Queries the association records of resource shares.

Usage notes

This topic provides an example on how to call the API operation to query the association records of the resource shares that are created by using the current Alibaba Cloud account in the cn-hangzhou region. The response shows the following records:

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

Limits

You can call this operation up to 20 times per second per account. This operation is globally limited to 500 times per second across all accounts. If the number of the calls per second exceeds a limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limits when you call this operation.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ListResourceShareAssociations

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

ResourceId String No vsw-bp183p93qs667muql****

The ID of the resource.

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

The ID of the principal.

Note This parameter is unavailable if you set the AssociationType parameter to Resource.
AssociationType String Yes Resource

The association type. Valid values:

  • Resource
  • Target
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 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 100. Default value: 20.

NextToken String No TGlzdFJlc291cm****

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

ResourceShareIds.N String No rs-6GRmdD3X****

The IDs of the resource shares.

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
NextToken String TGlzdFJlc291cm****

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

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

The time when the association of the entity 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 principal was updated.
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 ID of the shared resource.
  • If the value of AssociationType is Target, the value of this parameter is the ID of the principal.
ResourceShareName String example

The name of the resource share.

CreateTime String 2020-12-07T07:39:01.818Z

The time when the association of the entity 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 shared 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 principal was associated with or disassociated from the resource share.
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 the type of the resource. For more information about the types of resources that can be shared, see Services that work with Resource Sharing.
  • If the value of AssociationType is Target, the value of this parameter is Account.
ResourceShareId String rs-6GRmdD3X****

The ID of the resource share.

AssociationStatusMessage String The reason for the association failure.

The cause of the association failure.

AssociationType String Resource

The association type. Valid values:

  • Resource
  • Target
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 deletes the records of entities in the Failed or Disassociated state within 48 hours to 96 hours.
External Boolean false

Indicates whether the principal is outside the resource directory. Valid values:

  • true: The principal is outside the resource directory.
  • false: The principal is in the resource directory.

Examples

Sample requests

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

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

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

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "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",
    "External" : false,
    "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",
    "External" : false,
    "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 configured.
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.N parameter is invalid.
400 InvalidParameter.ResourceShareIds.Duplicate The ResourceShareIds contains duplicate values. The error message returned because duplicate resource share IDs are specified.
400 InvalidParameter.ResourceShareIds.Length The maximum length of ResourceShareIds exceeds 5 characters. The error message returned because the number of specified resource share IDs has exceeded the upper limit. Specify a maximum of five resource share IDs.
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 the value of the AssociationType parameter.
400 InvalidParameter The specified parameter is invalid. The error message returned because the value of a parameter is invalid.

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