查询资源目录管理账号和多个成员中的资源关系。
接口说明
- 如果您使用的是 RAM 用户账号或者 RAM 角色,需要被授予 ListMultiAccountResourceRelationships 接口的权限才能执行跨账号资源关系查询操作。更多信息,请参见 RAM 用户使用资源中心。
- ListMultiAccountResourceRelationships 接口默认最多返回 20 条数据,您可以通过指定
MaxResults
参数调整最大返回条目数。 - 如果返回结果中不存在
NextToken
,则表示没有更多数据。否则,表示还有更多数据。如果想要查询后续页,需要将 ListMultiAccountResourceRelationships 接口的NextToken
参数设置为上一次返回结果中获取到的NextToken
。如果未输入NextToken
参数,查询时默认返回第一页的数据。 - 通过设置一个或多个过滤条件,可以精确资源的查询范围。支持的过滤参数以及匹配方式见下文。多个过滤条件之间是逻辑与
AND
的关系,只有同时满足所有过滤条件的资源才会被返回。每个过滤条件内部是逻辑或OR
的关系,只要满足任意一个过滤条件值的资源都会被返回。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
授权信息
下表是API对应的授权信息,可以在RAM权限策略语句的Action
元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:
- 操作:是指具体的权限点。
- 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
- 资源类型:是指操作中支持授权的资源类型。具体说明如下:
- 对于必选的资源类型,用前面加 * 表示。
- 对于不支持资源级授权的操作,用
全部资源
表示。
- 条件关键字:是指云产品自身定义的条件关键字。
- 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
操作 | 访问级别 | 资源类型 | 条件关键字 | 关联操作 |
---|---|---|---|---|
resourcecenter:ListMultiAccountResourceRelationships | list | *全部资源 * |
| 无 |
请求参数
名称 | 类型 | 必填 | 描述 | 示例值 |
---|---|---|---|---|
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 |
返回参数
示例
正常返回示例
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. | 参数 RegionId 缺失。 |
404 | MissingParameter.ResourceType | The specified parameter ResourceType is missing. | 参数 ResourceType 缺失。 |
404 | MissingParameter.ResourceId | The specified parameter ResourceId is missing. | 参数 ResourceId 缺失。 |
404 | ExceedLimit.RelatedResourceFilter | The maximum length of RelatedResourceFilter is exceeded. | 参数 RelatedResourceFilter 数量超出上限。 |
409 | InvalidParameter.Scope | The Scope is invalid. | 参数Scope无效。 |
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 数量超出上限。 |
访问错误中心查看更多错误码。