Reference For: developers

API: tenants

Operations of the tenants tag of the native REST API.

Multi-tenant self-service (docs/cloud/SELF_SERVICE.md section 2): tenants with their folders and pools, quota, suspend/resume/close, tenant users and API tokens, monthly usage

GET /v1/tenants

Every tenant (Kyvernon.Tenant.Read).

CLI
kyvernon tenants list

Responses

StatusDescriptionSchema
200OKarray of TenantView
403Permission denied; args.privilege names the missing privilegeErrorBody

POST /v1/tenants

Creates a tenant: a folder Tenants/<name> per datacenter and a resource pool per cluster (Kyvernon.Tenant.Create).

CLI
kyvernon tenants create <name>

Request body

application/json: CreateTenantRequest

NameTypeRequiredDescription
anchorDayinteger (int32) or nullDay of the month (1 to 28) the traffic period starts (default: the 1st).
displayNamestringDisplay name.
externalRefstringThe portal's account id.
labelsobjectLabels.
namestringyesShort name ([a-z0-9-], 1..=63), also the name of its folders and pools.
quotaQuotaViewLimits (default: unlimited).

Responses

StatusDescriptionSchema
201CreatedTenantView
400Invalid argument; the error body names the fieldErrorBody
409Conflict: the object exists, or expectedVersion is staleErrorBody

GET /v1/tenants/{tenant}

One tenant with its quota and current use (operators, and the tenant's own users).

CLI
kyvernon tenants get <tenant>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)

Responses

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

POST /v1/tenants/{tenant}/close

Closes a tenant: VMs are powered off now and destroyed with their disks after the grace period; users cannot log in any more (Kyvernon.Tenant.Close).

CLI
kyvernon tenants close <tenant>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)

Request body

application/json: CloseTenantRequest

NameTypeRequiredDescription
graceSecondsinteger (int64) or nullSeconds until VMs and disks are destroyed (default: the controller's [tenancy] close_grace, 7 days).

Responses

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

PUT /v1/tenants/{tenant}/quota

Replaces the quota (Kyvernon.Tenant.SetQuota); null is unlimited.

CLI
kyvernon tenants quota <tenant> --body <json>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)

Request body

application/json: QuotaView

NameTypeRequiredDescription
diskGibinteger (int64) or nullDisk (GiB).
fwGroupMembersinteger (int64) or nullFirewall group members (null: 1,000).
fwGroupsinteger (int64) or nullFirewall groups (null: 100).
fwPoliciesinteger (int64) or nullFirewall policies (null: 50).
fwRulesinteger (int64) or nullFirewall rules (null: 500).
memoryMibinteger (int64) or nullMemory (MiB).
publicIpv4integer (int64) or nullPublic IPv4 addresses.
snapshotsinteger (int64) or nullSnapshots.
trafficGibMonthinteger (int64) or nullTraffic per month (GiB; enforced by the traffic accounting).
vcpusinteger (int64) or nullvCPUs.
vmsinteger (int64) or nullVMs.

Responses

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

POST /v1/tenants/{tenant}/resume

Resumes a suspended tenant and starts the VMs that ran at suspend (Kyvernon.Tenant.Resume).

CLI
kyvernon tenants resume <tenant>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)

Responses

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

POST /v1/tenants/{tenant}/suspend

Suspends a tenant: running VMs are shut down (through the guest, then hard) and their power state recorded; users become read-only; power-on and console are refused (Kyvernon.Tenant.Suspend).

CLI
kyvernon tenants suspend <tenant>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)

Responses

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

GET /v1/tenants/{tenant}/usage

Usage of a month per server: hours per plan (proration over a resize), snapshot GiB-hours, and the network side's traffic and extra-IP figures (Kyvernon.Usage.Read on the tenant).

CLI
kyvernon tenants usage <tenant>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)
monthquerystring or nullYYYY-MM (UTC; default: the current month, up to now).

Responses

StatusDescriptionSchema
200OKTenantUsageView
400Invalid argument; the error body names the fieldErrorBody
404Not found (or not visible to the caller)ErrorBody

GET /v1/tenants/{tenant}/users

The tenant's accounts (Kyvernon.Tenant.ManageUsers on the tenant).

CLI
kyvernon tenants users <tenant> list

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)

Responses

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

POST /v1/tenants/{tenant}/users

Creates an account of the tenant; its role (admin, user, read-only) is granted on the tenant's folders and pools only.

CLI
kyvernon tenants users <tenant> create <username>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)

Request body

application/json: CreateTenantUserRequest

NameTypeRequiredDescription
displayNamestringDisplay name.
emailstringE-mail.
passwordstringyesInitial password.
rolestringadmin (Tenant administrator), user (Tenant user) or read-only.
rotationRequiredbooleanThe password must be changed at first login.
serviceAccountbooleanAutomation account (API logins only).
usernamestringyesLogin name.

Responses

StatusDescriptionSchema
201CreatedUserView
400Invalid argument; the error body names the fieldErrorBody
409Conflict: the object exists, or expectedVersion is staleErrorBody

DELETE /v1/tenants/{tenant}/users/{username}

Deletes an account of the tenant.

CLI
kyvernon tenants users <tenant> delete <username>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)
usernamepathstringyesUser name of the account

Responses

StatusDescriptionSchema
204Done; no body
404Not found (or not visible to the caller)ErrorBody

GET /v1/tenants/{tenant}/users/{username}/api-tokens

API tokens of a tenant account.

CLI
kyvernon tenants users <tenant> api-tokens <username> list

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)
usernamepathstringyesUser name of the account

Responses

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

POST /v1/tenants/{tenant}/users/{username}/api-tokens

Creates an API token for a tenant account (the token is shown once).

CLI
kyvernon tenants users <tenant> api-tokens <username> create <name>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)
usernamepathstringyesUser name of the account

Request body

application/json: CreateApiTokenRequest

NameTypeRequiredDescription
namestringyesLabel (1..=64 characters).
ttlSecondsinteger (int64) or nullLifetime in seconds, 1 up to the controller maximum ([identity.policy] api_token_max_ttl, 365 days unless configured otherwise). Absent: the maximum. Every token expires; a longer lifetime is refused (error.api_token.ttl).

Responses

StatusDescriptionSchema
201CreatedCreateApiTokenResponse
404Not found (or not visible to the caller)ErrorBody

DELETE /v1/tenants/{tenant}/users/{username}/api-tokens/{id}

Revokes an API token of a tenant account.

CLI
kyvernon tenants users <tenant> api-tokens <username> delete <id>

Parameters

NameInTypeRequiredDescription
tenantpathstringyesId of the tenant (tenant-N)
usernamepathstringyesUser name of the account
idpathstringyesId of the API token

Responses

StatusDescriptionSchema
204Done; no body
404Not found (or not visible to the caller)ErrorBody

Version 0.1.