All Products
Search
Document Center

Resource Management:ListResourceShareAssociations

Last Updated:Mar 22, 2024

Queries the association records of resource shares.

Operation description

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.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
resourcesharing:ListResourceShareAssociationsRead
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ResourceIdstringNo

The ID of the resource.

Note This parameter is unavailable if you set the AssociationType parameter to Target.
vsw-bp183p93qs667muql****
TargetstringNo

The ID of the principal.

Note This parameter is unavailable if you set the AssociationType parameter to Resource.
172050525300****
AssociationTypestringYes

The association type. Valid values:

  • Resource
  • Target
Resource
AssociationStatusstringNo

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.
Associated
MaxResultsintegerNo

The maximum number of entries to return for a single request.

Valid values: 1 to 100. Default value: 20.

20
NextTokenstringNo

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.

TGlzdFJlc291cm****
ResourceShareIdsarrayNo

The IDs of the resource shares.

stringNo

The IDs of the resource shares.

rs-6GRmdD3X****

Response parameters

ParameterTypeDescriptionExample
object
NextTokenstring

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.

TGlzdFJlc291cm****
RequestIdstring

The ID of the request.

11BA57B5-7301-4E2F-BBA5-2AE4C2F4FCDB
ResourceShareAssociationsobject []

The information of the entities.

UpdateTimestring

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.
2020-12-07T07:39:02.920Z
EntityIdstring

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.
vsw-bp1upw03qyz8n7us9****
ResourceShareNamestring

The name of the resource share.

example
CreateTimestring

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.
2020-12-07T07:39:01.818Z
EntityTypestring

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.
VSwitch
ResourceShareIdstring

The ID of the resource share.

rs-6GRmdD3X****
AssociationStatusMessagestring

The cause of the association failure.

The reason for the association failure.
AssociationTypestring

The association type. Valid values:

  • Resource
  • Target
Resource
AssociationStatusstring

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.
Associated
Externalboolean

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.
false

Examples

Sample success responses

JSONformat

{
  "NextToken": "TGlzdFJlc291cm****",
  "RequestId": "11BA57B5-7301-4E2F-BBA5-2AE4C2F4FCDB",
  "ResourceShareAssociations": [
    {
      "UpdateTime": "2020-12-07T07:39:02.920Z",
      "EntityId": "vsw-bp1upw03qyz8n7us9****",
      "ResourceShareName": "example",
      "CreateTime": "2020-12-07T07:39:01.818Z",
      "EntityType": "VSwitch",
      "ResourceShareId": "rs-6GRmdD3X****",
      "AssociationStatusMessage": "The reason for the association failure. ",
      "AssociationType": "Resource",
      "AssociationStatus": "Associated",
      "External": false
    }
  ]
}

Error codes

HTTP status codeError codeError messageDescription
400MissingParameter.AssociationTypeYou must specify AssociationType.You must specify AssociationType.
400InvalidParameter.AssociationTypeThe AssociationType is invalid.The AssociationType parameter is invalid.
400InvalidParameter.AssociationStatusThe AssociationStatus is invalid.The AssociationStatus parameter is invalid.
400InvalidParameter.MaxResultsThe MaxResults is invalid.The MaxResults parameter is invalid.
400InvalidParameter.NextTokenThe NextToken is invalid.The NextToken parameter is invalid.
400InvalidParameter.NextToken.LengthThe maximum length of NextToken exceeds 256 characters.The length of NextToken cannot exceed 256 characters.
400InvalidParameter.ResourceShareIdsThe ResourceShareIds is invalid.The ResourceShareIds parameter is invalid.
400InvalidParameter.ResourceShareIds.DuplicateThe ResourceShareIds contains duplicate values.The ResourceShareIds parameter contains duplicate values.
400InvalidParameter.ResourceShareIds.LengthThe maximum length of ResourceShareIds exceeds 5 characters.The number of ResourceShareIds values cannot exceed 5.
400InvalidParameter.TargetThe Target is invalid.The Target parameter is invalid.
400InvalidParameter.ResourceIdThe ResourceId is invalid.The ResourceId parameter is invalid.
400ConflictedAssociationTypeThe specified ResourceId or Target conflicts with AssociationType.The specified parameter conflicts with AssociationType.
400InvalidParameterThe specified parameter is invalid.The specified parameter is invalid.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-02-04The Error code has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
Output ParametersThe response structure of the API has changed.
2024-01-03The Error code has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
Output ParametersThe response structure of the API has changed.