Updated on 2023-10-18 GMT+08:00

Obtaining Scheduled Tasks

Function

This API is used to obtain the scheduled tasks. Before calling this API:

URI

GET /v3/{project_id}/scheduled-jobs

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region.

To obtain this value, see Obtaining a Project ID.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

offset

No

String

Index offset. The query starts from the first piece of data. The default value is 0. The value must be a number and cannot be a negative number.

limit

No

String

Number of records to be queried. The default value is 10.

status

No

String

Task execution status.

Value:

  • Running: The task is being executed.
  • Completed: The task is successfully executed.
  • Failed: The task failed to be executed.
  • Pending: The task is not executed.

start_time

No

String

Start time in the "yyyy-mm-ddThh:mm:ssZ" format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, if the time zone offset is one hour, the value of Z is +0100.

NOTE:

The value is empty when the DB instance is being created. After the DB instance is created, the value is not empty.

end_time

No

String

End time in the "yyyy-mm-ddThh:mm:ssZ" format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, if the time zone offset is one hour, the value of Z is +0100.

NOTE:

The value is empty when the DB instance is being created. After the DB instance is created, the value is not empty.

job_id

No

String

Task ID.

job_name

No

String

Task scheduling type.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

If the following response body is returned for calling the API used to obtain a user token, the request is successful.

After the request is processed, the value of X-Subject-Token in the message header is the token value.

X-Language

No

String

Request language type. The default value is en-us.

Value:

  • en-us
  • zh-cn

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

schedules

Array of ScheduleTask objects

Task details.

total_count

Integer

Total number of records.

Table 5 ScheduleTask

Parameter

Type

Description

job_id

String

Task ID.

instance_id

String

Instance ID.

instance_name

String

Instance name.

instance_status

String

Instance status.

Value:

  • createfail: The DB instance fails to be created.
  • creating: The DB instance is being created.
  • normal: The DB instance is normal.
  • abnormal: The DB instance is abnormal.
  • deleted: The DB instance has been deleted.

project_id

String

Project ID of a tenant in a region.

job_name

String

Task name.

Value:

  • CreateGaussDBforMySQLInstance: Creating a DB instance
  • RestoreGaussDBforMySQLNewInstance: Restoring data to a new DB instance
  • AddGaussDBforMySQLNodes: Adding a node
  • DeleteGaussDBforMySQLNode: Deleting a node
  • RebootGaussDBforMySQLInstance: Rebooting a DB instance
  • ModifyGaussDBforMySQLPort: Changing a database port
  • ModifyGaussDBforMySQLSecurityGroup: Changing a security group
  • ResizeGaussDBforMySQLFlavor: Changing instance specifications
  • SwitchoverGaussDBforMySQLMasterNode: Promoting a read replica to the primary node
  • GaussDBforMySQLBindEIP: Binding an EIP
  • GaussDBforMySQLUnbindEIP: Unbinding an EIP
  • RenameGaussDBforMySQLInstance: Changing a DB instance name
  • DeleteGaussDBforMySQLInstance: Deleting a DB instance
  • UpgradeGaussDBforMySQLDatabaseVersion: Upgrading version
  • EnlargeGaussDBforMySQLProxy: Adding nodes for a proxy instance
  • OpenGaussDBforMySQLProxy: Creating a proxy instance
  • CloseGaussDBforMySQLProxy: Deleting a proxy instance
  • GaussdbforMySQLModifyProxyIp: Changing the IP address of a proxy instance
  • ScaleGaussDBforMySQLProxy: Changing the node specifications of a proxy instance
  • GaussDBforMySQLModifyInstanceMetricExtend: Enabling or disabling Monitoring by Seconds
  • GaussDBforMySQLModifyInstanceDataVip: Changing the private IP address
  • GaussDBforMySQLSwitchSSL: Enabling or disabling SSL
  • GaussDBforMySQLModifyProxyConsist: Changing the proxy consistency
  • GaussDBforMySQLModifyProxyWeight: Changing the read weights of nodes

create_time

String

Task creation time in the "yyyy-mm-ddThh:mm:ssZ" format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, if the time zone offset is one hour, the value of Z is +0100.

NOTE:

The value is empty when the DB instance is being created. After the DB instance is created, the value is not empty.

start_time

String

Task start time in the "yyyy-mm-ddThh:mm:ssZ" format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, if the time zone offset is one hour, the value of Z is +0100.

NOTE:

The value is empty when the DB instance is being created. After the DB instance is created, the value is not empty.

end_time

String

Task end time in the "yyyy-mm-ddThh:mm:ssZ" format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, if the time zone offset is one hour, the value of Z is +0100.

NOTE:

The value is empty when the DB instance is being created. After the DB instance is created, the value is not empty.

job_status

String

Task execution status.

Value:

  • Pending: The task is delayed and is not executed.
  • Running: The task is being executed.
  • Completed: The task is successfully executed.
  • Failed: The task failed to be executed.

datastore_type

String

Database type.

target_config

Object

Instance configuration information, such as specifications.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Request

Obtaining scheduled tasks

GET https://{endpoint}/v3/619d3e78f61b4be68bc5aa0b59edcf7b/scheduled-jobs?offset=1&limit=10

Example Response

Status code: 200

Success.

{
  "schedules" : [ {
    "job_id" : "56d3c1138dcf4f1da73b0170700c78d0",
    "instance_id" : "79bc540dd4d6432784894a981fdfacfcin07",
    "instance_name" : "gauss-f821",
    "instance_status" : "BUILD",
    "project_id" : "053f533ead80d5102f0cc012e8d468a4",
    "job_name" : "UpgradeGaussDBforMySQLDatabaseVersion",
    "create_time" : "2018-08-06T10:41:14+0000",
    "start_time" : "2018-08-06T10:41:14+0000",
    "end_time" : "2018-08-06T10:41:14+0000",
    "job_status" : "Completed",
    "datastore_type" : "gaussdb-mysql",
    "target_config" : {
      "flavor" : "gaussdb.mysql.xlarge.arm.4",
      "mem" : "16",
      "cpu" : "4"
    }
  } ],
  "total_count" : 1
}

Status Code

For details, see Status Codes.

Error Code

For details, see Error Codes.