Associates resources or principals with a resource share.
Operation description
This topic provides an example on how to call the API operation to associate the vSwitch vsw-bp183p93qs667muql****
and the member 172050525300****
with the resource share rs-6GRmdD3X****
in the cn-hangzhou
region. After the association, the vSwitch is shared with the member.
Debugging
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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ResourceShareId | string | Yes | The ID of the resource share. | rs-6GRmdD3X**** |
Resources | object [] | No | The information about the resources. | |
ResourceType | string | No | 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 |
ResourceId | string | No | 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**** |
Targets | array | No | The information about the principals. | |
string | No | The information about a principal.
For more information, see Resource sharing modes, View the ID of a resource directory, View the ID of a folder, or View the ID of a member. Valid values of N: 1 to 5. This indicates that a maximum of five principals can be specified at a time. | 172050525300**** | |
PermissionNames | array | No | The information about the permissions. If you do not configure this parameter, the system automatically associates the default permission for the specified resource type with the resource share. For more information, see Permission library. | |
string | No | The name of a permission. If you do not configure this parameter, the system automatically associates the default permission for the specified resource type with the resource share. For more information, see Permission library. | AliyunRSDefaultPermissionVSwitch | |
TargetProperties | object [] | No | The properties of the principal. Note
This parameter is available only when you specify an Alibaba Cloud service as a principal.
| |
TargetId | string | No | The ID of the principal. Note
TargetProperties.N.TargetId and TargetProperties.N.Property must be used in pairs.
| 172050525300**** |
Property | string | No | The property parameter of the principal. For example, you can specify a parameter that indicates the time range for resource sharing. Valid values of
Note
TargetProperties.N.TargetId and TargetProperties.N.Property must be used in pairs.
| { "timeRange":{ "timeRangeType":"timeRange", "beginAtTime":"00:00", "timezone":"UTC+8", "endAtTime":"19:59" } } |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "111FB84A-60A9-403E-9067-E55D7EE95BD1",
"ResourceShareAssociations": [
{
"UpdateTime": "2020-12-04T09:40:41.246Z",
"EntityId": "vsw-bp183p93qs667muql****",
"ResourceShareName": "test",
"CreateTime": "2020-12-04T09:40:41.246Z",
"EntityType": "VSwitch",
"ResourceShareId": "rs-6GRmdD3X****",
"AssociationStatusMessage": "The reason for the association failure.",
"AssociationType": "Resource",
"AssociationStatus": "Associating",
"TargetProperty": "{\n \"plan\":{\n \"timeRangeType\":\"timeRange\",\n \"beginAtTime\":\"00:00\",\n \"timezone\":\"UTC+8\",\n \"endAtTime\":\"19:59\"\n }\n}"
}
]
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
You must specify ResourceShareId. | |||
The ResourceShareId parameter is invalid. | |||
The specified shared resource is invalid. | |||
The specified Resources parameter contains duplicate values. | |||
The number of specified shared resources cannot exceed 5. | |||
The specified Targets parameter is invalid. | |||
The specified Targets parameter contains duplicate values. | |||
The number of Targets values cannot exceed 5. | |||
The specified Targets value is not a member in the resource directory. | |||
You must specify a resource or a resource account. | |||
The specified parameter is invalid. | |||
The specified ResourceType parameter is invalid. | |||
Duplicate values are specified for the PermissionNames parameter. | |||
The length of the value specified for the PermissionNames parameter exceeds the limit. | |||
The TargetProperties is invalid. | |||
TargetProperties contains duplicate parameters. | |||
The TargetProperties beyond the length limit. | |||
The resource share does not exist in the current account. | |||
You do not have the required permissions. | |||
You have not enabled sharing with Resource Directory. | |||
The specified Targets value is not a member in the resource directory. | |||
The status of the resource share does not allow the specified operation. | |||
The maximum number of Resources values per account is exceeded. | |||
You cannot share resources with yourself. | |||
The association operation is not supported while an disassociation is being performed. | |||
Only the management account of the resource directory can be used to share the current type of resource. If you still want to use the current account, contact the owner of the management account to configure the current account as a delegated administrator account of the trusted service to which the resource belongs. | |||
The number of invitations exceeds the upper limit. | |||
The enterprise name of the principal is inconsistent with that of the resource owner. | |||
The resource share contains resources that do not support this operation. | |||
The principal and resource owner are registered at different sites. | |||
- | |||
- |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
see changesets | ||||||||||||||
| ||||||||||||||
see changesets | ||||||||||||||
| ||||||||||||||
see changesets | ||||||||||||||
| ||||||||||||||
see changesets | ||||||||||||||
|