Codespaces マシン
REST API を使って、codespace 用に使えるマシン タイプを管理できます。
Codespaces マシンについて
特定のリポジトリに、または認証済みユーザーとして、codespace の作成に使えるマシン タイプを決めることができます。 詳しくは、「codespace のマシンの種類を変更する」を参照してください。
また、この情報は、既存の codespace のマシンを、その machine
プロパティを更新することで変更する場合にも、参照することができます。 マシンの更新は、次回 codepace が起動するときに実行されます。 詳しくは、「codespace のマシンの種類を変更する」を参照してください。
List available machine types for a repository
List the machine types available for a given repository based on its configuration.
You must authenticate using an access token with the codespace
scope to use this endpoint.
GitHub Apps must have write access to the codespaces_metadata
repository permission to use this endpoint.
"List available machine types for a repository" のパラメーター
名前, Type, 説明 |
---|
accept string Setting to |
名前, Type, 説明 |
---|
owner string 必須The account owner of the repository. The name is not case sensitive. |
repo string 必須The name of the repository without the |
名前, Type, 説明 |
---|
location string The location to check for available machines. Assigned by IP if not provided. |
client_ip string IP for location auto-detection when proxying a request |
ref string The branch or commit to check for prebuild availability and devcontainer restrictions. |
"List available machine types for a repository" の HTTP 応答状態コード
状態コード | 説明 |
---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
500 | Internal Error |
"List available machine types for a repository" のコード サンプル
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/codespaces/machines
Response
Status: 200
{
"total_count": 2,
"machines": [
{
"name": "standardLinux",
"display_name": "4 cores, 16 GB RAM, 64 GB storage",
"operating_system": "linux",
"storage_in_bytes": 68719476736,
"memory_in_bytes": 17179869184,
"cpus": 4
},
{
"name": "premiumLinux",
"display_name": "8 cores, 32 GB RAM, 64 GB storage",
"operating_system": "linux",
"storage_in_bytes": 68719476736,
"memory_in_bytes": 34359738368,
"cpus": 8
}
]
}
List machine types for a codespace
List the machine types a codespace can transition to use.
You must authenticate using an access token with the codespace
scope to use this endpoint.
GitHub Apps must have read access to the codespaces_metadata
repository permission to use this endpoint.
"List machine types for a codespace" のパラメーター
名前, Type, 説明 |
---|
accept string Setting to |
名前, Type, 説明 |
---|
codespace_name string 必須The name of the codespace. |
"List machine types for a codespace" の HTTP 応答状態コード
状態コード | 説明 |
---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
500 | Internal Error |
"List machine types for a codespace" のコード サンプル
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/user/codespaces/CODESPACE_NAME/machines
Response
Status: 200
{
"total_count": 2,
"machines": [
{
"name": "standardLinux",
"display_name": "4 cores, 16 GB RAM, 64 GB storage",
"operating_system": "linux",
"storage_in_bytes": 68719476736,
"memory_in_bytes": 17179869184,
"cpus": 4
},
{
"name": "premiumLinux",
"display_name": "8 cores, 32 GB RAM, 64 GB storage",
"operating_system": "linux",
"storage_in_bytes": 68719476736,
"memory_in_bytes": 34359738368,
"cpus": 8
}
]
}