All Products
Search
Document Center

Resource Management:DisassociateResourceShare

Last Updated:Feb 26, 2024

Disassociates resources or principals from a resource share.

Operation description

  • A resource owner can call this API operation to remove shared resources or principals from a resource share.
  • If an Alibaba Cloud account that is not the management account or a member of a resource directory is added to a resource share as a principal, you can use the Alibaba Cloud account to call this API operation to exit the resource share. For more information, see Exit a resource share.

This topic provides an example on how to use the management account of a resource directory to call the API operation to remove the member 172050525300**** from the resource share rs-6GRmdD3X**** in the cn-hangzhou region. After the member is removed from the resource share, the member cannot share the resources in the resource share.

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:DisassociateResourceShareWrite
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ResourceShareIdstringYes

The ID of the resource share.

rs-6GRmdD3X****
Resourcesobject []No

The shared resource.

ResourceTypestringNo

The type of a shared resource.

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

For more information about the types of resources that can be shared, see Services that work with Resource Sharing.

Note Resources.N.ResourceId and Resources.N.ResourceType must be used in pairs.
VSwitch
ResourceIdstringNo

The ID of a shared resource.

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

Note Resources.N.ResourceId and Resources.N.ResourceType must be used in pairs.
vsw-bp183p93qs667muql****
TargetsarrayNo

The ID of a principal.

stringNo

The ID of a principal.

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

172050525300****
ResourceOwnerstringNo

The owner of the resource share. Valid values:

  • Self: The resource share belongs to the current account. This is the default value. If you are the management account or a member of a resource directory and you want to remove resources or principals from a resource share, set this parameter to Self.
  • OtherAccounts: The resource share belongs to another account. If you are not the management account or a member of a resource directory and you want to exit a resource share, set this parameter to OtherAccounts.
Self

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

95230BC9-A8E8-4493-96BD-4F0C758E37F8
ResourceShareAssociationsobject []

The information of the entities that are associated with the resource share.

UpdateTimestring

The time when the disassociation 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 disassociation of the resource was updated.
  • If the value of AssociationType is Target, the value of this parameter is the time when the disassociation of the principal was updated.
2020-12-04T09:40:45.556Z
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 resource directory, folder, or member.
172050525300****
ResourceShareNamestring

The name of the resource share.

test
CreateTimestring

The time when the disassociation of the entity was performed. 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 disassociated from the resource share.
  • If the value of AssociationType is Target, the value of this parameter is the time when the principal was disassociated from the resource share.
2020-12-04T09:40:41.250Z
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.
Account
ResourceShareIdstring

The ID of the resource share.

rs-6GRmdD3X****
AssociationStatusMessagestring

The cause of the disassociation failure.

The Resources is invalid.
AssociationTypestring

The association type. Valid values:

  • Resource
  • Target
Target
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.
Disassociating

Examples

Sample success responses

JSONformat

{
  "RequestId": "95230BC9-A8E8-4493-96BD-4F0C758E37F8",
  "ResourceShareAssociations": [
    {
      "UpdateTime": "2020-12-04T09:40:45.556Z",
      "EntityId": "172050525300****",
      "ResourceShareName": "test",
      "CreateTime": "2020-12-04T09:40:41.250Z",
      "EntityType": "Account",
      "ResourceShareId": "rs-6GRmdD3X****",
      "AssociationStatusMessage": "The Resources is invalid.",
      "AssociationType": "Target",
      "AssociationStatus": "Disassociating"
    }
  ]
}

Error codes

HTTP status codeError codeError messageDescription
400MissingParameter.ResourceShareIdYou must specify ResourceShareId.You must specify ResourceShareId.
400InvalidParameter.ResourceShareIdThe ResourceShareId is invalid.The ResourceShareId parameter is invalid.
400InvalidParameter.ResourcesThe Resources is invalid.The specified shared resource is invalid.
400InvalidParameter.Resources.DuplicateThe Resources contains duplicate values.The specified Resources parameter contains duplicate values.
400InvalidParameter.Resources.LengthThe maximum number of Resources exceeds 5.The number of specified shared resources cannot exceed 5.
400InvalidParameter.TargetsThe Targets is invalid.The specified Targets parameter is invalid.
400InvalidParameter.Targets.DuplicateThe Targets contains duplicate values.The specified Targets parameter contains duplicate values.
400InvalidParameter.Targets.LengthThe maximum number of Targets exceeds 5.The number of Targets values cannot exceed 5.
400ResourceAndTargetBothEmptyEither a resource or a shared target must be specified.You must specify a resource or a resource account.
400DisassociateInvalidYou can not disassociate unassociated resource or target.The disassociation operation is not supported for an entity that is not associated with the resource share.
400InvalidParameterThe specified parameter is invalid.The specified parameter is invalid.
400InvalidParameter.ResourceTypeThe ResourceType is invalid.The specified ResourceType parameter is invalid.
404EntityNotExists.ResourceShareThe resource share does not exist in the current account.The resource share does not exist in the current account.
409AccountNotInResourceDirectoryThe account is not a master or a member of a resource directory.The specified Targets value is not a member in the resource directory.
409ResourceShareStatusMismatchActionThe status of the resource share does not allow the specified operation.The status of the resource share does not allow the specified operation.
409DisassociateConflictYou cannot perform the operation while association is already in progress.The association operation is not supported while an association is being performed.
409LeavingFailed.AccountThe account was added to the resource share automatically by resoucre directory.The current account is a principal of a resource share and cannot proactively exit the resource share. Contact the owner of the resource share to remove the account from the resource share.
409LeavingFailed.ResourceTypeThe resource share contains resources of the resource types that dont support this action.The resource share contains resources that cannot proactively exit the resource share. Contact the owner of the resource share to remove the current account from the resource share.
409ExternalTargetWithdrawConflictExisting internal association task in resource directory when disassociating with resource share.The current account is a principal of a resource share and cannot proactively exit the resource share. Contact the owner of the resource share to remove the account from the resource share.

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

Change history

Change timeSummary of changesOperation
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
    delete Error Codes: 404
    delete Error Codes: 409
Output ParametersThe response structure of the API has changed.