Help Center> Data Replication Service> API Reference> APIs V5.0 (in OBT)> Task Operations> Performing Operations on a Task with a Specified ID
Updated on 2024-07-11 GMT+08:00

Performing Operations on a Task with a Specified ID

Function

This API is used to perform operations on a task with a specified ID.

Constraints

  • This API can be used only in certain regions. For details, see Endpoints.

URI

POST /v5/{project_id}/jobs/{job_id}/action

Table 1 Path parameters

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.

job_id

Yes

String

Task ID. (In the multi-task scenario, this parameter is set to the value of master_job_id returned by the parent task details.)

Request Parameters

Table 2 Request header 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:

  • en-us
  • zh-cn
Table 3 Request body parameters

Parameter

Mandatory

Type

Description

job

Yes

Object

Operation on a single task.

For details, see Table 4.

Table 4 Data structure description of field job

Parameter

Mandatory

Type

Description

job_id

No

String

Task ID. (In the multi-task scenario, this parameter is set to the value of master_job_id returned by the parent task details.)

action_name

Yes

String

Name of an operation. Values:

  • network: indicates the operation for testing the connection to the source or destination database.
  • precheck: indicates the operation for performing a precheck.
  • start: indicates the operation for starting a task.
  • stop: indicates the operation for pausing a task.
  • restart: indicates the operation for resuming a task.
  • reset: indicates the operation for resetting a task. The API for performing a pre-check must be called first and the pre-check success rate must be 100%.
  • skip_precheck: indicates the operation for skipping the precheck.
  • create_compare: indicates the operation for creating a comparison task.
  • cancel_compare: indicates the operation for canceling a comparison task.
  • column_limit: indicates the operation for filtering fields.
  • reload_parameters: indicates the operation for reloading task parameters.
  • bind_eip: indicates operation for binding an EIP.
  • unbind_eip: indicates the operation for unbinding an EIP.
  • set_writable: indicates the operation for disabling read-only for the destination database.
  • cloud_connection: indicates the operation for testing the connectivity of workload replay from other clouds.
  • set_readonly: indicates the operation for setting read-only for the destination database of a DR task.

Enumerated values:

  • network
  • precheck
  • start
  • stop
  • restart
  • reset
  • skip_precheck
  • create_compare
  • cancel_compare
  • column_limit
  • reload_parameters
  • bind_eip
  • unbind_eip
  • set_writable
  • cloud_connection
  • set_readonly

action_params

No

Object

Parameter of an operation.

For details, see Table 5.

Table 5 Data structure description of field action_params

Parameter

Mandatory

Type

Description

endpoints

No

Array of objects

Database information.

For details, see Table 6.

precheck_mode

No

String

Pre-check mode. This parameter is mandatory during pre-check. The values are as follows:

  • forStartJob: pre-check before starting a task.
  • forRetryJob: pre-check before editing a task.
  • forResetJob: pre-check before resetting a task.

skip_precheck_info

No

Object

Parameter for skipped pre-check items. This parameter is mandatory when pre-check items are skipped.

For details, see Table 13.

pause_mode

No

String

Task pause mode. Set this parameter when a task is paused. To stop capturing logs of the source database, set the parameter to all.

Default value: target.

start_time

No

String

Scheduled start time of a task.

compare_task_param

No

Object

Information body for performing operations on a comparison task. This parameter is mandatory when you perform operations on a comparison task.

For details, see Table 14.

is_sync_re_edit

No

Boolean

When you resume a task after editing it, set this parameter to true and action_name to restart.

force_delete

No

Boolean

When a task is forcibly stopped, set this parameter to true.

public_ip_config

No

Object

Public IP address of a tenant.

For details, see Table 28.

replay_config

No

Object

Workload replay parameter information.

For details, see Table 20.

Table 6 Data structure description of field endpoints

Parameter

Mandatory

Type

Description

db_type

Yes

String

Database type. The value can be:

  • oracle: Oracle.
  • gaussdbv5: GaussDB distributed.
  • redis: Redis.
  • rediscluster: Cluster Redis.
  • gaussredis: GeminiDB Redis.

Enumerated values:

  • oracle
  • gaussdbv5
  • redis
  • rediscluster
  • gaussredis

endpoint_type

Yes

String

DB instance type. Values:

  • offline: indicates an on-premises database.
  • ecs: indicates a database built on Huawei Cloud ECSs.
  • cloud: indicates a Huawei cloud database.

Enumerated values:

  • offline
  • ecs
  • cloud

endpoint_role

Yes

String

DB instance role. Values:

  • so: indicates the source database.
  • ta: indicates the destination database.

Enumerated values:

  • so
  • ta

endpoint

Yes

Object

Basic information body of the database.

For details, see Table 7.

cloud

No

Object

Region and project where a DB instance is located.

For details, see Table 8.

vpc

No

Object

Information about the VPC, subnet, and security group where a DB instance resides.

For details, see Table 9.

config

No

Object

Basic information body of database settings.

For details, see Table 10.

ssl

No

Object

Information body of the database SSL certificate.

For details, see Table 11.

customized_dns

No

Object

Custom DNS server.

For details, see Table 12.

Table 7 Data structure description of fields endpoint and source_sharding

Parameter

Mandatory

Type

Description

id

No

String

Database information ID.

endpoint_name

Yes

String

Database scenario type. The value can be:

  • oracle: indicates the on-premises Oracle database.
  • ecs_oracle: indicates the Oracle database built on Huawei Cloud ECSs.
  • cloud_gaussdbv5: indicates the Huawei Cloud distributed GaussDB database.
  • mysql: indicates the MySQL database built on other clouds or on-premises MySQL database.
  • ecs_mysql: indicates the MySQL database built on Huawei Cloud ECSs.
  • cloud_mysql: indicates the Huawei Cloud RDS for MySQL database.
  • redis: On-premises Redis database.
  • ecs_redis: Redis database built on Huawei Cloud ECSs.
  • rediscluster: On-premises cluster Redis database.
  • ecs_rediscluster: Cluster Redis database built on Huawei Cloud ECSs.
  • cloud_gaussdb_redis: Huawei Cloud GeminiDB Redis.

Enumerated values:

  • oracle
  • ecs_oracle
  • cloud_gaussdbv5
  • mysql
  • ecs_mysql
  • cloud_mysql
  • redis
  • ecs_redis
  • rediscluster
  • ecs_rediscluster
  • cloud_gaussdb_redis

ip

No

String

Database IP address. Constraints:

  • If an on-premises MongoDB database is used, use colons (:) to separate the database IP address and port number, and use commas (,) to separate multiple values. A maximum of three IP addresses or domain names can be entered.
  • If a DDS instance is used, use colons (:) to separate the database IP address and port number, and use commas (,) to separate multiple values.
  • If the database is a cluster Redis database, enter the IP addresses and port numbers of all shards in the source cluster Redis database. Use colons (:) to separate a database IP address and port number. Use commas (,) to separate multiple values. You are advised to enter the IP address of the slave node of a cluster shard. Up to 32 IP addresses or domain names can be entered. Use commas (,) to separate multiple IP addresses or domain names.

Example:

  • MongoDB: 192.168.0.10:8080,192.168.0.11:8080,192.168.0.12:8080
  • DDS: 192.168.205.130:8635,192.168.250.64:8635
  • Cluster Redis: 192.168.0.1:8080,192.168.0.2:8080

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:

  • oracle: serviceName.orcl.

source_sharding

No

Array of objects

Information about the physical source database.

For details, see Table 7.

Table 8 Data structure description of field cloud

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.

Table 9 Data structure description of field vpc

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.

Table 10 Data structure description of field config

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

Table 11 Data structure description of field ssl

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.

Table 12 Data structure description of field customized_dns

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.

  • add: Add a customized DNS server IP address.
  • keep: Retain the DNS server IP address.
  • update: Update the customized DNS server IP address. (The update takes effect when the DNS server IP address changes.)
  • recover: Restore the default DNS server IP address. (Restoration may cause domain name resolution failures. Exercise caution when performing this operation.)

Enumerated values:

  • add
  • keep
  • update
  • recover

dns_ip

Yes

String

DNS server IP address.

Minimum length: 0

Maximum length: 15

Table 13 Data structure description of field skip_precheck_info

Parameter

Mandatory

Type

Description

skipped_precheck_list

Yes

Array of strings

Skipped pre-check item.

skip_reason

Yes

String

Reason for skipping the pre-check item.

Table 14 Data structure description of field compare_task_param

Parameter

Mandatory

Type

Description

compare_task_id

No

String

This parameter is mandatory for canceling a comparison task.

type

No

String

Comparison task mode. Values:

  • object: object-level comparison.
  • lines: row comparison.
  • contents: value comparison.

Enumerated values:

  • object
  • lines
  • contents

start_time

No

String

Scheduled tart time, in timestamp format.

option

No

Map<String,String>

Comparison policy.

db_object

No

Map<String,DatabaseObject>

Comparison object.

For details, see Table 24.

data_process_info

No

Array of objects

Request body for updating a data processing rule.

For details, see Table 15.

Table 15 Data structure description of field data_process_info

Parameter

Mandatory

Type

Description

filter_conditions

No

Array of objects

Request body for data processing rules for a specified task.

For details, see Table 16.

is_batch_process

No

Boolean

The value is true for database-level and batch table-level data processing and false for single-table data processing.

add_columns

No

Array of objects

Additional column. This parameter is mandatory when adding additional columns is required.

Note: You must use additional columns to avoid data conflicts in many-to-one operations.

For details, see Table 17.

ddl_operation

No

Map<String,String>

DDL operations to be migrated or synchronized in an incremental task. If this parameter is set to table, DDL operations including CREATE TABLE, ALTER TABLE, DROP TABLE, and RENAME TABLE can be migrated or synchronized.

If this parameter is left blank, DDL operations cannot be migrated or synchronized.

dml_operation

No

String

DML operations to be migrated or synchronized.

  • i: INSERT
  • u: UPDATE
  • d: DELETE

If this parameter is left blank, DML operations cannot be migrated or synchronized in an incremental task.

db_object_column_info

No

Object

Column mapping and filtering information. This parameter is mandatory when column mapping and filtering information is required.

For details, see Table 18.

db_or_table_rename_rule

No

Object

Database table mapping rule.

For details, see Table 21.

db_object

No

Object

Data processing object information, which is mandatory when column mapping and data filtering conditions are verified.

For details, see Table 22.

is_synchronized

No

Boolean

Whether the rule has been synchronized to the destination database.

source

No

String

Comparison source.

  • job: indicates the data filtering during synchronization.
  • compare: indicates the data filtering during comparison.

Enumerated values:

  • job
  • compare

Table 16 Data structure description of field filter_conditions

Parameter

Mandatory

Type

Description

value

No

String

Filtering condition. When filtering_type is set to configConditionalFilter, the default value is config. When filtering_type is set to contentConditionalFilter, the default value is the filtering condition.

NOTE:
  • Each table has only one verification rule.
  • Up to 500 tables can be filtered at a time.
  • Standard SQL statements can be used to filter records. Each expression cannot contain packages, functions, variables, or constants specific to a database engine.
  • Enter the part following WHERE in the SQL statement (excluding WHERE and semicolons), for example, sid > 3 and sname like "G %". A maximum of 512 characters are allowed.
  • In SQL statements for setting filter criteria, keywords must be enclosed in backquotes, and the value of datatime (including date and time) must be enclosed in single quotation marks, for example, `update` > '2022-07-13 00:00:00' and age >10.
  • Filter criteria cannot be configured for large objects, such as CLOB, BLOB, and BYTEA.
  • Filtering rules cannot be set for objects whose database names and table names contain newline characters.
  • You are not advised to set filter criteria for fields of approximate numeric types, such as FLOAT, DECIMAL, and DOUBLE.
  • Do not use fields containing special characters as a filter condition.
  • You are not advised to use non-idempotent expressions or functions as data processing conditions, such as SYSTIMESTAMP and SYSDATE, because the returned result may be different each time the function is called.

filtering_type

No

String

Filter condition type.

  • contentConditionalFilter: simple condition-based filtering.
  • configConditionalFilter: association table filtering.

Enumerated values:

  • contentConditionalFilter
  • configConditionalFilter
Table 17 Data structure description of field add_columns

Parameter

Mandatory

Type

Description

column_type

No

String

Column type.

column_name

No

String

Column name.

column_value

No

String

Column value.

data_type

No

String

Data type of a column.

Table 18 Data structure description of field db_object_column_info

Parameter

Mandatory

Type

Description

db_name

No

String

Database name.

schema_name

No

String

Schema name.

table_name

No

String

Table name.

column_infos

No

Array of objects

Column information.

For details, see Table 19.

total_count

No

Integer

Total number of database column records, which is irrelevant to pagination and is used only as a return body parameter.

Table 19 Data structure description of field column_infos

Parameter

Mandatory

Type

Description

column_name

No

String

Column name.

column_type

No

String

Column type.

primary_key_or_unique_index

No

String

Primary key or unique index.

column_mapped_name

No

String

Mapped column name.

is_filtered

No

Boolean

Whether the column is filtered.

is_partition_key

No

Boolean

Whether the column is a partition column.

Table 20 Data structure description of field replay_config

Parameter

Mandatory

Type

Description

db_instance_id

Yes

String

Source instance ID.

cloud_type

Yes

String

Cloud type.

  • AWSCloud: AWS Cloud.
  • TencentCloud: Tencent Cloud.
  • AliCloud: Alibaba Cloud.

Enumerated values:

  • AWSCloud
  • TencentCloud
  • AliCloud

ak

Yes

String

AK information of other clouds.

sk

Yes

String

SK information of other clouds.

db_source

Yes

String

Source of the source database. The value can be:

  • aws_aurora_mysql: Amazon Aurora MySQL.
  • tencent_tdsql_c: Tencent Cloud TDSQL-C MySQL.
  • ali_rds_mysql: Alibaba Cloud ApsaraDB RDS for MySQL.

Enumerated values:

  • aws_aurora_mysql
  • tencent_tdsql_c
  • ali_rds_mysql

region

Yes

String

Region name of other clouds.

traffic_source

Yes

String

Workload file source.

  • sdk: Download audit logs through third-party cloud APIs.
Table 21 Data structure description of field db_or_table_rename_rule

Parameter

Mandatory

Type

Description

prefix_name

No

String

Prefix name. When type is set to prefixAndSuffix, this parameter is mandatory, and only a prefix is added to the database table name. If suffix_name is also specified, both a prefix and a suffix are added to the database table name.

suffix_name

No

String

Suffix name. When type is set to prefixAndSuffix, this parameter is mandatory, and only a suffix is added to the database table name. If prefix_name is also specified, both a prefix and a suffix are added to the database table name.

type

No

String

Database table mapping type. prefixAndSuffix: prefix, suffix, or prefix and suffix.

Enumerated values:

  • prefixAndSuffix
  • manyToOne
Table 22 Data structure description of field db_object

Parameter

Mandatory

Type

Description

object_scope

Yes

String

Migration or synchronization object scope. The value can be:

  • all: Migrate or synchronize all objects.
  • database: database-level migration or synchronization.
  • table: table-level migration or synchronization.

Enumerated values:

  • all
  • database
  • table

target_root_db

No

object

Destination database for database object migration or synchronization. This parameter is mandatory for database synchronization from Layer 2 to Layer 3.

For details, see Table 23.

object_info

No

Map<String,DatabaseObject>

Object information for migration or synchronization. If object_scope is set to all, leave this parameter blank. If object_scope is set to database or table, this parameter is mandatory.

For details, see Table 24.

Table 23 Data structure description of field target_root_db

Parameter

Mandatory

Type

Description

db_name

No

String

Database name.

db_encoding

No

String

Encoding format. The default value is UTF-8.

Table 24 Data structure description of field db_object

Parameter

Mandatory

Type

Description

sync_type

No

String

Type of the database in real-time synchronization. Values:

config: This parameter is mandatory only when the database is used as an association database in advanced settings for data filtering. In this case, the database and its schemas and tables will not be synchronized to the destination database. The name and all parameters do not take effect. Enter the associated objects in schemas and tables.

NOTE:

To synchronize the database-level object, set sync_type to config for the lower-level object.

Enumerated values:

  • config

name

No

String

Name of the database in the destination database (database name mapping).

all

No

Boolean

Whether to migrate or synchronize the entire database.

NOTE:
  • If data filtering, column filtering, and column mapping are required for schemas, tables, and columns in the database, set this parameter to false. Otherwise, set this parameter to true.
  • If additional columns are required for tables in the database, set this parameter to true and enter additional column information in columns of table-level objects.
  • If the table columns in the database are used as association columns in advanced settings for data filtering, set this parameter to true, enter the association column information in columns, and enter the configuration criteria in advanced settings for data filtering in config_conditions.

schemas

No

Map<String,SchemaObject>

Schema to be migrated or synchronized. This parameter is mandatory when all is set to false.

For details, see Table 25.

tables

No

Map<String,TableObject>

Table to be migrated or synchronized. This parameter is mandatory when all is set to false.

For details, see Table 26.

total_table_num

No

Integer

Number of tables in the database. If the number of tables exceeds the threshold, this parameter is not displayed.

is_synchronized

No

Boolean

Whether synchronization has been performed.

Table 25 Data structure description of field schemas

Parameter

Mandatory

Type

Description

sync_type

No

String

Type of the schema in real-time synchronization. Values:

config: This parameter is mandatory only when the schema is used as an association schema in advanced settings for data filtering. In this case, the schema and its tables will not be synchronized to the destination database. The name and all parameters do not take effect. Enter the associated objects in tables.

NOTE:

To synchronize the schema-level object, set sync_type to config for the lower-level object.

name

No

String

Name of the schema in the destination database (schema name mapping).

all

No

Boolean

Whether to migrate or synchronize the entire schema.

NOTE:
  • If data filtering, column filtering, and column mapping are required for tables and columns in the schema, set this parameter to false. Otherwise, set this parameter to true.
  • If additional columns are required for tables in the schema, set this parameter to true and enter additional column information in columns of table-level objects.
  • If the table columns in the schema are used as association columns in advanced settings for data filtering, set this parameter to true, enter the association column information in columns, and enter the configuration criteria in advanced settings for data filtering in config_conditions.

tables

No

Map<String,TableObject>

Table to be migrated or synchronized. This parameter is mandatory when all is set to false.

For details, see Table 26.

Table 26 Data structure description of field tables

Parameter

Mandatory

Type

Description

sync_type

No

String

Type of the table in real-time synchronization. Values:

config: This parameter is mandatory only when the table is used as an association table in advanced settings for data filtering. In this case, the table and its columns will not be synchronized to the destination database. The name, all, filtered, and filter_conditions parameters do not take effect. Enter the associated objects in columns and the configuration criteria in advanced settings for data filtering in config_conditions.

NOTE:

To synchronize the table-level object, set sync_type to config for the lower-level object.

type

No

String

Object type. Values:

  • table: indicates a table.
  • view: indicates a view.
  • procedure: indicates a stored procedure.

Enumerated values:

  • table
  • view
  • procedure

name

No

String

Name of the table in the destination database (table name mapping).

all

No

Boolean

Whether to migrate or synchronize the entire table.

NOTE:
  • If column filtering and column mapping are not required for the table, set this parameter to true. Otherwise, set this parameter to false.
  • If additional columns are required for the table, set this parameter to true and enter additional column information in columns.
  • If the table columns are used as association columns in advanced settings for data filtering, set this parameter to true, enter the association column information in columns, and enter the configuration criteria in advanced settings for data filtering in config_conditions.

db_alias_name

No

String

Mapping of database names at the table level in the one-to-many scenario.

schema_alias_name

No

String

Mapping of schema names at the table level in the one-to-many scenario.

filtered

No

Boolean

Whether to filter data in the table.

filter_conditions

No

Array of strings

Filtering criteria for the table data. The processing rule value is a SQL statement. The value contains a maximum of 512 characters.

Minimum length: 0

Maximum length: 512

config_conditions

No

Array of strings

Configuration criteria in advanced settings for data filtering of the table. This parameter is mandatory when the table is used as an association table for query. The processing rule value is a SQL statement. The value contains a maximum of 512 characters.

Minimum length: 0

Maximum length: 512

is_synchronized

No

Boolean

Whether synchronization has been performed.

columns

No

Map<String,ColumnObject>

Columns to be synchronized, mapped, filtered, or added. This parameter is mandatory when column filtering, column mapping, and additional columns are required. This parameter takes effect only in real-time synchronization tasks. This parameter is mandatory when all is set to false.

For details, see Table 27.

Table 27 Data structure description of field columns

Parameter

Mandatory

Type

Description

sync_type

No

String

Type of the column in real-time synchronization. Values:

config: This parameter is mandatory only when the column is used as an association column in advanced settings for data filtering. If the column is a primary key column or index column required for optimizing the query, primary_key_for_data_filtering or index_for_data_filtering is mandatory.

NOTE:

Whether to synchronize the column to the destination database depends on the filtered parameter, which is different from the database, schema, and table-level synchronization.

primary_key_for_data_filtering

No

String

Whether the column is a primary key column in advanced settings for data filtering. If the column is a primary key column, set this parameter to the column name. Otherwise, leave this parameter blank.

index_for_data_filtering

No

String

Whether the column is an index column required for optimizing the query. The index is added to the cached data. It does not affect the source table. If the column is an index column in advanced settings for data filtering, this parameter is mandatory. Otherwise, leave this parameter blank.

name

No

String

Name of the column in the destination database (column name mapping). If the column is an additional column, the value must be the same as the column name in the table-level object.

type

No

String

Data type of the column. Column filtering: Enter the data type of the source column. Additional column adding: Enter the data type of the new column. The values and constraints vary depending on the operation type. Values:

  • Default: The value can be int, long, varchar(256), datetime, or timestamp.
  • create_time: The value can be long, datetime, or timestamp.
  • update_time: The value can be long, datetime, or timestamp.
  • Expression: The value can be varchar (256), and the column value must be concat(__current_database, '@', __current_table).
  • serverName@database@table: The value can be varchar(256).

primary_key_for_column_filtering

No

String

Whether the column is a primary key column in column mapping. If the column is a primary key column, set this parameter to PRI. Otherwise, leave this parameter blank.

filtered

No

Boolean

Whether the column is filtered out. This parameter cannot be used together with the additional parameter. Values:

  • true: indicates that the column will be synchronized.
  • false: indicates that the column is filtered out and will not be synchronized.

additional

No

Boolean

Whether the column is an additional column. If the column is an additional column, the value of name must be the same as the column name in the table-level object and cannot be used together with the filtered parameter.

operation_type

No

String

Operation type. The new column is filled with a specific operation type. Values:

  • Default: "operation_type":"ADDITIONALCOLUMN,default_value"
  • create_time: "operation_type":"ADDITIONALCOLUMN,create_time"
  • update_time: "operation_type":"ADDITIONALCOLUMN,update_time"
  • Expression: "operation_type":"ADDITIONALCOLUMN,expression"
  • serverName@database@table: "operation_type":"ADDITIONALCOLUMN,server_database_table"

value

No

String

Value of the additional column. Note:

  • This parameter is mandatory only when operation type is set to Default or serverName@database@table.
  • When operation type is set to Expression, this parameter has a fixed value of concat(__current_database, '@', __current_table).
Table 28 Data structure description of field public_ip_config

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.

  • In a primary/standby task, master indicates the primary task, and slave indicates the standby task.
  • In other cases, the value is fixed to master.

Enumerated values:

  • master
  • slave

Response Parameters

Status code: 200

Table 29 Response body parameters

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

id

String

Task ID.

name

String

Task name.

status

String

Operation result.

Status code: 202

Table 30 Response body parameters

Parameter

Type

Description

query_id

String

Query ID of the asynchronous operation task.

Status code: 400

Table 31 Response body parameters

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

  • Performing a precheck (asynchronous calling)
    https://{endpoint}/v5/054ba152d480d55b2f5dc0069e7ddef0/jobs/c7debc9c-8e09-4a5d-8dd6-cc44f78jb20r/action
    
    {
      "job" : {
        "action_name" : "precheck",
        "action_params" : {
          "precheck_mode" : "forStartJob"
        }
      }
    }
  • Testing the connection to the destination database (asynchronous calling)
    https://{endpoint}/v5/054ba152d480d55b2f5dc0069e7ddef0/jobs/c7debc9c-8e09-4a5d-8dd6-cc44f78jb20r/action
    
    {
      "job" : {
        "action_name" : "network",
        "action_params" : {
          "endpoints" : [ {
            "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-4g,cn-north-4c"
            },
            "vpc" : {
              "vpc_id" : "2cb5d364-ae63-4fbb-85b7-7d59f4a88f8f",
              "subnet_id" : "2cb54324-ae63-4fbb-85b7-7d59f4a88f8f",
              "security_group_id" : "039a3s89-665a-43e2-9b4f-bda7d9ee148d"
            }
          } ]
        }
      }
    }
  • Testing the connection to the source database (asynchronous calling)
    https://{endpoint}/v5/054ba152d480d55b2f5dc0069e7ddef0/jobs/c7debc9c-8e09-4a5d-8dd6-cc44f78jb20r/action
    
    {
      "job" : {
        "action_name" : "network",
        "action_params" : {
          "endpoints" : [ {
            "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_password" : "******",
              "id" : "971e1840-9395-4044-b6c8-00ef1f83ce48",
              "db_name" : "serviceName.orcl"
            },
            "ssl" : {
              "ssl_link" : false
            }
          } ]
        }
      }
    }
  • Creating an object comparison task (asynchronous calling)
    https://{endpoint}/v5/054ba152d480d55b2f5dc0069e7ddef0/jobs/d0f96c1d-571f-4b63-98a5-3b85b36jb20r/action
    
    {
      "job" : {
        "action_name" : "create_compare",
        "action_params" : {
          "compare_task_param" : {
            "type" : "object"
          }
        }
      }
    }
  • Creating a row comparison task (asynchronous calling)
    https://{endpoint}/v5/054ba152d480d55b2f5dc0069e7ddef0/jobs/d0f96c1d-571f-4b63-98a5-3b85b36jb20r/action
    
    {
      "job" : {
        "action_name" : "create_compare",
        "action_params" : {
          "compare_task_param" : {
            "type" : "lines",
            "option" : {
              "comparePolicy" : "normal"
            },
            "db_object" : {
              "db1" : {
                "name" : "db1",
                "tables" : {
                  "table1" : {
                    "name" : "table1"
                  }
                }
              }
            }
          }
        }
      }
    }
  • Starting a task upon its creation
    https://{endpoint}/v5/0/jobs/d0f96c1d-571f-4b63-98a5-3b85b36jb20r/action
    
    {
      "job": {
        "action_name": "start",
        "action_params": {}
      }
    }
  • Pausing a task
    https://{endpoint}/v5/054ba152d480d55b2f5dc0069e7ddef0/jobs/d0f96c1d-571f-4b63-98a5-3b85b36jb20r/action
    
    {
      "job": {
        "action_name": "stop",
        "action_params": {}
      }
    }
  • Resuming a task
    https://{endpoint}/v5/054ba152d480d55b2f5dc0069e7ddef0/jobs/d0f96c1d-571f-4b63-98a5-3b85b36jb20r/action
    
    {
      "job": {
        "action_name": "restart",
        "action_params": {}
      }
    }
  • Resetting a task
    https://{endpoint}/v5/054ba152d480d55b2f5dc0069e7ddef0/jobs/d0f96c1d-571f-4b63-98a5-3b85b36jb20r/action
    
    {
      "job": {
        "action_name": "reset",
        "action_params": {}
      }
    }
  • Skipping the pre-check
    https://{endpoint}/v5/054ba152d480d55b2f5dc0069e7ddef0/jobs/d0f96c1d-571f-4b63-98a5-3b85b36jb20r/action
    
    {
      "job": {
        "action_name": "skip_precheck",
        "action_params": {
          "skip_precheck_info": {
            "skipped_precheck_list": [
              "MysqlForeignKeyReferentialActionCheck"
            ],
            "skip_reason": "test11111"
          }
        }
      }
    }
  • Binding an EIP to a DB instance
    https://{endpoint}/v5/054ba152d480d55b2f5dc0069e7ddef0/jobs/d0f96c1d-571f-4b63-98a5-3b85b36jb20r/action
    
    {
      "job" : {
        "action_name" : "bind_eip",
        "action_params" : {
          "public_ip_config" : {
            "id" : "018d9e56-26d5-455a-97dc-e6f5f44a2cbd",
            "public_ip" : "******",
            "type" : "master"
          }
        }
      }
    }
  • Unbinding an EIP from a DB instance
    https://{endpoint}/v5/054ba152d480d55b2f5dc0069e7ddef0/jobs/d0f96c1d-571f-4b63-98a5-3b85b36jb20r/action
    
    {
      "job" : {
        "action_name" : "unbind_eip"
      }
    }
  • Testing the connectivity of other clouds
    https://{endpoint}/v5/5237e10fe9aa4ad5b16b6a5245248314/jobs/6c65eafc-b359-403b-b2fb-9f5fc58jb601/action
    
    {
      "job" : {
        "action_name" : "cloud_connection",
        "action_params" : {
          "replay_config" : {
            "ak" : "******",
            "sk" : "******",
            "traffic_source" : "sdk",
            "db_instance_id" : "data-anniversary-cluster",
            "cloud_type" : "AWSCloud",
            "region" : "ap-northeast-3",
            "db_source" : "aws_aurora_mysql"
          }
        }
      }
    }

Example Response

Status code: 200

OK

{
  "status": "success"
}

Status code: 202

Accepted

{
  "query_id" : "c5c1ffb3-c902-4b31-a606-dfa1231831f9"
}

Status code: 400

Bad Request

{
  "error_code" : "DRS.10000010",
  "error_msg" : "Job does not exist, please check job id."
}

Status Code

Status Code

Description

200

OK

202

Accepted

400

Bad Request

Error Code

For details, see Error Code.