# Automations ## UpsertAutomationsFile `client.Environments.Automations.Upsert(ctx, body) (*EnvironmentAutomationUpsertResponse, error)` **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 EnvironmentAutomationUpsertParams` - `AutomationsFile param.Field[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. - `EnvironmentID param.Field[string]` ### Returns - `type EnvironmentAutomationUpsertResponse struct{…}` - `UpdatedServiceIDs []string` - `UpdatedTaskIDs []string` ### Example ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) response, err := client.Environments.Automations.Upsert(context.TODO(), gitpod.EnvironmentAutomationUpsertParams{ AutomationsFile: gitpod.F(gitpod.AutomationsFileParam{ Services: gitpod.F(map[string]gitpod.AutomationsFileServiceParam{ "web-server": gitpod.AutomationsFileServiceParam{ Commands: gitpod.F(gitpod.AutomationsFileServicesCommandsParam{ Ready: gitpod.F("curl -s http://localhost:3000"), Start: gitpod.F("npm run dev"), }), Description: gitpod.F("Development web server"), Name: gitpod.F("Web Server"), TriggeredBy: gitpod.F([]gitpod.AutomationsFileServicesTriggeredBy{gitpod.AutomationsFileServicesTriggeredByPostDevcontainerStart}), }, }), Tasks: gitpod.F(map[string]gitpod.AutomationsFileTaskParam{ "build": gitpod.AutomationsFileTaskParam{ Command: gitpod.F("npm run build"), Description: gitpod.F("Builds the project artifacts"), Name: gitpod.F("Build Project"), TriggeredBy: gitpod.F([]gitpod.AutomationsFileTasksTriggeredBy{gitpod.AutomationsFileTasksTriggeredByPostEnvironmentStart}), }, }), }), EnvironmentID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.UpdatedServiceIDs) } ``` #### Response ```json { "updatedServiceIds": [ "string" ], "updatedTaskIds": [ "string" ] } ``` ## Domain Types ### Automations File - `type AutomationsFile struct{…}` 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 map[string, AutomationsFileService]` - `Commands AutomationsFileServicesCommands` - `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 AutomationsFileServicesRole` - `const AutomationsFileServicesRoleEmpty AutomationsFileServicesRole = ""` - `const AutomationsFileServicesRoleDefault AutomationsFileServicesRole = "default"` - `const AutomationsFileServicesRoleEditor AutomationsFileServicesRole = "editor"` - `const AutomationsFileServicesRoleAIAgent AutomationsFileServicesRole = "ai-agent"` - `RunsOn RunsOn` - `Docker RunsOnDocker` - `Environment []string` - `Image string` - `Machine unknown` Machine runs the service/task directly on the VM/machine level. - `TriggeredBy []AutomationsFileServicesTriggeredBy` - `const AutomationsFileServicesTriggeredByManual AutomationsFileServicesTriggeredBy = "manual"` - `const AutomationsFileServicesTriggeredByPostEnvironmentStart AutomationsFileServicesTriggeredBy = "postEnvironmentStart"` - `const AutomationsFileServicesTriggeredByPostDevcontainerStart AutomationsFileServicesTriggeredBy = "postDevcontainerStart"` - `const AutomationsFileServicesTriggeredByPrebuild AutomationsFileServicesTriggeredBy = "prebuild"` - `Tasks map[string, AutomationsFileTask]` - `Command string` - `DependsOn []string` - `Description string` - `Name string` - `RunsOn RunsOn` - `TriggeredBy []AutomationsFileTasksTriggeredBy` - `const AutomationsFileTasksTriggeredByManual AutomationsFileTasksTriggeredBy = "manual"` - `const AutomationsFileTasksTriggeredByPostEnvironmentStart AutomationsFileTasksTriggeredBy = "postEnvironmentStart"` - `const AutomationsFileTasksTriggeredByPostDevcontainerStart AutomationsFileTasksTriggeredBy = "postDevcontainerStart"` - `const AutomationsFileTasksTriggeredByPrebuild AutomationsFileTasksTriggeredBy = "prebuild"` # Services ## CreateService `client.Environments.Automations.Services.New(ctx, body) (*EnvironmentAutomationServiceNewResponse, error)` **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 EnvironmentAutomationServiceNewParams` - `EnvironmentID param.Field[string]` - `Metadata param.Field[ServiceMetadata]` - `Spec param.Field[ServiceSpec]` ### Returns - `type EnvironmentAutomationServiceNewResponse struct{…}` - `Service Service` - `ID string` - `EnvironmentID string` - `Metadata ServiceMetadata` - `CreatedAt Time` 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 - `const PrincipalUnspecified Principal = "PRINCIPAL_UNSPECIFIED"` - `const PrincipalAccount Principal = "PRINCIPAL_ACCOUNT"` - `const PrincipalUser Principal = "PRINCIPAL_USER"` - `const PrincipalRunner Principal = "PRINCIPAL_RUNNER"` - `const PrincipalEnvironment Principal = "PRINCIPAL_ENVIRONMENT"` - `const PrincipalServiceAccount Principal = "PRINCIPAL_SERVICE_ACCOUNT"` - `const PrincipalRunnerManager Principal = "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. - `const ServiceRoleUnspecified ServiceRole = "SERVICE_ROLE_UNSPECIFIED"` - `const ServiceRoleDefault ServiceRole = "SERVICE_ROLE_DEFAULT"` - `const ServiceRoleEditor ServiceRole = "SERVICE_ROLE_EDITOR"` - `const ServiceRoleAIAgent ServiceRole = "SERVICE_ROLE_AI_AGENT"` - `const ServiceRoleSecurityAgent ServiceRole = "SERVICE_ROLE_SECURITY_AGENT"` - `TriggeredBy []AutomationTrigger` triggered_by is a list of trigger that start the service. - `BeforeSnapshot bool` - `Manual bool` - `PostDevcontainerStart bool` - `PostEnvironmentStart bool` - `PostMachineStart bool` - `Prebuild bool` - `Spec ServiceSpec` - `Commands ServiceSpecCommands` 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. - `const ServicePhaseUnspecified ServicePhase = "SERVICE_PHASE_UNSPECIFIED"` - `const ServicePhaseStarting ServicePhase = "SERVICE_PHASE_STARTING"` - `const ServicePhaseRunning ServicePhase = "SERVICE_PHASE_RUNNING"` - `const ServicePhaseStopping ServicePhase = "SERVICE_PHASE_STOPPING"` - `const ServicePhaseStopped ServicePhase = "SERVICE_PHASE_STOPPED"` - `const ServicePhaseFailed ServicePhase = "SERVICE_PHASE_FAILED"` - `const ServicePhaseDeleted ServicePhase = "SERVICE_PHASE_DELETED"` - `Env []EnvironmentVariableItem` 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 RunsOnDocker` - `Environment []string` - `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 map[string, string]` 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 ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" "github.com/gitpod-io/gitpod-sdk-go/shared" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) service, err := client.Environments.Automations.Services.New(context.TODO(), gitpod.EnvironmentAutomationServiceNewParams{ EnvironmentID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"), Metadata: gitpod.F(gitpod.ServiceMetadataParam{ Description: gitpod.F("Runs the development web server"), Name: gitpod.F("Web Server"), Reference: gitpod.F("web-server"), TriggeredBy: gitpod.F([]shared.AutomationTriggerParam{shared.AutomationTriggerParam{ PostDevcontainerStart: gitpod.F(true), }}), }), Spec: gitpod.F(gitpod.ServiceSpecParam{ Commands: gitpod.F(gitpod.ServiceSpecCommandsParam{ Ready: gitpod.F("curl -s http://localhost:3000"), Start: gitpod.F("npm run dev"), }), }), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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(ctx, body) (*EnvironmentAutomationServiceDeleteResponse, error)` **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 EnvironmentAutomationServiceDeleteParams` - `ID param.Field[string]` - `Force param.Field[bool]` ### Returns - `type EnvironmentAutomationServiceDeleteResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) service, err := client.Environments.Automations.Services.Delete(context.TODO(), gitpod.EnvironmentAutomationServiceDeleteParams{ ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", service) } ``` #### Response ```json {} ``` ## ListServices `client.Environments.Automations.Services.List(ctx, params) (*ServicesPage[Service], error)` **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 EnvironmentAutomationServiceListParams` - `Token param.Field[string]` Query param - `PageSize param.Field[int64]` Query param - `Filter param.Field[EnvironmentAutomationServiceListParamsFilter]` Body param: filter contains the filter options for listing services - `EnvironmentIDs []string` environment_ids filters the response to only services of these environments - `References []string` references filters the response to only services with these references - `Roles []ServiceRole` roles filters the response to only services with these roles - `const ServiceRoleUnspecified ServiceRole = "SERVICE_ROLE_UNSPECIFIED"` - `const ServiceRoleDefault ServiceRole = "SERVICE_ROLE_DEFAULT"` - `const ServiceRoleEditor ServiceRole = "SERVICE_ROLE_EDITOR"` - `const ServiceRoleAIAgent ServiceRole = "SERVICE_ROLE_AI_AGENT"` - `const ServiceRoleSecurityAgent ServiceRole = "SERVICE_ROLE_SECURITY_AGENT"` - `ServiceIDs []string` service_ids filters the response to only services with these IDs - `Pagination param.Field[EnvironmentAutomationServiceListParamsPagination]` 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 int64` Page size is the maximum number of results to retrieve per page. Defaults to 25. Maximum 100. ### Returns - `type Service struct{…}` - `ID string` - `EnvironmentID string` - `Metadata ServiceMetadata` - `CreatedAt Time` 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 - `const PrincipalUnspecified Principal = "PRINCIPAL_UNSPECIFIED"` - `const PrincipalAccount Principal = "PRINCIPAL_ACCOUNT"` - `const PrincipalUser Principal = "PRINCIPAL_USER"` - `const PrincipalRunner Principal = "PRINCIPAL_RUNNER"` - `const PrincipalEnvironment Principal = "PRINCIPAL_ENVIRONMENT"` - `const PrincipalServiceAccount Principal = "PRINCIPAL_SERVICE_ACCOUNT"` - `const PrincipalRunnerManager Principal = "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. - `const ServiceRoleUnspecified ServiceRole = "SERVICE_ROLE_UNSPECIFIED"` - `const ServiceRoleDefault ServiceRole = "SERVICE_ROLE_DEFAULT"` - `const ServiceRoleEditor ServiceRole = "SERVICE_ROLE_EDITOR"` - `const ServiceRoleAIAgent ServiceRole = "SERVICE_ROLE_AI_AGENT"` - `const ServiceRoleSecurityAgent ServiceRole = "SERVICE_ROLE_SECURITY_AGENT"` - `TriggeredBy []AutomationTrigger` triggered_by is a list of trigger that start the service. - `BeforeSnapshot bool` - `Manual bool` - `PostDevcontainerStart bool` - `PostEnvironmentStart bool` - `PostMachineStart bool` - `Prebuild bool` - `Spec ServiceSpec` - `Commands ServiceSpecCommands` 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. - `const ServicePhaseUnspecified ServicePhase = "SERVICE_PHASE_UNSPECIFIED"` - `const ServicePhaseStarting ServicePhase = "SERVICE_PHASE_STARTING"` - `const ServicePhaseRunning ServicePhase = "SERVICE_PHASE_RUNNING"` - `const ServicePhaseStopping ServicePhase = "SERVICE_PHASE_STOPPING"` - `const ServicePhaseStopped ServicePhase = "SERVICE_PHASE_STOPPED"` - `const ServicePhaseFailed ServicePhase = "SERVICE_PHASE_FAILED"` - `const ServicePhaseDeleted ServicePhase = "SERVICE_PHASE_DELETED"` - `Env []EnvironmentVariableItem` 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 RunsOnDocker` - `Environment []string` - `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 map[string, string]` 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 ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) page, err := client.Environments.Automations.Services.List(context.TODO(), gitpod.EnvironmentAutomationServiceListParams{ Filter: gitpod.F(gitpod.EnvironmentAutomationServiceListParamsFilter{ References: gitpod.F([]string{"web-server", "database"}), }), Pagination: gitpod.F(gitpod.EnvironmentAutomationServiceListParamsPagination{ PageSize: gitpod.F(int64(20)), }), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### 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.Get(ctx, body) (*EnvironmentAutomationServiceGetResponse, error)` **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 EnvironmentAutomationServiceGetParams` - `ID param.Field[string]` ### Returns - `type EnvironmentAutomationServiceGetResponse struct{…}` - `Service Service` - `ID string` - `EnvironmentID string` - `Metadata ServiceMetadata` - `CreatedAt Time` 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 - `const PrincipalUnspecified Principal = "PRINCIPAL_UNSPECIFIED"` - `const PrincipalAccount Principal = "PRINCIPAL_ACCOUNT"` - `const PrincipalUser Principal = "PRINCIPAL_USER"` - `const PrincipalRunner Principal = "PRINCIPAL_RUNNER"` - `const PrincipalEnvironment Principal = "PRINCIPAL_ENVIRONMENT"` - `const PrincipalServiceAccount Principal = "PRINCIPAL_SERVICE_ACCOUNT"` - `const PrincipalRunnerManager Principal = "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. - `const ServiceRoleUnspecified ServiceRole = "SERVICE_ROLE_UNSPECIFIED"` - `const ServiceRoleDefault ServiceRole = "SERVICE_ROLE_DEFAULT"` - `const ServiceRoleEditor ServiceRole = "SERVICE_ROLE_EDITOR"` - `const ServiceRoleAIAgent ServiceRole = "SERVICE_ROLE_AI_AGENT"` - `const ServiceRoleSecurityAgent ServiceRole = "SERVICE_ROLE_SECURITY_AGENT"` - `TriggeredBy []AutomationTrigger` triggered_by is a list of trigger that start the service. - `BeforeSnapshot bool` - `Manual bool` - `PostDevcontainerStart bool` - `PostEnvironmentStart bool` - `PostMachineStart bool` - `Prebuild bool` - `Spec ServiceSpec` - `Commands ServiceSpecCommands` 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. - `const ServicePhaseUnspecified ServicePhase = "SERVICE_PHASE_UNSPECIFIED"` - `const ServicePhaseStarting ServicePhase = "SERVICE_PHASE_STARTING"` - `const ServicePhaseRunning ServicePhase = "SERVICE_PHASE_RUNNING"` - `const ServicePhaseStopping ServicePhase = "SERVICE_PHASE_STOPPING"` - `const ServicePhaseStopped ServicePhase = "SERVICE_PHASE_STOPPED"` - `const ServicePhaseFailed ServicePhase = "SERVICE_PHASE_FAILED"` - `const ServicePhaseDeleted ServicePhase = "SERVICE_PHASE_DELETED"` - `Env []EnvironmentVariableItem` 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 RunsOnDocker` - `Environment []string` - `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 map[string, string]` 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 ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) service, err := client.Environments.Automations.Services.Get(context.TODO(), gitpod.EnvironmentAutomationServiceGetParams{ ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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(ctx, body) (*EnvironmentAutomationServiceStartResponse, error)` **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 EnvironmentAutomationServiceStartParams` - `ID param.Field[string]` ### Returns - `type EnvironmentAutomationServiceStartResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) response, err := client.Environments.Automations.Services.Start(context.TODO(), gitpod.EnvironmentAutomationServiceStartParams{ ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### Response ```json {} ``` ## StopService `client.Environments.Automations.Services.Stop(ctx, body) (*EnvironmentAutomationServiceStopResponse, error)` **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 EnvironmentAutomationServiceStopParams` - `ID param.Field[string]` ### Returns - `type EnvironmentAutomationServiceStopResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) response, err := client.Environments.Automations.Services.Stop(context.TODO(), gitpod.EnvironmentAutomationServiceStopParams{ ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### Response ```json {} ``` ## UpdateService `client.Environments.Automations.Services.Update(ctx, body) (*EnvironmentAutomationServiceUpdateResponse, error)` **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 EnvironmentAutomationServiceUpdateParams` - `ID param.Field[string]` - `Metadata param.Field[EnvironmentAutomationServiceUpdateParamsMetadata]` - `Description string` - `Name string` - `Role ServiceRole` - `const ServiceRoleUnspecified ServiceRole = "SERVICE_ROLE_UNSPECIFIED"` - `const ServiceRoleDefault ServiceRole = "SERVICE_ROLE_DEFAULT"` - `const ServiceRoleEditor ServiceRole = "SERVICE_ROLE_EDITOR"` - `const ServiceRoleAIAgent ServiceRole = "SERVICE_ROLE_AI_AGENT"` - `const ServiceRoleSecurityAgent ServiceRole = "SERVICE_ROLE_SECURITY_AGENT"` - `TriggeredBy EnvironmentAutomationServiceUpdateParamsMetadataTriggeredBy` - `Trigger []AutomationTrigger` - `BeforeSnapshot bool` - `Manual bool` - `PostDevcontainerStart bool` - `PostEnvironmentStart bool` - `PostMachineStart bool` - `Prebuild bool` - `Spec param.Field[EnvironmentAutomationServiceUpdateParamsSpec]` 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 EnvironmentAutomationServiceUpdateParamsSpecCommands` - `Ready string` - `Start string` - `Stop string` - `Env []EnvironmentVariableItem` - `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` - `Docker RunsOnDocker` - `Environment []string` - `Image string` - `Machine unknown` Machine runs the service/task directly on the VM/machine level. - `Status param.Field[EnvironmentAutomationServiceUpdateParamsStatus]` 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` - `LogURL string` - `Output map[string, string]` setting an output field to empty string will unset it. - `Phase ServicePhase` - `const ServicePhaseUnspecified ServicePhase = "SERVICE_PHASE_UNSPECIFIED"` - `const ServicePhaseStarting ServicePhase = "SERVICE_PHASE_STARTING"` - `const ServicePhaseRunning ServicePhase = "SERVICE_PHASE_RUNNING"` - `const ServicePhaseStopping ServicePhase = "SERVICE_PHASE_STOPPING"` - `const ServicePhaseStopped ServicePhase = "SERVICE_PHASE_STOPPED"` - `const ServicePhaseFailed ServicePhase = "SERVICE_PHASE_FAILED"` - `const ServicePhaseDeleted ServicePhase = "SERVICE_PHASE_DELETED"` - `Session string` ### Returns - `type EnvironmentAutomationServiceUpdateResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) service, err := client.Environments.Automations.Services.Update(context.TODO(), gitpod.EnvironmentAutomationServiceUpdateParams{ ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), Spec: gitpod.F(gitpod.EnvironmentAutomationServiceUpdateParamsSpec{ Commands: gitpod.F(gitpod.EnvironmentAutomationServiceUpdateParamsSpecCommands{ Ready: gitpod.F("curl -s http://localhost:8080"), Start: gitpod.F("npm run start:dev"), }), }), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", service) } ``` #### Response ```json {} ``` ## Domain Types ### Service - `type Service struct{…}` - `ID string` - `EnvironmentID string` - `Metadata ServiceMetadata` - `CreatedAt Time` 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 - `const PrincipalUnspecified Principal = "PRINCIPAL_UNSPECIFIED"` - `const PrincipalAccount Principal = "PRINCIPAL_ACCOUNT"` - `const PrincipalUser Principal = "PRINCIPAL_USER"` - `const PrincipalRunner Principal = "PRINCIPAL_RUNNER"` - `const PrincipalEnvironment Principal = "PRINCIPAL_ENVIRONMENT"` - `const PrincipalServiceAccount Principal = "PRINCIPAL_SERVICE_ACCOUNT"` - `const PrincipalRunnerManager Principal = "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. - `const ServiceRoleUnspecified ServiceRole = "SERVICE_ROLE_UNSPECIFIED"` - `const ServiceRoleDefault ServiceRole = "SERVICE_ROLE_DEFAULT"` - `const ServiceRoleEditor ServiceRole = "SERVICE_ROLE_EDITOR"` - `const ServiceRoleAIAgent ServiceRole = "SERVICE_ROLE_AI_AGENT"` - `const ServiceRoleSecurityAgent ServiceRole = "SERVICE_ROLE_SECURITY_AGENT"` - `TriggeredBy []AutomationTrigger` triggered_by is a list of trigger that start the service. - `BeforeSnapshot bool` - `Manual bool` - `PostDevcontainerStart bool` - `PostEnvironmentStart bool` - `PostMachineStart bool` - `Prebuild bool` - `Spec ServiceSpec` - `Commands ServiceSpecCommands` 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. - `const ServicePhaseUnspecified ServicePhase = "SERVICE_PHASE_UNSPECIFIED"` - `const ServicePhaseStarting ServicePhase = "SERVICE_PHASE_STARTING"` - `const ServicePhaseRunning ServicePhase = "SERVICE_PHASE_RUNNING"` - `const ServicePhaseStopping ServicePhase = "SERVICE_PHASE_STOPPING"` - `const ServicePhaseStopped ServicePhase = "SERVICE_PHASE_STOPPED"` - `const ServicePhaseFailed ServicePhase = "SERVICE_PHASE_FAILED"` - `const ServicePhaseDeleted ServicePhase = "SERVICE_PHASE_DELETED"` - `Env []EnvironmentVariableItem` 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 RunsOnDocker` - `Environment []string` - `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 map[string, string]` 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 - `type ServiceMetadata struct{…}` - `CreatedAt Time` 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 - `const PrincipalUnspecified Principal = "PRINCIPAL_UNSPECIFIED"` - `const PrincipalAccount Principal = "PRINCIPAL_ACCOUNT"` - `const PrincipalUser Principal = "PRINCIPAL_USER"` - `const PrincipalRunner Principal = "PRINCIPAL_RUNNER"` - `const PrincipalEnvironment Principal = "PRINCIPAL_ENVIRONMENT"` - `const PrincipalServiceAccount Principal = "PRINCIPAL_SERVICE_ACCOUNT"` - `const PrincipalRunnerManager Principal = "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. - `const ServiceRoleUnspecified ServiceRole = "SERVICE_ROLE_UNSPECIFIED"` - `const ServiceRoleDefault ServiceRole = "SERVICE_ROLE_DEFAULT"` - `const ServiceRoleEditor ServiceRole = "SERVICE_ROLE_EDITOR"` - `const ServiceRoleAIAgent ServiceRole = "SERVICE_ROLE_AI_AGENT"` - `const ServiceRoleSecurityAgent ServiceRole = "SERVICE_ROLE_SECURITY_AGENT"` - `TriggeredBy []AutomationTrigger` triggered_by is a list of trigger that start the service. - `BeforeSnapshot bool` - `Manual bool` - `PostDevcontainerStart bool` - `PostEnvironmentStart bool` - `PostMachineStart bool` - `Prebuild bool` ### Service Phase - `type ServicePhase string` - `const ServicePhaseUnspecified ServicePhase = "SERVICE_PHASE_UNSPECIFIED"` - `const ServicePhaseStarting ServicePhase = "SERVICE_PHASE_STARTING"` - `const ServicePhaseRunning ServicePhase = "SERVICE_PHASE_RUNNING"` - `const ServicePhaseStopping ServicePhase = "SERVICE_PHASE_STOPPING"` - `const ServicePhaseStopped ServicePhase = "SERVICE_PHASE_STOPPED"` - `const ServicePhaseFailed ServicePhase = "SERVICE_PHASE_FAILED"` - `const ServicePhaseDeleted ServicePhase = "SERVICE_PHASE_DELETED"` ### Service Role - `type ServiceRole string` - `const ServiceRoleUnspecified ServiceRole = "SERVICE_ROLE_UNSPECIFIED"` - `const ServiceRoleDefault ServiceRole = "SERVICE_ROLE_DEFAULT"` - `const ServiceRoleEditor ServiceRole = "SERVICE_ROLE_EDITOR"` - `const ServiceRoleAIAgent ServiceRole = "SERVICE_ROLE_AI_AGENT"` - `const ServiceRoleSecurityAgent ServiceRole = "SERVICE_ROLE_SECURITY_AGENT"` ### Service Spec - `type ServiceSpec struct{…}` - `Commands ServiceSpecCommands` 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. - `const ServicePhaseUnspecified ServicePhase = "SERVICE_PHASE_UNSPECIFIED"` - `const ServicePhaseStarting ServicePhase = "SERVICE_PHASE_STARTING"` - `const ServicePhaseRunning ServicePhase = "SERVICE_PHASE_RUNNING"` - `const ServicePhaseStopping ServicePhase = "SERVICE_PHASE_STOPPING"` - `const ServicePhaseStopped ServicePhase = "SERVICE_PHASE_STOPPED"` - `const ServicePhaseFailed ServicePhase = "SERVICE_PHASE_FAILED"` - `const ServicePhaseDeleted ServicePhase = "SERVICE_PHASE_DELETED"` - `Env []EnvironmentVariableItem` 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 RunsOnDocker` - `Environment []string` - `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 - `type ServiceStatus struct{…}` - `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 map[string, string]` 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. - `const ServicePhaseUnspecified ServicePhase = "SERVICE_PHASE_UNSPECIFIED"` - `const ServicePhaseStarting ServicePhase = "SERVICE_PHASE_STARTING"` - `const ServicePhaseRunning ServicePhase = "SERVICE_PHASE_RUNNING"` - `const ServicePhaseStopping ServicePhase = "SERVICE_PHASE_STOPPING"` - `const ServicePhaseStopped ServicePhase = "SERVICE_PHASE_STOPPED"` - `const ServicePhaseFailed ServicePhase = "SERVICE_PHASE_FAILED"` - `const ServicePhaseDeleted ServicePhase = "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. # Tasks ## CreateTask `client.Environments.Automations.Tasks.New(ctx, body) (*EnvironmentAutomationTaskNewResponse, error)` **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 EnvironmentAutomationTaskNewParams` - `DependsOn param.Field[[]string]` - `EnvironmentID param.Field[string]` - `Metadata param.Field[TaskMetadata]` - `Spec param.Field[TaskSpec]` ### Returns - `type EnvironmentAutomationTaskNewResponse struct{…}` - `Task Task` - `ID string` - `DependsOn []string` dependencies specifies the IDs of the automations this task depends on. - `EnvironmentID string` - `Metadata TaskMetadata` - `CreatedAt Time` 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 - `const PrincipalUnspecified Principal = "PRINCIPAL_UNSPECIFIED"` - `const PrincipalAccount Principal = "PRINCIPAL_ACCOUNT"` - `const PrincipalUser Principal = "PRINCIPAL_USER"` - `const PrincipalRunner Principal = "PRINCIPAL_RUNNER"` - `const PrincipalEnvironment Principal = "PRINCIPAL_ENVIRONMENT"` - `const PrincipalServiceAccount Principal = "PRINCIPAL_SERVICE_ACCOUNT"` - `const PrincipalRunnerManager Principal = "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 []AutomationTrigger` triggered_by is a list of trigger that start the task. - `BeforeSnapshot bool` - `Manual bool` - `PostDevcontainerStart bool` - `PostEnvironmentStart bool` - `PostMachineStart bool` - `Prebuild bool` - `Spec TaskSpec` - `Command string` command contains the command the task should execute - `Env []EnvironmentVariableItem` 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 RunsOnDocker` - `Environment []string` - `Image string` - `Machine unknown` Machine runs the service/task directly on the VM/machine level. ### Example ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" "github.com/gitpod-io/gitpod-sdk-go/shared" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) task, err := client.Environments.Automations.Tasks.New(context.TODO(), gitpod.EnvironmentAutomationTaskNewParams{ EnvironmentID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"), Metadata: gitpod.F(shared.TaskMetadataParam{ Description: gitpod.F("Builds the project artifacts"), Name: gitpod.F("Build Project"), Reference: gitpod.F("build"), TriggeredBy: gitpod.F([]shared.AutomationTriggerParam{shared.AutomationTriggerParam{ PostEnvironmentStart: gitpod.F(true), }}), }), Spec: gitpod.F(shared.TaskSpecParam{ Command: gitpod.F("npm run build"), }), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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(ctx, body) (*EnvironmentAutomationTaskDeleteResponse, error)` **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 EnvironmentAutomationTaskDeleteParams` - `ID param.Field[string]` ### Returns - `type EnvironmentAutomationTaskDeleteResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) task, err := client.Environments.Automations.Tasks.Delete(context.TODO(), gitpod.EnvironmentAutomationTaskDeleteParams{ ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", task) } ``` #### Response ```json {} ``` ## ListTasks `client.Environments.Automations.Tasks.List(ctx, params) (*TasksPage[Task], error)` **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 EnvironmentAutomationTaskListParams` - `Token param.Field[string]` Query param - `PageSize param.Field[int64]` Query param - `Filter param.Field[EnvironmentAutomationTaskListParamsFilter]` Body param: filter contains the filter options for listing tasks - `EnvironmentIDs []string` environment_ids filters the response to only tasks of these environments - `References []string` references filters the response to only services with these references - `TaskIDs []string` task_ids filters the response to only tasks with these IDs - `Pagination param.Field[EnvironmentAutomationTaskListParamsPagination]` 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 int64` Page size is the maximum number of results to retrieve per page. Defaults to 25. Maximum 100. ### Returns - `type Task struct{…}` - `ID string` - `DependsOn []string` dependencies specifies the IDs of the automations this task depends on. - `EnvironmentID string` - `Metadata TaskMetadata` - `CreatedAt Time` 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 - `const PrincipalUnspecified Principal = "PRINCIPAL_UNSPECIFIED"` - `const PrincipalAccount Principal = "PRINCIPAL_ACCOUNT"` - `const PrincipalUser Principal = "PRINCIPAL_USER"` - `const PrincipalRunner Principal = "PRINCIPAL_RUNNER"` - `const PrincipalEnvironment Principal = "PRINCIPAL_ENVIRONMENT"` - `const PrincipalServiceAccount Principal = "PRINCIPAL_SERVICE_ACCOUNT"` - `const PrincipalRunnerManager Principal = "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 []AutomationTrigger` triggered_by is a list of trigger that start the task. - `BeforeSnapshot bool` - `Manual bool` - `PostDevcontainerStart bool` - `PostEnvironmentStart bool` - `PostMachineStart bool` - `Prebuild bool` - `Spec TaskSpec` - `Command string` command contains the command the task should execute - `Env []EnvironmentVariableItem` 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 RunsOnDocker` - `Environment []string` - `Image string` - `Machine unknown` Machine runs the service/task directly on the VM/machine level. ### Example ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) page, err := client.Environments.Automations.Tasks.List(context.TODO(), gitpod.EnvironmentAutomationTaskListParams{ Filter: gitpod.F(gitpod.EnvironmentAutomationTaskListParamsFilter{ References: gitpod.F([]string{"build", "test"}), }), Pagination: gitpod.F(gitpod.EnvironmentAutomationTaskListParamsPagination{ PageSize: gitpod.F(int64(20)), }), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### 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.Get(ctx, body) (*EnvironmentAutomationTaskGetResponse, error)` **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 EnvironmentAutomationTaskGetParams` - `ID param.Field[string]` ### Returns - `type EnvironmentAutomationTaskGetResponse struct{…}` - `Task Task` - `ID string` - `DependsOn []string` dependencies specifies the IDs of the automations this task depends on. - `EnvironmentID string` - `Metadata TaskMetadata` - `CreatedAt Time` 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 - `const PrincipalUnspecified Principal = "PRINCIPAL_UNSPECIFIED"` - `const PrincipalAccount Principal = "PRINCIPAL_ACCOUNT"` - `const PrincipalUser Principal = "PRINCIPAL_USER"` - `const PrincipalRunner Principal = "PRINCIPAL_RUNNER"` - `const PrincipalEnvironment Principal = "PRINCIPAL_ENVIRONMENT"` - `const PrincipalServiceAccount Principal = "PRINCIPAL_SERVICE_ACCOUNT"` - `const PrincipalRunnerManager Principal = "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 []AutomationTrigger` triggered_by is a list of trigger that start the task. - `BeforeSnapshot bool` - `Manual bool` - `PostDevcontainerStart bool` - `PostEnvironmentStart bool` - `PostMachineStart bool` - `Prebuild bool` - `Spec TaskSpec` - `Command string` command contains the command the task should execute - `Env []EnvironmentVariableItem` 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 RunsOnDocker` - `Environment []string` - `Image string` - `Machine unknown` Machine runs the service/task directly on the VM/machine level. ### Example ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) task, err := client.Environments.Automations.Tasks.Get(context.TODO(), gitpod.EnvironmentAutomationTaskGetParams{ ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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(ctx, body) (*EnvironmentAutomationTaskStartResponse, error)` **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 EnvironmentAutomationTaskStartParams` - `ID param.Field[string]` ### Returns - `type EnvironmentAutomationTaskStartResponse struct{…}` - `TaskExecution TaskExecution` - `ID string` - `Metadata TaskExecutionMetadata` - `CompletedAt Time` completed_at is the time the task execution was done. - `CreatedAt Time` 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 - `const PrincipalUnspecified Principal = "PRINCIPAL_UNSPECIFIED"` - `const PrincipalAccount Principal = "PRINCIPAL_ACCOUNT"` - `const PrincipalUser Principal = "PRINCIPAL_USER"` - `const PrincipalRunner Principal = "PRINCIPAL_RUNNER"` - `const PrincipalEnvironment Principal = "PRINCIPAL_ENVIRONMENT"` - `const PrincipalServiceAccount Principal = "PRINCIPAL_SERVICE_ACCOUNT"` - `const PrincipalRunnerManager Principal = "PRINCIPAL_RUNNER_MANAGER"` - `EnvironmentID string` environment_id is the ID of the environment in which the task run is executed. - `StartedAt Time` 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. - `const TaskExecutionPhaseUnspecified TaskExecutionPhase = "TASK_EXECUTION_PHASE_UNSPECIFIED"` - `const TaskExecutionPhasePending TaskExecutionPhase = "TASK_EXECUTION_PHASE_PENDING"` - `const TaskExecutionPhaseRunning TaskExecutionPhase = "TASK_EXECUTION_PHASE_RUNNING"` - `const TaskExecutionPhaseSucceeded TaskExecutionPhase = "TASK_EXECUTION_PHASE_SUCCEEDED"` - `const TaskExecutionPhaseFailed TaskExecutionPhase = "TASK_EXECUTION_PHASE_FAILED"` - `const TaskExecutionPhaseStopped TaskExecutionPhase = "TASK_EXECUTION_PHASE_STOPPED"` - `Plan []TaskExecutionSpecPlan` 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 []TaskExecutionSpecPlanStep` - `ID string` ID is the ID of the execution step - `DependsOn []string` - `Label string` - `ServiceID string` - `Task TaskExecutionSpecPlanStepsTask` - `ID string` - `Spec TaskSpec` - `Command string` command contains the command the task should execute - `Env []EnvironmentVariableItem` 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 RunsOnDocker` - `Environment []string` - `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 []TaskExecutionStatusStep` 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 map[string, string]` 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 ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) response, err := client.Environments.Automations.Tasks.Start(context.TODO(), gitpod.EnvironmentAutomationTaskStartParams{ ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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(ctx, body) (*EnvironmentAutomationTaskUpdateResponse, error)` **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 EnvironmentAutomationTaskUpdateParams` - `ID param.Field[string]` - `DependsOn param.Field[[]string]` dependencies specifies the IDs of the automations this task depends on. - `Metadata param.Field[EnvironmentAutomationTaskUpdateParamsMetadata]` - `Description string` - `Name string` - `TriggeredBy EnvironmentAutomationTaskUpdateParamsMetadataTriggeredBy` - `Trigger []AutomationTrigger` - `BeforeSnapshot bool` - `Manual bool` - `PostDevcontainerStart bool` - `PostEnvironmentStart bool` - `PostMachineStart bool` - `Prebuild bool` - `Spec param.Field[EnvironmentAutomationTaskUpdateParamsSpec]` - `Command string` - `Env []EnvironmentVariableItem` - `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` - `Docker RunsOnDocker` - `Environment []string` - `Image string` - `Machine unknown` Machine runs the service/task directly on the VM/machine level. ### Returns - `type EnvironmentAutomationTaskUpdateResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) task, err := client.Environments.Automations.Tasks.Update(context.TODO(), gitpod.EnvironmentAutomationTaskUpdateParams{ ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), Spec: gitpod.F(gitpod.EnvironmentAutomationTaskUpdateParamsSpec{ Command: gitpod.F("npm run test:coverage"), }), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", task) } ``` #### Response ```json {} ``` # Executions ## ListTaskExecutions `client.Environments.Automations.Tasks.Executions.List(ctx, params) (*TaskExecutionsPage[TaskExecution], error)` **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 EnvironmentAutomationTaskExecutionListParams` - `Token param.Field[string]` Query param - `PageSize param.Field[int64]` Query param - `Filter param.Field[EnvironmentAutomationTaskExecutionListParamsFilter]` Body param: filter contains the filter options for listing task runs - `EnvironmentIDs []string` environment_ids filters the response to only task runs of these environments - `Phases []TaskExecutionPhase` phases filters the response to only task runs in these phases - `const TaskExecutionPhaseUnspecified TaskExecutionPhase = "TASK_EXECUTION_PHASE_UNSPECIFIED"` - `const TaskExecutionPhasePending TaskExecutionPhase = "TASK_EXECUTION_PHASE_PENDING"` - `const TaskExecutionPhaseRunning TaskExecutionPhase = "TASK_EXECUTION_PHASE_RUNNING"` - `const TaskExecutionPhaseSucceeded TaskExecutionPhase = "TASK_EXECUTION_PHASE_SUCCEEDED"` - `const TaskExecutionPhaseFailed TaskExecutionPhase = "TASK_EXECUTION_PHASE_FAILED"` - `const TaskExecutionPhaseStopped TaskExecutionPhase = "TASK_EXECUTION_PHASE_STOPPED"` - `TaskIDs []string` task_ids filters the response to only task runs of these tasks - `TaskReferences []string` task_references filters the response to only task runs with this reference - `Pagination param.Field[EnvironmentAutomationTaskExecutionListParamsPagination]` 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 int64` Page size is the maximum number of results to retrieve per page. Defaults to 25. Maximum 100. ### Returns - `type TaskExecution struct{…}` - `ID string` - `Metadata TaskExecutionMetadata` - `CompletedAt Time` completed_at is the time the task execution was done. - `CreatedAt Time` 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 - `const PrincipalUnspecified Principal = "PRINCIPAL_UNSPECIFIED"` - `const PrincipalAccount Principal = "PRINCIPAL_ACCOUNT"` - `const PrincipalUser Principal = "PRINCIPAL_USER"` - `const PrincipalRunner Principal = "PRINCIPAL_RUNNER"` - `const PrincipalEnvironment Principal = "PRINCIPAL_ENVIRONMENT"` - `const PrincipalServiceAccount Principal = "PRINCIPAL_SERVICE_ACCOUNT"` - `const PrincipalRunnerManager Principal = "PRINCIPAL_RUNNER_MANAGER"` - `EnvironmentID string` environment_id is the ID of the environment in which the task run is executed. - `StartedAt Time` 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. - `const TaskExecutionPhaseUnspecified TaskExecutionPhase = "TASK_EXECUTION_PHASE_UNSPECIFIED"` - `const TaskExecutionPhasePending TaskExecutionPhase = "TASK_EXECUTION_PHASE_PENDING"` - `const TaskExecutionPhaseRunning TaskExecutionPhase = "TASK_EXECUTION_PHASE_RUNNING"` - `const TaskExecutionPhaseSucceeded TaskExecutionPhase = "TASK_EXECUTION_PHASE_SUCCEEDED"` - `const TaskExecutionPhaseFailed TaskExecutionPhase = "TASK_EXECUTION_PHASE_FAILED"` - `const TaskExecutionPhaseStopped TaskExecutionPhase = "TASK_EXECUTION_PHASE_STOPPED"` - `Plan []TaskExecutionSpecPlan` 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 []TaskExecutionSpecPlanStep` - `ID string` ID is the ID of the execution step - `DependsOn []string` - `Label string` - `ServiceID string` - `Task TaskExecutionSpecPlanStepsTask` - `ID string` - `Spec TaskSpec` - `Command string` command contains the command the task should execute - `Env []EnvironmentVariableItem` 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 RunsOnDocker` - `Environment []string` - `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 []TaskExecutionStatusStep` 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 map[string, string]` 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 ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" "github.com/gitpod-io/gitpod-sdk-go/shared" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) page, err := client.Environments.Automations.Tasks.Executions.List(context.TODO(), gitpod.EnvironmentAutomationTaskExecutionListParams{ Filter: gitpod.F(gitpod.EnvironmentAutomationTaskExecutionListParamsFilter{ Phases: gitpod.F([]shared.TaskExecutionPhase{shared.TaskExecutionPhaseRunning, shared.TaskExecutionPhaseFailed}), }), Pagination: gitpod.F(gitpod.EnvironmentAutomationTaskExecutionListParamsPagination{ PageSize: gitpod.F(int64(20)), }), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### 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.Get(ctx, body) (*EnvironmentAutomationTaskExecutionGetResponse, error)` **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 EnvironmentAutomationTaskExecutionGetParams` - `ID param.Field[string]` ### Returns - `type EnvironmentAutomationTaskExecutionGetResponse struct{…}` - `TaskExecution TaskExecution` - `ID string` - `Metadata TaskExecutionMetadata` - `CompletedAt Time` completed_at is the time the task execution was done. - `CreatedAt Time` 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 - `const PrincipalUnspecified Principal = "PRINCIPAL_UNSPECIFIED"` - `const PrincipalAccount Principal = "PRINCIPAL_ACCOUNT"` - `const PrincipalUser Principal = "PRINCIPAL_USER"` - `const PrincipalRunner Principal = "PRINCIPAL_RUNNER"` - `const PrincipalEnvironment Principal = "PRINCIPAL_ENVIRONMENT"` - `const PrincipalServiceAccount Principal = "PRINCIPAL_SERVICE_ACCOUNT"` - `const PrincipalRunnerManager Principal = "PRINCIPAL_RUNNER_MANAGER"` - `EnvironmentID string` environment_id is the ID of the environment in which the task run is executed. - `StartedAt Time` 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. - `const TaskExecutionPhaseUnspecified TaskExecutionPhase = "TASK_EXECUTION_PHASE_UNSPECIFIED"` - `const TaskExecutionPhasePending TaskExecutionPhase = "TASK_EXECUTION_PHASE_PENDING"` - `const TaskExecutionPhaseRunning TaskExecutionPhase = "TASK_EXECUTION_PHASE_RUNNING"` - `const TaskExecutionPhaseSucceeded TaskExecutionPhase = "TASK_EXECUTION_PHASE_SUCCEEDED"` - `const TaskExecutionPhaseFailed TaskExecutionPhase = "TASK_EXECUTION_PHASE_FAILED"` - `const TaskExecutionPhaseStopped TaskExecutionPhase = "TASK_EXECUTION_PHASE_STOPPED"` - `Plan []TaskExecutionSpecPlan` 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 []TaskExecutionSpecPlanStep` - `ID string` ID is the ID of the execution step - `DependsOn []string` - `Label string` - `ServiceID string` - `Task TaskExecutionSpecPlanStepsTask` - `ID string` - `Spec TaskSpec` - `Command string` command contains the command the task should execute - `Env []EnvironmentVariableItem` 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 RunsOnDocker` - `Environment []string` - `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 []TaskExecutionStatusStep` 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 map[string, string]` 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 ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) execution, err := client.Environments.Automations.Tasks.Executions.Get(context.TODO(), gitpod.EnvironmentAutomationTaskExecutionGetParams{ ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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(ctx, body) (*EnvironmentAutomationTaskExecutionStopResponse, error)` **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 EnvironmentAutomationTaskExecutionStopParams` - `ID param.Field[string]` ### Returns - `type EnvironmentAutomationTaskExecutionStopResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) response, err := client.Environments.Automations.Tasks.Executions.Stop(context.TODO(), gitpod.EnvironmentAutomationTaskExecutionStopParams{ ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### Response ```json {} ```