Queries resource shares.

Usage notes

This topic provides an example on how to call the API operation to query the resource shares that are created by using the current Alibaba Cloud account in the cn-hangzhou region. The response shows that the following resource shares are created by using the account whose ID is 151266687691****:

  • rs-hX9wC5jO****, which is in the Deleted state
  • rs-PqysnzIj****, which is in the Active state

Limits

You can call this operation up to 20 times per second per account. This operation is globally limited to 500 times per second across all accounts. If the number of the calls per second exceeds a limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limits when you call this operation.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ListResourceShares

The operation that you want to perform. Set the value to ListResourceShares.

ResourceOwner String Yes Self

The owner of the resource shares. Valid values:

  • Self: the current account
  • OtherAccounts: an account other than the current account
ResourceShareName String No test

The name of the resource share.

ResourceShareStatus String No Active

The status of the resource share. Valid values:

  • Active: The resource share is enabled.
  • Pending: The resource share is associated with one or more resource sharing invitations that are waiting for confirmation.
  • Deleting: The resource share is being deleted.
  • Deleted: The resource share is deleted.
Note The system deletes the records of resource shares in the Deleted state within 48 hours to 96 hours after you delete the resource shares.
MaxResults Integer No 20

The maximum number of entries to return for a single request.

Valid values: 1 to 100. Default value: 20.

NextToken String No TGlzdFJlc291cm****

The token that is used to initiate the next request. If the response of the current request is truncated, you can use the token to initiate another request and obtain the remaining records.

ResourceShareIds.N String No rs-PqysnzIj****

The IDs of the resource shares.

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
NextToken String TGlzdFJlc291cm****

The token that is used to initiate the next request. If the response of the current request is truncated, you can use the token to initiate another request and obtain the remaining records.

RequestId String 2F23CFB6-A721-4E90-AC1E-0E30FA8B45DA

The ID of the request.

ResourceShares Array of ResourceShare

The information of the resource shares.

UpdateTime String 2020-12-03T08:01:43.638Z

The time when the resource share was updated.

ResourceShareName String test

The name of the resource share.

ResourceShareOwner String 151266687691****

The owner of the resource share.

CreateTime String 2020-12-03T02:20:31.292Z

The time when the resource share was created.

ResourceShareId String rs-PqysnzIj****

The ID of the resource share.

ResourceShareStatus String Active

The status of the resource share. Valid values:

  • Active: The resource share is enabled.
  • Pending: The resource share is associated with one or more resource sharing invitations that are waiting for confirmation.
  • Deleting: The resource share is being deleted.
  • Deleted: The resource share is deleted.
Note The system deletes the records of resource shares in the Deleted state within 48 hours to 96 hours after you delete the resource shares.
AllowExternalTargets Boolean false

Indicates whether resources in the resource share can be shared with accounts outside the resource directory. Valid values:

  • false: Resources in the resource share can be shared only with accounts in the resource directory.
  • true: Resources in the resource share can be shared with both accounts in the resource directory and accounts outside the resource directory.

Examples

Sample requests

https://resourcesharing.cn-hangzhou.aliyuncs.com/?Action=ListResourceShares
&ResourceOwner=Self
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ListResourceSharesResponse>
    <ResourceShares>
        <ResourceShareId>rs-hX9wC5jO****</ResourceShareId>
        <ResourceShareName>test1</ResourceShareName>
        <ResourceShareStatus>Deleted</ResourceShareStatus>
        <CreateTime>2020-12-03T02:47:14.651Z</CreateTime>
        <UpdateTime>2020-12-03T08:01:56.696Z</UpdateTime>
        <ResourceShareOwner>151266687691****</ResourceShareOwner>
        <AllowExternalTargets>false</AllowExternalTargets>
    </ResourceShares>
    <ResourceShares>
        <ResourceShareId>rs-PqysnzIj****</ResourceShareId>
        <ResourceShareName>test</ResourceShareName>
        <ResourceShareStatus>Active</ResourceShareStatus>
        <CreateTime>2020-12-03T02:20:31.292Z</CreateTime>
        <UpdateTime>2020-12-03T08:01:43.638Z</UpdateTime>
        <ResourceShareOwner>151266687691****</ResourceShareOwner>
        <AllowExternalTargets>true</AllowExternalTargets>
    </ResourceShares>
    <RequestId>2F23CFB6-A721-4E90-AC1E-0E30FA8B45DA</RequestId>
</ListResourceSharesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "ResourceShares" : [ {
    "ResourceShareId" : "rs-hX9wC5jO****",
    "ResourceShareName" : "test1",
    "ResourceShareStatus" : "Deleted",
    "CreateTime" : "2020-12-03T02:47:14.651Z",
    "UpdateTime" : "2020-12-03T08:01:56.696Z",
    "ResourceShareOwner" : "151266687691****",
    "AllowExternalTargets" : false
  }, {
    "ResourceShareId" : "rs-PqysnzIj****",
    "ResourceShareName" : "test",
    "ResourceShareStatus" : "Active",
    "CreateTime" : "2020-12-03T02:20:31.292Z",
    "UpdateTime" : "2020-12-03T08:01:43.638Z",
    "ResourceShareOwner" : "151266687691****",
    "AllowExternalTargets" : true
  } ],
  "RequestId" : "2F23CFB6-A721-4E90-AC1E-0E30FA8B45DA"
}

Error codes

HTTP status code Error code Error message Description
400 MissingParameter.ResourceOwner You must specify ResourceOwner. The error message returned because the ResourceOwner parameter is not configured.
400 InvalidParameter.ResourceOwner The ResourceOwner is invalid. The error message returned because the value of the ResourceOwner parameter is invalid.
400 InvalidParameter.ResourceShareName The ResourceShareName is invalid. The error message returned because the value of the ResourceShareName parameter is invalid.
400 InvalidParameter.ResourceShareName.Length The maximum length of ResourceShareName exceeds 50 characters. The error message returned because the length of the value specified for the ResourceShareName parameter has exceeded the upper limit. Specify a value that is up to 50 characters in length.
400 InvalidParameter.ResourceShareStatus The ResourceShareStatus is invalid. The error message returned because the value of the ResourceShareStatus parameter is invalid.
400 InvalidParameter.MaxResults The MaxResults is invalid. The error message returned because the value of the MaxResults parameter is invalid.
400 InvalidParameter.NextToken The NextToken is invalid. The error message returned because the value of the NextToken parameter is invalid.
400 InvalidParameter.NextToken.Length The maximum length of NextToken exceeds 256 characters. The error message returned because the length of the value specified for the NextToken parameter has exceeded the upper limit. Specify a value that is up to 256 characters in length.
400 InvalidParameter.ResourceShareIds The ResourceShareIds is invalid. The error message returned because the value of the ResourceShareIds.N parameter is invalid.
400 InvalidParameter.ResourceShareIds.Duplicate The ResourceShareIds contains duplicate values. The error message returned because duplicate resource share IDs are specified.
400 InvalidParameter.ResourceShareIds.Length The maximum length of ResourceShareIds exceeds 5 characters. The error message returned because the number of specified resource share IDs has exceeded the upper limit. Specify a maximum of five resource share IDs.
400 InvalidParameter The specified parameter is invalid. The error message returned because the value of a parameter is invalid.

For a list of error codes, visit the API Error Center.