ListResourceShareAssociations - 查询关联资源或资源使用者

查询共享单元中关联资源或资源使用者的记录。

接口说明

本文将提供一个示例,在cn-hangzhou地域,查询当前账号创建的共享单元中关联的共享资源的记录。返回结果显示,当前账号关联过以下 2 个资源:

  • 在共享单元rs-6GRmdD3X****中,添加过VSwitch类型的共享资源vsw-bp1upw03qyz8n7us9****,该资源处于关联中Associated状态,即该资源正常共享中。

  • 在共享单元rs-6GRmdD3X****中,移除过VSwitch类型的共享资源vsw-bp183p93qs667muql****,该资源处于已分离Disassociated状态,即该资源已停止共享。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

resourcesharing:ListResourceShareAssociations

list

*全部资源

*

请求参数

名称

类型

必填

描述

示例值

ResourceId

string

资源 ID。

说明

AssociationTypeTarget时,该参数不可用。

vsw-bp183p93qs667muql****

ResourceArn

string

Target

string

资源使用者 ID。

说明

AssociationTypeResource时,该参数不可用。

172050525300****

AssociationType

string

关联类型:取值:

  • Resource:查询关联共享资源的记录。

  • Target:查询关联资源使用者的记录。

Resource

AssociationStatus

string

关联状态。取值:

  • Associating:关联中。

  • Associated:已关联。

  • Failed:关联失败。

  • Disassociating:分离中。

  • Disassociated:已分离。

说明

FailedDisassociated状态的记录,会在 48~96 小时内被系统自动删除。

Associated

MaxResults

integer

单次请求返回结果的最大条数。

取值范围:1~100。默认值:20。

20

NextToken

string

当请求的返回结果被截断时,您可以使用NextToken再次发起请求,获取从当前截断位置之后的内容。

TGlzdFJlc291cm****

ResourceShareIds

array

共享单元 ID。

N 的取值范围:1~5,即每次最多指定 5 个共享单元。

rs-6GRmdD3X****

string

共享单元 ID。

rs-6GRmdD3X****

返回参数

名称

类型

描述

示例值

object

返回参数。

NextToken

string

当请求的返回结果被截断时,您可以使用NextToken再次发起请求,获取从当前截断位置之后的内容。

TGlzdFJlc291cm****

RequestId

string

请求 ID。

11BA57B5-7301-4E2F-BBA5-2AE4C2F4FCDB

ResourceShareAssociations

array<object>

共享资源或资源使用者信息。

object

共享资源或资源使用者信息。

UpdateTime

string

更新关联的时间。存在以下两种情况:

  • 当关联类型AssociationType为资源Resource时,该参数为更新资源的时间。

  • 当关联类型AssociationType为资源使用者Target时,该参数为更新资源使用者的时间。

2020-12-07T07:39:02.920Z

EntityId

string

关联实体 ID。取值:

  • 当关联类型AssociationType为资源Resource时,该参数为资源 ID。

  • 当关联类型AssociationType为资源使用者Target时,该参数为资源使用者 ID。

vsw-bp1upw03qyz8n7us9****

ResourceArn

string

ResourceShareName

string

共享单元名称。

example

CreateTime

string

关联的时间。存在以下两种情况:

  • 当关联类型AssociationType为资源Resource时,该参数为添加或移除资源的时间。

  • 当关联类型AssociationType为资源使用者Target时,该参数为添加或移除资源使用者的时间。

2020-12-07T07:39:01.818Z

EntityType

string

关联实体类型。取值:

  • 当关联实体为资源时,该参数为资源类型。更多信息,请参见支持资源共享的云服务

  • 当关联实体为资源使用者时,该参数为Account

VSwitch

ResourceShareId

string

共享单元 ID。

rs-6GRmdD3X****

AssociationStatusMessage

string

关联失败的原因。

The reason for the association failure.

AssociationType

string

关联类型。取值:

  • Resource:资源。

  • Target:资源使用者。

Resource

AssociationStatus

string

关联状态。取值:

  • Associating:关联中。

  • Associated:已关联。

  • Failed:关联失败。

  • Disassociating:分离中。

  • Disassociated:已分离。

说明

FailedDisassociated状态的记录,会在 48~96 小时内被系统自动删除。

Failed

External

boolean

资源使用者是否为资源目录外账号。取值:

  • true:资源目录外账号。

  • false:资源目录内账号。

false

TargetProperty

string

资源使用者属性。例如:资源共享的时间段。timeRangeType取值:

  • timeRange:指定时间段。

  • day:全天。

说明

仅当资源使用者为阿里云服务时返回该参数。

{ "timeRange":{ "timeRangeType":"timeRange", "beginAtTime":"00:00", "timezone":"UTC+8", "endAtTime":"19:59" } }

AssociationFailedDetails

array<object>

关联或解除关联资源或者资源使用者检查失败详细原因。

object

关联或解除关联资源或者资源使用者检查失败详细原因。

Status

string

已弃用。请使用 FailureReason。

StatusMessage

string

已弃用。请使用 FailureDescription。

AssociateType

string

已弃用。请使用 OperationType。

ResourceArn

string

EntityType

string

关联实体类型。取值:

  • 当关联实体为资源时,该参数为资源类型。更多信息,请参见支持资源共享的云服务

  • 当关联实体为资源使用者时,该参数为ResourceDirectoryFolderAccountService

Account

FailureReason

string

关联或解除关联失败时的原因。 取值:

  • Unavailable:资源不存在等情况导致共享失败。

  • LimitExceeded:资源可共享的目标 Quota 超出上限。

  • ZonalResourceInaccessible: 资源在此地域不可用。

  • InternalError:服务器内部出现错误。

  • UnsupportedOperation:不支持执行操作。

Unavailable

FailureDescription

string

关联或解除关联失败时的详细原因描述。

You cannot access the specified resource at this time.

OperationType

string

操作类型。取值:

  • Associate:关联。

  • Disassociate:解除关联。

Associate

EntityId

string

关联实体 ID。取值:

  • 当关联类型 AssociationType 为资源 Resource 时,该参数为资源使用者 ID。

  • 当关联类型 AssociationType 为资源使用者 Target 时,该参数为资源 ID。

172050525300****

示例

正常返回示例

JSON格式

{
  "NextToken": "TGlzdFJlc291cm****",
  "RequestId": "11BA57B5-7301-4E2F-BBA5-2AE4C2F4FCDB",
  "ResourceShareAssociations": [
    {
      "UpdateTime": "2020-12-07T07:39:02.920Z",
      "EntityId": "vsw-bp1upw03qyz8n7us9****",
      "ResourceArn": "",
      "ResourceShareName": "example",
      "CreateTime": "2020-12-07T07:39:01.818Z",
      "EntityType": "VSwitch",
      "ResourceShareId": "rs-6GRmdD3X****",
      "AssociationStatusMessage": "The reason for the association failure. ",
      "AssociationType": "Resource",
      "AssociationStatus": "Failed",
      "External": false,
      "TargetProperty": "{\n    \"timeRange\":{\n        \"timeRangeType\":\"timeRange\",\n        \"beginAtTime\":\"00:00\",\n        \"timezone\":\"UTC+8\",\n        \"endAtTime\":\"19:59\"\n    }\n}",
      "AssociationFailedDetails": [
        {
          "Status": "无",
          "StatusMessage": "无",
          "AssociateType": "无",
          "ResourceArn": "",
          "EntityType": "Account",
          "FailureReason": "Unavailable",
          "FailureDescription": "You cannot access the specified resource at this time.",
          "OperationType": "Associate",
          "EntityId": "172050525300****"
        }
      ]
    }
  ]
}

错误码

HTTP status code

错误码

错误信息

描述

400 MissingParameter.AssociationType You must specify AssociationType. AssociationType参数缺失。
400 InvalidParameter.AssociationType The AssociationType is invalid. AssociationType参数错误。
400 InvalidParameter.AssociationStatus The AssociationStatus is invalid. AssociationStatus参数错误。
400 InvalidParameter.MaxResults The MaxResults is invalid. MaxResults参数错误。
400 InvalidParameter.NextToken The NextToken is invalid. NextToken参数错误。
400 InvalidParameter.NextToken.Length The maximum length of NextToken exceeds 256 characters. NextToken长度超限(最大256个字符)。
400 InvalidParameter.ResourceShareIds The ResourceShareIds is invalid. ResourceShareIds参数错误。
400 InvalidParameter.ResourceShareIds.Duplicate The ResourceShareIds contains duplicate values. ResourceShareIds有重复项。
400 InvalidParameter.ResourceShareIds.Length The maximum length of ResourceShareIds exceeds 5 characters. ResourceShareIds长度超限(最大5个)。
400 InvalidParameter.Target The Target is invalid. 资源所有者传参错误。
400 InvalidParameter.ResourceId The ResourceId is invalid. ResourceId参数错误。
400 ConflictedAssociationType The specified ResourceId or Target conflicts with AssociationType. 参数组合冲突:传入参数与AssociationType选定项不符。
400 InvalidParameter The specified parameter is invalid. 参数无效。
400 InvalidParameter.ResourceArn The ResourceArn is invalid. 资源ARN参数无效。
400 InvalidParameter.ResourceConflict Both ResourceId and ResourceArn cannot be specified simultaneously. Please provide only one of these parameters. ResourceId 和 ResourceArn 不能同时指定。请仅提供其中一个参数。

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

变更历史

更多信息,参考变更详情