Queries the resources you share with other accounts or the resources other accounts share with you.
In this example, the resources in the cn-hangzhou
region that you share with other accounts are queried. The returned result shows
that in the resource share rs-6GRmdD3X****
, you share the vsw-bp1upw03qyz8n7us9****
resource of the VSwitch
type with other accounts.
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | ListSharedResources |
The operation that you want to perform. Set the value to ListSharedResources. |
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 share. Valid values:
|
ResourceShareIds.N | RepeatList | No | rs-6GRmdD3X**** |
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. |
ResourceType | String | No | VSwitch |
The type of the shared resource. Set the value to VSwitch. |
ResourceIds.N | RepeatList | No | vsw-bp1upw03qyz8n7us9**** |
The ID of the shared resource. Valid values of N: 1 to 5. This indicates that a maximum of five shared resources can be specified at a time. |
Target | String | No | 172050525300**** |
The shared target. A shared target shares the resources of resource owners. You can share your resources only with the member accounts in your resource directory. A shared target is indicated by its account ID. For more information about how to obtain the ID, see View the basic information of a member account. |
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 | 04677DCA-7C33-464B-8811-1B1DA3C3D197 |
The ID of the request. |
SharedResources | Array of SharedResource |
The information of the shared resources. |
|
CreateTime | String | 2020-12-07T07:39:02.921Z |
The time when the shared resource was associated with the resource share. |
ResourceId | String | vsw-bp1upw03qyz8n7us9**** |
The ID of the shared resource. |
ResourceShareId | String | rs-6GRmdD3X**** |
The ID of the resource share. |
ResourceStatus | String | Available |
The status of the shared resource. This parameter is returned only when you query the resources that other accounts share with you. Valid values:
|
ResourceStatusMessage | String | The reason for the association failure. |
The cause of the association failure. |
ResourceType | String | VSwitch |
The type of the shared resource. The value can be only VSwitch. |
UpdateTime | String | 2020-12-07T07:39:02.921Z |
The time when the association of the shared resource was updated. |
Examples
Sample requests
https://resourcesharing.aliyuncs.com/?Action=ListSharedResources
&RegionId=cn-hangzhou
&ResourceOwner=Self
&<Common request parameters>
Sample success responses
XML
format
<ListSharedResourcesResponse>
<RequestId>04677DCA-7C33-464B-8811-1B1DA3C3D197</RequestId>
<SharedResources>
<ResourceShareId>rs-6GRmdD3X****</ResourceShareId>
<ResourceId>vsw-bp1upw03qyz8n7us9****</ResourceId>
<CreateTime>2020-12-07T07:39:02.921Z</CreateTime>
<UpdateTime>2020-12-07T07:39:02.921Z</UpdateTime>
<ResourceType>VSwitch</ResourceType>
</SharedResources>
</ListSharedResourcesResponse>
JSON
format
{
"RequestId": "04677DCA-7C33-464B-8811-1B1DA3C3D197",
"SharedResources": [
{
"ResourceShareId": "rs-6GRmdD3X****",
"ResourceId": "vsw-bp1upw03qyz8n7us9****",
"CreateTime": "2020-12-07T07:39:02.921Z",
"UpdateTime": "2020-12-07T07:39:02.921Z",
"ResourceType": "VSwitch"
}
]
}
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.ResourceType | The ResourceType is invalid. | The error message returned because the value of the ResourceType 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.ResourceIds | The ResourceIds is invalid. | The error message returned because the value of the ResourceType parameter is invalid. |
400 | InvalidParameter.ResourceIds.Length | The maximum number of ResourceIds (5) is exceeded. | The error message returned because the number of specified resource IDs has exceeded the upper limit. Specify a maximum of five resource IDs. |
400 | InvalidParameter.ResourceIds.Duplicate | The specified ResourceId contains duplicate values. | The error message returned because duplicate resource IDs are specified. |
400 | InvalidParameter.Target | The Target is invalid. | The error message returned because the value of the Target parameter is invalid. |
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.