콘텐츠로 이동

기기 수정

PATCH
/api/v1/devices/{device_id}
curl --request PATCH \
--url https://dev.api.endueos.com/api/v1/devices/res_01J9ZK3Q8M4XW7D2N5R6T0V1BC \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "research-box-2" }'

이름·설명·라벨을 바꾼다. size 는 virtual 만 (다음 시작부터) — actual 에 주면 409 DEVICE_STATE_CONFLICT. size 는 API 키로 바꿀 수 없다.

가이드 — 기기

device_id
필수

Device 의 id — Resource 와 같은 res_ 다 (v0.1.0 이 이미 냈다).

string
/^res_[0-9A-HJKMNP-TV-Z]{26}$/
예시
res_01J9ZK3Q8M4XW7D2N5R6T0V1BC
Media typeapplication/json
object
name
string
>= 1 characters <= 100 characters
description
Any of:
string
labels
object
size

Virtual 만 — 다음 시작부터 적용된다. actual 에 주면 409 DEVICE_STATE_CONFLICT.

string
허용 값: small medium large
예시
{
"name": "research-box-2"
}

성공.

Media typeapplication/json
object
data
필수

OS 가 관리하는 기기. actual(사용자의 기기)과 virtual(플랫폼이 띄운 VM) 둘이다. id 는 Resource 와 같은 res_ 다 — /resources/{resource_id} 는 같은 기기를 v0.1.0 의 Resource 모양으로 보여 준다.

object
device_id
필수

Device 의 id — Resource 와 같은 res_ 다 (v0.1.0 이 이미 냈다).

string
/^res_[0-9A-HJKMNP-TV-Z]{26}$/
station_id
필수
string
/^stn_[0-9A-HJKMNP-TV-Z]{26}$/
type
필수
string
허용 값: actual virtual
kind
필수
string
허용 값: chrome mac android linux windows
name
필수
string
description
필수
Any of:
string
labels
필수
object
status
필수

등록 상태 (Resource 의 status 와 같다).

string
허용 값: pending active disabled
online
필수

에이전트가 접속해 있고 핸드셰이크를 마쳤다. Resource 의 online 과 같은 규칙.

boolean
compute_status
필수
Any of:

Virtual Device 의 컴퓨트 상태. actual 이면 compute_status 가 null 이다.

string
허용 값: provisioning starting running stopping stopped failed deleting
status_reason
필수
Any of:
string
size
필수
Any of:

컴퓨트 크기. small 1 vCPU·1 GiB, medium 2 vCPU·4 GiB, large 4 vCPU·8 GiB — 공급자가 가장 가까운 사양으로 맞춘다.

string
허용 값: small medium large
workloads
필수

Actual 은 agent 하나, virtual 은 vm·storage(없을 수 있다)·agent.

Array<object>
One of: discriminator: type

Virtual Device 의 컴퓨트 한 대.

object
type
필수
string
허용 값: vm
workload_id
필수
string
/^wkl_[0-9A-HJKMNP-TV-Z]{26}$/
status
필수
string
허용 값: pending starting running stopping stopped failed destroyed
provider
필수

컴퓨트 공급자 — local(로컬 컨테이너)·fly·aws·vultr 등.

string
region
필수
Any of:
string
cpus
필수
integer format: int32
memory_mb
필수
integer format: int32
started_at
필수
Any of:
string format: date-time
stopped_at
필수
Any of:
string format: date-time
agent_version
필수
Any of:
string
os
필수
Any of:
string
arch
필수
Any of:
string
facts
필수

에이전트가 알려 준 기기 정보. 끊겨도 지워지지 않는다.

object
tool_count
필수
integer format: int32
last_connected_at
필수
Any of:
string format: date-time
last_seen_at
필수
Any of:
string format: date-time
last_disconnected_at
필수
Any of:
string format: date-time
started_at
필수
Any of:
string format: date-time
stopped_at
필수
Any of:
string format: date-time
created_at
필수
string format: date-time
updated_at
필수
string format: date-time
meta
필수
object
request_id
필수
string
timestamp
필수
string format: date-time
duration

서버 처리 시간(ms).

integer format: int32
예시
{
"data": {
"device_id": "res_01J9ZK3Q8M4XW7D2N5R6T0V1BC",
"station_id": "stn_01J9ZK3Q8M4XW7D2N5R6T0V1BC",
"type": "actual",
"kind": "chrome",
"status": "pending",
"compute_status": "provisioning",
"size": "small",
"workloads": [
{
"type": "vm",
"workload_id": "wkl_01J9ZK3Q8M4XW7D2N5R6T0V1BC",
"status": "pending"
}
]
}
}

요청 형식이 틀렸다 — VALIDATION_ERROR(details.errors[]) 또는 BAD_REQUEST. 본문은 오류 봉투.

인증이 없거나 무효다 — UNAUTHORIZED. 본문은 오류 봉투.

이 인증 수단으로는 못 하는 일이다 — FORBIDDEN (예: API 키로 클라우드 기기 만들기). 본문은 오류 봉투.

없거나 내 것이 아니다 — *_NOT_FOUND. 본문은 오류 봉투.

지금 상태와 충돌한다 — 코드는 위 설명을 본다. 본문은 오류 봉투.

한도를 넘었다 — Retry-After 초 뒤에 다시. 본문은 오류 봉투.

서버 오류 — INTERNAL_ERROR. 본문은 오류 봉투.

의존 서비스에 닿지 못했다 — 잠시 뒤 다시. 본문은 오류 봉투.