Skip to Content
kosemdocs
ReferenceAPIEnvironments

Reset environment

Purges an environment and starts it again from its image, at once if it runs. Where kosem keeps environments' roots on their disks (rootOnDisk in GetEnvironmentDefaults), what commands changed goes, /workspace, the home and Docker's data included; elsewhere, /workspace and the home stay. An image named by a tag is pulled again, rather than the digest that the environment's first start pinned it to. A stopped environment starts, which takes its vCPUs from the organization's quota as a start does.

POST
/v1/projects/{project}/environments/{environment}/reset

Purges an environment and starts it again from its image, at once if it runs.

Where kosem keeps environments' roots on their disks (rootOnDisk in GetEnvironmentDefaults), what commands changed goes, /workspace, the home and Docker's data included; elsewhere, /workspace and the home stay. An image named by a tag is pulled again, rather than the digest that the environment's first start pinned it to. A stopped environment starts, which takes its vCPUs from the organization's quota as a start does.

Authorization

bearer
headerAuthorizationBearer <token>

An access token, or an API key.

Path Parameters

project*string

The project's ID.

Match^prj_[0-7][0-9a-hjkmnp-tv-z]{25}$
environment*string

The environment's ID.

Match^env_[0-7][0-9a-hjkmnp-tv-z]{25}$

Response Body

OK

application/json
  1. response
createTime*string

When the environment was created.

Formatdate-time
displayName*string

Name shown in user interfaces.

idleTimeoutSeconds*integer

How long, in seconds, the environment runs unused before kosem stops it, keeping its disk; 0 if kosem never does. Unused is since lastUsedTime, with no background job running whose end its owner is told of: a job that nobody waits for, such as a server, stops with it.

Formatint64
image*string

Container image reference, with a tag or digest, which supplies the environment's OS, packages and tools; its entrypoint and command are not run. The environment keeps it; a digest makes restarts reproducible.

lastUsedTime?string

When the environment was last used: when its owner last started it, ran a command in it or reached its files, or a command last ran in it for a caller; absent until it is used. A background job that runs on in it doesn't use it.

Formatdate-time
name*string

Resource name, projects/{project_id}/environments/{environment_id}.

owner*string

The principal that owns the environment, such as an agent, agent:{agent_id}, which alone runs commands in it and makes and starts it as it needs to; empty for environments that people create. People may still stop and delete it.

runner?string

The runner of its pool that holds its disk, once kosem placed it.

runnerPool?string

The runner pool it runs in, on hosts of its organization's or its project's own; absent on kosem's machines.

runningJobs?integer

How many background jobs run in the environment, such as servers and builds that its owner left running, as the environment last said; 0 unless it is RUNNING. Each runs until it ends, its owner ends it or the environment stops.

Formatint32
size*

How large the environment and its disk are.

state*string

Where the environment is in its lifecycle: PROVISIONING while its disk and compute are made, RUNNING, STOPPING while its compute is removed, STOPPED with only its disk, STARTING again on its disk, and DELETING with its disk.

Value in"PROVISIONING""RUNNING""STOPPING""STOPPED""STARTING""DELETING"
stateReason*string

What the environment waits for, such as capacity, or what keeps it from getting there, which it keeps trying past.

stoppedTtlSeconds*integer

How long, in seconds, the environment is kept stopped before kosem deletes it, with its disk; 0 if it is kept until someone deletes it.

Formatint64
updateTime*string

When the environment was last changed.

Formatdate-time
Example Request
curl -X POST 'https://api.kosem.ai/v1/projects/string/environments/string/reset'
Example Response
{
  "createTime": "2019-08-24T14:15:22Z",
  "displayName": "string",
  "idleTimeoutSeconds": 0,
  "image": "string",
  "lastUsedTime": "2019-08-24T14:15:22Z",
  "name": "string",
  "owner": "string",
  "runner": "string",
  "runnerPool": "string",
  "runningJobs": 0,
  "size": {
    "diskGib": 0,
    "memoryMib": 0,
    "vcpus": 0
  },
  "state": "PROVISIONING",
  "stateReason": "string",
  "stoppedTtlSeconds": 0,
  "updateTime": "2019-08-24T14:15:22Z"
}