CreateEnvironmentClass
client.Runners.Configurations.EnvironmentClasses.New(ctx, body) (*RunnerConfigurationEnvironmentClassNewResponse, error)
POST/gitpod.v1.RunnerConfigurationService/CreateEnvironmentClass
Creates a new environment class for a runner.
Use this method to:
- Define compute resources
- Configure environment settings
- Set up runtime options
Examples
-
Create environment class:
Creates a new environment configuration.
runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" displayName: "Large Instance" description: "8 CPU, 16GB RAM" configuration: - key: "cpu" value: "8" - key: "memory" value: "16384"
CreateEnvironmentClass
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"),
)
environmentClass, err := client.Runners.Configurations.EnvironmentClasses.New(context.TODO(), gitpod.RunnerConfigurationEnvironmentClassNewParams{
Configuration: gitpod.F([]shared.FieldValueParam{shared.FieldValueParam{
Key: gitpod.F("cpu"),
Value: gitpod.F("8"),
}, shared.FieldValueParam{
Key: gitpod.F("memory"),
Value: gitpod.F("16384"),
}}),
Description: gitpod.F("8 CPU, 16GB RAM"),
DisplayName: gitpod.F("Large Instance"),
RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", environmentClass.ID)
}
{
"id": "id"
}Returns Examples
{
"id": "id"
}