Creates an import task that contains the import packages of the data sources, tasks, and tables.
The import package must be uploaded. Example of the upload method:
Config config = new Config();
config.setAccessKeyId(accessId);
config.setAccessKeySecret(accessKey);
config.setEndpoint(popEndpoint);
config.setRegionId(regionId);
Client client = new Client(config);
CreateImportMigrationAdvanceRequest request = new CreateImportMigrationAdvanceRequest();
request.setName("test_migration_api_" + System.currentTimeMillis());
request.setProjectId(123456L);
request.setPackageType("DATAWORKS_MODEL");
request.setPackageFileObject(new FileInputStream("/home/admin/Downloads/test.zip"));
RuntimeOptions runtime = new RuntimeOptions();
CreateImportMigrationResponse response = client.createImportMigrationAdvance(request, runtime);
...
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
Action | String | Yes | CreateImportMigration | The operation that you want to perform. Set the value to CreateImportMigration. |
ProjectId | Long | Yes | 123456 | The DataWorks workspace ID. You can log on to the DataWorks console and go to the Workspace page to obtain the workspace ID. |
Name | String | Yes | test_import_001 | The name of the import task. The name must be unique within the workspace. |
PackageType | String | Yes | DATAWORKS_MODEL | The type of the import package. Valid values:
|
PackageFile | String | Yes | /home/admin/xxx/import.zip | The path of the import package. The import package must be uploaded. Example of the upload method:
|
String | No | {"SCHEDULER_RESOURCE_GROUP": {"xxx":"yyy"},"DI_RESOURCE_GROUP":{"ccc":"ddd"}} | The mapping between the resource group for scheduling and the resource group for Data Integration. The keys and values in the mapping are the identifiers of the resource groups. Specify the mapping in the following format:
| |
WorkspaceMap | String | No | {"test_workspace_src": "test_workspace_target"} | The mapping between the prefixes for the names of the source and destination workspaces. When the system performs the import operation, the prefix for the name of the source workspace in the import package is replaced based on the mapping. |
CalculateEngineMap | String | Yes | { "ODPS": { "zxy_8221431_engine": "wzp_kaifazheban_engine" }, "EMR": { "aaaa": "bbb" } } | The mapping between the source compute engine instance and the destination compute engine instance. The following types of compute engine instances are supported: MaxCompute, E-MapReduce (EMR), Hadoop CDH, and Hologres. |
CommitRule | String | Yes | { "resourceAutoCommit": false, "resourceAutoDeploy": false, "functionAutoCommit": false, "functionAutoDeploy": false, "tableAutoCommitToDev": false, "tableAutoCommitToProd": false, "ignoreLock": false, "fileAutoCommit": false, "fileAutoDeploy": false } | The rule configured for automatically committing and deploying the import task. The rule contains the following parameters:
|
Description | String | No | test description | The description of the import package. |
Response parameters
Parameter | Type | Example | Description |
HttpStatusCode | Integer | 200 | The HTTP status code. |
Data | Long | 123456 | The import task ID. The ID is used as an input parameter if you want the system to run the import task or you want to obtain the running progress of the import task. |
ErrorMessage | String | test error message | The error message. |
RequestId | String | ADFASDFASDFA-ADFASDF-ASDFADSDF-AFFADS | The request ID. You can use the ID to locate logs and troubleshoot issues. |
ErrorCode | String | 110001123456 | The error code. |
Success | Boolean | true | Indicates whether the request was successful. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=CreateImportMigration
&ProjectId=123456
&Name=test_import_001
&PackageType=DATAWORKS_MODEL
&PackageFile=/home/admin/xxx/import.zip
&ResourceGroupMap={"SCHEDULER_RESOURCE_GROUP": {"xxx":"yyy"},"DI_RESOURCE_GROUP":{"ccc":"ddd"}}
&WorkspaceMap={"test_workspace_src": "test_workspace_target"}
&CalculateEngineMap={ "ODPS": { "zxy_8221431_engine": "wzp_kaifazheban_engine" }, "EMR": { "aaaa": "bbb" } }
&CommitRule={ "resourceAutoCommit": false, "resourceAutoDeploy": false, "functionAutoCommit": false, "functionAutoDeploy": false, "tableAutoCommitToDev": false, "tableAutoCommitToProd": false, "ignoreLock": false, "fileAutoCommit": false, "fileAutoDeploy": false }
&Description=test description
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateImportMigrationResponse>
<HttpStatusCode>200</HttpStatusCode>
<Data>123456</Data>
<ErrorMessage>test error message</ErrorMessage>
<RequestId>ADFASDFASDFA-ADFASDF-ASDFADSDF-AFFADS</RequestId>
<ErrorCode>110001123456</ErrorCode>
<Success>true</Success>
</CreateImportMigrationResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"HttpStatusCode" : 200,
"Data" : 123456,
"ErrorMessage" : "test error message",
"RequestId" : "ADFASDFASDFA-ADFASDF-ASDFADSDF-AFFADS",
"ErrorCode" : "110001123456",
"Success" : true
}
Error codes
For a list of error codes, see Service error codes.