本APIの利用には、さくらのクラウドの APIキー が必要です。
APIキーの発行についてはマニュアルをご覧ください。
APIキーの「アクセストークン」をユーザーID、「アクセストークンシークレット」をパスワードとした Basic認証 で本APIをご利用ください。
{- "user": { },
- "member": {
- "member_id": "abc12345"
}, - "account": {
- "account_id": "113200564612",
- "member": {
- "member_id": "abc12345"
}, - "account_code": "example-account",
- "account_name": "テストアカウント",
- "tos_agreed_at": "2024-10-10T13:50:40.250+09:00",
- "tos_agreed_version": "vXXXXXXXX",
- "created_at": "2024-10-10T13:50:40.250+09:00"
}
}利用規約に同意します。
必ず内容を熟読の上、同意できる場合のみ本APIをコールしてください。
同意するまで(本APIをコールするまで)、本サービスの各種操作は行えません。
| version | string Example: version=vXXXXXXX 同意した利用規約のバージョン |
{- "meta": {
- "page": 1,
- "page_size": 100,
- "total_pages": 1,
- "count": 0,
- "next": "string",
- "previous": "string"
}, - "results": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "created_at": "2024-10-10T13:50:40.250+09:00",
- "updated_at": "2024-10-10T13:50:40.250+09:00",
- "hostname": "example.sakuracr.jp",
- "username": "user01"
}
]
}認証が必要なコンテナーレジストリーの、認証情報を登録します。
プライベートなレジストリーに格納したコンテナーイメージを実行する場合、事前にこのAPIで認証情報を登録してください。
公開レジストリーのイメージを実行する場合は本操作は不要です。
| hostname required | string |
| username required | string |
| password required | string |
{- "hostname": "example.sakuracr.jp",
- "username": "user01",
- "password": "p@ssw0rd"
}{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "created_at": "2024-10-10T13:50:40.250+09:00",
- "updated_at": "2024-10-10T13:50:40.250+09:00",
- "hostname": "example.sakuracr.jp",
- "username": "user01"
}指定IDのコンテナーレジストリーの認証情報を取得します。
| registryId required | string <uuid> レジストリーID(登録APIのレスポンス内の |
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "created_at": "2024-10-10T13:50:40.250+09:00",
- "updated_at": "2024-10-10T13:50:40.250+09:00",
- "hostname": "example.sakuracr.jp",
- "username": "user01"
}登録済みの認証情報を変更します。
登録時に間違えた場合や、コンテナーレジストリーのパスワードを変更した場合などにお使いください。
| registryId required | string <uuid> レジストリーID(登録APIのレスポンス内の |
| hostname required | string |
| username required | string |
| password required | string |
{- "hostname": "example.sakuracr.jp",
- "username": "user01",
- "password": "p@ssw0rd"
}{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "created_at": "2024-10-10T13:50:40.250+09:00",
- "updated_at": "2024-10-10T13:50:40.250+09:00",
- "hostname": "example.sakuracr.jp",
- "username": "user01"
}登録済みのタスクの一覧情報を取得します。
| page | integer Default: 1 ページ番号(1 origin) |
| page_size | integer Default: 100 1ページのサイズ |
| tasks | string Example: tasks=task
|
| include_artifact | boolean アーティファクトが存在するタスクのみ表示する場合は true |
| created_after | string <iso8601> (DateTime) Example: created_after=2024-10-10T13:50:40.250+09:00 作成日時 (開始) |
| created_before | string <iso8601> (DateTime) Example: created_before=2024-10-10T13:50:40.250+09:00 作成日時 (終了) |
| status | Array of strings (TaskStatus) Items Enum: "waiting" "running" "error" "done" "aborted" "canceled" ステータスでの絞り込み |
| plan | Array of strings (PlanID) Items Enum: "v100-32gb" "h100-80gb" プランでの絞り込み |
| tag | string Example: tag=tag1 タグでの絞り込み |
{- "meta": {
- "page": 1,
- "page_size": 100,
- "total_pages": 1,
- "count": 0,
- "next": "string",
- "previous": "string"
}, - "results": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "created_at": "2024-10-10T13:50:40.250+09:00",
- "updated_at": "2024-10-10T13:50:40.250+09:00",
- "canceled_at": "2024-10-10T13:50:40.250+09:00",
- "containers": [
- {
- "index": 0,
- "image": "nginx:latest",
- "registry": "934d3911-0458-420e-99e0-5bce875442c8",
- "command": [
- "/bin/sh",
- "-c",
- "env"
], - "entrypoint": [
- "sh",
- "-c"
], - "environment": {
- "EXAMPLE_ENV": "example"
}, - "http": {
- "port": 80,
- "path": "/"
}, - "ssh": {
- "shell": "/bin/sh",
- "host_name": "string",
- "port": 0
}, - "plan": "v100-32gb",
- "exit_code": 0,
- "execution_seconds": null,
- "start_at": "2024-10-10T13:50:40.250+09:00",
- "stop_at": "2024-10-10T13:50:40.250+09:00"
}
], - "status": "waiting",
- "tags": [
- "tag1",
- "tag2",
- "tag3"
], - "error_message": "invalid registry permission",
- "artifact": {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "task": "4879b8a6-fb3e-4a0d-aef8-b0ea469ac85c",
- "created_at": "2024-10-10T13:50:40.250+09:00",
- "deleted_at": "2024-10-10T13:50:40.250+09:00",
- "filename": "artifact.tar.gz",
- "size_bytes": 0
}, - "execution_time_limit_sec": null
}
]
}新しいタスクを登録します。
タスク実行の詳細についてはマニュアルをご覧ください。
| name required | string |
required | Array of objects (ContainerDefinition) |
| tags required | Array of strings |
| execution_time_limit_sec | integer or null Default: null |
{- "name": "string",
- "containers": [
- {
- "image": "nginx:latest",
- "registry": "934d3911-0458-420e-99e0-5bce875442c8",
- "command": [
- "/bin/sh",
- "-c",
- "env"
], - "entrypoint": [
- "sh",
- "-c"
], - "environment": {
- "EXAMPLE_ENV": "example"
}, - "http": {
- "port": 80,
- "path": "/"
}, - "ssh": {
- "shell": "/bin/sh",
- "host_name": "string",
- "port": 0
}, - "plan": "v100-32gb"
}
], - "tags": [
- "tag1",
- "tag2",
- "tag3"
], - "execution_time_limit_sec": null
}{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "created_at": "2024-10-10T13:50:40.250+09:00",
- "updated_at": "2024-10-10T13:50:40.250+09:00",
- "canceled_at": "2024-10-10T13:50:40.250+09:00",
- "containers": [
- {
- "index": 0,
- "image": "nginx:latest",
- "registry": "934d3911-0458-420e-99e0-5bce875442c8",
- "command": [
- "/bin/sh",
- "-c",
- "env"
], - "entrypoint": [
- "sh",
- "-c"
], - "environment": {
- "EXAMPLE_ENV": "example"
}, - "http": {
- "port": 80,
- "path": "/"
}, - "ssh": {
- "shell": "/bin/sh",
- "host_name": "string",
- "port": 0
}, - "plan": "v100-32gb",
- "exit_code": 0,
- "execution_seconds": null,
- "start_at": "2024-10-10T13:50:40.250+09:00",
- "stop_at": "2024-10-10T13:50:40.250+09:00"
}
], - "status": "waiting",
- "tags": [
- "tag1",
- "tag2",
- "tag3"
], - "error_message": "invalid registry permission",
- "artifact": {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "task": "4879b8a6-fb3e-4a0d-aef8-b0ea469ac85c",
- "created_at": "2024-10-10T13:50:40.250+09:00",
- "deleted_at": "2024-10-10T13:50:40.250+09:00",
- "filename": "artifact.tar.gz",
- "size_bytes": 0
}, - "execution_time_limit_sec": null
}登録したタスクの情報を取得します。
| taskId required | string <uuid> タスクID(登録APIのレスポンス内の |
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "created_at": "2024-10-10T13:50:40.250+09:00",
- "updated_at": "2024-10-10T13:50:40.250+09:00",
- "canceled_at": "2024-10-10T13:50:40.250+09:00",
- "containers": [
- {
- "index": 0,
- "image": "nginx:latest",
- "registry": "934d3911-0458-420e-99e0-5bce875442c8",
- "command": [
- "/bin/sh",
- "-c",
- "env"
], - "entrypoint": [
- "sh",
- "-c"
], - "environment": {
- "EXAMPLE_ENV": "example"
}, - "http": {
- "port": 80,
- "path": "/"
}, - "ssh": {
- "shell": "/bin/sh",
- "host_name": "string",
- "port": 0
}, - "plan": "v100-32gb",
- "exit_code": 0,
- "execution_seconds": null,
- "start_at": "2024-10-10T13:50:40.250+09:00",
- "stop_at": "2024-10-10T13:50:40.250+09:00"
}
], - "status": "waiting",
- "tags": [
- "tag1",
- "tag2",
- "tag3"
], - "error_message": "invalid registry permission",
- "artifact": {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "task": "4879b8a6-fb3e-4a0d-aef8-b0ea469ac85c",
- "created_at": "2024-10-10T13:50:40.250+09:00",
- "deleted_at": "2024-10-10T13:50:40.250+09:00",
- "filename": "artifact.tar.gz",
- "size_bytes": 0
}, - "execution_time_limit_sec": null
}タスクの情報を削除します。
本APIの呼び出し後は、同じタスクIDは本サービスで使えなくなります。
注)本APIは、実行中のタスクをキャンセルするAPIではありません。
タスクをキャンセルしたい場合は、タスクのキャンセルAPIをコールしてください。
| taskId required | string <uuid> |
実行中のタスクをキャンセルします。
| taskId required | string <uuid> |
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "created_at": "2024-10-10T13:50:40.250+09:00",
- "updated_at": "2024-10-10T13:50:40.250+09:00",
- "canceled_at": "2024-10-10T13:50:40.250+09:00",
- "containers": [
- {
- "index": 0,
- "image": "nginx:latest",
- "registry": "934d3911-0458-420e-99e0-5bce875442c8",
- "command": [
- "/bin/sh",
- "-c",
- "env"
], - "entrypoint": [
- "sh",
- "-c"
], - "environment": {
- "EXAMPLE_ENV": "example"
}, - "http": {
- "port": 80,
- "path": "/"
}, - "ssh": {
- "shell": "/bin/sh",
- "host_name": "string",
- "port": 0
}, - "plan": "v100-32gb",
- "exit_code": 0,
- "execution_seconds": null,
- "start_at": "2024-10-10T13:50:40.250+09:00",
- "stop_at": "2024-10-10T13:50:40.250+09:00"
}
], - "status": "waiting",
- "tags": [
- "tag1",
- "tag2",
- "tag3"
], - "error_message": "invalid registry permission",
- "artifact": {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "task": "4879b8a6-fb3e-4a0d-aef8-b0ea469ac85c",
- "created_at": "2024-10-10T13:50:40.250+09:00",
- "deleted_at": "2024-10-10T13:50:40.250+09:00",
- "filename": "artifact.tar.gz",
- "size_bytes": 0
}, - "execution_time_limit_sec": null
}タスクに関連するファイル(出力ファイル)のダウンロードURLを取得します。
| taskId required | string <uuid> |
| target required | string Value: "output" |
| filename | string Example: filename=output.txt 指定するとContentDispositionヘッダにファイル名として指定されます |
アーティファクト(タスクの生成物)の操作に関するAPIです。
本APIでアーティファクトを操作するためには、タスク内で所定のディレクトリーにアーティファクトを保存いただく必要があります。
詳しくはSAKURA_ARTIFACT_DIR に関する説明を参照ください。
アーティファクト情報の一覧を取得します。
| page | integer Default: 1 ページ番号 |
| page_size | integer Default: 100 1ページのサイズ |
| task | string <uuid> 指定するとタスクIDで絞り込みます |
{- "meta": {
- "page": 1,
- "page_size": 100,
- "total_pages": 1,
- "count": 0,
- "next": "string",
- "previous": "string"
}, - "results": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "task": "4879b8a6-fb3e-4a0d-aef8-b0ea469ac85c",
- "created_at": "2024-10-10T13:50:40.250+09:00",
- "deleted_at": "2024-10-10T13:50:40.250+09:00",
- "filename": "artifact.tar.gz",
- "size_bytes": 0
}
]
}アーティファクトの情報を取得します。
| artifactId required | string <uuid> |
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "task": "4879b8a6-fb3e-4a0d-aef8-b0ea469ac85c",
- "created_at": "2024-10-10T13:50:40.250+09:00",
- "deleted_at": "2024-10-10T13:50:40.250+09:00",
- "filename": "artifact.tar.gz",
- "size_bytes": 0
}{- "meta": {
- "page": 1,
- "page_size": 100,
- "total_pages": 1,
- "count": 0,
- "next": "string",
- "previous": "string"
}, - "results": [
- {
- "id": "v100-32gb",
- "name": "V100 (32GB)",
- "minimum_execution_seconds": 0
}
]
}登録済みのSSH公開鍵情報情報を取得します。
| page | integer Default: 1 ページ番号(1 origin) |
| page_size | integer Default: 100 1ページのサイズ |
| is_active | boolean 有効状態でフィルタリングします。
|
{- "meta": {
- "page": 1,
- "page_size": 100,
- "total_pages": 1,
- "count": 0,
- "next": "string",
- "previous": "string"
}, - "results": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "name": "key-001",
- "pub_key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuKpK2QW9+3aZJ2vLC4Rk9v2DlHh8ejZ3O8Qp8g7VRVqbgOHRqZL3FoyPb6jl8mUvUeT5LjYKX8cL7ozGnYtFqN2KqzVGpjJ9g+J3MlNhnfM8jGZoIf1nmfpA5gItkX5iLtJ9cPC3nVo4U9qxNT3kNdc7MkPaa2Te9Zz5eQdZbMFeBpjNjfK example-001@example.com",
- "is_active": true
}
]
}新しいSSH公開鍵情報を登録します。
name:
SSH公開鍵情報の名前を指定します。pub_key:
登録するSSH公開鍵を指定します。is_active:
登録するSSH公開鍵の有効/無効を設定します。
| name required | string |
| pub_key required | string |
| is_active required | boolean |
{- "name": "key-001",
- "pub_key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuKpK2QW9+3aZJ2vLC4Rk9v2DlHh8ejZ3O8Qp8g7VRVqbgOHRqZL3FoyPb6jl8mUvUeT5LjYKX8cL7ozGnYtFqN2KqzVGpjJ9g+J3MlNhnfM8jGZoIf1nmfpA5gItkX5iLtJ9cPC3nVo4U9qxNT3kNdc7MkPaa2Te9Zz5eQdZbMFeBpjNjfK example-001@example.com",
- "is_active": true
}{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "name": "key-001",
- "pub_key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuKpK2QW9+3aZJ2vLC4Rk9v2DlHh8ejZ3O8Qp8g7VRVqbgOHRqZL3FoyPb6jl8mUvUeT5LjYKX8cL7ozGnYtFqN2KqzVGpjJ9g+J3MlNhnfM8jGZoIf1nmfpA5gItkX5iLtJ9cPC3nVo4U9qxNT3kNdc7MkPaa2Te9Zz5eQdZbMFeBpjNjfK example-001@example.com",
- "is_active": true
}登録したSSH公開鍵の情報を取得します。
| keyID required | string <uuid> SSH公開鍵情報ID |
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "name": "key-001",
- "pub_key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuKpK2QW9+3aZJ2vLC4Rk9v2DlHh8ejZ3O8Qp8g7VRVqbgOHRqZL3FoyPb6jl8mUvUeT5LjYKX8cL7ozGnYtFqN2KqzVGpjJ9g+J3MlNhnfM8jGZoIf1nmfpA5gItkX5iLtJ9cPC3nVo4U9qxNT3kNdc7MkPaa2Te9Zz5eQdZbMFeBpjNjfK example-001@example.com",
- "is_active": true
}SSH公開鍵情報を更新します。
SSH公開鍵(pub_key)の変更はできません。
変更が必要な場合はSSH公開鍵情報の削除APIで削除の後、SSH公開鍵情報の登録APIで作成し直してください。
| keyID required | string <uuid> SSH公開鍵情報ID |
name:
SSH公開鍵情報の名前を指定します。is_active:
SSH公開鍵の有効/無効を設定します。
| name required | string |
| is_active required | boolean |
{- "name": "key-001",
- "is_active": true
}{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "name": "key-001",
- "pub_key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuKpK2QW9+3aZJ2vLC4Rk9v2DlHh8ejZ3O8Qp8g7VRVqbgOHRqZL3FoyPb6jl8mUvUeT5LjYKX8cL7ozGnYtFqN2KqzVGpjJ9g+J3MlNhnfM8jGZoIf1nmfpA5gItkX5iLtJ9cPC3nVo4U9qxNT3kNdc7MkPaa2Te9Zz5eQdZbMFeBpjNjfK example-001@example.com",
- "is_active": true
}指定年月の請求情報を取得します。
| year | integer Example: year=2024 取得対象の年 |
| month | integer Example: month=6 取得対象の月 |
| day | integer Example: day=1 取得対象の日 |
{- "meta": {
- "page": 1,
- "page_size": 100,
- "total_pages": 1,
- "count": 0,
- "next": "string",
- "previous": "string"
}, - "results": [
- {
- "account": "113200564612",
- "bill_close_at": "2019-08-24",
- "details": [
- {
- "sequence_no": 0,
- "plan": "v100-32gb",
- "usage_type": 0,
- "usage": 0,
- "amount": 0,
- "description": "string"
}
], - "last_upload_at": "2024-10-10T13:50:40.250+09:00"
}
]
}指定年月のプラン別単価(実行時間1秒あたりの金額)一覧を取得します。
| year | integer Example: year=2024 取得対象の年 |
| month | integer Example: month=6 取得対象の月 |
| day | integer Example: day=10 取得対象の日 |
{- "meta": {
- "page": 1,
- "page_size": 100,
- "total_pages": 1,
- "count": 0,
- "next": "string",
- "previous": "string"
}, - "results": [
- {
- "plan": "v100-32gb",
- "price": "0.06",
- "is_overridden": false,
- "begin_at": "2019-08-24",
- "end_at": "2019-08-24"
}
]
}