ListResourceShareAssociations
Queries the records of associated resources or principals in a resource share.
Operation description
This topic provides an example on how to query the records of shared resources associated with a resource share created by the current account in the cn-hangzhou region. The response shows that the current account has associated the following two resources:
In the resource share rs-6GRmdD3X****, a VSwitch shared resource vsw-bp1upw03qyz8n7us9**** was added. The resource is in the Associated state, which indicates that the resource is being shared normally.
In the resource share rs-6GRmdD3X****, a VSwitch shared resource vsw-bp183p93qs667muql**** was removed. The resource is in the Disassociated state, which indicates that the sharing of the resource has stopped.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
resourcesharing:ListResourceShareAssociations |
list |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ResourceId |
string |
No |
The resource ID. Note
This parameter is unavailable when AssociationType is set to Target. |
vsw-bp183p93qs667muql**** |
| ResourceArn |
string |
No |
The resource ARN. Note
This parameter is unavailable when AssociationType is set to Target. |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
| Target |
string |
No |
The principal ID. Note
This parameter is unavailable when AssociationType is set to Resource. |
172050525300**** |
| AssociationType |
string |
Yes |
The association type. Valid values:
|
Resource |
| AssociationStatus |
string |
No |
The association status. Valid values:
Note
Records in the Failed and Disassociated states are automatically deleted by the system within 48 to 96 hours. |
Associated |
| MaxResults |
integer |
No |
The maximum number of entries to return for a single request. Valid values: 1 to 100. Default value: 20. |
20 |
| NextToken |
string |
No |
The pagination token. If the response is truncated, you can use NextToken to initiate another request and obtain the remaining results. |
TGlzdFJlc291cm**** |
| ResourceShareIds |
array |
No |
The resource share IDs. Valid values of N: 1 to 5. You can specify up to 5 resource shares at a time. |
rs-6GRmdD3X**** |
|
string |
No |
The resource share ID. |
rs-6GRmdD3X**** |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| NextToken |
string |
The pagination token. If the response is truncated, you can use NextToken to initiate another request and obtain the remaining results. |
TGlzdFJlc291cm**** |
| RequestId |
string |
The request ID. |
11BA57B5-7301-4E2F-BBA5-2AE4C2F4FCDB |
| ResourceShareAssociations |
array<object> |
The information about the shared resources or principals. |
|
|
array<object> |
The information about the shared resources or principals. |
||
| UpdateTime |
string |
The time when the association was updated. The value varies based on the following conditions:
|
2020-12-07T07:39:02.920Z |
| EntityId |
string |
The ID of the associated entity. Valid values:
|
vsw-bp1upw03qyz8n7us9**** |
| ResourceArn |
string |
The ARN of the associated resource. Note
This parameter is unavailable when AssociationType is set to Target. |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
| ResourceShareName |
string |
The name of the resource share. |
example |
| CreateTime |
string |
The time when the association was created. The value varies based on the following conditions:
|
2020-12-07T07:39:01.818Z |
| EntityType |
string |
The type of the associated entity. Valid values:
|
VSwitch |
| ResourceShareId |
string |
The resource share ID. |
rs-6GRmdD3X**** |
| AssociationStatusMessage |
string |
The reason why the association failed. |
The reason for the association failure. |
| AssociationType |
string |
The association type. Valid values:
|
Resource |
| AssociationStatus |
string |
The association status. Valid values:
Note
Records in the Failed and Disassociated states are automatically deleted by the system within 48 to 96 hours. |
Failed |
| External |
boolean |
Specifies whether the principal is an account outside the resource directory. Valid values:
|
false |
| AssociationFailedDetails |
array<object> |
The detailed reasons why the check for associate or dissociate resources or principals failed. |
|
|
object |
The detailed reasons why the check for associate or dissociate resources or principals failed. |
||
| Status |
string |
[Deprecated] Use FailureReason instead. |
None |
| StatusMessage |
string |
[Deprecated] Use FailureDescription instead. |
None |
| AssociateType |
string |
[Deprecated] Use OperationType instead. |
None |
| ResourceArn |
string |
The ARN of the associated resource. Note
This parameter is unavailable when AssociationType is set to Resource. |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
| EntityType |
string |
The type of the associated entity. Valid values:
|
Account |
| FailureReason |
string |
The reason why the associate or dissociate failed. Valid values:
|
Unavailable |
| FailureDescription |
string |
The detailed description of the reason why the associate or dissociate failed. |
You cannot access the specified resource at this time. |
| OperationType |
string |
The operation type. Valid values:
|
Associate |
| EntityId |
string |
The ID of the associated entity. Valid values:
|
172050525300**** |
| TargetProperty |
string |
The properties of the principal, such as the time range for resource sharing. Valid values of timeRangeType:
Note
This parameter is returned only when the principal is an Alibaba Cloud service. |
{ "timeRange":{ "timeRangeType":"timeRange", "beginAtTime":"00:00", "timezone":"UTC+8", "endAtTime":"19:59" } } |
| ResourceProperty |
string |
The properties of the resource. |
{"sharePrincipals":true,"shareTagOptions":false} |
Examples
Success response
JSON format
{
"NextToken": "TGlzdFJlc291cm****",
"RequestId": "11BA57B5-7301-4E2F-BBA5-2AE4C2F4FCDB",
"ResourceShareAssociations": [
{
"UpdateTime": "2020-12-07T07:39:02.920Z",
"EntityId": "vsw-bp1upw03qyz8n7us9****",
"ResourceArn": "acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di****",
"ResourceShareName": "example",
"CreateTime": "2020-12-07T07:39:01.818Z",
"EntityType": "VSwitch",
"ResourceShareId": "rs-6GRmdD3X****",
"AssociationStatusMessage": "The reason for the association failure. ",
"AssociationType": "Resource",
"AssociationStatus": "Failed",
"External": false,
"AssociationFailedDetails": [
{
"Status": "无",
"StatusMessage": "无",
"AssociateType": "无",
"ResourceArn": "acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di****",
"EntityType": "Account",
"FailureReason": "Unavailable",
"FailureDescription": "You cannot access the specified resource at this time.",
"OperationType": "Associate",
"EntityId": "172050525300****"
}
],
"TargetProperty": "{\n \"timeRange\":{\n \"timeRangeType\":\"timeRange\",\n \"beginAtTime\":\"00:00\",\n \"timezone\":\"UTC+8\",\n \"endAtTime\":\"19:59\"\n }\n}",
"ResourceProperty": "{\"sharePrincipals\":true,\"shareTagOptions\":false}"
}
]
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | MissingParameter.AssociationType | You must specify AssociationType. | You must specify AssociationType. |
| 400 | InvalidParameter.AssociationType | The AssociationType is invalid. | The AssociationType parameter is invalid. |
| 400 | InvalidParameter.AssociationStatus | The AssociationStatus is invalid. | The AssociationStatus parameter is invalid. |
| 400 | InvalidParameter.MaxResults | The MaxResults is invalid. | The MaxResults parameter is invalid. |
| 400 | InvalidParameter.NextToken | The NextToken is invalid. | The NextToken parameter is invalid. |
| 400 | InvalidParameter.NextToken.Length | The maximum length of NextToken exceeds 256 characters. | The length of NextToken cannot exceed 256 characters. |
| 400 | InvalidParameter.ResourceShareIds | The ResourceShareIds is invalid. | The ResourceShareIds parameter is invalid. |
| 400 | InvalidParameter.ResourceShareIds.Duplicate | The ResourceShareIds contains duplicate values. | The ResourceShareIds parameter contains duplicate values. |
| 400 | InvalidParameter.ResourceShareIds.Length | The maximum length of ResourceShareIds exceeds 5 characters. | The number of ResourceShareIds values cannot exceed 5. |
| 400 | InvalidParameter.Target | The Target is invalid. | The Target parameter is invalid. |
| 400 | InvalidParameter.ResourceId | The ResourceId is invalid. | The ResourceId parameter is invalid. |
| 400 | ConflictedAssociationType | The specified ResourceId or Target conflicts with AssociationType. | The specified parameter conflicts with AssociationType. |
| 400 | InvalidParameter | The specified parameter is invalid. | The specified parameter is invalid. |
| 400 | InvalidParameter.ResourceArn | The ResourceArn is invalid. | The ResourceArn is invalid. |
| 400 | InvalidParameter.ResourceConflict | Both ResourceId and ResourceArn cannot be specified simultaneously. Please provide only one of these parameters. | Both ResourceId and ResourceArn cannot be specified simultaneously. Please provide only one of these parameters. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.