查询资源目录管理账号和多个成员中的资源关系。
接口说明
如果您使用的是 RAM 用户账号或者 RAM 角色,需要被授予 ListMultiAccountResourceRelationships 接口的权限才能执行跨账号资源关系查询操作。更多信息,请参见 RAM 用户使用资源中心。
ListMultiAccountResourceRelationships 接口默认最多返回 20 条数据,您可以通过指定
MaxResults参数调整最大返回条目数。如果返回结果中不存在
NextToken,则表示没有更多数据。否则,表示还有更多数据。如果想要查询后续页,需要将 ListMultiAccountResourceRelationships 接口的NextToken参数设置为上一次返回结果中获取到的NextToken。如果未输入NextToken参数,查询时默认返回第一页的数据。通过设置一个或多个过滤条件,可以精确资源的查询范围。支持的过滤参数以及匹配方式见下文。多个过滤条件之间是逻辑与
AND的关系,只有同时满足所有过滤条件的资源才会被返回。每个过滤条件内部是逻辑或OR的关系,只要满足任意一个过滤条件值的资源都会被返回。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
resourcecenter:ListMultiAccountResourceRelationships |
list |
*全部资源
|
无 | 无 |
请求语法
POST HTTP/1.1
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| Scope |
string |
是 |
搜索的账号范围。取值:
|
rd-r4**** |
| RegionId |
string |
是 |
资源地域 ID。 |
cn-hangzhou |
| ResourceType |
string |
是 |
资源类型。 |
ACS::ACK::Cluster |
| ResourceId |
string |
是 |
资源 ID。 |
m-eb3hji**** |
| RelatedResourceFilter |
array<object> |
否 |
相关资源过滤条件。 |
|
|
object |
否 |
相关资源过滤条件。 |
||
| Key |
string |
否 |
过滤条件键。取值见下方 |
RelatedResourceRegionId |
| Value |
array |
否 |
过滤条件值。 |
|
|
string |
否 |
过滤条件值。 |
cn-shanghai |
|
| MatchType |
string |
否 |
匹配方式。 |
Equals |
| NextToken |
string |
否 |
查询返回结果下一页的令牌。 |
eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd**** |
| MaxResults |
integer |
否 |
每页的最大数据条数。 取值范围:1~500。 默认值:20。 |
10 |
支持的过滤参数
| 参数 | 描述 | 支持的匹配类型 |
| RelatedResourceRegionId | 相关资源地域 ID。 | Equals |
| RelatedResourceType | 相关资源类型。 | Equals |
| RelatedResourceId | 相关资源 ID。 | Equals |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
返回参数。 |
||
| RequestId |
string |
请求 ID。 |
BCAB07BA-82FA-5DC0-9322-FB7ED726481D |
| MaxResults |
integer |
每页的最大数据条数。 |
10 |
| NextToken |
string |
查询返回结果下一页的令牌。 |
eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd**** |
| Scope |
string |
搜索的账号范围。取值:
|
rd-r4**** |
| ResourceRelationships |
array<object> |
相关资源列表。 |
|
|
object |
相关资源列表。 |
||
| AccountId |
string |
资源目录管理账号 ID 或成员账号 ID。 |
193396142051**** |
| RegionId |
string |
资源地域 ID。 |
cn-hangzhou |
| ResourceType |
string |
资源类型。 |
ACS::ACK::Cluster |
| ResourceId |
string |
资源 ID。 |
m-eb3hji**** |
| RelatedResourceRegionId |
string |
相关资源地域 ID。 |
cn-shanghai |
| RelatedResourceType |
string |
相关资源类型。 |
ACS::VPC::VPC |
| RelatedResourceId |
string |
相关资源 ID。 |
vpc-uf6m5okksddm6c9lh7*** |
示例
正常返回示例
JSON格式
{
"RequestId": "BCAB07BA-82FA-5DC0-9322-FB7ED726481D",
"MaxResults": 10,
"NextToken": "eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****",
"Scope": "rd-r4****\n",
"ResourceRelationships": [
{
"AccountId": "193396142051****",
"RegionId": "cn-hangzhou",
"ResourceType": "ACS::ACK::Cluster\n",
"ResourceId": "m-eb3hji****\n",
"RelatedResourceRegionId": "cn-shanghai",
"RelatedResourceType": "ACS::VPC::VPC",
"RelatedResourceId": "vpc-uf6m5okksddm6c9lh7***"
}
]
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | NoPermission | You are not authorized to perform this operation. | |
| 400 | InvalidParameter.MaxResults | The specified parameter MaxResults is not valid. | 参数 MaxResults 不合法。 |
| 400 | MultiAccountServiceNotEnabled | Multi account ResourceCenter service is not enabled. | 多账号资源中心服务未开通。 |
| 400 | MissingParameter.RelatedResourceFilterValue | You must specify RelatedResourceFilterValue.n.Value. | 缺少参数 RelatedResourceFilterValue.n.Value。 |
| 400 | InvalidParameter.RelatedResourceFilterMatchType | The specified parameter RelatedResourceFilterMatchType.n.MatchType is not valid. | 参数 RelatedResourceFilterMatchType.n.MatchType 不合法。 |
| 400 | InvalidParameter.RelatedResourceFilterKey | The specified parameter RelatedResourceFilterMatchType.n.RelatedResourceFilterKey is not valid. | 参数 RelatedResourceFilterMatchType.n.RelatedResourceFilterKey 不合法。 |
| 403 | NoPermission.AccountScope | The operator is not permitted for this account scope. | 当前用户未授权操作此资源目录账号范围。 |
| 404 | NotExists.ResourceDirectory | The resource directory for the account is not enabled. | 当前账号未开通资源目录。 |
| 404 | NotExists.ResourceDirectory.FolderId | The specified folder does not exist. | 指定文件夹不存在。 |
| 404 | MissingParameter.RegionId | The specified parameter RegionId is missing. | |
| 404 | MissingParameter.ResourceType | The specified parameter ResourceType is missing. | |
| 404 | MissingParameter.ResourceId | The specified parameter ResourceId is missing. | |
| 404 | ExceedLimit.RelatedResourceFilter | The maximum length of RelatedResourceFilter is exceeded. | 参数 RelatedResourceFilter 数量超出上限。 |
| 409 | InvalidParameter.Scope | The Scope is invalid. | |
| 409 | NoPermission.ResourceDirectory.MemberAccount | ResourceDirectory Member Account is not authorized to perform this operation. | 资源目录成员账号不能执行此操作,请使用管理账号操作。 |
| 409 | InvalidParameter.ResourceType | The specified parameter ResourceType is not valid. | 参数 ResourceType 不合法。 |
| 409 | ExceedLimit.RelatedResourceFilterValue | The number of objects specified in the RelatedResourceFilterValue parameter exceeds the upper limit. | 参数 RelatedResourceFilterValue 数量超出上限。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。