Associe des ressources partagées ou des principaux à un partage de ressources.
Description de l'opération
Cet exemple montre comment ajouter le VSwitch vsw-bp183p93qs667muql**** au partage de ressources rs-6GRmdD3X**** dans la région cn-hangzhou et le partager avec le membre 172050525300**** au sein d'un répertoire de ressources.
Testez maintenant
Testez cette API dans OpenAPI Explorer, sans signature manuelle. Les appels réussis génèrent automatiquement du code SDK correspondant à vos paramètres. Téléchargez-le avec une sécurité intégrée des identifiants pour une utilisation locale. Testez cette API dans OpenAPI Explorer, sans signature manuelle. Les appels réussis génèrent automatiquement du code SDK correspondant à vos paramètres. Téléchargez-le avec une sécurité intégrée des identifiants pour une utilisation locale.
Test
Autorisation RAM
|
resourcesharing:AssociateResourceShare |
update |
*All Resource
|
|
Aucune |
Paramètres de requête
|
Paramètre |
Type |
Requis |
Description |
Exemple |
| ResourceShareId |
string |
Oui |
L'identifiant du partage de ressources. |
rs-6GRmdD3X**** |
| Resources |
array<object> |
Non |
Les ressources à associer au partage de ressources. |
|
|
object |
Non |
Une ressource à associer. |
||
| ResourceType |
string |
Non |
Le type de la ressource partagée. |
VSwitch |
| ResourceId |
string |
Non |
L'identifiant de la ressource partagée. |
vsw-bp183p93qs667muql**** |
| Targets |
array |
Non |
Les principaux à associer au partage de ressources. |
172050525300**** |
|
string |
Non |
L'identifiant d'un principal. Les valeurs valides dépendent du paramètre |
172050525300**** |
|
| ResourceArns |
array |
Non |
Les ARN des ressources partagées. |
|
|
string |
Non |
L'ARN de la ressource partagée. |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
|
| PermissionNames |
array |
Non |
Les noms des autorisations à appliquer. Si ce paramètre est omis, le système applique automatiquement l'autorisation par défaut pour le type de ressource. Pour plus d'informations, consultez Bibliothèque d'autorisations. |
|
|
string |
Non |
Le nom d'une autorisation. Pour plus d'informations, consultez Bibliothèque d'autorisations. |
AliyunRSDefaultPermissionVSwitch |
|
| TargetProperties |
array<object> |
Non |
Les propriétés des principaux. |
|
|
object |
Non |
Les propriétés d'un principal. |
||
| TargetId |
string |
Non |
L'identifiant du principal. |
172050525300**** |
| Property |
string |
Non |
La propriété du principal. Par exemple, vous pouvez spécifier la période de partage des ressources. Les valeurs valides pour |
{ |
| ResourceProperties |
array<object> |
Non |
Les propriétés des ressources. |
|
|
object |
Non |
Les propriétés d'une ressource. |
||
| ResourceArn |
string |
Non |
L'ARN de la ressource. |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
| Property |
string |
Non |
La propriété de la ressource. |
{"sharePrincipals":true,"shareTagOptions":false} |
Éléments de réponse
|
Élément |
Type |
Description |
Exemple |
|
object |
Le corps de la réponse. |
||
| RequestId |
string |
L'identifiant de la requête. |
111FB84A-60A9-403E-9067-E55D7EE95BD1 |
| ResourceShareAssociations |
array<object> |
Les informations sur les ressources ou les principaux associés au partage de ressources. |
|
|
object |
Les informations sur une ressource ou un principal associé au partage de ressources. |
||
| UpdateTime |
string |
L'heure de mise à jour de l'association. Ce paramètre peut prendre l'une des valeurs suivantes : |
2020-12-04T09:40:41.246Z |
| ResourceArn |
string |
L'Alibaba Cloud Resource Name (ARN) de la ressource associée. |
acs:vpc:cn-shanghai:103755469187****:vswitch/vsw-uf62b11ue4m8oz2di**** |
| ResourceShareName |
string |
Le nom du partage de ressources. |
test |
| CreateTime |
string |
L'heure de création de l'association. Ce paramètre peut prendre l'une des valeurs suivantes : |
2020-12-04T09:40:41.246Z |
| EntityType |
string |
Le type de l'entité associée. Valeurs valides : |
VSwitch |
| ResourceShareId |
string |
L'identifiant du partage de ressources. |
rs-6GRmdD3X**** |
| AssociationStatusMessage |
string |
La raison pour laquelle l'association a échoué. |
La raison de l'échec de l'association |
| AssociationType |
string |
Principal. |
Resource |
| AssociationStatus |
string |
Dissocié. |
Associating |
| TargetProperty |
string |
Les propriétés du principal. Par exemple, la plage horaire pour le partage des ressources. |
{ |
| EntityId |
string |
L'identifiant de l'entité associée. Ce paramètre peut prendre l'une des valeurs suivantes : |
vsw-bp183p93qs667muql**** |
| ResourceProperty |
string |
Les propriétés de la ressource. |
{"sharePrincipals":true,"shareTagOptions":false} |
Exemples
JSON format
{
"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}"
}
]
}
Codes d'erreur
|
Code de statut HTTP |
Code d'erreur |
Message d'erreur |
Description |
|---|---|---|---|
| 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. |
Consultez Codes d'erreur pour la liste complète.
Notes de version
Consultez Notes de version pour la liste complète.