Creating a Task
Function
This API is used to create a single task. You can create a real-time migration, synchronization, or DR task based on different request parameters.
Constraints
- This API is available only for synchronization from MySQL to MySQL, migration from Redis to GeminiDB Redis, migration from cluster Redis to GeminiDB Redis, and synchronization from Oracle to GaussDB Distributed.
- This API can be used only in certain regions. For details, see Endpoints.
URI
POST /v5/{project_id}/jobs
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID of a tenant in a region. For details about how to obtain the project ID, see Obtaining a Project ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Content-Type |
Yes |
String |
MIME type of the request body. Use the default value application/json. For APIs used to upload objects or images, the value varies depending on the flow type. The default value is application/json. |
X-Auth-Token |
Yes |
String |
User token obtained from IAM. It is a response to the API for obtaining a user token. This API is the only one that does not require authentication. After a request is processed, the value of X-Subject-Token in the header is the token value. |
X-Language |
No |
String |
Request language type. Default value: en-us Enumerated values:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
job |
Yes |
Object |
Request body for creating a task. For details, see Table 4. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
base_info |
Yes |
Object |
Basic information body for creating a task. For details, see Table 5. |
source_endpoint |
Yes |
Array of objects |
Database information body for creating a task. For details, see Table 7. |
target_endpoint |
Yes |
Array of objects |
Database information body for creating a task. For details, see Table 7. |
period_order |
No |
Object |
Yearly/Monthly information body. For details, see Table 14. |
node_info |
Yes |
Object |
Information body of the DRS instance. For details, see Table 15. |
public_ip_list |
No |
Array of objects |
Information about a specified EIP. For details, see Table 19. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
No |
String |
Task name. The task name can be 4 to 50 characters in length. It is case-insensitive and can contain only letters, digits, hyphens (-), and underscores (_).
|
job_type |
No |
String |
Task scenario. Values:
Enumerated values:
|
multi_write |
No |
Boolean |
Whether the DR type is dual-active. Note:
|
engine_type |
No |
String |
Engine type. Values:
Enumerated values:
|
job_direction |
No |
String |
Migration direction. Values:
Enumerated values:
|
task_type |
No |
String |
Migration type. Values:
Enumerated values:
|
net_type |
No |
String |
Network type. Values:
Enumerated values:
|
charging_mode |
No |
String |
Billing mode. The pay-per-use billing is used by default. Values:
Enumerated values:
|
enterprise_project_id |
No |
String |
Enterprise project ID. The default value is 0, indicating the default enterprise project. Default value: 0 |
description |
No |
String |
Task description. The task description can contain a maximum of 256 characters and cannot contain the following special characters: !<>'&"\ Minimum length: 0 Maximum length: 256 |
start_time |
No |
String |
Scheduled start time of a task. |
expired_days |
No |
String |
Number of days after which an abnormal task automatically stops. The unit is day. The value ranges from 14 to 100. If this parameter is not specified, the default value is 14. Default value: 14 |
tags |
No |
Array of objects |
Tag information. Up to 20 tags can be added. For details, see Table 6. |
is_open_fast_clean |
No |
Boolean |
Specifies whether to enable binlog clearing for RDS for MySQL or RDS for MariaDB. If this parameter is not transferred, the default value false is used, indicating that quick binlog clearing is disabled. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
No |
String |
Tag key. The value can contain a maximum of 36 characters, including letters, digits, underscores (_), and hyphens (-). Minimum length: 1 Maximum length: 36 |
value |
No |
String |
Tag value. The value can contain a maximum of 43 characters, including letters, digits, underscores (_), and hyphens (-). Minimum length: 1 Maximum length: 43 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
db_type |
Yes |
String |
Database type. Values:
Enumerated values:
|
endpoint_type |
Yes |
String |
DB instance type. Values:
Enumerated values:
|
endpoint_role |
Yes |
String |
DB instance role. Values:
Enumerated values:
|
endpoint |
Yes |
Object |
Basic information body of the database. For details, see Table 8. |
cloud |
No |
Object |
Region and project where a DB instance is located. For details, see Table 9. |
vpc |
No |
Object |
Information about the VPC, subnet, and security group where a DB instance resides. This parameter is mandatory when the DB instance type is ECS. For details, see Table 10. |
config |
No |
Object |
Basic information body of database settings. For details, see Table 11. |
ssl |
No |
Object |
Information body of the database SSL certificate. For details, see Table 12. |
customized_dns |
No |
Object |
Custom DNS server. For details, see Table 13. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
id |
No |
String |
Database information ID. |
endpoint_name |
Yes |
String |
Database scenario type. Values:
Enumerated values:
|
ip |
No |
String |
Database IP address. Note:
Example:
|
db_port |
No |
String |
Database port. The value is an integer ranging from 1 to 65535. |
db_user |
Yes |
String |
Database username. |
db_password |
Yes |
String |
Database password. |
instance_id |
No |
String |
ID of a Huawei Cloud DB instance. |
instance_name |
No |
String |
Name of a Huawei Cloud DB instance. |
db_name |
No |
String |
Database name. Example:
|
source_sharding |
No |
Array of objects |
Information about the physical source database. For details, see Table 8. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
region |
Yes |
String |
Region ID. This parameter is mandatory when DB Instance Type is set to ecs (database built on Huawei Cloud ECSs) or cloud (Huawei cloud database). For details, see Regions and Endpoints. Note: If there are subprojects in a region, the region ID is a combination of the regional project ID and subproject ID, which are combined using an underscore (_). |
project_id |
Yes |
String |
Project ID of a tenant in a region. For details about how to obtain the project ID, see Obtaining a Project ID. |
az_code |
No |
String |
Name of the AZ where the database is located. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
vpc_id |
Yes |
String |
ID of the VPC where a DB instance is located. To obtain the ID, perform the following steps: Method 1: Log in to the VPC console and view the VPC ID on the VPC details page. Method 2: Call the API for querying VPCs. For details, see Querying VPCs. |
subnet_id |
Yes |
String |
ID of the subnet where a DB instance is located. To obtain the ID, perform the following steps: Method 1: Log in to the VPC console and click the target subnet on the Subnets page to view the network ID on the displayed page. Method 2: Call the API for querying subnets. For details, see Querying Subnets. |
security_group_id |
No |
String |
ID of the security group where a DB instance is located. To obtain the ID, perform the following steps: Method 1: Log in to the VPC console. Choose Access Control > Security Groups in the navigation pane on the left. On the displayed page, click the target security group. You can view the security group ID on the displayed page. Method 2: Call the API for querying security groups. For details, see Querying Security Groups. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
is_target_readonly |
No |
Boolean |
Whether the destination DB instance is set to read-only. This parameter is available only when job_direction is set to up during MySQL migration and DR. In the DR scenario, this parameter is mandatory and set to true if the current cloud is the standby in single-active DR. If this parameter is not specified, the default value is true. Default value: true |
node_num |
No |
Integer |
Number of subtasks connected to the source cluster Redis instance for data migration from cluster Redis to GeminiDB Redis. The value ranges from 1 to 16 and cannot be greater than the number of shards in the source cluster Redis instance. Set this parameter based on the scale of the source cluster Redis instance. You are advised to set one subtask to connect to four shards in the source cluster Redis instance. Minimum value: 1 Maximum value: 16 Default value: 0 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
ssl_link |
No |
Boolean |
Whether SSL is enabled. If SSL is enabled, the value of this parameter is true. |
ssl_cert_name |
No |
String |
SSL certificate name. |
ssl_cert_key |
No |
String |
SSL certificate content, which is encrypted using Base64. |
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_password |
No |
String |
SSL certificate password. This parameter is mandatory if the certificate file name extension is .p12. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
is_set_dns |
Yes |
Boolean |
Specifies whether to set your own DNS server. |
set_dns_action |
Yes |
String |
Behavior of setting your own DNS server.
Enumerated values:
|
dns_ip |
Yes |
String |
DNS server IP address. Minimum length: 0 Maximum length: 15 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
period_type |
Yes |
Integer |
Subscription period type. Values:
Default value: 3 Enumerated values:
|
period_num |
Yes |
Integer |
Number of subscription periods. This parameter depends on the value of period_type. For example:
|
is_auto_renew |
No |
Integer |
Whether auto renewal is enabled. Values:
Default value: 0 Enumerated values:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
spec |
Yes |
Object |
Information body of DRS instance specifications. For details, see Table 16. |
vpc |
No |
Object |
Information body of DRS instance VPC. This parameter is mandatory for self-built databases. For details, see Table 17. |
base_info |
No |
Object |
Information body of DRS instance VPC. This parameter is mandatory for self-built databases. For details, see Table 18. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
node_type |
Yes |
String |
Specification code. Values:
Enumerated values:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
vpc_id |
Yes |
String |
ID of the VPC where the DRS instance is located. |
subnet_id |
Yes |
String |
ID of the subnet where the DRS instance is located. |
custom_node_ip |
No |
String |
IP address of the DRS instance to be created. Use commas (,) to separate multiple values. Only IPv4 addresses are supported. To obtain the IP address, perform the following steps:
|
security_group_id |
No |
String |
ID of the security group where the DRS instance is located. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
instance_type |
Yes |
String |
DB instance type. The value can be:
Enumerated values:
|
arch |
Yes |
String |
CPU architecture. The value can be:
Enumerated values:
|
availability_zone |
Yes |
String |
AZ ID. If the task instance is not a single instance, you need to specify an AZ for each node of the instance and separate the AZs with commas (,). |
status |
No |
String |
Status. |
role |
No |
String |
Primary/Standby role of a task. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
id |
Yes |
String |
ID of a specified EIP. |
public_ip |
Yes |
String |
EIP. |
type |
Yes |
String |
Type of a task with an EIP bound.
Enumerated values:
|
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
job |
Object |
Response body for creating a task. For details, see Table 21. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Task ID. |
name |
String |
Task name. |
status |
String |
Task status. |
create_time |
String |
Task creation time. |
is_clone_job |
String |
Indicates whether a task is a clone task. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. Minimum length: 12 Maximum length: 12 |
error_msg |
String |
Error message. Minimum length: 1 Maximum length: 512 |
Example Request
- Creating a pay-per-use synchronization task from Oracle to GaussDB distributed, in which task_type is set to FULL_INCR_TRANS and net_type is set to eip
https://{endpoint}/v5/054ba152d480d55b2f5dc0069e7ddef0/jobs { "job" : { "base_info" : { "name" : "DRS-1234", "job_type" : "sync", "engine_type" : "oracle-to-gaussdbv5", "job_direction" : "up", "task_type" : "FULL_INCR_TRANS", "net_type" : "eip", "charging_mode" : "on_demand", "enterprise_project_id" : "0", "description" : "", "expired_days" : "14", "tags" : [ { "key" : "test", "value" : "test" } ] }, "source_endpoint" : [ { "db_type" : "oracle", "endpoint_type" : "offline", "endpoint_role" : "so", "endpoint" : { "endpoint_name" : "oracle", "ip" : "10.154.217.239", "db_port" : "1521", "db_user" : "ORACLE_USER", "db_name" : "serviceName.orcl", "db_password" : "******" }, "ssl" : { "ssl_link" : false } } ], "target_endpoint" : [ { "db_type" : "gaussdbv5", "endpoint_type" : "cloud", "endpoint_role" : "ta", "endpoint" : { "endpoint_name" : "cloud_gaussdbv5", "instance_id" : "c2c7579bc09c490b9d8009db715aeb0ain14", "db_user" : "root", "db_password" : "******" }, "cloud" : { "region" : "cn-north-4", "project_id" : "9dc8c0f3f74c4dbb23c29cf0318ee561", "az_code" : "cn-north-4a,cn-north-4c,cn-north-4g" }, "vpc" : { "vpc_id" : "2cb5d364-ae63-4fbb-85b7-7d59f4a88f8f", "subnet_id" : "2cb54324-ae63-4fbb-85b7-7d59f4a88f8f", "security_group_id" : "039a3s89-665a-43e2-9b4f-bda7d9ee148d" } } ], "node_info" : { "spec" : { "node_type" : "medium" }, "vpc" : { "vpc_id" : "2cb5d364-ae63-4fbb-85b7-7d59f4a88f8f", "subnet_id" : "2cb54324-ae63-4fbb-85b7-7d59f4a88f8f" } } } }
- Creating a pay-per-use real-time synchronization task from Oracle to GaussDB Distributed and specifying an EIP
https://{endpoint}/v5/054ba152d480d55b2f5dc0069e7ddef0/jobs { "job": { "base_info": { "name": "DRS-1234", "job_type": "sync", "engine_type": "oracle-to-gaussdbv5", "job_direction": "up", "task_type": "FULL_INCR_TRANS", "net_type": "eip", "charging_mode": "on_demand", "enterprise_project_id": "0", "description": "", "expired_days": "14", "tags": [ { "key": "test", "value": "test" } ] }, "source_endpoint": [ { "db_type": "oracle", "endpoint_type": "offline", "endpoint_role": "so", "endpoint": { "endpoint_name": "oracle", "ip": "******", "db_port": "1521", "db_user": "ORACLE_USER", "db_name": "serviceName.orcl", "db_password": "******" }, "ssl": { "ssl_link": false } } ], "target_endpoint": [ { "db_type": "gaussdbv5", "endpoint_type": "cloud", "endpoint_role": "ta", "endpoint": { "endpoint_name": "cloud_gaussdbv5", "instance_id": "c2c7579bc09c490b9d8009db715aeb0ain14", "db_user": "root", "db_password": "******" }, "cloud": { "region": "cn-north-4", "project_id": "9dc8c0f3f74c4dbb23c29cf0318ee561", "az_code": "cn-north-4a,cn-north-4c,cn-north-4g" }, "vpc": { "vpc_id": "2cb5d364-ae63-4fbb-85b7-7d59f4a88f8f", "subnet_id": "2cb54324-ae63-4fbb-85b7-7d59f4a88f8f", "security_group_id": "039a3s89-665a-43e2-9b4f-bda7d9ee148d" } } ], "node_info": { "spec": { "node_type": "medium" }, "vpc": { "vpc_id": "2cb5d364-ae63-4fbb-85b7-7d59f4a88f8f", "subnet_id": "2cb54324-ae63-4fbb-85b7-7d59f4a88f8f" } }, "public_ip_list": [ { "id": "018d9e56-26d5-455a-97dc-e6f5f44a2cbd", "public_ip": "******", "type": "master" } ] } }
Example Response
Status code: 200
OK
{ "job" : { "id" : "c7debc9c-8e09-4a5d-8dd6-cc44f78jb20r", "name" : "DRS-1234", "status" : "CREATING", "create_time" : "2022-11-07T16:15:18Z" } }
Status code: 400
Bad Request
{ "error_code" : "DRS.10000001", "error_msg" : "Failed." }
Status Code
Status Code |
Description |
---|---|
200 |
OK |
400 |
Bad Request |
Error Code
For details, see Error Code.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot