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.
Only the management account or a delegated administrator can perform this action.
Parameters:
-
account_ids
(AccountIdList)
–
The IDs of the member accounts to associate. You can specify up to 50 account IDs.
-
client_token
(Optional[ClientToken], default:
None
)
–
A unique identifier to ensure idempotency of the request. Valid for 24 hours after creation.
Raises:
Source code in docs_src/capo_compute_optimizer_automation/_services/async_compute_optimizer_automation.py
| async def associate_accounts(
self,
account_ids: "capo_compute_optimizer_automation.types.account_id_list.AccountIdList",
*,
config_overrides: Optional[AsyncComputeOptimizerAutomationClientConfig] = None,
client_token: Optional[
"capo_compute_optimizer_automation.types.client_token.ClientToken"
] = None,
) -> "capo_compute_optimizer_automation.types.associate_accounts_response.AssociateAccountsResponse":
"""<p>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.</p> <note> <p>Only the management account or a delegated administrator can perform this action.</p> </note>
Args:
account_ids: <p> The IDs of the member accounts to associate. You can specify up to 50 account IDs. </p>
client_token: <p> A unique identifier to ensure idempotency of the request. Valid for 24 hours after creation. </p>
Raises:
capo_compute_optimizer_automation.errors.access_denied_exception.AccessDeniedException: <p> You do not have sufficient permissions to perform this action. </p>
capo_compute_optimizer_automation.errors.forbidden_exception.ForbiddenException: <p> You are not authorized to perform this action. </p>
capo_compute_optimizer_automation.errors.idempotency_token_in_use_exception.IdempotencyTokenInUseException: <p> The specified client token is already in use. </p>
capo_compute_optimizer_automation.errors.idempotent_parameter_mismatch_exception.IdempotentParameterMismatchException: <p>Exception thrown when the same client token is used with different parameters, indicating a mismatch in idempotent request parameters.</p>
capo_compute_optimizer_automation.errors.internal_server_exception.InternalServerException: <p> An internal error occurred while processing the request. </p>
capo_compute_optimizer_automation.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p> One or more parameter values are not valid. </p>
capo_compute_optimizer_automation.errors.not_management_account_exception.NotManagementAccountException: <p> The operation can only be performed by a management account. </p>
capo_compute_optimizer_automation.errors.opt_in_required_exception.OptInRequiredException: <p> The account must be opted in to Compute Optimizer Automation before performing this action. </p>
capo_compute_optimizer_automation.errors.service_unavailable_exception.ServiceUnavailableException: <p> The service is temporarily unavailable. </p>
capo_compute_optimizer_automation.errors.throttling_exception.ThrottlingException: <p> The request was denied due to request throttling. </p>
capo_compute_optimizer_automation.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_compute_optimizer_automation.types.associate_accounts_request.AssociateAccountsRequest]",
) -> AsyncOperationResponse[
"capo_compute_optimizer_automation.types.associate_accounts_response.AssociateAccountsResponse"
]:
import capo_compute_optimizer_automation._operations.compute_optimizer_automation_service.associate_accounts
(
output,
http_response,
) = await capo_compute_optimizer_automation._operations.compute_optimizer_automation_service.associate_accounts.async_associate_accounts(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("AssociateAccounts")
)
input_: capo_compute_optimizer_automation.types.associate_accounts_request.AssociateAccountsRequest = {
"account_ids": account_ids
}
if client_token is None:
client_token = str(uuid.uuid4())
input_["client_token"] = client_token
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|