# Environments ## CreateEnvironment `client.environments.create(EnvironmentCreateParamsbody, RequestOptionsoptions?): EnvironmentCreateResponse` **post** `/gitpod.v1.EnvironmentService/CreateEnvironment` Creates a development environment from a context URL (e.g. Git repository) and starts it. The `class` field must be a valid environment class ID. You can find a list of available environment classes with the `ListEnvironmentClasses` method. ### Examples - Create from context URL: Creates an environment from a Git repository URL with default settings. ```yaml spec: machine: class: "d2c94c27-3b76-4a42-b88c-95a85e392c68" content: initializer: specs: - contextUrl: url: "https://github.com/gitpod-io/gitpod" ``` - Create from Git repository: Creates an environment from a Git repository with specific branch targeting. ```yaml spec: machine: class: "d2c94c27-3b76-4a42-b88c-95a85e392c68" content: initializer: specs: - git: remoteUri: "https://github.com/gitpod-io/gitpod" cloneTarget: "main" targetMode: "CLONE_TARGET_MODE_REMOTE_BRANCH" ``` - Create with custom timeout and ports: Creates an environment with custom inactivity timeout and exposed port configuration. ```yaml spec: machine: class: "d2c94c27-3b76-4a42-b88c-95a85e392c68" content: initializer: specs: - contextUrl: url: "https://github.com/gitpod-io/gitpod" timeout: disconnected: "7200s" # 2 hours in seconds ports: - port: 3000 admission: "ADMISSION_LEVEL_EVERYONE" name: "Web App" ``` ### Parameters - `body: EnvironmentCreateParams` - `name?: string | null` name is a user-defined identifier for the environment. If not specified, the system will generate a name. - `sessionId?: string` session_id is the ID of the session this environment belongs to. If empty, a new session is created implicitly. - `spec?: EnvironmentSpec` spec is the configuration of the environment that's required for the to start the environment - `admission?: AdmissionLevel` admission controlls who can access the environment and its ports. - `"ADMISSION_LEVEL_UNSPECIFIED"` - `"ADMISSION_LEVEL_OWNER_ONLY"` - `"ADMISSION_LEVEL_EVERYONE"` - `"ADMISSION_LEVEL_ORGANIZATION"` - `"ADMISSION_LEVEL_CREATOR_ONLY"` - `automationsFile?: AutomationsFile` automations_file is the automations file spec of the environment - `automationsFilePath?: string` automations_file_path is the path to the automations file that is applied in the environment, relative to the repo root. path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `session?: string` - `triggerFilter?: Array` trigger_filter specifies which automation triggers should execute. When set, only automations matching these triggers will run. If empty/unset, all triggers are evaluated normally. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `content?: Content` content is the content spec of the environment - `gitEmail?: string` The Git email address - `gitUsername?: string` The Git username - `initializer?: EnvironmentInitializer` initializer configures how the environment is to be initialized - `specs?: Array` - `contextUrl?: ContextURL` - `url?: string` url is the URL from which the environment is created - `git?: Git` - `checkoutLocation?: string` a path relative to the environment root in which the code will be checked out to - `cloneTarget?: string` the value for the clone target mode - use depends on the target mode - `remoteUri?: string` remote_uri is the Git remote origin - `targetMode?: "CLONE_TARGET_MODE_UNSPECIFIED" | "CLONE_TARGET_MODE_REMOTE_HEAD" | "CLONE_TARGET_MODE_REMOTE_COMMIT" | 3 more` the target mode determines what gets checked out - `"CLONE_TARGET_MODE_UNSPECIFIED"` - `"CLONE_TARGET_MODE_REMOTE_HEAD"` - `"CLONE_TARGET_MODE_REMOTE_COMMIT"` - `"CLONE_TARGET_MODE_REMOTE_BRANCH"` - `"CLONE_TARGET_MODE_LOCAL_BRANCH"` - `"CLONE_TARGET_MODE_REMOTE_TAG"` - `upstreamRemoteUri?: string` upstream_Remote_uri is the fork upstream of a repository - `session?: string` - `desiredPhase?: EnvironmentPhase` Phase is the desired phase of the environment - `"ENVIRONMENT_PHASE_UNSPECIFIED"` - `"ENVIRONMENT_PHASE_CREATING"` - `"ENVIRONMENT_PHASE_STARTING"` - `"ENVIRONMENT_PHASE_RUNNING"` - `"ENVIRONMENT_PHASE_UPDATING"` - `"ENVIRONMENT_PHASE_STOPPING"` - `"ENVIRONMENT_PHASE_STOPPED"` - `"ENVIRONMENT_PHASE_DELETING"` - `"ENVIRONMENT_PHASE_DELETED"` - `devcontainer?: Devcontainer` devcontainer is the devcontainer spec of the environment - `defaultDevcontainerImage?: string` default_devcontainer_image is the default image that is used to start the devcontainer if no devcontainer config file is found - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `dotfiles?: Dotfiles` Experimental: dotfiles is the dotfiles configuration of the devcontainer - `repository: string` URL of a dotfiles Git repository (e.g. https://github.com/owner/repository) - `lifecycleStage?: "LIFECYCLE_STAGE_UNSPECIFIED" | "LIFECYCLE_STAGE_FULL" | "LIFECYCLE_STAGE_PREBUILD"` lifecycle_stage controls which devcontainer lifecycle commands are executed. Defaults to FULL if not specified. - `"LIFECYCLE_STAGE_UNSPECIFIED"` - `"LIFECYCLE_STAGE_FULL"` - `"LIFECYCLE_STAGE_PREBUILD"` - `session?: string` - `kernelControlsConfig?: KernelControlsConfig` kernel_controls_config configures kernel-level controls for this environment - `veto?: Veto` veto controls blocking mechanisms - `exec?: Exec` exec controls executable blocking - `action?: KernelControlsAction` action specifies what action kernel-level controls take on policy violations - `"KERNEL_CONTROLS_ACTION_UNSPECIFIED"` - `"KERNEL_CONTROLS_ACTION_BLOCK"` - `"KERNEL_CONTROLS_ACTION_AUDIT"` - `denylist?: Array` denylist is the list of executable paths or names to block - `enabled?: boolean` enabled controls whether executable blocking is active - `machine?: Machine` machine is the machine spec of the environment - `class?: string` Class denotes the class of the environment we ought to start - `session?: string` - `ports?: Array` ports is the set of ports which ought to be exposed to your network - `admission?: AdmissionLevel` policy of this port - `name?: string` name of this port - `port?: number` port number - `protocol?: "PROTOCOL_UNSPECIFIED" | "PROTOCOL_HTTP" | "PROTOCOL_HTTPS"` protocol for communication (Gateway proxy → user environment service). this setting only affects the protocol used between Gateway and user environment services. - `"PROTOCOL_UNSPECIFIED"` - `"PROTOCOL_HTTP"` - `"PROTOCOL_HTTPS"` - `secrets?: Array` secrets are confidential data that is mounted into the environment - `id?: string` id is the unique identifier of the secret. - `apiOnly?: boolean` api_only indicates the secret is only available via API/CLI. These secrets are resolved but NOT automatically injected into services or devcontainers. - `containerRegistryBasicAuthHost?: string` container_registry_basic_auth_host is the hostname of the container registry that supports basic auth - `credentialProxy?: CredentialProxy` credential_proxy configures transparent credential injection via the credential proxy. When set, the credential proxy intercepts HTTPS traffic to the target hosts and replaces the dummy secret value with the real value in the specified HTTP header. The real secret value is never exposed in the environment. This field is orthogonal to mount — a secret can be both mounted (e.g. as a git credential) and proxied at the same time. - `format?: "FORMAT_UNSPECIFIED" | "FORMAT_PLAIN" | "FORMAT_BASE64"` format describes how the secret value is encoded. The proxy uses this to decode the value before injecting it into the header. - `"FORMAT_UNSPECIFIED"` - `"FORMAT_PLAIN"` - `"FORMAT_BASE64"` - `header?: string` header is the HTTP header name to inject (e.g. "Authorization"). - `targetHosts?: Array` target_hosts lists the hostnames to intercept (for example "github.com" or "*.github.com"). Wildcards are subdomain-only and do not match the apex domain. - `environmentVariable?: string` - `filePath?: string` file_path is the path inside the devcontainer where the secret is mounted - `gitCredentialHost?: string` - `name?: string` name is the human readable description of the secret - `scope?: "SCOPE_UNSPECIFIED" | "SCOPE_ORGANIZATION" | "SCOPE_PROJECT" | 3 more` scope indicates where this secret originated from. Used to filter secrets during build (only org and project secrets are injected). - `"SCOPE_UNSPECIFIED"` - `"SCOPE_ORGANIZATION"` - `"SCOPE_PROJECT"` - `"SCOPE_USER"` - `"SCOPE_SERVICE_ACCOUNT"` - `"SCOPE_RUNNER"` - `session?: string` session indicated the current session of the secret. When the session does not change, secrets are not reloaded in the environment. - `source?: string` source is the source of the secret, for now control-plane or runner - `sourceRef?: string` source_ref into the source, in case of control-plane this is uuid of the secret - `specVersion?: string` version of the spec. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b. - `sshPublicKeys?: Array` ssh_public_keys are the public keys used to ssh into the environment - `id?: string` id is the unique identifier of the public key - `value?: string` value is the actual public key in the public key file format - `timeout?: Timeout` Timeout configures the environment timeout - `disconnected?: string` inacitivity is the maximum time of disconnection before the environment is stopped or paused. Minimum duration is 30 minutes. Set to 0 to disable. value must be 0s (disabled) or at least 1800s (30 minutes): ``` this == duration('0s') || this >= duration('1800s') ``` - `workflowActionId?: string | null` workflow_action_id is an optional reference to the workflow execution action that created this environment. Used for tracking and event correlation. ### Returns - `EnvironmentCreateResponse` - `environment: Environment` +resource get environment - `id: string` ID is a unique identifier of this environment. No other environment with the same name must be managed by this environment manager - `metadata?: EnvironmentMetadata` Metadata is data associated with this environment that's required for other parts of Gitpod to function - `annotations?: Record` annotations are key/value pairs that gets attached to the environment. +internal - not yet implemented - `archivedAt?: string` Time when the Environment was archived. If not set, the environment is not archived. - `createdAt?: string` Time when the Environment was created. - `creator?: Subject` creator is the identity of the creator of the environment - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `lastStartedAt?: string` Time when the Environment was last started (i.e. CreateEnvironment or StartEnvironment were called). - `lockdownAt?: string` lockdown_at is the time at which the environment becomes locked down due to the organization's maximum environment lifetime policy. Nil when no lifetime policy applies. - `name?: string` name is the name of the environment as specified by the user - `organizationId?: string` organization_id is the ID of the organization that contains the environment - `originalContextUrl?: string` original_context_url is the normalized URL from which the environment was created - `prebuildId?: string | null` prebuild_id is the ID of the prebuild this environment was created from. Only set if the environment was created from a prebuild. - `projectId?: string` If the Environment was started from a project, the project_id will reference the project. - `role?: EnvironmentRole` role is the role of the environment - `"ENVIRONMENT_ROLE_UNSPECIFIED"` - `"ENVIRONMENT_ROLE_DEFAULT"` - `"ENVIRONMENT_ROLE_PREBUILD"` - `"ENVIRONMENT_ROLE_WORKFLOW"` - `runnerId?: string` Runner is the ID of the runner that runs this environment. - `spec?: EnvironmentSpec` Spec is the configuration of the environment that's required for the runner to start the environment - `admission?: AdmissionLevel` admission controlls who can access the environment and its ports. - `"ADMISSION_LEVEL_UNSPECIFIED"` - `"ADMISSION_LEVEL_OWNER_ONLY"` - `"ADMISSION_LEVEL_EVERYONE"` - `"ADMISSION_LEVEL_ORGANIZATION"` - `"ADMISSION_LEVEL_CREATOR_ONLY"` - `automationsFile?: AutomationsFile` automations_file is the automations file spec of the environment - `automationsFilePath?: string` automations_file_path is the path to the automations file that is applied in the environment, relative to the repo root. path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `session?: string` - `triggerFilter?: Array` trigger_filter specifies which automation triggers should execute. When set, only automations matching these triggers will run. If empty/unset, all triggers are evaluated normally. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `content?: Content` content is the content spec of the environment - `gitEmail?: string` The Git email address - `gitUsername?: string` The Git username - `initializer?: EnvironmentInitializer` initializer configures how the environment is to be initialized - `specs?: Array` - `contextUrl?: ContextURL` - `url?: string` url is the URL from which the environment is created - `git?: Git` - `checkoutLocation?: string` a path relative to the environment root in which the code will be checked out to - `cloneTarget?: string` the value for the clone target mode - use depends on the target mode - `remoteUri?: string` remote_uri is the Git remote origin - `targetMode?: "CLONE_TARGET_MODE_UNSPECIFIED" | "CLONE_TARGET_MODE_REMOTE_HEAD" | "CLONE_TARGET_MODE_REMOTE_COMMIT" | 3 more` the target mode determines what gets checked out - `"CLONE_TARGET_MODE_UNSPECIFIED"` - `"CLONE_TARGET_MODE_REMOTE_HEAD"` - `"CLONE_TARGET_MODE_REMOTE_COMMIT"` - `"CLONE_TARGET_MODE_REMOTE_BRANCH"` - `"CLONE_TARGET_MODE_LOCAL_BRANCH"` - `"CLONE_TARGET_MODE_REMOTE_TAG"` - `upstreamRemoteUri?: string` upstream_Remote_uri is the fork upstream of a repository - `session?: string` - `desiredPhase?: EnvironmentPhase` Phase is the desired phase of the environment - `"ENVIRONMENT_PHASE_UNSPECIFIED"` - `"ENVIRONMENT_PHASE_CREATING"` - `"ENVIRONMENT_PHASE_STARTING"` - `"ENVIRONMENT_PHASE_RUNNING"` - `"ENVIRONMENT_PHASE_UPDATING"` - `"ENVIRONMENT_PHASE_STOPPING"` - `"ENVIRONMENT_PHASE_STOPPED"` - `"ENVIRONMENT_PHASE_DELETING"` - `"ENVIRONMENT_PHASE_DELETED"` - `devcontainer?: Devcontainer` devcontainer is the devcontainer spec of the environment - `defaultDevcontainerImage?: string` default_devcontainer_image is the default image that is used to start the devcontainer if no devcontainer config file is found - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `dotfiles?: Dotfiles` Experimental: dotfiles is the dotfiles configuration of the devcontainer - `repository: string` URL of a dotfiles Git repository (e.g. https://github.com/owner/repository) - `lifecycleStage?: "LIFECYCLE_STAGE_UNSPECIFIED" | "LIFECYCLE_STAGE_FULL" | "LIFECYCLE_STAGE_PREBUILD"` lifecycle_stage controls which devcontainer lifecycle commands are executed. Defaults to FULL if not specified. - `"LIFECYCLE_STAGE_UNSPECIFIED"` - `"LIFECYCLE_STAGE_FULL"` - `"LIFECYCLE_STAGE_PREBUILD"` - `session?: string` - `kernelControlsConfig?: KernelControlsConfig` kernel_controls_config configures kernel-level controls for this environment - `veto?: Veto` veto controls blocking mechanisms - `exec?: Exec` exec controls executable blocking - `action?: KernelControlsAction` action specifies what action kernel-level controls take on policy violations - `"KERNEL_CONTROLS_ACTION_UNSPECIFIED"` - `"KERNEL_CONTROLS_ACTION_BLOCK"` - `"KERNEL_CONTROLS_ACTION_AUDIT"` - `denylist?: Array` denylist is the list of executable paths or names to block - `enabled?: boolean` enabled controls whether executable blocking is active - `machine?: Machine` machine is the machine spec of the environment - `class?: string` Class denotes the class of the environment we ought to start - `session?: string` - `ports?: Array` ports is the set of ports which ought to be exposed to your network - `admission?: AdmissionLevel` policy of this port - `name?: string` name of this port - `port?: number` port number - `protocol?: "PROTOCOL_UNSPECIFIED" | "PROTOCOL_HTTP" | "PROTOCOL_HTTPS"` protocol for communication (Gateway proxy → user environment service). this setting only affects the protocol used between Gateway and user environment services. - `"PROTOCOL_UNSPECIFIED"` - `"PROTOCOL_HTTP"` - `"PROTOCOL_HTTPS"` - `secrets?: Array` secrets are confidential data that is mounted into the environment - `id?: string` id is the unique identifier of the secret. - `apiOnly?: boolean` api_only indicates the secret is only available via API/CLI. These secrets are resolved but NOT automatically injected into services or devcontainers. - `containerRegistryBasicAuthHost?: string` container_registry_basic_auth_host is the hostname of the container registry that supports basic auth - `credentialProxy?: CredentialProxy` credential_proxy configures transparent credential injection via the credential proxy. When set, the credential proxy intercepts HTTPS traffic to the target hosts and replaces the dummy secret value with the real value in the specified HTTP header. The real secret value is never exposed in the environment. This field is orthogonal to mount — a secret can be both mounted (e.g. as a git credential) and proxied at the same time. - `format?: "FORMAT_UNSPECIFIED" | "FORMAT_PLAIN" | "FORMAT_BASE64"` format describes how the secret value is encoded. The proxy uses this to decode the value before injecting it into the header. - `"FORMAT_UNSPECIFIED"` - `"FORMAT_PLAIN"` - `"FORMAT_BASE64"` - `header?: string` header is the HTTP header name to inject (e.g. "Authorization"). - `targetHosts?: Array` target_hosts lists the hostnames to intercept (for example "github.com" or "*.github.com"). Wildcards are subdomain-only and do not match the apex domain. - `environmentVariable?: string` - `filePath?: string` file_path is the path inside the devcontainer where the secret is mounted - `gitCredentialHost?: string` - `name?: string` name is the human readable description of the secret - `scope?: "SCOPE_UNSPECIFIED" | "SCOPE_ORGANIZATION" | "SCOPE_PROJECT" | 3 more` scope indicates where this secret originated from. Used to filter secrets during build (only org and project secrets are injected). - `"SCOPE_UNSPECIFIED"` - `"SCOPE_ORGANIZATION"` - `"SCOPE_PROJECT"` - `"SCOPE_USER"` - `"SCOPE_SERVICE_ACCOUNT"` - `"SCOPE_RUNNER"` - `session?: string` session indicated the current session of the secret. When the session does not change, secrets are not reloaded in the environment. - `source?: string` source is the source of the secret, for now control-plane or runner - `sourceRef?: string` source_ref into the source, in case of control-plane this is uuid of the secret - `specVersion?: string` version of the spec. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b. - `sshPublicKeys?: Array` ssh_public_keys are the public keys used to ssh into the environment - `id?: string` id is the unique identifier of the public key - `value?: string` value is the actual public key in the public key file format - `timeout?: Timeout` Timeout configures the environment timeout - `disconnected?: string` inacitivity is the maximum time of disconnection before the environment is stopped or paused. Minimum duration is 30 minutes. Set to 0 to disable. value must be 0s (disabled) or at least 1800s (30 minutes): ``` this == duration('0s') || this >= duration('1800s') ``` - `workflowActionId?: string | null` workflow_action_id is an optional reference to the workflow execution action that created this environment. Used for tracking and event correlation. - `status?: EnvironmentStatus` Status is the current status of the environment - `activitySignal?: EnvironmentActivitySignal` activity_signal is the last activity signal for the environment. - `source?: string` source of the activity signal, such as "VS Code", "SSH", or "Automations". It should be a human-readable string that describes the source of the activity signal. - `timestamp?: string` timestamp of when the activity was observed by the source. Only reported every 5 minutes. Zero value means no activity was observed. - `automationsFile?: AutomationsFile` automations_file contains the status of the automations file. - `automationsFilePath?: string` automations_file_path is the path to the automations file relative to the repo root. - `automationsFilePresence?: "PRESENCE_UNSPECIFIED" | "PRESENCE_ABSENT" | "PRESENCE_DISCOVERED" | "PRESENCE_SPECIFIED"` automations_file_presence indicates how an automations file is present in the environment. - `"PRESENCE_UNSPECIFIED"` - `"PRESENCE_ABSENT"` - `"PRESENCE_DISCOVERED"` - `"PRESENCE_SPECIFIED"` - `failureMessage?: string` failure_message contains the reason the automations file failed to be applied. This is only set if the phase is FAILED. - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the automations file. - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `session?: string` session is the automations file session that is currently applied in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when no triggers are defined in the automations file. - `content?: Content` content contains the status of the environment content. - `contentLocationInMachine?: string` content_location_in_machine is the location of the content in the machine - `failureMessage?: string` failure_message contains the reason the content initialization failed. - `git?: Git` git is the Git working copy status of the environment. Note: this is a best-effort field and more often than not will not be present. Its absence does not indicate the absence of a working copy. - `branch?: string` branch is branch we're currently on - `changedFiles?: Array` changed_files is an array of changed files in the environment, possibly truncated - `changeType?: "CHANGE_TYPE_UNSPECIFIED" | "CHANGE_TYPE_ADDED" | "CHANGE_TYPE_MODIFIED" | 5 more` ChangeType is the type of change that happened to the file - `"CHANGE_TYPE_UNSPECIFIED"` - `"CHANGE_TYPE_ADDED"` - `"CHANGE_TYPE_MODIFIED"` - `"CHANGE_TYPE_DELETED"` - `"CHANGE_TYPE_RENAMED"` - `"CHANGE_TYPE_COPIED"` - `"CHANGE_TYPE_UPDATED_BUT_UNMERGED"` - `"CHANGE_TYPE_UNTRACKED"` - `oldPath?: string` old_path is the previous path of the file before a rename or copy. Only set when change_type is RENAMED or COPIED. - `path?: string` path is the path of the file - `cloneUrl?: string` clone_url is the repository url as you would pass it to "git clone". Only HTTPS clone URLs are supported. - `latestCommit?: string` latest_commit is the most recent commit on the current branch - `totalChangedFiles?: number` - `totalUnpushedCommits?: number` the total number of unpushed changes - `unpushedCommits?: Array` unpushed_commits is an array of unpushed changes in the environment, possibly truncated - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the environment content - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `session?: string` session is the session that is currently active in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when the content is present but not in the expected state. - `devcontainer?: Devcontainer` devcontainer contains the status of the devcontainer. - `containerId?: string` container_id is the ID of the container. - `containerName?: string` container_name is the name of the container that is used to connect to the devcontainer - `devcontainerconfigInSync?: boolean` devcontainerconfig_in_sync indicates if the devcontainer is up to date w.r.t. the devcontainer config file. - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root - `devcontainerFilePresence?: "PRESENCE_UNSPECIFIED" | "PRESENCE_GENERATED" | "PRESENCE_DISCOVERED" | "PRESENCE_SPECIFIED"` devcontainer_file_presence indicates how the devcontainer file is present in the repo. - `"PRESENCE_UNSPECIFIED"` - `"PRESENCE_GENERATED"` - `"PRESENCE_DISCOVERED"` - `"PRESENCE_SPECIFIED"` - `failureMessage?: string` failure_message contains the reason the devcontainer failed to operate. - `phase?: "PHASE_UNSPECIFIED" | "PHASE_CREATING" | "PHASE_RUNNING" | 2 more` phase is the current phase of the devcontainer - `"PHASE_UNSPECIFIED"` - `"PHASE_CREATING"` - `"PHASE_RUNNING"` - `"PHASE_STOPPED"` - `"PHASE_FAILED"` - `remoteUser?: string` remote_user is the user that is used to connect to the devcontainer - `remoteWorkspaceFolder?: string` remote_workspace_folder is the folder that is used to connect to the devcontainer - `secretsInSync?: boolean` secrets_in_sync indicates if the secrets are up to date w.r.t. the running devcontainer. - `session?: string` session is the session that is currently active in the devcontainer. - `warningMessage?: string` warning_message contains warnings, e.g. when the devcontainer is present but not in the expected state. - `environmentUrls?: EnvironmentURLs` environment_url contains the URL at which the environment can be accessed. This field is only set if the environment is running. - `logs?: string` logs is the URL at which the environment logs can be accessed. - `ops?: string` ops is the URL at which the environment ops service can be accessed. - `ports?: Array` - `port?: number` port is the port number of the environment port - `url?: string` url is the URL at which the environment port can be accessed - `ssh?: SSH` SSH is the URL at which the environment can be accessed via SSH. - `url?: string` - `supportBundle?: string` support_bundle is the URL at which the environment support bundle can be accessed. - `failureMessage?: Array` failure_message summarises why the environment failed to operate. If this is non-empty the environment has failed to operate and will likely transition to a stopped state. - `machine?: Machine` machine contains the status of the environment machine - `failureMessage?: string` failure_message contains the reason the machine failed to operate. - `phase?: "PHASE_UNSPECIFIED" | "PHASE_CREATING" | "PHASE_STARTING" | 5 more` phase is the current phase of the environment machine - `"PHASE_UNSPECIFIED"` - `"PHASE_CREATING"` - `"PHASE_STARTING"` - `"PHASE_RUNNING"` - `"PHASE_STOPPING"` - `"PHASE_STOPPED"` - `"PHASE_DELETING"` - `"PHASE_DELETED"` - `session?: string` session is the session that is currently active in the machine. - `timeout?: string` timeout contains the reason the environment has timed out. If this field is empty, the environment has not timed out. - `versions?: Versions` versions contains the versions of components in the machine. - `amiId?: string` - `supervisorCommit?: string` - `supervisorVersion?: string` - `warningMessage?: string` warning_message contains warnings, e.g. when the machine is present but not in the expected state. - `phase?: EnvironmentPhase` the phase of an environment is a simple, high-level summary of where the environment is in its lifecycle - `runnerAck?: RunnerAck` runner_ack contains the acknowledgement from the runner that is has received the environment spec. - `message?: string` - `specVersion?: string` - `statusCode?: "STATUS_CODE_UNSPECIFIED" | "STATUS_CODE_OK" | "STATUS_CODE_INVALID_RESOURCE" | "STATUS_CODE_FAILED_PRECONDITION"` - `"STATUS_CODE_UNSPECIFIED"` - `"STATUS_CODE_OK"` - `"STATUS_CODE_INVALID_RESOURCE"` - `"STATUS_CODE_FAILED_PRECONDITION"` - `secrets?: Array` secrets contains the status of the environment secrets - `id?: string` id is the unique identifier of the secret. - `failureMessage?: string` failure_message contains the reason the secret failed to be materialize. - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `secretName?: string` - `session?: string` session is the session that is currently active in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when the secret is present but not in the expected state. - `sshPublicKeys?: Array` ssh_public_keys contains the status of the environment ssh public keys - `id?: string` id is the unique identifier of the public key - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the public key - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `statusVersion?: string` version of the status update. Environment instances themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. - `warningMessage?: Array` warning_message contains warnings, e.g. when the environment is present but not in the expected state. ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const environment = await client.environments.create({ spec: { content: { initializer: { specs: [{ contextUrl: { url: 'https://github.com/gitpod-io/gitpod' } }] }, }, machine: { class: 'd2c94c27-3b76-4a42-b88c-95a85e392c68' }, }, }); console.log(environment.environment); ``` #### Response ```json { "environment": { "id": "id", "metadata": { "annotations": { "foo": "string" }, "archivedAt": "2019-12-27T18:11:19.117Z", "createdAt": "2019-12-27T18:11:19.117Z", "creator": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "principal": "PRINCIPAL_UNSPECIFIED" }, "lastStartedAt": "2019-12-27T18:11:19.117Z", "lockdownAt": "2019-12-27T18:11:19.117Z", "name": "name", "organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "originalContextUrl": "originalContextUrl", "prebuildId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "projectId": "projectId", "role": "ENVIRONMENT_ROLE_UNSPECIFIED", "runnerId": "runnerId", "sessionId": "sessionId" }, "spec": { "admission": "ADMISSION_LEVEL_UNSPECIFIED", "automationsFile": { "automationsFilePath": "automationsFilePath", "session": "session", "triggerFilter": [ { "beforeSnapshot": true, "manual": true, "postDevcontainerStart": true, "postEnvironmentStart": true, "postMachineStart": true, "prebuild": true } ] }, "content": { "gitEmail": "gitEmail", "gitUsername": "gitUsername", "initializer": { "specs": [ { "contextUrl": { "url": "https://example.com" }, "git": { "checkoutLocation": "checkoutLocation", "cloneTarget": "cloneTarget", "remoteUri": "remoteUri", "targetMode": "CLONE_TARGET_MODE_UNSPECIFIED", "upstreamRemoteUri": "upstreamRemoteUri" } } ] }, "session": "session" }, "desiredPhase": "ENVIRONMENT_PHASE_UNSPECIFIED", "devcontainer": { "defaultDevcontainerImage": "defaultDevcontainerImage", "devcontainerFilePath": "devcontainerFilePath", "dotfiles": { "repository": "https://example.com" }, "lifecycleStage": "LIFECYCLE_STAGE_UNSPECIFIED", "session": "session" }, "kernelControlsConfig": { "bpfDebugLevel": "BPF_DEBUG_LEVEL_UNSPECIFIED", "veto": { "exec": { "action": "KERNEL_CONTROLS_ACTION_UNSPECIFIED", "denyBlockDevices": true, "denylist": [ "string" ], "enabled": true, "resolveBareNames": true, "untouchable": true, "watch": true } } }, "machine": { "class": "class", "preferDualDisk": true, "session": "session" }, "ports": [ { "admission": "ADMISSION_LEVEL_UNSPECIFIED", "authNonce": "authNonce", "name": "x", "port": 1024, "protocol": "PROTOCOL_UNSPECIFIED" } ], "secrets": [ { "id": "id", "apiOnly": true, "containerRegistryBasicAuthHost": "containerRegistryBasicAuthHost", "credentialProxy": { "format": "FORMAT_UNSPECIFIED", "header": "header", "targetHosts": [ "string" ] }, "environmentVariable": "environmentVariable", "filePath": "filePath", "gitCredentialHost": "gitCredentialHost", "name": "name", "scope": "SCOPE_UNSPECIFIED", "session": "session", "source": "source", "sourceRef": "sourceRef" } ], "specVersion": "specVersion", "sshPublicKeys": [ { "id": "id", "value": "value" } ], "timeout": { "disconnected": "+9125115.360s" }, "workflowActionId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" }, "status": { "activitySignal": { "source": "xxx", "timestamp": "2019-12-27T18:11:19.117Z" }, "automationsFile": { "automationsFilePath": "automationsFilePath", "automationsFilePresence": "PRESENCE_UNSPECIFIED", "failureMessage": "failureMessage", "phase": "CONTENT_PHASE_UNSPECIFIED", "session": "session", "warningMessage": "warningMessage" }, "content": { "contentLocationInMachine": "contentLocationInMachine", "failureMessage": "failureMessage", "git": { "branch": "branch", "changedFiles": [ { "changeType": "CHANGE_TYPE_UNSPECIFIED", "oldPath": "oldPath", "path": "path" } ], "cloneUrl": "cloneUrl", "latestCommit": "latestCommit", "totalChangedFiles": 0, "totalUnpushedCommits": 0, "unpushedCommits": [ "string" ] }, "phase": "CONTENT_PHASE_UNSPECIFIED", "session": "session", "warningMessage": "warningMessage" }, "devcontainer": { "containerId": "containerId", "containerName": "containerName", "devcontainerconfigInSync": true, "devcontainerFilePath": "devcontainerFilePath", "devcontainerFilePresence": "PRESENCE_UNSPECIFIED", "failureMessage": "failureMessage", "phase": "PHASE_UNSPECIFIED", "remoteUser": "remoteUser", "remoteWorkspaceFolder": "remoteWorkspaceFolder", "secretsInSync": true, "session": "session", "warningMessage": "warningMessage" }, "environmentUrls": { "logs": "logs", "ops": "ops", "ports": [ { "port": 1024, "url": "url" } ], "ssh": { "url": "url" }, "supportBundle": "supportBundle", "vmLiveUsage": "vmLiveUsage" }, "failureMessage": [ "string" ], "machine": { "dualDisk": true, "failureMessage": "failureMessage", "phase": "PHASE_UNSPECIFIED", "session": "session", "timeout": "timeout", "versions": { "amiId": "amiId", "supervisorCommit": "supervisorCommit", "supervisorVersion": "supervisorVersion" }, "warningMessage": "warningMessage" }, "phase": "ENVIRONMENT_PHASE_UNSPECIFIED", "runnerAck": { "message": "message", "specVersion": "specVersion", "statusCode": "STATUS_CODE_UNSPECIFIED" }, "secrets": [ { "id": "id", "failureMessage": "failureMessage", "phase": "CONTENT_PHASE_UNSPECIFIED", "secretName": "secretName", "session": "session", "warningMessage": "warningMessage" } ], "sshPublicKeys": [ { "id": "id", "phase": "CONTENT_PHASE_UNSPECIFIED" } ], "statusVersion": "statusVersion", "warningMessage": [ "string" ] } } } ``` ## CreateEnvironmentAccessToken `client.environments.createEnvironmentToken(EnvironmentCreateEnvironmentTokenParamsbody, RequestOptionsoptions?): EnvironmentCreateEnvironmentTokenResponse` **post** `/gitpod.v1.EnvironmentService/CreateEnvironmentAccessToken` Creates an access token for the environment. Generated tokens are valid for one hour and provide environment-specific access permissions. The token is scoped to a specific environment. ### Examples - Generate environment token: Creates a temporary access token for accessing an environment. ```yaml environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" ``` ### Parameters - `body: EnvironmentCreateEnvironmentTokenParams` - `environmentId: string` environment_id specifies the environment for which the access token should be created. ### Returns - `EnvironmentCreateEnvironmentTokenResponse` - `accessToken: string` access_token is the token that can be used for environment authentication ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const response = await client.environments.createEnvironmentToken({ environmentId: '07e03a28-65a5-4d98-b532-8ea67b188048', }); console.log(response.accessToken); ``` #### Response ```json { "accessToken": "accessToken" } ``` ## CreateEnvironmentFromProject `client.environments.createFromProject(EnvironmentCreateFromProjectParamsbody, RequestOptionsoptions?): EnvironmentCreateFromProjectResponse` **post** `/gitpod.v1.EnvironmentService/CreateEnvironmentFromProject` Creates an environment from an existing project configuration and starts it. This method uses project settings as defaults but allows overriding specific configurations. Project settings take precedence over default configurations, while custom specifications in the request override project settings. ### Examples - Create with project defaults: Creates an environment using all default settings from the project configuration. ```yaml projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" ``` - Create with custom compute resources: Creates an environment from project with custom machine class and timeout settings. ```yaml projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" spec: machine: class: "d2c94c27-3b76-4a42-b88c-95a85e392c68" timeout: disconnected: "14400s" # 4 hours in seconds ``` ### Parameters - `body: EnvironmentCreateFromProjectParams` - `name?: string | null` name is a user-defined identifier for the environment. If not specified, the system will generate a name. - `projectId?: string` - `sessionId?: string` session_id is the ID of the session this environment belongs to. If empty, a new session is created implicitly. - `spec?: EnvironmentSpec` Spec is the configuration of the environment that's required for the runner to start the environment Configuration already defined in the Project will override parts of the spec, if set - `admission?: AdmissionLevel` admission controlls who can access the environment and its ports. - `"ADMISSION_LEVEL_UNSPECIFIED"` - `"ADMISSION_LEVEL_OWNER_ONLY"` - `"ADMISSION_LEVEL_EVERYONE"` - `"ADMISSION_LEVEL_ORGANIZATION"` - `"ADMISSION_LEVEL_CREATOR_ONLY"` - `automationsFile?: AutomationsFile` automations_file is the automations file spec of the environment - `automationsFilePath?: string` automations_file_path is the path to the automations file that is applied in the environment, relative to the repo root. path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `session?: string` - `triggerFilter?: Array` trigger_filter specifies which automation triggers should execute. When set, only automations matching these triggers will run. If empty/unset, all triggers are evaluated normally. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `content?: Content` content is the content spec of the environment - `gitEmail?: string` The Git email address - `gitUsername?: string` The Git username - `initializer?: EnvironmentInitializer` initializer configures how the environment is to be initialized - `specs?: Array` - `contextUrl?: ContextURL` - `url?: string` url is the URL from which the environment is created - `git?: Git` - `checkoutLocation?: string` a path relative to the environment root in which the code will be checked out to - `cloneTarget?: string` the value for the clone target mode - use depends on the target mode - `remoteUri?: string` remote_uri is the Git remote origin - `targetMode?: "CLONE_TARGET_MODE_UNSPECIFIED" | "CLONE_TARGET_MODE_REMOTE_HEAD" | "CLONE_TARGET_MODE_REMOTE_COMMIT" | 3 more` the target mode determines what gets checked out - `"CLONE_TARGET_MODE_UNSPECIFIED"` - `"CLONE_TARGET_MODE_REMOTE_HEAD"` - `"CLONE_TARGET_MODE_REMOTE_COMMIT"` - `"CLONE_TARGET_MODE_REMOTE_BRANCH"` - `"CLONE_TARGET_MODE_LOCAL_BRANCH"` - `"CLONE_TARGET_MODE_REMOTE_TAG"` - `upstreamRemoteUri?: string` upstream_Remote_uri is the fork upstream of a repository - `session?: string` - `desiredPhase?: EnvironmentPhase` Phase is the desired phase of the environment - `"ENVIRONMENT_PHASE_UNSPECIFIED"` - `"ENVIRONMENT_PHASE_CREATING"` - `"ENVIRONMENT_PHASE_STARTING"` - `"ENVIRONMENT_PHASE_RUNNING"` - `"ENVIRONMENT_PHASE_UPDATING"` - `"ENVIRONMENT_PHASE_STOPPING"` - `"ENVIRONMENT_PHASE_STOPPED"` - `"ENVIRONMENT_PHASE_DELETING"` - `"ENVIRONMENT_PHASE_DELETED"` - `devcontainer?: Devcontainer` devcontainer is the devcontainer spec of the environment - `defaultDevcontainerImage?: string` default_devcontainer_image is the default image that is used to start the devcontainer if no devcontainer config file is found - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `dotfiles?: Dotfiles` Experimental: dotfiles is the dotfiles configuration of the devcontainer - `repository: string` URL of a dotfiles Git repository (e.g. https://github.com/owner/repository) - `lifecycleStage?: "LIFECYCLE_STAGE_UNSPECIFIED" | "LIFECYCLE_STAGE_FULL" | "LIFECYCLE_STAGE_PREBUILD"` lifecycle_stage controls which devcontainer lifecycle commands are executed. Defaults to FULL if not specified. - `"LIFECYCLE_STAGE_UNSPECIFIED"` - `"LIFECYCLE_STAGE_FULL"` - `"LIFECYCLE_STAGE_PREBUILD"` - `session?: string` - `kernelControlsConfig?: KernelControlsConfig` kernel_controls_config configures kernel-level controls for this environment - `veto?: Veto` veto controls blocking mechanisms - `exec?: Exec` exec controls executable blocking - `action?: KernelControlsAction` action specifies what action kernel-level controls take on policy violations - `"KERNEL_CONTROLS_ACTION_UNSPECIFIED"` - `"KERNEL_CONTROLS_ACTION_BLOCK"` - `"KERNEL_CONTROLS_ACTION_AUDIT"` - `denylist?: Array` denylist is the list of executable paths or names to block - `enabled?: boolean` enabled controls whether executable blocking is active - `machine?: Machine` machine is the machine spec of the environment - `class?: string` Class denotes the class of the environment we ought to start - `session?: string` - `ports?: Array` ports is the set of ports which ought to be exposed to your network - `admission?: AdmissionLevel` policy of this port - `name?: string` name of this port - `port?: number` port number - `protocol?: "PROTOCOL_UNSPECIFIED" | "PROTOCOL_HTTP" | "PROTOCOL_HTTPS"` protocol for communication (Gateway proxy → user environment service). this setting only affects the protocol used between Gateway and user environment services. - `"PROTOCOL_UNSPECIFIED"` - `"PROTOCOL_HTTP"` - `"PROTOCOL_HTTPS"` - `secrets?: Array` secrets are confidential data that is mounted into the environment - `id?: string` id is the unique identifier of the secret. - `apiOnly?: boolean` api_only indicates the secret is only available via API/CLI. These secrets are resolved but NOT automatically injected into services or devcontainers. - `containerRegistryBasicAuthHost?: string` container_registry_basic_auth_host is the hostname of the container registry that supports basic auth - `credentialProxy?: CredentialProxy` credential_proxy configures transparent credential injection via the credential proxy. When set, the credential proxy intercepts HTTPS traffic to the target hosts and replaces the dummy secret value with the real value in the specified HTTP header. The real secret value is never exposed in the environment. This field is orthogonal to mount — a secret can be both mounted (e.g. as a git credential) and proxied at the same time. - `format?: "FORMAT_UNSPECIFIED" | "FORMAT_PLAIN" | "FORMAT_BASE64"` format describes how the secret value is encoded. The proxy uses this to decode the value before injecting it into the header. - `"FORMAT_UNSPECIFIED"` - `"FORMAT_PLAIN"` - `"FORMAT_BASE64"` - `header?: string` header is the HTTP header name to inject (e.g. "Authorization"). - `targetHosts?: Array` target_hosts lists the hostnames to intercept (for example "github.com" or "*.github.com"). Wildcards are subdomain-only and do not match the apex domain. - `environmentVariable?: string` - `filePath?: string` file_path is the path inside the devcontainer where the secret is mounted - `gitCredentialHost?: string` - `name?: string` name is the human readable description of the secret - `scope?: "SCOPE_UNSPECIFIED" | "SCOPE_ORGANIZATION" | "SCOPE_PROJECT" | 3 more` scope indicates where this secret originated from. Used to filter secrets during build (only org and project secrets are injected). - `"SCOPE_UNSPECIFIED"` - `"SCOPE_ORGANIZATION"` - `"SCOPE_PROJECT"` - `"SCOPE_USER"` - `"SCOPE_SERVICE_ACCOUNT"` - `"SCOPE_RUNNER"` - `session?: string` session indicated the current session of the secret. When the session does not change, secrets are not reloaded in the environment. - `source?: string` source is the source of the secret, for now control-plane or runner - `sourceRef?: string` source_ref into the source, in case of control-plane this is uuid of the secret - `specVersion?: string` version of the spec. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b. - `sshPublicKeys?: Array` ssh_public_keys are the public keys used to ssh into the environment - `id?: string` id is the unique identifier of the public key - `value?: string` value is the actual public key in the public key file format - `timeout?: Timeout` Timeout configures the environment timeout - `disconnected?: string` inacitivity is the maximum time of disconnection before the environment is stopped or paused. Minimum duration is 30 minutes. Set to 0 to disable. value must be 0s (disabled) or at least 1800s (30 minutes): ``` this == duration('0s') || this >= duration('1800s') ``` - `workflowActionId?: string | null` workflow_action_id is an optional reference to the workflow execution action that created this environment. Used for tracking and event correlation. ### Returns - `EnvironmentCreateFromProjectResponse` - `environment: Environment` +resource get environment - `id: string` ID is a unique identifier of this environment. No other environment with the same name must be managed by this environment manager - `metadata?: EnvironmentMetadata` Metadata is data associated with this environment that's required for other parts of Gitpod to function - `annotations?: Record` annotations are key/value pairs that gets attached to the environment. +internal - not yet implemented - `archivedAt?: string` Time when the Environment was archived. If not set, the environment is not archived. - `createdAt?: string` Time when the Environment was created. - `creator?: Subject` creator is the identity of the creator of the environment - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `lastStartedAt?: string` Time when the Environment was last started (i.e. CreateEnvironment or StartEnvironment were called). - `lockdownAt?: string` lockdown_at is the time at which the environment becomes locked down due to the organization's maximum environment lifetime policy. Nil when no lifetime policy applies. - `name?: string` name is the name of the environment as specified by the user - `organizationId?: string` organization_id is the ID of the organization that contains the environment - `originalContextUrl?: string` original_context_url is the normalized URL from which the environment was created - `prebuildId?: string | null` prebuild_id is the ID of the prebuild this environment was created from. Only set if the environment was created from a prebuild. - `projectId?: string` If the Environment was started from a project, the project_id will reference the project. - `role?: EnvironmentRole` role is the role of the environment - `"ENVIRONMENT_ROLE_UNSPECIFIED"` - `"ENVIRONMENT_ROLE_DEFAULT"` - `"ENVIRONMENT_ROLE_PREBUILD"` - `"ENVIRONMENT_ROLE_WORKFLOW"` - `runnerId?: string` Runner is the ID of the runner that runs this environment. - `spec?: EnvironmentSpec` Spec is the configuration of the environment that's required for the runner to start the environment - `admission?: AdmissionLevel` admission controlls who can access the environment and its ports. - `"ADMISSION_LEVEL_UNSPECIFIED"` - `"ADMISSION_LEVEL_OWNER_ONLY"` - `"ADMISSION_LEVEL_EVERYONE"` - `"ADMISSION_LEVEL_ORGANIZATION"` - `"ADMISSION_LEVEL_CREATOR_ONLY"` - `automationsFile?: AutomationsFile` automations_file is the automations file spec of the environment - `automationsFilePath?: string` automations_file_path is the path to the automations file that is applied in the environment, relative to the repo root. path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `session?: string` - `triggerFilter?: Array` trigger_filter specifies which automation triggers should execute. When set, only automations matching these triggers will run. If empty/unset, all triggers are evaluated normally. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `content?: Content` content is the content spec of the environment - `gitEmail?: string` The Git email address - `gitUsername?: string` The Git username - `initializer?: EnvironmentInitializer` initializer configures how the environment is to be initialized - `specs?: Array` - `contextUrl?: ContextURL` - `url?: string` url is the URL from which the environment is created - `git?: Git` - `checkoutLocation?: string` a path relative to the environment root in which the code will be checked out to - `cloneTarget?: string` the value for the clone target mode - use depends on the target mode - `remoteUri?: string` remote_uri is the Git remote origin - `targetMode?: "CLONE_TARGET_MODE_UNSPECIFIED" | "CLONE_TARGET_MODE_REMOTE_HEAD" | "CLONE_TARGET_MODE_REMOTE_COMMIT" | 3 more` the target mode determines what gets checked out - `"CLONE_TARGET_MODE_UNSPECIFIED"` - `"CLONE_TARGET_MODE_REMOTE_HEAD"` - `"CLONE_TARGET_MODE_REMOTE_COMMIT"` - `"CLONE_TARGET_MODE_REMOTE_BRANCH"` - `"CLONE_TARGET_MODE_LOCAL_BRANCH"` - `"CLONE_TARGET_MODE_REMOTE_TAG"` - `upstreamRemoteUri?: string` upstream_Remote_uri is the fork upstream of a repository - `session?: string` - `desiredPhase?: EnvironmentPhase` Phase is the desired phase of the environment - `"ENVIRONMENT_PHASE_UNSPECIFIED"` - `"ENVIRONMENT_PHASE_CREATING"` - `"ENVIRONMENT_PHASE_STARTING"` - `"ENVIRONMENT_PHASE_RUNNING"` - `"ENVIRONMENT_PHASE_UPDATING"` - `"ENVIRONMENT_PHASE_STOPPING"` - `"ENVIRONMENT_PHASE_STOPPED"` - `"ENVIRONMENT_PHASE_DELETING"` - `"ENVIRONMENT_PHASE_DELETED"` - `devcontainer?: Devcontainer` devcontainer is the devcontainer spec of the environment - `defaultDevcontainerImage?: string` default_devcontainer_image is the default image that is used to start the devcontainer if no devcontainer config file is found - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `dotfiles?: Dotfiles` Experimental: dotfiles is the dotfiles configuration of the devcontainer - `repository: string` URL of a dotfiles Git repository (e.g. https://github.com/owner/repository) - `lifecycleStage?: "LIFECYCLE_STAGE_UNSPECIFIED" | "LIFECYCLE_STAGE_FULL" | "LIFECYCLE_STAGE_PREBUILD"` lifecycle_stage controls which devcontainer lifecycle commands are executed. Defaults to FULL if not specified. - `"LIFECYCLE_STAGE_UNSPECIFIED"` - `"LIFECYCLE_STAGE_FULL"` - `"LIFECYCLE_STAGE_PREBUILD"` - `session?: string` - `kernelControlsConfig?: KernelControlsConfig` kernel_controls_config configures kernel-level controls for this environment - `veto?: Veto` veto controls blocking mechanisms - `exec?: Exec` exec controls executable blocking - `action?: KernelControlsAction` action specifies what action kernel-level controls take on policy violations - `"KERNEL_CONTROLS_ACTION_UNSPECIFIED"` - `"KERNEL_CONTROLS_ACTION_BLOCK"` - `"KERNEL_CONTROLS_ACTION_AUDIT"` - `denylist?: Array` denylist is the list of executable paths or names to block - `enabled?: boolean` enabled controls whether executable blocking is active - `machine?: Machine` machine is the machine spec of the environment - `class?: string` Class denotes the class of the environment we ought to start - `session?: string` - `ports?: Array` ports is the set of ports which ought to be exposed to your network - `admission?: AdmissionLevel` policy of this port - `name?: string` name of this port - `port?: number` port number - `protocol?: "PROTOCOL_UNSPECIFIED" | "PROTOCOL_HTTP" | "PROTOCOL_HTTPS"` protocol for communication (Gateway proxy → user environment service). this setting only affects the protocol used between Gateway and user environment services. - `"PROTOCOL_UNSPECIFIED"` - `"PROTOCOL_HTTP"` - `"PROTOCOL_HTTPS"` - `secrets?: Array` secrets are confidential data that is mounted into the environment - `id?: string` id is the unique identifier of the secret. - `apiOnly?: boolean` api_only indicates the secret is only available via API/CLI. These secrets are resolved but NOT automatically injected into services or devcontainers. - `containerRegistryBasicAuthHost?: string` container_registry_basic_auth_host is the hostname of the container registry that supports basic auth - `credentialProxy?: CredentialProxy` credential_proxy configures transparent credential injection via the credential proxy. When set, the credential proxy intercepts HTTPS traffic to the target hosts and replaces the dummy secret value with the real value in the specified HTTP header. The real secret value is never exposed in the environment. This field is orthogonal to mount — a secret can be both mounted (e.g. as a git credential) and proxied at the same time. - `format?: "FORMAT_UNSPECIFIED" | "FORMAT_PLAIN" | "FORMAT_BASE64"` format describes how the secret value is encoded. The proxy uses this to decode the value before injecting it into the header. - `"FORMAT_UNSPECIFIED"` - `"FORMAT_PLAIN"` - `"FORMAT_BASE64"` - `header?: string` header is the HTTP header name to inject (e.g. "Authorization"). - `targetHosts?: Array` target_hosts lists the hostnames to intercept (for example "github.com" or "*.github.com"). Wildcards are subdomain-only and do not match the apex domain. - `environmentVariable?: string` - `filePath?: string` file_path is the path inside the devcontainer where the secret is mounted - `gitCredentialHost?: string` - `name?: string` name is the human readable description of the secret - `scope?: "SCOPE_UNSPECIFIED" | "SCOPE_ORGANIZATION" | "SCOPE_PROJECT" | 3 more` scope indicates where this secret originated from. Used to filter secrets during build (only org and project secrets are injected). - `"SCOPE_UNSPECIFIED"` - `"SCOPE_ORGANIZATION"` - `"SCOPE_PROJECT"` - `"SCOPE_USER"` - `"SCOPE_SERVICE_ACCOUNT"` - `"SCOPE_RUNNER"` - `session?: string` session indicated the current session of the secret. When the session does not change, secrets are not reloaded in the environment. - `source?: string` source is the source of the secret, for now control-plane or runner - `sourceRef?: string` source_ref into the source, in case of control-plane this is uuid of the secret - `specVersion?: string` version of the spec. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b. - `sshPublicKeys?: Array` ssh_public_keys are the public keys used to ssh into the environment - `id?: string` id is the unique identifier of the public key - `value?: string` value is the actual public key in the public key file format - `timeout?: Timeout` Timeout configures the environment timeout - `disconnected?: string` inacitivity is the maximum time of disconnection before the environment is stopped or paused. Minimum duration is 30 minutes. Set to 0 to disable. value must be 0s (disabled) or at least 1800s (30 minutes): ``` this == duration('0s') || this >= duration('1800s') ``` - `workflowActionId?: string | null` workflow_action_id is an optional reference to the workflow execution action that created this environment. Used for tracking and event correlation. - `status?: EnvironmentStatus` Status is the current status of the environment - `activitySignal?: EnvironmentActivitySignal` activity_signal is the last activity signal for the environment. - `source?: string` source of the activity signal, such as "VS Code", "SSH", or "Automations". It should be a human-readable string that describes the source of the activity signal. - `timestamp?: string` timestamp of when the activity was observed by the source. Only reported every 5 minutes. Zero value means no activity was observed. - `automationsFile?: AutomationsFile` automations_file contains the status of the automations file. - `automationsFilePath?: string` automations_file_path is the path to the automations file relative to the repo root. - `automationsFilePresence?: "PRESENCE_UNSPECIFIED" | "PRESENCE_ABSENT" | "PRESENCE_DISCOVERED" | "PRESENCE_SPECIFIED"` automations_file_presence indicates how an automations file is present in the environment. - `"PRESENCE_UNSPECIFIED"` - `"PRESENCE_ABSENT"` - `"PRESENCE_DISCOVERED"` - `"PRESENCE_SPECIFIED"` - `failureMessage?: string` failure_message contains the reason the automations file failed to be applied. This is only set if the phase is FAILED. - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the automations file. - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `session?: string` session is the automations file session that is currently applied in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when no triggers are defined in the automations file. - `content?: Content` content contains the status of the environment content. - `contentLocationInMachine?: string` content_location_in_machine is the location of the content in the machine - `failureMessage?: string` failure_message contains the reason the content initialization failed. - `git?: Git` git is the Git working copy status of the environment. Note: this is a best-effort field and more often than not will not be present. Its absence does not indicate the absence of a working copy. - `branch?: string` branch is branch we're currently on - `changedFiles?: Array` changed_files is an array of changed files in the environment, possibly truncated - `changeType?: "CHANGE_TYPE_UNSPECIFIED" | "CHANGE_TYPE_ADDED" | "CHANGE_TYPE_MODIFIED" | 5 more` ChangeType is the type of change that happened to the file - `"CHANGE_TYPE_UNSPECIFIED"` - `"CHANGE_TYPE_ADDED"` - `"CHANGE_TYPE_MODIFIED"` - `"CHANGE_TYPE_DELETED"` - `"CHANGE_TYPE_RENAMED"` - `"CHANGE_TYPE_COPIED"` - `"CHANGE_TYPE_UPDATED_BUT_UNMERGED"` - `"CHANGE_TYPE_UNTRACKED"` - `oldPath?: string` old_path is the previous path of the file before a rename or copy. Only set when change_type is RENAMED or COPIED. - `path?: string` path is the path of the file - `cloneUrl?: string` clone_url is the repository url as you would pass it to "git clone". Only HTTPS clone URLs are supported. - `latestCommit?: string` latest_commit is the most recent commit on the current branch - `totalChangedFiles?: number` - `totalUnpushedCommits?: number` the total number of unpushed changes - `unpushedCommits?: Array` unpushed_commits is an array of unpushed changes in the environment, possibly truncated - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the environment content - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `session?: string` session is the session that is currently active in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when the content is present but not in the expected state. - `devcontainer?: Devcontainer` devcontainer contains the status of the devcontainer. - `containerId?: string` container_id is the ID of the container. - `containerName?: string` container_name is the name of the container that is used to connect to the devcontainer - `devcontainerconfigInSync?: boolean` devcontainerconfig_in_sync indicates if the devcontainer is up to date w.r.t. the devcontainer config file. - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root - `devcontainerFilePresence?: "PRESENCE_UNSPECIFIED" | "PRESENCE_GENERATED" | "PRESENCE_DISCOVERED" | "PRESENCE_SPECIFIED"` devcontainer_file_presence indicates how the devcontainer file is present in the repo. - `"PRESENCE_UNSPECIFIED"` - `"PRESENCE_GENERATED"` - `"PRESENCE_DISCOVERED"` - `"PRESENCE_SPECIFIED"` - `failureMessage?: string` failure_message contains the reason the devcontainer failed to operate. - `phase?: "PHASE_UNSPECIFIED" | "PHASE_CREATING" | "PHASE_RUNNING" | 2 more` phase is the current phase of the devcontainer - `"PHASE_UNSPECIFIED"` - `"PHASE_CREATING"` - `"PHASE_RUNNING"` - `"PHASE_STOPPED"` - `"PHASE_FAILED"` - `remoteUser?: string` remote_user is the user that is used to connect to the devcontainer - `remoteWorkspaceFolder?: string` remote_workspace_folder is the folder that is used to connect to the devcontainer - `secretsInSync?: boolean` secrets_in_sync indicates if the secrets are up to date w.r.t. the running devcontainer. - `session?: string` session is the session that is currently active in the devcontainer. - `warningMessage?: string` warning_message contains warnings, e.g. when the devcontainer is present but not in the expected state. - `environmentUrls?: EnvironmentURLs` environment_url contains the URL at which the environment can be accessed. This field is only set if the environment is running. - `logs?: string` logs is the URL at which the environment logs can be accessed. - `ops?: string` ops is the URL at which the environment ops service can be accessed. - `ports?: Array` - `port?: number` port is the port number of the environment port - `url?: string` url is the URL at which the environment port can be accessed - `ssh?: SSH` SSH is the URL at which the environment can be accessed via SSH. - `url?: string` - `supportBundle?: string` support_bundle is the URL at which the environment support bundle can be accessed. - `failureMessage?: Array` failure_message summarises why the environment failed to operate. If this is non-empty the environment has failed to operate and will likely transition to a stopped state. - `machine?: Machine` machine contains the status of the environment machine - `failureMessage?: string` failure_message contains the reason the machine failed to operate. - `phase?: "PHASE_UNSPECIFIED" | "PHASE_CREATING" | "PHASE_STARTING" | 5 more` phase is the current phase of the environment machine - `"PHASE_UNSPECIFIED"` - `"PHASE_CREATING"` - `"PHASE_STARTING"` - `"PHASE_RUNNING"` - `"PHASE_STOPPING"` - `"PHASE_STOPPED"` - `"PHASE_DELETING"` - `"PHASE_DELETED"` - `session?: string` session is the session that is currently active in the machine. - `timeout?: string` timeout contains the reason the environment has timed out. If this field is empty, the environment has not timed out. - `versions?: Versions` versions contains the versions of components in the machine. - `amiId?: string` - `supervisorCommit?: string` - `supervisorVersion?: string` - `warningMessage?: string` warning_message contains warnings, e.g. when the machine is present but not in the expected state. - `phase?: EnvironmentPhase` the phase of an environment is a simple, high-level summary of where the environment is in its lifecycle - `runnerAck?: RunnerAck` runner_ack contains the acknowledgement from the runner that is has received the environment spec. - `message?: string` - `specVersion?: string` - `statusCode?: "STATUS_CODE_UNSPECIFIED" | "STATUS_CODE_OK" | "STATUS_CODE_INVALID_RESOURCE" | "STATUS_CODE_FAILED_PRECONDITION"` - `"STATUS_CODE_UNSPECIFIED"` - `"STATUS_CODE_OK"` - `"STATUS_CODE_INVALID_RESOURCE"` - `"STATUS_CODE_FAILED_PRECONDITION"` - `secrets?: Array` secrets contains the status of the environment secrets - `id?: string` id is the unique identifier of the secret. - `failureMessage?: string` failure_message contains the reason the secret failed to be materialize. - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `secretName?: string` - `session?: string` session is the session that is currently active in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when the secret is present but not in the expected state. - `sshPublicKeys?: Array` ssh_public_keys contains the status of the environment ssh public keys - `id?: string` id is the unique identifier of the public key - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the public key - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `statusVersion?: string` version of the status update. Environment instances themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. - `warningMessage?: Array` warning_message contains warnings, e.g. when the environment is present but not in the expected state. ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const response = await client.environments.createFromProject({ projectId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', spec: { machine: { class: 'd2c94c27-3b76-4a42-b88c-95a85e392c68' }, timeout: { disconnected: '14400s' }, }, }); console.log(response.environment); ``` #### Response ```json { "environment": { "id": "id", "metadata": { "annotations": { "foo": "string" }, "archivedAt": "2019-12-27T18:11:19.117Z", "createdAt": "2019-12-27T18:11:19.117Z", "creator": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "principal": "PRINCIPAL_UNSPECIFIED" }, "lastStartedAt": "2019-12-27T18:11:19.117Z", "lockdownAt": "2019-12-27T18:11:19.117Z", "name": "name", "organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "originalContextUrl": "originalContextUrl", "prebuildId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "projectId": "projectId", "role": "ENVIRONMENT_ROLE_UNSPECIFIED", "runnerId": "runnerId", "sessionId": "sessionId" }, "spec": { "admission": "ADMISSION_LEVEL_UNSPECIFIED", "automationsFile": { "automationsFilePath": "automationsFilePath", "session": "session", "triggerFilter": [ { "beforeSnapshot": true, "manual": true, "postDevcontainerStart": true, "postEnvironmentStart": true, "postMachineStart": true, "prebuild": true } ] }, "content": { "gitEmail": "gitEmail", "gitUsername": "gitUsername", "initializer": { "specs": [ { "contextUrl": { "url": "https://example.com" }, "git": { "checkoutLocation": "checkoutLocation", "cloneTarget": "cloneTarget", "remoteUri": "remoteUri", "targetMode": "CLONE_TARGET_MODE_UNSPECIFIED", "upstreamRemoteUri": "upstreamRemoteUri" } } ] }, "session": "session" }, "desiredPhase": "ENVIRONMENT_PHASE_UNSPECIFIED", "devcontainer": { "defaultDevcontainerImage": "defaultDevcontainerImage", "devcontainerFilePath": "devcontainerFilePath", "dotfiles": { "repository": "https://example.com" }, "lifecycleStage": "LIFECYCLE_STAGE_UNSPECIFIED", "session": "session" }, "kernelControlsConfig": { "bpfDebugLevel": "BPF_DEBUG_LEVEL_UNSPECIFIED", "veto": { "exec": { "action": "KERNEL_CONTROLS_ACTION_UNSPECIFIED", "denyBlockDevices": true, "denylist": [ "string" ], "enabled": true, "resolveBareNames": true, "untouchable": true, "watch": true } } }, "machine": { "class": "class", "preferDualDisk": true, "session": "session" }, "ports": [ { "admission": "ADMISSION_LEVEL_UNSPECIFIED", "authNonce": "authNonce", "name": "x", "port": 1024, "protocol": "PROTOCOL_UNSPECIFIED" } ], "secrets": [ { "id": "id", "apiOnly": true, "containerRegistryBasicAuthHost": "containerRegistryBasicAuthHost", "credentialProxy": { "format": "FORMAT_UNSPECIFIED", "header": "header", "targetHosts": [ "string" ] }, "environmentVariable": "environmentVariable", "filePath": "filePath", "gitCredentialHost": "gitCredentialHost", "name": "name", "scope": "SCOPE_UNSPECIFIED", "session": "session", "source": "source", "sourceRef": "sourceRef" } ], "specVersion": "specVersion", "sshPublicKeys": [ { "id": "id", "value": "value" } ], "timeout": { "disconnected": "+9125115.360s" }, "workflowActionId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" }, "status": { "activitySignal": { "source": "xxx", "timestamp": "2019-12-27T18:11:19.117Z" }, "automationsFile": { "automationsFilePath": "automationsFilePath", "automationsFilePresence": "PRESENCE_UNSPECIFIED", "failureMessage": "failureMessage", "phase": "CONTENT_PHASE_UNSPECIFIED", "session": "session", "warningMessage": "warningMessage" }, "content": { "contentLocationInMachine": "contentLocationInMachine", "failureMessage": "failureMessage", "git": { "branch": "branch", "changedFiles": [ { "changeType": "CHANGE_TYPE_UNSPECIFIED", "oldPath": "oldPath", "path": "path" } ], "cloneUrl": "cloneUrl", "latestCommit": "latestCommit", "totalChangedFiles": 0, "totalUnpushedCommits": 0, "unpushedCommits": [ "string" ] }, "phase": "CONTENT_PHASE_UNSPECIFIED", "session": "session", "warningMessage": "warningMessage" }, "devcontainer": { "containerId": "containerId", "containerName": "containerName", "devcontainerconfigInSync": true, "devcontainerFilePath": "devcontainerFilePath", "devcontainerFilePresence": "PRESENCE_UNSPECIFIED", "failureMessage": "failureMessage", "phase": "PHASE_UNSPECIFIED", "remoteUser": "remoteUser", "remoteWorkspaceFolder": "remoteWorkspaceFolder", "secretsInSync": true, "session": "session", "warningMessage": "warningMessage" }, "environmentUrls": { "logs": "logs", "ops": "ops", "ports": [ { "port": 1024, "url": "url" } ], "ssh": { "url": "url" }, "supportBundle": "supportBundle", "vmLiveUsage": "vmLiveUsage" }, "failureMessage": [ "string" ], "machine": { "dualDisk": true, "failureMessage": "failureMessage", "phase": "PHASE_UNSPECIFIED", "session": "session", "timeout": "timeout", "versions": { "amiId": "amiId", "supervisorCommit": "supervisorCommit", "supervisorVersion": "supervisorVersion" }, "warningMessage": "warningMessage" }, "phase": "ENVIRONMENT_PHASE_UNSPECIFIED", "runnerAck": { "message": "message", "specVersion": "specVersion", "statusCode": "STATUS_CODE_UNSPECIFIED" }, "secrets": [ { "id": "id", "failureMessage": "failureMessage", "phase": "CONTENT_PHASE_UNSPECIFIED", "secretName": "secretName", "session": "session", "warningMessage": "warningMessage" } ], "sshPublicKeys": [ { "id": "id", "phase": "CONTENT_PHASE_UNSPECIFIED" } ], "statusVersion": "statusVersion", "warningMessage": [ "string" ] } } } ``` ## CreateEnvironmentLogsToken `client.environments.createLogsToken(EnvironmentCreateLogsTokenParamsbody, RequestOptionsoptions?): EnvironmentCreateLogsTokenResponse` **post** `/gitpod.v1.EnvironmentService/CreateEnvironmentLogsToken` Creates an access token for retrieving environment logs. Generated tokens are valid for one hour and provide read-only access to the environment's logs. ### Examples - Generate logs token: Creates a temporary access token for retrieving environment logs. ```yaml environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" ``` ### Parameters - `body: EnvironmentCreateLogsTokenParams` - `environmentId?: string` environment_id specifies the environment for which the logs token should be created. +required ### Returns - `EnvironmentCreateLogsTokenResponse` - `accessToken: string` access_token is the token that can be used to access the logs of the environment ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const response = await client.environments.createLogsToken({ environmentId: '07e03a28-65a5-4d98-b532-8ea67b188048', }); console.log(response.accessToken); ``` #### Response ```json { "accessToken": "accessToken" } ``` ## DeleteEnvironment `client.environments.delete(EnvironmentDeleteParamsbody, RequestOptionsoptions?): EnvironmentDeleteResponse` **post** `/gitpod.v1.EnvironmentService/DeleteEnvironment` Permanently deletes an environment. Running environments are automatically stopped before deletion. If force is true, the environment is deleted immediately without graceful shutdown. ### Examples - Delete with graceful shutdown: Deletes an environment after gracefully stopping it. ```yaml environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" force: false ``` - Force delete: Immediately deletes an environment without waiting for graceful shutdown. ```yaml environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" force: true ``` ### Parameters - `body: EnvironmentDeleteParams` - `environmentId?: string` environment_id specifies the environment that is going to delete. +required - `force?: boolean` force indicates whether the environment should be deleted forcefully When force deleting an Environment, the Environment is removed immediately and environment lifecycle is not respected. Force deleting can result in data loss on the environment. ### Returns - `EnvironmentDeleteResponse = unknown` ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const environment = await client.environments.delete({ environmentId: '07e03a28-65a5-4d98-b532-8ea67b188048', }); console.log(environment); ``` #### Response ```json {} ``` ## ListEnvironments `client.environments.list(EnvironmentListParamsparams, RequestOptionsoptions?): EnvironmentsPage` **post** `/gitpod.v1.EnvironmentService/ListEnvironments` Lists all environments matching the specified criteria. Use this method to find and monitor environments across your organization. Results are ordered by creation time with newest environments first. ### Examples - List running environments for a project: Retrieves all running environments for a specific project with pagination. ```yaml filter: statusPhases: ["ENVIRONMENT_PHASE_RUNNING"] projectIds: ["b0e12f6c-4c67-429d-a4a6-d9838b5da047"] pagination: pageSize: 10 ``` - List all environments for a specific runner: Filters environments by runner ID and creator ID. ```yaml filter: runnerIds: ["e6aa9c54-89d3-42c1-ac31-bd8d8f1concentrate"] creatorIds: ["f53d2330-3795-4c5d-a1f3-453121af9c60"] ``` - List stopped and deleted environments: Retrieves all environments in stopped or deleted state. ```yaml filter: statusPhases: ["ENVIRONMENT_PHASE_STOPPED", "ENVIRONMENT_PHASE_DELETED"] ``` ### Parameters - `params: EnvironmentListParams` - `token?: string` Query param - `pageSize?: number` Query param - `filter?: Filter` Body param - `archivalStatus?: "ARCHIVAL_STATUS_UNSPECIFIED" | "ARCHIVAL_STATUS_ACTIVE" | "ARCHIVAL_STATUS_ARCHIVED" | "ARCHIVAL_STATUS_ALL" | null` archival_status filters the response based on environment archive status - `"ARCHIVAL_STATUS_UNSPECIFIED"` - `"ARCHIVAL_STATUS_ACTIVE"` - `"ARCHIVAL_STATUS_ARCHIVED"` - `"ARCHIVAL_STATUS_ALL"` - `createdBefore?: string | null` created_before filters environments created before this timestamp - `creatorIds?: Array` creator_ids filters the response to only Environments created by specified members - `projectIds?: Array` project_ids filters the response to only Environments associated with the specified projects - `roles?: Array` roles filters the response to only Environments with the specified roles - `"ENVIRONMENT_ROLE_UNSPECIFIED"` - `"ENVIRONMENT_ROLE_DEFAULT"` - `"ENVIRONMENT_ROLE_PREBUILD"` - `"ENVIRONMENT_ROLE_WORKFLOW"` - `runnerIds?: Array` runner_ids filters the response to only Environments running on these Runner IDs - `runnerKinds?: Array` runner_kinds filters the response to only Environments running on these Runner Kinds - `"RUNNER_KIND_UNSPECIFIED"` - `"RUNNER_KIND_LOCAL"` - `"RUNNER_KIND_REMOTE"` - `"RUNNER_KIND_LOCAL_CONFIGURATION"` - `sessionIds?: Array` session_ids filters the response to only environments belonging to the specified sessions - `statusPhases?: Array` actual_phases is a list of phases the environment must be in for it to be returned in the API call - `"ENVIRONMENT_PHASE_UNSPECIFIED"` - `"ENVIRONMENT_PHASE_CREATING"` - `"ENVIRONMENT_PHASE_STARTING"` - `"ENVIRONMENT_PHASE_RUNNING"` - `"ENVIRONMENT_PHASE_UPDATING"` - `"ENVIRONMENT_PHASE_STOPPING"` - `"ENVIRONMENT_PHASE_STOPPED"` - `"ENVIRONMENT_PHASE_DELETING"` - `"ENVIRONMENT_PHASE_DELETED"` - `pagination?: Pagination` Body param: pagination contains the pagination options for listing environments - `token?: string` Token for the next set of results that was returned as next_token of a PaginationResponse - `pageSize?: number` Page size is the maximum number of results to retrieve per page. Defaults to 25. Maximum 100. ### Returns - `Environment` +resource get environment - `id: string` ID is a unique identifier of this environment. No other environment with the same name must be managed by this environment manager - `metadata?: EnvironmentMetadata` Metadata is data associated with this environment that's required for other parts of Gitpod to function - `annotations?: Record` annotations are key/value pairs that gets attached to the environment. +internal - not yet implemented - `archivedAt?: string` Time when the Environment was archived. If not set, the environment is not archived. - `createdAt?: string` Time when the Environment was created. - `creator?: Subject` creator is the identity of the creator of the environment - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `lastStartedAt?: string` Time when the Environment was last started (i.e. CreateEnvironment or StartEnvironment were called). - `lockdownAt?: string` lockdown_at is the time at which the environment becomes locked down due to the organization's maximum environment lifetime policy. Nil when no lifetime policy applies. - `name?: string` name is the name of the environment as specified by the user - `organizationId?: string` organization_id is the ID of the organization that contains the environment - `originalContextUrl?: string` original_context_url is the normalized URL from which the environment was created - `prebuildId?: string | null` prebuild_id is the ID of the prebuild this environment was created from. Only set if the environment was created from a prebuild. - `projectId?: string` If the Environment was started from a project, the project_id will reference the project. - `role?: EnvironmentRole` role is the role of the environment - `"ENVIRONMENT_ROLE_UNSPECIFIED"` - `"ENVIRONMENT_ROLE_DEFAULT"` - `"ENVIRONMENT_ROLE_PREBUILD"` - `"ENVIRONMENT_ROLE_WORKFLOW"` - `runnerId?: string` Runner is the ID of the runner that runs this environment. - `spec?: EnvironmentSpec` Spec is the configuration of the environment that's required for the runner to start the environment - `admission?: AdmissionLevel` admission controlls who can access the environment and its ports. - `"ADMISSION_LEVEL_UNSPECIFIED"` - `"ADMISSION_LEVEL_OWNER_ONLY"` - `"ADMISSION_LEVEL_EVERYONE"` - `"ADMISSION_LEVEL_ORGANIZATION"` - `"ADMISSION_LEVEL_CREATOR_ONLY"` - `automationsFile?: AutomationsFile` automations_file is the automations file spec of the environment - `automationsFilePath?: string` automations_file_path is the path to the automations file that is applied in the environment, relative to the repo root. path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `session?: string` - `triggerFilter?: Array` trigger_filter specifies which automation triggers should execute. When set, only automations matching these triggers will run. If empty/unset, all triggers are evaluated normally. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `content?: Content` content is the content spec of the environment - `gitEmail?: string` The Git email address - `gitUsername?: string` The Git username - `initializer?: EnvironmentInitializer` initializer configures how the environment is to be initialized - `specs?: Array` - `contextUrl?: ContextURL` - `url?: string` url is the URL from which the environment is created - `git?: Git` - `checkoutLocation?: string` a path relative to the environment root in which the code will be checked out to - `cloneTarget?: string` the value for the clone target mode - use depends on the target mode - `remoteUri?: string` remote_uri is the Git remote origin - `targetMode?: "CLONE_TARGET_MODE_UNSPECIFIED" | "CLONE_TARGET_MODE_REMOTE_HEAD" | "CLONE_TARGET_MODE_REMOTE_COMMIT" | 3 more` the target mode determines what gets checked out - `"CLONE_TARGET_MODE_UNSPECIFIED"` - `"CLONE_TARGET_MODE_REMOTE_HEAD"` - `"CLONE_TARGET_MODE_REMOTE_COMMIT"` - `"CLONE_TARGET_MODE_REMOTE_BRANCH"` - `"CLONE_TARGET_MODE_LOCAL_BRANCH"` - `"CLONE_TARGET_MODE_REMOTE_TAG"` - `upstreamRemoteUri?: string` upstream_Remote_uri is the fork upstream of a repository - `session?: string` - `desiredPhase?: EnvironmentPhase` Phase is the desired phase of the environment - `"ENVIRONMENT_PHASE_UNSPECIFIED"` - `"ENVIRONMENT_PHASE_CREATING"` - `"ENVIRONMENT_PHASE_STARTING"` - `"ENVIRONMENT_PHASE_RUNNING"` - `"ENVIRONMENT_PHASE_UPDATING"` - `"ENVIRONMENT_PHASE_STOPPING"` - `"ENVIRONMENT_PHASE_STOPPED"` - `"ENVIRONMENT_PHASE_DELETING"` - `"ENVIRONMENT_PHASE_DELETED"` - `devcontainer?: Devcontainer` devcontainer is the devcontainer spec of the environment - `defaultDevcontainerImage?: string` default_devcontainer_image is the default image that is used to start the devcontainer if no devcontainer config file is found - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `dotfiles?: Dotfiles` Experimental: dotfiles is the dotfiles configuration of the devcontainer - `repository: string` URL of a dotfiles Git repository (e.g. https://github.com/owner/repository) - `lifecycleStage?: "LIFECYCLE_STAGE_UNSPECIFIED" | "LIFECYCLE_STAGE_FULL" | "LIFECYCLE_STAGE_PREBUILD"` lifecycle_stage controls which devcontainer lifecycle commands are executed. Defaults to FULL if not specified. - `"LIFECYCLE_STAGE_UNSPECIFIED"` - `"LIFECYCLE_STAGE_FULL"` - `"LIFECYCLE_STAGE_PREBUILD"` - `session?: string` - `kernelControlsConfig?: KernelControlsConfig` kernel_controls_config configures kernel-level controls for this environment - `veto?: Veto` veto controls blocking mechanisms - `exec?: Exec` exec controls executable blocking - `action?: KernelControlsAction` action specifies what action kernel-level controls take on policy violations - `"KERNEL_CONTROLS_ACTION_UNSPECIFIED"` - `"KERNEL_CONTROLS_ACTION_BLOCK"` - `"KERNEL_CONTROLS_ACTION_AUDIT"` - `denylist?: Array` denylist is the list of executable paths or names to block - `enabled?: boolean` enabled controls whether executable blocking is active - `machine?: Machine` machine is the machine spec of the environment - `class?: string` Class denotes the class of the environment we ought to start - `session?: string` - `ports?: Array` ports is the set of ports which ought to be exposed to your network - `admission?: AdmissionLevel` policy of this port - `name?: string` name of this port - `port?: number` port number - `protocol?: "PROTOCOL_UNSPECIFIED" | "PROTOCOL_HTTP" | "PROTOCOL_HTTPS"` protocol for communication (Gateway proxy → user environment service). this setting only affects the protocol used between Gateway and user environment services. - `"PROTOCOL_UNSPECIFIED"` - `"PROTOCOL_HTTP"` - `"PROTOCOL_HTTPS"` - `secrets?: Array` secrets are confidential data that is mounted into the environment - `id?: string` id is the unique identifier of the secret. - `apiOnly?: boolean` api_only indicates the secret is only available via API/CLI. These secrets are resolved but NOT automatically injected into services or devcontainers. - `containerRegistryBasicAuthHost?: string` container_registry_basic_auth_host is the hostname of the container registry that supports basic auth - `credentialProxy?: CredentialProxy` credential_proxy configures transparent credential injection via the credential proxy. When set, the credential proxy intercepts HTTPS traffic to the target hosts and replaces the dummy secret value with the real value in the specified HTTP header. The real secret value is never exposed in the environment. This field is orthogonal to mount — a secret can be both mounted (e.g. as a git credential) and proxied at the same time. - `format?: "FORMAT_UNSPECIFIED" | "FORMAT_PLAIN" | "FORMAT_BASE64"` format describes how the secret value is encoded. The proxy uses this to decode the value before injecting it into the header. - `"FORMAT_UNSPECIFIED"` - `"FORMAT_PLAIN"` - `"FORMAT_BASE64"` - `header?: string` header is the HTTP header name to inject (e.g. "Authorization"). - `targetHosts?: Array` target_hosts lists the hostnames to intercept (for example "github.com" or "*.github.com"). Wildcards are subdomain-only and do not match the apex domain. - `environmentVariable?: string` - `filePath?: string` file_path is the path inside the devcontainer where the secret is mounted - `gitCredentialHost?: string` - `name?: string` name is the human readable description of the secret - `scope?: "SCOPE_UNSPECIFIED" | "SCOPE_ORGANIZATION" | "SCOPE_PROJECT" | 3 more` scope indicates where this secret originated from. Used to filter secrets during build (only org and project secrets are injected). - `"SCOPE_UNSPECIFIED"` - `"SCOPE_ORGANIZATION"` - `"SCOPE_PROJECT"` - `"SCOPE_USER"` - `"SCOPE_SERVICE_ACCOUNT"` - `"SCOPE_RUNNER"` - `session?: string` session indicated the current session of the secret. When the session does not change, secrets are not reloaded in the environment. - `source?: string` source is the source of the secret, for now control-plane or runner - `sourceRef?: string` source_ref into the source, in case of control-plane this is uuid of the secret - `specVersion?: string` version of the spec. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b. - `sshPublicKeys?: Array` ssh_public_keys are the public keys used to ssh into the environment - `id?: string` id is the unique identifier of the public key - `value?: string` value is the actual public key in the public key file format - `timeout?: Timeout` Timeout configures the environment timeout - `disconnected?: string` inacitivity is the maximum time of disconnection before the environment is stopped or paused. Minimum duration is 30 minutes. Set to 0 to disable. value must be 0s (disabled) or at least 1800s (30 minutes): ``` this == duration('0s') || this >= duration('1800s') ``` - `workflowActionId?: string | null` workflow_action_id is an optional reference to the workflow execution action that created this environment. Used for tracking and event correlation. - `status?: EnvironmentStatus` Status is the current status of the environment - `activitySignal?: EnvironmentActivitySignal` activity_signal is the last activity signal for the environment. - `source?: string` source of the activity signal, such as "VS Code", "SSH", or "Automations". It should be a human-readable string that describes the source of the activity signal. - `timestamp?: string` timestamp of when the activity was observed by the source. Only reported every 5 minutes. Zero value means no activity was observed. - `automationsFile?: AutomationsFile` automations_file contains the status of the automations file. - `automationsFilePath?: string` automations_file_path is the path to the automations file relative to the repo root. - `automationsFilePresence?: "PRESENCE_UNSPECIFIED" | "PRESENCE_ABSENT" | "PRESENCE_DISCOVERED" | "PRESENCE_SPECIFIED"` automations_file_presence indicates how an automations file is present in the environment. - `"PRESENCE_UNSPECIFIED"` - `"PRESENCE_ABSENT"` - `"PRESENCE_DISCOVERED"` - `"PRESENCE_SPECIFIED"` - `failureMessage?: string` failure_message contains the reason the automations file failed to be applied. This is only set if the phase is FAILED. - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the automations file. - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `session?: string` session is the automations file session that is currently applied in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when no triggers are defined in the automations file. - `content?: Content` content contains the status of the environment content. - `contentLocationInMachine?: string` content_location_in_machine is the location of the content in the machine - `failureMessage?: string` failure_message contains the reason the content initialization failed. - `git?: Git` git is the Git working copy status of the environment. Note: this is a best-effort field and more often than not will not be present. Its absence does not indicate the absence of a working copy. - `branch?: string` branch is branch we're currently on - `changedFiles?: Array` changed_files is an array of changed files in the environment, possibly truncated - `changeType?: "CHANGE_TYPE_UNSPECIFIED" | "CHANGE_TYPE_ADDED" | "CHANGE_TYPE_MODIFIED" | 5 more` ChangeType is the type of change that happened to the file - `"CHANGE_TYPE_UNSPECIFIED"` - `"CHANGE_TYPE_ADDED"` - `"CHANGE_TYPE_MODIFIED"` - `"CHANGE_TYPE_DELETED"` - `"CHANGE_TYPE_RENAMED"` - `"CHANGE_TYPE_COPIED"` - `"CHANGE_TYPE_UPDATED_BUT_UNMERGED"` - `"CHANGE_TYPE_UNTRACKED"` - `oldPath?: string` old_path is the previous path of the file before a rename or copy. Only set when change_type is RENAMED or COPIED. - `path?: string` path is the path of the file - `cloneUrl?: string` clone_url is the repository url as you would pass it to "git clone". Only HTTPS clone URLs are supported. - `latestCommit?: string` latest_commit is the most recent commit on the current branch - `totalChangedFiles?: number` - `totalUnpushedCommits?: number` the total number of unpushed changes - `unpushedCommits?: Array` unpushed_commits is an array of unpushed changes in the environment, possibly truncated - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the environment content - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `session?: string` session is the session that is currently active in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when the content is present but not in the expected state. - `devcontainer?: Devcontainer` devcontainer contains the status of the devcontainer. - `containerId?: string` container_id is the ID of the container. - `containerName?: string` container_name is the name of the container that is used to connect to the devcontainer - `devcontainerconfigInSync?: boolean` devcontainerconfig_in_sync indicates if the devcontainer is up to date w.r.t. the devcontainer config file. - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root - `devcontainerFilePresence?: "PRESENCE_UNSPECIFIED" | "PRESENCE_GENERATED" | "PRESENCE_DISCOVERED" | "PRESENCE_SPECIFIED"` devcontainer_file_presence indicates how the devcontainer file is present in the repo. - `"PRESENCE_UNSPECIFIED"` - `"PRESENCE_GENERATED"` - `"PRESENCE_DISCOVERED"` - `"PRESENCE_SPECIFIED"` - `failureMessage?: string` failure_message contains the reason the devcontainer failed to operate. - `phase?: "PHASE_UNSPECIFIED" | "PHASE_CREATING" | "PHASE_RUNNING" | 2 more` phase is the current phase of the devcontainer - `"PHASE_UNSPECIFIED"` - `"PHASE_CREATING"` - `"PHASE_RUNNING"` - `"PHASE_STOPPED"` - `"PHASE_FAILED"` - `remoteUser?: string` remote_user is the user that is used to connect to the devcontainer - `remoteWorkspaceFolder?: string` remote_workspace_folder is the folder that is used to connect to the devcontainer - `secretsInSync?: boolean` secrets_in_sync indicates if the secrets are up to date w.r.t. the running devcontainer. - `session?: string` session is the session that is currently active in the devcontainer. - `warningMessage?: string` warning_message contains warnings, e.g. when the devcontainer is present but not in the expected state. - `environmentUrls?: EnvironmentURLs` environment_url contains the URL at which the environment can be accessed. This field is only set if the environment is running. - `logs?: string` logs is the URL at which the environment logs can be accessed. - `ops?: string` ops is the URL at which the environment ops service can be accessed. - `ports?: Array` - `port?: number` port is the port number of the environment port - `url?: string` url is the URL at which the environment port can be accessed - `ssh?: SSH` SSH is the URL at which the environment can be accessed via SSH. - `url?: string` - `supportBundle?: string` support_bundle is the URL at which the environment support bundle can be accessed. - `failureMessage?: Array` failure_message summarises why the environment failed to operate. If this is non-empty the environment has failed to operate and will likely transition to a stopped state. - `machine?: Machine` machine contains the status of the environment machine - `failureMessage?: string` failure_message contains the reason the machine failed to operate. - `phase?: "PHASE_UNSPECIFIED" | "PHASE_CREATING" | "PHASE_STARTING" | 5 more` phase is the current phase of the environment machine - `"PHASE_UNSPECIFIED"` - `"PHASE_CREATING"` - `"PHASE_STARTING"` - `"PHASE_RUNNING"` - `"PHASE_STOPPING"` - `"PHASE_STOPPED"` - `"PHASE_DELETING"` - `"PHASE_DELETED"` - `session?: string` session is the session that is currently active in the machine. - `timeout?: string` timeout contains the reason the environment has timed out. If this field is empty, the environment has not timed out. - `versions?: Versions` versions contains the versions of components in the machine. - `amiId?: string` - `supervisorCommit?: string` - `supervisorVersion?: string` - `warningMessage?: string` warning_message contains warnings, e.g. when the machine is present but not in the expected state. - `phase?: EnvironmentPhase` the phase of an environment is a simple, high-level summary of where the environment is in its lifecycle - `runnerAck?: RunnerAck` runner_ack contains the acknowledgement from the runner that is has received the environment spec. - `message?: string` - `specVersion?: string` - `statusCode?: "STATUS_CODE_UNSPECIFIED" | "STATUS_CODE_OK" | "STATUS_CODE_INVALID_RESOURCE" | "STATUS_CODE_FAILED_PRECONDITION"` - `"STATUS_CODE_UNSPECIFIED"` - `"STATUS_CODE_OK"` - `"STATUS_CODE_INVALID_RESOURCE"` - `"STATUS_CODE_FAILED_PRECONDITION"` - `secrets?: Array` secrets contains the status of the environment secrets - `id?: string` id is the unique identifier of the secret. - `failureMessage?: string` failure_message contains the reason the secret failed to be materialize. - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `secretName?: string` - `session?: string` session is the session that is currently active in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when the secret is present but not in the expected state. - `sshPublicKeys?: Array` ssh_public_keys contains the status of the environment ssh public keys - `id?: string` id is the unique identifier of the public key - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the public key - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `statusVersion?: string` version of the status update. Environment instances themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. - `warningMessage?: Array` warning_message contains warnings, e.g. when the environment is present but not in the expected state. ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const environment of client.environments.list({ filter: { creatorIds: ['f53d2330-3795-4c5d-a1f3-453121af9c60'], runnerIds: ['e6aa9c54-89d3-42c1-ac31-bd8d8f1concentrate'], }, })) { console.log(environment.id); } ``` #### Response ```json { "count": { "relation": "COUNT_RESPONSE_RELATION_UNSPECIFIED", "value": 0 }, "environments": [ { "id": "id", "metadata": { "annotations": { "foo": "string" }, "archivedAt": "2019-12-27T18:11:19.117Z", "createdAt": "2019-12-27T18:11:19.117Z", "creator": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "principal": "PRINCIPAL_UNSPECIFIED" }, "lastStartedAt": "2019-12-27T18:11:19.117Z", "lockdownAt": "2019-12-27T18:11:19.117Z", "name": "name", "organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "originalContextUrl": "originalContextUrl", "prebuildId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "projectId": "projectId", "role": "ENVIRONMENT_ROLE_UNSPECIFIED", "runnerId": "runnerId", "sessionId": "sessionId" }, "spec": { "admission": "ADMISSION_LEVEL_UNSPECIFIED", "automationsFile": { "automationsFilePath": "automationsFilePath", "session": "session", "triggerFilter": [ { "beforeSnapshot": true, "manual": true, "postDevcontainerStart": true, "postEnvironmentStart": true, "postMachineStart": true, "prebuild": true } ] }, "content": { "gitEmail": "gitEmail", "gitUsername": "gitUsername", "initializer": { "specs": [ { "contextUrl": { "url": "https://example.com" }, "git": { "checkoutLocation": "checkoutLocation", "cloneTarget": "cloneTarget", "remoteUri": "remoteUri", "targetMode": "CLONE_TARGET_MODE_UNSPECIFIED", "upstreamRemoteUri": "upstreamRemoteUri" } } ] }, "session": "session" }, "desiredPhase": "ENVIRONMENT_PHASE_UNSPECIFIED", "devcontainer": { "defaultDevcontainerImage": "defaultDevcontainerImage", "devcontainerFilePath": "devcontainerFilePath", "dotfiles": { "repository": "https://example.com" }, "lifecycleStage": "LIFECYCLE_STAGE_UNSPECIFIED", "session": "session" }, "kernelControlsConfig": { "bpfDebugLevel": "BPF_DEBUG_LEVEL_UNSPECIFIED", "veto": { "exec": { "action": "KERNEL_CONTROLS_ACTION_UNSPECIFIED", "denyBlockDevices": true, "denylist": [ "string" ], "enabled": true, "resolveBareNames": true, "untouchable": true, "watch": true } } }, "machine": { "class": "class", "preferDualDisk": true, "session": "session" }, "ports": [ { "admission": "ADMISSION_LEVEL_UNSPECIFIED", "authNonce": "authNonce", "name": "x", "port": 1024, "protocol": "PROTOCOL_UNSPECIFIED" } ], "secrets": [ { "id": "id", "apiOnly": true, "containerRegistryBasicAuthHost": "containerRegistryBasicAuthHost", "credentialProxy": { "format": "FORMAT_UNSPECIFIED", "header": "header", "targetHosts": [ "string" ] }, "environmentVariable": "environmentVariable", "filePath": "filePath", "gitCredentialHost": "gitCredentialHost", "name": "name", "scope": "SCOPE_UNSPECIFIED", "session": "session", "source": "source", "sourceRef": "sourceRef" } ], "specVersion": "specVersion", "sshPublicKeys": [ { "id": "id", "value": "value" } ], "timeout": { "disconnected": "+9125115.360s" }, "workflowActionId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" }, "status": { "activitySignal": { "source": "xxx", "timestamp": "2019-12-27T18:11:19.117Z" }, "automationsFile": { "automationsFilePath": "automationsFilePath", "automationsFilePresence": "PRESENCE_UNSPECIFIED", "failureMessage": "failureMessage", "phase": "CONTENT_PHASE_UNSPECIFIED", "session": "session", "warningMessage": "warningMessage" }, "content": { "contentLocationInMachine": "contentLocationInMachine", "failureMessage": "failureMessage", "git": { "branch": "branch", "changedFiles": [ { "changeType": "CHANGE_TYPE_UNSPECIFIED", "oldPath": "oldPath", "path": "path" } ], "cloneUrl": "cloneUrl", "latestCommit": "latestCommit", "totalChangedFiles": 0, "totalUnpushedCommits": 0, "unpushedCommits": [ "string" ] }, "phase": "CONTENT_PHASE_UNSPECIFIED", "session": "session", "warningMessage": "warningMessage" }, "devcontainer": { "containerId": "containerId", "containerName": "containerName", "devcontainerconfigInSync": true, "devcontainerFilePath": "devcontainerFilePath", "devcontainerFilePresence": "PRESENCE_UNSPECIFIED", "failureMessage": "failureMessage", "phase": "PHASE_UNSPECIFIED", "remoteUser": "remoteUser", "remoteWorkspaceFolder": "remoteWorkspaceFolder", "secretsInSync": true, "session": "session", "warningMessage": "warningMessage" }, "environmentUrls": { "logs": "logs", "ops": "ops", "ports": [ { "port": 1024, "url": "url" } ], "ssh": { "url": "url" }, "supportBundle": "supportBundle", "vmLiveUsage": "vmLiveUsage" }, "failureMessage": [ "string" ], "machine": { "dualDisk": true, "failureMessage": "failureMessage", "phase": "PHASE_UNSPECIFIED", "session": "session", "timeout": "timeout", "versions": { "amiId": "amiId", "supervisorCommit": "supervisorCommit", "supervisorVersion": "supervisorVersion" }, "warningMessage": "warningMessage" }, "phase": "ENVIRONMENT_PHASE_UNSPECIFIED", "runnerAck": { "message": "message", "specVersion": "specVersion", "statusCode": "STATUS_CODE_UNSPECIFIED" }, "secrets": [ { "id": "id", "failureMessage": "failureMessage", "phase": "CONTENT_PHASE_UNSPECIFIED", "secretName": "secretName", "session": "session", "warningMessage": "warningMessage" } ], "sshPublicKeys": [ { "id": "id", "phase": "CONTENT_PHASE_UNSPECIFIED" } ], "statusVersion": "statusVersion", "warningMessage": [ "string" ] } } ], "pagination": { "nextToken": "nextToken" } } ``` ## MarkEnvironmentActive `client.environments.markActive(EnvironmentMarkActiveParamsbody, RequestOptionsoptions?): EnvironmentMarkActiveResponse` **post** `/gitpod.v1.EnvironmentService/MarkEnvironmentActive` Records environment activity to prevent automatic shutdown. Activity signals should be sent every 5 minutes while the environment is actively being used. The source must be between 3-80 characters. ### Examples - Signal VS Code activity: Records VS Code editor activity to prevent environment shutdown. ```yaml environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" activitySignal: source: "VS Code" timestamp: "2025-02-12T14:30:00Z" ``` ### Parameters - `body: EnvironmentMarkActiveParams` - `activitySignal?: EnvironmentActivitySignal` activity_signal specifies the activity. - `source?: string` source of the activity signal, such as "VS Code", "SSH", or "Automations". It should be a human-readable string that describes the source of the activity signal. - `timestamp?: string` timestamp of when the activity was observed by the source. Only reported every 5 minutes. Zero value means no activity was observed. - `environmentId?: string` The ID of the environment to update activity for. ### Returns - `EnvironmentMarkActiveResponse = unknown` ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const response = await client.environments.markActive({ activitySignal: { source: 'VS Code', timestamp: '2025-02-12T14:30:00Z' }, environmentId: '07e03a28-65a5-4d98-b532-8ea67b188048', }); console.log(response); ``` #### Response ```json {} ``` ## GetEnvironment `client.environments.retrieve(EnvironmentRetrieveParamsbody, RequestOptionsoptions?): EnvironmentRetrieveResponse` **post** `/gitpod.v1.EnvironmentService/GetEnvironment` Gets details about a specific environment including its status, configuration, and context URL. Use this method to: - Check if an environment is ready to use - Get connection details for IDE and exposed ports - Monitor environment health and resource usage - Debug environment setup issues ### Examples - Get environment details: Retrieves detailed information about a specific environment using its unique identifier. ```yaml environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" ``` ### Parameters - `body: EnvironmentRetrieveParams` - `environmentId: string` environment_id specifies the environment to get ### Returns - `EnvironmentRetrieveResponse` - `environment: Environment` +resource get environment - `id: string` ID is a unique identifier of this environment. No other environment with the same name must be managed by this environment manager - `metadata?: EnvironmentMetadata` Metadata is data associated with this environment that's required for other parts of Gitpod to function - `annotations?: Record` annotations are key/value pairs that gets attached to the environment. +internal - not yet implemented - `archivedAt?: string` Time when the Environment was archived. If not set, the environment is not archived. - `createdAt?: string` Time when the Environment was created. - `creator?: Subject` creator is the identity of the creator of the environment - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `lastStartedAt?: string` Time when the Environment was last started (i.e. CreateEnvironment or StartEnvironment were called). - `lockdownAt?: string` lockdown_at is the time at which the environment becomes locked down due to the organization's maximum environment lifetime policy. Nil when no lifetime policy applies. - `name?: string` name is the name of the environment as specified by the user - `organizationId?: string` organization_id is the ID of the organization that contains the environment - `originalContextUrl?: string` original_context_url is the normalized URL from which the environment was created - `prebuildId?: string | null` prebuild_id is the ID of the prebuild this environment was created from. Only set if the environment was created from a prebuild. - `projectId?: string` If the Environment was started from a project, the project_id will reference the project. - `role?: EnvironmentRole` role is the role of the environment - `"ENVIRONMENT_ROLE_UNSPECIFIED"` - `"ENVIRONMENT_ROLE_DEFAULT"` - `"ENVIRONMENT_ROLE_PREBUILD"` - `"ENVIRONMENT_ROLE_WORKFLOW"` - `runnerId?: string` Runner is the ID of the runner that runs this environment. - `spec?: EnvironmentSpec` Spec is the configuration of the environment that's required for the runner to start the environment - `admission?: AdmissionLevel` admission controlls who can access the environment and its ports. - `"ADMISSION_LEVEL_UNSPECIFIED"` - `"ADMISSION_LEVEL_OWNER_ONLY"` - `"ADMISSION_LEVEL_EVERYONE"` - `"ADMISSION_LEVEL_ORGANIZATION"` - `"ADMISSION_LEVEL_CREATOR_ONLY"` - `automationsFile?: AutomationsFile` automations_file is the automations file spec of the environment - `automationsFilePath?: string` automations_file_path is the path to the automations file that is applied in the environment, relative to the repo root. path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `session?: string` - `triggerFilter?: Array` trigger_filter specifies which automation triggers should execute. When set, only automations matching these triggers will run. If empty/unset, all triggers are evaluated normally. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `content?: Content` content is the content spec of the environment - `gitEmail?: string` The Git email address - `gitUsername?: string` The Git username - `initializer?: EnvironmentInitializer` initializer configures how the environment is to be initialized - `specs?: Array` - `contextUrl?: ContextURL` - `url?: string` url is the URL from which the environment is created - `git?: Git` - `checkoutLocation?: string` a path relative to the environment root in which the code will be checked out to - `cloneTarget?: string` the value for the clone target mode - use depends on the target mode - `remoteUri?: string` remote_uri is the Git remote origin - `targetMode?: "CLONE_TARGET_MODE_UNSPECIFIED" | "CLONE_TARGET_MODE_REMOTE_HEAD" | "CLONE_TARGET_MODE_REMOTE_COMMIT" | 3 more` the target mode determines what gets checked out - `"CLONE_TARGET_MODE_UNSPECIFIED"` - `"CLONE_TARGET_MODE_REMOTE_HEAD"` - `"CLONE_TARGET_MODE_REMOTE_COMMIT"` - `"CLONE_TARGET_MODE_REMOTE_BRANCH"` - `"CLONE_TARGET_MODE_LOCAL_BRANCH"` - `"CLONE_TARGET_MODE_REMOTE_TAG"` - `upstreamRemoteUri?: string` upstream_Remote_uri is the fork upstream of a repository - `session?: string` - `desiredPhase?: EnvironmentPhase` Phase is the desired phase of the environment - `"ENVIRONMENT_PHASE_UNSPECIFIED"` - `"ENVIRONMENT_PHASE_CREATING"` - `"ENVIRONMENT_PHASE_STARTING"` - `"ENVIRONMENT_PHASE_RUNNING"` - `"ENVIRONMENT_PHASE_UPDATING"` - `"ENVIRONMENT_PHASE_STOPPING"` - `"ENVIRONMENT_PHASE_STOPPED"` - `"ENVIRONMENT_PHASE_DELETING"` - `"ENVIRONMENT_PHASE_DELETED"` - `devcontainer?: Devcontainer` devcontainer is the devcontainer spec of the environment - `defaultDevcontainerImage?: string` default_devcontainer_image is the default image that is used to start the devcontainer if no devcontainer config file is found - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `dotfiles?: Dotfiles` Experimental: dotfiles is the dotfiles configuration of the devcontainer - `repository: string` URL of a dotfiles Git repository (e.g. https://github.com/owner/repository) - `lifecycleStage?: "LIFECYCLE_STAGE_UNSPECIFIED" | "LIFECYCLE_STAGE_FULL" | "LIFECYCLE_STAGE_PREBUILD"` lifecycle_stage controls which devcontainer lifecycle commands are executed. Defaults to FULL if not specified. - `"LIFECYCLE_STAGE_UNSPECIFIED"` - `"LIFECYCLE_STAGE_FULL"` - `"LIFECYCLE_STAGE_PREBUILD"` - `session?: string` - `kernelControlsConfig?: KernelControlsConfig` kernel_controls_config configures kernel-level controls for this environment - `veto?: Veto` veto controls blocking mechanisms - `exec?: Exec` exec controls executable blocking - `action?: KernelControlsAction` action specifies what action kernel-level controls take on policy violations - `"KERNEL_CONTROLS_ACTION_UNSPECIFIED"` - `"KERNEL_CONTROLS_ACTION_BLOCK"` - `"KERNEL_CONTROLS_ACTION_AUDIT"` - `denylist?: Array` denylist is the list of executable paths or names to block - `enabled?: boolean` enabled controls whether executable blocking is active - `machine?: Machine` machine is the machine spec of the environment - `class?: string` Class denotes the class of the environment we ought to start - `session?: string` - `ports?: Array` ports is the set of ports which ought to be exposed to your network - `admission?: AdmissionLevel` policy of this port - `name?: string` name of this port - `port?: number` port number - `protocol?: "PROTOCOL_UNSPECIFIED" | "PROTOCOL_HTTP" | "PROTOCOL_HTTPS"` protocol for communication (Gateway proxy → user environment service). this setting only affects the protocol used between Gateway and user environment services. - `"PROTOCOL_UNSPECIFIED"` - `"PROTOCOL_HTTP"` - `"PROTOCOL_HTTPS"` - `secrets?: Array` secrets are confidential data that is mounted into the environment - `id?: string` id is the unique identifier of the secret. - `apiOnly?: boolean` api_only indicates the secret is only available via API/CLI. These secrets are resolved but NOT automatically injected into services or devcontainers. - `containerRegistryBasicAuthHost?: string` container_registry_basic_auth_host is the hostname of the container registry that supports basic auth - `credentialProxy?: CredentialProxy` credential_proxy configures transparent credential injection via the credential proxy. When set, the credential proxy intercepts HTTPS traffic to the target hosts and replaces the dummy secret value with the real value in the specified HTTP header. The real secret value is never exposed in the environment. This field is orthogonal to mount — a secret can be both mounted (e.g. as a git credential) and proxied at the same time. - `format?: "FORMAT_UNSPECIFIED" | "FORMAT_PLAIN" | "FORMAT_BASE64"` format describes how the secret value is encoded. The proxy uses this to decode the value before injecting it into the header. - `"FORMAT_UNSPECIFIED"` - `"FORMAT_PLAIN"` - `"FORMAT_BASE64"` - `header?: string` header is the HTTP header name to inject (e.g. "Authorization"). - `targetHosts?: Array` target_hosts lists the hostnames to intercept (for example "github.com" or "*.github.com"). Wildcards are subdomain-only and do not match the apex domain. - `environmentVariable?: string` - `filePath?: string` file_path is the path inside the devcontainer where the secret is mounted - `gitCredentialHost?: string` - `name?: string` name is the human readable description of the secret - `scope?: "SCOPE_UNSPECIFIED" | "SCOPE_ORGANIZATION" | "SCOPE_PROJECT" | 3 more` scope indicates where this secret originated from. Used to filter secrets during build (only org and project secrets are injected). - `"SCOPE_UNSPECIFIED"` - `"SCOPE_ORGANIZATION"` - `"SCOPE_PROJECT"` - `"SCOPE_USER"` - `"SCOPE_SERVICE_ACCOUNT"` - `"SCOPE_RUNNER"` - `session?: string` session indicated the current session of the secret. When the session does not change, secrets are not reloaded in the environment. - `source?: string` source is the source of the secret, for now control-plane or runner - `sourceRef?: string` source_ref into the source, in case of control-plane this is uuid of the secret - `specVersion?: string` version of the spec. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b. - `sshPublicKeys?: Array` ssh_public_keys are the public keys used to ssh into the environment - `id?: string` id is the unique identifier of the public key - `value?: string` value is the actual public key in the public key file format - `timeout?: Timeout` Timeout configures the environment timeout - `disconnected?: string` inacitivity is the maximum time of disconnection before the environment is stopped or paused. Minimum duration is 30 minutes. Set to 0 to disable. value must be 0s (disabled) or at least 1800s (30 minutes): ``` this == duration('0s') || this >= duration('1800s') ``` - `workflowActionId?: string | null` workflow_action_id is an optional reference to the workflow execution action that created this environment. Used for tracking and event correlation. - `status?: EnvironmentStatus` Status is the current status of the environment - `activitySignal?: EnvironmentActivitySignal` activity_signal is the last activity signal for the environment. - `source?: string` source of the activity signal, such as "VS Code", "SSH", or "Automations". It should be a human-readable string that describes the source of the activity signal. - `timestamp?: string` timestamp of when the activity was observed by the source. Only reported every 5 minutes. Zero value means no activity was observed. - `automationsFile?: AutomationsFile` automations_file contains the status of the automations file. - `automationsFilePath?: string` automations_file_path is the path to the automations file relative to the repo root. - `automationsFilePresence?: "PRESENCE_UNSPECIFIED" | "PRESENCE_ABSENT" | "PRESENCE_DISCOVERED" | "PRESENCE_SPECIFIED"` automations_file_presence indicates how an automations file is present in the environment. - `"PRESENCE_UNSPECIFIED"` - `"PRESENCE_ABSENT"` - `"PRESENCE_DISCOVERED"` - `"PRESENCE_SPECIFIED"` - `failureMessage?: string` failure_message contains the reason the automations file failed to be applied. This is only set if the phase is FAILED. - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the automations file. - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `session?: string` session is the automations file session that is currently applied in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when no triggers are defined in the automations file. - `content?: Content` content contains the status of the environment content. - `contentLocationInMachine?: string` content_location_in_machine is the location of the content in the machine - `failureMessage?: string` failure_message contains the reason the content initialization failed. - `git?: Git` git is the Git working copy status of the environment. Note: this is a best-effort field and more often than not will not be present. Its absence does not indicate the absence of a working copy. - `branch?: string` branch is branch we're currently on - `changedFiles?: Array` changed_files is an array of changed files in the environment, possibly truncated - `changeType?: "CHANGE_TYPE_UNSPECIFIED" | "CHANGE_TYPE_ADDED" | "CHANGE_TYPE_MODIFIED" | 5 more` ChangeType is the type of change that happened to the file - `"CHANGE_TYPE_UNSPECIFIED"` - `"CHANGE_TYPE_ADDED"` - `"CHANGE_TYPE_MODIFIED"` - `"CHANGE_TYPE_DELETED"` - `"CHANGE_TYPE_RENAMED"` - `"CHANGE_TYPE_COPIED"` - `"CHANGE_TYPE_UPDATED_BUT_UNMERGED"` - `"CHANGE_TYPE_UNTRACKED"` - `oldPath?: string` old_path is the previous path of the file before a rename or copy. Only set when change_type is RENAMED or COPIED. - `path?: string` path is the path of the file - `cloneUrl?: string` clone_url is the repository url as you would pass it to "git clone". Only HTTPS clone URLs are supported. - `latestCommit?: string` latest_commit is the most recent commit on the current branch - `totalChangedFiles?: number` - `totalUnpushedCommits?: number` the total number of unpushed changes - `unpushedCommits?: Array` unpushed_commits is an array of unpushed changes in the environment, possibly truncated - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the environment content - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `session?: string` session is the session that is currently active in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when the content is present but not in the expected state. - `devcontainer?: Devcontainer` devcontainer contains the status of the devcontainer. - `containerId?: string` container_id is the ID of the container. - `containerName?: string` container_name is the name of the container that is used to connect to the devcontainer - `devcontainerconfigInSync?: boolean` devcontainerconfig_in_sync indicates if the devcontainer is up to date w.r.t. the devcontainer config file. - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root - `devcontainerFilePresence?: "PRESENCE_UNSPECIFIED" | "PRESENCE_GENERATED" | "PRESENCE_DISCOVERED" | "PRESENCE_SPECIFIED"` devcontainer_file_presence indicates how the devcontainer file is present in the repo. - `"PRESENCE_UNSPECIFIED"` - `"PRESENCE_GENERATED"` - `"PRESENCE_DISCOVERED"` - `"PRESENCE_SPECIFIED"` - `failureMessage?: string` failure_message contains the reason the devcontainer failed to operate. - `phase?: "PHASE_UNSPECIFIED" | "PHASE_CREATING" | "PHASE_RUNNING" | 2 more` phase is the current phase of the devcontainer - `"PHASE_UNSPECIFIED"` - `"PHASE_CREATING"` - `"PHASE_RUNNING"` - `"PHASE_STOPPED"` - `"PHASE_FAILED"` - `remoteUser?: string` remote_user is the user that is used to connect to the devcontainer - `remoteWorkspaceFolder?: string` remote_workspace_folder is the folder that is used to connect to the devcontainer - `secretsInSync?: boolean` secrets_in_sync indicates if the secrets are up to date w.r.t. the running devcontainer. - `session?: string` session is the session that is currently active in the devcontainer. - `warningMessage?: string` warning_message contains warnings, e.g. when the devcontainer is present but not in the expected state. - `environmentUrls?: EnvironmentURLs` environment_url contains the URL at which the environment can be accessed. This field is only set if the environment is running. - `logs?: string` logs is the URL at which the environment logs can be accessed. - `ops?: string` ops is the URL at which the environment ops service can be accessed. - `ports?: Array` - `port?: number` port is the port number of the environment port - `url?: string` url is the URL at which the environment port can be accessed - `ssh?: SSH` SSH is the URL at which the environment can be accessed via SSH. - `url?: string` - `supportBundle?: string` support_bundle is the URL at which the environment support bundle can be accessed. - `failureMessage?: Array` failure_message summarises why the environment failed to operate. If this is non-empty the environment has failed to operate and will likely transition to a stopped state. - `machine?: Machine` machine contains the status of the environment machine - `failureMessage?: string` failure_message contains the reason the machine failed to operate. - `phase?: "PHASE_UNSPECIFIED" | "PHASE_CREATING" | "PHASE_STARTING" | 5 more` phase is the current phase of the environment machine - `"PHASE_UNSPECIFIED"` - `"PHASE_CREATING"` - `"PHASE_STARTING"` - `"PHASE_RUNNING"` - `"PHASE_STOPPING"` - `"PHASE_STOPPED"` - `"PHASE_DELETING"` - `"PHASE_DELETED"` - `session?: string` session is the session that is currently active in the machine. - `timeout?: string` timeout contains the reason the environment has timed out. If this field is empty, the environment has not timed out. - `versions?: Versions` versions contains the versions of components in the machine. - `amiId?: string` - `supervisorCommit?: string` - `supervisorVersion?: string` - `warningMessage?: string` warning_message contains warnings, e.g. when the machine is present but not in the expected state. - `phase?: EnvironmentPhase` the phase of an environment is a simple, high-level summary of where the environment is in its lifecycle - `runnerAck?: RunnerAck` runner_ack contains the acknowledgement from the runner that is has received the environment spec. - `message?: string` - `specVersion?: string` - `statusCode?: "STATUS_CODE_UNSPECIFIED" | "STATUS_CODE_OK" | "STATUS_CODE_INVALID_RESOURCE" | "STATUS_CODE_FAILED_PRECONDITION"` - `"STATUS_CODE_UNSPECIFIED"` - `"STATUS_CODE_OK"` - `"STATUS_CODE_INVALID_RESOURCE"` - `"STATUS_CODE_FAILED_PRECONDITION"` - `secrets?: Array` secrets contains the status of the environment secrets - `id?: string` id is the unique identifier of the secret. - `failureMessage?: string` failure_message contains the reason the secret failed to be materialize. - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `secretName?: string` - `session?: string` session is the session that is currently active in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when the secret is present but not in the expected state. - `sshPublicKeys?: Array` ssh_public_keys contains the status of the environment ssh public keys - `id?: string` id is the unique identifier of the public key - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the public key - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `statusVersion?: string` version of the status update. Environment instances themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. - `warningMessage?: Array` warning_message contains warnings, e.g. when the environment is present but not in the expected state. ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const environment = await client.environments.retrieve({ environmentId: '07e03a28-65a5-4d98-b532-8ea67b188048', }); console.log(environment.environment); ``` #### Response ```json { "environment": { "id": "id", "metadata": { "annotations": { "foo": "string" }, "archivedAt": "2019-12-27T18:11:19.117Z", "createdAt": "2019-12-27T18:11:19.117Z", "creator": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "principal": "PRINCIPAL_UNSPECIFIED" }, "lastStartedAt": "2019-12-27T18:11:19.117Z", "lockdownAt": "2019-12-27T18:11:19.117Z", "name": "name", "organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "originalContextUrl": "originalContextUrl", "prebuildId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "projectId": "projectId", "role": "ENVIRONMENT_ROLE_UNSPECIFIED", "runnerId": "runnerId", "sessionId": "sessionId" }, "spec": { "admission": "ADMISSION_LEVEL_UNSPECIFIED", "automationsFile": { "automationsFilePath": "automationsFilePath", "session": "session", "triggerFilter": [ { "beforeSnapshot": true, "manual": true, "postDevcontainerStart": true, "postEnvironmentStart": true, "postMachineStart": true, "prebuild": true } ] }, "content": { "gitEmail": "gitEmail", "gitUsername": "gitUsername", "initializer": { "specs": [ { "contextUrl": { "url": "https://example.com" }, "git": { "checkoutLocation": "checkoutLocation", "cloneTarget": "cloneTarget", "remoteUri": "remoteUri", "targetMode": "CLONE_TARGET_MODE_UNSPECIFIED", "upstreamRemoteUri": "upstreamRemoteUri" } } ] }, "session": "session" }, "desiredPhase": "ENVIRONMENT_PHASE_UNSPECIFIED", "devcontainer": { "defaultDevcontainerImage": "defaultDevcontainerImage", "devcontainerFilePath": "devcontainerFilePath", "dotfiles": { "repository": "https://example.com" }, "lifecycleStage": "LIFECYCLE_STAGE_UNSPECIFIED", "session": "session" }, "kernelControlsConfig": { "bpfDebugLevel": "BPF_DEBUG_LEVEL_UNSPECIFIED", "veto": { "exec": { "action": "KERNEL_CONTROLS_ACTION_UNSPECIFIED", "denyBlockDevices": true, "denylist": [ "string" ], "enabled": true, "resolveBareNames": true, "untouchable": true, "watch": true } } }, "machine": { "class": "class", "preferDualDisk": true, "session": "session" }, "ports": [ { "admission": "ADMISSION_LEVEL_UNSPECIFIED", "authNonce": "authNonce", "name": "x", "port": 1024, "protocol": "PROTOCOL_UNSPECIFIED" } ], "secrets": [ { "id": "id", "apiOnly": true, "containerRegistryBasicAuthHost": "containerRegistryBasicAuthHost", "credentialProxy": { "format": "FORMAT_UNSPECIFIED", "header": "header", "targetHosts": [ "string" ] }, "environmentVariable": "environmentVariable", "filePath": "filePath", "gitCredentialHost": "gitCredentialHost", "name": "name", "scope": "SCOPE_UNSPECIFIED", "session": "session", "source": "source", "sourceRef": "sourceRef" } ], "specVersion": "specVersion", "sshPublicKeys": [ { "id": "id", "value": "value" } ], "timeout": { "disconnected": "+9125115.360s" }, "workflowActionId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" }, "status": { "activitySignal": { "source": "xxx", "timestamp": "2019-12-27T18:11:19.117Z" }, "automationsFile": { "automationsFilePath": "automationsFilePath", "automationsFilePresence": "PRESENCE_UNSPECIFIED", "failureMessage": "failureMessage", "phase": "CONTENT_PHASE_UNSPECIFIED", "session": "session", "warningMessage": "warningMessage" }, "content": { "contentLocationInMachine": "contentLocationInMachine", "failureMessage": "failureMessage", "git": { "branch": "branch", "changedFiles": [ { "changeType": "CHANGE_TYPE_UNSPECIFIED", "oldPath": "oldPath", "path": "path" } ], "cloneUrl": "cloneUrl", "latestCommit": "latestCommit", "totalChangedFiles": 0, "totalUnpushedCommits": 0, "unpushedCommits": [ "string" ] }, "phase": "CONTENT_PHASE_UNSPECIFIED", "session": "session", "warningMessage": "warningMessage" }, "devcontainer": { "containerId": "containerId", "containerName": "containerName", "devcontainerconfigInSync": true, "devcontainerFilePath": "devcontainerFilePath", "devcontainerFilePresence": "PRESENCE_UNSPECIFIED", "failureMessage": "failureMessage", "phase": "PHASE_UNSPECIFIED", "remoteUser": "remoteUser", "remoteWorkspaceFolder": "remoteWorkspaceFolder", "secretsInSync": true, "session": "session", "warningMessage": "warningMessage" }, "environmentUrls": { "logs": "logs", "ops": "ops", "ports": [ { "port": 1024, "url": "url" } ], "ssh": { "url": "url" }, "supportBundle": "supportBundle", "vmLiveUsage": "vmLiveUsage" }, "failureMessage": [ "string" ], "machine": { "dualDisk": true, "failureMessage": "failureMessage", "phase": "PHASE_UNSPECIFIED", "session": "session", "timeout": "timeout", "versions": { "amiId": "amiId", "supervisorCommit": "supervisorCommit", "supervisorVersion": "supervisorVersion" }, "warningMessage": "warningMessage" }, "phase": "ENVIRONMENT_PHASE_UNSPECIFIED", "runnerAck": { "message": "message", "specVersion": "specVersion", "statusCode": "STATUS_CODE_UNSPECIFIED" }, "secrets": [ { "id": "id", "failureMessage": "failureMessage", "phase": "CONTENT_PHASE_UNSPECIFIED", "secretName": "secretName", "session": "session", "warningMessage": "warningMessage" } ], "sshPublicKeys": [ { "id": "id", "phase": "CONTENT_PHASE_UNSPECIFIED" } ], "statusVersion": "statusVersion", "warningMessage": [ "string" ] } } } ``` ## StartEnvironment `client.environments.start(EnvironmentStartParamsbody, RequestOptionsoptions?): EnvironmentStartResponse` **post** `/gitpod.v1.EnvironmentService/StartEnvironment` Starts a stopped environment. Use this method to resume work on a previously stopped environment. The environment retains its configuration and workspace content from when it was stopped. ### Examples - Start an environment: Resumes a previously stopped environment with its existing configuration. ```yaml environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" ``` ### Parameters - `body: EnvironmentStartParams` - `environmentId?: string` environment_id specifies which environment should be started. ### Returns - `EnvironmentStartResponse = unknown` ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const response = await client.environments.start({ environmentId: '07e03a28-65a5-4d98-b532-8ea67b188048', }); console.log(response); ``` #### Response ```json {} ``` ## StopEnvironment `client.environments.stop(EnvironmentStopParamsbody, RequestOptionsoptions?): EnvironmentStopResponse` **post** `/gitpod.v1.EnvironmentService/StopEnvironment` Stops a running environment. Use this method to pause work while preserving the environment's state. The environment can be resumed later using StartEnvironment. ### Examples - Stop an environment: Gracefully stops a running environment while preserving its state. ```yaml environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" ``` ### Parameters - `body: EnvironmentStopParams` - `environmentId?: string` environment_id specifies which environment should be stopped. +required ### Returns - `EnvironmentStopResponse = unknown` ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const response = await client.environments.stop({ environmentId: '07e03a28-65a5-4d98-b532-8ea67b188048', }); console.log(response); ``` #### Response ```json {} ``` ## UnarchiveEnvironment `client.environments.unarchive(EnvironmentUnarchiveParamsbody, RequestOptionsoptions?): EnvironmentUnarchiveResponse` **post** `/gitpod.v1.EnvironmentService/UnarchiveEnvironment` Unarchives an environment. ### Examples - Unarchive an environment: ```yaml environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" ``` ### Parameters - `body: EnvironmentUnarchiveParams` - `environmentId?: string` environment_id specifies the environment to unarchive. +required ### Returns - `EnvironmentUnarchiveResponse = unknown` ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const response = await client.environments.unarchive({ environmentId: '07e03a28-65a5-4d98-b532-8ea67b188048', }); console.log(response); ``` #### Response ```json {} ``` ## UpdateEnvironment `client.environments.update(EnvironmentUpdateParamsbody, RequestOptionsoptions?): EnvironmentUpdateResponse` **post** `/gitpod.v1.EnvironmentService/UpdateEnvironment` Updates an environment's configuration while it is running. Updates are limited to: - Git credentials (username, email) - SSH public keys - Content initialization - Port configurations - Automation files - Environment timeouts ### Examples - Update Git credentials: Updates the Git configuration for the environment. ```yaml environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" spec: content: gitUsername: "example-user" gitEmail: "user@example.com" ``` - Add SSH public key: Adds a new SSH public key for authentication. ```yaml environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" spec: sshPublicKeys: - id: "0194b7c1-c954-718d-91a4-9a742aa5fc11" value: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI..." ``` - Update content session: Updates the content session identifier for the environment. ```yaml environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" spec: content: session: "0194b7c1-c954-718d-91a4-9a742aa5fc11" ``` Note: Machine class changes require stopping the environment and creating a new one. ### Parameters - `body: EnvironmentUpdateParams` - `environmentId?: string` environment_id specifies which environment should be updated. +required - `metadata?: Metadata | null` - `name?: string | null` name is the user-defined display name of the environment - `spec?: Spec | null` - `automationsFile?: AutomationsFile | null` automations_file is the automations file spec of the environment - `automationsFilePath?: string | null` automations_file_path is the path to the automations file that is applied in the environment, relative to the repo root. path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `session?: string | null` - `content?: Content | null` - `gitEmail?: string | null` The Git email address - `gitUsername?: string | null` The Git username - `initializer?: EnvironmentInitializer | null` initializer configures how the environment is to be initialized - `specs?: Array` - `contextUrl?: ContextURL` - `url?: string` url is the URL from which the environment is created - `git?: Git` - `checkoutLocation?: string` a path relative to the environment root in which the code will be checked out to - `cloneTarget?: string` the value for the clone target mode - use depends on the target mode - `remoteUri?: string` remote_uri is the Git remote origin - `targetMode?: "CLONE_TARGET_MODE_UNSPECIFIED" | "CLONE_TARGET_MODE_REMOTE_HEAD" | "CLONE_TARGET_MODE_REMOTE_COMMIT" | 3 more` the target mode determines what gets checked out - `"CLONE_TARGET_MODE_UNSPECIFIED"` - `"CLONE_TARGET_MODE_REMOTE_HEAD"` - `"CLONE_TARGET_MODE_REMOTE_COMMIT"` - `"CLONE_TARGET_MODE_REMOTE_BRANCH"` - `"CLONE_TARGET_MODE_LOCAL_BRANCH"` - `"CLONE_TARGET_MODE_REMOTE_TAG"` - `upstreamRemoteUri?: string` upstream_Remote_uri is the fork upstream of a repository - `session?: string | null` session should be changed to trigger a content reinitialization - `devcontainer?: Devcontainer | null` - `devcontainerFilePath?: string | null` devcontainer_file_path is the path to the devcontainer file relative to the repo root path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `session?: string | null` session should be changed to trigger a devcontainer rebuild - `kernelControlsConfig?: KernelControlsConfig | null` kernel_controls_config configures kernel-level controls for this environment - `veto?: Veto` veto controls blocking mechanisms - `exec?: Exec` exec controls executable blocking - `action?: KernelControlsAction` action specifies what action kernel-level controls take on policy violations - `"KERNEL_CONTROLS_ACTION_UNSPECIFIED"` - `"KERNEL_CONTROLS_ACTION_BLOCK"` - `"KERNEL_CONTROLS_ACTION_AUDIT"` - `denylist?: Array` denylist is the list of executable paths or names to block - `enabled?: boolean` enabled controls whether executable blocking is active - `ports?: Array` ports controls port sharing - `admission?: AdmissionLevel` policy of this port - `"ADMISSION_LEVEL_UNSPECIFIED"` - `"ADMISSION_LEVEL_OWNER_ONLY"` - `"ADMISSION_LEVEL_EVERYONE"` - `"ADMISSION_LEVEL_ORGANIZATION"` - `"ADMISSION_LEVEL_CREATOR_ONLY"` - `name?: string` name of this port - `port?: number` port number - `protocol?: "PROTOCOL_UNSPECIFIED" | "PROTOCOL_HTTP" | "PROTOCOL_HTTPS"` protocol for communication (Gateway proxy → user environment service). this setting only affects the protocol used between Gateway and user environment services. - `"PROTOCOL_UNSPECIFIED"` - `"PROTOCOL_HTTP"` - `"PROTOCOL_HTTPS"` - `sshPublicKeys?: Array` ssh_public_keys are the public keys to update empty array means nothing to update - `id?: string` id is the unique identifier of the public key - `value?: string | null` value is the actual public key in the public key file format if not provided, the public key will be removed - `timeout?: Timeout | null` Timeout configures the environment timeout - `disconnected?: string | null` inacitivity is the maximum time of disconnection before the environment is stopped or paused. Minimum duration is 30 minutes. Set to 0 to disable. value must be 0s (disabled) or at least 1800s (30 minutes): ``` this == duration('0s') || this >= duration('1800s') ``` ### Returns - `EnvironmentUpdateResponse = unknown` ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const environment = await client.environments.update({ environmentId: '07e03a28-65a5-4d98-b532-8ea67b188048', spec: { sshPublicKeys: [ { id: '0194b7c1-c954-718d-91a4-9a742aa5fc11', value: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI...', }, ], }, }); console.log(environment); ``` #### Response ```json {} ``` ## Domain Types ### Admission Level - `AdmissionLevel = "ADMISSION_LEVEL_UNSPECIFIED" | "ADMISSION_LEVEL_OWNER_ONLY" | "ADMISSION_LEVEL_EVERYONE" | 2 more` Admission level describes who can access an environment instance and its ports. - `"ADMISSION_LEVEL_UNSPECIFIED"` - `"ADMISSION_LEVEL_OWNER_ONLY"` - `"ADMISSION_LEVEL_EVERYONE"` - `"ADMISSION_LEVEL_ORGANIZATION"` - `"ADMISSION_LEVEL_CREATOR_ONLY"` ### Bpf Debug Level - `BpfDebugLevel = "BPF_DEBUG_LEVEL_UNSPECIFIED" | "BPF_DEBUG_LEVEL_INFO" | "BPF_DEBUG_LEVEL_VERBOSE"` BPFDebugLevel controls the verbosity of BPF trace_pipe output (bpf_printk). Applies to all BPF-based agents (veto exec, future agents). - `"BPF_DEBUG_LEVEL_UNSPECIFIED"` - `"BPF_DEBUG_LEVEL_INFO"` - `"BPF_DEBUG_LEVEL_VERBOSE"` ### Environment - `Environment` +resource get environment - `id: string` ID is a unique identifier of this environment. No other environment with the same name must be managed by this environment manager - `metadata?: EnvironmentMetadata` Metadata is data associated with this environment that's required for other parts of Gitpod to function - `annotations?: Record` annotations are key/value pairs that gets attached to the environment. +internal - not yet implemented - `archivedAt?: string` Time when the Environment was archived. If not set, the environment is not archived. - `createdAt?: string` Time when the Environment was created. - `creator?: Subject` creator is the identity of the creator of the environment - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `lastStartedAt?: string` Time when the Environment was last started (i.e. CreateEnvironment or StartEnvironment were called). - `lockdownAt?: string` lockdown_at is the time at which the environment becomes locked down due to the organization's maximum environment lifetime policy. Nil when no lifetime policy applies. - `name?: string` name is the name of the environment as specified by the user - `organizationId?: string` organization_id is the ID of the organization that contains the environment - `originalContextUrl?: string` original_context_url is the normalized URL from which the environment was created - `prebuildId?: string | null` prebuild_id is the ID of the prebuild this environment was created from. Only set if the environment was created from a prebuild. - `projectId?: string` If the Environment was started from a project, the project_id will reference the project. - `role?: EnvironmentRole` role is the role of the environment - `"ENVIRONMENT_ROLE_UNSPECIFIED"` - `"ENVIRONMENT_ROLE_DEFAULT"` - `"ENVIRONMENT_ROLE_PREBUILD"` - `"ENVIRONMENT_ROLE_WORKFLOW"` - `runnerId?: string` Runner is the ID of the runner that runs this environment. - `spec?: EnvironmentSpec` Spec is the configuration of the environment that's required for the runner to start the environment - `admission?: AdmissionLevel` admission controlls who can access the environment and its ports. - `"ADMISSION_LEVEL_UNSPECIFIED"` - `"ADMISSION_LEVEL_OWNER_ONLY"` - `"ADMISSION_LEVEL_EVERYONE"` - `"ADMISSION_LEVEL_ORGANIZATION"` - `"ADMISSION_LEVEL_CREATOR_ONLY"` - `automationsFile?: AutomationsFile` automations_file is the automations file spec of the environment - `automationsFilePath?: string` automations_file_path is the path to the automations file that is applied in the environment, relative to the repo root. path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `session?: string` - `triggerFilter?: Array` trigger_filter specifies which automation triggers should execute. When set, only automations matching these triggers will run. If empty/unset, all triggers are evaluated normally. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `content?: Content` content is the content spec of the environment - `gitEmail?: string` The Git email address - `gitUsername?: string` The Git username - `initializer?: EnvironmentInitializer` initializer configures how the environment is to be initialized - `specs?: Array` - `contextUrl?: ContextURL` - `url?: string` url is the URL from which the environment is created - `git?: Git` - `checkoutLocation?: string` a path relative to the environment root in which the code will be checked out to - `cloneTarget?: string` the value for the clone target mode - use depends on the target mode - `remoteUri?: string` remote_uri is the Git remote origin - `targetMode?: "CLONE_TARGET_MODE_UNSPECIFIED" | "CLONE_TARGET_MODE_REMOTE_HEAD" | "CLONE_TARGET_MODE_REMOTE_COMMIT" | 3 more` the target mode determines what gets checked out - `"CLONE_TARGET_MODE_UNSPECIFIED"` - `"CLONE_TARGET_MODE_REMOTE_HEAD"` - `"CLONE_TARGET_MODE_REMOTE_COMMIT"` - `"CLONE_TARGET_MODE_REMOTE_BRANCH"` - `"CLONE_TARGET_MODE_LOCAL_BRANCH"` - `"CLONE_TARGET_MODE_REMOTE_TAG"` - `upstreamRemoteUri?: string` upstream_Remote_uri is the fork upstream of a repository - `session?: string` - `desiredPhase?: EnvironmentPhase` Phase is the desired phase of the environment - `"ENVIRONMENT_PHASE_UNSPECIFIED"` - `"ENVIRONMENT_PHASE_CREATING"` - `"ENVIRONMENT_PHASE_STARTING"` - `"ENVIRONMENT_PHASE_RUNNING"` - `"ENVIRONMENT_PHASE_UPDATING"` - `"ENVIRONMENT_PHASE_STOPPING"` - `"ENVIRONMENT_PHASE_STOPPED"` - `"ENVIRONMENT_PHASE_DELETING"` - `"ENVIRONMENT_PHASE_DELETED"` - `devcontainer?: Devcontainer` devcontainer is the devcontainer spec of the environment - `defaultDevcontainerImage?: string` default_devcontainer_image is the default image that is used to start the devcontainer if no devcontainer config file is found - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `dotfiles?: Dotfiles` Experimental: dotfiles is the dotfiles configuration of the devcontainer - `repository: string` URL of a dotfiles Git repository (e.g. https://github.com/owner/repository) - `lifecycleStage?: "LIFECYCLE_STAGE_UNSPECIFIED" | "LIFECYCLE_STAGE_FULL" | "LIFECYCLE_STAGE_PREBUILD"` lifecycle_stage controls which devcontainer lifecycle commands are executed. Defaults to FULL if not specified. - `"LIFECYCLE_STAGE_UNSPECIFIED"` - `"LIFECYCLE_STAGE_FULL"` - `"LIFECYCLE_STAGE_PREBUILD"` - `session?: string` - `kernelControlsConfig?: KernelControlsConfig` kernel_controls_config configures kernel-level controls for this environment - `veto?: Veto` veto controls blocking mechanisms - `exec?: Exec` exec controls executable blocking - `action?: KernelControlsAction` action specifies what action kernel-level controls take on policy violations - `"KERNEL_CONTROLS_ACTION_UNSPECIFIED"` - `"KERNEL_CONTROLS_ACTION_BLOCK"` - `"KERNEL_CONTROLS_ACTION_AUDIT"` - `denylist?: Array` denylist is the list of executable paths or names to block - `enabled?: boolean` enabled controls whether executable blocking is active - `machine?: Machine` machine is the machine spec of the environment - `class?: string` Class denotes the class of the environment we ought to start - `session?: string` - `ports?: Array` ports is the set of ports which ought to be exposed to your network - `admission?: AdmissionLevel` policy of this port - `name?: string` name of this port - `port?: number` port number - `protocol?: "PROTOCOL_UNSPECIFIED" | "PROTOCOL_HTTP" | "PROTOCOL_HTTPS"` protocol for communication (Gateway proxy → user environment service). this setting only affects the protocol used between Gateway and user environment services. - `"PROTOCOL_UNSPECIFIED"` - `"PROTOCOL_HTTP"` - `"PROTOCOL_HTTPS"` - `secrets?: Array` secrets are confidential data that is mounted into the environment - `id?: string` id is the unique identifier of the secret. - `apiOnly?: boolean` api_only indicates the secret is only available via API/CLI. These secrets are resolved but NOT automatically injected into services or devcontainers. - `containerRegistryBasicAuthHost?: string` container_registry_basic_auth_host is the hostname of the container registry that supports basic auth - `credentialProxy?: CredentialProxy` credential_proxy configures transparent credential injection via the credential proxy. When set, the credential proxy intercepts HTTPS traffic to the target hosts and replaces the dummy secret value with the real value in the specified HTTP header. The real secret value is never exposed in the environment. This field is orthogonal to mount — a secret can be both mounted (e.g. as a git credential) and proxied at the same time. - `format?: "FORMAT_UNSPECIFIED" | "FORMAT_PLAIN" | "FORMAT_BASE64"` format describes how the secret value is encoded. The proxy uses this to decode the value before injecting it into the header. - `"FORMAT_UNSPECIFIED"` - `"FORMAT_PLAIN"` - `"FORMAT_BASE64"` - `header?: string` header is the HTTP header name to inject (e.g. "Authorization"). - `targetHosts?: Array` target_hosts lists the hostnames to intercept (for example "github.com" or "*.github.com"). Wildcards are subdomain-only and do not match the apex domain. - `environmentVariable?: string` - `filePath?: string` file_path is the path inside the devcontainer where the secret is mounted - `gitCredentialHost?: string` - `name?: string` name is the human readable description of the secret - `scope?: "SCOPE_UNSPECIFIED" | "SCOPE_ORGANIZATION" | "SCOPE_PROJECT" | 3 more` scope indicates where this secret originated from. Used to filter secrets during build (only org and project secrets are injected). - `"SCOPE_UNSPECIFIED"` - `"SCOPE_ORGANIZATION"` - `"SCOPE_PROJECT"` - `"SCOPE_USER"` - `"SCOPE_SERVICE_ACCOUNT"` - `"SCOPE_RUNNER"` - `session?: string` session indicated the current session of the secret. When the session does not change, secrets are not reloaded in the environment. - `source?: string` source is the source of the secret, for now control-plane or runner - `sourceRef?: string` source_ref into the source, in case of control-plane this is uuid of the secret - `specVersion?: string` version of the spec. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b. - `sshPublicKeys?: Array` ssh_public_keys are the public keys used to ssh into the environment - `id?: string` id is the unique identifier of the public key - `value?: string` value is the actual public key in the public key file format - `timeout?: Timeout` Timeout configures the environment timeout - `disconnected?: string` inacitivity is the maximum time of disconnection before the environment is stopped or paused. Minimum duration is 30 minutes. Set to 0 to disable. value must be 0s (disabled) or at least 1800s (30 minutes): ``` this == duration('0s') || this >= duration('1800s') ``` - `workflowActionId?: string | null` workflow_action_id is an optional reference to the workflow execution action that created this environment. Used for tracking and event correlation. - `status?: EnvironmentStatus` Status is the current status of the environment - `activitySignal?: EnvironmentActivitySignal` activity_signal is the last activity signal for the environment. - `source?: string` source of the activity signal, such as "VS Code", "SSH", or "Automations". It should be a human-readable string that describes the source of the activity signal. - `timestamp?: string` timestamp of when the activity was observed by the source. Only reported every 5 minutes. Zero value means no activity was observed. - `automationsFile?: AutomationsFile` automations_file contains the status of the automations file. - `automationsFilePath?: string` automations_file_path is the path to the automations file relative to the repo root. - `automationsFilePresence?: "PRESENCE_UNSPECIFIED" | "PRESENCE_ABSENT" | "PRESENCE_DISCOVERED" | "PRESENCE_SPECIFIED"` automations_file_presence indicates how an automations file is present in the environment. - `"PRESENCE_UNSPECIFIED"` - `"PRESENCE_ABSENT"` - `"PRESENCE_DISCOVERED"` - `"PRESENCE_SPECIFIED"` - `failureMessage?: string` failure_message contains the reason the automations file failed to be applied. This is only set if the phase is FAILED. - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the automations file. - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `session?: string` session is the automations file session that is currently applied in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when no triggers are defined in the automations file. - `content?: Content` content contains the status of the environment content. - `contentLocationInMachine?: string` content_location_in_machine is the location of the content in the machine - `failureMessage?: string` failure_message contains the reason the content initialization failed. - `git?: Git` git is the Git working copy status of the environment. Note: this is a best-effort field and more often than not will not be present. Its absence does not indicate the absence of a working copy. - `branch?: string` branch is branch we're currently on - `changedFiles?: Array` changed_files is an array of changed files in the environment, possibly truncated - `changeType?: "CHANGE_TYPE_UNSPECIFIED" | "CHANGE_TYPE_ADDED" | "CHANGE_TYPE_MODIFIED" | 5 more` ChangeType is the type of change that happened to the file - `"CHANGE_TYPE_UNSPECIFIED"` - `"CHANGE_TYPE_ADDED"` - `"CHANGE_TYPE_MODIFIED"` - `"CHANGE_TYPE_DELETED"` - `"CHANGE_TYPE_RENAMED"` - `"CHANGE_TYPE_COPIED"` - `"CHANGE_TYPE_UPDATED_BUT_UNMERGED"` - `"CHANGE_TYPE_UNTRACKED"` - `oldPath?: string` old_path is the previous path of the file before a rename or copy. Only set when change_type is RENAMED or COPIED. - `path?: string` path is the path of the file - `cloneUrl?: string` clone_url is the repository url as you would pass it to "git clone". Only HTTPS clone URLs are supported. - `latestCommit?: string` latest_commit is the most recent commit on the current branch - `totalChangedFiles?: number` - `totalUnpushedCommits?: number` the total number of unpushed changes - `unpushedCommits?: Array` unpushed_commits is an array of unpushed changes in the environment, possibly truncated - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the environment content - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `session?: string` session is the session that is currently active in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when the content is present but not in the expected state. - `devcontainer?: Devcontainer` devcontainer contains the status of the devcontainer. - `containerId?: string` container_id is the ID of the container. - `containerName?: string` container_name is the name of the container that is used to connect to the devcontainer - `devcontainerconfigInSync?: boolean` devcontainerconfig_in_sync indicates if the devcontainer is up to date w.r.t. the devcontainer config file. - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root - `devcontainerFilePresence?: "PRESENCE_UNSPECIFIED" | "PRESENCE_GENERATED" | "PRESENCE_DISCOVERED" | "PRESENCE_SPECIFIED"` devcontainer_file_presence indicates how the devcontainer file is present in the repo. - `"PRESENCE_UNSPECIFIED"` - `"PRESENCE_GENERATED"` - `"PRESENCE_DISCOVERED"` - `"PRESENCE_SPECIFIED"` - `failureMessage?: string` failure_message contains the reason the devcontainer failed to operate. - `phase?: "PHASE_UNSPECIFIED" | "PHASE_CREATING" | "PHASE_RUNNING" | 2 more` phase is the current phase of the devcontainer - `"PHASE_UNSPECIFIED"` - `"PHASE_CREATING"` - `"PHASE_RUNNING"` - `"PHASE_STOPPED"` - `"PHASE_FAILED"` - `remoteUser?: string` remote_user is the user that is used to connect to the devcontainer - `remoteWorkspaceFolder?: string` remote_workspace_folder is the folder that is used to connect to the devcontainer - `secretsInSync?: boolean` secrets_in_sync indicates if the secrets are up to date w.r.t. the running devcontainer. - `session?: string` session is the session that is currently active in the devcontainer. - `warningMessage?: string` warning_message contains warnings, e.g. when the devcontainer is present but not in the expected state. - `environmentUrls?: EnvironmentURLs` environment_url contains the URL at which the environment can be accessed. This field is only set if the environment is running. - `logs?: string` logs is the URL at which the environment logs can be accessed. - `ops?: string` ops is the URL at which the environment ops service can be accessed. - `ports?: Array` - `port?: number` port is the port number of the environment port - `url?: string` url is the URL at which the environment port can be accessed - `ssh?: SSH` SSH is the URL at which the environment can be accessed via SSH. - `url?: string` - `supportBundle?: string` support_bundle is the URL at which the environment support bundle can be accessed. - `failureMessage?: Array` failure_message summarises why the environment failed to operate. If this is non-empty the environment has failed to operate and will likely transition to a stopped state. - `machine?: Machine` machine contains the status of the environment machine - `failureMessage?: string` failure_message contains the reason the machine failed to operate. - `phase?: "PHASE_UNSPECIFIED" | "PHASE_CREATING" | "PHASE_STARTING" | 5 more` phase is the current phase of the environment machine - `"PHASE_UNSPECIFIED"` - `"PHASE_CREATING"` - `"PHASE_STARTING"` - `"PHASE_RUNNING"` - `"PHASE_STOPPING"` - `"PHASE_STOPPED"` - `"PHASE_DELETING"` - `"PHASE_DELETED"` - `session?: string` session is the session that is currently active in the machine. - `timeout?: string` timeout contains the reason the environment has timed out. If this field is empty, the environment has not timed out. - `versions?: Versions` versions contains the versions of components in the machine. - `amiId?: string` - `supervisorCommit?: string` - `supervisorVersion?: string` - `warningMessage?: string` warning_message contains warnings, e.g. when the machine is present but not in the expected state. - `phase?: EnvironmentPhase` the phase of an environment is a simple, high-level summary of where the environment is in its lifecycle - `runnerAck?: RunnerAck` runner_ack contains the acknowledgement from the runner that is has received the environment spec. - `message?: string` - `specVersion?: string` - `statusCode?: "STATUS_CODE_UNSPECIFIED" | "STATUS_CODE_OK" | "STATUS_CODE_INVALID_RESOURCE" | "STATUS_CODE_FAILED_PRECONDITION"` - `"STATUS_CODE_UNSPECIFIED"` - `"STATUS_CODE_OK"` - `"STATUS_CODE_INVALID_RESOURCE"` - `"STATUS_CODE_FAILED_PRECONDITION"` - `secrets?: Array` secrets contains the status of the environment secrets - `id?: string` id is the unique identifier of the secret. - `failureMessage?: string` failure_message contains the reason the secret failed to be materialize. - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `secretName?: string` - `session?: string` session is the session that is currently active in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when the secret is present but not in the expected state. - `sshPublicKeys?: Array` ssh_public_keys contains the status of the environment ssh public keys - `id?: string` id is the unique identifier of the public key - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the public key - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `statusVersion?: string` version of the status update. Environment instances themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. - `warningMessage?: Array` warning_message contains warnings, e.g. when the environment is present but not in the expected state. ### Environment Activity Signal - `EnvironmentActivitySignal` EnvironmentActivitySignal used to signal activity for an environment. - `source?: string` source of the activity signal, such as "VS Code", "SSH", or "Automations". It should be a human-readable string that describes the source of the activity signal. - `timestamp?: string` timestamp of when the activity was observed by the source. Only reported every 5 minutes. Zero value means no activity was observed. ### Environment Metadata - `EnvironmentMetadata` EnvironmentMetadata is data associated with an environment that's required for other parts of the system to function - `annotations?: Record` annotations are key/value pairs that gets attached to the environment. +internal - not yet implemented - `archivedAt?: string` Time when the Environment was archived. If not set, the environment is not archived. - `createdAt?: string` Time when the Environment was created. - `creator?: Subject` creator is the identity of the creator of the environment - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `lastStartedAt?: string` Time when the Environment was last started (i.e. CreateEnvironment or StartEnvironment were called). - `lockdownAt?: string` lockdown_at is the time at which the environment becomes locked down due to the organization's maximum environment lifetime policy. Nil when no lifetime policy applies. - `name?: string` name is the name of the environment as specified by the user - `organizationId?: string` organization_id is the ID of the organization that contains the environment - `originalContextUrl?: string` original_context_url is the normalized URL from which the environment was created - `prebuildId?: string | null` prebuild_id is the ID of the prebuild this environment was created from. Only set if the environment was created from a prebuild. - `projectId?: string` If the Environment was started from a project, the project_id will reference the project. - `role?: EnvironmentRole` role is the role of the environment - `"ENVIRONMENT_ROLE_UNSPECIFIED"` - `"ENVIRONMENT_ROLE_DEFAULT"` - `"ENVIRONMENT_ROLE_PREBUILD"` - `"ENVIRONMENT_ROLE_WORKFLOW"` - `runnerId?: string` Runner is the ID of the runner that runs this environment. ### Environment Phase - `EnvironmentPhase = "ENVIRONMENT_PHASE_UNSPECIFIED" | "ENVIRONMENT_PHASE_CREATING" | "ENVIRONMENT_PHASE_STARTING" | 6 more` - `"ENVIRONMENT_PHASE_UNSPECIFIED"` - `"ENVIRONMENT_PHASE_CREATING"` - `"ENVIRONMENT_PHASE_STARTING"` - `"ENVIRONMENT_PHASE_RUNNING"` - `"ENVIRONMENT_PHASE_UPDATING"` - `"ENVIRONMENT_PHASE_STOPPING"` - `"ENVIRONMENT_PHASE_STOPPED"` - `"ENVIRONMENT_PHASE_DELETING"` - `"ENVIRONMENT_PHASE_DELETED"` ### Environment Role - `EnvironmentRole = "ENVIRONMENT_ROLE_UNSPECIFIED" | "ENVIRONMENT_ROLE_DEFAULT" | "ENVIRONMENT_ROLE_PREBUILD" | "ENVIRONMENT_ROLE_WORKFLOW"` EnvironmentRole represents the role of an environment - `"ENVIRONMENT_ROLE_UNSPECIFIED"` - `"ENVIRONMENT_ROLE_DEFAULT"` - `"ENVIRONMENT_ROLE_PREBUILD"` - `"ENVIRONMENT_ROLE_WORKFLOW"` ### Environment Spec - `EnvironmentSpec` EnvironmentSpec specifies the configuration of an environment for an environment start - `admission?: AdmissionLevel` admission controlls who can access the environment and its ports. - `"ADMISSION_LEVEL_UNSPECIFIED"` - `"ADMISSION_LEVEL_OWNER_ONLY"` - `"ADMISSION_LEVEL_EVERYONE"` - `"ADMISSION_LEVEL_ORGANIZATION"` - `"ADMISSION_LEVEL_CREATOR_ONLY"` - `automationsFile?: AutomationsFile` automations_file is the automations file spec of the environment - `automationsFilePath?: string` automations_file_path is the path to the automations file that is applied in the environment, relative to the repo root. path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `session?: string` - `triggerFilter?: Array` trigger_filter specifies which automation triggers should execute. When set, only automations matching these triggers will run. If empty/unset, all triggers are evaluated normally. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `content?: Content` content is the content spec of the environment - `gitEmail?: string` The Git email address - `gitUsername?: string` The Git username - `initializer?: EnvironmentInitializer` initializer configures how the environment is to be initialized - `specs?: Array` - `contextUrl?: ContextURL` - `url?: string` url is the URL from which the environment is created - `git?: Git` - `checkoutLocation?: string` a path relative to the environment root in which the code will be checked out to - `cloneTarget?: string` the value for the clone target mode - use depends on the target mode - `remoteUri?: string` remote_uri is the Git remote origin - `targetMode?: "CLONE_TARGET_MODE_UNSPECIFIED" | "CLONE_TARGET_MODE_REMOTE_HEAD" | "CLONE_TARGET_MODE_REMOTE_COMMIT" | 3 more` the target mode determines what gets checked out - `"CLONE_TARGET_MODE_UNSPECIFIED"` - `"CLONE_TARGET_MODE_REMOTE_HEAD"` - `"CLONE_TARGET_MODE_REMOTE_COMMIT"` - `"CLONE_TARGET_MODE_REMOTE_BRANCH"` - `"CLONE_TARGET_MODE_LOCAL_BRANCH"` - `"CLONE_TARGET_MODE_REMOTE_TAG"` - `upstreamRemoteUri?: string` upstream_Remote_uri is the fork upstream of a repository - `session?: string` - `desiredPhase?: EnvironmentPhase` Phase is the desired phase of the environment - `"ENVIRONMENT_PHASE_UNSPECIFIED"` - `"ENVIRONMENT_PHASE_CREATING"` - `"ENVIRONMENT_PHASE_STARTING"` - `"ENVIRONMENT_PHASE_RUNNING"` - `"ENVIRONMENT_PHASE_UPDATING"` - `"ENVIRONMENT_PHASE_STOPPING"` - `"ENVIRONMENT_PHASE_STOPPED"` - `"ENVIRONMENT_PHASE_DELETING"` - `"ENVIRONMENT_PHASE_DELETED"` - `devcontainer?: Devcontainer` devcontainer is the devcontainer spec of the environment - `defaultDevcontainerImage?: string` default_devcontainer_image is the default image that is used to start the devcontainer if no devcontainer config file is found - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `dotfiles?: Dotfiles` Experimental: dotfiles is the dotfiles configuration of the devcontainer - `repository: string` URL of a dotfiles Git repository (e.g. https://github.com/owner/repository) - `lifecycleStage?: "LIFECYCLE_STAGE_UNSPECIFIED" | "LIFECYCLE_STAGE_FULL" | "LIFECYCLE_STAGE_PREBUILD"` lifecycle_stage controls which devcontainer lifecycle commands are executed. Defaults to FULL if not specified. - `"LIFECYCLE_STAGE_UNSPECIFIED"` - `"LIFECYCLE_STAGE_FULL"` - `"LIFECYCLE_STAGE_PREBUILD"` - `session?: string` - `kernelControlsConfig?: KernelControlsConfig` kernel_controls_config configures kernel-level controls for this environment - `veto?: Veto` veto controls blocking mechanisms - `exec?: Exec` exec controls executable blocking - `action?: KernelControlsAction` action specifies what action kernel-level controls take on policy violations - `"KERNEL_CONTROLS_ACTION_UNSPECIFIED"` - `"KERNEL_CONTROLS_ACTION_BLOCK"` - `"KERNEL_CONTROLS_ACTION_AUDIT"` - `denylist?: Array` denylist is the list of executable paths or names to block - `enabled?: boolean` enabled controls whether executable blocking is active - `machine?: Machine` machine is the machine spec of the environment - `class?: string` Class denotes the class of the environment we ought to start - `session?: string` - `ports?: Array` ports is the set of ports which ought to be exposed to your network - `admission?: AdmissionLevel` policy of this port - `name?: string` name of this port - `port?: number` port number - `protocol?: "PROTOCOL_UNSPECIFIED" | "PROTOCOL_HTTP" | "PROTOCOL_HTTPS"` protocol for communication (Gateway proxy → user environment service). this setting only affects the protocol used between Gateway and user environment services. - `"PROTOCOL_UNSPECIFIED"` - `"PROTOCOL_HTTP"` - `"PROTOCOL_HTTPS"` - `secrets?: Array` secrets are confidential data that is mounted into the environment - `id?: string` id is the unique identifier of the secret. - `apiOnly?: boolean` api_only indicates the secret is only available via API/CLI. These secrets are resolved but NOT automatically injected into services or devcontainers. - `containerRegistryBasicAuthHost?: string` container_registry_basic_auth_host is the hostname of the container registry that supports basic auth - `credentialProxy?: CredentialProxy` credential_proxy configures transparent credential injection via the credential proxy. When set, the credential proxy intercepts HTTPS traffic to the target hosts and replaces the dummy secret value with the real value in the specified HTTP header. The real secret value is never exposed in the environment. This field is orthogonal to mount — a secret can be both mounted (e.g. as a git credential) and proxied at the same time. - `format?: "FORMAT_UNSPECIFIED" | "FORMAT_PLAIN" | "FORMAT_BASE64"` format describes how the secret value is encoded. The proxy uses this to decode the value before injecting it into the header. - `"FORMAT_UNSPECIFIED"` - `"FORMAT_PLAIN"` - `"FORMAT_BASE64"` - `header?: string` header is the HTTP header name to inject (e.g. "Authorization"). - `targetHosts?: Array` target_hosts lists the hostnames to intercept (for example "github.com" or "*.github.com"). Wildcards are subdomain-only and do not match the apex domain. - `environmentVariable?: string` - `filePath?: string` file_path is the path inside the devcontainer where the secret is mounted - `gitCredentialHost?: string` - `name?: string` name is the human readable description of the secret - `scope?: "SCOPE_UNSPECIFIED" | "SCOPE_ORGANIZATION" | "SCOPE_PROJECT" | 3 more` scope indicates where this secret originated from. Used to filter secrets during build (only org and project secrets are injected). - `"SCOPE_UNSPECIFIED"` - `"SCOPE_ORGANIZATION"` - `"SCOPE_PROJECT"` - `"SCOPE_USER"` - `"SCOPE_SERVICE_ACCOUNT"` - `"SCOPE_RUNNER"` - `session?: string` session indicated the current session of the secret. When the session does not change, secrets are not reloaded in the environment. - `source?: string` source is the source of the secret, for now control-plane or runner - `sourceRef?: string` source_ref into the source, in case of control-plane this is uuid of the secret - `specVersion?: string` version of the spec. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b. - `sshPublicKeys?: Array` ssh_public_keys are the public keys used to ssh into the environment - `id?: string` id is the unique identifier of the public key - `value?: string` value is the actual public key in the public key file format - `timeout?: Timeout` Timeout configures the environment timeout - `disconnected?: string` inacitivity is the maximum time of disconnection before the environment is stopped or paused. Minimum duration is 30 minutes. Set to 0 to disable. value must be 0s (disabled) or at least 1800s (30 minutes): ``` this == duration('0s') || this >= duration('1800s') ``` - `workflowActionId?: string | null` workflow_action_id is an optional reference to the workflow execution action that created this environment. Used for tracking and event correlation. ### Environment Status - `EnvironmentStatus` EnvironmentStatus describes an environment status - `activitySignal?: EnvironmentActivitySignal` activity_signal is the last activity signal for the environment. - `source?: string` source of the activity signal, such as "VS Code", "SSH", or "Automations". It should be a human-readable string that describes the source of the activity signal. - `timestamp?: string` timestamp of when the activity was observed by the source. Only reported every 5 minutes. Zero value means no activity was observed. - `automationsFile?: AutomationsFile` automations_file contains the status of the automations file. - `automationsFilePath?: string` automations_file_path is the path to the automations file relative to the repo root. - `automationsFilePresence?: "PRESENCE_UNSPECIFIED" | "PRESENCE_ABSENT" | "PRESENCE_DISCOVERED" | "PRESENCE_SPECIFIED"` automations_file_presence indicates how an automations file is present in the environment. - `"PRESENCE_UNSPECIFIED"` - `"PRESENCE_ABSENT"` - `"PRESENCE_DISCOVERED"` - `"PRESENCE_SPECIFIED"` - `failureMessage?: string` failure_message contains the reason the automations file failed to be applied. This is only set if the phase is FAILED. - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the automations file. - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `session?: string` session is the automations file session that is currently applied in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when no triggers are defined in the automations file. - `content?: Content` content contains the status of the environment content. - `contentLocationInMachine?: string` content_location_in_machine is the location of the content in the machine - `failureMessage?: string` failure_message contains the reason the content initialization failed. - `git?: Git` git is the Git working copy status of the environment. Note: this is a best-effort field and more often than not will not be present. Its absence does not indicate the absence of a working copy. - `branch?: string` branch is branch we're currently on - `changedFiles?: Array` changed_files is an array of changed files in the environment, possibly truncated - `changeType?: "CHANGE_TYPE_UNSPECIFIED" | "CHANGE_TYPE_ADDED" | "CHANGE_TYPE_MODIFIED" | 5 more` ChangeType is the type of change that happened to the file - `"CHANGE_TYPE_UNSPECIFIED"` - `"CHANGE_TYPE_ADDED"` - `"CHANGE_TYPE_MODIFIED"` - `"CHANGE_TYPE_DELETED"` - `"CHANGE_TYPE_RENAMED"` - `"CHANGE_TYPE_COPIED"` - `"CHANGE_TYPE_UPDATED_BUT_UNMERGED"` - `"CHANGE_TYPE_UNTRACKED"` - `oldPath?: string` old_path is the previous path of the file before a rename or copy. Only set when change_type is RENAMED or COPIED. - `path?: string` path is the path of the file - `cloneUrl?: string` clone_url is the repository url as you would pass it to "git clone". Only HTTPS clone URLs are supported. - `latestCommit?: string` latest_commit is the most recent commit on the current branch - `totalChangedFiles?: number` - `totalUnpushedCommits?: number` the total number of unpushed changes - `unpushedCommits?: Array` unpushed_commits is an array of unpushed changes in the environment, possibly truncated - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the environment content - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `session?: string` session is the session that is currently active in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when the content is present but not in the expected state. - `devcontainer?: Devcontainer` devcontainer contains the status of the devcontainer. - `containerId?: string` container_id is the ID of the container. - `containerName?: string` container_name is the name of the container that is used to connect to the devcontainer - `devcontainerconfigInSync?: boolean` devcontainerconfig_in_sync indicates if the devcontainer is up to date w.r.t. the devcontainer config file. - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root - `devcontainerFilePresence?: "PRESENCE_UNSPECIFIED" | "PRESENCE_GENERATED" | "PRESENCE_DISCOVERED" | "PRESENCE_SPECIFIED"` devcontainer_file_presence indicates how the devcontainer file is present in the repo. - `"PRESENCE_UNSPECIFIED"` - `"PRESENCE_GENERATED"` - `"PRESENCE_DISCOVERED"` - `"PRESENCE_SPECIFIED"` - `failureMessage?: string` failure_message contains the reason the devcontainer failed to operate. - `phase?: "PHASE_UNSPECIFIED" | "PHASE_CREATING" | "PHASE_RUNNING" | 2 more` phase is the current phase of the devcontainer - `"PHASE_UNSPECIFIED"` - `"PHASE_CREATING"` - `"PHASE_RUNNING"` - `"PHASE_STOPPED"` - `"PHASE_FAILED"` - `remoteUser?: string` remote_user is the user that is used to connect to the devcontainer - `remoteWorkspaceFolder?: string` remote_workspace_folder is the folder that is used to connect to the devcontainer - `secretsInSync?: boolean` secrets_in_sync indicates if the secrets are up to date w.r.t. the running devcontainer. - `session?: string` session is the session that is currently active in the devcontainer. - `warningMessage?: string` warning_message contains warnings, e.g. when the devcontainer is present but not in the expected state. - `environmentUrls?: EnvironmentURLs` environment_url contains the URL at which the environment can be accessed. This field is only set if the environment is running. - `logs?: string` logs is the URL at which the environment logs can be accessed. - `ops?: string` ops is the URL at which the environment ops service can be accessed. - `ports?: Array` - `port?: number` port is the port number of the environment port - `url?: string` url is the URL at which the environment port can be accessed - `ssh?: SSH` SSH is the URL at which the environment can be accessed via SSH. - `url?: string` - `supportBundle?: string` support_bundle is the URL at which the environment support bundle can be accessed. - `failureMessage?: Array` failure_message summarises why the environment failed to operate. If this is non-empty the environment has failed to operate and will likely transition to a stopped state. - `machine?: Machine` machine contains the status of the environment machine - `failureMessage?: string` failure_message contains the reason the machine failed to operate. - `phase?: "PHASE_UNSPECIFIED" | "PHASE_CREATING" | "PHASE_STARTING" | 5 more` phase is the current phase of the environment machine - `"PHASE_UNSPECIFIED"` - `"PHASE_CREATING"` - `"PHASE_STARTING"` - `"PHASE_RUNNING"` - `"PHASE_STOPPING"` - `"PHASE_STOPPED"` - `"PHASE_DELETING"` - `"PHASE_DELETED"` - `session?: string` session is the session that is currently active in the machine. - `timeout?: string` timeout contains the reason the environment has timed out. If this field is empty, the environment has not timed out. - `versions?: Versions` versions contains the versions of components in the machine. - `amiId?: string` - `supervisorCommit?: string` - `supervisorVersion?: string` - `warningMessage?: string` warning_message contains warnings, e.g. when the machine is present but not in the expected state. - `phase?: EnvironmentPhase` the phase of an environment is a simple, high-level summary of where the environment is in its lifecycle - `"ENVIRONMENT_PHASE_UNSPECIFIED"` - `"ENVIRONMENT_PHASE_CREATING"` - `"ENVIRONMENT_PHASE_STARTING"` - `"ENVIRONMENT_PHASE_RUNNING"` - `"ENVIRONMENT_PHASE_UPDATING"` - `"ENVIRONMENT_PHASE_STOPPING"` - `"ENVIRONMENT_PHASE_STOPPED"` - `"ENVIRONMENT_PHASE_DELETING"` - `"ENVIRONMENT_PHASE_DELETED"` - `runnerAck?: RunnerAck` runner_ack contains the acknowledgement from the runner that is has received the environment spec. - `message?: string` - `specVersion?: string` - `statusCode?: "STATUS_CODE_UNSPECIFIED" | "STATUS_CODE_OK" | "STATUS_CODE_INVALID_RESOURCE" | "STATUS_CODE_FAILED_PRECONDITION"` - `"STATUS_CODE_UNSPECIFIED"` - `"STATUS_CODE_OK"` - `"STATUS_CODE_INVALID_RESOURCE"` - `"STATUS_CODE_FAILED_PRECONDITION"` - `secrets?: Array` secrets contains the status of the environment secrets - `id?: string` id is the unique identifier of the secret. - `failureMessage?: string` failure_message contains the reason the secret failed to be materialize. - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `secretName?: string` - `session?: string` session is the session that is currently active in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when the secret is present but not in the expected state. - `sshPublicKeys?: Array` ssh_public_keys contains the status of the environment ssh public keys - `id?: string` id is the unique identifier of the public key - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the public key - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `statusVersion?: string` version of the status update. Environment instances themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. - `warningMessage?: Array` warning_message contains warnings, e.g. when the environment is present but not in the expected state. ### Kernel Controls Config - `KernelControlsConfig` KernelControlsConfig configures kernel-level controls for the environment - `veto?: Veto` veto controls blocking mechanisms - `exec?: Exec` exec controls executable blocking - `action?: KernelControlsAction` action specifies what action kernel-level controls take on policy violations - `"KERNEL_CONTROLS_ACTION_UNSPECIFIED"` - `"KERNEL_CONTROLS_ACTION_BLOCK"` - `"KERNEL_CONTROLS_ACTION_AUDIT"` - `denylist?: Array` denylist is the list of executable paths or names to block - `enabled?: boolean` enabled controls whether executable blocking is active ### Veto - `Veto` Veto controls kernel-level blocking mechanisms - `exec?: Exec` exec controls executable blocking - `action?: KernelControlsAction` action specifies what action kernel-level controls take on policy violations - `"KERNEL_CONTROLS_ACTION_UNSPECIFIED"` - `"KERNEL_CONTROLS_ACTION_BLOCK"` - `"KERNEL_CONTROLS_ACTION_AUDIT"` - `denylist?: Array` denylist is the list of executable paths or names to block - `enabled?: boolean` enabled controls whether executable blocking is active ### Environment Create Response - `EnvironmentCreateResponse` - `environment: Environment` +resource get environment - `id: string` ID is a unique identifier of this environment. No other environment with the same name must be managed by this environment manager - `metadata?: EnvironmentMetadata` Metadata is data associated with this environment that's required for other parts of Gitpod to function - `annotations?: Record` annotations are key/value pairs that gets attached to the environment. +internal - not yet implemented - `archivedAt?: string` Time when the Environment was archived. If not set, the environment is not archived. - `createdAt?: string` Time when the Environment was created. - `creator?: Subject` creator is the identity of the creator of the environment - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `lastStartedAt?: string` Time when the Environment was last started (i.e. CreateEnvironment or StartEnvironment were called). - `lockdownAt?: string` lockdown_at is the time at which the environment becomes locked down due to the organization's maximum environment lifetime policy. Nil when no lifetime policy applies. - `name?: string` name is the name of the environment as specified by the user - `organizationId?: string` organization_id is the ID of the organization that contains the environment - `originalContextUrl?: string` original_context_url is the normalized URL from which the environment was created - `prebuildId?: string | null` prebuild_id is the ID of the prebuild this environment was created from. Only set if the environment was created from a prebuild. - `projectId?: string` If the Environment was started from a project, the project_id will reference the project. - `role?: EnvironmentRole` role is the role of the environment - `"ENVIRONMENT_ROLE_UNSPECIFIED"` - `"ENVIRONMENT_ROLE_DEFAULT"` - `"ENVIRONMENT_ROLE_PREBUILD"` - `"ENVIRONMENT_ROLE_WORKFLOW"` - `runnerId?: string` Runner is the ID of the runner that runs this environment. - `spec?: EnvironmentSpec` Spec is the configuration of the environment that's required for the runner to start the environment - `admission?: AdmissionLevel` admission controlls who can access the environment and its ports. - `"ADMISSION_LEVEL_UNSPECIFIED"` - `"ADMISSION_LEVEL_OWNER_ONLY"` - `"ADMISSION_LEVEL_EVERYONE"` - `"ADMISSION_LEVEL_ORGANIZATION"` - `"ADMISSION_LEVEL_CREATOR_ONLY"` - `automationsFile?: AutomationsFile` automations_file is the automations file spec of the environment - `automationsFilePath?: string` automations_file_path is the path to the automations file that is applied in the environment, relative to the repo root. path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `session?: string` - `triggerFilter?: Array` trigger_filter specifies which automation triggers should execute. When set, only automations matching these triggers will run. If empty/unset, all triggers are evaluated normally. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `content?: Content` content is the content spec of the environment - `gitEmail?: string` The Git email address - `gitUsername?: string` The Git username - `initializer?: EnvironmentInitializer` initializer configures how the environment is to be initialized - `specs?: Array` - `contextUrl?: ContextURL` - `url?: string` url is the URL from which the environment is created - `git?: Git` - `checkoutLocation?: string` a path relative to the environment root in which the code will be checked out to - `cloneTarget?: string` the value for the clone target mode - use depends on the target mode - `remoteUri?: string` remote_uri is the Git remote origin - `targetMode?: "CLONE_TARGET_MODE_UNSPECIFIED" | "CLONE_TARGET_MODE_REMOTE_HEAD" | "CLONE_TARGET_MODE_REMOTE_COMMIT" | 3 more` the target mode determines what gets checked out - `"CLONE_TARGET_MODE_UNSPECIFIED"` - `"CLONE_TARGET_MODE_REMOTE_HEAD"` - `"CLONE_TARGET_MODE_REMOTE_COMMIT"` - `"CLONE_TARGET_MODE_REMOTE_BRANCH"` - `"CLONE_TARGET_MODE_LOCAL_BRANCH"` - `"CLONE_TARGET_MODE_REMOTE_TAG"` - `upstreamRemoteUri?: string` upstream_Remote_uri is the fork upstream of a repository - `session?: string` - `desiredPhase?: EnvironmentPhase` Phase is the desired phase of the environment - `"ENVIRONMENT_PHASE_UNSPECIFIED"` - `"ENVIRONMENT_PHASE_CREATING"` - `"ENVIRONMENT_PHASE_STARTING"` - `"ENVIRONMENT_PHASE_RUNNING"` - `"ENVIRONMENT_PHASE_UPDATING"` - `"ENVIRONMENT_PHASE_STOPPING"` - `"ENVIRONMENT_PHASE_STOPPED"` - `"ENVIRONMENT_PHASE_DELETING"` - `"ENVIRONMENT_PHASE_DELETED"` - `devcontainer?: Devcontainer` devcontainer is the devcontainer spec of the environment - `defaultDevcontainerImage?: string` default_devcontainer_image is the default image that is used to start the devcontainer if no devcontainer config file is found - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `dotfiles?: Dotfiles` Experimental: dotfiles is the dotfiles configuration of the devcontainer - `repository: string` URL of a dotfiles Git repository (e.g. https://github.com/owner/repository) - `lifecycleStage?: "LIFECYCLE_STAGE_UNSPECIFIED" | "LIFECYCLE_STAGE_FULL" | "LIFECYCLE_STAGE_PREBUILD"` lifecycle_stage controls which devcontainer lifecycle commands are executed. Defaults to FULL if not specified. - `"LIFECYCLE_STAGE_UNSPECIFIED"` - `"LIFECYCLE_STAGE_FULL"` - `"LIFECYCLE_STAGE_PREBUILD"` - `session?: string` - `kernelControlsConfig?: KernelControlsConfig` kernel_controls_config configures kernel-level controls for this environment - `veto?: Veto` veto controls blocking mechanisms - `exec?: Exec` exec controls executable blocking - `action?: KernelControlsAction` action specifies what action kernel-level controls take on policy violations - `"KERNEL_CONTROLS_ACTION_UNSPECIFIED"` - `"KERNEL_CONTROLS_ACTION_BLOCK"` - `"KERNEL_CONTROLS_ACTION_AUDIT"` - `denylist?: Array` denylist is the list of executable paths or names to block - `enabled?: boolean` enabled controls whether executable blocking is active - `machine?: Machine` machine is the machine spec of the environment - `class?: string` Class denotes the class of the environment we ought to start - `session?: string` - `ports?: Array` ports is the set of ports which ought to be exposed to your network - `admission?: AdmissionLevel` policy of this port - `name?: string` name of this port - `port?: number` port number - `protocol?: "PROTOCOL_UNSPECIFIED" | "PROTOCOL_HTTP" | "PROTOCOL_HTTPS"` protocol for communication (Gateway proxy → user environment service). this setting only affects the protocol used between Gateway and user environment services. - `"PROTOCOL_UNSPECIFIED"` - `"PROTOCOL_HTTP"` - `"PROTOCOL_HTTPS"` - `secrets?: Array` secrets are confidential data that is mounted into the environment - `id?: string` id is the unique identifier of the secret. - `apiOnly?: boolean` api_only indicates the secret is only available via API/CLI. These secrets are resolved but NOT automatically injected into services or devcontainers. - `containerRegistryBasicAuthHost?: string` container_registry_basic_auth_host is the hostname of the container registry that supports basic auth - `credentialProxy?: CredentialProxy` credential_proxy configures transparent credential injection via the credential proxy. When set, the credential proxy intercepts HTTPS traffic to the target hosts and replaces the dummy secret value with the real value in the specified HTTP header. The real secret value is never exposed in the environment. This field is orthogonal to mount — a secret can be both mounted (e.g. as a git credential) and proxied at the same time. - `format?: "FORMAT_UNSPECIFIED" | "FORMAT_PLAIN" | "FORMAT_BASE64"` format describes how the secret value is encoded. The proxy uses this to decode the value before injecting it into the header. - `"FORMAT_UNSPECIFIED"` - `"FORMAT_PLAIN"` - `"FORMAT_BASE64"` - `header?: string` header is the HTTP header name to inject (e.g. "Authorization"). - `targetHosts?: Array` target_hosts lists the hostnames to intercept (for example "github.com" or "*.github.com"). Wildcards are subdomain-only and do not match the apex domain. - `environmentVariable?: string` - `filePath?: string` file_path is the path inside the devcontainer where the secret is mounted - `gitCredentialHost?: string` - `name?: string` name is the human readable description of the secret - `scope?: "SCOPE_UNSPECIFIED" | "SCOPE_ORGANIZATION" | "SCOPE_PROJECT" | 3 more` scope indicates where this secret originated from. Used to filter secrets during build (only org and project secrets are injected). - `"SCOPE_UNSPECIFIED"` - `"SCOPE_ORGANIZATION"` - `"SCOPE_PROJECT"` - `"SCOPE_USER"` - `"SCOPE_SERVICE_ACCOUNT"` - `"SCOPE_RUNNER"` - `session?: string` session indicated the current session of the secret. When the session does not change, secrets are not reloaded in the environment. - `source?: string` source is the source of the secret, for now control-plane or runner - `sourceRef?: string` source_ref into the source, in case of control-plane this is uuid of the secret - `specVersion?: string` version of the spec. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b. - `sshPublicKeys?: Array` ssh_public_keys are the public keys used to ssh into the environment - `id?: string` id is the unique identifier of the public key - `value?: string` value is the actual public key in the public key file format - `timeout?: Timeout` Timeout configures the environment timeout - `disconnected?: string` inacitivity is the maximum time of disconnection before the environment is stopped or paused. Minimum duration is 30 minutes. Set to 0 to disable. value must be 0s (disabled) or at least 1800s (30 minutes): ``` this == duration('0s') || this >= duration('1800s') ``` - `workflowActionId?: string | null` workflow_action_id is an optional reference to the workflow execution action that created this environment. Used for tracking and event correlation. - `status?: EnvironmentStatus` Status is the current status of the environment - `activitySignal?: EnvironmentActivitySignal` activity_signal is the last activity signal for the environment. - `source?: string` source of the activity signal, such as "VS Code", "SSH", or "Automations". It should be a human-readable string that describes the source of the activity signal. - `timestamp?: string` timestamp of when the activity was observed by the source. Only reported every 5 minutes. Zero value means no activity was observed. - `automationsFile?: AutomationsFile` automations_file contains the status of the automations file. - `automationsFilePath?: string` automations_file_path is the path to the automations file relative to the repo root. - `automationsFilePresence?: "PRESENCE_UNSPECIFIED" | "PRESENCE_ABSENT" | "PRESENCE_DISCOVERED" | "PRESENCE_SPECIFIED"` automations_file_presence indicates how an automations file is present in the environment. - `"PRESENCE_UNSPECIFIED"` - `"PRESENCE_ABSENT"` - `"PRESENCE_DISCOVERED"` - `"PRESENCE_SPECIFIED"` - `failureMessage?: string` failure_message contains the reason the automations file failed to be applied. This is only set if the phase is FAILED. - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the automations file. - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `session?: string` session is the automations file session that is currently applied in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when no triggers are defined in the automations file. - `content?: Content` content contains the status of the environment content. - `contentLocationInMachine?: string` content_location_in_machine is the location of the content in the machine - `failureMessage?: string` failure_message contains the reason the content initialization failed. - `git?: Git` git is the Git working copy status of the environment. Note: this is a best-effort field and more often than not will not be present. Its absence does not indicate the absence of a working copy. - `branch?: string` branch is branch we're currently on - `changedFiles?: Array` changed_files is an array of changed files in the environment, possibly truncated - `changeType?: "CHANGE_TYPE_UNSPECIFIED" | "CHANGE_TYPE_ADDED" | "CHANGE_TYPE_MODIFIED" | 5 more` ChangeType is the type of change that happened to the file - `"CHANGE_TYPE_UNSPECIFIED"` - `"CHANGE_TYPE_ADDED"` - `"CHANGE_TYPE_MODIFIED"` - `"CHANGE_TYPE_DELETED"` - `"CHANGE_TYPE_RENAMED"` - `"CHANGE_TYPE_COPIED"` - `"CHANGE_TYPE_UPDATED_BUT_UNMERGED"` - `"CHANGE_TYPE_UNTRACKED"` - `oldPath?: string` old_path is the previous path of the file before a rename or copy. Only set when change_type is RENAMED or COPIED. - `path?: string` path is the path of the file - `cloneUrl?: string` clone_url is the repository url as you would pass it to "git clone". Only HTTPS clone URLs are supported. - `latestCommit?: string` latest_commit is the most recent commit on the current branch - `totalChangedFiles?: number` - `totalUnpushedCommits?: number` the total number of unpushed changes - `unpushedCommits?: Array` unpushed_commits is an array of unpushed changes in the environment, possibly truncated - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the environment content - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `session?: string` session is the session that is currently active in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when the content is present but not in the expected state. - `devcontainer?: Devcontainer` devcontainer contains the status of the devcontainer. - `containerId?: string` container_id is the ID of the container. - `containerName?: string` container_name is the name of the container that is used to connect to the devcontainer - `devcontainerconfigInSync?: boolean` devcontainerconfig_in_sync indicates if the devcontainer is up to date w.r.t. the devcontainer config file. - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root - `devcontainerFilePresence?: "PRESENCE_UNSPECIFIED" | "PRESENCE_GENERATED" | "PRESENCE_DISCOVERED" | "PRESENCE_SPECIFIED"` devcontainer_file_presence indicates how the devcontainer file is present in the repo. - `"PRESENCE_UNSPECIFIED"` - `"PRESENCE_GENERATED"` - `"PRESENCE_DISCOVERED"` - `"PRESENCE_SPECIFIED"` - `failureMessage?: string` failure_message contains the reason the devcontainer failed to operate. - `phase?: "PHASE_UNSPECIFIED" | "PHASE_CREATING" | "PHASE_RUNNING" | 2 more` phase is the current phase of the devcontainer - `"PHASE_UNSPECIFIED"` - `"PHASE_CREATING"` - `"PHASE_RUNNING"` - `"PHASE_STOPPED"` - `"PHASE_FAILED"` - `remoteUser?: string` remote_user is the user that is used to connect to the devcontainer - `remoteWorkspaceFolder?: string` remote_workspace_folder is the folder that is used to connect to the devcontainer - `secretsInSync?: boolean` secrets_in_sync indicates if the secrets are up to date w.r.t. the running devcontainer. - `session?: string` session is the session that is currently active in the devcontainer. - `warningMessage?: string` warning_message contains warnings, e.g. when the devcontainer is present but not in the expected state. - `environmentUrls?: EnvironmentURLs` environment_url contains the URL at which the environment can be accessed. This field is only set if the environment is running. - `logs?: string` logs is the URL at which the environment logs can be accessed. - `ops?: string` ops is the URL at which the environment ops service can be accessed. - `ports?: Array` - `port?: number` port is the port number of the environment port - `url?: string` url is the URL at which the environment port can be accessed - `ssh?: SSH` SSH is the URL at which the environment can be accessed via SSH. - `url?: string` - `supportBundle?: string` support_bundle is the URL at which the environment support bundle can be accessed. - `failureMessage?: Array` failure_message summarises why the environment failed to operate. If this is non-empty the environment has failed to operate and will likely transition to a stopped state. - `machine?: Machine` machine contains the status of the environment machine - `failureMessage?: string` failure_message contains the reason the machine failed to operate. - `phase?: "PHASE_UNSPECIFIED" | "PHASE_CREATING" | "PHASE_STARTING" | 5 more` phase is the current phase of the environment machine - `"PHASE_UNSPECIFIED"` - `"PHASE_CREATING"` - `"PHASE_STARTING"` - `"PHASE_RUNNING"` - `"PHASE_STOPPING"` - `"PHASE_STOPPED"` - `"PHASE_DELETING"` - `"PHASE_DELETED"` - `session?: string` session is the session that is currently active in the machine. - `timeout?: string` timeout contains the reason the environment has timed out. If this field is empty, the environment has not timed out. - `versions?: Versions` versions contains the versions of components in the machine. - `amiId?: string` - `supervisorCommit?: string` - `supervisorVersion?: string` - `warningMessage?: string` warning_message contains warnings, e.g. when the machine is present but not in the expected state. - `phase?: EnvironmentPhase` the phase of an environment is a simple, high-level summary of where the environment is in its lifecycle - `runnerAck?: RunnerAck` runner_ack contains the acknowledgement from the runner that is has received the environment spec. - `message?: string` - `specVersion?: string` - `statusCode?: "STATUS_CODE_UNSPECIFIED" | "STATUS_CODE_OK" | "STATUS_CODE_INVALID_RESOURCE" | "STATUS_CODE_FAILED_PRECONDITION"` - `"STATUS_CODE_UNSPECIFIED"` - `"STATUS_CODE_OK"` - `"STATUS_CODE_INVALID_RESOURCE"` - `"STATUS_CODE_FAILED_PRECONDITION"` - `secrets?: Array` secrets contains the status of the environment secrets - `id?: string` id is the unique identifier of the secret. - `failureMessage?: string` failure_message contains the reason the secret failed to be materialize. - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `secretName?: string` - `session?: string` session is the session that is currently active in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when the secret is present but not in the expected state. - `sshPublicKeys?: Array` ssh_public_keys contains the status of the environment ssh public keys - `id?: string` id is the unique identifier of the public key - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the public key - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `statusVersion?: string` version of the status update. Environment instances themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. - `warningMessage?: Array` warning_message contains warnings, e.g. when the environment is present but not in the expected state. ### Environment Create Environment Token Response - `EnvironmentCreateEnvironmentTokenResponse` - `accessToken: string` access_token is the token that can be used for environment authentication ### Environment Create From Project Response - `EnvironmentCreateFromProjectResponse` - `environment: Environment` +resource get environment - `id: string` ID is a unique identifier of this environment. No other environment with the same name must be managed by this environment manager - `metadata?: EnvironmentMetadata` Metadata is data associated with this environment that's required for other parts of Gitpod to function - `annotations?: Record` annotations are key/value pairs that gets attached to the environment. +internal - not yet implemented - `archivedAt?: string` Time when the Environment was archived. If not set, the environment is not archived. - `createdAt?: string` Time when the Environment was created. - `creator?: Subject` creator is the identity of the creator of the environment - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `lastStartedAt?: string` Time when the Environment was last started (i.e. CreateEnvironment or StartEnvironment were called). - `lockdownAt?: string` lockdown_at is the time at which the environment becomes locked down due to the organization's maximum environment lifetime policy. Nil when no lifetime policy applies. - `name?: string` name is the name of the environment as specified by the user - `organizationId?: string` organization_id is the ID of the organization that contains the environment - `originalContextUrl?: string` original_context_url is the normalized URL from which the environment was created - `prebuildId?: string | null` prebuild_id is the ID of the prebuild this environment was created from. Only set if the environment was created from a prebuild. - `projectId?: string` If the Environment was started from a project, the project_id will reference the project. - `role?: EnvironmentRole` role is the role of the environment - `"ENVIRONMENT_ROLE_UNSPECIFIED"` - `"ENVIRONMENT_ROLE_DEFAULT"` - `"ENVIRONMENT_ROLE_PREBUILD"` - `"ENVIRONMENT_ROLE_WORKFLOW"` - `runnerId?: string` Runner is the ID of the runner that runs this environment. - `spec?: EnvironmentSpec` Spec is the configuration of the environment that's required for the runner to start the environment - `admission?: AdmissionLevel` admission controlls who can access the environment and its ports. - `"ADMISSION_LEVEL_UNSPECIFIED"` - `"ADMISSION_LEVEL_OWNER_ONLY"` - `"ADMISSION_LEVEL_EVERYONE"` - `"ADMISSION_LEVEL_ORGANIZATION"` - `"ADMISSION_LEVEL_CREATOR_ONLY"` - `automationsFile?: AutomationsFile` automations_file is the automations file spec of the environment - `automationsFilePath?: string` automations_file_path is the path to the automations file that is applied in the environment, relative to the repo root. path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `session?: string` - `triggerFilter?: Array` trigger_filter specifies which automation triggers should execute. When set, only automations matching these triggers will run. If empty/unset, all triggers are evaluated normally. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `content?: Content` content is the content spec of the environment - `gitEmail?: string` The Git email address - `gitUsername?: string` The Git username - `initializer?: EnvironmentInitializer` initializer configures how the environment is to be initialized - `specs?: Array` - `contextUrl?: ContextURL` - `url?: string` url is the URL from which the environment is created - `git?: Git` - `checkoutLocation?: string` a path relative to the environment root in which the code will be checked out to - `cloneTarget?: string` the value for the clone target mode - use depends on the target mode - `remoteUri?: string` remote_uri is the Git remote origin - `targetMode?: "CLONE_TARGET_MODE_UNSPECIFIED" | "CLONE_TARGET_MODE_REMOTE_HEAD" | "CLONE_TARGET_MODE_REMOTE_COMMIT" | 3 more` the target mode determines what gets checked out - `"CLONE_TARGET_MODE_UNSPECIFIED"` - `"CLONE_TARGET_MODE_REMOTE_HEAD"` - `"CLONE_TARGET_MODE_REMOTE_COMMIT"` - `"CLONE_TARGET_MODE_REMOTE_BRANCH"` - `"CLONE_TARGET_MODE_LOCAL_BRANCH"` - `"CLONE_TARGET_MODE_REMOTE_TAG"` - `upstreamRemoteUri?: string` upstream_Remote_uri is the fork upstream of a repository - `session?: string` - `desiredPhase?: EnvironmentPhase` Phase is the desired phase of the environment - `"ENVIRONMENT_PHASE_UNSPECIFIED"` - `"ENVIRONMENT_PHASE_CREATING"` - `"ENVIRONMENT_PHASE_STARTING"` - `"ENVIRONMENT_PHASE_RUNNING"` - `"ENVIRONMENT_PHASE_UPDATING"` - `"ENVIRONMENT_PHASE_STOPPING"` - `"ENVIRONMENT_PHASE_STOPPED"` - `"ENVIRONMENT_PHASE_DELETING"` - `"ENVIRONMENT_PHASE_DELETED"` - `devcontainer?: Devcontainer` devcontainer is the devcontainer spec of the environment - `defaultDevcontainerImage?: string` default_devcontainer_image is the default image that is used to start the devcontainer if no devcontainer config file is found - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `dotfiles?: Dotfiles` Experimental: dotfiles is the dotfiles configuration of the devcontainer - `repository: string` URL of a dotfiles Git repository (e.g. https://github.com/owner/repository) - `lifecycleStage?: "LIFECYCLE_STAGE_UNSPECIFIED" | "LIFECYCLE_STAGE_FULL" | "LIFECYCLE_STAGE_PREBUILD"` lifecycle_stage controls which devcontainer lifecycle commands are executed. Defaults to FULL if not specified. - `"LIFECYCLE_STAGE_UNSPECIFIED"` - `"LIFECYCLE_STAGE_FULL"` - `"LIFECYCLE_STAGE_PREBUILD"` - `session?: string` - `kernelControlsConfig?: KernelControlsConfig` kernel_controls_config configures kernel-level controls for this environment - `veto?: Veto` veto controls blocking mechanisms - `exec?: Exec` exec controls executable blocking - `action?: KernelControlsAction` action specifies what action kernel-level controls take on policy violations - `"KERNEL_CONTROLS_ACTION_UNSPECIFIED"` - `"KERNEL_CONTROLS_ACTION_BLOCK"` - `"KERNEL_CONTROLS_ACTION_AUDIT"` - `denylist?: Array` denylist is the list of executable paths or names to block - `enabled?: boolean` enabled controls whether executable blocking is active - `machine?: Machine` machine is the machine spec of the environment - `class?: string` Class denotes the class of the environment we ought to start - `session?: string` - `ports?: Array` ports is the set of ports which ought to be exposed to your network - `admission?: AdmissionLevel` policy of this port - `name?: string` name of this port - `port?: number` port number - `protocol?: "PROTOCOL_UNSPECIFIED" | "PROTOCOL_HTTP" | "PROTOCOL_HTTPS"` protocol for communication (Gateway proxy → user environment service). this setting only affects the protocol used between Gateway and user environment services. - `"PROTOCOL_UNSPECIFIED"` - `"PROTOCOL_HTTP"` - `"PROTOCOL_HTTPS"` - `secrets?: Array` secrets are confidential data that is mounted into the environment - `id?: string` id is the unique identifier of the secret. - `apiOnly?: boolean` api_only indicates the secret is only available via API/CLI. These secrets are resolved but NOT automatically injected into services or devcontainers. - `containerRegistryBasicAuthHost?: string` container_registry_basic_auth_host is the hostname of the container registry that supports basic auth - `credentialProxy?: CredentialProxy` credential_proxy configures transparent credential injection via the credential proxy. When set, the credential proxy intercepts HTTPS traffic to the target hosts and replaces the dummy secret value with the real value in the specified HTTP header. The real secret value is never exposed in the environment. This field is orthogonal to mount — a secret can be both mounted (e.g. as a git credential) and proxied at the same time. - `format?: "FORMAT_UNSPECIFIED" | "FORMAT_PLAIN" | "FORMAT_BASE64"` format describes how the secret value is encoded. The proxy uses this to decode the value before injecting it into the header. - `"FORMAT_UNSPECIFIED"` - `"FORMAT_PLAIN"` - `"FORMAT_BASE64"` - `header?: string` header is the HTTP header name to inject (e.g. "Authorization"). - `targetHosts?: Array` target_hosts lists the hostnames to intercept (for example "github.com" or "*.github.com"). Wildcards are subdomain-only and do not match the apex domain. - `environmentVariable?: string` - `filePath?: string` file_path is the path inside the devcontainer where the secret is mounted - `gitCredentialHost?: string` - `name?: string` name is the human readable description of the secret - `scope?: "SCOPE_UNSPECIFIED" | "SCOPE_ORGANIZATION" | "SCOPE_PROJECT" | 3 more` scope indicates where this secret originated from. Used to filter secrets during build (only org and project secrets are injected). - `"SCOPE_UNSPECIFIED"` - `"SCOPE_ORGANIZATION"` - `"SCOPE_PROJECT"` - `"SCOPE_USER"` - `"SCOPE_SERVICE_ACCOUNT"` - `"SCOPE_RUNNER"` - `session?: string` session indicated the current session of the secret. When the session does not change, secrets are not reloaded in the environment. - `source?: string` source is the source of the secret, for now control-plane or runner - `sourceRef?: string` source_ref into the source, in case of control-plane this is uuid of the secret - `specVersion?: string` version of the spec. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b. - `sshPublicKeys?: Array` ssh_public_keys are the public keys used to ssh into the environment - `id?: string` id is the unique identifier of the public key - `value?: string` value is the actual public key in the public key file format - `timeout?: Timeout` Timeout configures the environment timeout - `disconnected?: string` inacitivity is the maximum time of disconnection before the environment is stopped or paused. Minimum duration is 30 minutes. Set to 0 to disable. value must be 0s (disabled) or at least 1800s (30 minutes): ``` this == duration('0s') || this >= duration('1800s') ``` - `workflowActionId?: string | null` workflow_action_id is an optional reference to the workflow execution action that created this environment. Used for tracking and event correlation. - `status?: EnvironmentStatus` Status is the current status of the environment - `activitySignal?: EnvironmentActivitySignal` activity_signal is the last activity signal for the environment. - `source?: string` source of the activity signal, such as "VS Code", "SSH", or "Automations". It should be a human-readable string that describes the source of the activity signal. - `timestamp?: string` timestamp of when the activity was observed by the source. Only reported every 5 minutes. Zero value means no activity was observed. - `automationsFile?: AutomationsFile` automations_file contains the status of the automations file. - `automationsFilePath?: string` automations_file_path is the path to the automations file relative to the repo root. - `automationsFilePresence?: "PRESENCE_UNSPECIFIED" | "PRESENCE_ABSENT" | "PRESENCE_DISCOVERED" | "PRESENCE_SPECIFIED"` automations_file_presence indicates how an automations file is present in the environment. - `"PRESENCE_UNSPECIFIED"` - `"PRESENCE_ABSENT"` - `"PRESENCE_DISCOVERED"` - `"PRESENCE_SPECIFIED"` - `failureMessage?: string` failure_message contains the reason the automations file failed to be applied. This is only set if the phase is FAILED. - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the automations file. - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `session?: string` session is the automations file session that is currently applied in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when no triggers are defined in the automations file. - `content?: Content` content contains the status of the environment content. - `contentLocationInMachine?: string` content_location_in_machine is the location of the content in the machine - `failureMessage?: string` failure_message contains the reason the content initialization failed. - `git?: Git` git is the Git working copy status of the environment. Note: this is a best-effort field and more often than not will not be present. Its absence does not indicate the absence of a working copy. - `branch?: string` branch is branch we're currently on - `changedFiles?: Array` changed_files is an array of changed files in the environment, possibly truncated - `changeType?: "CHANGE_TYPE_UNSPECIFIED" | "CHANGE_TYPE_ADDED" | "CHANGE_TYPE_MODIFIED" | 5 more` ChangeType is the type of change that happened to the file - `"CHANGE_TYPE_UNSPECIFIED"` - `"CHANGE_TYPE_ADDED"` - `"CHANGE_TYPE_MODIFIED"` - `"CHANGE_TYPE_DELETED"` - `"CHANGE_TYPE_RENAMED"` - `"CHANGE_TYPE_COPIED"` - `"CHANGE_TYPE_UPDATED_BUT_UNMERGED"` - `"CHANGE_TYPE_UNTRACKED"` - `oldPath?: string` old_path is the previous path of the file before a rename or copy. Only set when change_type is RENAMED or COPIED. - `path?: string` path is the path of the file - `cloneUrl?: string` clone_url is the repository url as you would pass it to "git clone". Only HTTPS clone URLs are supported. - `latestCommit?: string` latest_commit is the most recent commit on the current branch - `totalChangedFiles?: number` - `totalUnpushedCommits?: number` the total number of unpushed changes - `unpushedCommits?: Array` unpushed_commits is an array of unpushed changes in the environment, possibly truncated - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the environment content - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `session?: string` session is the session that is currently active in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when the content is present but not in the expected state. - `devcontainer?: Devcontainer` devcontainer contains the status of the devcontainer. - `containerId?: string` container_id is the ID of the container. - `containerName?: string` container_name is the name of the container that is used to connect to the devcontainer - `devcontainerconfigInSync?: boolean` devcontainerconfig_in_sync indicates if the devcontainer is up to date w.r.t. the devcontainer config file. - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root - `devcontainerFilePresence?: "PRESENCE_UNSPECIFIED" | "PRESENCE_GENERATED" | "PRESENCE_DISCOVERED" | "PRESENCE_SPECIFIED"` devcontainer_file_presence indicates how the devcontainer file is present in the repo. - `"PRESENCE_UNSPECIFIED"` - `"PRESENCE_GENERATED"` - `"PRESENCE_DISCOVERED"` - `"PRESENCE_SPECIFIED"` - `failureMessage?: string` failure_message contains the reason the devcontainer failed to operate. - `phase?: "PHASE_UNSPECIFIED" | "PHASE_CREATING" | "PHASE_RUNNING" | 2 more` phase is the current phase of the devcontainer - `"PHASE_UNSPECIFIED"` - `"PHASE_CREATING"` - `"PHASE_RUNNING"` - `"PHASE_STOPPED"` - `"PHASE_FAILED"` - `remoteUser?: string` remote_user is the user that is used to connect to the devcontainer - `remoteWorkspaceFolder?: string` remote_workspace_folder is the folder that is used to connect to the devcontainer - `secretsInSync?: boolean` secrets_in_sync indicates if the secrets are up to date w.r.t. the running devcontainer. - `session?: string` session is the session that is currently active in the devcontainer. - `warningMessage?: string` warning_message contains warnings, e.g. when the devcontainer is present but not in the expected state. - `environmentUrls?: EnvironmentURLs` environment_url contains the URL at which the environment can be accessed. This field is only set if the environment is running. - `logs?: string` logs is the URL at which the environment logs can be accessed. - `ops?: string` ops is the URL at which the environment ops service can be accessed. - `ports?: Array` - `port?: number` port is the port number of the environment port - `url?: string` url is the URL at which the environment port can be accessed - `ssh?: SSH` SSH is the URL at which the environment can be accessed via SSH. - `url?: string` - `supportBundle?: string` support_bundle is the URL at which the environment support bundle can be accessed. - `failureMessage?: Array` failure_message summarises why the environment failed to operate. If this is non-empty the environment has failed to operate and will likely transition to a stopped state. - `machine?: Machine` machine contains the status of the environment machine - `failureMessage?: string` failure_message contains the reason the machine failed to operate. - `phase?: "PHASE_UNSPECIFIED" | "PHASE_CREATING" | "PHASE_STARTING" | 5 more` phase is the current phase of the environment machine - `"PHASE_UNSPECIFIED"` - `"PHASE_CREATING"` - `"PHASE_STARTING"` - `"PHASE_RUNNING"` - `"PHASE_STOPPING"` - `"PHASE_STOPPED"` - `"PHASE_DELETING"` - `"PHASE_DELETED"` - `session?: string` session is the session that is currently active in the machine. - `timeout?: string` timeout contains the reason the environment has timed out. If this field is empty, the environment has not timed out. - `versions?: Versions` versions contains the versions of components in the machine. - `amiId?: string` - `supervisorCommit?: string` - `supervisorVersion?: string` - `warningMessage?: string` warning_message contains warnings, e.g. when the machine is present but not in the expected state. - `phase?: EnvironmentPhase` the phase of an environment is a simple, high-level summary of where the environment is in its lifecycle - `runnerAck?: RunnerAck` runner_ack contains the acknowledgement from the runner that is has received the environment spec. - `message?: string` - `specVersion?: string` - `statusCode?: "STATUS_CODE_UNSPECIFIED" | "STATUS_CODE_OK" | "STATUS_CODE_INVALID_RESOURCE" | "STATUS_CODE_FAILED_PRECONDITION"` - `"STATUS_CODE_UNSPECIFIED"` - `"STATUS_CODE_OK"` - `"STATUS_CODE_INVALID_RESOURCE"` - `"STATUS_CODE_FAILED_PRECONDITION"` - `secrets?: Array` secrets contains the status of the environment secrets - `id?: string` id is the unique identifier of the secret. - `failureMessage?: string` failure_message contains the reason the secret failed to be materialize. - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `secretName?: string` - `session?: string` session is the session that is currently active in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when the secret is present but not in the expected state. - `sshPublicKeys?: Array` ssh_public_keys contains the status of the environment ssh public keys - `id?: string` id is the unique identifier of the public key - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the public key - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `statusVersion?: string` version of the status update. Environment instances themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. - `warningMessage?: Array` warning_message contains warnings, e.g. when the environment is present but not in the expected state. ### Environment Create Logs Token Response - `EnvironmentCreateLogsTokenResponse` - `accessToken: string` access_token is the token that can be used to access the logs of the environment ### Environment Delete Response - `EnvironmentDeleteResponse = unknown` ### Environment Mark Active Response - `EnvironmentMarkActiveResponse = unknown` ### Environment Retrieve Response - `EnvironmentRetrieveResponse` - `environment: Environment` +resource get environment - `id: string` ID is a unique identifier of this environment. No other environment with the same name must be managed by this environment manager - `metadata?: EnvironmentMetadata` Metadata is data associated with this environment that's required for other parts of Gitpod to function - `annotations?: Record` annotations are key/value pairs that gets attached to the environment. +internal - not yet implemented - `archivedAt?: string` Time when the Environment was archived. If not set, the environment is not archived. - `createdAt?: string` Time when the Environment was created. - `creator?: Subject` creator is the identity of the creator of the environment - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `lastStartedAt?: string` Time when the Environment was last started (i.e. CreateEnvironment or StartEnvironment were called). - `lockdownAt?: string` lockdown_at is the time at which the environment becomes locked down due to the organization's maximum environment lifetime policy. Nil when no lifetime policy applies. - `name?: string` name is the name of the environment as specified by the user - `organizationId?: string` organization_id is the ID of the organization that contains the environment - `originalContextUrl?: string` original_context_url is the normalized URL from which the environment was created - `prebuildId?: string | null` prebuild_id is the ID of the prebuild this environment was created from. Only set if the environment was created from a prebuild. - `projectId?: string` If the Environment was started from a project, the project_id will reference the project. - `role?: EnvironmentRole` role is the role of the environment - `"ENVIRONMENT_ROLE_UNSPECIFIED"` - `"ENVIRONMENT_ROLE_DEFAULT"` - `"ENVIRONMENT_ROLE_PREBUILD"` - `"ENVIRONMENT_ROLE_WORKFLOW"` - `runnerId?: string` Runner is the ID of the runner that runs this environment. - `spec?: EnvironmentSpec` Spec is the configuration of the environment that's required for the runner to start the environment - `admission?: AdmissionLevel` admission controlls who can access the environment and its ports. - `"ADMISSION_LEVEL_UNSPECIFIED"` - `"ADMISSION_LEVEL_OWNER_ONLY"` - `"ADMISSION_LEVEL_EVERYONE"` - `"ADMISSION_LEVEL_ORGANIZATION"` - `"ADMISSION_LEVEL_CREATOR_ONLY"` - `automationsFile?: AutomationsFile` automations_file is the automations file spec of the environment - `automationsFilePath?: string` automations_file_path is the path to the automations file that is applied in the environment, relative to the repo root. path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `session?: string` - `triggerFilter?: Array` trigger_filter specifies which automation triggers should execute. When set, only automations matching these triggers will run. If empty/unset, all triggers are evaluated normally. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `content?: Content` content is the content spec of the environment - `gitEmail?: string` The Git email address - `gitUsername?: string` The Git username - `initializer?: EnvironmentInitializer` initializer configures how the environment is to be initialized - `specs?: Array` - `contextUrl?: ContextURL` - `url?: string` url is the URL from which the environment is created - `git?: Git` - `checkoutLocation?: string` a path relative to the environment root in which the code will be checked out to - `cloneTarget?: string` the value for the clone target mode - use depends on the target mode - `remoteUri?: string` remote_uri is the Git remote origin - `targetMode?: "CLONE_TARGET_MODE_UNSPECIFIED" | "CLONE_TARGET_MODE_REMOTE_HEAD" | "CLONE_TARGET_MODE_REMOTE_COMMIT" | 3 more` the target mode determines what gets checked out - `"CLONE_TARGET_MODE_UNSPECIFIED"` - `"CLONE_TARGET_MODE_REMOTE_HEAD"` - `"CLONE_TARGET_MODE_REMOTE_COMMIT"` - `"CLONE_TARGET_MODE_REMOTE_BRANCH"` - `"CLONE_TARGET_MODE_LOCAL_BRANCH"` - `"CLONE_TARGET_MODE_REMOTE_TAG"` - `upstreamRemoteUri?: string` upstream_Remote_uri is the fork upstream of a repository - `session?: string` - `desiredPhase?: EnvironmentPhase` Phase is the desired phase of the environment - `"ENVIRONMENT_PHASE_UNSPECIFIED"` - `"ENVIRONMENT_PHASE_CREATING"` - `"ENVIRONMENT_PHASE_STARTING"` - `"ENVIRONMENT_PHASE_RUNNING"` - `"ENVIRONMENT_PHASE_UPDATING"` - `"ENVIRONMENT_PHASE_STOPPING"` - `"ENVIRONMENT_PHASE_STOPPED"` - `"ENVIRONMENT_PHASE_DELETING"` - `"ENVIRONMENT_PHASE_DELETED"` - `devcontainer?: Devcontainer` devcontainer is the devcontainer spec of the environment - `defaultDevcontainerImage?: string` default_devcontainer_image is the default image that is used to start the devcontainer if no devcontainer config file is found - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root path must not be absolute (start with a /): ``` this.matches('^$|^[^/].*') ``` - `dotfiles?: Dotfiles` Experimental: dotfiles is the dotfiles configuration of the devcontainer - `repository: string` URL of a dotfiles Git repository (e.g. https://github.com/owner/repository) - `lifecycleStage?: "LIFECYCLE_STAGE_UNSPECIFIED" | "LIFECYCLE_STAGE_FULL" | "LIFECYCLE_STAGE_PREBUILD"` lifecycle_stage controls which devcontainer lifecycle commands are executed. Defaults to FULL if not specified. - `"LIFECYCLE_STAGE_UNSPECIFIED"` - `"LIFECYCLE_STAGE_FULL"` - `"LIFECYCLE_STAGE_PREBUILD"` - `session?: string` - `kernelControlsConfig?: KernelControlsConfig` kernel_controls_config configures kernel-level controls for this environment - `veto?: Veto` veto controls blocking mechanisms - `exec?: Exec` exec controls executable blocking - `action?: KernelControlsAction` action specifies what action kernel-level controls take on policy violations - `"KERNEL_CONTROLS_ACTION_UNSPECIFIED"` - `"KERNEL_CONTROLS_ACTION_BLOCK"` - `"KERNEL_CONTROLS_ACTION_AUDIT"` - `denylist?: Array` denylist is the list of executable paths or names to block - `enabled?: boolean` enabled controls whether executable blocking is active - `machine?: Machine` machine is the machine spec of the environment - `class?: string` Class denotes the class of the environment we ought to start - `session?: string` - `ports?: Array` ports is the set of ports which ought to be exposed to your network - `admission?: AdmissionLevel` policy of this port - `name?: string` name of this port - `port?: number` port number - `protocol?: "PROTOCOL_UNSPECIFIED" | "PROTOCOL_HTTP" | "PROTOCOL_HTTPS"` protocol for communication (Gateway proxy → user environment service). this setting only affects the protocol used between Gateway and user environment services. - `"PROTOCOL_UNSPECIFIED"` - `"PROTOCOL_HTTP"` - `"PROTOCOL_HTTPS"` - `secrets?: Array` secrets are confidential data that is mounted into the environment - `id?: string` id is the unique identifier of the secret. - `apiOnly?: boolean` api_only indicates the secret is only available via API/CLI. These secrets are resolved but NOT automatically injected into services or devcontainers. - `containerRegistryBasicAuthHost?: string` container_registry_basic_auth_host is the hostname of the container registry that supports basic auth - `credentialProxy?: CredentialProxy` credential_proxy configures transparent credential injection via the credential proxy. When set, the credential proxy intercepts HTTPS traffic to the target hosts and replaces the dummy secret value with the real value in the specified HTTP header. The real secret value is never exposed in the environment. This field is orthogonal to mount — a secret can be both mounted (e.g. as a git credential) and proxied at the same time. - `format?: "FORMAT_UNSPECIFIED" | "FORMAT_PLAIN" | "FORMAT_BASE64"` format describes how the secret value is encoded. The proxy uses this to decode the value before injecting it into the header. - `"FORMAT_UNSPECIFIED"` - `"FORMAT_PLAIN"` - `"FORMAT_BASE64"` - `header?: string` header is the HTTP header name to inject (e.g. "Authorization"). - `targetHosts?: Array` target_hosts lists the hostnames to intercept (for example "github.com" or "*.github.com"). Wildcards are subdomain-only and do not match the apex domain. - `environmentVariable?: string` - `filePath?: string` file_path is the path inside the devcontainer where the secret is mounted - `gitCredentialHost?: string` - `name?: string` name is the human readable description of the secret - `scope?: "SCOPE_UNSPECIFIED" | "SCOPE_ORGANIZATION" | "SCOPE_PROJECT" | 3 more` scope indicates where this secret originated from. Used to filter secrets during build (only org and project secrets are injected). - `"SCOPE_UNSPECIFIED"` - `"SCOPE_ORGANIZATION"` - `"SCOPE_PROJECT"` - `"SCOPE_USER"` - `"SCOPE_SERVICE_ACCOUNT"` - `"SCOPE_RUNNER"` - `session?: string` session indicated the current session of the secret. When the session does not change, secrets are not reloaded in the environment. - `source?: string` source is the source of the secret, for now control-plane or runner - `sourceRef?: string` source_ref into the source, in case of control-plane this is uuid of the secret - `specVersion?: string` version of the spec. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b. - `sshPublicKeys?: Array` ssh_public_keys are the public keys used to ssh into the environment - `id?: string` id is the unique identifier of the public key - `value?: string` value is the actual public key in the public key file format - `timeout?: Timeout` Timeout configures the environment timeout - `disconnected?: string` inacitivity is the maximum time of disconnection before the environment is stopped or paused. Minimum duration is 30 minutes. Set to 0 to disable. value must be 0s (disabled) or at least 1800s (30 minutes): ``` this == duration('0s') || this >= duration('1800s') ``` - `workflowActionId?: string | null` workflow_action_id is an optional reference to the workflow execution action that created this environment. Used for tracking and event correlation. - `status?: EnvironmentStatus` Status is the current status of the environment - `activitySignal?: EnvironmentActivitySignal` activity_signal is the last activity signal for the environment. - `source?: string` source of the activity signal, such as "VS Code", "SSH", or "Automations". It should be a human-readable string that describes the source of the activity signal. - `timestamp?: string` timestamp of when the activity was observed by the source. Only reported every 5 minutes. Zero value means no activity was observed. - `automationsFile?: AutomationsFile` automations_file contains the status of the automations file. - `automationsFilePath?: string` automations_file_path is the path to the automations file relative to the repo root. - `automationsFilePresence?: "PRESENCE_UNSPECIFIED" | "PRESENCE_ABSENT" | "PRESENCE_DISCOVERED" | "PRESENCE_SPECIFIED"` automations_file_presence indicates how an automations file is present in the environment. - `"PRESENCE_UNSPECIFIED"` - `"PRESENCE_ABSENT"` - `"PRESENCE_DISCOVERED"` - `"PRESENCE_SPECIFIED"` - `failureMessage?: string` failure_message contains the reason the automations file failed to be applied. This is only set if the phase is FAILED. - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the automations file. - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `session?: string` session is the automations file session that is currently applied in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when no triggers are defined in the automations file. - `content?: Content` content contains the status of the environment content. - `contentLocationInMachine?: string` content_location_in_machine is the location of the content in the machine - `failureMessage?: string` failure_message contains the reason the content initialization failed. - `git?: Git` git is the Git working copy status of the environment. Note: this is a best-effort field and more often than not will not be present. Its absence does not indicate the absence of a working copy. - `branch?: string` branch is branch we're currently on - `changedFiles?: Array` changed_files is an array of changed files in the environment, possibly truncated - `changeType?: "CHANGE_TYPE_UNSPECIFIED" | "CHANGE_TYPE_ADDED" | "CHANGE_TYPE_MODIFIED" | 5 more` ChangeType is the type of change that happened to the file - `"CHANGE_TYPE_UNSPECIFIED"` - `"CHANGE_TYPE_ADDED"` - `"CHANGE_TYPE_MODIFIED"` - `"CHANGE_TYPE_DELETED"` - `"CHANGE_TYPE_RENAMED"` - `"CHANGE_TYPE_COPIED"` - `"CHANGE_TYPE_UPDATED_BUT_UNMERGED"` - `"CHANGE_TYPE_UNTRACKED"` - `oldPath?: string` old_path is the previous path of the file before a rename or copy. Only set when change_type is RENAMED or COPIED. - `path?: string` path is the path of the file - `cloneUrl?: string` clone_url is the repository url as you would pass it to "git clone". Only HTTPS clone URLs are supported. - `latestCommit?: string` latest_commit is the most recent commit on the current branch - `totalChangedFiles?: number` - `totalUnpushedCommits?: number` the total number of unpushed changes - `unpushedCommits?: Array` unpushed_commits is an array of unpushed changes in the environment, possibly truncated - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the environment content - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `session?: string` session is the session that is currently active in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when the content is present but not in the expected state. - `devcontainer?: Devcontainer` devcontainer contains the status of the devcontainer. - `containerId?: string` container_id is the ID of the container. - `containerName?: string` container_name is the name of the container that is used to connect to the devcontainer - `devcontainerconfigInSync?: boolean` devcontainerconfig_in_sync indicates if the devcontainer is up to date w.r.t. the devcontainer config file. - `devcontainerFilePath?: string` devcontainer_file_path is the path to the devcontainer file relative to the repo root - `devcontainerFilePresence?: "PRESENCE_UNSPECIFIED" | "PRESENCE_GENERATED" | "PRESENCE_DISCOVERED" | "PRESENCE_SPECIFIED"` devcontainer_file_presence indicates how the devcontainer file is present in the repo. - `"PRESENCE_UNSPECIFIED"` - `"PRESENCE_GENERATED"` - `"PRESENCE_DISCOVERED"` - `"PRESENCE_SPECIFIED"` - `failureMessage?: string` failure_message contains the reason the devcontainer failed to operate. - `phase?: "PHASE_UNSPECIFIED" | "PHASE_CREATING" | "PHASE_RUNNING" | 2 more` phase is the current phase of the devcontainer - `"PHASE_UNSPECIFIED"` - `"PHASE_CREATING"` - `"PHASE_RUNNING"` - `"PHASE_STOPPED"` - `"PHASE_FAILED"` - `remoteUser?: string` remote_user is the user that is used to connect to the devcontainer - `remoteWorkspaceFolder?: string` remote_workspace_folder is the folder that is used to connect to the devcontainer - `secretsInSync?: boolean` secrets_in_sync indicates if the secrets are up to date w.r.t. the running devcontainer. - `session?: string` session is the session that is currently active in the devcontainer. - `warningMessage?: string` warning_message contains warnings, e.g. when the devcontainer is present but not in the expected state. - `environmentUrls?: EnvironmentURLs` environment_url contains the URL at which the environment can be accessed. This field is only set if the environment is running. - `logs?: string` logs is the URL at which the environment logs can be accessed. - `ops?: string` ops is the URL at which the environment ops service can be accessed. - `ports?: Array` - `port?: number` port is the port number of the environment port - `url?: string` url is the URL at which the environment port can be accessed - `ssh?: SSH` SSH is the URL at which the environment can be accessed via SSH. - `url?: string` - `supportBundle?: string` support_bundle is the URL at which the environment support bundle can be accessed. - `failureMessage?: Array` failure_message summarises why the environment failed to operate. If this is non-empty the environment has failed to operate and will likely transition to a stopped state. - `machine?: Machine` machine contains the status of the environment machine - `failureMessage?: string` failure_message contains the reason the machine failed to operate. - `phase?: "PHASE_UNSPECIFIED" | "PHASE_CREATING" | "PHASE_STARTING" | 5 more` phase is the current phase of the environment machine - `"PHASE_UNSPECIFIED"` - `"PHASE_CREATING"` - `"PHASE_STARTING"` - `"PHASE_RUNNING"` - `"PHASE_STOPPING"` - `"PHASE_STOPPED"` - `"PHASE_DELETING"` - `"PHASE_DELETED"` - `session?: string` session is the session that is currently active in the machine. - `timeout?: string` timeout contains the reason the environment has timed out. If this field is empty, the environment has not timed out. - `versions?: Versions` versions contains the versions of components in the machine. - `amiId?: string` - `supervisorCommit?: string` - `supervisorVersion?: string` - `warningMessage?: string` warning_message contains warnings, e.g. when the machine is present but not in the expected state. - `phase?: EnvironmentPhase` the phase of an environment is a simple, high-level summary of where the environment is in its lifecycle - `runnerAck?: RunnerAck` runner_ack contains the acknowledgement from the runner that is has received the environment spec. - `message?: string` - `specVersion?: string` - `statusCode?: "STATUS_CODE_UNSPECIFIED" | "STATUS_CODE_OK" | "STATUS_CODE_INVALID_RESOURCE" | "STATUS_CODE_FAILED_PRECONDITION"` - `"STATUS_CODE_UNSPECIFIED"` - `"STATUS_CODE_OK"` - `"STATUS_CODE_INVALID_RESOURCE"` - `"STATUS_CODE_FAILED_PRECONDITION"` - `secrets?: Array` secrets contains the status of the environment secrets - `id?: string` id is the unique identifier of the secret. - `failureMessage?: string` failure_message contains the reason the secret failed to be materialize. - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `secretName?: string` - `session?: string` session is the session that is currently active in the environment. - `warningMessage?: string` warning_message contains warnings, e.g. when the secret is present but not in the expected state. - `sshPublicKeys?: Array` ssh_public_keys contains the status of the environment ssh public keys - `id?: string` id is the unique identifier of the public key - `phase?: "CONTENT_PHASE_UNSPECIFIED" | "CONTENT_PHASE_CREATING" | "CONTENT_PHASE_INITIALIZING" | 4 more` phase is the current phase of the public key - `"CONTENT_PHASE_UNSPECIFIED"` - `"CONTENT_PHASE_CREATING"` - `"CONTENT_PHASE_INITIALIZING"` - `"CONTENT_PHASE_READY"` - `"CONTENT_PHASE_UPDATING"` - `"CONTENT_PHASE_FAILED"` - `"CONTENT_PHASE_UNAVAILABLE"` - `statusVersion?: string` version of the status update. Environment instances themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. - `warningMessage?: Array` warning_message contains warnings, e.g. when the environment is present but not in the expected state. ### Environment Start Response - `EnvironmentStartResponse = unknown` ### Environment Stop Response - `EnvironmentStopResponse = unknown` ### Environment Unarchive Response - `EnvironmentUnarchiveResponse = unknown` ### Environment Update Response - `EnvironmentUpdateResponse = unknown` # Automations ## UpsertAutomationsFile `client.environments.automations.upsert(AutomationUpsertParamsbody, RequestOptionsoptions?): AutomationUpsertResponse` **post** `/gitpod.v1.EnvironmentAutomationService/UpsertAutomationsFile` Upserts the automations file for the given environment. Use this method to: - Configure environment automations - Update automation settings - Manage automation files ### Examples - Update automations file: Updates or creates the automations configuration. ```yaml environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" automationsFile: services: web-server: name: "Web Server" description: "Development web server" commands: start: "npm run dev" ready: "curl -s http://localhost:3000" triggeredBy: - postDevcontainerStart tasks: build: name: "Build Project" description: "Builds the project artifacts" command: "npm run build" triggeredBy: - postEnvironmentStart ``` ### Parameters - `body: AutomationUpsertParams` - `automationsFile?: AutomationsFile` WARN: Do not remove any field here, as it will break reading automation yaml files. We error if there are any unknown fields in the yaml (to ensure the yaml is correct), but would break if we removed any fields. This includes marking a field as "reserved" in the proto file, this will also break reading the yaml. - `services?: Record` - `commands?: Commands` - `ready?: string` ready is an optional command that is run repeatedly until it exits with a zero exit code. If set, the service will first go into a Starting phase, and then into a Running phase once the ready command exits with a zero exit code. - `start?: string` start is the command to start and run the service. If start exits, the service will transition to the following phase: - Stopped: if the exit code is 0 - Failed: if the exit code is not 0 If the stop command is not set, the start command will receive a SIGTERM signal when the service is requested to stop. If it does not exit within 2 minutes, it will receive a SIGKILL signal. - `stop?: string` stop is an optional command that runs when the service is requested to stop. If set, instead of sending a SIGTERM signal to the start command, the stop command will be run. Once the stop command exits, the start command will receive a SIGKILL signal. If the stop command exits with a non-zero exit code, the service will transition to the Failed phase. If the stop command does not exit within 2 minutes, a SIGKILL signal will be sent to both the start and stop commands. - `description?: string` - `name?: string` - `role?: "" | "default" | "editor" | "ai-agent"` - `""` - `"default"` - `"editor"` - `"ai-agent"` - `runsOn?: RunsOn` - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. - `triggeredBy?: Array<"manual" | "postEnvironmentStart" | "postDevcontainerStart" | "prebuild">` - `"manual"` - `"postEnvironmentStart"` - `"postDevcontainerStart"` - `"prebuild"` - `tasks?: Record` - `command?: string` - `dependsOn?: Array` - `description?: string` - `name?: string` - `runsOn?: RunsOn` - `triggeredBy?: Array<"manual" | "postEnvironmentStart" | "postDevcontainerStart" | "prebuild">` - `"manual"` - `"postEnvironmentStart"` - `"postDevcontainerStart"` - `"prebuild"` - `environmentId?: string` ### Returns - `AutomationUpsertResponse` - `updatedServiceIds?: Array` - `updatedTaskIds?: Array` ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const response = await client.environments.automations.upsert({ automationsFile: { services: { 'web-server': { commands: { ready: 'curl -s http://localhost:3000', start: 'npm run dev' }, description: 'Development web server', name: 'Web Server', triggeredBy: ['postDevcontainerStart'], }, }, tasks: { build: { command: 'npm run build', description: 'Builds the project artifacts', name: 'Build Project', triggeredBy: ['postEnvironmentStart'], }, }, }, environmentId: '07e03a28-65a5-4d98-b532-8ea67b188048', }); console.log(response.updatedServiceIds); ``` #### Response ```json { "updatedServiceIds": [ "string" ], "updatedTaskIds": [ "string" ] } ``` ## Domain Types ### Automations File - `AutomationsFile` WARN: Do not remove any field here, as it will break reading automation yaml files. We error if there are any unknown fields in the yaml (to ensure the yaml is correct), but would break if we removed any fields. This includes marking a field as "reserved" in the proto file, this will also break reading the yaml. - `services?: Record` - `commands?: Commands` - `ready?: string` ready is an optional command that is run repeatedly until it exits with a zero exit code. If set, the service will first go into a Starting phase, and then into a Running phase once the ready command exits with a zero exit code. - `start?: string` start is the command to start and run the service. If start exits, the service will transition to the following phase: - Stopped: if the exit code is 0 - Failed: if the exit code is not 0 If the stop command is not set, the start command will receive a SIGTERM signal when the service is requested to stop. If it does not exit within 2 minutes, it will receive a SIGKILL signal. - `stop?: string` stop is an optional command that runs when the service is requested to stop. If set, instead of sending a SIGTERM signal to the start command, the stop command will be run. Once the stop command exits, the start command will receive a SIGKILL signal. If the stop command exits with a non-zero exit code, the service will transition to the Failed phase. If the stop command does not exit within 2 minutes, a SIGKILL signal will be sent to both the start and stop commands. - `description?: string` - `name?: string` - `role?: "" | "default" | "editor" | "ai-agent"` - `""` - `"default"` - `"editor"` - `"ai-agent"` - `runsOn?: RunsOn` - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. - `triggeredBy?: Array<"manual" | "postEnvironmentStart" | "postDevcontainerStart" | "prebuild">` - `"manual"` - `"postEnvironmentStart"` - `"postDevcontainerStart"` - `"prebuild"` - `tasks?: Record` - `command?: string` - `dependsOn?: Array` - `description?: string` - `name?: string` - `runsOn?: RunsOn` - `triggeredBy?: Array<"manual" | "postEnvironmentStart" | "postDevcontainerStart" | "prebuild">` - `"manual"` - `"postEnvironmentStart"` - `"postDevcontainerStart"` - `"prebuild"` ### Automation Upsert Response - `AutomationUpsertResponse` - `updatedServiceIds?: Array` - `updatedTaskIds?: Array` # Services ## CreateService `client.environments.automations.services.create(ServiceCreateParamsbody, RequestOptionsoptions?): ServiceCreateResponse` **post** `/gitpod.v1.EnvironmentAutomationService/CreateService` Creates a new automation service for an environment. Use this method to: - Set up long-running services - Configure service triggers - Define service dependencies - Specify runtime environments ### Examples - Create basic service: Creates a simple service with start command. ```yaml environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" metadata: reference: "web-server" name: "Web Server" description: "Runs the development web server" triggeredBy: - postDevcontainerStart: true spec: commands: start: "npm run dev" ready: "curl -s http://localhost:3000" ``` - Create Docker-based service: Creates a service running in a specific container. ```yaml environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" metadata: reference: "redis" name: "Redis Server" description: "Redis cache service" spec: commands: start: "redis-server" runsOn: docker: image: "redis:7" ``` ### Parameters - `body: ServiceCreateParams` - `environmentId?: string` - `metadata?: ServiceMetadata` - `createdAt?: string` created_at is the time the service was created. - `creator?: Subject` creator describes the principal who created the service. - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `description?: string` description is a user-facing description for the service. It can be used to provide context and documentation for the service. - `name?: string` name is a user-facing name for the service. Unlike the reference, this field is not unique, and not referenced by the system. This is a short descriptive name for the service. - `reference?: string` reference is a user-facing identifier for the service which must be unique on the environment. It is used to express dependencies between services, and to identify the service in user interactions (e.g. the CLI). - `role?: ServiceRole` role specifies the intended role or purpose of the service. - `"SERVICE_ROLE_UNSPECIFIED"` - `"SERVICE_ROLE_DEFAULT"` - `"SERVICE_ROLE_EDITOR"` - `"SERVICE_ROLE_AI_AGENT"` - `"SERVICE_ROLE_SECURITY_AGENT"` - `triggeredBy?: Array` triggered_by is a list of trigger that start the service. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `spec?: ServiceSpec` - `commands?: Commands` commands contains the commands to start, stop and check the readiness of the service - `ready?: string` ready is an optional command that is run repeatedly until it exits with a zero exit code. If set, the service will first go into a Starting phase, and then into a Running phase once the ready command exits with a zero exit code. - `start?: string` start is the command to start and run the service. If start exits, the service will transition to the following phase: - Stopped: if the exit code is 0 - Failed: if the exit code is not 0 If the stop command is not set, the start command will receive a SIGTERM signal when the service is requested to stop. If it does not exit within 2 minutes, it will receive a SIGKILL signal. - `stop?: string` stop is an optional command that runs when the service is requested to stop. If set, instead of sending a SIGTERM signal to the start command, the stop command will be run. Once the stop command exits, the start command will receive a SIGKILL signal. If the stop command exits with a non-zero exit code, the service will transition to the Failed phase. If the stop command does not exit within 2 minutes, a SIGKILL signal will be sent to both the start and stop commands. - `desiredPhase?: ServicePhase` desired_phase is the phase the service should be in. Used to start or stop the service. - `"SERVICE_PHASE_UNSPECIFIED"` - `"SERVICE_PHASE_STARTING"` - `"SERVICE_PHASE_RUNNING"` - `"SERVICE_PHASE_STOPPING"` - `"SERVICE_PHASE_STOPPED"` - `"SERVICE_PHASE_FAILED"` - `"SERVICE_PHASE_DELETED"` - `env?: Array` env specifies environment variables for the service. - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn` runs_on specifies the environment the service should run on. - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. - `session?: string` session should be changed to trigger a restart of the service. If a service exits it will not be restarted until the session is changed. - `specVersion?: string` version of the spec. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b. ### Returns - `ServiceCreateResponse` - `service: Service` - `id: string` - `environmentId?: string` - `metadata?: ServiceMetadata` - `createdAt?: string` created_at is the time the service was created. - `creator?: Subject` creator describes the principal who created the service. - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `description?: string` description is a user-facing description for the service. It can be used to provide context and documentation for the service. - `name?: string` name is a user-facing name for the service. Unlike the reference, this field is not unique, and not referenced by the system. This is a short descriptive name for the service. - `reference?: string` reference is a user-facing identifier for the service which must be unique on the environment. It is used to express dependencies between services, and to identify the service in user interactions (e.g. the CLI). - `role?: ServiceRole` role specifies the intended role or purpose of the service. - `"SERVICE_ROLE_UNSPECIFIED"` - `"SERVICE_ROLE_DEFAULT"` - `"SERVICE_ROLE_EDITOR"` - `"SERVICE_ROLE_AI_AGENT"` - `"SERVICE_ROLE_SECURITY_AGENT"` - `triggeredBy?: Array` triggered_by is a list of trigger that start the service. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `spec?: ServiceSpec` - `commands?: Commands` commands contains the commands to start, stop and check the readiness of the service - `ready?: string` ready is an optional command that is run repeatedly until it exits with a zero exit code. If set, the service will first go into a Starting phase, and then into a Running phase once the ready command exits with a zero exit code. - `start?: string` start is the command to start and run the service. If start exits, the service will transition to the following phase: - Stopped: if the exit code is 0 - Failed: if the exit code is not 0 If the stop command is not set, the start command will receive a SIGTERM signal when the service is requested to stop. If it does not exit within 2 minutes, it will receive a SIGKILL signal. - `stop?: string` stop is an optional command that runs when the service is requested to stop. If set, instead of sending a SIGTERM signal to the start command, the stop command will be run. Once the stop command exits, the start command will receive a SIGKILL signal. If the stop command exits with a non-zero exit code, the service will transition to the Failed phase. If the stop command does not exit within 2 minutes, a SIGKILL signal will be sent to both the start and stop commands. - `desiredPhase?: ServicePhase` desired_phase is the phase the service should be in. Used to start or stop the service. - `"SERVICE_PHASE_UNSPECIFIED"` - `"SERVICE_PHASE_STARTING"` - `"SERVICE_PHASE_RUNNING"` - `"SERVICE_PHASE_STOPPING"` - `"SERVICE_PHASE_STOPPED"` - `"SERVICE_PHASE_FAILED"` - `"SERVICE_PHASE_DELETED"` - `env?: Array` env specifies environment variables for the service. - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn` runs_on specifies the environment the service should run on. - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. - `session?: string` session should be changed to trigger a restart of the service. If a service exits it will not be restarted until the session is changed. - `specVersion?: string` version of the spec. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b. - `status?: ServiceStatus` - `failureMessage?: string` failure_message summarises why the service failed to operate. If this is non-empty the service has failed to operate and will likely transition to a failed state. - `logUrl?: string` log_url contains the URL at which the service logs can be accessed. - `output?: Record` output contains the output of the service. setting an output field to empty string will unset it. - `phase?: ServicePhase` phase is the current phase of the service. - `session?: string` session is the current session of the service. - `statusVersion?: string` version of the status update. Service instances themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const service = await client.environments.automations.services.create({ environmentId: '07e03a28-65a5-4d98-b532-8ea67b188048', metadata: { description: 'Runs the development web server', name: 'Web Server', reference: 'web-server', triggeredBy: [{ postDevcontainerStart: true }], }, spec: { commands: { ready: 'curl -s http://localhost:3000', start: 'npm run dev' } }, }); console.log(service.service); ``` #### Response ```json { "service": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "environmentId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "metadata": { "createdAt": "2019-12-27T18:11:19.117Z", "creator": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "principal": "PRINCIPAL_UNSPECIFIED" }, "description": "description", "name": "x", "reference": "reference", "role": "SERVICE_ROLE_UNSPECIFIED", "triggeredBy": [ { "beforeSnapshot": true, "manual": true, "postDevcontainerStart": true, "postEnvironmentStart": true, "postMachineStart": true, "prebuild": true } ] }, "spec": { "commands": { "ready": "ready", "start": "x", "stop": "stop" }, "desiredPhase": "SERVICE_PHASE_UNSPECIFIED", "env": [ { "name": "x", "value": "value", "valueFrom": { "secretRef": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } } } ], "runsOn": { "docker": { "environment": [ "string" ], "image": "x" }, "machine": {} }, "session": "session", "specVersion": "specVersion" }, "status": { "failureMessage": "failureMessage", "logUrl": "logUrl", "output": { "foo": "string" }, "phase": "SERVICE_PHASE_UNSPECIFIED", "session": "session", "statusVersion": "statusVersion" } } } ``` ## DeleteService `client.environments.automations.services.delete(ServiceDeleteParamsbody, RequestOptionsoptions?): ServiceDeleteResponse` **post** `/gitpod.v1.EnvironmentAutomationService/DeleteService` Deletes an automation service. This call does not block until the service is deleted. If the service is not stopped it will be stopped before deletion. Use this method to: - Remove unused services - Clean up service configurations - Stop and delete services ### Examples - Delete service: Removes a service after stopping it. ```yaml id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" force: false ``` - Force delete: Immediately removes a service. ```yaml id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" force: true ``` ### Parameters - `body: ServiceDeleteParams` - `id?: string` - `force?: boolean` ### Returns - `ServiceDeleteResponse = unknown` ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const service = await client.environments.automations.services.delete({ id: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', }); console.log(service); ``` #### Response ```json {} ``` ## ListServices `client.environments.automations.services.list(ServiceListParamsparams, RequestOptionsoptions?): ServicesPage` **post** `/gitpod.v1.EnvironmentAutomationService/ListServices` Lists automation services with optional filtering. Use this method to: - View all services in an environment - Filter services by reference - Monitor service status ### Examples - List environment services: Shows all services for an environment. ```yaml filter: environmentIds: ["07e03a28-65a5-4d98-b532-8ea67b188048"] pagination: pageSize: 20 ``` - Filter by reference: Lists services matching specific references. ```yaml filter: references: ["web-server", "database"] pagination: pageSize: 20 ``` ### Parameters - `params: ServiceListParams` - `token?: string` Query param - `pageSize?: number` Query param - `filter?: Filter` Body param: filter contains the filter options for listing services - `environmentIds?: Array` environment_ids filters the response to only services of these environments - `references?: Array` references filters the response to only services with these references - `roles?: Array` roles filters the response to only services with these roles - `"SERVICE_ROLE_UNSPECIFIED"` - `"SERVICE_ROLE_DEFAULT"` - `"SERVICE_ROLE_EDITOR"` - `"SERVICE_ROLE_AI_AGENT"` - `"SERVICE_ROLE_SECURITY_AGENT"` - `serviceIds?: Array` service_ids filters the response to only services with these IDs - `pagination?: Pagination` Body param: pagination contains the pagination options for listing services - `token?: string` Token for the next set of results that was returned as next_token of a PaginationResponse - `pageSize?: number` Page size is the maximum number of results to retrieve per page. Defaults to 25. Maximum 100. ### Returns - `Service` - `id: string` - `environmentId?: string` - `metadata?: ServiceMetadata` - `createdAt?: string` created_at is the time the service was created. - `creator?: Subject` creator describes the principal who created the service. - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `description?: string` description is a user-facing description for the service. It can be used to provide context and documentation for the service. - `name?: string` name is a user-facing name for the service. Unlike the reference, this field is not unique, and not referenced by the system. This is a short descriptive name for the service. - `reference?: string` reference is a user-facing identifier for the service which must be unique on the environment. It is used to express dependencies between services, and to identify the service in user interactions (e.g. the CLI). - `role?: ServiceRole` role specifies the intended role or purpose of the service. - `"SERVICE_ROLE_UNSPECIFIED"` - `"SERVICE_ROLE_DEFAULT"` - `"SERVICE_ROLE_EDITOR"` - `"SERVICE_ROLE_AI_AGENT"` - `"SERVICE_ROLE_SECURITY_AGENT"` - `triggeredBy?: Array` triggered_by is a list of trigger that start the service. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `spec?: ServiceSpec` - `commands?: Commands` commands contains the commands to start, stop and check the readiness of the service - `ready?: string` ready is an optional command that is run repeatedly until it exits with a zero exit code. If set, the service will first go into a Starting phase, and then into a Running phase once the ready command exits with a zero exit code. - `start?: string` start is the command to start and run the service. If start exits, the service will transition to the following phase: - Stopped: if the exit code is 0 - Failed: if the exit code is not 0 If the stop command is not set, the start command will receive a SIGTERM signal when the service is requested to stop. If it does not exit within 2 minutes, it will receive a SIGKILL signal. - `stop?: string` stop is an optional command that runs when the service is requested to stop. If set, instead of sending a SIGTERM signal to the start command, the stop command will be run. Once the stop command exits, the start command will receive a SIGKILL signal. If the stop command exits with a non-zero exit code, the service will transition to the Failed phase. If the stop command does not exit within 2 minutes, a SIGKILL signal will be sent to both the start and stop commands. - `desiredPhase?: ServicePhase` desired_phase is the phase the service should be in. Used to start or stop the service. - `"SERVICE_PHASE_UNSPECIFIED"` - `"SERVICE_PHASE_STARTING"` - `"SERVICE_PHASE_RUNNING"` - `"SERVICE_PHASE_STOPPING"` - `"SERVICE_PHASE_STOPPED"` - `"SERVICE_PHASE_FAILED"` - `"SERVICE_PHASE_DELETED"` - `env?: Array` env specifies environment variables for the service. - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn` runs_on specifies the environment the service should run on. - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. - `session?: string` session should be changed to trigger a restart of the service. If a service exits it will not be restarted until the session is changed. - `specVersion?: string` version of the spec. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b. - `status?: ServiceStatus` - `failureMessage?: string` failure_message summarises why the service failed to operate. If this is non-empty the service has failed to operate and will likely transition to a failed state. - `logUrl?: string` log_url contains the URL at which the service logs can be accessed. - `output?: Record` output contains the output of the service. setting an output field to empty string will unset it. - `phase?: ServicePhase` phase is the current phase of the service. - `session?: string` session is the current session of the service. - `statusVersion?: string` version of the status update. Service instances themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const service of client.environments.automations.services.list({ filter: { references: ['web-server', 'database'] }, pagination: { pageSize: 20 }, })) { console.log(service.id); } ``` #### Response ```json { "pagination": { "nextToken": "nextToken" }, "services": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "environmentId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "metadata": { "createdAt": "2019-12-27T18:11:19.117Z", "creator": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "principal": "PRINCIPAL_UNSPECIFIED" }, "description": "description", "name": "x", "reference": "reference", "role": "SERVICE_ROLE_UNSPECIFIED", "triggeredBy": [ { "beforeSnapshot": true, "manual": true, "postDevcontainerStart": true, "postEnvironmentStart": true, "postMachineStart": true, "prebuild": true } ] }, "spec": { "commands": { "ready": "ready", "start": "x", "stop": "stop" }, "desiredPhase": "SERVICE_PHASE_UNSPECIFIED", "env": [ { "name": "x", "value": "value", "valueFrom": { "secretRef": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } } } ], "runsOn": { "docker": { "environment": [ "string" ], "image": "x" }, "machine": {} }, "session": "session", "specVersion": "specVersion" }, "status": { "failureMessage": "failureMessage", "logUrl": "logUrl", "output": { "foo": "string" }, "phase": "SERVICE_PHASE_UNSPECIFIED", "session": "session", "statusVersion": "statusVersion" } } ] } ``` ## GetService `client.environments.automations.services.retrieve(ServiceRetrieveParamsbody, RequestOptionsoptions?): ServiceRetrieveResponse` **post** `/gitpod.v1.EnvironmentAutomationService/GetService` Gets details about a specific automation service. Use this method to: - Check service status - View service configuration - Monitor service health - Retrieve service metadata ### Examples - Get service details: Retrieves information about a specific service. ```yaml id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" ``` ### Parameters - `body: ServiceRetrieveParams` - `id?: string` ### Returns - `ServiceRetrieveResponse` - `service: Service` - `id: string` - `environmentId?: string` - `metadata?: ServiceMetadata` - `createdAt?: string` created_at is the time the service was created. - `creator?: Subject` creator describes the principal who created the service. - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `description?: string` description is a user-facing description for the service. It can be used to provide context and documentation for the service. - `name?: string` name is a user-facing name for the service. Unlike the reference, this field is not unique, and not referenced by the system. This is a short descriptive name for the service. - `reference?: string` reference is a user-facing identifier for the service which must be unique on the environment. It is used to express dependencies between services, and to identify the service in user interactions (e.g. the CLI). - `role?: ServiceRole` role specifies the intended role or purpose of the service. - `"SERVICE_ROLE_UNSPECIFIED"` - `"SERVICE_ROLE_DEFAULT"` - `"SERVICE_ROLE_EDITOR"` - `"SERVICE_ROLE_AI_AGENT"` - `"SERVICE_ROLE_SECURITY_AGENT"` - `triggeredBy?: Array` triggered_by is a list of trigger that start the service. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `spec?: ServiceSpec` - `commands?: Commands` commands contains the commands to start, stop and check the readiness of the service - `ready?: string` ready is an optional command that is run repeatedly until it exits with a zero exit code. If set, the service will first go into a Starting phase, and then into a Running phase once the ready command exits with a zero exit code. - `start?: string` start is the command to start and run the service. If start exits, the service will transition to the following phase: - Stopped: if the exit code is 0 - Failed: if the exit code is not 0 If the stop command is not set, the start command will receive a SIGTERM signal when the service is requested to stop. If it does not exit within 2 minutes, it will receive a SIGKILL signal. - `stop?: string` stop is an optional command that runs when the service is requested to stop. If set, instead of sending a SIGTERM signal to the start command, the stop command will be run. Once the stop command exits, the start command will receive a SIGKILL signal. If the stop command exits with a non-zero exit code, the service will transition to the Failed phase. If the stop command does not exit within 2 minutes, a SIGKILL signal will be sent to both the start and stop commands. - `desiredPhase?: ServicePhase` desired_phase is the phase the service should be in. Used to start or stop the service. - `"SERVICE_PHASE_UNSPECIFIED"` - `"SERVICE_PHASE_STARTING"` - `"SERVICE_PHASE_RUNNING"` - `"SERVICE_PHASE_STOPPING"` - `"SERVICE_PHASE_STOPPED"` - `"SERVICE_PHASE_FAILED"` - `"SERVICE_PHASE_DELETED"` - `env?: Array` env specifies environment variables for the service. - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn` runs_on specifies the environment the service should run on. - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. - `session?: string` session should be changed to trigger a restart of the service. If a service exits it will not be restarted until the session is changed. - `specVersion?: string` version of the spec. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b. - `status?: ServiceStatus` - `failureMessage?: string` failure_message summarises why the service failed to operate. If this is non-empty the service has failed to operate and will likely transition to a failed state. - `logUrl?: string` log_url contains the URL at which the service logs can be accessed. - `output?: Record` output contains the output of the service. setting an output field to empty string will unset it. - `phase?: ServicePhase` phase is the current phase of the service. - `session?: string` session is the current session of the service. - `statusVersion?: string` version of the status update. Service instances themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const service = await client.environments.automations.services.retrieve({ id: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', }); console.log(service.service); ``` #### Response ```json { "service": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "environmentId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "metadata": { "createdAt": "2019-12-27T18:11:19.117Z", "creator": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "principal": "PRINCIPAL_UNSPECIFIED" }, "description": "description", "name": "x", "reference": "reference", "role": "SERVICE_ROLE_UNSPECIFIED", "triggeredBy": [ { "beforeSnapshot": true, "manual": true, "postDevcontainerStart": true, "postEnvironmentStart": true, "postMachineStart": true, "prebuild": true } ] }, "spec": { "commands": { "ready": "ready", "start": "x", "stop": "stop" }, "desiredPhase": "SERVICE_PHASE_UNSPECIFIED", "env": [ { "name": "x", "value": "value", "valueFrom": { "secretRef": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } } } ], "runsOn": { "docker": { "environment": [ "string" ], "image": "x" }, "machine": {} }, "session": "session", "specVersion": "specVersion" }, "status": { "failureMessage": "failureMessage", "logUrl": "logUrl", "output": { "foo": "string" }, "phase": "SERVICE_PHASE_UNSPECIFIED", "session": "session", "statusVersion": "statusVersion" } } } ``` ## StartService `client.environments.automations.services.start(ServiceStartParamsbody, RequestOptionsoptions?): ServiceStartResponse` **post** `/gitpod.v1.EnvironmentAutomationService/StartService` Starts an automation service. This call does not block until the service is started. This call will not error if the service is already running or has been started. Use this method to: - Start stopped services - Resume service operations - Trigger service initialization ### Examples - Start service: Starts a previously stopped service. ```yaml id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" ``` ### Parameters - `body: ServiceStartParams` - `id?: string` ### Returns - `ServiceStartResponse = unknown` ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const response = await client.environments.automations.services.start({ id: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', }); console.log(response); ``` #### Response ```json {} ``` ## StopService `client.environments.automations.services.stop(ServiceStopParamsbody, RequestOptionsoptions?): ServiceStopResponse` **post** `/gitpod.v1.EnvironmentAutomationService/StopService` Stops an automation service. This call does not block until the service is stopped. This call will not error if the service is already stopped or has been stopped. Use this method to: - Pause service operations - Gracefully stop services - Prepare for updates ### Examples - Stop service: Gracefully stops a running service. ```yaml id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" ``` ### Parameters - `body: ServiceStopParams` - `id?: string` ### Returns - `ServiceStopResponse = unknown` ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const response = await client.environments.automations.services.stop({ id: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', }); console.log(response); ``` #### Response ```json {} ``` ## UpdateService `client.environments.automations.services.update(ServiceUpdateParamsbody, RequestOptionsoptions?): ServiceUpdateResponse` **post** `/gitpod.v1.EnvironmentAutomationService/UpdateService` Updates an automation service configuration. Use this method to: - Modify service commands - Update triggers - Change runtime settings - Adjust dependencies ### Examples - Update commands: Changes service start and ready commands. ```yaml id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" spec: commands: start: "npm run start:dev" ready: "curl -s http://localhost:8080" ``` - Update triggers: Modifies when the service starts. ```yaml id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" metadata: triggeredBy: trigger: - postDevcontainerStart: true - manual: true ``` ### Parameters - `body: ServiceUpdateParams` - `id?: string` - `metadata?: Metadata` - `description?: string | null` - `name?: string | null` - `role?: ServiceRole | null` - `"SERVICE_ROLE_UNSPECIFIED"` - `"SERVICE_ROLE_DEFAULT"` - `"SERVICE_ROLE_EDITOR"` - `"SERVICE_ROLE_AI_AGENT"` - `"SERVICE_ROLE_SECURITY_AGENT"` - `triggeredBy?: TriggeredBy | null` - `trigger?: Array` - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `spec?: Spec` Changing the spec of a service is a complex operation. The spec of a service can only be updated if the service is in a stopped state. If the service is running, it must be stopped first. - `commands?: Commands | null` - `ready?: string | null` - `start?: string | null` - `stop?: string | null` - `env?: Array` - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn | null` - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. - `status?: Status` Service status updates are only expected from the executing environment. As a client of this API you are not expected to provide this field. Updating this field requires the `environmentservice:update_status` permission. - `failureMessage?: string | null` - `logUrl?: string | null` - `output?: Record` setting an output field to empty string will unset it. - `phase?: ServicePhase | null` - `"SERVICE_PHASE_UNSPECIFIED"` - `"SERVICE_PHASE_STARTING"` - `"SERVICE_PHASE_RUNNING"` - `"SERVICE_PHASE_STOPPING"` - `"SERVICE_PHASE_STOPPED"` - `"SERVICE_PHASE_FAILED"` - `"SERVICE_PHASE_DELETED"` - `session?: string | null` ### Returns - `ServiceUpdateResponse = unknown` ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const service = await client.environments.automations.services.update({ id: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', spec: { commands: { ready: 'curl -s http://localhost:8080', start: 'npm run start:dev' } }, }); console.log(service); ``` #### Response ```json {} ``` ## Domain Types ### Service - `Service` - `id: string` - `environmentId?: string` - `metadata?: ServiceMetadata` - `createdAt?: string` created_at is the time the service was created. - `creator?: Subject` creator describes the principal who created the service. - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `description?: string` description is a user-facing description for the service. It can be used to provide context and documentation for the service. - `name?: string` name is a user-facing name for the service. Unlike the reference, this field is not unique, and not referenced by the system. This is a short descriptive name for the service. - `reference?: string` reference is a user-facing identifier for the service which must be unique on the environment. It is used to express dependencies between services, and to identify the service in user interactions (e.g. the CLI). - `role?: ServiceRole` role specifies the intended role or purpose of the service. - `"SERVICE_ROLE_UNSPECIFIED"` - `"SERVICE_ROLE_DEFAULT"` - `"SERVICE_ROLE_EDITOR"` - `"SERVICE_ROLE_AI_AGENT"` - `"SERVICE_ROLE_SECURITY_AGENT"` - `triggeredBy?: Array` triggered_by is a list of trigger that start the service. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `spec?: ServiceSpec` - `commands?: Commands` commands contains the commands to start, stop and check the readiness of the service - `ready?: string` ready is an optional command that is run repeatedly until it exits with a zero exit code. If set, the service will first go into a Starting phase, and then into a Running phase once the ready command exits with a zero exit code. - `start?: string` start is the command to start and run the service. If start exits, the service will transition to the following phase: - Stopped: if the exit code is 0 - Failed: if the exit code is not 0 If the stop command is not set, the start command will receive a SIGTERM signal when the service is requested to stop. If it does not exit within 2 minutes, it will receive a SIGKILL signal. - `stop?: string` stop is an optional command that runs when the service is requested to stop. If set, instead of sending a SIGTERM signal to the start command, the stop command will be run. Once the stop command exits, the start command will receive a SIGKILL signal. If the stop command exits with a non-zero exit code, the service will transition to the Failed phase. If the stop command does not exit within 2 minutes, a SIGKILL signal will be sent to both the start and stop commands. - `desiredPhase?: ServicePhase` desired_phase is the phase the service should be in. Used to start or stop the service. - `"SERVICE_PHASE_UNSPECIFIED"` - `"SERVICE_PHASE_STARTING"` - `"SERVICE_PHASE_RUNNING"` - `"SERVICE_PHASE_STOPPING"` - `"SERVICE_PHASE_STOPPED"` - `"SERVICE_PHASE_FAILED"` - `"SERVICE_PHASE_DELETED"` - `env?: Array` env specifies environment variables for the service. - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn` runs_on specifies the environment the service should run on. - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. - `session?: string` session should be changed to trigger a restart of the service. If a service exits it will not be restarted until the session is changed. - `specVersion?: string` version of the spec. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b. - `status?: ServiceStatus` - `failureMessage?: string` failure_message summarises why the service failed to operate. If this is non-empty the service has failed to operate and will likely transition to a failed state. - `logUrl?: string` log_url contains the URL at which the service logs can be accessed. - `output?: Record` output contains the output of the service. setting an output field to empty string will unset it. - `phase?: ServicePhase` phase is the current phase of the service. - `session?: string` session is the current session of the service. - `statusVersion?: string` version of the status update. Service instances themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. ### Service Metadata - `ServiceMetadata` - `createdAt?: string` created_at is the time the service was created. - `creator?: Subject` creator describes the principal who created the service. - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `description?: string` description is a user-facing description for the service. It can be used to provide context and documentation for the service. - `name?: string` name is a user-facing name for the service. Unlike the reference, this field is not unique, and not referenced by the system. This is a short descriptive name for the service. - `reference?: string` reference is a user-facing identifier for the service which must be unique on the environment. It is used to express dependencies between services, and to identify the service in user interactions (e.g. the CLI). - `role?: ServiceRole` role specifies the intended role or purpose of the service. - `"SERVICE_ROLE_UNSPECIFIED"` - `"SERVICE_ROLE_DEFAULT"` - `"SERVICE_ROLE_EDITOR"` - `"SERVICE_ROLE_AI_AGENT"` - `"SERVICE_ROLE_SECURITY_AGENT"` - `triggeredBy?: Array` triggered_by is a list of trigger that start the service. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` ### Service Phase - `ServicePhase = "SERVICE_PHASE_UNSPECIFIED" | "SERVICE_PHASE_STARTING" | "SERVICE_PHASE_RUNNING" | 4 more` - `"SERVICE_PHASE_UNSPECIFIED"` - `"SERVICE_PHASE_STARTING"` - `"SERVICE_PHASE_RUNNING"` - `"SERVICE_PHASE_STOPPING"` - `"SERVICE_PHASE_STOPPED"` - `"SERVICE_PHASE_FAILED"` - `"SERVICE_PHASE_DELETED"` ### Service Role - `ServiceRole = "SERVICE_ROLE_UNSPECIFIED" | "SERVICE_ROLE_DEFAULT" | "SERVICE_ROLE_EDITOR" | 2 more` - `"SERVICE_ROLE_UNSPECIFIED"` - `"SERVICE_ROLE_DEFAULT"` - `"SERVICE_ROLE_EDITOR"` - `"SERVICE_ROLE_AI_AGENT"` - `"SERVICE_ROLE_SECURITY_AGENT"` ### Service Spec - `ServiceSpec` - `commands?: Commands` commands contains the commands to start, stop and check the readiness of the service - `ready?: string` ready is an optional command that is run repeatedly until it exits with a zero exit code. If set, the service will first go into a Starting phase, and then into a Running phase once the ready command exits with a zero exit code. - `start?: string` start is the command to start and run the service. If start exits, the service will transition to the following phase: - Stopped: if the exit code is 0 - Failed: if the exit code is not 0 If the stop command is not set, the start command will receive a SIGTERM signal when the service is requested to stop. If it does not exit within 2 minutes, it will receive a SIGKILL signal. - `stop?: string` stop is an optional command that runs when the service is requested to stop. If set, instead of sending a SIGTERM signal to the start command, the stop command will be run. Once the stop command exits, the start command will receive a SIGKILL signal. If the stop command exits with a non-zero exit code, the service will transition to the Failed phase. If the stop command does not exit within 2 minutes, a SIGKILL signal will be sent to both the start and stop commands. - `desiredPhase?: ServicePhase` desired_phase is the phase the service should be in. Used to start or stop the service. - `"SERVICE_PHASE_UNSPECIFIED"` - `"SERVICE_PHASE_STARTING"` - `"SERVICE_PHASE_RUNNING"` - `"SERVICE_PHASE_STOPPING"` - `"SERVICE_PHASE_STOPPED"` - `"SERVICE_PHASE_FAILED"` - `"SERVICE_PHASE_DELETED"` - `env?: Array` env specifies environment variables for the service. - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn` runs_on specifies the environment the service should run on. - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. - `session?: string` session should be changed to trigger a restart of the service. If a service exits it will not be restarted until the session is changed. - `specVersion?: string` version of the spec. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b. ### Service Status - `ServiceStatus` - `failureMessage?: string` failure_message summarises why the service failed to operate. If this is non-empty the service has failed to operate and will likely transition to a failed state. - `logUrl?: string` log_url contains the URL at which the service logs can be accessed. - `output?: Record` output contains the output of the service. setting an output field to empty string will unset it. - `phase?: ServicePhase` phase is the current phase of the service. - `"SERVICE_PHASE_UNSPECIFIED"` - `"SERVICE_PHASE_STARTING"` - `"SERVICE_PHASE_RUNNING"` - `"SERVICE_PHASE_STOPPING"` - `"SERVICE_PHASE_STOPPED"` - `"SERVICE_PHASE_FAILED"` - `"SERVICE_PHASE_DELETED"` - `session?: string` session is the current session of the service. - `statusVersion?: string` version of the status update. Service instances themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. ### Service Create Response - `ServiceCreateResponse` - `service: Service` - `id: string` - `environmentId?: string` - `metadata?: ServiceMetadata` - `createdAt?: string` created_at is the time the service was created. - `creator?: Subject` creator describes the principal who created the service. - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `description?: string` description is a user-facing description for the service. It can be used to provide context and documentation for the service. - `name?: string` name is a user-facing name for the service. Unlike the reference, this field is not unique, and not referenced by the system. This is a short descriptive name for the service. - `reference?: string` reference is a user-facing identifier for the service which must be unique on the environment. It is used to express dependencies between services, and to identify the service in user interactions (e.g. the CLI). - `role?: ServiceRole` role specifies the intended role or purpose of the service. - `"SERVICE_ROLE_UNSPECIFIED"` - `"SERVICE_ROLE_DEFAULT"` - `"SERVICE_ROLE_EDITOR"` - `"SERVICE_ROLE_AI_AGENT"` - `"SERVICE_ROLE_SECURITY_AGENT"` - `triggeredBy?: Array` triggered_by is a list of trigger that start the service. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `spec?: ServiceSpec` - `commands?: Commands` commands contains the commands to start, stop and check the readiness of the service - `ready?: string` ready is an optional command that is run repeatedly until it exits with a zero exit code. If set, the service will first go into a Starting phase, and then into a Running phase once the ready command exits with a zero exit code. - `start?: string` start is the command to start and run the service. If start exits, the service will transition to the following phase: - Stopped: if the exit code is 0 - Failed: if the exit code is not 0 If the stop command is not set, the start command will receive a SIGTERM signal when the service is requested to stop. If it does not exit within 2 minutes, it will receive a SIGKILL signal. - `stop?: string` stop is an optional command that runs when the service is requested to stop. If set, instead of sending a SIGTERM signal to the start command, the stop command will be run. Once the stop command exits, the start command will receive a SIGKILL signal. If the stop command exits with a non-zero exit code, the service will transition to the Failed phase. If the stop command does not exit within 2 minutes, a SIGKILL signal will be sent to both the start and stop commands. - `desiredPhase?: ServicePhase` desired_phase is the phase the service should be in. Used to start or stop the service. - `"SERVICE_PHASE_UNSPECIFIED"` - `"SERVICE_PHASE_STARTING"` - `"SERVICE_PHASE_RUNNING"` - `"SERVICE_PHASE_STOPPING"` - `"SERVICE_PHASE_STOPPED"` - `"SERVICE_PHASE_FAILED"` - `"SERVICE_PHASE_DELETED"` - `env?: Array` env specifies environment variables for the service. - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn` runs_on specifies the environment the service should run on. - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. - `session?: string` session should be changed to trigger a restart of the service. If a service exits it will not be restarted until the session is changed. - `specVersion?: string` version of the spec. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b. - `status?: ServiceStatus` - `failureMessage?: string` failure_message summarises why the service failed to operate. If this is non-empty the service has failed to operate and will likely transition to a failed state. - `logUrl?: string` log_url contains the URL at which the service logs can be accessed. - `output?: Record` output contains the output of the service. setting an output field to empty string will unset it. - `phase?: ServicePhase` phase is the current phase of the service. - `session?: string` session is the current session of the service. - `statusVersion?: string` version of the status update. Service instances themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. ### Service Delete Response - `ServiceDeleteResponse = unknown` ### Service Retrieve Response - `ServiceRetrieveResponse` - `service: Service` - `id: string` - `environmentId?: string` - `metadata?: ServiceMetadata` - `createdAt?: string` created_at is the time the service was created. - `creator?: Subject` creator describes the principal who created the service. - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `description?: string` description is a user-facing description for the service. It can be used to provide context and documentation for the service. - `name?: string` name is a user-facing name for the service. Unlike the reference, this field is not unique, and not referenced by the system. This is a short descriptive name for the service. - `reference?: string` reference is a user-facing identifier for the service which must be unique on the environment. It is used to express dependencies between services, and to identify the service in user interactions (e.g. the CLI). - `role?: ServiceRole` role specifies the intended role or purpose of the service. - `"SERVICE_ROLE_UNSPECIFIED"` - `"SERVICE_ROLE_DEFAULT"` - `"SERVICE_ROLE_EDITOR"` - `"SERVICE_ROLE_AI_AGENT"` - `"SERVICE_ROLE_SECURITY_AGENT"` - `triggeredBy?: Array` triggered_by is a list of trigger that start the service. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `spec?: ServiceSpec` - `commands?: Commands` commands contains the commands to start, stop and check the readiness of the service - `ready?: string` ready is an optional command that is run repeatedly until it exits with a zero exit code. If set, the service will first go into a Starting phase, and then into a Running phase once the ready command exits with a zero exit code. - `start?: string` start is the command to start and run the service. If start exits, the service will transition to the following phase: - Stopped: if the exit code is 0 - Failed: if the exit code is not 0 If the stop command is not set, the start command will receive a SIGTERM signal when the service is requested to stop. If it does not exit within 2 minutes, it will receive a SIGKILL signal. - `stop?: string` stop is an optional command that runs when the service is requested to stop. If set, instead of sending a SIGTERM signal to the start command, the stop command will be run. Once the stop command exits, the start command will receive a SIGKILL signal. If the stop command exits with a non-zero exit code, the service will transition to the Failed phase. If the stop command does not exit within 2 minutes, a SIGKILL signal will be sent to both the start and stop commands. - `desiredPhase?: ServicePhase` desired_phase is the phase the service should be in. Used to start or stop the service. - `"SERVICE_PHASE_UNSPECIFIED"` - `"SERVICE_PHASE_STARTING"` - `"SERVICE_PHASE_RUNNING"` - `"SERVICE_PHASE_STOPPING"` - `"SERVICE_PHASE_STOPPED"` - `"SERVICE_PHASE_FAILED"` - `"SERVICE_PHASE_DELETED"` - `env?: Array` env specifies environment variables for the service. - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn` runs_on specifies the environment the service should run on. - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. - `session?: string` session should be changed to trigger a restart of the service. If a service exits it will not be restarted until the session is changed. - `specVersion?: string` version of the spec. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b. - `status?: ServiceStatus` - `failureMessage?: string` failure_message summarises why the service failed to operate. If this is non-empty the service has failed to operate and will likely transition to a failed state. - `logUrl?: string` log_url contains the URL at which the service logs can be accessed. - `output?: Record` output contains the output of the service. setting an output field to empty string will unset it. - `phase?: ServicePhase` phase is the current phase of the service. - `session?: string` session is the current session of the service. - `statusVersion?: string` version of the status update. Service instances themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. ### Service Start Response - `ServiceStartResponse = unknown` ### Service Stop Response - `ServiceStopResponse = unknown` ### Service Update Response - `ServiceUpdateResponse = unknown` # Tasks ## CreateTask `client.environments.automations.tasks.create(TaskCreateParamsbody, RequestOptionsoptions?): TaskCreateResponse` **post** `/gitpod.v1.EnvironmentAutomationService/CreateTask` Creates a new automation task. Use this method to: - Define one-off or scheduled tasks - Set up build or test automation - Configure task dependencies - Specify execution environments ### Examples - Create basic task: Creates a simple build task. ```yaml environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" metadata: reference: "build" name: "Build Project" description: "Builds the project artifacts" triggeredBy: - postEnvironmentStart: true spec: command: "npm run build" ``` - Create task with dependencies: Creates a task that depends on other services. ```yaml environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" metadata: reference: "test" name: "Run Tests" description: "Runs the test suite" spec: command: "npm test" dependsOn: ["d2c94c27-3b76-4a42-b88c-95a85e392c68"] ``` ### Parameters - `body: TaskCreateParams` - `dependsOn?: Array` - `environmentId?: string` - `metadata?: TaskMetadata` - `createdAt?: string` created_at is the time the task was created. - `creator?: Subject` creator describes the principal who created the task. - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `description?: string` description is a user-facing description for the task. It can be used to provide context and documentation for the task. - `name?: string` name is a user-facing name for the task. Unlike the reference, this field is not unique, and not referenced by the system. This is a short descriptive name for the task. - `reference?: string` reference is a user-facing identifier for the task which must be unique on the environment. It is used to express dependencies between tasks, and to identify the task in user interactions (e.g. the CLI). - `triggeredBy?: Array` triggered_by is a list of trigger that start the task. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `spec?: TaskSpec` - `command?: string` command contains the command the task should execute - `env?: Array` env specifies environment variables for the task. - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn` runs_on specifies the environment the task should run on. - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. ### Returns - `TaskCreateResponse` - `task: Task` - `id: string` - `dependsOn?: Array` dependencies specifies the IDs of the automations this task depends on. - `environmentId?: string` - `metadata?: TaskMetadata` - `createdAt?: string` created_at is the time the task was created. - `creator?: Subject` creator describes the principal who created the task. - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `description?: string` description is a user-facing description for the task. It can be used to provide context and documentation for the task. - `name?: string` name is a user-facing name for the task. Unlike the reference, this field is not unique, and not referenced by the system. This is a short descriptive name for the task. - `reference?: string` reference is a user-facing identifier for the task which must be unique on the environment. It is used to express dependencies between tasks, and to identify the task in user interactions (e.g. the CLI). - `triggeredBy?: Array` triggered_by is a list of trigger that start the task. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `spec?: TaskSpec` - `command?: string` command contains the command the task should execute - `env?: Array` env specifies environment variables for the task. - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn` runs_on specifies the environment the task should run on. - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const task = await client.environments.automations.tasks.create({ environmentId: '07e03a28-65a5-4d98-b532-8ea67b188048', metadata: { description: 'Builds the project artifacts', name: 'Build Project', reference: 'build', triggeredBy: [{ postEnvironmentStart: true }], }, spec: { command: 'npm run build' }, }); console.log(task.task); ``` #### Response ```json { "task": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "dependsOn": [ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" ], "environmentId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "metadata": { "createdAt": "2019-12-27T18:11:19.117Z", "creator": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "principal": "PRINCIPAL_UNSPECIFIED" }, "description": "description", "name": "x", "reference": "reference", "triggeredBy": [ { "beforeSnapshot": true, "manual": true, "postDevcontainerStart": true, "postEnvironmentStart": true, "postMachineStart": true, "prebuild": true } ] }, "spec": { "command": "command", "env": [ { "name": "x", "value": "value", "valueFrom": { "secretRef": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } } } ], "runsOn": { "docker": { "environment": [ "string" ], "image": "x" }, "machine": {} } } } } ``` ## DeleteTask `client.environments.automations.tasks.delete(TaskDeleteParamsbody, RequestOptionsoptions?): TaskDeleteResponse` **post** `/gitpod.v1.EnvironmentAutomationService/DeleteTask` Deletes an automation task. Use this method to: - Remove unused tasks - Clean up task configurations - Delete obsolete automations ### Examples - Delete task: Removes a task and its configuration. ```yaml id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" ``` ### Parameters - `body: TaskDeleteParams` - `id?: string` ### Returns - `TaskDeleteResponse = unknown` ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const task = await client.environments.automations.tasks.delete({ id: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', }); console.log(task); ``` #### Response ```json {} ``` ## ListTasks `client.environments.automations.tasks.list(TaskListParamsparams, RequestOptionsoptions?): TasksPage` **post** `/gitpod.v1.EnvironmentAutomationService/ListTasks` Lists automation tasks with optional filtering. Use this method to: - View all tasks in an environment - Filter tasks by reference - Monitor task status ### Examples - List environment tasks: Shows all tasks for an environment. ```yaml filter: environmentIds: ["07e03a28-65a5-4d98-b532-8ea67b188048"] pagination: pageSize: 20 ``` - Filter by reference: Lists tasks matching specific references. ```yaml filter: references: ["build", "test"] pagination: pageSize: 20 ``` ### Parameters - `params: TaskListParams` - `token?: string` Query param - `pageSize?: number` Query param - `filter?: Filter` Body param: filter contains the filter options for listing tasks - `environmentIds?: Array` environment_ids filters the response to only tasks of these environments - `references?: Array` references filters the response to only services with these references - `taskIds?: Array` task_ids filters the response to only tasks with these IDs - `pagination?: Pagination` Body param: pagination contains the pagination options for listing tasks - `token?: string` Token for the next set of results that was returned as next_token of a PaginationResponse - `pageSize?: number` Page size is the maximum number of results to retrieve per page. Defaults to 25. Maximum 100. ### Returns - `Task` - `id: string` - `dependsOn?: Array` dependencies specifies the IDs of the automations this task depends on. - `environmentId?: string` - `metadata?: TaskMetadata` - `createdAt?: string` created_at is the time the task was created. - `creator?: Subject` creator describes the principal who created the task. - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `description?: string` description is a user-facing description for the task. It can be used to provide context and documentation for the task. - `name?: string` name is a user-facing name for the task. Unlike the reference, this field is not unique, and not referenced by the system. This is a short descriptive name for the task. - `reference?: string` reference is a user-facing identifier for the task which must be unique on the environment. It is used to express dependencies between tasks, and to identify the task in user interactions (e.g. the CLI). - `triggeredBy?: Array` triggered_by is a list of trigger that start the task. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `spec?: TaskSpec` - `command?: string` command contains the command the task should execute - `env?: Array` env specifies environment variables for the task. - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn` runs_on specifies the environment the task should run on. - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const task of client.environments.automations.tasks.list({ filter: { references: ['build', 'test'] }, pagination: { pageSize: 20 }, })) { console.log(task.id); } ``` #### Response ```json { "pagination": { "nextToken": "nextToken" }, "tasks": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "dependsOn": [ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" ], "environmentId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "metadata": { "createdAt": "2019-12-27T18:11:19.117Z", "creator": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "principal": "PRINCIPAL_UNSPECIFIED" }, "description": "description", "name": "x", "reference": "reference", "triggeredBy": [ { "beforeSnapshot": true, "manual": true, "postDevcontainerStart": true, "postEnvironmentStart": true, "postMachineStart": true, "prebuild": true } ] }, "spec": { "command": "command", "env": [ { "name": "x", "value": "value", "valueFrom": { "secretRef": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } } } ], "runsOn": { "docker": { "environment": [ "string" ], "image": "x" }, "machine": {} } } } ] } ``` ## GetTask `client.environments.automations.tasks.retrieve(TaskRetrieveParamsbody, RequestOptionsoptions?): TaskRetrieveResponse` **post** `/gitpod.v1.EnvironmentAutomationService/GetTask` Gets details about a specific automation task. Use this method to: - Check task configuration - View task dependencies - Monitor task status ### Examples - Get task details: Retrieves information about a specific task. ```yaml id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" ``` ### Parameters - `body: TaskRetrieveParams` - `id?: string` ### Returns - `TaskRetrieveResponse` - `task: Task` - `id: string` - `dependsOn?: Array` dependencies specifies the IDs of the automations this task depends on. - `environmentId?: string` - `metadata?: TaskMetadata` - `createdAt?: string` created_at is the time the task was created. - `creator?: Subject` creator describes the principal who created the task. - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `description?: string` description is a user-facing description for the task. It can be used to provide context and documentation for the task. - `name?: string` name is a user-facing name for the task. Unlike the reference, this field is not unique, and not referenced by the system. This is a short descriptive name for the task. - `reference?: string` reference is a user-facing identifier for the task which must be unique on the environment. It is used to express dependencies between tasks, and to identify the task in user interactions (e.g. the CLI). - `triggeredBy?: Array` triggered_by is a list of trigger that start the task. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `spec?: TaskSpec` - `command?: string` command contains the command the task should execute - `env?: Array` env specifies environment variables for the task. - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn` runs_on specifies the environment the task should run on. - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const task = await client.environments.automations.tasks.retrieve({ id: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', }); console.log(task.task); ``` #### Response ```json { "task": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "dependsOn": [ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" ], "environmentId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "metadata": { "createdAt": "2019-12-27T18:11:19.117Z", "creator": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "principal": "PRINCIPAL_UNSPECIFIED" }, "description": "description", "name": "x", "reference": "reference", "triggeredBy": [ { "beforeSnapshot": true, "manual": true, "postDevcontainerStart": true, "postEnvironmentStart": true, "postMachineStart": true, "prebuild": true } ] }, "spec": { "command": "command", "env": [ { "name": "x", "value": "value", "valueFrom": { "secretRef": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } } } ], "runsOn": { "docker": { "environment": [ "string" ], "image": "x" }, "machine": {} } } } } ``` ## StartTask `client.environments.automations.tasks.start(TaskStartParamsbody, RequestOptionsoptions?): TaskStartResponse` **post** `/gitpod.v1.EnvironmentAutomationService/StartTask` Starts a task by creating a new task execution. This call does not block until the task is started; the task will be started asynchronously. Use this method to: - Trigger task execution - Run one-off tasks - Start scheduled tasks immediately ### Examples - Start task: Creates a new execution of a task. ```yaml id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" ``` ### Parameters - `body: TaskStartParams` - `id?: string` ### Returns - `TaskStartResponse` - `taskExecution: TaskExecution` - `id: string` - `metadata?: TaskExecutionMetadata` - `completedAt?: string` completed_at is the time the task execution was done. - `createdAt?: string` created_at is the time the task was created. - `creator?: Subject` creator describes the principal who created/started the task run. - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `environmentId?: string` environment_id is the ID of the environment in which the task run is executed. - `startedAt?: string` started_at is the time the task execution actually started to run. - `startedBy?: string` started_by describes the trigger that started the task execution. - `taskId?: string` task_id is the ID of the main task being executed. - `spec?: TaskExecutionSpec` - `desiredPhase?: TaskExecutionPhase` desired_phase is the phase the task execution should be in. Used to stop a running task execution early. - `"TASK_EXECUTION_PHASE_UNSPECIFIED"` - `"TASK_EXECUTION_PHASE_PENDING"` - `"TASK_EXECUTION_PHASE_RUNNING"` - `"TASK_EXECUTION_PHASE_SUCCEEDED"` - `"TASK_EXECUTION_PHASE_FAILED"` - `"TASK_EXECUTION_PHASE_STOPPED"` - `plan?: Array` plan is a list of groups of steps. The steps in a group are executed concurrently, while the groups are executed sequentially. The order of the groups is the order in which they are executed. - `steps?: Array` - `id?: string` ID is the ID of the execution step - `dependsOn?: Array` - `label?: string` - `serviceId?: string` - `task?: Task` - `id?: string` - `spec?: TaskSpec` - `command?: string` command contains the command the task should execute - `env?: Array` env specifies environment variables for the task. - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn` runs_on specifies the environment the task should run on. - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. - `status?: TaskExecutionStatus` - `failureMessage?: string` failure_message summarises why the task execution failed to operate. If this is non-empty the task execution has failed to operate and will likely transition to a failed state. - `logUrl?: string` log_url is the URL to the logs of the task's steps. If this is empty, the task either has no logs or has not yet started. - `phase?: TaskExecutionPhase` the phase of a task execution represents the aggregated phase of all steps. - `statusVersion?: string` version of the status update. Task executions themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. - `steps?: Array` steps provides the status for each individual step of the task execution. If a step is missing it has not yet started. - `id?: string` ID is the ID of the execution step - `failureMessage?: string` failure_message summarises why the step failed to operate. If this is non-empty the step has failed to operate and will likely transition to a failed state. - `output?: Record` output contains the output of the task execution. setting an output field to empty string will unset it. - `phase?: TaskExecutionPhase` phase is the current phase of the execution step ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const response = await client.environments.automations.tasks.start({ id: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', }); console.log(response.taskExecution); ``` #### Response ```json { "taskExecution": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "metadata": { "completedAt": "2019-12-27T18:11:19.117Z", "createdAt": "2019-12-27T18:11:19.117Z", "creator": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "principal": "PRINCIPAL_UNSPECIFIED" }, "environmentId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "startedAt": "2019-12-27T18:11:19.117Z", "startedBy": "startedBy", "taskId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" }, "spec": { "desiredPhase": "TASK_EXECUTION_PHASE_UNSPECIFIED", "plan": [ { "steps": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "dependsOn": [ "string" ], "label": "label", "serviceId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "task": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "spec": { "command": "command", "env": [ { "name": "x", "value": "value", "valueFrom": { "secretRef": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } } } ], "runsOn": { "docker": { "environment": [ "string" ], "image": "x" }, "machine": {} } } } } ] } ] }, "status": { "failureMessage": "failureMessage", "logUrl": "logUrl", "phase": "TASK_EXECUTION_PHASE_UNSPECIFIED", "statusVersion": "statusVersion", "steps": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "failureMessage": "failureMessage", "output": { "foo": "string" }, "phase": "TASK_EXECUTION_PHASE_UNSPECIFIED" } ] } } } ``` ## UpdateTask `client.environments.automations.tasks.update(TaskUpdateParamsbody, RequestOptionsoptions?): TaskUpdateResponse` **post** `/gitpod.v1.EnvironmentAutomationService/UpdateTask` Updates an automation task configuration. Use this method to: - Modify task commands - Update task triggers - Change dependencies - Adjust execution settings ### Examples - Update command: Changes the task's command. ```yaml id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" spec: command: "npm run test:coverage" ``` - Update triggers: Modifies when the task runs. ```yaml id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" metadata: triggeredBy: trigger: - postEnvironmentStart: true ``` ### Parameters - `body: TaskUpdateParams` - `id?: string` - `dependsOn?: Array` dependencies specifies the IDs of the automations this task depends on. - `metadata?: Metadata` - `description?: string | null` - `name?: string | null` - `triggeredBy?: TriggeredBy | null` - `trigger?: Array` - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `spec?: Spec` - `command?: string | null` - `env?: Array` - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn | null` - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. ### Returns - `TaskUpdateResponse = unknown` ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const task = await client.environments.automations.tasks.update({ id: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', spec: { command: 'npm run test:coverage' }, }); console.log(task); ``` #### Response ```json {} ``` ## Domain Types ### Task Create Response - `TaskCreateResponse` - `task: Task` - `id: string` - `dependsOn?: Array` dependencies specifies the IDs of the automations this task depends on. - `environmentId?: string` - `metadata?: TaskMetadata` - `createdAt?: string` created_at is the time the task was created. - `creator?: Subject` creator describes the principal who created the task. - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `description?: string` description is a user-facing description for the task. It can be used to provide context and documentation for the task. - `name?: string` name is a user-facing name for the task. Unlike the reference, this field is not unique, and not referenced by the system. This is a short descriptive name for the task. - `reference?: string` reference is a user-facing identifier for the task which must be unique on the environment. It is used to express dependencies between tasks, and to identify the task in user interactions (e.g. the CLI). - `triggeredBy?: Array` triggered_by is a list of trigger that start the task. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `spec?: TaskSpec` - `command?: string` command contains the command the task should execute - `env?: Array` env specifies environment variables for the task. - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn` runs_on specifies the environment the task should run on. - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. ### Task Delete Response - `TaskDeleteResponse = unknown` ### Task Retrieve Response - `TaskRetrieveResponse` - `task: Task` - `id: string` - `dependsOn?: Array` dependencies specifies the IDs of the automations this task depends on. - `environmentId?: string` - `metadata?: TaskMetadata` - `createdAt?: string` created_at is the time the task was created. - `creator?: Subject` creator describes the principal who created the task. - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `description?: string` description is a user-facing description for the task. It can be used to provide context and documentation for the task. - `name?: string` name is a user-facing name for the task. Unlike the reference, this field is not unique, and not referenced by the system. This is a short descriptive name for the task. - `reference?: string` reference is a user-facing identifier for the task which must be unique on the environment. It is used to express dependencies between tasks, and to identify the task in user interactions (e.g. the CLI). - `triggeredBy?: Array` triggered_by is a list of trigger that start the task. - `beforeSnapshot?: boolean` - `manual?: boolean` - `postDevcontainerStart?: boolean` - `postEnvironmentStart?: boolean` - `postMachineStart?: boolean` - `prebuild?: boolean` - `spec?: TaskSpec` - `command?: string` command contains the command the task should execute - `env?: Array` env specifies environment variables for the task. - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn` runs_on specifies the environment the task should run on. - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. ### Task Start Response - `TaskStartResponse` - `taskExecution: TaskExecution` - `id: string` - `metadata?: TaskExecutionMetadata` - `completedAt?: string` completed_at is the time the task execution was done. - `createdAt?: string` created_at is the time the task was created. - `creator?: Subject` creator describes the principal who created/started the task run. - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `environmentId?: string` environment_id is the ID of the environment in which the task run is executed. - `startedAt?: string` started_at is the time the task execution actually started to run. - `startedBy?: string` started_by describes the trigger that started the task execution. - `taskId?: string` task_id is the ID of the main task being executed. - `spec?: TaskExecutionSpec` - `desiredPhase?: TaskExecutionPhase` desired_phase is the phase the task execution should be in. Used to stop a running task execution early. - `"TASK_EXECUTION_PHASE_UNSPECIFIED"` - `"TASK_EXECUTION_PHASE_PENDING"` - `"TASK_EXECUTION_PHASE_RUNNING"` - `"TASK_EXECUTION_PHASE_SUCCEEDED"` - `"TASK_EXECUTION_PHASE_FAILED"` - `"TASK_EXECUTION_PHASE_STOPPED"` - `plan?: Array` plan is a list of groups of steps. The steps in a group are executed concurrently, while the groups are executed sequentially. The order of the groups is the order in which they are executed. - `steps?: Array` - `id?: string` ID is the ID of the execution step - `dependsOn?: Array` - `label?: string` - `serviceId?: string` - `task?: Task` - `id?: string` - `spec?: TaskSpec` - `command?: string` command contains the command the task should execute - `env?: Array` env specifies environment variables for the task. - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn` runs_on specifies the environment the task should run on. - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. - `status?: TaskExecutionStatus` - `failureMessage?: string` failure_message summarises why the task execution failed to operate. If this is non-empty the task execution has failed to operate and will likely transition to a failed state. - `logUrl?: string` log_url is the URL to the logs of the task's steps. If this is empty, the task either has no logs or has not yet started. - `phase?: TaskExecutionPhase` the phase of a task execution represents the aggregated phase of all steps. - `statusVersion?: string` version of the status update. Task executions themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. - `steps?: Array` steps provides the status for each individual step of the task execution. If a step is missing it has not yet started. - `id?: string` ID is the ID of the execution step - `failureMessage?: string` failure_message summarises why the step failed to operate. If this is non-empty the step has failed to operate and will likely transition to a failed state. - `output?: Record` output contains the output of the task execution. setting an output field to empty string will unset it. - `phase?: TaskExecutionPhase` phase is the current phase of the execution step ### Task Update Response - `TaskUpdateResponse = unknown` # Executions ## ListTaskExecutions `client.environments.automations.tasks.executions.list(ExecutionListParamsparams, RequestOptionsoptions?): TaskExecutionsPage` **post** `/gitpod.v1.EnvironmentAutomationService/ListTaskExecutions` Lists executions of automation tasks. Use this method to: - View task execution history - Monitor running tasks - Track task completion status ### Examples - List all executions: Shows execution history for all tasks. ```yaml filter: environmentIds: ["07e03a28-65a5-4d98-b532-8ea67b188048"] pagination: pageSize: 20 ``` - Filter by phase: Lists executions in specific phases. ```yaml filter: phases: ["TASK_EXECUTION_PHASE_RUNNING", "TASK_EXECUTION_PHASE_FAILED"] pagination: pageSize: 20 ``` ### Parameters - `params: ExecutionListParams` - `token?: string` Query param - `pageSize?: number` Query param - `filter?: Filter` Body param: filter contains the filter options for listing task runs - `environmentIds?: Array` environment_ids filters the response to only task runs of these environments - `phases?: Array` phases filters the response to only task runs in these phases - `"TASK_EXECUTION_PHASE_UNSPECIFIED"` - `"TASK_EXECUTION_PHASE_PENDING"` - `"TASK_EXECUTION_PHASE_RUNNING"` - `"TASK_EXECUTION_PHASE_SUCCEEDED"` - `"TASK_EXECUTION_PHASE_FAILED"` - `"TASK_EXECUTION_PHASE_STOPPED"` - `taskIds?: Array` task_ids filters the response to only task runs of these tasks - `taskReferences?: Array` task_references filters the response to only task runs with this reference - `pagination?: Pagination` Body param: pagination contains the pagination options for listing task runs - `token?: string` Token for the next set of results that was returned as next_token of a PaginationResponse - `pageSize?: number` Page size is the maximum number of results to retrieve per page. Defaults to 25. Maximum 100. ### Returns - `TaskExecution` - `id: string` - `metadata?: TaskExecutionMetadata` - `completedAt?: string` completed_at is the time the task execution was done. - `createdAt?: string` created_at is the time the task was created. - `creator?: Subject` creator describes the principal who created/started the task run. - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `environmentId?: string` environment_id is the ID of the environment in which the task run is executed. - `startedAt?: string` started_at is the time the task execution actually started to run. - `startedBy?: string` started_by describes the trigger that started the task execution. - `taskId?: string` task_id is the ID of the main task being executed. - `spec?: TaskExecutionSpec` - `desiredPhase?: TaskExecutionPhase` desired_phase is the phase the task execution should be in. Used to stop a running task execution early. - `"TASK_EXECUTION_PHASE_UNSPECIFIED"` - `"TASK_EXECUTION_PHASE_PENDING"` - `"TASK_EXECUTION_PHASE_RUNNING"` - `"TASK_EXECUTION_PHASE_SUCCEEDED"` - `"TASK_EXECUTION_PHASE_FAILED"` - `"TASK_EXECUTION_PHASE_STOPPED"` - `plan?: Array` plan is a list of groups of steps. The steps in a group are executed concurrently, while the groups are executed sequentially. The order of the groups is the order in which they are executed. - `steps?: Array` - `id?: string` ID is the ID of the execution step - `dependsOn?: Array` - `label?: string` - `serviceId?: string` - `task?: Task` - `id?: string` - `spec?: TaskSpec` - `command?: string` command contains the command the task should execute - `env?: Array` env specifies environment variables for the task. - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn` runs_on specifies the environment the task should run on. - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. - `status?: TaskExecutionStatus` - `failureMessage?: string` failure_message summarises why the task execution failed to operate. If this is non-empty the task execution has failed to operate and will likely transition to a failed state. - `logUrl?: string` log_url is the URL to the logs of the task's steps. If this is empty, the task either has no logs or has not yet started. - `phase?: TaskExecutionPhase` the phase of a task execution represents the aggregated phase of all steps. - `statusVersion?: string` version of the status update. Task executions themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. - `steps?: Array` steps provides the status for each individual step of the task execution. If a step is missing it has not yet started. - `id?: string` ID is the ID of the execution step - `failureMessage?: string` failure_message summarises why the step failed to operate. If this is non-empty the step has failed to operate and will likely transition to a failed state. - `output?: Record` output contains the output of the task execution. setting an output field to empty string will unset it. - `phase?: TaskExecutionPhase` phase is the current phase of the execution step ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const taskExecution of client.environments.automations.tasks.executions.list({ filter: { phases: ['TASK_EXECUTION_PHASE_RUNNING', 'TASK_EXECUTION_PHASE_FAILED'] }, pagination: { pageSize: 20 }, })) { console.log(taskExecution.id); } ``` #### Response ```json { "pagination": { "nextToken": "nextToken" }, "taskExecutions": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "metadata": { "completedAt": "2019-12-27T18:11:19.117Z", "createdAt": "2019-12-27T18:11:19.117Z", "creator": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "principal": "PRINCIPAL_UNSPECIFIED" }, "environmentId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "startedAt": "2019-12-27T18:11:19.117Z", "startedBy": "startedBy", "taskId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" }, "spec": { "desiredPhase": "TASK_EXECUTION_PHASE_UNSPECIFIED", "plan": [ { "steps": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "dependsOn": [ "string" ], "label": "label", "serviceId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "task": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "spec": { "command": "command", "env": [ { "name": "x", "value": "value", "valueFrom": { "secretRef": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } } } ], "runsOn": { "docker": { "environment": [ "string" ], "image": "x" }, "machine": {} } } } } ] } ] }, "status": { "failureMessage": "failureMessage", "logUrl": "logUrl", "phase": "TASK_EXECUTION_PHASE_UNSPECIFIED", "statusVersion": "statusVersion", "steps": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "failureMessage": "failureMessage", "output": { "foo": "string" }, "phase": "TASK_EXECUTION_PHASE_UNSPECIFIED" } ] } } ] } ``` ## GetTaskExecution `client.environments.automations.tasks.executions.retrieve(ExecutionRetrieveParamsbody, RequestOptionsoptions?): ExecutionRetrieveResponse` **post** `/gitpod.v1.EnvironmentAutomationService/GetTaskExecution` Gets details about a specific task execution. Use this method to: - Monitor execution progress - View execution logs - Check execution status - Debug failed executions ### Examples - Get execution details: Retrieves information about a specific task execution. ```yaml id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" ``` ### Parameters - `body: ExecutionRetrieveParams` - `id?: string` ### Returns - `ExecutionRetrieveResponse` - `taskExecution: TaskExecution` - `id: string` - `metadata?: TaskExecutionMetadata` - `completedAt?: string` completed_at is the time the task execution was done. - `createdAt?: string` created_at is the time the task was created. - `creator?: Subject` creator describes the principal who created/started the task run. - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `environmentId?: string` environment_id is the ID of the environment in which the task run is executed. - `startedAt?: string` started_at is the time the task execution actually started to run. - `startedBy?: string` started_by describes the trigger that started the task execution. - `taskId?: string` task_id is the ID of the main task being executed. - `spec?: TaskExecutionSpec` - `desiredPhase?: TaskExecutionPhase` desired_phase is the phase the task execution should be in. Used to stop a running task execution early. - `"TASK_EXECUTION_PHASE_UNSPECIFIED"` - `"TASK_EXECUTION_PHASE_PENDING"` - `"TASK_EXECUTION_PHASE_RUNNING"` - `"TASK_EXECUTION_PHASE_SUCCEEDED"` - `"TASK_EXECUTION_PHASE_FAILED"` - `"TASK_EXECUTION_PHASE_STOPPED"` - `plan?: Array` plan is a list of groups of steps. The steps in a group are executed concurrently, while the groups are executed sequentially. The order of the groups is the order in which they are executed. - `steps?: Array` - `id?: string` ID is the ID of the execution step - `dependsOn?: Array` - `label?: string` - `serviceId?: string` - `task?: Task` - `id?: string` - `spec?: TaskSpec` - `command?: string` command contains the command the task should execute - `env?: Array` env specifies environment variables for the task. - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn` runs_on specifies the environment the task should run on. - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. - `status?: TaskExecutionStatus` - `failureMessage?: string` failure_message summarises why the task execution failed to operate. If this is non-empty the task execution has failed to operate and will likely transition to a failed state. - `logUrl?: string` log_url is the URL to the logs of the task's steps. If this is empty, the task either has no logs or has not yet started. - `phase?: TaskExecutionPhase` the phase of a task execution represents the aggregated phase of all steps. - `statusVersion?: string` version of the status update. Task executions themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. - `steps?: Array` steps provides the status for each individual step of the task execution. If a step is missing it has not yet started. - `id?: string` ID is the ID of the execution step - `failureMessage?: string` failure_message summarises why the step failed to operate. If this is non-empty the step has failed to operate and will likely transition to a failed state. - `output?: Record` output contains the output of the task execution. setting an output field to empty string will unset it. - `phase?: TaskExecutionPhase` phase is the current phase of the execution step ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const execution = await client.environments.automations.tasks.executions.retrieve({ id: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', }); console.log(execution.taskExecution); ``` #### Response ```json { "taskExecution": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "metadata": { "completedAt": "2019-12-27T18:11:19.117Z", "createdAt": "2019-12-27T18:11:19.117Z", "creator": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "principal": "PRINCIPAL_UNSPECIFIED" }, "environmentId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "startedAt": "2019-12-27T18:11:19.117Z", "startedBy": "startedBy", "taskId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" }, "spec": { "desiredPhase": "TASK_EXECUTION_PHASE_UNSPECIFIED", "plan": [ { "steps": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "dependsOn": [ "string" ], "label": "label", "serviceId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "task": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "spec": { "command": "command", "env": [ { "name": "x", "value": "value", "valueFrom": { "secretRef": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } } } ], "runsOn": { "docker": { "environment": [ "string" ], "image": "x" }, "machine": {} } } } } ] } ] }, "status": { "failureMessage": "failureMessage", "logUrl": "logUrl", "phase": "TASK_EXECUTION_PHASE_UNSPECIFIED", "statusVersion": "statusVersion", "steps": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "failureMessage": "failureMessage", "output": { "foo": "string" }, "phase": "TASK_EXECUTION_PHASE_UNSPECIFIED" } ] } } } ``` ## StopTaskExecution `client.environments.automations.tasks.executions.stop(ExecutionStopParamsbody, RequestOptionsoptions?): ExecutionStopResponse` **post** `/gitpod.v1.EnvironmentAutomationService/StopTaskExecution` Stops a running task execution. Use this method to: - Cancel long-running tasks - Stop failed executions - Interrupt task processing ### Examples - Stop execution: Stops a running task execution. ```yaml id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" ``` ### Parameters - `body: ExecutionStopParams` - `id?: string` ### Returns - `ExecutionStopResponse = unknown` ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); const response = await client.environments.automations.tasks.executions.stop({ id: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', }); console.log(response); ``` #### Response ```json {} ``` ## Domain Types ### Execution Retrieve Response - `ExecutionRetrieveResponse` - `taskExecution: TaskExecution` - `id: string` - `metadata?: TaskExecutionMetadata` - `completedAt?: string` completed_at is the time the task execution was done. - `createdAt?: string` created_at is the time the task was created. - `creator?: Subject` creator describes the principal who created/started the task run. - `id?: string` id is the UUID of the subject - `principal?: Principal` Principal is the principal of the subject - `"PRINCIPAL_UNSPECIFIED"` - `"PRINCIPAL_ACCOUNT"` - `"PRINCIPAL_USER"` - `"PRINCIPAL_RUNNER"` - `"PRINCIPAL_ENVIRONMENT"` - `"PRINCIPAL_SERVICE_ACCOUNT"` - `"PRINCIPAL_RUNNER_MANAGER"` - `environmentId?: string` environment_id is the ID of the environment in which the task run is executed. - `startedAt?: string` started_at is the time the task execution actually started to run. - `startedBy?: string` started_by describes the trigger that started the task execution. - `taskId?: string` task_id is the ID of the main task being executed. - `spec?: TaskExecutionSpec` - `desiredPhase?: TaskExecutionPhase` desired_phase is the phase the task execution should be in. Used to stop a running task execution early. - `"TASK_EXECUTION_PHASE_UNSPECIFIED"` - `"TASK_EXECUTION_PHASE_PENDING"` - `"TASK_EXECUTION_PHASE_RUNNING"` - `"TASK_EXECUTION_PHASE_SUCCEEDED"` - `"TASK_EXECUTION_PHASE_FAILED"` - `"TASK_EXECUTION_PHASE_STOPPED"` - `plan?: Array` plan is a list of groups of steps. The steps in a group are executed concurrently, while the groups are executed sequentially. The order of the groups is the order in which they are executed. - `steps?: Array` - `id?: string` ID is the ID of the execution step - `dependsOn?: Array` - `label?: string` - `serviceId?: string` - `task?: Task` - `id?: string` - `spec?: TaskSpec` - `command?: string` command contains the command the task should execute - `env?: Array` env specifies environment variables for the task. - `name?: string` name is the environment variable name. - `value?: string` value is a literal string value. - `valueFrom?: EnvironmentVariableSource` value_from specifies a source for the value. - `secretRef: SecretRef` secret_ref references a secret by ID. - `id?: string` id is the UUID of the secret to reference. - `runsOn?: RunsOn` runs_on specifies the environment the task should run on. - `docker?: Docker` - `environment?: Array` - `image?: string` - `machine?: unknown` Machine runs the service/task directly on the VM/machine level. - `status?: TaskExecutionStatus` - `failureMessage?: string` failure_message summarises why the task execution failed to operate. If this is non-empty the task execution has failed to operate and will likely transition to a failed state. - `logUrl?: string` log_url is the URL to the logs of the task's steps. If this is empty, the task either has no logs or has not yet started. - `phase?: TaskExecutionPhase` the phase of a task execution represents the aggregated phase of all steps. - `statusVersion?: string` version of the status update. Task executions themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don't interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b. - `steps?: Array` steps provides the status for each individual step of the task execution. If a step is missing it has not yet started. - `id?: string` ID is the ID of the execution step - `failureMessage?: string` failure_message summarises why the step failed to operate. If this is non-empty the step has failed to operate and will likely transition to a failed state. - `output?: Record` output contains the output of the task execution. setting an output field to empty string will unset it. - `phase?: TaskExecutionPhase` phase is the current phase of the execution step ### Execution Stop Response - `ExecutionStopResponse = unknown` # Classes ## ListEnvironmentClasses `client.environments.classes.list(ClassListParamsparams, RequestOptionsoptions?): EnvironmentClassesPage` **post** `/gitpod.v1.EnvironmentService/ListEnvironmentClasses` Lists available environment classes with their specifications and resource limits. Use this method to understand what types of environments you can create and their capabilities. Environment classes define the compute resources and features available to your environments. ### Examples - List all available classes: Retrieves a list of all environment classes with their specifications. ```yaml {} ``` buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE ### Parameters - `params: ClassListParams` - `token?: string` Query param - `pageSize?: number` Query param - `filter?: Filter` Body param - `canCreateEnvironments?: boolean | null` can_create_environments filters the response to only environment classes that can be used to create new environments by the caller. Unlike enabled, which indicates general availability, this ensures the caller only sees environment classes they are allowed to use. - `enabled?: boolean | null` enabled filters the response to only enabled or disabled environment classes. If not set, all environment classes are returned. - `runnerIds?: Array` runner_ids filters the response to only EnvironmentClasses of these Runner IDs - `runnerKinds?: Array` runner_kind filters the response to only environment classes from runners of these kinds. - `"RUNNER_KIND_UNSPECIFIED"` - `"RUNNER_KIND_LOCAL"` - `"RUNNER_KIND_REMOTE"` - `"RUNNER_KIND_LOCAL_CONFIGURATION"` - `runnerProviders?: Array` runner_providers filters the response to only environment classes from runners of these providers. - `"RUNNER_PROVIDER_UNSPECIFIED"` - `"RUNNER_PROVIDER_AWS_EC2"` - `"RUNNER_PROVIDER_LINUX_HOST"` - `"RUNNER_PROVIDER_DESKTOP_MAC"` - `"RUNNER_PROVIDER_MANAGED"` - `"RUNNER_PROVIDER_GCP"` - `"RUNNER_PROVIDER_DEV_AGENT"` - `pagination?: Pagination` Body param: pagination contains the pagination options for listing environment classes - `token?: string` Token for the next set of results that was returned as next_token of a PaginationResponse - `pageSize?: number` Page size is the maximum number of results to retrieve per page. Defaults to 25. Maximum 100. ### Returns - `EnvironmentClass` - `id: string` id is the unique identifier of the environment class - `runnerId: string` runner_id is the unique identifier of the runner the environment class belongs to - `configuration?: Array` configuration describes the configuration of the environment class - `key?: string` - `value?: string` - `description?: string` description is a human readable description of the environment class - `displayName?: string` display_name is the human readable name of the environment class - `enabled?: boolean` enabled indicates whether the environment class can be used to create new environments. ### Example ```typescript import Gitpod from '@gitpod/sdk'; const client = new Gitpod({ bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const environmentClass of client.environments.classes.list()) { console.log(environmentClass.id); } ``` #### Response ```json { "environmentClasses": [ { "id": "id", "runnerId": "runnerId", "configuration": [ { "key": "key", "value": "value" } ], "description": "xxx", "displayName": "xxx", "enabled": true } ], "pagination": { "nextToken": "nextToken" } } ```