闪电立方 - hcs-mgw CLI 命令参考
本文列出闪电立方 - hcs-mgw 在阿里云 CLI 中的可用命令,并提供各命令的语法和参数说明。
前提条件
地域与接入点
凭证配置中的默认地域可用 --region <regionId> 覆盖。
未指定接入地址时,CLI 按产品规则尝试解析,需要指定时可按地域和网络类型查看 Endpoint,再使用 --endpoint <endpoint>。
版本信息
属性 | 值 |
CLI 版本 | 3.5.4 |
API 版本 | 2024-06-26 |
可用命令
单击命令名称,查看命令描述、语法和参数说明。
任务
命令 | 说明 |
创建迁移任务 | |
创建迁移报告 | |
删除迁移任务 | |
获取迁移任务详情 | |
当迁移任务有失败文件时,获取失败文件是否能重试的信息 | |
获取迁移报告详情 | |
列举用户在该区域下的迁移任务 | |
列举迁移任务运行历史 | |
创建任务后,您可以通过该方法来启动任务、暂停任务以及关闭任务,也可以通过该方法来调整任务限流信息 |
数据地址
命令 | 说明 |
创建数据地址 | |
删除数据地址 | |
获取数据地址详情 | |
列举用户在该区域下的数据地址 | |
更新数据地址 | |
校验数据地址是否可用 |
代理
命令 | 说明 |
创建代理 | |
删除代理 | |
获取代理详情 | |
获取代理运行状态 | |
列举用户在该区域下的代理 |
通道
命令 | 说明 |
创建通道 | |
删除通道 | |
获取通道详情 | |
列举通道 | |
更新通道 |
命令详情
语法逐行列出命令参数:<类型> 是需要替换的值占位符,方括号表示可选参数,# 表示列表项序号;[options] 表示 CLI 通用选项,见“全局选项”。可选对象或列表内标为必填的字段,仅在提供该对象或列表项时必填。完整参数定义见各命令的参数说明。
CreateAddress
命令描述
创建数据地址
contentType:application/json
HTTP 方法:POST
protocol:HTTPS
requestBodyType:json
url:/address
语法
aliyun hcs-mgw CreateAddress
[--body <object>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--body | Object | 否 | 创建数据地址请求体 |
示例
aliyun hcs-mgw POST /address --region cn-hangzhou --body '{"AddressDetail":{"InvRegionId":"oss-cn-hangzhou","InvRole":"test_inv_role","HdfsAuthConfig":{"UserName":"example-string","AuthType":"example-string"},"InvDomain":"test_inv_domain","AgentList":"agent1,agent2","Prefix":"test_prefix","InvAccessId":"test_inv_access_id","InvAccessSecret":"test_inv_secret_key","Role":"test_role","AccessSecret":"test_secret_key","Bucket":"test_bucket","AccessId":"test_access_id","InvPath":"manifest.json","InvBucket":"test_inv_bucket","DataType":"oss","RegionId":"cn-hangzhou","AddressType":"oss","Domain":"test_domain","InvLocation":"oss"},"Tags":"K1:V1,K2:V2","Name":"test_name"}' --version 2024-06-26 --force
CreateAgent
命令描述
创建代理
contentType:application/json
HTTP 方法:POST
protocol:HTTPS
requestBodyType:json
url:/agent
语法
aliyun hcs-mgw CreateAgent
[--body <object>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--body | Object | 否 | 创建代理请求体 |
示例
aliyun hcs-mgw POST /agent --region cn-hangzhou --body '{"DeployMethod":"default","AgentEndpoint":"vpc","TunnelId":"test_tunnel_id","Tags":"K1:V1,K2:V2","Name":"test_name"}' --version 2024-06-26 --force
CreateJob
命令描述
创建迁移任务
contentType:application/json
HTTP 方法:POST
protocol:HTTPS
requestBodyType:json
url:/job
语法
aliyun hcs-mgw CreateJob
[--body <object>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--body | Object | 否 | 创建迁移任务请求体 |
示例
aliyun hcs-mgw POST /job --region cn-hangzhou --body '{"OverwriteMode":"always","AppendableToNormal":false,"WithStorageClass":false,"ConvertSymlinkTarget":false,"TransferMode":"all","FilterRule":{"FileTypeFilters":{"ExcludeSymlink":false,"ExcludeDir":false},"KeyFilters":{"Includes":{"Regex":[".0_.jpg"]},"Excludes":{"Regex":[".0_.jpg"]}},"LastModifiedFilters":{"Includes":{"TimeFilter":[{"EndTime":"2006-12-31T59:59:59Z","StartTime":"2006-01-01T00:00:00Z"}]},"Excludes":{"TimeFilter":[{"EndTime":"2006-12-31T59:59:59Z","StartTime":"2006-01-01T00:00:00Z"}]}},"PrefixFilters":{"Includes":{"Prefix":["source-prefix/dir-a/"]}}},"EnableMultiVersioning":false,"WithLastModifyTime":true,"Name":"test_name","Audit":{"LogMode":"off"},"ImportQos":{"MaxBandWidth":1073741824,"MaxImportTaskQps":1000},"ScheduleRule":{"SuspendCronExpression":"0_0_0_0_0_0","MaxScheduleCount":1,"StartCronExpression":"0_0_0_0_0_0"},"CreateReport":true,"TargetStorageClass":"Standard","SrcAddress":"test_src_address","DestAddress":"test_dest_address","Tags":"K1:V1,K2:V2","ParentVersion":"6af62558-970d-4f44-8663-4e297170fd6a"}' --version 2024-06-26 --force
CreateReport
命令描述
创建迁移报告
contentType:application/json
HTTP 方法:POST
protocol:HTTPS
requestBodyType:json
url:/report
语法
aliyun hcs-mgw CreateReport
[--body <object>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--body | Object | 否 | 创建迁移报告请求体 |
示例
aliyun hcs-mgw POST /report --region cn-hangzhou --body '{"Version":"test_job_id","JobName":"test_job_name","RuntimeId":1}' --version 2024-06-26 --force
CreateTunnel
命令描述
创建通道
contentType:application/json
HTTP 方法:POST
protocol:HTTPS
requestBodyType:json
url:/tunnel
语法
aliyun hcs-mgw CreateTunnel
[--body <object>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--body | Object | 否 | 创建通道请求体 |
示例
aliyun hcs-mgw POST /tunnel --region cn-hangzhou --body '{"Tags":"K1:V1,K2:V2","TunnelQos":{"MaxQps":100,"MaxBandwidth":1073741824}}' --version 2024-06-26 --force
DeleteAddress
命令描述
删除数据地址
HTTP 方法:DELETE
protocol:HTTPS
url:/address/{addressName}
语法
aliyun hcs-mgw DeleteAddress
--addressName <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--addressName | String | 是 | 数据地址名称 |
示例
aliyun hcs-mgw DELETE /address/test_address_name --region cn-hangzhou --header "Content-Type=application/json" --version 2024-06-26 --force
DeleteAgent
命令描述
删除代理
HTTP 方法:DELETE
protocol:HTTPS
url:/agent/{agentName}
语法
aliyun hcs-mgw DeleteAgent
--agentName <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--agentName | String | 是 | 代理名称 |
示例
aliyun hcs-mgw DELETE /agent/test_agent_name --region cn-hangzhou --header "Content-Type=application/json" --version 2024-06-26 --force
DeleteJob
命令描述
删除迁移任务
HTTP 方法:DELETE
protocol:HTTPS
url:/job/{jobName}
语法
aliyun hcs-mgw DeleteJob
[--forceDelete <bool>]
--jobName <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--forceDelete | Boolean | 否 | 是否强制删除子任务。如果该任务有子任务,指定为true,会强制删除该任务以及它的子任务,指定为false,会删除失败 |
--jobName | String | 是 | 任务名称 |
示例
aliyun hcs-mgw DELETE /job/test_job_name --region cn-hangzhou --header "Content-Type=application/json" --version 2024-06-26 --force
DeleteTunnel
命令描述
删除通道
HTTP 方法:DELETE
protocol:HTTPS
url:/tunnel/{tunnelId}
语法
aliyun hcs-mgw DeleteTunnel
--tunnelId <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--tunnelId | String | 是 | 通道ID |
示例
aliyun hcs-mgw DELETE /tunnel/test_tunnel_id --region cn-hangzhou --header "Content-Type=application/json" --version 2024-06-26 --force
GetAddress
命令描述
获取数据地址详情
HTTP 方法:GET
protocol:HTTPS
url:/address/{addressName}
语法
aliyun hcs-mgw GetAddress
--addressName <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--addressName | String | 是 | 数据地址名称 |
示例
aliyun hcs-mgw GET /address/test_address_name --region cn-hangzhou --header "Content-Type=application/json" --version 2024-06-26 --force
GetAgent
命令描述
获取代理详情
HTTP 方法:GET
protocol:HTTPS
url:/agent/{agentName}
语法
aliyun hcs-mgw GetAgent
--agentName <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--agentName | String | 是 | 代理名称 |
示例
aliyun hcs-mgw GET /agent/teast_agent_name --region cn-hangzhou --header "Content-Type=application/json" --version 2024-06-26 --force
GetAgentStatus
命令描述
获取代理运行状态
HTTP 方法:GET
protocol:HTTPS
url:/agent/{agentName}?status
语法
aliyun hcs-mgw GetAgentStatus
--agentName <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--agentName | String | 是 | 代理名称 |
示例
aliyun hcs-mgw GET /agent/test_agent_name?status --region cn-hangzhou --header "Content-Type=application/json" --version 2024-06-26 --force
GetJob
命令描述
获取迁移任务详情
HTTP 方法:GET
protocol:HTTPS
url:/job/{jobName}
语法
aliyun hcs-mgw GetJob
[--byVersion <string>]
--jobName <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--byVersion | String | 否 | 是否使用任务ID获取 |
--jobName | String | 是 | 任务名称,如果byVersion为true,该参数表示任务ID |
示例
aliyun hcs-mgw GET /job/test_job_name --region cn-hangzhou --header "Content-Type=application/json" --version 2024-06-26 --force
GetJobResult
命令描述
当迁移任务有失败文件时,获取失败文件是否能重试的信息
HTTP 方法:GET
protocol:HTTPS
url:/job/{jobName}?jobResult
语法
aliyun hcs-mgw GetJobResult
--jobName <string>
--runtimeId <int>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--jobName | String | 是 | 任务名称 |
--runtimeId | Integer | 是 | 任务执行ID |
示例
aliyun hcs-mgw GET /job/test_job_name?jobResult --region cn-hangzhou --runtimeId 1 --header "Content-Type=application/json" --version 2024-06-26 --force
GetReport
命令描述
获取迁移报告详情
HTTP 方法:GET
protocol:HTTPS
url:/report
语法
aliyun hcs-mgw GetReport
[--runtimeId <int>]
--version <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--runtimeId | Integer | 否 | 迁移任务执行ID |
--version | String | 是 | 迁移任务ID |
示例
aliyun hcs-mgw GET /report --region cn-hangzhou --version test_job_id --header "Content-Type=application/json" --version 2024-06-26 --force
GetTunnel
命令描述
获取通道详情
HTTP 方法:GET
protocol:HTTPS
url:/tunnel/{tunnelId}
语法
aliyun hcs-mgw GetTunnel
--tunnelId <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--tunnelId | String | 是 | 通道ID |
示例
aliyun hcs-mgw GET /tunnel/test_tunnel_id --region cn-hangzhou --header "Content-Type=application/json" --version 2024-06-26 --force
ListAddress
命令描述
列举用户在该区域下的数据地址
HTTP 方法:GET
protocol:HTTPS
url:/addresslist
语法
aliyun hcs-mgw ListAddress
[--count <int>]
[--marker <string>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--count | Integer | 否 | 指定返回迁移地址的数量。 |
--marker | String | 否 | 设定从该marker之后列举迁移地址。 |
示例
aliyun hcs-mgw GET /addresslist --region cn-hangzhou --marker test_marker --count 100 --header "Content-Type=application/json" --version 2024-06-26 --force
ListAgent
命令描述
列举用户在该区域下的代理
HTTP 方法:GET
protocol:HTTPS
url:/agentlist
语法
aliyun hcs-mgw ListAgent
[--count <int>]
[--marker <string>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--count | Integer | 否 | 指定返回代理的数量。 |
--marker | String | 否 | 设定从该marker之后列举代理。 |
示例
aliyun hcs-mgw GET /agentlist --region cn-hangzhou --marker test_agent --count 100 --header "Content-Type=application/json" --version 2024-06-26 --force
ListJob
命令描述
列举用户在该区域下的迁移任务
HTTP 方法:GET
protocol:HTTPS
url:/joblist
语法
aliyun hcs-mgw ListJob
[--all <bool>]
[--count <int>]
[--marker <string>]
[--parentName <string>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--all | Boolean | 否 | 是否返回子任务。 |
--count | Integer | 否 | 指定返回迁移任务的数量。 |
--marker | String | 否 | 设定从该marker之后列举迁移任务。 |
--parentName | String | 否 | 父任务名称。指定该参数时,会返回所有该父任务的子任务 |
示例
aliyun hcs-mgw GET /joblist --region cn-hangzhou --all true --parentName test_parent_job_name --marker test_marker --count 1000 --header "Content-Type=application/json" --version 2024-06-26 --force
ListJobHistory
命令描述
列举迁移任务运行历史
HTTP 方法:GET
protocol:HTTPS
url:/jobhistory/{jobName}
语法
aliyun hcs-mgw ListJobHistory
[--count <int>]
--jobName <string>
[--marker <string>]
[--runtimeId <int>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--count | Integer | 否 | 指定返回迁移任务历史的数量。 |
--jobName | String | 是 | 任务名称 |
--marker | String | 否 | 设定从该marker之后列举任务运行历史。 |
--runtimeId | Integer | 否 | 任务执行ID。指定执行ID,只会list该执行ID的运行历史 |
示例
aliyun hcs-mgw GET /jobhistory/test_job_name --region cn-hangzhou --header "Content-Type=application/json" --version 2024-06-26 --force
ListTunnel
命令描述
列举通道
HTTP 方法:GET
protocol:HTTPS
url:/tunnellist
语法
aliyun hcs-mgw ListTunnel
[--count <int>]
[--marker <string>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--count | Integer | 否 | 指定返回通道的数量。 |
--marker | String | 否 | 设定从该marker之后列举通道。 |
示例
aliyun hcs-mgw GET /tunnellist --region cn-hangzhou --marker test_marker --count 100 --header "Content-Type=application/json" --version 2024-06-26 --force
UpdateAddress
命令描述
更新数据地址
contentType:application/json
HTTP 方法:PUT
protocol:HTTPS
requestBodyType:json
url:/address/{addressName}
语法
aliyun hcs-mgw UpdateAddress
--addressName <string>
[--body <object>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--addressName | String | 是 | 数据地址名称 |
--body | Object | 否 | 更新数据地址请求体 |
示例
aliyun hcs-mgw PUT /address/test_address_name --region cn-hangzhou --header "Content-Type=application/json" --version 2024-06-26 --force
UpdateJob
命令描述
创建任务后,您可以通过该方法来启动任务、暂停任务以及关闭任务,也可以通过该方法来调整任务限流信息
contentType:application/json
HTTP 方法:PUT
protocol:HTTPS
requestBodyType:json
url:/job/{jobName}
语法
aliyun hcs-mgw UpdateJob
[--body <object>]
--jobName <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--body | Object | 否 | 更新任务请求体 |
--jobName | String | 是 | 任务名称 |
示例
aliyun hcs-mgw PUT /job/test_job_name --region cn-hangzhou --header "Content-Type=application/json" --version 2024-06-26 --force
UpdateTunnel
命令描述
更新通道
contentType:application/json
HTTP 方法:PUT
protocol:HTTPS
requestBodyType:json
url:/tunnel/{tunnelId}
语法
aliyun hcs-mgw UpdateTunnel
[--body <object>]
--tunnelId <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--body | Object | 否 | 更新通道请求体 |
--tunnelId | String | 是 | 通道ID |
示例
aliyun hcs-mgw PUT /tunnel/test_tunnel_id --region cn-hangzhou --header "Content-Type=application/json" --version 2024-06-26 --force
VerifyAddress
命令描述
校验数据地址是否可用
HTTP 方法:GET
protocol:HTTPS
url:/address/{addressName}?verify
语法
aliyun hcs-mgw VerifyAddress
--addressName <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--addressName | String | 是 | 数据地址名称 |
示例
aliyun hcs-mgw GET /address/test_address_name?verify --region cn-hangzhou --header "Content-Type=application/json" --version 2024-06-26 --force
全局选项
以下为 CLI 通用选项,各选项的适用范围以说明为准。
选项 | 说明 |
--cli-dry-run | 使用 |
--cli-input-json | 使用 |
--cli-output | 设置宿主 CLI Help、本地错误和更新检查的输出格式(json) |
--cli-query | 使用 |
--cli-sign-version | 短横线命令的 OpenAPI 签名版本:当前仅支持 v4;设为空值可清空并恢复默认签名( |
--language | 使用 |
--output -o | 使用 |
--profile -p | 使用 |
--region | 使用 |
--version --api-version | 使用 |
--yes -y | 跳过安全策略的确认提示(用于非交互式/Agent 场景) |