Disassociates shared resources or principals from a resource share.
Operation description
A resource owner can call this API to remove shared resources or principals from a resource share.
A principal outside your resource directory can call this API to leave the resource share. For more information, see Exit a resource share.
This example shows how to use the management account of a resource directory to remove the principal 172050525300**** from the resource share rs-6GRmdD3X**** in the cn-hangzhou region. This action stops the sharing of resources with that principal.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
resourcesharing:DisassociateResourceShare |
update |
*All Resource
|
|
None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ResourceShareId |
string |
Yes |
The ID of the resource share. |
rs-6GRmdD3X**** |
| Resources |
array<object> |
No |
A list of shared resources to disassociate from the resource share. |
|
|
object |
No |
A shared resource. |
||
| ResourceType |
string |
No |
The type of the shared resource. You can disassociate up to five shared resources in a single request. For a list of supported resource types, see Services that work with Resource Sharing. Note
The |
VSwitch |
| ResourceId |
string |
No |
The ID of the shared resource. You can disassociate up to five shared resources in a single request. Note
The |
vsw-bp183p93qs667muql**** |
| Targets |
array |
No |
A list of principals to disassociate from the resource share. |
172050525300**** |
|
string |
No |
The ID of a principal. You can disassociate up to five principals in a single request. |
172050525300**** |
|
| ResourceArns |
array |
No |
A list of the Alibaba Cloud Resource Names (ARNs) of the shared resources. You can disassociate up to five shared resources in a single request. |
|
|
string |
No |
The Alibaba Cloud Resource Name (ARN) of the shared resource. Note
For the format of an ARN, see Services that work with Resource Sharing. |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
|
| ResourceOwner |
string |
No |
The owner of the resource share. Valid values:
|
Self |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| RequestId |
string |
The ID of the request. |
95230BC9-A8E8-4493-96BD-4F0C758E37F8 |
| ResourceShareAssociations |
array<object> |
The associations of shared resources or principals with the resource share. |
|
|
object |
An association of a shared resource or principal with the resource share. |
||
| UpdateTime |
string |
The time the association was last updated. For this operation, this indicates the time of disassociation. The meaning varies based on the
|
2020-12-04T09:40:45.556Z |
| ResourceArn |
string |
The Alibaba Cloud Resource Name (ARN) of the shared resource. Note
This parameter is returned only when |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
| ResourceShareName |
string |
The name of the resource share. |
test |
| CreateTime |
string |
The time the association was created. The meaning varies based on the
|
2020-12-04T09:40:41.250Z |
| EntityType |
string |
The type of the entity. Valid values:
|
Account |
| ResourceShareId |
string |
The ID of the resource share. |
rs-6GRmdD3X**** |
| AssociationStatusMessage |
string |
The reason why the disassociation failed. |
The Resources is invalid. |
| AssociationType |
string |
The association type. Valid values:
|
Target |
| AssociationStatus |
string |
The status of the association. Valid values:
Note
The system automatically deletes records in the |
Disassociating |
| TargetProperty |
string |
The properties of the principal, such as the time period for resource sharing. Note
This parameter is returned only when the principal is an Alibaba Cloud service. |
{ "timeRange":{ "timeRangeType":"timeRange", "beginAtTime":"00:00", "timezone":"UTC+8", "endAtTime":"19:59" } } |
| EntityId |
string |
The ID of the entity. Its value varies based on the
|
172050525300**** |
| ResourceProperty |
string |
The properties of the resource. |
{"sharePrincipals":true,"shareTagOptions":false} |
Examples
Success response
JSON format
{
"RequestId": "95230BC9-A8E8-4493-96BD-4F0C758E37F8",
"ResourceShareAssociations": [
{
"UpdateTime": "2020-12-04T09:40:45.556Z",
"ResourceArn": "acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di****",
"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}",
"EntityId": "172050525300****",
"ResourceProperty": "{\"sharePrincipals\":true,\"shareTagOptions\":false}"
}
]
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | MissingParameter.ResourceShareId | You must specify ResourceShareId. | You must specify ResourceShareId. |
| 400 | InvalidParameter.ResourceShareId | The ResourceShareId is invalid. | The ResourceShareId parameter is invalid. |
| 400 | InvalidParameter.Resources | The Resources is invalid. | The specified shared resource is invalid. |
| 400 | InvalidParameter.Resources.Duplicate | The Resources contains duplicate values. | The specified Resources parameter contains duplicate values. |
| 400 | InvalidParameter.Resources.Length | The maximum number of Resources exceeds 5. | The number of specified shared resources cannot exceed 5. |
| 400 | InvalidParameter.Targets | The Targets is invalid. | The specified Targets parameter is invalid. |
| 400 | InvalidParameter.Targets.Duplicate | The Targets contains duplicate values. | The specified Targets parameter contains duplicate values. |
| 400 | InvalidParameter.Targets.Length | The maximum number of Targets exceeds 5. | The number of Targets values cannot exceed 5. |
| 400 | ResourceAndTargetBothEmpty | Either a resource or a shared target must be specified. | You must specify a resource or a resource account. |
| 400 | DisassociateInvalid | You can not disassociate unassociated resource or target. | The disassociation operation is not supported for an entity that is not associated with the resource share. |
| 400 | InvalidParameter | The specified parameter is invalid. | The specified parameter is invalid. |
| 400 | InvalidParameter.ResourceType | The ResourceType is invalid. | The specified ResourceType parameter is invalid. |
| 400 | InvalidParameter.ResourceArns | The ResourceArns is invalid. | The ResourceArns parameter is invalid. |
| 400 | InvalidParameter.ResourceArns.Duplicate | The ResourceArns contains duplicate values. | The ResourceArns contains duplicate values. |
| 400 | InvalidParameter.ResourceArns.Length | The ResourceArns beyond the length limit. | The maximum number of ResourceArns exceeds 5. |
| 400 | InvalidParameter.ResourceConflict | Both Resources and ResourceArns cannot be specified simultaneously. Please provide only one of these parameters. | Both Resources and ResourceArns cannot be specified simultaneously. Please provide only one of these parameters. |
| 400 | NotSupport.ResourceType.ResourcesParameter | The Resources parameter does not support this resource type. Please use ResourceArns instead. | The Resources parameter does not support this resource type. Please use ResourceArns instead. |
| 404 | EntityNotExists.ResourceShare | The resource share does not exist in the current account. | The resource share does not exist in the current account. |
| 409 | AccountNotInResourceDirectory | The account is not a master or a member of a resource directory. | The specified Targets value is not a member in the resource directory. |
| 409 | ResourceShareStatusMismatchAction | The status of the resource share does not allow the specified operation. | The status of the resource share does not allow the specified operation. |
| 409 | DisassociateConflict | You cannot perform the operation while association is already in progress. | The association operation is not supported while an association is being performed. |
| 409 | LeavingFailed.Account | The 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. |
| 409 | LeavingFailed.ResourceType | The 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. |
| 409 | ExternalTargetWithdrawConflict | Existing 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. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.