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

Adding a scheduling task

Function

Add a scheduling task.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    dws:cluster:addOperationalTask

    Write

    cluster *

    • g:ResourceTag/<tag-key>

    • g:EnterpriseProjectId

    dws:operationalTask:operate

    -

URI

POST /v1/{project_id}/clusters/{cluster_id}/operational-tasks

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition:

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Constraints:

None

Range:

None

Default Value:

None

cluster_id

Yes

String

Definition:

Cluster ID For details about how to obtain the cluster ID, see Obtaining the Cluster ID.

Constraints:

None

Range:

None

Default Value:

None

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

task_info

No

TaskInfo object

Definition:

Task information.

Constraints:

None

Range:

The value is not null.

Default Value:

None

Table 3 TaskInfo

Parameter

Mandatory

Type

Description

task_name

No

String

Definition:

Job name.

Constraints:

None

Range:

The value is not null.

Default Value:

None

description

No

String

Definition:

Description about the IPv6 address or CIDR block.

Constraints:

None

Range:

None

Default Value:

None

start_time

No

String

Definition:

Start time.

Constraints:

None

Range:

None

Default Value:

None

end_time

No

String

Definition:

End time.

Constraints:

None

Range:

The value is not null.

Default Value:

None

white_list

No

Array of DateInfo objects

Definition:

Execution plan.

Constraints:

None

Range:

The value is not null.

Default Value:

None

type

No

String

Definition:

Job type

Constraints:

None

Range:

Date: one-off task;

Window: periodic task;

Default Value:

None

vacuum_mode

No

String

Definition:

Task mode

Constraints:

None

Range:

The value is not null.

Default Value:

None

vacuum_target

No

String

Definition

Autovacuum target.

Constraints

N/A

Range

user_vacuumfull: VACUUM FULL for user tables

system_vacuum: VACUUM FULL for system tables

Default Value

N/A

vacuum_threshold

No

String

Definition

Expansion rate, in percentage.

Constraints

N/A

Range

You are advised to set this parameter to the current cluster space usage plus 10%. Do not set it to higher than 80%.

Default Value

N/A

vacuum_retrieving_space

No

String

Definition

Reclaimable space of the target table.

Constraints

N/A

Range

Non-null

Default Value

N/A

vacuum_priority

No

String

Definition:

Priority.

Constraints:

None

Range:

The value is not null.

Default Value:

None

time_zone

No

String

Definition:

Time zone offset information.

Constraints:

None

Range:

-2659~+2459

Default Value:

None

priority

No

Array of TableInfoOpen objects

Definition:

Priority table information.

Default Value:

None

category

No

String

Definition:

Category information.

Default Value:

Vacuum

Table 4 DateInfo

Parameter

Mandatory

Type

Description

date_type

No

String

Definition:

Date type. For example, if the scheduled task is executed on the first day of each month, the value is 1th.

Constraints:

None

Range:

None

Default Value:

None

date_start

No

String

Definition:

Start time, for example, 04:00:00.

Constraints:

None

Range:

None

Default Value:

None

date_end

No

String

Definition:

End time, for example, 08:00:00.

Constraints:

None

Range:

None

Default Value:

None

Table 5 TableInfoOpen

Parameter

Mandatory

Type

Description

database_name

No

String

Definition:

Database name

Default Value:

None

schema_name

No

String

Definition:

Schema name

Default Value:

None

table_name

No

String

Definition:

Table name.

Default Value:

None

Response Parameters

Status code: 200

Request succeeded.

None

Example Requests

Add a one-off task.

post https://{Endpoint}/v1/169439ece752470aa5171633e9d3e47f/clusters/50aee999-9215-4dd0-a142-254ac6bf80e7/operational-tasks

{
  "task_info" : {
    "category" : "VacuumFull",
    "task_name" : "test1",
    "start_time" : 1767211200000,
    "end_time" : 1767225600000,
    "description" : "desc",
    "type" : "Window",
    "white_list" : [ {
      "date_type" : "1th",
      "date_start" : "04:00:00",
      "date_end" : "08:00:00"
    } ],
    "vacuum_mode" : "manual",
    "vacuum_target" : "",
    "vacuum_priority" : [ {
      "db_name" : "postgres",
      "schema_name" : "public",
      "table_name" : "a"
    } ],
    "vacuum_threshold" : "",
    "vacuum_retrieving_space" : ""
  }
}

Example Responses

Status code: 200

{ }

Status Codes

Status Code

Description

200

Request succeeded.

400

Request error.

401

Authentication failed.

403

No operation permissions.

404

No resources found.

500

Internal service error.

503

Service unavailable.