Quickstart for Auto Scale#

Rackspace Auto Scale is a service that lets you configure automated scaling of resources in response to an increase or decrease in overall workload based on user-defined policies. You can set up a schedule for launching Auto Scale or define an event that is triggered by Cloud Monitoring. You can also specify a minimum and maximum number of cloud servers, the amount of resources that you want to increase or decrease, and the thresholds in Cloud Monitoring that trigger the scaling activities.

To use Auto Scale, you define a scaling group consisting of cloud servers and cloud load balancers. Then you define policies, either schedule-based or monitoring-based. For monitoring-based policies, you define cloud monitoring alerts to watch the group’s activity, and you define scaling rules to change the scaling group’s configuration in response to alerts. For schedule-based policies, you simply set a schedule. Because you can change a scaling group’s configuration in response to changing workloads, you can begin with a minimal cloud configuration and grow only when the cost of that growth is justified.

Before beginning to work with Auto Scale, you should be familiar with Cloud Servers and Cloud Monitoring.

Concepts#

To use this service effectively, you should understand how these key ideas are used in this context:

capability URL

URL that gives authorization for a certain action or event. If you know the URL, you have access to it and you can use the URL to trigger a specific event. Capability URLs are usually long and random and cannot be guessed by a user.

scaling group

Specifies the basic elements of the Auto Scale configuration. It manages how many servers can participate in the scaling group. It also specifies information related to load balancers if your configuration uses a load balancer. When you create a scaling group, you specify the details for the group configuration and the launch configuration.

scaling policy

Defines the scaling activity that will take place, as well as when and how that scaling activity will take place. You can define a scaling policy to trigger Auto Scale activities through a webhook or based on a schedule. You can specify multiple policies to manage a scaling group.

webhook

Industry-standard protocol for sending events between systems; for Auto Scale, webhoooks are used to execute policies. A webhook consists of an HTTP callback that is triggered by some user-defined event, such as an alarm that is set through Cloud Monitoring or another monitoring service.

Authentication#

To use this service you have to authenticate first. To do this, you will need your Rackspace username and API key. Your username is the one you use to login to the Cloud Control Panel at http://mycloud.rackspace.com/.

To find your API key, use the instructions in View and reset your API key.

You can specify a default region. Here is a list of available regions:

  • DFW (Dallas-Fort Worth, TX, US)

  • HKG (Hong Kong, China)

  • IAD (Blacksburg, VA, US)

  • LON (London, England)

  • SYD (Sydney, Australia)

Some users have access to another region in ORD (Chicago, IL). New users will not have this region.

Once you have these pieces of information, you can pass them into the SDK by replacing {username}, {apiKey}, and {region} with your info:

CloudIdentity cloudIdentity = new CloudIdentity()
{
    APIKey = "{apiKey}",
    Username = "{username}"
};
CloudAutoScaleProvider cloudAutoScaleProvider =
      new CloudAutoScaleProvider(cloudIdentity, "{region}", null);
// Not currently supported by this SDK
// Authentication in jclouds is lazy and happens on the first call to the cloud.
AutoscaleApi autoscaleApi = ContextBuilder.newBuilder("rackspace-autoscale-us")
    .credentials("{username}", "{apiKey}")
    .buildApi(AutoscaleApi.class);
// Not currently supported by this SDK
require 'vendor/autoload.php';

use OpenCloud\Rackspace;

$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
    'username' => '{username}',
    'apiKey'   => '{apiKey}'
));
import pyrax

pyrax.set_setting("identity_type", "rackspace")
pyrax.set_default_region('{region}')
pyrax.set_credentials('{username}', '{apiKey}')

au = pyrax.autoscale
require 'fog'

@client = Fog::Rackspace::AutoScale.new(
  :rackspace_username => '{username}',
  :rackspace_api_key => '{apiKey}',
  :rackspace_region => '{region}'
)
curl -s https://identity.api.rackspacecloud.com/v2.0/tokens -X 'POST' \
  -H "Content-Type: application/json" \
  -d '{
    "auth": {
      "RAX-KSKEY:apiKeyCredentials": {
        "username": "{username}",
        "apiKey": "{apiKey}"
      }
    }
  }' | python -m json.tool

# From the resulting json, set two environment variables: TOKEN and ENDPOINT.

export TOKEN="{tokenId}"
export ENDPOINT="{publicUrl}" # For Auto Scaling service(s)

Use the API#

Some of the basic operations you can perform with this API are described below.

Scaling Groups#

Create an autoscaling group.

FlavorId flavorId =  new FlavorId("{flavor_id}");
ImageId imageId = new ImageId("{image_id}");
string groupName = "{group_name}";
string serverName = "{server_name}";
GroupConfiguration groupConfiguration =
      new GroupConfiguration(
              name: groupName,
              cooldown: TimeSpan.FromSeconds(60),
              minEntities: 0,
              maxEntities: 0,
              metadata: new JObject());
LaunchConfiguration launchConfiguration =
      new ServerLaunchConfiguration(
              new ServerLaunchArguments(
                      new ServerArgument(
                              flavorId,
                              imageId,
                              serverName,
                              null,
                              null)));
PolicyConfiguration[] policyConfigurations = { };
ScalingGroupConfiguration configuration =
      new ScalingGroupConfiguration(
              groupConfiguration,
              launchConfiguration,
              policyConfigurations);
ScalingGroup scalingGroup
      = await cloudAutoScaleProvider.CreateGroupAsync(configuration, CancellationToken.None);
// Not currently supported by this SDK
private static final String PUBLIC_NET = "00000000-0000-0000-0000-000000000000";
private static final String SERVICE_NET = "11111111-1111-1111-1111-111111111111";

GroupApi groupApi = autoscaleApi.getGroupApi("{region}");

GroupConfiguration groupConfig = GroupConfiguration.builder()
        .maxEntities(5)
        .cooldown(2)
        .name("{groupName}")
        .minEntities(0)
        .metadata(ImmutableMap.of("notes", "This is an autoscale group for examples"))
        .build();

LaunchConfiguration launchConfig = LaunchConfiguration.builder()
        .loadBalancers(ImmutableList.of(LoadBalancer.builder().port(8080).id(9099).build()))
        .serverName("{groupName}")
        .serverImageRef("{imageId}")
        .serverFlavorRef("{flavorId}")
        .serverDiskConfig(Server.DISK_CONFIG_AUTO)
        .serverMetadata(ImmutableMap.of("notes", "Server examples notes"))
        .networks(ImmutableList.of(PUBLIC_NET, SERVICE_NET))
              .personalities(ImmutableList.of(
                      Personality.builder()
                              .path("filepath")
                              .contents("VGhpcyBpcyBhIHRlc3QgZmlsZS4=")
                              .build()))
        .type(LaunchConfigurationType.LAUNCH_SERVER)
        .build();

CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
        .cooldown(0)
        .type(ScalingPolicyType.WEBHOOK)
        .name("{groupName}")
        .targetType(ScalingPolicyTargetType.PERCENT_CHANGE)
        .target("1")
        .build();
// Not currently supported by this SDK
$service = $client->autoscaleService(null, '{region}');

$object = (object) array(
   // Config which determines the autoscale group's behaviour
   'groupConfiguration' => (object) array(
      'name'        => 'New autoscale group',
      'minEntities' => 5,
      'maxEntities' => 25,
      'cooldown'    => 60
   ),
   // Specify what's going to launch - in this case a server
   'launchConfiguration' => (object) array(
      'type' => 'launch_server',
      'args' => (object) array(
         // Server properties
         'server' => (object) array(
            'flavorRef' => '{flavorId}',
            'name'      => 'My server name',
            'imageRef'  => '{imageId}'
         ),
         // LB properties
         'loadBalancer' => array(
            (object) array(
               'loadBalancerId' => {loadBalancerId},
               'port'           => 80
            )
         )
      )
   ),
   'scalingPolicies' => array(
      array(
         'name'     => 'scale up by 1',
         'change'   => 1,
         'cooldown' => 60,
         'type'     => 'webhook'
      )
   )
);

$group = $service->group();
$group->create($object);
# After authenticating
au = pyrax.autoscale
networks = [pyrax.cloudnetworks.PUBLIC_NET_ID,
        pyrax.cloudnetworks.SERVICE_NET_ID]
scaling_group = au.create("My Scaling Group", cooldown=60,
                          min_entities=2, max_entities=24,
                          launch_config_type="launch_server",
                          server_name="My Server Name",
                          image_id="{imageId}", flavor_id="{flavorId}",
                          disk_config="MANUAL",
                          metadata={"someKey": "someValue"},
                          personality=[{"contents": "SomeBase64EncodedString",
                                        "path": "/etc/SomeFileName.txt"}],
                          networks=networks,
                          load_balancers=("{loadBalancerId}", 80),
                          key_name="MySSHKeyName")
# A group builder is provided for your convenience.
# For other options please refer to the fog docs

require 'fog/rackspace/models/auto_scale/group_builder'

INTERNET = '00000000-0000-0000-0000-000000000000'
SERVICE_NET = '11111111-1111-1111-1111-111111111111'

attributes = {
  :server_name => "testgroup",
  :image => my_image,
  :flavor => 3,
  :networks => [INTERNET, SERVICE_NET],
  :personality => [
    {
      "path" => "/root/.csivh",
      "contents" => "VGhpcyBpcyBhIHRlc3QgZmlsZS4="
    }
  ],
  :max_entities => 3,
  :min_entities => 2,
  :cooldown => 600,
  :name => "MyScalingGroup",
  :metadata => { "created_by" => "autoscale sample script" },
  :load_balancers => {
     :port =>  80,
     :loadBalancerId => 1234
   }
  :launch_config_type => :launch_server
}

my_group = Fog::Rackspace::AutoScale::GroupBuilder.build(service, attributes)
curl -X POST $ENDPOINT/groups \
  -H "X-Auth-Token: $TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
   "launchConfiguration": {
      "args": {
         "server": {
            "name": "{serverName}",
            "imageRef": "7cf5ffc3-7b20-46fd-98e4-fefa9908d7e8",
            "flavorRef": "{serverFlavor}",
            "OS-DCF:diskConfig": "AUTO"
         }
      },
    "type": "launch_server"
     },
     "groupConfiguration": {
        "maxEntities": {maxServers},
        "cooldown": 360,
        "name": "{scalingGroupName}",
        "minEntities": {minServers}
     },
     "scalingPolicies": [
        {
           "cooldown": 0,
           "name": "{scalingPolicyName}",
           "change": 1,
           "type": "schedule",
           "args": {
              "cron":"23 * * * *"
           }
        }
     ]
  }' | python -m json.tool

List the autoscaling groups you have setup.

ReadOnlyCollectionPage<ScalingGroup> scalingGroups =
      await cloudAutoScaleProvider.ListScalingGroupsAsync(
              null,
              null,
              CancellationToken.None);
// Not currently supported by this SDK
GroupApi groupApi = autoscaleApi.getGroupApi("{region}");

FluentIterable<Group> groups = groupApi.list();
// Not currently supported by this SDK
$groups = $service->groupList();
scaling_groups = au.list()
scaling_groups = service.groups
curl -X GET $ENDPOINT/groups \
  -H "X-Auth-Token: $TOKEN" \
  -H "Accept: application/json" | python -m json.tool

Get details of the scaling group you created.

ScalingGroup scalingGroup =
      await cloudAutoScaleProvider.GetGroupAsync({group_id},CancellationToken.None);
// Not currently supported by this SDK
GroupApi groupApi = autoscaleApi.getGroupApi("{region}");

Group group = groupApi.get("{groupId}");
// Not currently supported by this SDK
$group = $service->group('{groupId}');
# After authenticating
au = pyrax.autoscale
scaling_group = au.get("{scalingGroupId}")
my_group = service.groups.get('{groupId}')
curl -X GET $ENDPOINT/groups/{groupId} \
  -H "X-Auth-Token: $TOKEN" \
  -H "Accept: application/json" | python -m json.tool

Alter the details of the scaling group.

TimeSpan cooldown = TimeSpan.FromSeconds(60);
await cloudAutoScaleProvider.SetGroupConfigurationAsync(
      {group_id},
      new GroupConfiguration(
              "group_name",
              cooldown,
              0,
              0,
              new JObject()),
              CancellationToken.None);
// Not currently supported by this SDK
GroupApi groupApi = autoscaleApi.getGroupApi("{region}");

GroupConfiguration groupConfiguration = GroupConfiguration.builder()
        .maxEntities(25)
        .cooldown(60)
        .name("New name")
        .minEntities(5)
        .metadata(ImmutableMap.of("notes", "This is an autoscale group for examples"))
        .build();

groupApi.updateGroupConfiguration("{groupId}", groupConfiguration);
// Not currently supported by this SDK
// Not currently supported by this SDK
au = pyrax.autoscale
au.update("{scalingGroupId}", name="My Group", cooldown=120,
        min_entities=1, max_entities=25, metadata={"someKey": "someValue"})
group_config = my_group.group_config

group_config.cooldown = 120
group_config.max_entities = 16
group_config.save
$ curl -X PUT $ENDPOINT/groups/{scalingGroupId}/config \
  -H "X-Auth-Token: $TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
     "name": "My Group",
     "cooldown": 120,
     "minEntities": 1,
     "maxEntities": 25
   }' | python -m json.tool

Look into the state of the autoscaling group.

GroupState groupState =
      await cloudAutoScaleProvider.GetGroupStateAsync({group_id}, CancellationToken.None);
// Not currently supported by this SDK
GroupApi groupApi = autoscaleApi.getGroupApi("{region}");

GroupState groupState = groupApi.getState("{scalingGroupId}");
// Not currently supported by this SDK
$state = $group->getState();
# After authenticating
au = pyrax.autoscale
state = au.get_state("{scalingGroupId}")
my_group.state
curl -X GET $ENDPOINT/groups/{groupId}/state \
  -H "X-Auth-Token: $TOKEN" \
  -H "Accept: application/json" | python -m json.tool

Delete the autoscaling group.

await cloudAutoScaleProvider.DeleteGroupAsync(scalingGroup.Id, true, CancellationToken.None);
// Not currently supported by this SDK
GroupApi groupApi = autoscaleApi.getGroupApi("{region}");

groupApi.delete("{groupId}");
// Not currently supported by this SDK
$group->delete();
au.delete("{groupId}")
my_group.destroy
curl -X DELETE $ENDPOINT/groups/{groupId} \
  -H "X-Auth-Token: $TOKEN"

Policies#

To create an autoscale policy that will

  • Add one server

  • Only allow another scaling actions to happen after a 360 second cool down

PolicyConfiguration policyConfiguration =
      PolicyConfiguration.Capacity(
              "Capacity 0 Policy",
              0,
              TimeSpan.FromSeconds(60));
Policy policy =
      await cloudAutoScaleProvider.CreatePolicyAsync(
              {group_id},
              policyConfiguration,
              CancellationToken.None);
// Not currently supported by this SDK
PolicyApi policyApi = autoscaleApi.getPolicyApi("{region}", "{scalingGroupId}");

CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
          .cooldown(360)
          .type(ScalingPolicyType.WEBHOOK)
          .name("{policyName}")
          .targetType(ScalingPolicyTargetType.INCREMENTAL)
          .target("1")
          .build();

FluentIterable<ScalingPolicy> policies = policyApi.create(ImmutableList.of(scalingPolicy));
// Not currently supported by this SDK
$policy = $group->getScalingPolicy();
$policy->create(array(
    array(
    (object) array(
        'name'     => 'My policy',
        'change'   => 1,
        'type'     => 'webhook',
        'cooldown' => 360
    )

));

# After authenticating
au = pyrax.autoscale
au.add_policy("{scalingGroupId}", "My Policy", cooldown=360, change=1,
              is_percent=False)
my_policy = my_group.policies.create :name => 'Scale by one server',
  :cooldown => 360,
  :type => 'webhook',
  :change => 1
curl -X POST $ENDPOINT/groups/{groupId}/policies \
  -H "X-Auth-Token: $TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '[
     {
        "name":"{policyName}",
        "change":1,
        "cooldown":360,
        "type":"webhook"
     }
  ]' | python -m json.tool

To list all autoscaling policies in a region:

ReadOnlyCollectionPage<Policy> policies =
      await cloudAutoScaleProvider.ListPoliciesAsync({group_id}, null, null, CancellationToken.None);
// Not currently supported by this SDK
PolicyApi policyApi = autoscaleApi.getPolicyApi("{region}", "{scalingGroupId}");

FluentIterable<Policy> policies = policyApi.list();
// Not currently supported by this SDK
$policies = $group->getScalingPolicies();
# After authenticating
au = pyrax.autoscale
policies = au.list_policies("{scalingGroupId}")
my_group.policies
curl -X GET $ENDPOINT/groups/{groupId}/policies \
  -H "X-Auth-Token: $TOKEN" \
  -H "Accept: application/json" | python -m json.tool

To inspect details of a specific autoscaling policy:

Policy policy =
      await cloudAutoScaleProvider.GetPolicyAsync({group_id}, {policy_id}, CancellationToken.None);
// Not currently supported by this SDK
PolicyApi policyApi = autoscaleApi.getPolicyApi("{region}", "{scalingGroupId}");

Policy policy = policyApi.get("{policyId}");
// Not currently supported by this SDK
$policy = $group->getScalingPolicy('{policyId}');
# After authenticating
au = pyrax.autoscale
policy = au.get_policy("{scalingGroupId}", "{policyId}")
my_policy = my_group.policies.get '{policyId}'
curl -X GET $ENDPOINT/groups/{groupId}/policies/{policyId} \
  -H "X-Auth-Token: $TOKEN" \
  -H "Accept: application/json" | python -m json.tool

To alter details for a policy:

TimeSpan cooldown = TimeSpan.FromSeconds(60);
int desiredCapacity = 1;
PolicyConfiguration policyConfiguration =
      PolicyConfiguration.Capacity("Capacity 1 Policy", desiredCapacity, cooldown);
await cloudAutoScaleProvider.SetPolicyAsync(
      {group_id},
      {policy_id),
      policyConfiguration,
      CancellationToken.None);
// Not currently supported by this SDK
PolicyApi policyApi = autoscaleApi.getPolicyApi("{region}", "{scalingGroupId}");

CreateScalingPolicy scalingPolicy = CreateScalingPolicy.builder()
          .cooldown(3)
          .type(ScalingPolicyType.WEBHOOK)
          .name("New name")
          .targetType(ScalingPolicyTargetType.INCREMENTAL)
          .target("1")
          .build();

policyApi.update("{policyId}", scalingPolicy);
// Not currently supported by this SDK
$policy->update(array(
    'name'     => 'New name',
    'cooldown' => 120
));
au = pyrax.autoscale
au.update_policy("{scalingGroupId}", "{policyId}", name="My Policy",
        policy_type="webhook", cooldown=120, change=10, is_percent=True,
        desired_capacity=7)
my_policy.cooldown = 60
my_policy.change = 3
my_policy.save
curl -X PUT $ENDPOINT/groups/{scalingGroupId}/policies/{policyId} \
  -H "X-Auth-Token: $TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "change": 10,
    "cooldown": 120,
    "name": "My policy",
    "type": "webhook"
  }' | python -m json.tool

To execute a particular autoscaling policy:

cloudAutoScaleProvider.ExecutePolicyAsync(scalingGroup.Id, policy.Id, CancellationToken.None);
// Not currently supported by this SDK
WebhhookApi webhookApi =
    autoscaleApi.getWebhookApi("{region}", "{groupId}", "{policyId}");

Webhook webhook = webhookApi.get("{webhookId}");
AutoscaleUtils.execute(webhook.getAnonymousExecutionURI().get());
// Not currently supported by this SDK
$policy->execute();
# After authenticating
au = pyrax.autoscale
au.execute_policy("{scalingGroupId}", "{policyId}")
my_policy.execute
curl -X POST $ENDPOINT/groups/{groupId}/policies/{policyId}/execute \
  -H "X-Auth-Token: $TOKEN"

To delete an autoscaling policy:

await cloudAutoScaleProvider.DeletePolicyAsync(scalingGroup.Id, policy.Id, CancellationToken.None);
// Not currently supported by this SDK
PolicyApi policyApi = autoscaleApi.getPolicyApi("{region}", "{scalingGroupId}");

policyApi.delete("{policyId}");
// Not currently supported by this SDK
$policy->delete();
au.delete_policy("{groupId}", "{policyId}")
my_policy.destroy
curl -X DELETE $ENDPOINT/groups/{groupId}/policies/{policyId} \
  -H "X-Auth-Token: $TOKEN"

Webhooks#

To trigger autoscale actions, you can create a webhook:

NewWebhookConfiguration webhookConfiguration = new NewWebhookConfiguration("Test Webhook");
Webhook webhook =
      await cloudAutoScaleProvider.CreateWebhookAsync(
              {scaling_group}.Id,
              {scaling_group}.ScalingPolicies[0].Id,
              webhookConfiguration,
              CancellationToken.None);
// Not currently supported by this SDK
WebhookApi webhookApi =
    autoscaleApi.getWebhookApi("{region}", "{groupId}", "{policyId}");

FluentIterable<Webhook> result = webhookApi.create("{name}", ImmutableMap.<String, Object>of());
// Not currently supported by this SDK
$webook = $policy->getWebhook();
$webhook->create(array(
    (object) array(
        'name'     => 'My webhook',
        'metadata' => array(
            'firstKey'  => 'foo',
            'secondKey' => 'bar'
        )
    )
));
# After authenticating
au = pyrax.autoscale
# Note: the `metadata` parameter is optional.
webhook = au.add_webhook("{scalingGroupId}", "{policyId}",
        name="My Webhook", metadata={"someKey": "someValue"})
my_webhook = my_policy.webhooks.create :name => 'my-webhook'
curl -X POST $ENDPOINT/groups/{groupId}/policies/{policyId}/webhooks \
  -H "X-Auth-Token: $TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '[
    {
      "metadata": {
         "someKey": "someValue"
      },
      "name": "My Webhook"
    }
  ]' | python -m json.tool

To inspect the autoscaling webhook details:

Webhook webhook =
      await cloudAutoScaleProvider.GetWebhookAsync(
              {group_id},
              {policy_id},
              {webhook_id},
              CancellationToken.None);
// Not currently supported by this SDK
WebhookApi webhookApi =
    autoscaleApi.getWebhookApi("{region}", "{groupId}", "{policyId}");

Webhook webhook = webhookApi.get("{webhookId}");
// Not currently supported by this SDK
$webhook = $policy->getWebhook('{webhookId}');
webhook = au.get_webhook("{groupId}", "{policyId}", "{webhookId}")
my_webhook = my_policy.webhooks.get('{webhookId}')
curl -X GET $ENDPOINT/groups/{groupId}/policies/{policyId}/webhooks \
  -H "X-Auth-Token: $TOKEN" \
  -H "Accept: application/json" | python -m json.tool

To list all available autoscaling webhooks in a particular region:

ReadOnlyCollectionPage<Webhook> webhooks =
      await cloudAutoScaleProvider.ListWebhooksAsync(
              {group_id},
              {policy_id},
              null,
              null,
              CancellationToken.None);
// Not currently supported by this SDK
WebhookApi webhookApi =
    autoscaleApi.getWebhookApi("{region}", "{groupId}", "{policyId}");

FluentIterable<Webhook> webhooks = webhookApi.list();
// Not currently supported by this SDK
$webhooks = $policy->getWebhookList();
webhooks = au.list_webhooks("{groupId}", "{policyId}")
my_policy.webhooks
curl -X GET $ENDPOINT/groups/{groupId}/policies/{policyId}/webhooks \
  -H "X-Auth-Token: $TOKEN" \
  -H "Accept: application/json" | python -m json.tool

To alter details about a webhook:

// update the webhook name
string updatedName = "Updated Webhook";
await cloudAutoScaleProvider.UpdateWebhookAsync(
      {group_id},
      {policy_id},
      {webhook_id},
      new UpdateWebhookConfiguration(updatedName),
      CancellationToken.None);
// Not currently supported by this SDK
WebhookApi webhookApi =
  autoscaleApi.getWebhookApi("{region}", "{groupId}", "{policyId}");

webhookApi.update("{webhookId}", "New name", ImmutableMap.<String, Object>of());
// Not currently supported by this SDK
$webhook->update(array(
    'metadata' => array(
        'someKey' => 'someValue'
    )
));
au.update_webhook("{groupId}", "{policyId}", "{webhookId}",
        name="My Webhook", metadata={"someKey": "someValue"})
my_webhook.name = 'webhook1'
my_webhook.metadata = {
    :owner => 'webteam'
}
my_webhook.save
curl -X PUT $ENDPOINT/groups/{groupId}/policies/{policyId}/webhooks/{webhookId} \
  -H "X-Auth-Token: $TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "webhook1",
    "metadata": { "someKey": "someValue" }
  }' | python -m json.tool

To delete a webhook:

await cloudAutoScaleProvider.DeleteWebhookAsync(
      {group_id},
      {policy_id},
      {webhook_id},
      CancellationToken.None);
// Not currently supported by this SDK
WebhookApi webhookApi =
    autoscaleApi.getWebhookApi("{region}", "{groupId}", "{policyId}");

webhookApi.delete("{webhookId}");
// Not currently supported by this SDK
$webhook->delete();
au.delete_webhook("{groupId}", "{policyId}", "{webhookId}")
my_webhook.destroy
curl -X DELETE $ENDPOINT/groups/{groupId}/policies/{policyId}/webhooks/{webhookId} \
  -H "X-Auth-Token: $TOKEN"

More information#

This quickstart is intentionally brief, demonstrating only a few basic operations. To learn more about interacting with Rackspace cloud services, explore the following sites: