All Products
Search
Document Center

Resource Management:ListResourceShareAssociations

Last Updated:Nov 19, 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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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:ListResourceShareAssociationslist
*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.

Valid values of N: 1 to 5. This indicates that a maximum of five resource shares can be specified at a time.

stringNo

The ID of a resource share.

rs-6GRmdD3X****

Response parameters

ParameterTypeDescriptionExample
object

The returned result.

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 request ID.

11BA57B5-7301-4E2F-BBA5-2AE4C2F4FCDB
ResourceShareAssociationsarray<object>

The information of the entities.

ResourceShareAssociationobject

The information of an entity.

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 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 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
  • false
false
TargetPropertystring

The properties of the principal, such as the time range within which the resource is shared. Valid values of timeRangeType:

  • timeRange: a specific time range
  • day: all day
Note This parameter is returned only if the principal is an Alibaba Cloud service.
{ "timeRange":{ "timeRangeType":"timeRange", "beginAtTime":"00:00", "timezone":"UTC+8", "endAtTime":"19:59" } }
AssociationFailedDetailsarray<object>

The information about the failure.

AssociationFailedDetailobject

The information about the failure.

Statusstring

This parameter is deprecated. The FailureReason parameter is used instead.

None
StatusMessagestring

This parameter is deprecated. The FailureDescription parameter is used instead.

None
AssociateTypestring

This parameter is deprecated. The OperationType parameter is used instead.

None
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 principal.
  • If the value of AssociationType is Target, the value of this parameter is the ID of the resource.
172050525300****
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 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 ResourceDirectory, Folder, Account, or Service.
Account
FailureReasonstring

The failure cause. Valid values:

  • Unavailable: The resource does not exist.
  • LimitExceeded: The number of principals for the resource exceeds the upper limit.
  • ZonalResourceInaccessible: The resource is unavailable in this region.
  • InternalError: An internal error occurred.
  • UnsupportedOperation: You cannot perform this operation.
Unavailable
FailureDescriptionstring

The failure description.

You cannot access the specified resource at this time.
OperationTypestring

The operation type. Valid values:

  • Associate
  • Disassociate
Associate

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,
      "TargetProperty": "{\n    \"timeRange\":{\n        \"timeRangeType\":\"timeRange\",\n        \"beginAtTime\":\"00:00\",\n        \"timezone\":\"UTC+8\",\n        \"endAtTime\":\"19:59\"\n    }\n}",
      "AssociationFailedDetails": [
        {
          "Status": "None\n",
          "StatusMessage": "None\n",
          "AssociateType": "None\n",
          "EntityId": "172050525300****",
          "EntityType": "Account",
          "FailureReason": "Unavailable",
          "FailureDescription": "You cannot access the specified resource at this time.",
          "OperationType": "Associate"
        }
      ]
    }
  ]
}

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 changedView Change Details
2024-01-03The Error code has changed. The response structure of the API has changedView Change Details