Updates the enrollment (opt in and opt out) status of an account to the Cost Optimization Hub service.
If the account is a management account of an organization, this action can also be used to enroll member accounts of the organization.
You must have the appropriate permissions to opt in to Cost Optimization Hub and to view its recommendations. When you opt in, Cost Optimization Hub automatically creates a service-linked role in your account to access its data.
Parameters:
-
status
(EnrollmentStatus)
–
-
include_member_accounts
(Optional[bool], default:
None
)
–
Indicates whether to enroll member accounts of the organization if the account is the management account or delegated administrator.
Raises:
Source code in docs_src/capo_cost_optimization_hub/_services/async_cost_optimization_hub.py
| async def update_enrollment_status(
self,
status: "capo_cost_optimization_hub.types.enrollment_status.EnrollmentStatus",
*,
config_overrides: Optional[AsyncCostOptimizationHubClientConfig] = None,
include_member_accounts: Optional[bool] = None,
) -> "capo_cost_optimization_hub.types.update_enrollment_status_response.UpdateEnrollmentStatusResponse":
"""<p>Updates the enrollment (opt in and opt out) status of an account to the Cost Optimization Hub service.</p> <p>If the account is a management account of an organization, this action can also be used to enroll member accounts of the organization.</p> <p>You must have the appropriate permissions to opt in to Cost Optimization Hub and to view its recommendations. When you opt in, Cost Optimization Hub automatically creates a service-linked role in your account to access its data.</p>
Args:
status: <p>Sets the account status.</p>
include_member_accounts: <p>Indicates whether to enroll member accounts of the organization if the account is the management account or delegated administrator.</p>
Raises:
capo_cost_optimization_hub.errors.access_denied_exception.AccessDeniedException: <p>You are not authorized to use this operation with the given parameters.</p>
capo_cost_optimization_hub.errors.internal_server_exception.InternalServerException: <p>An error on the server occurred during the processing of your request. Try again later.</p>
capo_cost_optimization_hub.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
capo_cost_optimization_hub.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
capo_cost_optimization_hub.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_cost_optimization_hub.types.update_enrollment_status_request.UpdateEnrollmentStatusRequest]",
) -> AsyncOperationResponse[
"capo_cost_optimization_hub.types.update_enrollment_status_response.UpdateEnrollmentStatusResponse"
]:
import capo_cost_optimization_hub._operations.cost_optimization_hub_service.update_enrollment_status
(
output,
http_response,
) = await capo_cost_optimization_hub._operations.cost_optimization_hub_service.update_enrollment_status.async_update_enrollment_status(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("UpdateEnrollmentStatus")
)
input_: capo_cost_optimization_hub.types.update_enrollment_status_request.UpdateEnrollmentStatusRequest = {
"status": status
}
if include_member_accounts is not None:
input_["include_member_accounts"] = include_member_accounts
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|