Updated on 2023-11-08 GMT+08:00

Querying Planned Tasks

Function

This API is used to query the planned tasks of an AS group.

URI

GET /autoscaling-api/v1/{project_id}/scaling-groups/{scaling_group_id}/scheduled-tasks

Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

scaling_group_id

Yes

String

Specifies the AS group ID.

limit

No

Integer

Specifies the number of records to query.

marker

No

String

Specifies the marker for pagination query.

Request

None

Example Request

This example queries the planned tasks of an AS group.

GET https://{Endpoint}/v1/{project_id}/scaling-groups/{scaling_group_id}/scheduled-tasks

Response

Table 2 Response parameters

Parameter

Mandatory

Type

Description

page_info

No

Object

Specifies the pagination information. For details, see Table 3.

scheduled_tasks

No

Array of objects

Specifies the list of planned tasks. For details, see Table 4.

Table 3 page_info field description

Parameter

Mandatory

Type

Description

next_marker

No

String

Specifies the marker value of the next page.

Table 4 scheduled_tasks field description

Parameter

Mandatory

Type

Description

task_id

No

String

Specifies the planned task ID.

scaling_group_id

No

String

Specifies the AS group ID.

name

No

String

Specifies the planned task name.

scheduled_policy

No

Object

Specifies the planned task policy. For details, see Table 5.

instance_number

No

Object

Specifies the instance number settings of the AS group. For details, see Table 6.

create_time

No

String

Specified the creation time.

tenant_id

No

String

Specifies the tenant ID.

domain_id

No

String

Specifies the account ID.

update_time

No

String

Specifies the update time.

Table 5 scheduled_policy field description

Parameter

Mandatory

Type

Description

start_time

No

String

Specifies the time when the valid period of the planned task starts. This parameter is valid only when recurrence_type is specified. The format is yyyy-MM-dd'T'HH:mm'Z'. If this parameter is left empty, the time when the task is successfully created is used by default.

end_time

No

String

Specifies the time when the valid period of the planned task ends. This parameter is valid and mandatory only if recurrence_type is specified. The format is yyyy-MM-dd'T'HH:mm'Z'.

launch_time

Yes

String

Specifies the time when the planned task is executed. The UTC time is used. If recurrence_type is left empty or null, the format of the execution time is yyyy-MM-dd'T'HH:mm'Z'. If recurrence_type is specified, the format of the execution time is HH:mm.

recurrence_type

No

String

If this parameter is left blank or null, the planned task is executed at a specified time point. If this parameter is set to DAILY, WEEKLY, or MONTHLY, the planned task is executed periodically by day, week, or month.

recurrence_value

No

String

This parameter is mandatory only if recurrence_type is set to WEEKLY or MONTHLY. Multiple dates are separated by commas (,). When recurrence_type is set to WEEKLY, the value ranges from 1 to 7. If recurrence_type is set to MONTHLY, the value ranges from 1 to 31.

Table 6 instance_number field description

Parameter

Mandatory

Type

Description

max

No

Integer

Specifies the maximum number of instances in the AS group.

min

No

Integer

Specifies the minimum number of instances in the AS group.

desire

No

Integer

Specifies the expected number of instances in the AS group.

Example Response

{
  "page_info": {
    "next_marker": "xxxx"
  },
  "scheduled_tasks": [
    {
      "task_id": "fd7d63ce-8f5c-443e-b9a0-bef9386b23b3",
      "name": "task_01",
      "scheduled_policy": {
        "start_time": "2016-01-0T17:31Z",
        "end_time": "2016-02-08T17:31Z",
        "launch_time": "17:00",
        "recurrence_type": "Daily"
      },
      "scaling_group_id": "e5d27f5c-dd76-4a61-b4bc-a67c5686719a",
      "instance_number": {
        "max": 10
      }
    }
  ]
}

Returned Values

  • Normal

    200

  • Abnormal

    Returned Value

    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. Then, 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 an internal service error occurred.

    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 server has received an invalid response.

    503 Service Unavailable

    Failed to complete the request because the system is currently unavailable.

    504 Gateway Timeout

    A gateway timeout error occurred.

Error Codes

See Error Codes.