All Products
Search
Document Center

Resource Management:DisassociateResourceShare

Last Updated:Nov 19, 2024

Disassociates resources or principals from a resource share.

Operation description

  • A resource owner can call this API operation to disassociate shared resources or principals from a resource share.
  • If a principal does not belong to a resource directory, the principal can 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 disassociate the member 172050525300**** from the resource share rs-6GRmdD3X**** in the cn-hangzhou region. After the member is disassociated from the resource share, the member cannot share the resources in the resource share.

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

Request parameters

ParameterTypeRequiredDescriptionExample
ResourceShareIdstringYes

The ID of the resource share.

rs-6GRmdD3X****
Resourcesarray<object>No

The information about the resources.

objectNo

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 the 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 information about the principals.

stringNo

The information about the principals.

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. For resource sharing within a resource directory, if you are a resource owner and you want to disassociate resources or principals from a resource share, set this parameter to Self.
  • OtherAccounts: The resource share belongs to another account. For resource sharing outside a resource directory, if you are a principal and you want to exit a resource share, set this parameter to OtherAccounts.
Self

Response parameters

ParameterTypeDescriptionExample
object

The returned result.

RequestIdstring

The request ID.

95230BC9-A8E8-4493-96BD-4F0C758E37F8
ResourceShareAssociationsarray<object>

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

ResourceShareAssociationobject

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, member, or Alibaba Cloud service.
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
TargetPropertystring

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

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" } }

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",
      "TargetProperty": "{\n    \"timeRange\":{\n        \"timeRangeType\":\"timeRange\",\n        \"beginAtTime\":\"00:00\",\n        \"timezone\":\"UTC+8\",\n        \"endAtTime\":\"19:59\"\n    }\n}"
    }
  ]
}

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 changedView Change Details