Reference For: developers

API: servers

Operations of the servers tag of the native REST API.

Tenant-scoped self-service servers (section 3): create from a plan and a catalogue image, power, reinstall, resize, rescue, password reset, snapshots, console, delete; every operation is a task

GET /v1/tenants/{tenant}/servers

The tenant's servers.

CLI
kyvernon servers <tenant> list

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)
includeDeletedqueryboolean or nullInclude deleted servers (kept for usage).

Responses

StatusDescriptionSchema
200OKarray of ServerView
404Not found (or not visible to the caller)ErrorBody

POST /v1/tenants/{tenant}/servers

Creates a server from a plan and a catalogue image (quota-checked; a task). A generated password is in the answer, once.

CLI
kyvernon servers <tenant> create <hostname> --plan <plan> --image <image>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)

Request body

application/json: CreateServerRequest

NameTypeRequiredDescription
hostnamestringyesHost name (RFC 1123 label), also the VM's name.
imagestringyesCatalogue image (vm-N of the template).
locationstring or nullDatacenter (datacenter-N; default: the tenant's first).
passwordbooleanGenerate a password (always when no SSH keys are given); it is returned once.
planstringyesPlan (vmplan-N).
sshKeysarray of stringSSH public keys for the default user and root.
userDatastring or nullcloud-init user data (guestinfo.userdata, at most 64 KiB).

Responses

StatusDescriptionSchema
202Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait)ServerTaskView
400Invalid argument; the error body names the fieldErrorBody
404Not found (or not visible to the caller)ErrorBody
409Conflict: the object exists, or expectedVersion is staleErrorBody
412error.quota.exceeded (args resource, limit, current, requested), error.tenant.suspendedErrorBody

GET /v1/tenants/{tenant}/servers/{server}

One server.

CLI
kyvernon servers <tenant> get <server>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)
serverpathstringyesId of the server of the tenant

Responses

StatusDescriptionSchema
200OKServerView
404Not found (or not visible to the caller)ErrorBody

DELETE /v1/tenants/{tenant}/servers/{server}

Deletes a server and its disks; its addresses go back to the pool.

CLI
kyvernon servers <tenant> delete <server>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)
serverpathstringyesId of the server of the tenant

Responses

StatusDescriptionSchema
202Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait)ServerTaskView
404Not found (or not visible to the caller)ErrorBody

POST /v1/tenants/{tenant}/servers/{server}/console

A console ticket for the server (refused while the tenant is suspended). Callers that are not users of the tenant also need Kyvernon.Tenant.Impersonate.

CLI
kyvernon servers <tenant> console <server>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)
serverpathstringyesId of the server of the tenant

Responses

StatusDescriptionSchema
200OKConsoleTicketView
403Permission denied; args.privilege names the missing privilegeErrorBody
412Failed precondition; the error body says whichErrorBody

POST /v1/tenants/{tenant}/servers/{server}/power

A power action: on, off, shutdown, reboot or reset.

CLI
kyvernon servers <tenant> power <server> <action>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)
serverpathstringyesId of the server of the tenant

Request body

application/json: ServerPowerRequest

NameTypeRequiredDescription
actionstringyeson, off (hard), shutdown (through the guest, then hard), reboot or reset.

Responses

StatusDescriptionSchema
202Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait)ServerTaskView
412Failed precondition; the error body says whichErrorBody

POST /v1/tenants/{tenant}/servers/{server}/reinstall

Reinstalls the server from an image; its addresses stay.

CLI
kyvernon servers <tenant> reinstall <server>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)
serverpathstringyesId of the server of the tenant

Request body

application/json: ReinstallServerRequest

NameTypeRequiredDescription
imagestring or nullImage (default: the current one).
passwordbooleanGenerate a password (always when no SSH keys are given).
sshKeysarray of stringSSH public keys.
userDatastring or nullcloud-init user data.

Responses

StatusDescriptionSchema
202Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait)ServerTaskView
412Failed precondition; the error body says whichErrorBody

POST /v1/tenants/{tenant}/servers/{server}/rescue

Boots a rescue image with the server's disk attached (the server is shut down).

CLI
kyvernon servers <tenant> rescue <server>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)
serverpathstringyesId of the server of the tenant

Request body

application/json: RescueServerRequest

NameTypeRequiredDescription
imagestring or nullRescue image (default: the first catalogue entry marked rescue).

Responses

StatusDescriptionSchema
202Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait)ServerTaskView
412Failed precondition; the error body says whichErrorBody

POST /v1/tenants/{tenant}/servers/{server}/reset-password

Sets a new generated password (through the guest agent now, else cloud-init at the next boot); returned once.

CLI
kyvernon servers <tenant> reset-password <server>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)
serverpathstringyesId of the server of the tenant

Responses

StatusDescriptionSchema
202Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait)ServerTaskView
412Failed precondition; the error body says whichErrorBody

POST /v1/tenants/{tenant}/servers/{server}/resize

Moves the server to a larger plan: the disk grows (never shrinks) and the server reboots (rebootRequired: true).

CLI
kyvernon servers <tenant> resize <server> <plan>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)
serverpathstringyesId of the server of the tenant

Request body

application/json: ResizeServerRequest

NameTypeRequiredDescription
planstringyesThe larger plan.

Responses

StatusDescriptionSchema
202Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait)ServerTaskView
400error.server.plan_not_largerErrorBody
412Failed precondition; the error body says whichErrorBody

POST /v1/tenants/{tenant}/servers/{server}/snapshots

Takes a snapshot (within the snapshots quota).

CLI
kyvernon servers <tenant> snapshot <server> <name>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)
serverpathstringyesId of the server of the tenant

Request body

application/json: ServerSnapshotRequest

NameTypeRequiredDescription
namestringyesSnapshot name (1..=80 characters).

Responses

StatusDescriptionSchema
202Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait)ServerTaskView
412Failed precondition; the error body says whichErrorBody

DELETE /v1/tenants/{tenant}/servers/{server}/snapshots/{key}

Removes a snapshot.

CLI
kyvernon servers <tenant> remove-snapshot <server> <key>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)
serverpathstringyesId of the server of the tenant
keypathinteger (int32)yesKey of the snapshot in the snapshot tree

Responses

StatusDescriptionSchema
202Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait)ServerTaskView
404Not found (or not visible to the caller)ErrorBody

POST /v1/tenants/{tenant}/servers/{server}/snapshots/{key}/revert

Reverts the server to a snapshot.

CLI
kyvernon servers <tenant> revert-snapshot <server> <key>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)
serverpathstringyesId of the server of the tenant
keypathinteger (int32)yesKey of the snapshot in the snapshot tree

Responses

StatusDescriptionSchema
202Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait)ServerTaskView
404Not found (or not visible to the caller)ErrorBody

POST /v1/tenants/{tenant}/servers/{server}/unrescue

Ends rescue mode and starts the server again.

CLI
kyvernon servers <tenant> unrescue <server>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)
serverpathstringyesId of the server of the tenant

Responses

StatusDescriptionSchema
202Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait)ServerTaskView
412Failed precondition; the error body says whichErrorBody

Version 0.1.