associateAccounts method
Associates one or more member accounts with your organization's management account, enabling centralized implementation of optimization actions across those accounts. Once associated, the management account (or a delegated administrator) can apply recommended actions to the member account. When you associate a member account, its organization rule mode is automatically set to "Any allowed," which permits the management account to create Automation rules that automatically apply actions to that account. If the member account has not previously enabled the Automation feature, the association process automatically enables it.
May throw AccessDeniedException.
May throw ForbiddenException.
May throw IdempotencyTokenInUseException.
May throw IdempotentParameterMismatchException.
May throw InternalServerException.
May throw InvalidParameterValueException.
May throw NotManagementAccountException.
May throw OptInRequiredException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
Parameter accountIds :
The IDs of the member accounts to associate. You can specify up to 50
account IDs.
Parameter clientToken :
A unique identifier to ensure idempotency of the request. Valid for 24
hours after creation.
Implementation
Future<AssociateAccountsResponse> associateAccounts({
required List<String> accountIds,
String? clientToken,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'ComputeOptimizerAutomationService.AssociateAccounts'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'accountIds': accountIds,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
},
);
return AssociateAccountsResponse.fromJson(jsonResponse.body);
}