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.
id: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
GetTask
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)
}
{
"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"
}
}
}
],
"prebuildRequiresSuccess": true,
"runsOn": {
"docker": {
"environment": [
"string"
],
"image": "x"
},
"machine": {}
}
}
}
}Returns Examples
{
"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"
}
}
}
],
"prebuildRequiresSuccess": true,
"runsOn": {
"docker": {
"environment": [
"string"
],
"image": "x"
},
"machine": {}
}
}
}
}