• Auto Scaling

as
  1. Help Center
  2. Auto Scaling
  3. API Reference
  4. API
  5. AS Policy Execution Logs
  6. Querying AS Policy Execution Logs

Querying AS Policy Execution Logs

Function

This interface is used to query execution records of an AS policy. The results are filtered based on the conditions you input and displayed by page.

URI

GET /autoscaling-api/v1/{project_id}/scaling_policy_execute_log/{scaling_policy_id}{?start_time,end_time,start_number,limit,log_id,scaling_resource_type,scaling_resource_id, execute_type}

NOTE:

You can type the question mark (?) and ampersand (&) at the end of the URI to define multiple search criteria. You can filter all non-mandatory parameters in the parameter description.

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.

log_id

No

String

Specifies the log ID.

scaling_resource_type

No

String

Specifies the scaling resource type.

  • AS group: SCALING_GROUP
  • Bandwidth: BANDWIDTH

scaling_resource_id

No

String

Specifies the scaling resource ID.

execute_type

No

String

Specifies the AS policy execution type.

SCHEDULED: automatically triggered at a specified time point

RECURRENCE: automatically triggered at a specified time period

ALARM: alarm-triggered

MANUAL: manually triggered

start_time

No

String

Specifies the start time for querying scaling action logs. The format of the start time is yyyy-MM-ddThh:mm:ssZ.

end_time

No

String

Specifies the end time for querying scaling action logs. The format of the end time is yyyy-MM-ddThh:mm:ssZ.

start_number

No

Integer

Specifies the start line number. The default value is 0.

limit

No

Integer

Specifies the total number of query records. The default value is 20 and the maximum value is 100.

Request Message

  • Request parameters

    None

  • Example request

    None

Response Message

  • Response parameters
    Table 2 Response parameters

    Parameter

    Type

    Description

    total_number

    Integer

    Specifies the total number of query records.

    start_number

    Integer

    Specifies the start line number.

    limit

    Integer

    Specifies the maximum number of resources to be queried.

    scaling_policy_execute_log

    List data structure

    Specifies the execution logs of an AS policy.

    Table 3 scaling_policy_execute_log field data structure description

    Parameter

    Type

    Description

    status

    String

    Specifies the AS policy execution status.

    SUCCESS: indicates that the AS policy is successfully executed.

    FAIL: indicates that the AS policy failed to be executed.

    EXECUTING: The task is in process.

    failed_reason

    String

    Specifies the AS policy execution failure.

    execute_type

    String

    Specifies the AS policy execution type.

    SCHEDULE: automatically triggered at a specified time point

    RECURRENCE: automatically triggered at a specified time period

    ALARM: alarm-triggered

    MANUAL: manually triggered

    execute_time

    String

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

    id

    String

    Specifies the ID of an AS policy execution log.

    tenant_id

    String

    Specifies the project ID.

    scaling_policy_id

    String

    Specifies the AS policy ID.

    scaling_resource_type

    String

    Specifies the scaling resource type.

    • AS group: SCALING_GROUP
    • Bandwidth: BANDWIDTH

    scaling_resource_id

    String

    Specifies the scaling resource ID.

    old_value

    String

    Specifies the source value.

    desire_value

    String

    Specifies the target value.

    limit_value

    Integer

    Specifies the operation restrictions.

    When scaling_resource_type is set to BANDWIDTH and operation is not SET, this parameter takes effect and the unit is Mbit/s.

    In this case:

    • If operation is set to ADD, this parameter indicates the maximum bandwidth.
    • If operation is set to REDUCE, this parameter indicates the minimum bandwidth.

    type

    String

    Specifies the AS policy execution type.

    ADD: indicates adding instances.

    REMOVE: indicates reducing instances.

    SET: indicates setting the number of instances to a specified value.

    job_records

    List data structure

    Specifies the tasks contained in a scaling action based on an AS policy.

    Table 4 job_records field data structure description

    Parameter

    Type

    Description

    job_name

    String

    Specifies the task name.

    record_type

    String

    Specifies the record type.

    API: API calling type

    MEG: message type

    record_time

    String

    Specifies the record time.

    request

    String

    Specifies the request body. This parameter is valid only if record_type is set to API.

    response

    String

    Specifies the response body. This parameter is valid only if record_type is set to API.

    code

    Integer

    Specifies the returned code. This parameter is valid only if record_type is set to API.

    message

    String

    Specifies the message. This parameter is valid only if record_type is set to MEG.

    job_status

    String

    Specifies the execution status of the task.

    SUCCESS: The task is successfully executed.

    FAIL: The task failed to be executed.

    Table 5 meta_data field data structure description

    Parameter

    Type

    Description

    User-defined field key pair

    String

    Specifies the key and value of the metadata.

  • Example response
    {
     "limit": 10,
     "scaling_policy_execute_log": [{
      "id": "6c0a50f6-1dcc-4734-9008-a000f73a4d2c",
      "status": "SUCCESS",
      "type": "ADD",
      "tenant_id": "5a3563ad5f124b97925c206547cb7319",
      "scaling_resource_type": "BANDWIDTH",
      "scaling_resource_id": "5a49dbcd-8511-4890-81fd-a330b90373d1",
      "scaling_policy_id": "c880d2ac-2a25-4971-a4e3-6ce85c659734",
      "old_value": "5",
      "desire_value": "6",
      "limit_value": "10",
      "execute_time": "2018-07-30T07:46:05Z",
      "execute_type": "MANUAL",
      "job_records": [{
       "response": "{\"bandwidth\":{\"tenant_id\":\"5a3563ad5f124b97925c206547cb7319\",\"size\":5,\"share_type\":\"PER\",\"bandwidth_type\":\"bgp\",\"publicip_info\":[{\"publicip_id\":\"a617fb2b-c059-437b-bbd8-2689a29c565f\",\"ipVersion\":4,\"publicip_type\":\"5_bgp\",\"publicip_address\":\"10.154.112.214\"}],\"name\":\"bandwidth-22e7\",\"charge_mode\":\"bandwidth\",\"id\":\"5a49dbcd-8511-4890-81fd-a330b90373d1\"}}",
       "code": "OK (200) - The request has succeeded",
       "job_name": "QUERY_CURRENT_BANDWIDTH",
       "record_type": "API",
       "record_time": "2018-07-30T07:46:06Z",
       "job_status": "SUCCESS"
      },
      {
       "request": "{\"bandwidth\":{\"size\":6}}",
       "response": "{\"bandwidth\":{\"tenant_id\":\"5a3563ad5f124b97925c206547cb7319\",\"size\":6,\"share_type\":\"PER\",\"bandwidth_type\":\"bgp\",\"publicip_info\":[{\"publicip_id\":\"a617fb2b-c059-437b-bbd8-2689a29c565f\",\"ipVersion\":4,\"publicip_type\":\"5_bgp\",\"publicip_address\":\"10.154.112.214\"}],\"name\":\"bandwidth-22e7\",\"charge_mode\":\"bandwidth\",\"id\":\"5a49dbcd-8511-4890-81fd-a330b90373d1\"}}",
       "code": "OK (200) - The request has succeeded",
       "job_name": "ADJUST_BANDWIDTH",
       "record_type": "API",
       "record_time": "2018-07-30T07:46:07Z",
       "job_status": "SUCCESS"
      }],
      "meta_data": {
       "metadata_eip_id": "a617fb2b-c059-437b-bbd8-2689a29c565f",
       "metadata_eip_address": "10.154.112.214"
      }
     }],
     "total_number": 1,
     "start_number": 0
    }

Returned Values

  • Normal

    200

  • Abnormal

    Returned Values

    Description

    400 Bad Request

    The server failed to process the request.

    401 Unauthorized

    You must enter the username and password to access the requested page.

    403 Forbidden

    You are forbidden to access the requested page.

    404 Not Found

    The server could not find the requested page.

    405 Method Not Allowed

    You are not allowed to use the method specified in the request.

    406 Not Acceptable

    The response generated by the server could not be accepted by the client.

    407 Proxy Authentication Required

    You must use the proxy server for authentication so that the request can be processed.

    408 Request Timeout

    The request timed out.

    409 Conflict

    The request could not be processed due to a conflict.

    500 Internal Server Error

    Failed to complete the request because of an internal service error.

    501 Not Implemented

    Failed to complete the request because the server does not support the requested function.

    502 Bad Gateway

    Failed to complete the request because the request is invalid.

    503 Service Unavailable

    Failed to complete the request because the system is unavailable.

    504 Gateway Timeout

    A gateway timeout error occurred.

Error Codes

See section Error Codes.