Creates a resource share.
Resource Sharing allows you to share the resources of your Alibaba Cloud account with other accounts and access the resources shared by other accounts. To share your resources with other accounts, you can create resource shares. Then, add the resources and the accounts with which you want to share the resources to the resource shares. For more information about Resource Sharing, see Overview of Resource Sharing.
Resource Sharing has the following limits:
- You can share your resources only with the member accounts in your resource directory. A maximum of five member accounts can be specified at a time.
- By default, a maximum of 10 resource shares can be created within an Alibaba Cloud account.
- A maximum of 10 resources can be shared within an Alibaba Cloud account. A maximum of five resources can be specified at a time.
In this example, a resource share named test
is created to share the vSwitch vsw-bp183p93qs667muql****
in the cn-hangzhou
region to the member account 172050525300****
.
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateResourceShare |
The operation that you want to perform. Set the value to CreateResourceShare. |
RegionId | String | Yes | cn-hangzhou |
The region ID. For more information about regions where the Resource Sharing service is available, see DescribeRegions. |
ResourceShareName | String | Yes | test |
The name of the resource share. The name must be 1 to 50 characters in length. It can contain letters, digits, periods (.), underscores (_), and hyphens (-). |
Resources.N.ResourceId | String | No | vsw-bp183p93qs667muql**** |
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.
|
Resources.N.ResourceType | String | No | VSwitch |
The type 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. Set the value to VSwitch. Note
|
Targets.N | RepeatList | No | 172050525300**** |
The shared target. A shared target shares the resources of resource owners. You can share your resources only with the member accounts in your resource directory. A shared target is indicated by its account ID. For more information about how to obtain the ID, see View the basic information of a member account. Valid values of N: 1 to 5. This indicates that a maximum of five shared targets can be specified at a time. |
For more information about common parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 2C3FA051-61DC-4F3E-81E9-E4830524DF4B |
The ID of the request. |
ResourceShare | Struct |
The information of the resource share. |
|
CreateTime | String | 2020-12-03T08:02:22.413Z |
The time when the resource share was created. |
ResourceShareId | String | rs-qSkW1HBY**** |
The ID of the resource share. |
ResourceShareName | String | test |
The name of the resource share. |
ResourceShareOwner | String | 151266687691**** |
The owner of the resource share. |
ResourceShareStatus | String | Active |
The status of the resource share. Valid values:
Note The system automatically deletes the records of resource shares in the Deleted state
within 48 hours to 96 hours after you delete the resource shares.
|
UpdateTime | String | 2020-12-03T08:02:22.413Z |
The time when the resource share was updated. |
Examples
Sample requests
https://resourcesharing.aliyuncs.com/?Action=CreateResourceShare
&RegionId=cn-hangzhou
&ResourceShareName=test
&Resources.1.ResourceId=vsw-bp183p93qs667muql****
&Resources.1.ResourceType=VSwitch
&Targets.1=172050525300****
&<Common request parameters>
Sample success responses
XML
format
<CreateResourceShareResponse>
<RequestId>2C3FA051-61DC-4F3E-81E9-E4830524DF4B</RequestId>
<ResourceShare>
<ResourceShareId>rs-qSkW1HBY****</ResourceShareId>
<ResourceShareName>test</ResourceShareName>
<ResourceShareStatus>Active</ResourceShareStatus>
<CreateTime>2020-12-03T08:02:22.413Z</CreateTime>
<UpdateTime>2020-12-03T08:02:22.413Z</UpdateTime>
<ResourceShareOwner>151266687691****</ResourceShareOwner>
</ResourceShare>
</CreateResourceShareResponse>
JSON
format
{
"RequestId": "2C3FA051-61DC-4F3E-81E9-E4830524DF4B",
"ResourceShare": {
"ResourceShareId": "rs-qSkW1HBY****",
"ResourceShareName": "test",
"ResourceShareStatus": "Active",
"CreateTime": "2020-12-03T08:02:22.413Z",
"UpdateTime": "2020-12-03T08:02:22.413Z",
"ResourceShareOwner": "151266687691****"
}
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | MissingParameter.ResourceShareName | You must specify ResourceShareName. | The error message returned because the ResourceShareName parameter is not specified. |
400 | InvalidParameter.ResourceShareName | The ResourceShareName is invalid. | The error message returned because the value of the ResourceShareName parameter is invalid. |
400 | InvalidParameter.ResourceShareName.Length | The maximum length of ResourceShareName exceeds 50 characters. | The error message returned because the length of the value specified for the ResourceShareName parameter has exceeded the upper limit. Specify a value that is up to 50 characters in length. |
400 | InvalidParameter.Resources | The Resources is invalid. | The error message returned because the specified resource is invalid. |
400 | InvalidParameter.Resources.Length | The maximum number of Resources exceeds 5. | The error message returned because the number of specified resources has exceeded the upper limit. Specify a maximum of five resources. |
400 | InvalidParameter.Resources.Duplicate | The Resources contains duplicate values. | The error message returned because duplicate resources are specified. |
400 | InvalidParameter.Targets | The Targets is invalid. | The error message returned because the value of the Targets parameter is invalid. |
400 | InvalidParameter.Targets.Length | The maximum number of Targets exceeds 5. | The error message returned because the number of specified shared targets has exceeded the upper limit. Specify a maximum of five shared targets. |
400 | InvalidParameter.Targets.Duplicate | The Targets contains duplicate values. | The error message returned because duplicate accounts are specified. |
409 | AccountNotInResourceDirectory | The account is not a master or a member of a resource directory. | The error message returned because the specified account is not in your resource directory. |
409 | QuotaExceeded.ResourceShare.Count | The maximum number of ResourceShare exceeds the limit. | The error message returned because the maximum number of resource shares has reached. |
409 | EntityAlreadyExists.ResourceShare | The specified resource share ID already exists. | The error message returned because the ID of the resource share exists. |
409 | QuotaExceeded.SharedResource.Count | The maximum number of shared resources per account exceeds 10. | The error message returned because the maximum number of shared resources within an Alibaba Cloud account has been reached. A maximum of 10 resources can be shared within an Alibaba Cloud account. |
409 | ShareWithYourself | You cannot share resources with yourself. | The error message returned because you are not allowed to share resources with yourself. |
400 | InvalidTarget | The shared target does not exist in the resource directory. | The error message returned because the specified account is not in your resource directory. |
400 | InvalidParameter | The specified parameter is invalid. | The error message returned because a specified parameter is invalid. |
For a list of error codes, visit the API Error Center.