Queries resource shares.

In this example, the resource shares of the current Alibaba Cloud account in the cn-hangzhou region are queried. The returned result shows that the following resource shares are created within the account 151266687691****:

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

Request parameters

Parameter Type Required Example Description
Action String Yes ListResourceShares

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

RegionId String Yes cn-hangzhou

The region ID.

For more information about regions where the Resource Sharing service is available, see DescribeRegions.

ResourceOwner String Yes Self

The owner of the resource shares. Valid values:

  • Self: The resource shares belong to the current account.
  • OtherAccounts: The resource shares belong to an account other than the current account.
ResourceShareIds.N RepeatList No rs-PqysnzIj****

The ID of the resource share.

Valid values of N: 1 to 5. This indicates that a maximum of five resource shares can be specified at a time.

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.
  • Deleting: The resource share is being deleted.
  • Deleted: The resource share is deleted.
Note The system automatically 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 20. Default value: 20.

NextToken String No TGlzdFJlc291cmNlU2hhcmVzJjE1MTI2NjY4NzY5MTAzOTEmMiZORnI4NDhVeEtrUT0

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

For more information about common parameters, see Common parameters.

Response parameters

Parameter Type Example Description
NextToken String TGlzdFJlc291cmNlU2hhcmVzJjE1MTI2NjY4NzY5MTAzOTEmMiZORnI4NDhVeEtrUT0=

The token that is used to initiate the next request. If the returned result for 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.

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.

ResourceShareName String test

The name of the resource share.

ResourceShareOwner String 151266687691****

The owner of the resource share.

ResourceShareStatus String Active

The status of the resource share. Valid values:

  • Active: The resource share is enabled.
  • Deleting: The resource share is being deleted.
  • Deleted: The resource share is deleted.
Note The system automatically deletes the records of resource shares in the Deleted state within 48 hours to 96 hours after you delete the resource shares.
UpdateTime String 2020-12-03T08:01:43.638Z

The time when the resource share was updated.

Examples

Sample requests

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

Sample success responses

XML format

<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>
      </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>
      </ResourceShares>
      <RequestId>2F23CFB6-A721-4E90-AC1E-0E30FA8B45DA</RequestId>
</ListResourceSharesResponse>

JSON format

{
  "ResourceShares": [
    {
      "ResourceShareId": "rs-hX9wC5jO****",
      "ResourceShareName": "test1",
      "ResourceShareStatus": "Deleted",
      "CreateTime": "2020-12-03T02:47:14.651Z",
      "UpdateTime": "2020-12-03T08:01:56.696Z",
      "ResourceShareOwner": "151266687691****"
    },
    {
      "ResourceShareId": "rs-PqysnzIj****",
      "ResourceShareName": "test",
      "ResourceShareStatus": "Active",
      "CreateTime": "2020-12-03T02:20:31.292Z",
      "UpdateTime": "2020-12-03T08:01:43.638Z",
      "ResourceShareOwner": "151266687691****"
    }
  ],
  "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 specified.
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 parameter is invalid.
400 InvalidParameter.ResourceShareIds.Length The maximum length of ResourceShareIds exceeds 5 characters. The error message returned because the number of resource share IDs specified by using the ResourceShareIds parameter has exceeded the upper limit. Specify a maximum of five resource share IDs.
400 InvalidParameter.ResourceShareIds.Duplicate The ResourceShareIds contains duplicate values. The error message returned because duplicate resource share IDs are specified for the ResourceShareIds parameter.
400 InvalidParameter The specified parameter is invalid. The error message returned because a specified parameter is invalid.

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