Querying Details of a Data Migration Task
Function
This API is used to query migration task details.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
dcs:migrationTask:get
Read
migrationTask *
-
-
-
URI
GET /v2/{project_id}/migration-task/{task_id}
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. For details, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
| task_id | Yes | String | Definition ID of the data migration task. It can be obtained from response parameter task_id of the API for Listing Migration Tasks. Constraints N/A Range N/A Default Value N/A |
Request Parameters
None
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| task_id | String | Definition Migration task ID. Range N/A |
| task_name | String | Definition Migration task name. Range N/A |
| description | String | Definition Description of the migration task. Range N/A |
| status | String | Definition Status of the migration task. Range |
| migration_type | String | Definition Description of the migration task. Range |
| migration_method | String | Definition Migration type. Range |
| ecs_tenant_private_ip | String | Definition Private IP address of the migration ECS on the tenant side. This IP address can be added to the whitelist if it is in the same VPC as the private IP address of the target or source Redis. Range N/A |
| backup_files | BackupFilesRespBody object | Definition: Backup files to be imported when the migration mode is backup file import. |
| network_type | String | Definition Network type. The value can be vpc or vpn. Range |
| source_instance | SourceInstanceRespBody object | Definition: Source Redis information. |
| target_instance | TargetInstanceRespBody object | Definition: Target Redis instance information. |
| created_at | String | Definition Time when the migration task is created. Range N/A |
| updated_at | String | Definition Time when the migration task is complete. Range N/A |
| released_at | String | Definition Time when the migration ECS is released. Range N/A |
| version | String | Definition Version of the migration ECS. Range N/A |
| resume_mode | String | Definition Data migration mode. Range |
| supported_features | Array of strings | Definition Supported features. Range N/A |
| tenant_vpc_id | String | Definition Tenant VPC ID. Range N/A |
| tenant_subnet_id | String | Definition Tenant subnet ID. Range N/A |
| tenant_security_group_id | String | Definition Tenant security group ID. Range N/A |
| bandwidth_limit_mb | String | Definition Maximum bandwidth. Range N/A |
| task_status | String | Definition Task status. EXCHANGING is returned only when IP addresses are being switched. Range EXCHANGING: IP addresses are being switched. |
| Parameter | Type | Description |
|---|---|---|
| file_source | String | Definition Data source, which can be an OBS bucket or a backup record. Range |
| bucket_name | String | Definition OBS bucket name. Range N/A |
| files | Array of FilesResp objects | Definition: List of backup files to be imported. |
| backup_id | String | Definition Backup record ID. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| file_name | String | Definition Name of a backup file. Range N/A |
| size | String | Definition File size in bytes. Range N/A |
| update_at | String | Definition Time when the file is last modified. The format is YYYY-MM-DD HH:MM:SS. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| addrs | String | Definition IP address and domain name of the Redis instance. Range N/A |
| password | String | Definition Redis password. Range N/A |
| id | String | Definition Redis instance ID. Range N/A |
| ip | String | Definition Redis IP address. Range N/A |
| port | String | Definition Redis port. Range N/A |
| name | String | Definition Redis name. Range N/A |
| proxy_multi_db | Boolean | Definition Whether multi-DB is enabled for a Proxy Cluster DCS instance. Range |
| db | String | Definition Redis database. Range 0–255 |
| withProxy | Boolean | Definition Whether proxy nodes are available. Range |
| Parameter | Type | Description |
|---|---|---|
| addrs | String | Definition Source Redis address (specified in the source_instance parameter). Range N/A |
| password | String | Definition Redis password. Range N/A |
| id | String | Definition Redis instance ID. Range N/A |
| ip | String | Definition Redis IP address. Range N/A |
| port | String | Definition Redis port. Range N/A |
| name | String | Definition Redis name. Range N/A |
| proxy_multi_db | Boolean | Definition Whether multi-DB is enabled for a Proxy Cluster DCS instance. Range |
| db | String | Definition Redis database. Range 0–255 |
| withProxy | Boolean | Definition Whether proxy nodes are available. Range |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_msg | String | Definition Error information. Range N/A |
| error_code | String | Definition Error code. Range For details, see Error Codes. |
| error_ext_msg | String | Definition Extended error information. This parameter is not used currently and is set to null. Range N/A |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_msg | String | Definition Error information. Range N/A |
| error_code | String | Definition Error code. Range For details, see Error Codes. |
| error_ext_msg | String | Definition Extended error information. This parameter is not used currently and is set to null. Range N/A |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_msg | String | Definition Error information. Range N/A |
| error_code | String | Definition Error code. Range For details, see Error Codes. |
| error_ext_msg | String | Definition Extended error information. This parameter is not used currently and is set to null. Range N/A |
Status code: 404
| Parameter | Type | Description |
|---|---|---|
| error_msg | String | Definition Error information. Range N/A |
| error_code | String | Definition Error code. Range For details, see Error Codes. |
| error_ext_msg | String | Definition Extended error information. This parameter is not used currently and is set to null. Range N/A |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_msg | String | Definition Error information. Range N/A |
| error_code | String | Definition Error code. Range For details, see Error Codes. |
| error_ext_msg | String | Definition Extended error information. This parameter is not used currently and is set to null. Range N/A |
Example Requests
GET https://{dcs_endpoint}/v2/254d2280acb74d36a8b839746bcd7352/migration-task/a276c1ffa0a54c2597fc824b917db317 Example Responses
Status code: 200
Details of a data migration task queried successfully.
{
"task_name" : "migration1",
"task_id" : "a276c1ffa0a54c2597fc824b917db317",
"status" : "TERMINATING",
"migration_type" : "online_migration",
"network_type" : "vpc",
"source_instance" : {
"addrs" : "192.168.1.2:6379",
"id" : "86157b69-8a62-47f9-8c55-fa6ddc8927e1",
"name" : "dcs-test",
"ip" : "192.168.1.2",
"port" : "6379",
"proxy_multi_db" : false,
"password" : "DCStest123",
"db" : "0"
},
"target_instance" : {
"addrs" : "192.168.1.2:6379",
"id" : "86157b69-8a62-47f9-8c55-fa6ddc8927ee",
"name" : "test-instance",
"ip" : "192.168.1.2",
"port" : "6379",
"proxy_multi_db" : false,
"password" : "DCStest123",
"db" : "0"
},
"created_at" : "2019-10-22T14:44:30.000Z",
"updated_at" : "2019-10-22T18:00:00.000Z"
} SDK Sample Code
The SDK sample code is as follows.
Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.dcs.v2.region.DcsRegion; import com.huaweicloud.sdk.dcs.v2.*; import com.huaweicloud.sdk.dcs.v2.model.*; public class ShowMigrationTaskSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); DcsClient client = DcsClient.newBuilder() .withCredential(auth) .withRegion(DcsRegion.valueOf("<YOUR REGION>")) .build(); ShowMigrationTaskRequest request = new ShowMigrationTaskRequest(); request.withTaskId("{task_id}"); try { ShowMigrationTaskResponse response = client.showMigrationTask(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkdcs.v2.region.dcs_region import DcsRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkdcs.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = DcsClient.new_builder() \ .with_credentials(credentials) \ .with_region(DcsRegion.value_of("<YOUR REGION>")) \ .build() try: request = ShowMigrationTaskRequest() request.task_id = "{task_id}" response = client.show_migration_task(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" dcs "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dcs/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dcs/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dcs/v2/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth, err := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). SafeBuild() if err != nil { fmt.Println(err) return } hcClient, err := dcs.DcsClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). SafeBuild() if err != nil { fmt.Println(err) return } client := dcs.NewDcsClient(hcClient) request := &model.ShowMigrationTaskRequest{} request.TaskId = "{task_id}" response, err := client.ShowMigrationTask(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
More
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
| Status Code | Description |
|---|---|
| 200 | Details of a data migration task queried successfully. |
| 400 | Invalid request. |
| 401 | Invalid authentication information. |
| 403 | The request is rejected. |
| 404 | The requested resource is not found. |
| 500 | Internal service error. |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank 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