Lists the accounts in your organization that are enrolled in Compute Optimizer and whether they have enabled Automation.
Only the management account or a delegated administrator can perform this action.
Parameters:
-
max_results
(Optional[int], default:
None
)
–
The maximum number of results to return in a single call.
-
next_token
(Optional[NextToken], default:
None
)
–
The token for the next page of results.
Raises:
Source code in docs_src/capo_compute_optimizer_automation/_services/async_compute_optimizer_automation.py
| async def list_accounts(
self,
*,
config_overrides: Optional[AsyncComputeOptimizerAutomationClientConfig] = None,
max_results: Optional[int] = None,
next_token: Optional[
"capo_compute_optimizer_automation.types.next_token.NextToken"
] = None,
) -> "capo_compute_optimizer_automation.types.list_accounts_response.ListAccountsResponse":
"""<p> Lists the accounts in your organization that are enrolled in Compute Optimizer and whether they have enabled Automation. </p> <note> <p>Only the management account or a delegated administrator can perform this action.</p> </note>
Args:
max_results: <p> The maximum number of results to return in a single call. </p>
next_token: <p> The token for the next page of results. </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.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.list_accounts_request.ListAccountsRequest]",
) -> AsyncOperationResponse[
"capo_compute_optimizer_automation.types.list_accounts_response.ListAccountsResponse"
]:
import capo_compute_optimizer_automation._operations.compute_optimizer_automation_service.list_accounts
(
output,
http_response,
) = await capo_compute_optimizer_automation._operations.compute_optimizer_automation_service.list_accounts.async_list_accounts(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("ListAccounts")
)
input_: capo_compute_optimizer_automation.types.list_accounts_request.ListAccountsRequest = {}
if max_results is not None:
input_["max_results"] = max_results
if next_token is not None:
input_["next_token"] = next_token
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|