Membuat bagian sumber daya.
Deskripsi operasi
Alibaba Cloud Resource Sharing lets you share resources from your account with one or more Principals. For more information, see Resource Sharing overview.
This example shows how to use the management account of a Resource Directory to create a resource share named test in the cn-hangzhou region and share the vSwitch vsw-bp183p93qs667muql**** with member 172050525300****.
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
resourcesharing:CreateResourceShare |
create |
*全部资源
|
|
None |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| ResourceShareName |
string |
Yes |
Nama bagian sumber daya. Panjang nama harus 1 hingga 50 karakter. Dapat berisi huruf, angka, titik (.), garis bawah (_), dan tanda hubung (-). |
test |
| Resources |
array<object> |
No |
Daftar Resource yang dibagikan. |
|
|
object |
No |
A shared resource. |
||
| ResourceId |
string |
No |
The ID of the shared resource. You can add up to five shared resources at a time. Catatan
Specify the |
vsw-bp183p93qs667muql**** |
| ResourceType |
string |
No |
The type of the shared resource. You can add up to five shared resources at a time. For a list of supported resource types, see Services that work with Resource Sharing. Catatan
Specify the |
VSwitch |
| Targets |
array |
No |
Daftar pihak yang berwenang. |
172050525300**** |
|
string |
No |
The ID of a principal. Valid values depend on the setting of
For more information, see Methods used to share resources, View the ID of a resource directory, View the ID of a folder, or View the ID of a member. You can add up to five principals at a time. |
172050525300**** |
|
| ResourceArns |
array |
No |
Nama Sumber Daya Alibaba Cloud (ARN) Resource yang dibagikan. Anda dapat menambahkan hingga lima Resource yang dibagikan sekaligus. |
|
|
string |
No |
The ARN of the shared resource. Catatan
For the format of a resource ARN, see Services that work with Resource Sharing. |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
|
| PermissionNames |
array |
No |
Nama izin. Jika tidak ditentukan, sistem akan melampirkan izin default untuk tipe Sumber daya. Untuk detail, lihat Permission Library. |
|
|
string |
No |
The name of the permission. If unspecified, the system attaches the default permission for the resource type. For details, see Permission Library. |
AliyunRSDefaultPermissionVSwitch |
|
| AllowExternalTargets |
boolean |
No |
Apakah akan mengizinkan berbagi dengan akun di luar direktori sumber daya Anda. Nilai valid:
|
false |
| ResourceGroupId |
string |
No |
ID kelompok sumber daya. |
rg-aekz5nlvlak**** |
| TargetProperties |
array<object> |
No |
Properti pihak yang berwenang. Catatan
Parameter ini hanya tersedia ketika pihak yang berwenang adalah layanan Alibaba Cloud. |
|
|
object |
No |
The properties of the principal. Catatan
This parameter is available only when the principal is an Alibaba Cloud service. |
||
| Property |
string |
No |
The property of the principal. For example, you can specify a time range for resource sharing. Valid values for
Catatan
Specify the |
{ "timeRange":{ "timeRangeType":"timeRange", "beginAtTime":"00:00", "timezone":"UTC+8", "endAtTime":"19:59" } } |
| TargetId |
string |
No |
The ID of the principal. Catatan
Specify the |
172050525300**** |
| ResourceProperties |
array<object> |
No |
Daftar properti Sumber daya. |
|
|
object |
No |
A resource property. |
||
| Property |
string |
No |
The resource property. |
{"sharePrincipals":true,"shareTagOptions":false} |
| ResourceArn |
string |
No |
The ARN of the resource. |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
| Tag |
array<object> |
No |
Tag bagian sumber daya. Anda dapat menambahkan maksimum 20 tag. |
|
|
object |
No |
A tag. |
||
| Key |
string |
No |
The tag key. Catatan
The tag key can be up to 128 characters in length. It cannot start with |
k1 |
| Value |
string |
No |
The tag value. Catatan
The tag value can be up to 128 characters in length. It cannot start with |
v1 |
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| RequestId |
string |
The request ID. |
2C3FA051-61DC-4F3E-81E9-E4830524DF4B |
| ResourceShare |
object |
The information about the resource share. |
|
| AllowExternalTargets |
boolean |
Indicates whether accounts outside the resource directory are allowed to access the shared resources. Valid values:
|
false |
| CreateTime |
string |
The time when the resource share was created. |
2020-12-03T08:02:22.413Z |
| ResourceShareId |
string |
The ID of the resource share. |
rs-qSkW1HBY**** |
| ResourceShareName |
string |
The name of the resource share. |
test |
| ResourceShareOwner |
string |
The owner of the resource share. |
151266687691**** |
| ResourceShareStatus |
string |
The status of the resource share. Valid values:
Catatan
A resource share in the |
Active |
| UpdateTime |
string |
The time when the resource share was last updated. |
2020-12-03T08:02:22.413Z |
Contoh
Respons sukses
JSONformat
{
"RequestId": "2C3FA051-61DC-4F3E-81E9-E4830524DF4B",
"ResourceShare": {
"AllowExternalTargets": false,
"CreateTime": "2020-12-03T08:02:22.413Z",
"ResourceShareId": "rs-qSkW1HBY****",
"ResourceShareName": "test",
"ResourceShareOwner": "151266687691****",
"ResourceShareStatus": "Active",
"UpdateTime": "2020-12-03T08:02:22.413Z"
}
}
Kode kesalahan
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParameter.ResourceShareName | The ResourceShareName is invalid. | |
| 400 | InvalidParameter.ResourceShareName.Length | The maximum length of ResourceShareName exceeds 50 characters. | |
| 400 | InvalidParameter.Resources | The Resources is invalid. | |
| 400 | InvalidParameter.Resources.Duplicate | The Resources contains duplicate values. | |
| 400 | InvalidParameter.Resources.Length | The maximum number of Resources exceeds 5. | |
| 400 | InvalidParameter.Targets | The Targets is invalid. | |
| 400 | InvalidParameter.Targets.Duplicate | The Targets contains duplicate values. | |
| 400 | InvalidParameter.Targets.Length | The maximum number of Targets exceeds 5. | |
| 400 | InvalidTarget | The shared target does not exist in the resource directory. | |
| 400 | InvalidParameter | The specified parameter is invalid. | |
| 400 | MissingParameter.ResourceShareName | You must specify ResourceShareName. | |
| 400 | InvalidParameter.ResourceType | The ResourceType is invalid. | |
| 400 | InvalidParameter.PermissionNames.Duplicate | The PermissionNames duplicate values. | |
| 400 | InvalidParameter.PermissionNames.Length | The maximum length of PermissionNames exceeds quota limit. | |
| 400 | InvalidParameter.TargetProperties | The TargetProperties is invalid. | |
| 400 | InvalidParameter.TargetProperties.Duplicate | The TargetProperties contains duplicate values. | |
| 400 | InvalidParameter.TargetProperties.Length | The TargetProperties beyond the length limit. | |
| 400 | InvalidParameter.ResourceArns | The ResourceArns is invalid. | |
| 400 | InvalidParameter.ResourceArns.Duplicate | The ResourceArns contains duplicate values. | |
| 400 | InvalidParameter.ResourceArns.Length | The ResourceArns beyond the length limit. | |
| 400 | InvalidParameter.ResourceConflict | 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. | |
| 400 | InvalidParameter.ResourceProperties | The ResourceProperties is invalid. | |
| 400 | InvalidParameter.ResourceProperties.Duplicate | The ResourceProperties contains duplicate values. | |
| 400 | InvalidParameter.ResourceProperties.Length | The ResourceProperties beyond the length limit. | |
| 400 | NotSupport.ResourceProperty | The resource type does not support resource property. | |
| 404 | EntityNotExists.Permission | The resource share permission does not exist. | |
| 409 | NotEnableSharingWithResourceDirectory | You have not enabled sharing with your Resource Directory. | |
| 409 | AccountNotInResourceDirectory | The account is not a master or a member of a resource directory. | |
| 409 | QuotaExceeded.ResourceShare.Count | The maximum number of ResourceShare exceeds the limit. | |
| 409 | EntityAlreadyExists.ResourceShare | The specified resource share ID already exists. | |
| 409 | QuotaExceeded.SharedResource.Count | The maximum number of shared resources per account exceeds the limit. | |
| 409 | ShareWithYourself | You cannot share resources with yourself. | |
| 409 | NotManagementAccount | Only the management account of the service is allowed to share such resources. | |
| 409 | QuotaExceeded.PendingInvitations | The maximum number of pending invitations exceeds the limit. | |
| 409 | InvalidTarget.LegalEntityMismatch | The target account does not have the same legal entity as the resource owner account. | |
| 409 | ExternalTargetsNotAllowed.ResourceType | The resource share includes resource types that cannot be shared with accounts outside the resource directory. | |
| 409 | InvalidTarget.SiteMismatch | Cross-site resource sharing is not supported. | |
| 409 | NotSupport.Service.ExistInOtherResourceShare | The resource type has been shared to the target service through other resourceShare. Please share it in the same resourceShare. | |
| 409 | NotSupport.Service.AssociateConflict | The same resource cannot be shared repeatedly to the target service. |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.