createCrossAccountAttachment method
Create a cross-account attachment in Global Accelerator. You create a cross-account attachment to specify the principals who have permission to work with resources in accelerators in their own account. You specify, in the same attachment, the resources that are shared.
A principal can be an Amazon Web Services account number or the Amazon Resource Name (ARN) for an accelerator. For account numbers that are listed as principals, to work with a resource listed in the attachment, you must sign in to an account specified as a principal. Then, you can work with resources that are listed, with any of your accelerators. If an accelerator ARN is listed in the cross-account attachment as a principal, anyone with permission to make updates to the accelerator can work with resources that are listed in the attachment.
Specify each principal and resource separately. To specify two CIDR
address pools, list them individually under Resources, and so
on. For a command line operation, for example, you might use a statement
like the following:
"Resources": [{"Cidr": "169.254.60.0/24"},{"Cidr":
"169.254.59.0/24"}]
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 InternalServiceErrorException.
May throw InvalidArgumentException.
May throw LimitExceededException.
May throw TransactionInProgressException.
Parameter name :
The name of the cross-account attachment.
Parameter idempotencyToken :
A unique, case-sensitive identifier that you provide to ensure the
idempotency—that is, the uniqueness—of the request.
Parameter principals :
The principals to include in the cross-account attachment. A principal can
be an Amazon Web Services account number or the Amazon Resource Name (ARN)
for an accelerator.
Parameter resources :
The Amazon Resource Names (ARNs) for the resources to include in the
cross-account attachment. A resource can be any supported Amazon Web
Services resource type for Global Accelerator or a CIDR range for a bring
your own IP address (BYOIP) address pool.
Parameter tags :
Add tags for a cross-account attachment.
For more information, see Tagging in Global Accelerator in the Global Accelerator Developer Guide.
Implementation
Future<CreateCrossAccountAttachmentResponse> createCrossAccountAttachment({
required String name,
String? idempotencyToken,
List<String>? principals,
List<Resource>? resources,
List<Tag>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'GlobalAccelerator_V20180706.CreateCrossAccountAttachment'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Name': name,
'IdempotencyToken': idempotencyToken ?? _s.generateIdempotencyToken(),
if (principals != null) 'Principals': principals,
if (resources != null) 'Resources': resources,
if (tags != null) 'Tags': tags,
},
);
return CreateCrossAccountAttachmentResponse.fromJson(jsonResponse.body);
}