updateCrossAccountAttachment method
Update a cross-account attachment to add or remove principals or resources. When you update an attachment to remove a principal (account ID or accelerator) or a resource, Global Accelerator revokes the permission for specific resources.
For more information, see Working with cross-account attachments and resources in Global Accelerator in the Global Accelerator Developer Guide.
May throw AccessDeniedException.
May throw AttachmentNotFoundException.
May throw InternalServiceErrorException.
May throw InvalidArgumentException.
May throw LimitExceededException.
May throw TransactionInProgressException.
Parameter attachmentArn :
The Amazon Resource Name (ARN) of the cross-account attachment to update.
Parameter addPrincipals :
The principals to add to the cross-account attachment. A principal is an
account or the Amazon Resource Name (ARN) of an accelerator that the
attachment gives permission to work with resources from another account.
The resources are also listed in the attachment.
To add more than one principal, separate the account numbers or accelerator ARNs, or both, with commas.
Parameter addResources :
The resources to add to the cross-account attachment. A resource listed in
a cross-account attachment can be used with an accelerator by the
principals that are listed in the attachment.
To add more than one resource, separate the resource ARNs with commas.
Parameter name :
The name of the cross-account attachment.
Parameter removePrincipals :
The principals to remove from the cross-account attachment. A principal is
an account or the Amazon Resource Name (ARN) of an accelerator that the
attachment gives permission to work with resources from another account.
The resources are also listed in the attachment.
To remove more than one principal, separate the account numbers or accelerator ARNs, or both, with commas.
Parameter removeResources :
The resources to remove from the cross-account attachment. A resource
listed in a cross-account attachment can be used with an accelerator by
the principals that are listed in the attachment.
To remove more than one resource, separate the resource ARNs with commas.
Implementation
Future<UpdateCrossAccountAttachmentResponse> updateCrossAccountAttachment({
required String attachmentArn,
List<String>? addPrincipals,
List<Resource>? addResources,
String? name,
List<String>? removePrincipals,
List<Resource>? removeResources,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'GlobalAccelerator_V20180706.UpdateCrossAccountAttachment'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'AttachmentArn': attachmentArn,
if (addPrincipals != null) 'AddPrincipals': addPrincipals,
if (addResources != null) 'AddResources': addResources,
if (name != null) 'Name': name,
if (removePrincipals != null) 'RemovePrincipals': removePrincipals,
if (removeResources != null) 'RemoveResources': removeResources,
},
);
return UpdateCrossAccountAttachmentResponse.fromJson(jsonResponse.body);
}