更新时间:2025-02-13 GMT+08:00

管理迁移任务

功能介绍

管理迁移任务,包括启动任务,暂停任务,同步任务,日志上传,回滚失败迁移任务。

调用方法

请参见如何调用API

URI

POST /v3/tasks/{task_id}/action

表1 路径参数

参数

是否必选

参数类型

描述

task_id

String

迁移任务ID

最小长度:0

最大长度:255

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

X-Auth-Token

用户Token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

最小长度:1

最大长度:16384

表3 请求Body参数

参数

是否必选

参数类型

描述

operation

String

操作任务的具体动作

start:开始任务

stop:停止任务

test:测试

clone_test:克隆测试

restart:重新开始

network_check:网络质量检测

枚举值:

  • start

  • stop

  • test

  • clone_test

  • restart

  • network_check

template_id

String

模板id

最小长度:0

最大长度:2048

switch_hce

Boolean

是否切换hce

缺省值:false

is_need_consistency_check

Boolean

是否进行一致性校验

缺省值:false

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

-

String

管理迁移任务成功

状态码:403

表5 响应Body参数

参数

参数类型

描述

error_code

String

错误代码

最小长度:0

最大长度:255

error_msg

String

错误信息

最小长度:0

最大长度:255

encoded_authorization_message

String

加密授权信息

最小长度:0

最大长度:65535

error_param

Array of strings

错误参数

最小长度:0

最大长度:65535

数组长度:1 - 20

details

Array of details objects

详细错误信息

数组长度:1 - 20

表6 details

参数

参数类型

描述

error_code

String

SMS错误代码

最小长度:0

最大长度:65535

error_msg

String

SMS错误信息

最小长度:0

最大长度:65535

请求示例

  • 管理迁移任务。操作类型是克隆时,需要指定模板id。克隆ID为7a9a9540-ff28-4869-b9e4-855fbe12xxxx的任务的目的端服务器

    POST https://{endpoint}/v3/tasks/7a9a9540-ff28-4869-b9e4-855fbe12xxxx/action
    
    {
      "operation" : "clone_test",
      "template_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001"
    }
  • 启动目的端

    POST https://{endpoint}/v3/tasks/7a9a9540-ff28-4869-b9e4-855fbe12xxxx/action
    
    {
      "operation" : "test"
    }
  • 启动ID为7a9a9540-ff28-4869-b9e4-855fbe12xxxx的任务

    POST https://{endpoint}/v3/tasks/7a9a9540-ff28-4869-b9e4-855fbe12xxxx/action
    
    {
      "operation" : "start"
    }
  • 暂停ID为7a9a9540-ff28-4869-b9e4-855fbe12xxxx的任务

    POST https://{endpoint}/v3/tasks/7a9a9540-ff28-4869-b9e4-855fbe12xxxx/action
    
    {
      "operation" : "stop"
    }
  • 重启ID为7a9a9540-ff28-4869-b9e4-855fbe12xxxx任务

    POST https://{endpoint}/v3/tasks/7a9a9540-ff28-4869-b9e4-855fbe12xxxx/action
    
    {
      "operation" : "restart"
    }

响应示例

状态码:403

鉴权失败

{
  "error_code" : "SMS.9004",
  "error_msg" : "The current account does not have the permission to execute policy You do not have permission to perform action XXX on resource XXX.",
  "encoded_authorization_message" : "XXXXXX",
  "error_param" : [ "You do not have permission to perform action XXX on resource XXX." ],
  "details" : [ {
    "error_code" : "SMS.9004",
    "error_msg" : "You do not have permission to perform action XXX on resource XXX."
  } ]
}

状态码

状态码

描述

200

管理迁移任务成功

403

鉴权失败

错误码

请参见错误码