Associates permissions with a resource share.

Usage notes

This topic provides an example on how to call the API operation to associate the AliyunRSDefaultPermissionVSwitch permission with the rs-6GRmdD3X**** resource share in the cn-hangzhou region.

Limits

You can call this operation up to 20 times per second per account. This operation is globally limited to 500 times per second across all accounts. If the number of the calls per second exceeds a limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limits when you call this operation.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes AssociateResourceSharePermission

The operation that you want to perform. Set the value to AssociateResourceSharePermission.

ResourceShareId String Yes rs-6GRmdD3X****

The ID of the resource share.

PermissionName String Yes AliyunRSDefaultPermissionVSwitch

The name of the permission.

Replace Boolean No false

Specifies whether to use the specified permission to replace an existing permission. Valid values:

  • false: does not use the specified permission to replace an existing permission. This is the default value. If you set the value to false for a resource share that does not have associated permissions, the system associates the specified permission with the resource share. In a resource share, one resource type can have only one permission. If you set the value to false for a resource share that already has a permission for the resource type indicated by the specified permission, the system reports an error. This prevents you from replacing the existing permission by mistake.
  • true: uses the specified permission to replace an existing permission of the same resource type.

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
RequestId String 111FB84A-60A9-403E-9067-E55D7EE95BD1

The ID of the request.

Examples

Sample requests

https://resourcesharing.cn-hangzhou.aliyuncs.com/?Action=AssociateResourceSharePermission
&ResourceShareId=rs-6GRmdD3X****
&PermissionName=AliyunRSDefaultPermissionVSwitch
&Replace=false
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<AssociateResourceSharePermissionResponse>
    <RequestId>2C3FA051-61DC-4F3E-81E9-E4830524DF4B</RequestId>
</AssociateResourceSharePermissionResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "2C3FA051-61DC-4F3E-81E9-E4830524DF4B"
}

Error codes

HTTP status code Error code Error message Description
400 InvalidParameter.ResourceShareId The ResourceShareId is invalid. The error message returned because the value of the ResourceShareId parameter is invalid.
400 MissingParameter.ResourceShareId You must specify ResourceShareId. The error message returned because the ResourceShareId parameter is not configured.
400 MissingParameter.PermissionName You must specify PermissionName. The error message returned because the PermissionName parameter is not configured.
404 EntityNotExists.Permission The resource share permission does not exist. The error message returned because the specified permission does not exist.

For a list of error codes, see Service error codes.