ListSharedResources - 查询共享或其他账号共享的资源列表

查询共享的资源列表或者其他账号共享的资源列表。

接口说明

本文将提供一个示例,查询您在cn-hangzhou地域共享的资源列表。返回结果显示,您只共享过 1 个资源,即在共享单元rs-6GRmdD3X****内共享过VSwitch类型的资源vsw-bp1upw03qyz8n7us9****

调试

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

调试

授权信息

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

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

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

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

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

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

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

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

操作

访问级别

资源类型

条件关键字

关联操作

resourcesharing:ListSharedResources

list

*全部资源

*

请求参数

名称

类型

必填

描述

示例值

ResourceOwner

string

共享单元归属者。取值:

  • Self:查询您创建的共享单元中,共享给其他账号的资源列表。

  • OtherAccounts:查询其他账号创建的共享单元中,共享给您的资源列表。

Self

ResourceType

string

共享资源类型。

支持共享的资源类型,请参见支持资源共享的云服务

VSwitch

Target

string

资源使用者 ID 或资源所有者 ID。取值:

  • ResourceOwnerSelf时,该参数为资源使用者 ID。

  • ResourceOwnerOtherAccounts时,该参数为资源所有者 ID。

172050525300****

MaxResults

integer

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

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

20

NextToken

string

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

TGlzdFJlc291cm****

ResourceShareIds

array

共享单元 ID。

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

rs-6GRmdD3X****

string

共享单元 ID。

rs-6GRmdD3X****

ResourceIds

array

共享资源 ID。

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

vsw-bp1upw03qyz8n7us9****

string

共享资源 ID。

vsw-bp1upw03qyz8n7us9****

ResourceArns

array

string

返回参数

名称

类型

描述

示例值

object

返回参数。

NextToken

string

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

TGlzdFJlc291cm****

RequestId

string

请求 ID。

04677DCA-7C33-464B-8811-1B1DA3C3D197

SharedResources

array<object>

共享资源信息。

object

共享资源信息。

UpdateTime

string

更新关联资源的时间。

2020-12-07T07:39:02.921Z

ResourceType

string

共享资源类型。

支持共享的资源类型,请参见支持资源共享的云服务

VSwitch

CreateTime

string

关联资源的时间。

2020-12-07T07:39:02.921Z

ResourceShareId

string

共享单元 ID。

rs-6GRmdD3X****

ResourceArn

string

ResourceStatus

string

共享资源状态。查询您共享的资源时不返回该参数,查询共享给您的资源时返回该参数。

取值:

  • Available:资源可用。

  • ZonalResourceInaccessible:在当前可用区,资源不可用。

  • LimitExceeded:配额超限,资源不可用。

  • Unavailable:资源不可用。

Available

ResourceStatusMessage

string

关联失败的原因。

The reason for the association failure.

ResourceId

string

共享资源 ID。

vsw-bp1upw03qyz8n7us9****

示例

正常返回示例

JSON格式

{
  "NextToken": "TGlzdFJlc291cm****",
  "RequestId": "04677DCA-7C33-464B-8811-1B1DA3C3D197",
  "SharedResources": [
    {
      "UpdateTime": "2020-12-07T07:39:02.921Z",
      "ResourceType": "VSwitch",
      "CreateTime": "2020-12-07T07:39:02.921Z",
      "ResourceShareId": "rs-6GRmdD3X****",
      "ResourceArn": "",
      "ResourceStatus": "Available",
      "ResourceStatusMessage": "The reason for the association failure. ",
      "ResourceId": "vsw-bp1upw03qyz8n7us9****"
    }
  ]
}

错误码

HTTP status code

错误码

错误信息

描述

400 MissingParameter.ResourceOwner You must specify ResourceOwner. ResourceOwner参数缺失。
400 InvalidParameter.ResourceOwner The ResourceOwner is invalid. ResourceOwner参数错误。
400 InvalidParameter.ResourceType The ResourceType is invalid. 传入的资源类型错误。
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.ResourceIds The ResourceIds is invalid. 传入的资源ID错误。
400 InvalidParameter.ResourceIds.Duplicate The specified ResourceId contains duplicate values. 传入的资源ID有重复项。
400 InvalidParameter.ResourceIds.Length The maximum number of ResourceIds (5) is exceeded. 传入的资源ID数量超限(最大5个)。
400 InvalidParameter.Target The Target is invalid. 资源所有者传参错误。
400 InvalidParameter The specified parameter is invalid. 参数无效。
400 InvalidParameter.ResourceArns The ResourceArns is invalid. ResourceArns参数无效。
400 InvalidParameter.ResourceArns.Duplicate The ResourceArns contains duplicate values. 资源ARN参数有重复项。
400 InvalidParameter.ResourceArns.Length The ResourceArns beyond the length limit. 资源ARN数量超限(最大5个)。
400 NotSupport.ResourceType.ResourcesParameter The Resources parameter does not support this resource type. Please use ResourceArns instead. 当前资源类型不支持Resources参数,请使用ResourceArns参数。
400 InvalidParameter.ResourceConflict Both ResourceId and ResourceArn cannot be specified simultaneously. Please provide only one of these parameters. ResourceId 和 ResourceArn 不能同时指定。请仅提供其中一个参数。

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

变更历史

更多信息,参考变更详情