Updated on 2024-05-23 GMT+08:00

Updating a Planned Task

Function

This API is used to update a planned task of an AS group.

URI

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

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.

scheduled_task_id

Yes

String

Specifies the planned task ID.

Request

Table 2 Request parameters

Parameter

Mandatory

Type

Description

name

No

String

Specifies the planned task name.

scheduled_policy

No

Object

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

instance_number

No

Object

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

Table 3 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 4 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 Request

This example updates the planned task 0h327883-324n-4dzd-9c61-68d03ee191dd by setting the maximum number of instances in the AS group to 10 and the minimum number of instances to 5 at 17:00 every day.

PUT https://{Endpoint}/v1/{project_id}/scaling-groups/xxxxxx/scheduled-tasks/0h327883-324n-4dzd-9c61-68d03ee191dd

{
    "name": "task_01",
    "scheduled_policy": {
        "start_time": "2016-01-08T17:31Z",
        "end_time": "2016-02-08T17:31Z",
        "launch_time": "17:00",
        "recurrence_type": "Daily"
    },
    "instance_number": {
        "max": 10,
        "min": 5
    }
}

Response

None

Example Response

None

Returned Values

  • Normal

    204

  • 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.