Help Center/ Object Storage Migration Service/ API Reference/ Out-of-Date APIs/ Querying All Migration Tasks of a Tenant
Updated on 2023-12-27 GMT+08:00

Querying All Migration Tasks of a Tenant

Function

This API is used to query information about all migration tasks of a tenant.

URI

GET /v1/{project_id}/objectstorage/task?start={start}&limit={limit}&state={state}

Table 1 describes the parameters in the URI.

Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

start

Yes

Specifies the start serial number of migration tasks.

limit

Yes

Specifies the maximum number of returned tasks, which cannot exceed 100. Otherwise, the query fails.

state

No

Specifies the task status as follows:

  • 0: Not started
  • 1: Waiting to migrate
  • 2: Migrating
  • 3: Migration paused
  • 4: Migration failed
  • 5: Migration succeeded

Request

Request Parameters

None.

Response

Response Parameters

Table 2 describes the response parameters.

Table 2 Response parameters

Parameter

Type

Description

id

long

Specifies the task ID.

name

String

Specifies a task name.

src_node

JSONObject

Specifies the source node information. For details, see Table 3.

dst_node

JSONObject

Specifies the destination node information. For details, see Table 5.

thread_num

int

Specifies the number of threads used by a migration task.

status

int

Specifies the task status as follows:

  • 0: Not started
  • 1: Waiting to migrate
  • 2: Migrating
  • 3: Migration paused
  • 4: Migration failed
  • 5: Migration succeeded

progress

double

Specifies the task progress. For example, 0.522 represents the progress is 52.2%, and 1 represents the progress is 100%.

migrate_speed

long

Specifies the migration speed (byte/s).

enableKMS

boolean

Specifies whether to use KMS encryption.

description

String

Describes the migration task. This field can be left blank.

error_reason

JSONObject

Specifies the migration task failure cause. For details, see Table 8. This field is left blank when the task is not in the Migration failed state.

total_size

long

Specifies the total amount of a task.

complete_size

long

Specifies the size of a task that has been completed.

start_time

long

Specifies the start time of a task.

left_time

long

Specifies the remaining time of a task.

total_time

long

Specifies the total time used of a task.

success_num

long

Specifies the number of successfully migrated objects.

fail_num

long

Specifies the number of objects failed to be migrated.

total_num

long

Specifies the total number of migrated objects.

smnInfo

JSONObject

Specifies SMN messages. For details, see Table 6.

NOTE:

You can determine whether to enable SMN to send messages. This parameter is available only after a migration task is complete.

migrate_since

long

Specifies whether to migrate only object data that is modified after a specified time. If this function is enabled, only objects that are modified after the specified time at the source end will be migrated. The default value is 0, indicating that no time is specified.

task_type

String

Specifies the task type. The default value is object.

  • list: indicates that the system will migrate objects in an object list file.
  • object: indicates that the system will migrate the selected objects and folders.
  • prefix: indicates that the system will migrate objects with a specified prefix.

source_cdn

JSONObject

Specifies whether to enable CDN during the migration. For details, see Table 7. If CDN is enabled, the source objects to be migrated are obtained from the CDN domain name during migration. If this field is included, CDN is supported. Otherwise, CDN is not supported.

auto_restore

Boolean

Specifies whether to automatically restore archive data. IF this function is enabled, archive data is automatically restored and migrated.

enable_failed_object_recording

Boolean

Specifies whether to record objects failed to be migrated. With this function, information about the objects that fail to be migrated will be stored in the destination bucket.

failed_object_record

String

Specifies the failed data record format. The data format is JSON. For details about the value, see Table 9.

bandwidth_policy

JSONArray

Specifies traffic limiting rules. For details, see Table 10.

Table 3 src_node data structure

Parameter

Type

Description

region

String

Specifies the region where the source bucket locates.

list_file

JSONObject

Specifies the failed data record format. The data format is JSON. For details about the value, see Table 4.

object_key

JSONArray

Specifies the name of the object to be selected in the source bucket, which is in JSONArray format. Each element is the absolute path of an object.

bucket

String

Specifies the name of the source bucket.

cloud_type

String

Specifies source cloud providers.

Table 4 list_file data structure

Parameter

Type

Description

obs_bucket

String

Specifies the name of the OBS bucket for storing object list files.

list_file_key

String

Specifies the object name of the object list file.

Table 5 dst_node data structure

Parameter

Type

Description

region

String

Specifies the region where the destination bucket locates.

object_key

String

Specifies the name of the object selected in the destination bucket.

bucket

String

Specifies the name of the destination bucket.

cloud_type

String

Specifies the destination cloud service provider.

Table 6 smnInfo field description

Parameter

Type

Description

notifyResult

Boolean

Records whether messages are sent using SMN after migration tasks are complete.

notifyErrorMessage

String

Records the error code of the failure cause in sending messages using SMN. This parameter value is empty if migration tasks are successful.

topicName

String

Specifies the SMN topic name. This parameter value is empty if SMN messages are successfully sent.

Table 7 source_cdn data structure

Parameter

Type

Description

protocol

String

Specifies the protocol type. The value can be HTTPS or HTTP.

domain

String

Specifies the domain name from which to obtain objects to be migrated.

authentication_type

String

Specifies the authentication method.

  • If no authentication is required, set it to NONE.
  • Qiniu:

    QINIU_PRIVATE_AUTHENTICATION

  • Alibaba Cloud:

    ALIYUN_OSS_A, ALIYUN_OSS_B, and ALIYUN_OSS_C

  • KingsoftCloud: KSYUN_PRIVATE_AUTHENTICATION
Table 8 error_reason data structure

Parameter

Type

Description

error_code

String

Specifies the returned error code for a failed migration task.

error_msg

String

Specifies why the migration fails.

Table 9 failed_object_record field description

Parameter

Type

Description

result

Boolean

Specifies whether to support retransmission of failed objects.

list_file_key

String

Specifies the path for storing the failed object list file.

errorCode

String

Specifies the error codes configured for failed objects that cannot be retransmitted.

Table 10 bandwidth_policy data structure

Parameter

Type

Description

start

String

Specifies the start time of a traffic limiting rule. The format is hh:mm. For example, 10:03

end

String

Specifies the end time of a traffic limiting rule. The format is the same as that of the start time.

max_bandwidth

int

Specifies the maximum bandwidth allowed (byte/s) in a time segment.

Examples

Request example

GET /v1/{project_id}/objectstorage/task?start=0&limit=10&state=0

Response example

{
	"id": 1,
	"name": "bucket3-bucket3-20161027211637786_544",
	"src_node": {
		"region": "us-east-1",
		"bucket": "bucket3",
		"object_key": ["log/object1", "log/object2"]
	},
	"dst_node": {
		"region": "xxx",
		"bucket": "bucket3",
		"object_key": "/"
	},
	"thread_num": 50,
	"status": 5,
	"progress": 1,
	"total_num": 2000,
	"success_num": 200,
	"fail_num": 0,
	"migrate_speed": 7213154,
	"enableKMS": true,
	"description": "ZXCZCZXCDVXVC",
	"error_reason": "",
	"total_size": 2000000000,
	"complete_size": 2000000000,
	"start_time": 1477574224062,
	"left_time": 0,
	"total_time": 88124,
	"smnInfo": {
		"notifyResult": false,
		"notifyErrorMessage": "S3M.0156",
		"topicName": "Test"
	},
	"enable_failed_object_recording": true,
	"failed_object_record": "{"
	result ": true, "
	list_file_key ": "
	oms / failed_object_lists / 180840792025063 / failed - objects - list.txt "}"
}, {
	"id": 2,
	"name": "bucket3-bucket3-20161027211637786_545",
	"src_node": {
		"region": "us-east-1",
		"bucket": "bucket3",
		"object_key": ["log/object1", "log/object2"],
		"cloud_type": "xxx"
	},
	"dst_node": {
		"region": "xxx",
		"bucket": "bucket3",
		"object_key": "/",
		"cloud_type": "HEC"
	},
	"thread_num": 50,
	"status": 5,
	"progress": 1,
	"total_num": 2000,
	"success_num": 200,
	"fail_num": 0,
	"migrate_speed": 7213154,
	"enableKMS": true,
	"description": "ZXCZCZXCDVXVC",
	"error_reason": "",
	"total_size": 2000000000,
	"complete_size": 2000000000,
	"start_time": 1477574224062,
	"left_time": 0,
	"total_time": 88124,
	"smnInfo": {
		"notifyResult": false,
		"notifyErrorMessage": "S3M.0156",
		"topicName": "Test"
	},
	"migrate_since": 123456789,
        "source_cdn": {
		"protocol": "https",
		"domain": "xxx.xxx.xxx",
		"authentication_type": "NONE"
	},
        "bandwidth_policy": [ 
        { 
                "start": "00:00", 
                "end": "23:59", 
                "max_bandwidth": 50000000
        }
       ]
}

Status Code

For details about the status code, see Status Code.