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.
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.
id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" metadata: triggeredBy: trigger: - postDevcontainerStart: true - manual: true
UpdateService
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)
}
{}Returns Examples
{}