Crea un recurso compartido.
Descripción de la operación
El servicio de Recursos compartidos de Alibaba Cloud le permite compartir recursos de su cuenta con uno o más principales. Para obtener más información, consulte Resumen de Recursos compartidos.
Este ejemplo muestra cómo utilizar la cuenta de administración de un Directorio de recursos para crear un recurso compartido denominado test en la región cn-hangzhou y compartir el vSwitch vsw-bp183p93qs667muql**** con el miembro 172050525300****.
Pruébelo ahora
Test
Autorización de RAM
|
Action |
Nivel de acceso |
Tipo de recurso |
Clave de condición |
Acción dependiente |
|
resourcesharing:CreateResourceShare |
create |
*All Resource
|
|
Ninguna |
Parámetros de la solicitud
|
Parámetro |
Tipo |
Obligatorio |
Descripción |
Ejemplo |
| ResourceShareName |
string |
Sí |
El nombre del recurso compartido. El nombre debe tener entre 1 y 50 caracteres de longitud. Puede contener letras, dígitos, caracteres chinos, puntos (.), guiones bajos (_) y guiones (-). |
test |
| Resources |
array<object> |
No |
Una lista de recursos compartidos. |
|
|
object |
No |
Un recurso compartido. |
||
| ResourceId |
string |
No |
El ID del recurso compartido. Puede agregar hasta cinco recursos compartidos a la vez. Nota
Especifique los parámetros |
vsw-bp183p93qs667muql**** |
| ResourceType |
string |
No |
El tipo del recurso compartido. Puede agregar hasta cinco recursos compartidos a la vez. Para consultar una lista de los tipos de recursos compatibles, consulte Servicios compatibles con Recursos compartidos. Nota
Especifique los parámetros |
VSwitch |
| Targets |
array |
No |
Una lista de principales. |
172050525300**** |
|
string |
No |
El ID de un principal. Los valores válidos dependen de la configuración de
Para obtener más información, consulte Métodos para compartir recursos, Ver el ID de un directorio de recursos, Ver el ID de una carpeta o Ver el ID de un miembro. Puede agregar hasta cinco principales a la vez. |
172050525300**** |
|
| ResourceArns |
array |
No |
Los Nombres de recursos de Alibaba Cloud (ARN) de los recursos compartidos. Puede agregar hasta cinco recursos compartidos a la vez. |
|
|
string |
No |
El ARN del recurso compartido. Nota
Para consultar el formato de un ARN de recurso, consulte Servicios compatibles con Recursos compartidos. |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
|
| PermissionNames |
array |
No |
El nombre del permiso. Si no se especifica, el sistema adjunta el permiso predeterminado para el tipo de recurso. Para obtener más detalles, consulte Biblioteca de permisos. |
|
|
string |
No |
El nombre del permiso. Si no se especifica, el sistema adjunta el permiso predeterminado para el tipo de recurso. Para obtener más detalles, consulte Biblioteca de permisos. |
AliyunRSDefaultPermissionVSwitch |
|
| AllowExternalTargets |
boolean |
No |
Especifica si se permite compartir con cuentas fuera de su directorio de recursos. Valores válidos:
|
false |
| ResourceGroupId |
string |
No |
El ID del grupo de recursos. |
rg-aekz5nlvlak**** |
| TargetProperties |
array<object> |
No |
Las propiedades del principal. Nota
Este parámetro está disponible únicamente cuando el principal es un servicio de Alibaba Cloud. |
|
|
object |
No |
Las propiedades del principal. Nota
Este parámetro está disponible únicamente cuando el principal es un servicio de Alibaba Cloud. |
||
| Property |
string |
No |
La propiedad del principal. Por ejemplo, puede especificar un intervalo de tiempo para compartir recursos. Valores válidos para
Nota
Especifique los parámetros |
{ "timeRange":{ "timeRangeType":"timeRange", "beginAtTime":"00:00", "timezone":"UTC+8", "endAtTime":"19:59" } } |
| TargetId |
string |
No |
El ID del principal. Nota
Especifique los parámetros |
172050525300**** |
| ResourceProperties |
array<object> |
No |
Una lista de propiedades de recursos. |
|
|
object |
No |
Una propiedad de recurso. |
||
| Property |
string |
No |
La propiedad del recurso. |
{"sharePrincipals":true,"shareTagOptions":false} |
| ResourceArn |
string |
No |
El ARN del recurso. |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
| Tag |
array<object> |
No |
Las etiquetas del recurso compartido. Puede agregar un máximo de 20 etiquetas. |
|
|
object |
No |
Una etiqueta. |
||
| Key |
string |
No |
La clave de la etiqueta. Nota
La clave de la etiqueta puede tener hasta 128 caracteres de longitud. No puede comenzar con |
k1 |
| Value |
string |
No |
El valor de la etiqueta. Nota
El valor de la etiqueta puede tener hasta 128 caracteres de longitud. No puede comenzar con |
v1 |
Elementos de la respuesta
|
Elemento |
Tipo |
Descripción |
Ejemplo |
|
object |
Los parámetros de respuesta. |
||
| RequestId |
string |
El ID de la solicitud. |
2C3FA051-61DC-4F3E-81E9-E4830524DF4B |
| ResourceShare |
object |
La información sobre el recurso compartido. |
|
| AllowExternalTargets |
boolean |
Indica si se permite que las cuentas fuera del directorio de recursos accedan a los recursos compartidos. Valores válidos:
|
false |
| CreateTime |
string |
La hora en que se creó el recurso compartido. |
2020-12-03T08:02:22.413Z |
| ResourceShareId |
string |
El ID del recurso compartido. |
rs-qSkW1HBY**** |
| ResourceShareName |
string |
El nombre del recurso compartido. |
test |
| ResourceShareOwner |
string |
El propietario del recurso compartido. |
151266687691**** |
| ResourceShareStatus |
string |
El estado del recurso compartido. Valores válidos:
Nota
Un recurso compartido en estado |
Active |
| UpdateTime |
string |
La hora de la última actualización del recurso compartido. |
2020-12-03T08:02:22.413Z |
Ejemplos
Respuesta exitosa
JSON Formato
{
"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"
}
}
Códigos de error
|
Código de estado HTTP |
Código de error |
Mensaje de error |
Descripción |
|---|---|---|---|
| 400 | InvalidParameter.ResourceShareName | The ResourceShareName is invalid. | The ResourceShareName parameter is invalid. |
| 400 | InvalidParameter.ResourceShareName.Length | The maximum length of ResourceShareName exceeds 50 characters. | The length of ResourceShareName cannot exceed 50 characters. |
| 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 | InvalidTarget | The shared target does not exist in the resource directory. | The specified Targets value is not a member in the resource directory. |
| 400 | InvalidParameter | The specified parameter is invalid. | The specified parameter is invalid. |
| 400 | MissingParameter.ResourceShareName | You must specify ResourceShareName. | The ResourceShareName parameter is missing. |
| 400 | InvalidParameter.ResourceType | The ResourceType is invalid. | The specified ResourceType parameter is invalid. |
| 400 | InvalidParameter.PermissionNames.Duplicate | The PermissionNames duplicate values. | Duplicate values are specified for the PermissionNames parameter. |
| 400 | InvalidParameter.PermissionNames.Length | The maximum length of PermissionNames exceeds quota limit. | The length of the value specified for the PermissionNames parameter exceeds the limit. |
| 400 | InvalidParameter.TargetProperties | The TargetProperties is invalid. | The TargetProperties is invalid. |
| 400 | InvalidParameter.TargetProperties.Duplicate | The TargetProperties contains duplicate values. | TargetProperties contains duplicate parameters. |
| 400 | InvalidParameter.TargetProperties.Length | The TargetProperties beyond the length limit. | The TargetProperties beyond the length limit. |
| 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. |
| 400 | InvalidParameter.ResourceProperties | The ResourceProperties is invalid. | The ResourceProperties is invalid. |
| 400 | InvalidParameter.ResourceProperties.Duplicate | The ResourceProperties contains duplicate values. | The ResourceProperties contains duplicate values. |
| 400 | InvalidParameter.ResourceProperties.Length | The ResourceProperties beyond the length limit. | The ResourceProperties beyond the length limit. |
| 400 | NotSupport.ResourceProperty | The resource type does not support resource property. | The resource type does not support resource property. |
| 404 | EntityNotExists.Permission | The resource share permission does not exist. | You do not have the required permissions. |
| 409 | NotEnableSharingWithResourceDirectory | You have not enabled sharing with your Resource Directory. | You have not enabled sharing with Resource Directory. |
| 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 | QuotaExceeded.ResourceShare.Count | The maximum number of ResourceShare exceeds the limit. | The maximum number of ResourceShare exceeds the limit. |
| 409 | EntityAlreadyExists.ResourceShare | The specified resource share ID already exists. | The specified resource share ID already exists. |
| 409 | QuotaExceeded.SharedResource.Count | The maximum number of shared resources per account exceeds the limit. | The maximum number of Resources values per account is exceeded. |
| 409 | ShareWithYourself | You cannot share resources with yourself. | You cannot share resources with yourself. |
| 409 | NotManagementAccount | Only the management account of the service is allowed to share such resources. | 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. |
| 409 | QuotaExceeded.PendingInvitations | The maximum number of pending invitations exceeds the limit. | The number of invitations exceeds the upper limit. |
| 409 | InvalidTarget.LegalEntityMismatch | The target account does not have the same legal entity as the resource owner account. | The enterprise name of the principal is inconsistent with that of the resource owner. |
| 409 | ExternalTargetsNotAllowed.ResourceType | The resource share includes resource types that cannot be shared with accounts outside the resource directory. | The resource share contains resources that do not support this operation. |
| 409 | InvalidTarget.SiteMismatch | Cross-site resource sharing is not supported. | The principal and resource owner are registered at different sites. |
| 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. |
Consulte Códigos de error para ver la lista completa.
Notas de la versión
Consulte Notas de la versión para ver la lista completa.