全部产品
Search
文档中心

资源管理:ListMultiAccountResourceRelationships - 查询多账号的资源关系

更新时间:Aug 28, 2026

查询资源目录管理账号和多个成员中的资源关系。

接口说明

  • 如果您使用的是 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

*全部资源

*

请求语法

POST  HTTP/1.1

请求参数

名称

类型

必填

描述

示例值

Scope

string

搜索的账号范围。取值:

  • 资源目录 ID,表示搜索管理账号和所有成员中的资源。更多信息,请参见 GetResourceDirectory

  • Root 资源夹 ID,表示搜索 Root 资源夹及子资源夹下的所有成员中的资源。更多信息,请参见 ListFoldersForParent

  • 资源夹 ID,表示搜索指定资源夹下所有成员中的资源。更多信息,请参见 ListFoldersForParent

  • 成员 ID,表示搜索指定成员中的资源。更多信息,请参见 ListAccounts

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

搜索的账号范围。取值:

  • 资源目录 ID,表示搜索管理账号和所有成员中的资源。

  • Root 资源夹 ID,表示搜索 Root 资源夹及子资源夹下的所有成员中的资源。

  • 资源夹 ID,表示搜索指定资源夹下所有成员中的资源。

  • 成员 ID,表示搜索指定成员中的资源。

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 数量超出上限。

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情