Queries shared targets.
If resource sharing is initiated by you, you can query the shared targets with which you share your resources.
If resource sharing is initiated by other accounts, you can query the resource shares with which your account is associated.
In this example, the shared targets with which you share your resources are queried
in the cn-hangzhou
region. The returned result shows that you share your resources with the shared targets
114240524784****
and 172050525300****
.
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | ListSharedTargets |
The operation that you want to perform. Set the value to ListSharedTargets. |
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. |
Targets.N | RepeatList | No | 114240524784**** |
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. Valid values of N: 1 to 5. This indicates that a maximum of five shared targets can be specified at a time. |
ResourceType | String | No | VSwitch |
The type of the shared resource. Set the value to VSwitch. |
ResourceId | String | No | vsw-bp1upw03qyz8n7us9**** |
The ID of the shared resource. |
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. |
SharedTargets | Array of SharedTarget |
The information of the shared targets. |
|
CreateTime | String | 2020-12-07T09:16:59.905Z |
The time when the shared target was associated with the resource share. |
ResourceShareId | String | rs-6GRmdD3X**** |
The ID of the resource share. |
TargetId | String | 114240524784**** |
The ID of the shared target. |
UpdateTime | String | 2020-12-07T09:16:59.905Z |
The time when the association of the shared target was updated. |
Examples
Sample requests
https://resourcesharing.aliyuncs.com/?Action=ListSharedTargets
&RegionId=cn-hangzhou
&ResourceOwner=Self
&<Common request parameters>
Sample success responses
XML
format
<ListSharedTargetsResponse>
<RequestId>445ECACB-1082-4008-ABD4-8B259EFF4855</RequestId>
<SharedTargets>
<ResourceShareId>rs-6GRmdD3X****</ResourceShareId>
<CreateTime>2020-12-07T09:16:59.905Z</CreateTime>
<UpdateTime>2020-12-07T09:16:59.905Z</UpdateTime>
<TargetId>114240524784****</TargetId>
</SharedTargets>
<SharedTargets>
<ResourceShareId>rs-6GRmdD3X****</ResourceShareId>
<CreateTime>2020-12-07T09:15:26.879Z</CreateTime>
<UpdateTime>2020-12-07T09:15:26.879Z</UpdateTime>
<TargetId>172050525300****</TargetId>
</SharedTargets>
</ListSharedTargetsResponse>
JSON
format
{
"RequestId": "445ECACB-1082-4008-ABD4-8B259EFF4855",
"SharedTargets": [
{
"ResourceShareId": "rs-6GRmdD3X****",
"CreateTime": "2020-12-07T09:16:59.905Z",
"UpdateTime": "2020-12-07T09:16:59.905Z",
"TargetId": "114240524784****"
},
{
"ResourceShareId": "rs-6GRmdD3X****",
"CreateTime": "2020-12-07T09:15:26.879Z",
"UpdateTime": "2020-12-07T09:15:26.879Z",
"TargetId": "172050525300****"
}
]
}
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.Targets | The Targets is invalid. | The error message returned because the value of the Targets parameter is invalid. |
400 | InvalidParameter.Targets.Length | The maximum number of Targets exceeds 5. | The error message returned because the number of specified shared targets has exceeded the upper limit. Specify a maximum of five shared targets. |
400 | InvalidParameter.Targets.Duplicate | The Targets contains duplicate values. | The error message returned because duplicate shared targets are specified. |
400 | InvalidParameter.ResourceId | The ResourceId is invalid. | The error message returned because the value of the ResourceId 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.