Queries the association records of resource shares.

In this example, in the cn-hangzhou region, the association records of the resource shares that belong to the current Alibaba Cloud account are queried. The returned result shows that the following resources have been associated:

  • The vSwitch vsw-bp1upw03qyz8n7us9**** has been associated with the resource share rs-6GRmdD3X****. The vSwitch is in the Associated state. This indicates that the vSwitch is being shared.
  • The vSwitch vsw-bp183p93qs667muql**** has been disassociated from the resource share rs-6GRmdD3X****. The vSwitch is in the Disassociated state. This indicates that the sharing of the vSwitch is stopped.

Request parameters

Parameter Type Required Example Description
Action String Yes ListResourceShareAssociations

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

AssociationType String Yes Resource

The association type. Valid values:

  • Resource
  • Target
RegionId String Yes cn-hangzhou

The region ID.

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

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.

ResourceId String No vsw-bp183p93qs667muql****

The ID of the resource.

Note This parameter is unavailable if AssociationType is set to Target.
Target String No 172050525300****

The ID of the shared target.

Note This parameter is unavailable if AssociationType is set to Resource.
AssociationStatus String No Associated

The association status. Valid values:

  • Associating: The entity is being associated.
  • Associated: The entity is associated.
  • Failed: The entity fails to be associated.
  • Disassociating: The entity is being disassociated.
  • Disassociated: The entity is disassociated.
Note The system automatically deletes the records of entities in the Failed or Disassociated state within 48 hours to 96 hours.
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 11BA57B5-7301-4E2F-BBA5-2AE4C2F4FCDB

The ID of the request.

ResourceShareAssociations Array of ResourceShareAssociation

The information of the entities.

AssociationStatus String Associated

The association status. Valid values:

  • Associating: The entity is being associated.
  • Associated: The entity is associated.
  • Failed: The entity fails to be associated.
  • Disassociating: The entity is being disassociated.
  • Disassociated: The entity is disassociated.
Note The system automatically deletes the records of entities in the Failed or Disassociated state within 48 hours to 96 hours.
AssociationStatusMessage String The reason for the association failure.

The cause of the association failure.

AssociationType String Resource

The association type. Valid values:

  • Resource
  • Target
CreateTime String 2020-12-07T07:39:01.818Z

The time when the association was created. The value of this parameter depends on the value of the AssociationType parameter:

  • If the value of AssociationType is Resource, the value of this parameter is the time when the resource was associated with or disassociated from the resource share.
  • If the value of AssociationType is Target, the value of this parameter is the time when the account was associated with or disassociated from the resource share.
EntityId String vsw-bp1upw03qyz8n7us9****

The ID of the entity. The value of this parameter depends on the value of the AssociationType parameter:

  • If the value of AssociationType is Resource, the value of this parameter is the resource ID.
  • If the value of AssociationType is Target, the value of this parameter is the account ID.
EntityType String VSwitch

The type of the entity. The value of this parameter depends on the value of the AssociationType parameter:

  • If the value of AssociationType is Resource, the value of this parameter is VSwitch.
  • If the value of AssociationType is Target, the value of this parameter is Account.
ResourceShareId String rs-6GRmdD3X****

The ID of the resource share.

ResourceShareName String example

The name of the resource share.

UpdateTime String 2020-12-07T07:39:02.920Z

The time when the association was updated. The value of this parameter depends on the value of the AssociationType parameter:

  • If the value of AssociationType is Resource, the value of this parameter is the time when the association of the shared resource was updated.
  • If the value of AssociationType is Target, the value of this parameter is the time when the association of the shared target was updated.

Examples

Sample requests

https://resourcesharing.aliyuncs.com/?Action=ListResourceShareAssociations
&AssociationType=Resource
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

<ListResourceShareAssociationsResponse>
      <ResourceShareAssociations>
            <ResourceShareId>rs-6GRmdD3X****</ResourceShareId>
            <ResourceShareName>example</ResourceShareName>
            <EntityId>vsw-bp1upw03qyz8n7us9****</EntityId>
            <EntityType>VSwitch</EntityType>
            <AssociationStatusMessage></AssociationStatusMessage>
            <AssociationType>Resource</AssociationType>
            <CreateTime>2020-12-07T07:39:01.818Z</CreateTime>
            <UpdateTime>2020-12-07T07:39:02.920Z</UpdateTime>
            <AssociationStatus>Associated</AssociationStatus>
      </ResourceShareAssociations>
      <ResourceShareAssociations>
            <ResourceShareId>rs-6GRmdD3X****</ResourceShareId>
            <ResourceShareName>example</ResourceShareName>
            <EntityId>vsw-bp183p93qs667muql****</EntityId>
            <EntityType>VSwitch</EntityType>
            <AssociationStatusMessage></AssociationStatusMessage>
            <AssociationType>Resource</AssociationType>
            <CreateTime>2020-12-04T09:40:41.246Z</CreateTime>
            <UpdateTime>2020-12-07T03:17:24.067Z</UpdateTime>
            <AssociationStatus>Disassociated</AssociationStatus>
      </ResourceShareAssociations>
      <RequestId>11BA57B5-7301-4E2F-BBA5-2AE4C2F4FCDB</RequestId>
</ListResourceShareAssociationsResponse>

JSON format

{
  "ResourceShareAssociations": [
    {
      "ResourceShareId": "rs-6GRmdD3X****",
      "ResourceShareName": "example",
      "EntityId": "vsw-bp1upw03qyz8n7us9****",
      "EntityType": "VSwitch",
      "AssociationStatusMessage": "",
      "AssociationType": "Resource",
      "CreateTime": "2020-12-07T07:39:01.818Z",
      "UpdateTime": "2020-12-07T07:39:02.920Z",
      "AssociationStatus": "Associated"
    },
    {
      "ResourceShareId": "rs-6GRmdD3X****",
      "ResourceShareName": "example",
      "EntityId": "vsw-bp183p93qs667muql****",
      "EntityType": "VSwitch",
      "AssociationStatusMessage": "",
      "AssociationType": "Resource",
      "CreateTime": "2020-12-04T09:40:41.246Z",
      "UpdateTime": "2020-12-07T03:17:24.067Z",
      "AssociationStatus": "Disassociated"
    }
  ],
  "RequestId": "11BA57B5-7301-4E2F-BBA5-2AE4C2F4FCDB"
}

Error codes

HTTP status code Error code Error message Description
400 MissingParameter.AssociationType You must specify AssociationType. The error message returned because the AssociationType parameter is not specified.
400 InvalidParameter.AssociationType The AssociationType is invalid. The error message returned because the value of the AssociationType parameter is invalid.
400 InvalidParameter.AssociationStatus The AssociationStatus is invalid. The error message returned because the value of the AssociationStatus 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.Target The Target is invalid. The error message returned because the value of the Target parameter is invalid.
400 InvalidParameter.ResourceId The ResourceId is invalid. The error message returned because the value of the ResourceId parameter is invalid.
400 ConflictedAssociationType The specified ResourceId or Target conflicts with AssociationType. The error message returned because the value of the ResourceId or Target parameter conflicts with that of the AssociationType 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.