Associa recursos compartilhados ou principais a um compartilhamento de recursos.
Descrição da operação
Este exemplo mostra como adicionar o VSwitch vsw-bp183p93qs667muql**** ao Compartilhamento de Recursos rs-6GRmdD3X**** na região cn-hangzhou e compartilhá-lo com o Membro 172050525300**** em um diretório de recursos.
Experimente agora
Testar
Autorização RAM
|
Ação |
Nível de acesso |
Tipo de recurso |
Chave de condição |
Ação dependente |
|
resourcesharing:AssociateResourceShare |
update |
*All Resource
|
|
Nenhuma |
Parâmetros da solicitação
|
Parâmetro |
Tipo |
Obrigatório |
Descrição |
Exemplo |
| ResourceShareId |
string |
Sim |
O ID do compartilhamento de recursos. |
rs-6GRmdD3X**** |
| Resources |
array<object> |
Não |
Os recursos a serem associados ao compartilhamento de recursos. |
|
|
object |
Não |
Um recurso a ser associado. |
||
| ResourceType |
string |
Não |
O tipo do recurso compartilhado. Você pode especificar até cinco recursos em uma única solicitação. Para obter uma lista dos tipos de recursos compatíveis, consulte Serviços compatíveis com o Compartilhamento de Recursos. Nota
Resources.N.ResourceId e Resources.N.ResourceType devem ser especificados juntos. |
VSwitch |
| ResourceId |
string |
Não |
O ID do recurso compartilhado. Nota
Resources.N.ResourceId e Resources.N.ResourceType devem ser especificados juntos. |
vsw-bp183p93qs667muql**** |
| Targets |
array |
Não |
Os principais a serem associados ao compartilhamento de recursos. |
172050525300**** |
|
string |
Não |
O ID de um principal. Os valores válidos dependem da configuração AllowExternalTargets para o compartilhamento de recursos:
Para obter mais informações, consulte Visão geral do Compartilhamento de Recursos, Visualizar o ID de um diretório de recursos, Visualizar o ID de uma pasta ou Visualizar o ID de um membro. Você pode especificar até cinco principais em uma única solicitação. |
172050525300**** |
|
| ResourceArns |
array |
Não |
Os ARNs dos recursos compartilhados. Você pode especificar até cinco recursos em uma única solicitação. |
|
|
string |
Não |
O ARN do recurso compartilhado. Nota
Para obter detalhes sobre o formato do ARN, consulte Serviços compatíveis com o Compartilhamento de Recursos. |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
|
| PermissionNames |
array |
Não |
Os nomes das permissões a serem aplicadas. Se este parâmetro for omitido, o sistema aplicará automaticamente a permissão padrão para o tipo de recurso. Para obter mais informações, consulte Biblioteca de permissões. |
|
|
string |
Não |
O nome de uma permissão. Para obter mais informações, consulte Biblioteca de permissões. |
AliyunRSDefaultPermissionVSwitch |
|
| TargetProperties |
array<object> |
Não |
As propriedades dos principais. Nota
Este parâmetro se aplica apenas quando um principal é um serviço Alibaba Cloud. |
|
|
object |
Não |
As propriedades de um principal. |
||
| TargetId |
string |
Não |
O ID do principal. Nota
TargetProperties.N.TargetId e TargetProperties.N.Property devem ser especificados juntos. |
172050525300**** |
| Property |
string |
Não |
A propriedade do principal. Por exemplo, você pode especificar o período de tempo para o compartilhamento de recursos. Os valores válidos para timeRangeType são:
Nota
TargetProperties.N.TargetId e TargetProperties.N.Property devem ser especificados juntos. |
{ "timeRange":{ "timeRangeType":"timeRange", "beginAtTime":"00:00", "timezone":"UTC+8", "endAtTime":"19:59" } } |
| ResourceProperties |
array<object> |
Não |
As propriedades dos recursos. |
|
|
object |
Não |
As propriedades de um recurso. |
||
| ResourceArn |
string |
Não |
O ARN do recurso. |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
| Property |
string |
Não |
A propriedade do recurso. |
{"sharePrincipals":true,"shareTagOptions":false} |
Elementos de resposta
|
Elemento |
Tipo |
Descrição |
Exemplo |
|
object |
O corpo da resposta. |
||
| RequestId |
string |
O ID da solicitação. |
111FB84A-60A9-403E-9067-E55D7EE95BD1 |
| ResourceShareAssociations |
array<object> |
As informações sobre os recursos ou principais que estão associados ao compartilhamento de recursos. |
|
|
object |
As informações sobre um recurso ou principal que está associado ao compartilhamento de recursos. |
||
| UpdateTime |
string |
A hora em que a associação foi atualizada. Este parâmetro pode ter um dos seguintes valores:
|
2020-12-04T09:40:41.246Z |
| ResourceArn |
string |
O Alibaba Cloud Resource Name (ARN) do recurso associado. Nota
Este parâmetro é retornado apenas quando AssociationType está definido como Resource. |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
| ResourceShareName |
string |
O nome do compartilhamento de recursos. |
test |
| CreateTime |
string |
A hora em que a associação foi criada. Este parâmetro pode ter um dos seguintes valores:
|
2020-12-04T09:40:41.246Z |
| EntityType |
string |
O tipo da entidade associada. Valores válidos:
|
VSwitch |
| ResourceShareId |
string |
O ID do compartilhamento de recursos. |
rs-6GRmdD3X**** |
| AssociationStatusMessage |
string |
O motivo pelo qual a associação falhou. |
The reason for the association failure. |
| AssociationType |
string |
Target. |
Resource |
| AssociationStatus |
string |
Disassociated. |
Associating |
| TargetProperty |
string |
As propriedades do principal. Por exemplo, o intervalo de tempo para o compartilhamento de recursos. Nota
Este parâmetro é retornado apenas se o principal for um serviço Alibaba Cloud. |
{ "plan":{ "timeRangeType":"timeRange", "beginAtTime":"00:00", "timezone":"UTC+8", "endAtTime":"19:59" } } |
| EntityId |
string |
O ID da entidade associada. Este parâmetro pode ter um dos seguintes valores:
|
vsw-bp183p93qs667muql**** |
| ResourceProperty |
string |
As propriedades do recurso. |
{"sharePrincipals":true,"shareTagOptions":false} |
Exemplos
Resposta de sucesso
JSON formato
{
"RequestId": "111FB84A-60A9-403E-9067-E55D7EE95BD1",
"ResourceShareAssociations": [
{
"UpdateTime": "2020-12-04T09:40:41.246Z",
"ResourceArn": "acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di****",
"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}",
"EntityId": "vsw-bp183p93qs667muql****",
"ResourceProperty": "{\"sharePrincipals\":true,\"shareTagOptions\":false}"
}
]
}
Códigos de erro
|
Código de status HTTP |
Código de erro |
Mensagem de erro |
Descrição |
|---|---|---|---|
| 400 | MissingParameter.ResourceShareId | You must specify ResourceShareId. | You must specify ResourceShareId. |
| 400 | InvalidParameter.ResourceShareId | The ResourceShareId is invalid. | The ResourceShareId parameter is invalid. |
| 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 | ResourceAndTargetBothEmpty | Either a resource or a shared target must be specified. | You must specify a resource or a resource account. |
| 400 | InvalidParameter | The specified parameter is invalid. | The specified parameter is invalid. |
| 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.ResourceShare | The resource share does not exist in the current account. | The resource share does not exist in the current account. |
| 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 | ResourceShareStatusMismatchAction | The status of the resource share does not allow the specified operation. | The status of the resource share does not allow the specified operation. |
| 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 | AssociateConflict | You cannot perform the operation while disassociation operation is being performed. | The association operation is not supported while an disassociation is being performed. |
| 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. | |
| 409 | NotSupport.ResourcePropertyConflict | The ResourceProperty can not be updated until the last operation is completed. | The ResourceProperty can not be updated until the last operation is completed. |
Consulte Códigos de Erro para uma lista completa.
Notas de versão
Consulte Notas de Versão para uma lista completa.