CreateWarmPool
client.Prebuilds.NewWarmPool(ctx, body) (*PrebuildNewWarmPoolResponse, error)
POST/gitpod.v1.PrebuildService/CreateWarmPool
Creates a warm pool for a project and environment class.
A warm pool maintains pre-created environment instances from a prebuild snapshot so that new environments can start near-instantly.
Only one warm pool is allowed per <project, environment_class> pair. The environment class must have prebuilds enabled on the project.
The pool’s snapshot is managed automatically: when a new prebuild completes for the same project and environment class, the pool’s snapshot is updated and the runner rotates instances.
Examples
-
Create warm pool:
Creates a warm pool with 2 instances for a project and environment class.
projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" desiredSize: 2
CreateWarmPool
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.NewWarmPool(context.TODO(), gitpod.PrebuildNewWarmPoolParams{
EnvironmentClassID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"),
DesiredSize: gitpod.F(int64(2)),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.WarmPool)
}
{
"warmPool": {
"metadata": {
"createdAt": "2019-12-27T18:11:19.117Z",
"updatedAt": "2019-12-27T18:11:19.117Z",
"environmentClassId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"projectId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"runnerId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
},
"spec": {
"desiredPhase": "WARM_POOL_PHASE_UNSPECIFIED",
"desiredSize": 1,
"maxSize": 1,
"minSize": 20,
"snapshotId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"specVersion": "specVersion"
},
"status": {
"phase": "WARM_POOL_PHASE_UNSPECIFIED",
"desiredSize": 0,
"failureMessage": "failureMessage",
"runningInstances": 0,
"statusVersion": "statusVersion",
"stoppedInstances": 0
},
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
}Returns Examples
{
"warmPool": {
"metadata": {
"createdAt": "2019-12-27T18:11:19.117Z",
"updatedAt": "2019-12-27T18:11:19.117Z",
"environmentClassId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"organizationId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"projectId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"runnerId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
},
"spec": {
"desiredPhase": "WARM_POOL_PHASE_UNSPECIFIED",
"desiredSize": 1,
"maxSize": 1,
"minSize": 20,
"snapshotId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"specVersion": "specVersion"
},
"status": {
"phase": "WARM_POOL_PHASE_UNSPECIFIED",
"desiredSize": 0,
"failureMessage": "failureMessage",
"runningInstances": 0,
"statusVersion": "statusVersion",
"stoppedInstances": 0
},
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
}