Getting Started
Scenarios
This section describes the basic procedure of calling OMS APIs by creating an object data migration task.
For details, see Calling APIs.
Involved APIs
- Obtaining a User Token Through Password Authentication: This API is used to obtain the user token for authentication.
- Creating a Migration Task: used to create a migration task using the source and destination AK/SK pairs
- Querying a Migration Task: used to query the task details based on the migration task ID to check whether the migration task has been created successfully
Prerequisites
- You have obtained the AK/SK pair of the source platform account.
- You have obtained AK/SK of the destination platform account. For details about how to obtain AKs and SKs, see Creating Access Keys (AK and SK).
- You have obtained the endpoints of IAM and OMS. For details, see Regions and Endpoints.
- You have obtained the region where the source bucket locates.
- The destination bucket has been created. For details, see Creating a Bucket.
- You have obtained the region where the destination bucket locates. For details, see Viewing Bucket Information.
- You have obtained the project ID. For details, see Obtaining a Project ID and Task ID.
Creating an Application
Assume that you have obtained the required information shown as follows, which are examples. You need to replace them based on the actual situation.
- IAM endpoint: iam_endpoint
- OMS endpoint: oms.cn-north-1.myhuaweicloud.com
- Project ID: 0215ef11e49d4743be23dd97a156xxxx
- Region where the source bucket locates: cn-beijing
- Region where the destination bucket locates: cn-north-1
- Source AK: source_ak
- Source SK: source_sk
- Destination AK: destination_ak
- Destination SK: destination_sk
- Source bucket name: source_bucket
- Destination bucket name: destination_bucket
- Source type: cloud_type
Procedure
- Obtain the token of the IAM user.
- API
URI format: POST /v3/auth/tokens
For details, see Obtaining a User Token Through Password Authentication.
- Example request
POST: https://{iam_endpoint}/v3/auth/tokens
Obtain {endpoint} from Regions and Endpoints.
Body:{ "auth": { "identity": { "methods": [ "password" ], "password": { "user": { "name": "testname", "domain": { "name": "testname" }, "password": "Password" } } }, "scope": { "project": { "id": "0215ef11e49d4743be23dd97a156xxxx" } } } }
In the response header, the value of X-Subject-Token is the token.
X-Subject-Token:MIIDkgYJKoZIhvcNAQcCoIIDgzCCA38CAQExDTALBglghkgBZQMEAgEwgXXXXX...
- API
- Make a call to the API for creating a migration task to create a migration task.
- API
URI format: POST https://{endpoint}/v2/{project_id}/tasks
For details, see Creating a Migration Task.
- Example request
POST: https://{endpoint}/v2/0215ef11e49d4743be23dd97a1561e91/tasks
Obtain {endpoint} from Regions and Endpoints.
Header:
Content-Type: application/json X-Auth-Token: "Token"
Body:
{ "task_type" : "prefix", "src_node" : { "cloud_type" : "HuaweiCloud", "region" : "cn-north-1", "bucket" : "src_bucket", "ak" : "src_ak", "sk" : "src_sk", "object_key" : [ "abc", "123", "prefix3", "path/prefix4" ] }, "dst_node" : { "region" : "cn-north-1", "ak" : "dst_ak", "sk" : "dst_sk", "bucket" : "dst_bucket" }, "enable_kms" : false, "enable_failed_object_recording" : true, "description" : "xxx" }
- Example response
{ "id" : 180890111968184, "task_name" : "task_name" }
- API
- Make a call to the task viewing API to view the task status.
- API
GET /v2/{project_id}/tasks/{task_id}
For details, see Querying a Migration Task.
- Example request
GET: https://{endpoint}/v2/2c0689c860ad4728a497c91ec0844383/tasks/191297407830872
Obtain {endpoint} from Regions and Endpoints.
Header:
Content-Type: application/json X-Auth-Token: "Token"
- Example response
{ "bandwidth_policy" : [ { "end" : "23:59", "max_bandwidth" : 0, "start" : "00:00" } ], "complete_size" : 0, "description" : "test log", "dst_node" : { "bucket" : "dst_bucket", "region" : "cn-north-1" }, "enable_failed_object_recording" : true, "enable_kms" : true, "enable_restore" : false, "error_reason" : { "error_code" : "string", "error_msg" : "string" }, "failed_num" : 0, "failed_object_record" : { "result" : true, "list_file_key" : "string", "error_code" : "string" }, "group_id" : "string", "id" : 0, "is_query_over" : true, "left_time" : 0, "migrate_since" : 0, "migrate_speed" : 0, "name" : "string", "progress" : 0, "real_size" : 0, "skipped_num" : 0, "src_node" : { "bucket" : "src_bucket", "cloud_type" : "AWS", "region" : "cn-north-1", "app_id" : "string", "object_key" : [ "string", "string" ], "list_file" : { "list_file_key" : "object_list_file.txt", "obs_bucket" : "obs_bucket" } }, "start_time" : 0, "status" : 0, "successful_num" : 0, "task_type" : "list", "total_num" : 0, "total_size" : 0, "total_time" : 0, "smn_info" : { "notify_result" : true, "notify_error_message" : "string", "topic_name" : "string" }, "source_cdn" : { "domain" : "xxx.xxx.xxx", "protocol" : "http", "authentication_type" : "string" } }
- API
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