数据灾备中心 - bdrc CLI 命令参考
本文列出数据灾备中心 - bdrc 在阿里云 CLI 中的可用命令,并提供各命令的语法和参数说明。
前提条件
地域与接入点
凭证配置中的默认地域可用 --region <regionId> 覆盖。
未指定接入地址时,CLI 按产品规则尝试解析,需要指定时可按地域和网络类型查看 Endpoint,再使用 --endpoint <endpoint>。
版本信息
属性 | 值 |
CLI 版本 | 3.5.4 |
API 版本 | 2023-08-08 |
可用命令
单击命令名称,查看命令描述、语法和参数说明。
资源分类管理
命令 | 说明 |
创建资源分类 | |
删除资源分类 | |
获取单个资源分类 | |
获取资源分类列表 | |
更新资源分类 |
消息中心
命令 | 说明 |
获取单个消息 | |
批量查询消息 |
保护策略中心
命令 | 说明 |
创建保护策略 | |
删除保护策略 | |
获取保护策略 | |
获取保护策略列表 | |
获取保护策略应用历史 | |
更新保护策略 |
资源中心
命令 | 说明 |
检查数据保护评分规则。调用该接口将会触发一个异步任务来检查您的资源是否满足数据保护评分的要求 | |
查询数据保护规则检查结果 | |
查询云产品数据冗余类型统计信息 | |
查询云产品的数据保护评分状态 | |
查询资源列表 | |
查询数据保护规则列表 | |
查询风险最多的资源列表 | |
关闭云产品的数据保护评分 | |
关闭资源的数据保护评分 | |
开启云产品的数据保护评分 | |
开启单个资源的数据保护评分 | |
更新资源列表。调用该接口后,将会触发一个异步任务来更新您的资源列表和数据保护评分 |
跨账号统一管理
命令 | 说明 |
开启跨账号管理,只有BDRC委派管理员能够调用,会启用资源目录侧的可信服务 | |
查询跨账号纳管关系列表 | |
只有BDRC委派管理员能够调用,增量更新跨账号纳管关系 |
其他
命令 | 说明 |
关闭数据灾备中心 | |
查询地域列表。BDRC本身是中心化的产品,接口用于部分与Region相关的功能使用 | |
查询异步任务详情 | |
查询异步任务列表 | |
查询数据灾备中心状态 | |
开启数据灾备中心 | |
预检查资源数量 |
命令详情
语法逐行列出命令参数:<类型> 是需要替换的值占位符,方括号表示可选参数,# 表示列表项序号;[options] 表示 CLI 通用选项,见“全局选项”。可选对象或列表内标为必填的字段,仅在提供该对象或列表项时必填。完整参数定义见各命令的参数说明。
CheckRules
命令描述
检查数据保护评分规则。调用该接口将会触发一个异步任务来检查您的资源是否满足数据保护评分的要求
contentType:application/x-www-form-urlencoded
HTTP 方法:POST
protocol:HTTPS
requestBodyType:formData
url:/api/v1/rules/check
语法
aliyun bdrc CheckRules
--ResourceArn <string>
[--RuleId <string>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--ResourceArn | String | 是 | 资源唯一标识。必填。支持使用英文逗号(,)分隔传入多个资源ARN |
--RuleId | String | 否 | 需要检查的规则ID,不填代表检查所有规则 |
示例
aliyun bdrc POST /api/v1/rules/check --region cn-hangzhou --header "Content-Type=application/x-www-form-urlencoded" --body ResourceArn=acs:ecs:123000890:cn-shanghai:instance/i-00100090
CloseBdrcService
命令描述
关闭数据灾备中心
HTTP 方法:POST
protocol:HTTPS
url:/api/v1/service/close
语法
aliyun bdrc CloseBdrcService
[options]
参数
该命令没有专属参数。CLI 通用选项见“全局选项”。
示例
aliyun bdrc POST /api/v1/service/close --region cn-hangzhou --header "Content-Type=application/json"
CreateProtectionPolicy
命令描述
创建保护策略
contentType:application/x-www-form-urlencoded
HTTP 方法:POST
protocol:HTTPS
requestBodyType:formData
url:/api/v1/protection-policies
语法
aliyun bdrc CreateProtectionPolicy
[--BoundResourceCategoryIds <array>]
[--ClientToken <string>]
--ProtectionPolicyName <string>
--ProtectionPolicyRegionId <string>
--SubProtectionPolicies <array>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--BoundResourceCategoryIds | List | 否 | 关联的资源分类ID |
--ClientToken | String | 否 | 客户端Token,用于保证请求的幂等性。 |
--ProtectionPolicyName | String | 是 | 保护策略名 |
--ProtectionPolicyRegionId | String | 是 | 保护策略地域ID |
--SubProtectionPolicies | List | 是 | 子保护策略 |
示例
aliyun bdrc POST /api/v1/protection-policies --region cn-hangzhou --header "Content-Type=application/x-www-form-urlencoded" --body ProtectionPolicyRegionId=cn-hangzhou&ProtectionPolicyName=My000Policy&SubProtectionPolicies=[{Config=PlaybookUuid_:_2093d1ea-0651-48a6-bea2-fa7157285dc1_,_ParamType_:_custom_,_InputParams_:,SubProtectionPolicyType=ECS_AUTO_SNAPSHOT_POLICY}]
CreateResourceCategory
命令描述
创建资源分类
contentType:application/x-www-form-urlencoded
HTTP 方法:POST
protocol:HTTPS
requestBodyType:formData
url:/api/v1/resource-categories/create
语法
aliyun bdrc CreateResourceCategory
--ResourceCategoryName <string>
--ResourceMatcher <string>
[--ResourceType <string>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--ResourceCategoryName | String | 是 | 资源分类名。必填 |
--ResourceMatcher | String | 是 | 资源匹配器。必填。JSON格式的匹配规则,支持TAG(标签)条件与BOOL(布尔)组合:TAG条件支持EQUAL(标签键值相等)、KEY_EXIST(标签键存在)、KEY_EXIST_NOT_EQUAL(标签键存在但值不相等)三种操作符;BOOL条件仅支持AND操作符,表示所有子条件均需匹配 |
--ResourceType | String | 否 | 资源类型。可选。指定后,该资源分类仅匹配该类型的资源;不填则不限制资源类型,匹配器可匹配所有类型的资源
|
示例
aliyun bdrc POST /api/v1/resource-categories/create --region cn-hangzhou --header "Content-Type=application/x-www-form-urlencoded" --body ResourceCategoryName=My000ResourceCategory&ResourceMatcher=type_:_BOOL_,_operator_:_AND_,_values_:_type_:_TAG_,_operator_:_EQUAL_,_key_:_key0_,_values_:_value0_,_type_:_TAG_,_operator_:_KEY_EXIST_,_key_:_key1_,_type_:_TAG_,_operator_:_KEY_EXIST_NOT_EQUAL_,_key_:_key2_,_values_:_value2-wrong
DeleteProtectionPolicy
命令描述
删除保护策略
HTTP 方法:DELETE
protocol:HTTPS
url:/api/v1/protection-policies/{ProtectionPolicyId}
语法
aliyun bdrc DeleteProtectionPolicy
--ProtectionPolicyId <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--ProtectionPolicyId | String | 是 | 保护策略ID |
示例
aliyun bdrc DELETE /api/v1/protection-policies/p-1230007890 --region cn-hangzhou --header "Content-Type=application/json"
DeleteResourceCategory
命令描述
删除资源分类
contentType:application/x-www-form-urlencoded
HTTP 方法:POST
protocol:HTTPS
requestBodyType:formData
url:/api/v1/resource-categories/delete
语法
aliyun bdrc DeleteResourceCategory
--ResourceCategoryId <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--ResourceCategoryId | String | 是 | 资源分类ID |
示例
aliyun bdrc POST /api/v1/resource-categories/delete --region cn-hangzhou --header "Content-Type=application/x-www-form-urlencoded" --body ResourceCategoryId=rc-12300007890
DescribeCheckDetails
命令描述
查询数据保护规则检查结果
HTTP 方法:GET
protocol:HTTPS
url:/api/v1/check-details
语法
aliyun bdrc DescribeCheckDetails
[--MaxResults <int>]
[--NextToken <string>]
--ResourceArn <string>
[--RuleId <string>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--MaxResults | Integer | 否 | 分页查询时每页的最大条目数。默认值为10
|
--NextToken | String | 否 | 查询凭证(Token),取值为上一次API调用返回的NextToken参数值。有关本接口查看返回数据的设置方式,请参见上文接口说明 |
--ResourceArn | String | 是 | 资源唯一标识 |
--RuleId | String | 否 | 数据保护规则唯一标识。可选。不填则不按规则过滤 |
示例
aliyun bdrc GET /api/v1/check-details --region cn-hangzhou --ResourceArn 'acs:ecs:123000890:cn-shanghai:instance/i-00100090' --header "Content-Type=application/json"
DescribeProductDataRedundancyTypeStat
命令描述
查询云产品数据冗余类型统计信息
HTTP 方法:GET
protocol:HTTPS
url:/api/v1/products/data-redundancy-type-stat
语法
aliyun bdrc DescribeProductDataRedundancyTypeStat
--ProductType <string>
[--ResourceCategoryId <string>]
[--ResourceOwnerIds <array>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--ProductType | String | 是 | 云产品类型 |
--ResourceCategoryId | String | 否 | 资源分类 ID。过滤指定资源分类的资源计算结果,不填则不过滤。支持使用英文逗号(,)分隔传入多个资源分类 ID |
--ResourceOwnerIds | List | 否 | 资源所有者 ID 列表,在跨账号统一管理中使用。过滤指定账号的资源计算结果,不填则获取当前登录账号的数据 |
示例
aliyun bdrc GET /api/v1/products/data-redundancy-type-stat --region cn-hangzhou --ProductType oss --header "Content-Type=application/json"
DescribeProducts
命令描述
查询云产品的数据保护评分状态
HTTP 方法:GET
protocol:HTTPS
url:/api/v1/products
语法
aliyun bdrc DescribeProducts
[--ProductType <string>]
[--ResourceCategoryId <string>]
[--ResourceOwnerIds <array>]
[--ResourceRegionId <string>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--ProductType | String | 否 | 资源所属产品。过滤指定产品的资源计算结果,不填则不过滤 |
--ResourceCategoryId | String | 否 | 资源分类ID。过滤指定资源分类的资源计算结果,不填则不过滤。支持使用英文逗号(,)分隔传入多个资源分类ID |
--ResourceOwnerIds | List | 否 | 资源所有者 ID 列表,在跨账号统一管理中使用。过滤指定账号的资源计算结果,不填则获取当前登录账号的数据 |
--ResourceRegionId | String | 否 | 资源所在地域ID。过滤指定地域的资源计算结果,不填则不过滤。支持使用英文逗号(,)分隔传入多个地域ID |
示例
aliyun bdrc GET /api/v1/products --region cn-hangzhou --ResourceCategoryId 'rc-000000123' --ResourceRegionId 'cn-shanghai' --ResourceOwnerIds '[1230007890]' --ProductType oss --header "Content-Type=application/json"
DescribeRegions
命令描述
查询地域列表。BDRC本身是中心化的产品,接口用于部分与Region相关的功能使用
HTTP 方法:GET
protocol:HTTPS
url:/api/v1/regions
语法
aliyun bdrc DescribeRegions
[options]
参数
该命令没有专属参数。CLI 通用选项见“全局选项”。
示例
aliyun bdrc GET /api/v1/regions --region cn-hangzhou --header "Content-Type=application/json"
DescribeResources
命令描述
查询资源列表
HTTP 方法:GET
protocol:HTTPS
url:/api/v1/resources
语法
aliyun bdrc DescribeResources
[--DataRedundancyType <string>]
[--FailedRuleTemplate <string>]
[--MaxResults <int>]
[--NextToken <string>]
[--ResourceArn <string>]
[--ResourceCategoryId <string>]
[--ResourceId <string>]
[--ResourceOwnerIds <array>]
[--ResourceRegionId <string>]
[--ResourceType <string>]
[--SortBy <string>]
[--SortOrder <string>]
[--StorageClass <string>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--DataRedundancyType | String | 否 | 数据冗余类型
|
--FailedRuleTemplate | String | 否 | 评分失败的规则过滤 |
--MaxResults | Integer | 否 | 分页查询时每页行数。最大值为100。默认值:当不设置值或设置的值小于10时,默认值为10。当设置的值大于100时,默认值为100
|
--NextToken | String | 否 | 分页游标,如果有下一页,则该字段有返回值。说明 该参数只要返回数据,则说明还有下一页。您可以将返回的NextToken作为请求参数再次获得下一页的数据,直到返回为Null,表示获取到了所有的数据 |
--ResourceArn | String | 否 | 资源ARN。支持使用英文逗号(,)分隔传入多个资源ARN |
--ResourceCategoryId | String | 否 | 资源分类ID。支持使用英文逗号(,)分隔传入多个资源分类ID |
--ResourceId | String | 否 | 资源ID。例如,当待查询的资源为实例时,可以理解为InstanceId |
--ResourceOwnerIds | List | 否 | 资源所有者ID列表,在跨账号场景使用,置空时默认获取当前账号的数据 |
--ResourceRegionId | String | 否 | 资源地域ID |
--ResourceType | String | 否 | 资源类型
|
--SortBy | String | 否 | 排序方式 |
--SortOrder | String | 否 | ASC: 升序, DESC: 降序
|
--StorageClass | String | 否 | 存储类型
|
示例
aliyun bdrc GET /api/v1/resources --region cn-hangzhou --FailedRuleTemplate 'rule-000c000yc9' --ResourceCategoryId 'rc-000000123' --ResourceRegionId 'cn-hangzhou' --NextToken cae0000000000699 --SortBy protectionScore --StorageClass ARCHIVE --MaxResults 10 --DataRedundancyType LRS --SortOrder ASC --ResourceType 'ACS::ECS::Instance' --ResourceArn 'acs:ecs:cn-hangzhou:1230007890:instance/i-1230007890' --ResourceId 'i-0003000110' --ResourceOwnerIds '[1230007890]' --header "Content-Type=application/json"
DescribeRules
命令描述
查询数据保护规则列表
HTTP 方法:GET
protocol:HTTPS
url:/api/v1/rules
语法
aliyun bdrc DescribeRules
[--MaxResults <int>]
[--NextToken <string>]
[--ResourceCategoryId <string>]
[--ResourceOwnerIds <array>]
[--ResourceRegionId <string>]
[--ResourceType <string>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--MaxResults | Integer | 否 | 分页查询时每页的最大条目数。最大值为50。默认值为10
|
--NextToken | String | 否 | 是否拥有下一次查询的令牌(Token)。取值:如果NextToken为空表示没有下一次查询。 如果NextToken有返回值,该取值表示下一次查询开始的令牌 |
--ResourceCategoryId | String | 否 | 资源分类 ID。过滤指定资源分类的资源计算结果,不填则不过滤。支持使用英文逗号(,)分隔传入多个资源分类 ID |
--ResourceOwnerIds | List | 否 | 资源所有者 ID 列表,在跨账号统一管理中使用。过滤指定账号的资源计算结果,不填则获取当前登录账号的数据 |
--ResourceRegionId | String | 否 | 资源所在地域 ID。过滤指定地域的资源计算结果,不填则不过滤。支持使用英文逗号(,)分隔传入多个地域 ID |
--ResourceType | String | 否 | 资源类型
|
示例
aliyun bdrc GET /api/v1/rules --region cn-hangzhou --ResourceCategoryId 'rc-000000123' --ResourceRegionId 'cn-hangzhou' --NextToken cae0000000000699 --ResourceOwnerIds '[1230007890]' --MaxResults 10 --ResourceType 'ACS::ECS::Instance' --header "Content-Type=application/json"
DescribeTask
命令描述
查询异步任务详情
HTTP 方法:GET
protocol:HTTPS
url:/api/v1/tasks/{TaskId}
语法
aliyun bdrc DescribeTask
--TaskId <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--TaskId | String | 是 | 任务ID。您可以调用DescribeTasks查看任务ID |
示例
aliyun bdrc GET /api/v1/tasks/t-0004d9ctt1ii00000000 --region cn-hangzhou --header "Content-Type=application/json"
DescribeTasks
命令描述
查询异步任务列表
HTTP 方法:GET
protocol:HTTPS
url:/api/v1/tasks
语法
aliyun bdrc DescribeTasks
[--MaxResults <int>]
[--NextToken <string>]
[--TaskStatus <string>]
[--TaskType <string>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--MaxResults | Integer | 否 | 返回的最大数。取值范围:10~500。默认值:当不设置值或者设置的值小于10,默认值为10。当设置的值大于500时,默认值为500
|
--NextToken | String | 否 | 查询凭证(Token),取值为上一次API调用返回的NextToken参数值。有关本接口查看返回数据的设置方式,请参见上文接口说明 |
--TaskStatus | String | 否 | 任务状态
|
--TaskType | String | 否 | 任务类型。支持使用英文逗号(,)分隔传入多个任务类型 |
示例
aliyun bdrc GET /api/v1/tasks --region cn-hangzhou --NextToken cae0000000000699 --MaxResults 10 --TaskType UPDATE_RESOURCES --TaskStatus RUNNING --header "Content-Type=application/json"
DescribeTopRiskyResources
命令描述
查询风险最多的资源列表
HTTP 方法:GET
protocol:HTTPS
url:/api/v1/resources/top-risky
语法
aliyun bdrc DescribeTopRiskyResources
[--ResourceCategoryId <string>]
[--ResourceOwnerIds <array>]
[--ResourceType <string>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--ResourceCategoryId | String | 否 | 资源分类 ID。过滤指定资源分类的资源计算结果,不填则不过滤。支持使用英文逗号(,)分隔传入多个资源分类 ID |
--ResourceOwnerIds | List | 否 | 资源所有者 ID 列表,在跨账号统一管理中使用。过滤指定账号的资源计算结果,不填则获取当前登录账号的数据 |
--ResourceType | String | 否 | 资源类型
|
示例
aliyun bdrc GET /api/v1/resources/top-risky --region cn-hangzhou --ResourceCategoryId 'rc-000000123' --ResourceOwnerIds '[1230007890]' --ResourceType 'ACS::ECS::Instance' --header "Content-Type=application/json"
DisableCheckProduct
命令描述
关闭云产品的数据保护评分
contentType:application/x-www-form-urlencoded
HTTP 方法:POST
protocol:HTTPS
requestBodyType:formData
url:/api/v1/products/disable-check
语法
aliyun bdrc DisableCheckProduct
--ProductType <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--ProductType | String | 是 | 产品类型
|
示例
aliyun bdrc POST /api/v1/products/disable-check --region cn-hangzhou --header "Content-Type=application/x-www-form-urlencoded" --body ProductType=ecs
DisableCheckResource
命令描述
关闭资源的数据保护评分
contentType:application/x-www-form-urlencoded
HTTP 方法:POST
protocol:HTTPS
requestBodyType:formData
url:/api/v1/resources/disable-check
语法
aliyun bdrc DisableCheckResource
--ResourceArn <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--ResourceArn | String | 是 | 资源唯一标识 |
示例
aliyun bdrc POST /api/v1/resources/disable-check --region cn-hangzhou --header "Content-Type=application/x-www-form-urlencoded" --body ResourceArn=acs:ecs:123000890:cn-shanghai:instance/i-00100090
EnableCheckProduct
命令描述
开启云产品的数据保护评分
contentType:application/x-www-form-urlencoded
HTTP 方法:POST
protocol:HTTPS
requestBodyType:formData
url:/api/v1/products/enable-check
语法
aliyun bdrc EnableCheckProduct
--ProductType <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--ProductType | String | 是 | 产品类型
|
示例
aliyun bdrc POST /api/v1/products/enable-check --region cn-hangzhou --header "Content-Type=application/x-www-form-urlencoded" --body ProductType=ecs
EnableCheckResource
命令描述
开启单个资源的数据保护评分
contentType:application/x-www-form-urlencoded
HTTP 方法:POST
protocol:HTTPS
requestBodyType:formData
url:/api/v1/resources/enable-check
语法
aliyun bdrc EnableCheckResource
--ResourceArn <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--ResourceArn | String | 是 | 资源唯一标识 |
示例
aliyun bdrc POST /api/v1/resources/enable-check --region cn-hangzhou --header "Content-Type=application/x-www-form-urlencoded" --body ResourceArn=acs:ecs:123000890:cn-shanghai:instance/i-00100090
EnableCrossAccountManagement
命令描述
开启跨账号管理,只有BDRC委派管理员能够调用,会启用资源目录侧的可信服务
HTTP 方法:POST
protocol:HTTPS
url:/api/v1/cross-accounts/enable-management
语法
aliyun bdrc EnableCrossAccountManagement
[options]
参数
该命令没有专属参数。CLI 通用选项见“全局选项”。
示例
aliyun bdrc POST /api/v1/cross-accounts/enable-management --region cn-hangzhou --header "Content-Type=application/json"
GetBdrcService
命令描述
查询数据灾备中心状态
HTTP 方法:GET
protocol:HTTPS
url:/api/v1/service
语法
aliyun bdrc GetBdrcService
[options]
参数
该命令没有专属参数。CLI 通用选项见“全局选项”。
示例
aliyun bdrc GET /api/v1/service --region cn-hangzhou --header "Content-Type=application/json"
GetMessage
命令描述
获取单个消息
HTTP 方法:GET
protocol:HTTPS
url:/api/v1/messages/{MessageId}
语法
aliyun bdrc GetMessage
--MessageId <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--MessageId | String | 是 | 消息ID |
示例
aliyun bdrc GET /api/v1/messages/m-1230000890 --region cn-hangzhou --header "Content-Type=application/json"
GetProtectionPolicy
命令描述
获取保护策略
HTTP 方法:GET
protocol:HTTPS
url:/api/v1/protection-policies/{ProtectionPolicyId}
语法
aliyun bdrc GetProtectionPolicy
--ProtectionPolicyId <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--ProtectionPolicyId | String | 是 | 保护策略ID |
示例
aliyun bdrc GET /api/v1/protection-policies/p-1230007890 --region cn-hangzhou --header "Content-Type=application/json"
GetResourceCategory
命令描述
获取单个资源分类
HTTP 方法:GET
protocol:HTTPS
url:/api/v1/resource-categories/get
语法
aliyun bdrc GetResourceCategory
--ResourceCategoryId <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--ResourceCategoryId | String | 是 | 资源分类ID |
示例
aliyun bdrc GET /api/v1/resource-categories/get --region cn-hangzhou --ResourceCategoryId 'rc-12300007890' --header "Content-Type=application/json"
ListCrossAccounts
命令描述
查询跨账号纳管关系列表
HTTP 方法:GET
protocol:HTTPS
url:/api/v1/cross-accounts
语法
aliyun bdrc ListCrossAccounts
[--CrossAccountOwnerId <int>]
[--ManagementMode <string>]
[--MaxResults <int>]
[--NextToken <string>]
[--TargetId <string>]
[--TargetType <string>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--CrossAccountOwnerId | Integer | 否 | 跨账号纳管关系所有者 |
--ManagementMode | String | 否 | 跨账号纳管模式
|
--MaxResults | Integer | 否 | 最大返回结果数
|
--NextToken | String | 否 | 分页游标 |
--TargetId | String | 否 | 跨账号纳管目标ID |
--TargetType | String | 否 | 跨账号纳管目标类型
|
示例
aliyun bdrc GET /api/v1/cross-accounts --region cn-hangzhou --ManagementMode MANUAL --CrossAccountOwnerId 1230007890 --NextToken cae0000000000699 --MaxResults 10 --TargetType ACCOUNT --TargetId 1230007890 --header "Content-Type=application/json"
ListMessages
命令描述
批量查询消息
HTTP 方法:GET
protocol:HTTPS
url:/api/v1/messages
语法
aliyun bdrc ListMessages
[--MaxResults <int>]
[--MessageLevel <string>]
[--MessageTimeEarlierThan <int>]
[--MessageTimeLaterThan <int>]
[--MessageType <string>]
[--NextToken <string>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--MaxResults | Integer | 否 | 本次请求所返回的最大记录条数 |
--MessageLevel | String | 否 | 消息等级
|
--MessageTimeEarlierThan | Integer | 否 | 消息时间早于。Unix 时间戳,单位:秒 |
--MessageTimeLaterThan | Integer | 否 | 消息时间晚于。Unix 时间戳,单位:秒 |
--MessageType | String | 否 | 消息类型
|
--NextToken | String | 否 | 分页游标,如果有下一页,则该字段有返回值。说明 该参数只要返回数据,则说明还有下一页。您可以将返回的NextToken作为请求参数再次获得下一页的数据,直到返回为Null,表示获取到了所有的数据 |
示例
aliyun bdrc GET /api/v1/messages --region cn-hangzhou --NextToken cae0000000000099 --MessageTimeLaterThan 1740019609 --MaxResults 100 --MessageTimeEarlierThan 1740019610 --MessageLevel WARNING --MessageType SUB_PROTECTION_POLICY_MODIFIED --header "Content-Type=application/json"
ListProtectionPolicies
命令描述
获取保护策略列表
HTTP 方法:GET
protocol:HTTPS
url:/api/v1/protection-policies
语法
aliyun bdrc ListProtectionPolicies
[--MaxResults <int>]
[--NextToken <string>]
[--ProtectionPolicyId <string>]
[--ProtectionPolicyRegionId <string>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--MaxResults | Integer | 否 | 最大返回结果数
|
--NextToken | String | 否 | 分页游标 |
--ProtectionPolicyId | String | 否 | 保护策略ID |
--ProtectionPolicyRegionId | String | 否 | 保护策略地域ID |
示例
aliyun bdrc GET /api/v1/protection-policies --region cn-hangzhou --ProtectionPolicyRegionId 'cn-hangzhou' --NextToken cae0000000000699 --ProtectionPolicyId 'p-1230007890' --MaxResults 10 --header "Content-Type=application/json"
ListProtectionPolicyApplications
命令描述
获取保护策略应用历史
HTTP 方法:GET
protocol:HTTPS
url:/api/v1/protection-policies/{ProtectionPolicyId}/list-applications
语法
aliyun bdrc ListProtectionPolicyApplications
[--ApplyStatus <string>]
[--MaxResults <int>]
[--NextToken <string>]
--ProtectionPolicyId <string>
[--ResourceType <string>]
[--SubProtectionPolicyType <string>]
--TaskId <string>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--ApplyStatus | String | 否 | 应用状态
|
--MaxResults | Integer | 否 | 本次请求所返回的最大记录条数 |
--NextToken | String | 否 | 分页游标,如果有下一页,则该字段有返回值。说明 该参数只要返回数据,则说明还有下一页。您可以将返回的NextToken作为请求参数再次获得下一页的数据,直到返回为Null,表示获取到了所有的数据 |
--ProtectionPolicyId | String | 是 | 保护策略ID |
--ResourceType | String | 否 | 资源类型
|
--SubProtectionPolicyType | String | 否 | 子保护策略类型 |
--TaskId | String | 是 | 任务ID。您可以调用DescribeTasks查看任务ID |
示例
aliyun bdrc GET /api/v1/protection-policies/p-1230000890/list-applications --region cn-hangzhou --TaskId 't-0004d9ctt1ii00000000' --header "Content-Type=application/json"
ListResourceCategories
命令描述
获取资源分类列表
HTTP 方法:GET
protocol:HTTPS
url:/api/v1/resource-categories/list
语法
aliyun bdrc ListResourceCategories
[--MaxResults <int>]
[--NextToken <string>]
[--ResourceCategoryId <string>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--MaxResults | Integer | 否 | 本次请求所返回的最大记录条数
|
--NextToken | String | 否 | 分页游标,如果有下一页,则该字段有返回值。说明 该参数只要返回数据,则说明还有下一页。您可以将返回的NextToken作为请求参数再次获得下一页的数据,直到返回为Null,表示获取到了所有的数据 |
--ResourceCategoryId | String | 否 | 资源分类ID。可选。填写后仅查询指定资源分类,不填则查询全部资源分类 |
示例
aliyun bdrc GET /api/v1/resource-categories/list --region cn-hangzhou --ResourceCategoryId 'rc-12300007890' --NextToken cae0000000000699 --MaxResults 10 --header "Content-Type=application/json"
OpenBdrcService
命令描述
开启数据灾备中心
HTTP 方法:POST
protocol:HTTPS
url:/api/v1/service/open
语法
aliyun bdrc OpenBdrcService
[options]
参数
该命令没有专属参数。CLI 通用选项见“全局选项”。
示例
aliyun bdrc POST /api/v1/service/open --region cn-hangzhou --header "Content-Type=application/json"
PrecheckResourceCount
命令描述
预检查资源数量
contentType:application/x-www-form-urlencoded
HTTP 方法:POST
protocol:HTTPS
requestBodyType:formData
url:/api/v1/resources/precheck-count
语法
aliyun bdrc PrecheckResourceCount
[--ResourceType <string>]
--TagResourceMatchers <array>
[options]
参数
参数 | 类型 | 必填 | 说明 |
--ResourceType | String | 否 | 资源类型。可选。不填则不限制资源类型
|
--TagResourceMatchers | List | 是 | 标签资源匹配器。必填。按标签匹配资源的规则列表,每项包含key(标签键)、operator(操作符,支持EQUAL标签键值相等、KEY_EXIST标签键存在、KEY_EXIST_NOT_EQUAL标签键存在但值不相等)、values(标签值列表) |
示例
aliyun bdrc POST /api/v1/resources/precheck-count --region cn-hangzhou --header "Content-Type=application/x-www-form-urlencoded" --body TagResourceMatchers=[{Operator=EQUAL,Values=[Alice],Key=CreatedBy}]
UpdateCrossAccounts
命令描述
只有BDRC委派管理员能够调用,增量更新跨账号纳管关系
contentType:application/x-www-form-urlencoded
HTTP 方法:PATCH
protocol:HTTPS
requestBodyType:formData
url:/api/v1/cross-accounts
语法
aliyun bdrc UpdateCrossAccounts
[--CreateTargets <array>]
[--DeleteTargets <array>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--CreateTargets | List | 否 | 添加的跨账号纳管关系 |
--DeleteTargets | List | 否 | 移除的跨账号纳管关系 |
示例
aliyun bdrc PATCH /api/v1/cross-accounts --region cn-hangzhou --header "Content-Type=application/x-www-form-urlencoded" --body CreateTargets=[{TargetType=ACCOUNT,TargetId=1230007890}]&DeleteTargets=[{TargetType=ACCOUNT,TargetId=1230007890}]
UpdateProtectionPolicy
命令描述
更新保护策略
contentType:application/x-www-form-urlencoded
HTTP 方法:PATCH
protocol:HTTPS
requestBodyType:formData
url:/api/v1/protection-policies/{ProtectionPolicyId}
语法
aliyun bdrc UpdateProtectionPolicy
[--BoundResourceCategoryIds <array>]
[--ClientToken <string>]
--ProtectionPolicyId <string>
[--ProtectionPolicyName <string>]
[--SubProtectionPolicies <array>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--BoundResourceCategoryIds | List | 否 | 关联的资源分类ID列表 |
--ClientToken | String | 否 | 客户端Token,用于保证请求的幂等性。从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken只支持ASCII字符。说明 若您未指定,则系统自动使用API请求的RequestId作为ClientToken标识。每次API请求的RequestId可能不一样 |
--ProtectionPolicyId | String | 是 | 保护策略ID |
--ProtectionPolicyName | String | 否 | 保护策略名 |
--SubProtectionPolicies | List | 否 | 启用的子保护策略列表 |
示例
aliyun bdrc PATCH /api/v1/protection-policies/p-1230007890 --region cn-hangzhou --header "Content-Type=application/json"
UpdateResourceCategory
命令描述
更新资源分类
contentType:application/x-www-form-urlencoded
HTTP 方法:POST
protocol:HTTPS
requestBodyType:formData
url:/api/v1/resource-categories/update
语法
aliyun bdrc UpdateResourceCategory
--ResourceCategoryId <string>
[--ResourceCategoryName <string>]
[--ResourceMatcher <string>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--ResourceCategoryId | String | 是 | 资源分类ID |
--ResourceCategoryName | String | 否 | 资源分类名。可选。不填则不修改资源分类名。默认资源分类的名称不允许修改 |
--ResourceMatcher | String | 否 | 资源匹配器。可选。不填则不修改匹配规则。格式同CreateResourceCategory的ResourceMatcher |
示例
aliyun bdrc POST /api/v1/resource-categories/update --region cn-hangzhou --header "Content-Type=application/x-www-form-urlencoded" --body ResourceCategoryId=rc-12300007890
UpdateResources
命令描述
更新资源列表。调用该接口后,将会触发一个异步任务来更新您的资源列表和数据保护评分
contentType:application/x-www-form-urlencoded
HTTP 方法:POST
protocol:HTTPS
requestBodyType:formData
url:/api/v1/resources/update
语法
aliyun bdrc UpdateResources
[--ResourceType <string>]
[options]
参数
参数 | 类型 | 必填 | 说明 |
--ResourceType | String | 否 | 资源类型,不填代表更新所有类型。支持使用英文逗号(,)分隔传入多个资源类型 |
示例
aliyun bdrc POST /api/v1/resources/update --region cn-hangzhou --header "Content-Type=application/x-www-form-urlencoded" --body ResourceType=ACS::ECS::Instance
全局选项
以下为 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 场景) |