UpdateEnvironment
client.environments.update(EnvironmentUpdateParams { environmentId, metadata, spec } body, 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.
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.
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.
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.
UpdateEnvironment
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);{}Returns Examples
{}