CancelPrebuild
client.Prebuilds.Cancel(ctx, body) (*PrebuildCancelResponse, error)
POST/gitpod.v1.PrebuildService/CancelPrebuild
Cancels a running prebuild.
Use this method to:
- Stop prebuilds that are no longer needed
- Free up resources for other operations
Examples
-
Cancel prebuild:
Stops a running prebuild and cleans up resources.
prebuildId: "07e03a28-65a5-4d98-b532-8ea67b188048"
CancelPrebuild
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.Prebuilds.Cancel(context.TODO(), gitpod.PrebuildCancelParams{
PrebuildID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Prebuild)
}
{
"prebuild": {
"metadata": {
"createdAt": "2019-12-27T18:11:19.117Z",
"creator": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"updatedAt": "2019-12-27T18:11:19.117Z",
"environmentClassId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"executor": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"projectId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"triggeredBy": "PREBUILD_TRIGGER_UNSPECIFIED"
},
"spec": {
"desiredPhase": "PREBUILD_PHASE_UNSPECIFIED",
"specVersion": "specVersion",
"timeout": "+9125115.360s"
},
"status": {
"phase": "PREBUILD_PHASE_UNSPECIFIED",
"completionTime": "2019-12-27T18:11:19.117Z",
"environmentId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"failureMessage": "failureMessage",
"logUrl": "https://example.com",
"snapshotCompletionPercentage": 100,
"snapshotSizeBytes": "snapshotSizeBytes",
"statusVersion": "statusVersion",
"warningMessage": "warningMessage"
},
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
}Returns Examples
{
"prebuild": {
"metadata": {
"createdAt": "2019-12-27T18:11:19.117Z",
"creator": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"updatedAt": "2019-12-27T18:11:19.117Z",
"environmentClassId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"executor": {
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"principal": "PRINCIPAL_UNSPECIFIED"
},
"organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"projectId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"triggeredBy": "PREBUILD_TRIGGER_UNSPECIFIED"
},
"spec": {
"desiredPhase": "PREBUILD_PHASE_UNSPECIFIED",
"specVersion": "specVersion",
"timeout": "+9125115.360s"
},
"status": {
"phase": "PREBUILD_PHASE_UNSPECIFIED",
"completionTime": "2019-12-27T18:11:19.117Z",
"environmentId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"failureMessage": "failureMessage",
"logUrl": "https://example.com",
"snapshotCompletionPercentage": 100,
"snapshotSizeBytes": "snapshotSizeBytes",
"statusVersion": "statusVersion",
"warningMessage": "warningMessage"
},
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
}