Modifying Tasks in Batches¶
Function¶
This API is used to modify task names or descriptions in batches and set exception notification.
Constraints¶
After the test of connections to the source and destination databases is successful, you need to call this API. Enter the source and destination database information according to the example. Otherwise, errors may occur in subsequent tasks.
This API can be invoked when the task name, description, or exception notification is modified but the task is not in the stopped or deleted state.
This API is invoked after connections to the source and destination databases are tested. The task must be in CONFIGURATION state. In the dual-active DR scenario, the parent task cannot call the API.
URI¶
PUT /v3/{project_id}/jobs/batch-modification
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Project ID of a tenant in a region |
Request Parameters¶
Parameter | Mandatory | Type | Description |
---|---|---|---|
Content-Type | Yes | String | The content type. The default value is application/json. |
X-Auth-Token | Yes | String | User token obtained from IAM. |
X-Language | No | String | Request language type Default value: en-us Values:
|
Parameter | Mandatory | Type | Description |
---|---|---|---|
jobs | Yes | Array of ModifyJobReq objects | Request body for modifying tasks. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
job_id | Yes | String | Task ID. |
description | No | String | Task description. This parameter is mandatory when you modify the task description. Minimum length: 0 character Maximum length: 256 |
name | No | String | Task name. Set this parameter when you need to change the task name. |
alarm_notify | No | AlarmNotifyInfo object | Set exception notification. |
task_type | No | String | Task mode. Values:
|
source_endpoint | No | Endpoint object | Source database information. This parameter is mandatory for calling the API after the connection test. |
target_endpoint | No | Endpoint object | Destination database information. This parameter is mandatory for calling the API after the connection test. |
node_type | No | String | Node specification type. This parameter is mandatory when this API is invoked to modify a task after the connection test. Default value: high Values:
|
engine_type | No | String | Engine type of a DRS task. This parameter is mandatory when this API is invoked to modify a task after the connection test. Values:
|
net_type | No | String | Network type. This parameter is mandatory after the connection test. Values:
|
store_db_info | No | Boolean | Whether to save the database information. This parameter is mandatory when the API is called after the connection test. |
is_recreate | No | Boolean | Whether the task is a rebuilding task. |
job_direction | No | String | Task direction. Values:
|
is_target_readonly | No | Boolean | Whether the destination DB instance can be read-only. |
replace_definer | No | Boolean | Whether to migrate all Definers to the user. MySQL databases support this setting. This parameter is mandatory when this API is invoked to modify a task after the connection test. Values:
|
tags | No | Array of ResourceTag object | Specifies the tag information. |
db_use_type | No | String | Migration type. Values:
|
Parameter | Mandatory | Type | Description |
---|---|---|---|
delay_time | No | Long | Subscription delay, in seconds.
|
rto_delay | No | Long | Recovery Time Objective (RTO) delay, in seconds.
|
rpo_delay | No | Long | Recovery Point Objective (RPO) delay, in seconds.
|
alarm_to_user | No | Boolean | Whether to notify users of alarms. The default value is false. |
subscriptions | No | Array of SubscriptionInfo objects | Receiving method and message body. Up to two receiving modes and message bodies are supported. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
endpoints | No | Array of strings | List of mobile numbers or email addresses. Use commas (,) to separate multiple mobile numbers or email addresses. Up to 10 mobile numbers or email addresses are supported. |
protocol | No | String | Receiving method. Values:
|
Parameter | Mandatory | Type | Description |
---|---|---|---|
db_type | No | String | Database type. This parameter is mandatory when this API is invoked to modify a task after the connection test. Values:
|
az_code | No | String | Code of the AZ where the database is located. |
region | No | String | Region where the DB instance is located. This parameter is mandatory when the database is a cloud instance, for example, an RDS or GaussDB(for MySQL) instance. In DR scenarios, if job_direction is set to down, this parameter is mandatory in source_endpoint. If job_direction is set to up, this parameter is mandatory in target_endpoint. |
inst_id | No | String | ID of the DB instance. This parameter is mandatory when the database is a cloud instance, for example, an RDS or GaussDB(for MySQL) instance. In DR scenarios, if job_direction is set to down, this parameter is mandatory in source_endpoint. If job_direction is set to up, this parameter is mandatory in target_endpoint. |
vpc_id | No | String | ID of the VPC where the database is located. |
subnet_id | No | String | ID of the subnet where the database is located. |
security_group_id | No | String | ID of the security group to which the database belongs. |
project_id | No | String | The project ID of an RDS or GaussDB(for MySQL) instance. |
db_password | No | String | Database password. |
db_port | No | Integer | Database port. The value is an integer ranging from 1 to 65535. |
db_user | No | String | Database user. |
inst_name | No | String | The name of an RDS or GaussDB(for MySQL) instance. |
ip | No | String | Database IP address. |
mongo_ha_mode | No | String | MongoDB HA mode. |
ssl_cert_password | No | String | SSL certificate password. The certificate file name extension is .p12. |
ssl_cert_check_sum | No | String | The checksum value of the SSL certificate, which is used for backend verification. This parameter is mandatory for secure connection to the source database. |
ssl_cert_key | No | String | SSL certificate content, which is encrypted using Base64. |
ssl_cert_name | No | String | SSL certificate name. |
ssl_link | No | Boolean | Whether SSL is enabled. |
cluster_mode | No | String | For MongoDB 4.0 or later, if the cluster instance cannot obtain the IP address of the sharded node, set cluster_mode in source_endpoint to Sharding4.0+. Default value: Sharding4.0+ Values:
|
Parameter | Mandatory | Type | Description |
---|---|---|---|
key | No | String | Tag key. The value can contain a maximum of 36 characters, including letters, digits, underscores (_), and hyphens (-). Set this parameter when you need to modify a tag. |
value | No | String | Tag value. The value can contain a maximum of 43 characters, including letters, digits, underscores (_), and hyphens (-). Set this parameter when you need to modify a tag. |
Response Parameters¶
Status code: 200
Parameter | Type | Description |
---|---|---|
count | Integer | Total number. |
results | Array of ModifyJobResp objects | List of tasks that are modified in batches. |
Parameter | Type | Description |
---|---|---|
id | String | Task ID. |
status | String | Status Values:
|
error_code | String | Error code, which is optional and indicates the returned information about the failure status. |
error_msg | String | Error message, which is optional and indicates the returned information about the failure status. |
Example Request¶
Example of changing task names in batches:
https://{EndPoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-modification
{ "jobs" : [ { "job_id" : "140b5236-88ad-43c8-811c-1268453jb101", "name" : "testName" } ] }
Request for setting task exception notifications in batches:
https://{Endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-modification
{ "jobs" : [ { "job_id" : "8d0e8e36-a618-490d-8a46-8c61ac9jb502", "alarm_notify" : { "delay_time" : 0, "rto_delay" : 0, "rpo_delay" : 0, "alarm_to_user" : false, "subscriptions" : [ { "protocol" : "sms", "endpoints" : [ "150xxxxxxxx" ] }, { "protocol" : "email", "endpoints" : [ "abc@xxx.com" ] } ] } } ] }
Example of modifying task description in batches:
https://{EndPoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-modification
{ "jobs" : [ { "job_id" : "140b5236-88ad-43c8-811c-1268453jb101", "name" : "testName", "description" : "test description" } ] }
Example of calling the API after the MySQL connection test:
https://{EndPoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-modification
{ "jobs": [{ "job_id": "1fded2ab-ce99-4b0e-9cc9-9ce7e17jb101", "name": "DRS-5646-linxiaolu", "source_endpoint": { "region": "eu-de", "ip": "192.168.0.27", "db_port": "3306", "db_user": "root", "db_password": "********", "ssl_link": false, "db_type": "mysql", "project_id": "054ba152d480d55b2f5dc0069e7ddef0" }, "target_endpoint": { "region": "eu-de", "db_type": "mysql", "db_user": "root", "db_password": "********", "project_id": "054ba152d480d55b2f5dc0069e7ddef0", "inst_id": "3def1ac7f8ab4ae48d7c025339f80414in01" }, "node_type": "high", "engine_type": "mysql", "store_db_info": true, "net_type": "eip", "replace_definer": true }] }
Example of calling the API after the MongoDB connection test:
https://{EndPoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-modification
{ "jobs": [{ "job_id": "741d91cf-67e8-4126-ad0f-32f6cccjb105", "name": "DRS-4513", "source_endpoint": { "region": "eu-de", "ip": "192.168.11.231:8635,192.168.10.12:8635", "db_port": 0, "db_user": "rwuser", "db_password": "********", "ssl_link": false, "db_type": "mongodb", "project_id": "0549a6a31000d4e82fd1c00c3d6f2d76", "db_name": "admin" }, "target_endpoint": { "region": "eu-de", "db_type": "mongodb", "db_user": "rwuser", "db_password": "********", "project_id": "0549a6a31000d4e82fd1c00c3d6f2d76", "inst_id": "3cadd5a0ef724f55ac7fa5bcb5f4fc5fin02" }, "node_type": "high", "engine_type": "mongodb", "net_type": "eip", "store_db_info": true }] }
Example Response¶
Status code: 200
OK
{
"results" : [ {
"id" : "efa2bd29-8780-494f-a2ee-188b003ejb11",
"status" : "success"
} ],
"count" : 1
}
Status Code¶
Status Code | Description |
---|---|
200 | OK |
400 | Bad Request |
Error Code¶
For details, see Error Code.