Querying an AS Policy (V2)

Function

This API is used to query details about a specified AS policy by policy ID.

The difference between the V2 and V1 APIs for querying details of an AS policy is that V2 contains scaling resource types in response messages.

URI

GET /autoscaling-api/v2/{project_id}/scaling_policy/{scaling_policy_id}

Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

scaling_policy_id

Yes

String

Specifies the AS policy ID.

Request

None

Example Request

This example queries the details about the AS policy with ID 906f73ff-56e8-41b2-a005-8157d0c60361.

GET https://{Endpoint}/autoscaling-api/v2/{project_id}/scaling_policy/906f73ff-56e8-41b2-a005-8157d0c60361

Response

Table 2 Response parameters

Parameter

Type

Description

scaling_policy

scaling_policy object

Specifies details about the AS policy. For details, see Table 3.

Table 3 scaling_policy field description

Parameter

Type

Description

scaling_resource_id

String

Specifies the scaling resource ID.

scaling_resource_type

String

Specifies the scaling resource type.

  • AS group: SCALING_GROUP
  • Bandwidth: BANDWIDTH

scaling_policy_name

String

Specifies the AS policy name.

Supports fuzzy search.

scaling_policy_id

String

Specifies the AS policy ID.

policy_status

String

Specifies the AS policy status.

  • INSERVICE: The AS policy is enabled.
  • PAUSED: The AS policy is disabled.
  • EXECUTING: The AS policy is being executed.

scaling_policy_type

String

Specifies the AS policy type.

  • ALARM: indicates that the scaling action is triggered by an alarm. A value is returned for alarm_id, and no value is returned for scheduled_policy.
  • SCHEDULED: indicates that the scaling action is triggered as scheduled. A value is returned for scheduled_policy, and no value is returned for alarm_id, recurrence_type, recurrence_value, start_time, or end_time.
  • RECURRENCE: indicates that the scaling action is triggered periodically. Values are returned for scheduled_policy, recurrence_type, recurrence_value, start_time, and end_time, and no value is returned for alarm_id.

alarm_id

String

Specifies the alarm ID.

scheduled_policy

scheduled_policy object

Specifies the periodic or scheduled AS policy. For details, see Table 4.

scaling_policy_action

scaling_policy_action object

Specifies the scaling action of the AS policy. For details, see Table 5.

cool_down_time

Integer

Specifies the cooldown period (s).

create_time

String

Specifies the time when an AS policy was created. The time format complies with UTC.

meta_data

meta_data object

Provides additional information. For details, see Table 6.

description

String

Specifies the AS policy description.

Table 4 scheduled_policy field description

Parameter

Type

Description

launch_time

String

Specifies the time when the scaling action is triggered. The time format complies with UTC.

  • If scaling_policy_type is set to SCHEDULED, the time format is YYYY-MM-DDThh:mmZ.
  • If scaling_policy_type is set to RECURRENCE, the time format is hh:mm.

recurrence_type

String

Specifies the type of a periodically triggered scaling action.

  • Daily: indicates that the scaling action is triggered once a day.
  • Weekly: indicates that the scaling action is triggered once a week.
  • Monthly: indicates that the scaling action is triggered once a month.

recurrence_value

String

Specifies the frequency at which scaling actions are triggered.

  • If recurrence_type is set to Daily, the value is null, indicating that the scaling action is triggered once a day.
  • If recurrence_type is set to Weekly, the value ranges from 1 (Sunday) to 7 (Saturday). The digits refer to dates in each week and separated by a comma, such as 1,3,5.
  • If recurrence_type is set to Monthly, the value ranges from 1 to 31. The digits refer to the dates in each month and separated by a comma, such as 1,10,13,28.

start_time

String

Specifies the start time of the scaling action triggered periodically. The time format complies with UTC.

The time format is YYYY-MM-DDThh:mmZ.

end_time

String

Specifies the end time of the scaling action triggered periodically. The time format complies with UTC.

The time format is YYYY-MM-DDThh:mmZ.

Table 5 scaling_policy_action field description

Parameter

Type

Description

operation

String

Specifies the scaling action.

  • ADD: indicates adding instances.
  • REDUCE: indicates reducing instances.
  • SET: indicates setting the number of instances to a specified value.

size

Integer

Specifies the operation size.

percentage

Integer

Specifies the percentage of instances to be operated.

limits

Integer

Specifies the operation restrictions.

Table 6 meta_data field description

Parameter

Type

Description

metadata_bandwidth_share_type

String

Specifies the bandwidth sharing type in the bandwidth scaling policy.

metadata_eip_id

String

Specifies the EIP ID for the bandwidth in the bandwidth scaling policy.

metadata_eip_address

String

Specifies the EIP for the bandwidth in the bandwidth scaling policy.

Example Response

{
    "scaling_policy": {
           "scaling_policy_id": "906f73ff-56e8-41b2-a005-8157d0c60361",
           "scaling_policy_name": "hth_aspolicy_1",
           "scaling_resource_id": "8ade64b5-d685-40b8-8582-4ce306ea37a6",
           "scaling_resource_type": "BANDWIDTH",
           "scaling_policy_type": "ALARM",
           "alarm_id": "al1513822380493GvlJKZwA8",
           "scheduled_policy": {
           },
           "cool_down_time": 900,
           "scaling_policy_action": {
                  "operation": "ADD",
                  "size": 1,
                  "limits": 111
           },
           "policy_status": "INSERVICE",
           "create_time": "2018-03-21T08:03:35Z",
           "meta_data": {
               "metadata_eip_id": "263f0886-de6a-4e21-ad83-814ca9f3844e",
               "metadata_eip_address": "255.255.255.255"
           }
    }
}

Returned Values

Error Codes

See Error Codes.