Computadores codespaces
Use a API REST para gerenciar a disponibilidade de tipos de computador para um codespace.
Sobre os computadores Codespaces
Você pode determinar quais tipos de máquina estão disponíveis para criar um codespace, seja em um determinado repositório ou como um usuário autenticado. Para obter mais informações, confira "Alterando o tipo de máquina para seu codespace".
Use também essas informações ao alterar o computador de um codespace existente atualizando a propriedade machine
. A atualização da máquina ocorrerá na próxima vez que o codespace for reiniciado. Para obter mais informações, confira "Alterando o tipo de máquina para seu 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.
Parâmetros para "List available machine types for a repository"
Nome, Type, Descrição |
---|
accept string Setting to |
Nome, Type, Descrição |
---|
owner string ObrigatórioThe account owner of the repository. The name is not case sensitive. |
repo string ObrigatórioThe name of the repository without the |
Nome, Type, Descrição |
---|
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. |
Códigos de status de resposta HTTP para "List available machine types for a repository"
Código de status | Descrição |
---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
500 | Internal Error |
Exemplos de código para "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.
Parâmetros para "List machine types for a codespace"
Nome, Type, Descrição |
---|
accept string Setting to |
Nome, Type, Descrição |
---|
codespace_name string ObrigatórioThe name of the codespace. |
Códigos de status de resposta HTTP para "List machine types for a codespace"
Código de status | Descrição |
---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
500 | Internal Error |
Exemplos de código para "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
}
]
}