Create a New Autoscale Pool
client.GPUDroplets.Autoscale.New(ctx, body) (*GPUDropletAutoscaleNewResponse, error)
/v2/droplets/autoscale
To create a new autoscale pool, send a POST request to /v2/droplets/autoscale setting the required attributes.
The response body will contain a JSON object with a key called autoscale_pool containing the standard attributes for the new autoscale pool.
Parameters
Returns
Create a New Autoscale Pool
package main
import (
"context"
"fmt"
"github.com/stainless-sdks/-go"
"github.com/stainless-sdks/-go/option"
)
func main() {
client := gradient.NewClient(
option.WithAccessToken("My Access Token"),
)
autoscale, err := client.GPUDroplets.Autoscale.New(context.TODO(), gradient.GPUDropletAutoscaleNewParams{
Config: gradient.F[gradient.GPUDropletAutoscaleNewParamsConfigUnion](gradient.AutoscalePoolDynamicConfigParam{
MinInstances: gradient.F(int64(1)),
MaxInstances: gradient.F(int64(5)),
TargetCPUUtilization: gradient.F(0.500000),
CooldownMinutes: gradient.F(int64(10)),
}),
DropletTemplate: gradient.F(gradient.AutoscalePoolDropletTemplateParam{
Name: gradient.F("example.com"),
Region: gradient.F(gradient.AutoscalePoolDropletTemplateRegionNyc3),
Size: gradient.F("c-2"),
Image: gradient.F("ubuntu-20-04-x64"),
SSHKeys: gradient.F([]string{"3b:16:e4:bf:8b:00:8b:b8:59:8c:a9:d3:f0:19:fa:45"}),
Ipv6: gradient.F(true),
Tags: gradient.F([]string{"env:prod", "web"}),
UserData: gradient.F("#cloud-config\nruncmd:\n - touch /test.txt\n"),
VpcUuid: gradient.F("760e09ef-dc84-11e8-981e-3cfdfeaae000"),
}),
Name: gradient.F("my-autoscale-pool"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", autoscale.AutoscalePool)
}
{
"autoscale_pool": {
"id": "0d3db13e-a604-4944-9827-7ec2642d32ac",
"name": "test-autoscaler-group-01",
"config": {
"min_instances": 1,
"max_instances": 5,
"target_cpu_utilization": 0.5,
"cooldown_minutes": 10
},
"droplet_template": {
"name": "droplet-name",
"size": "c-2",
"region": "tor1",
"image": "ubuntu-20-04-x64",
"tags": [
"my-tag"
],
"ssh_keys": [
"3b:16:e4:bf:8b:00:8b:b8:59:8c:a9:d3:f0:19:fa:45"
],
"vpc_uuid": "760e09ef-dc84-11e8-981e-3cfdfeaae000",
"with_droplet_agent": true,
"project_id": "746c6152-2fa2-11ed-92d3-27aaa54e4988",
"ipv6": true,
"user_data": "#cloud-config\nruncmd:\n - touch /test.txt\n"
},
"created_at": "2020-11-19T20:27:18Z",
"updated_at": "2020-12-01T00:42:16Z",
"status": "active",
"active_resources_count": 1
}
}Returns Examples
{
"autoscale_pool": {
"id": "0d3db13e-a604-4944-9827-7ec2642d32ac",
"name": "test-autoscaler-group-01",
"config": {
"min_instances": 1,
"max_instances": 5,
"target_cpu_utilization": 0.5,
"cooldown_minutes": 10
},
"droplet_template": {
"name": "droplet-name",
"size": "c-2",
"region": "tor1",
"image": "ubuntu-20-04-x64",
"tags": [
"my-tag"
],
"ssh_keys": [
"3b:16:e4:bf:8b:00:8b:b8:59:8c:a9:d3:f0:19:fa:45"
],
"vpc_uuid": "760e09ef-dc84-11e8-981e-3cfdfeaae000",
"with_droplet_agent": true,
"project_id": "746c6152-2fa2-11ed-92d3-27aaa54e4988",
"ipv6": true,
"user_data": "#cloud-config\nruncmd:\n - touch /test.txt\n"
},
"created_at": "2020-11-19T20:27:18Z",
"updated_at": "2020-12-01T00:42:16Z",
"status": "active",
"active_resources_count": 1
}
}