Skip to content

update_enrollment_status async

update_enrollment_status(
    status: Status,
    *,
    config_overrides: Optional[AsyncComputeOptimizerClientConfig] = None,
    include_member_accounts: Optional[IncludeMemberAccounts] = None,
) -> UpdateEnrollmentStatusResponse

Updates the enrollment (opt in and opt out) status of an account to the Compute Optimizer 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 Compute Optimizer, to view its recommendations, and to opt out. For more information, see Controlling access with Amazon Web Services Identity and Access Management in the Compute Optimizer User Guide.

When you opt in, Compute Optimizer automatically creates a service-linked role in your account to access its data. For more information, see Using Service-Linked Roles for Compute Optimizer in the Compute Optimizer User Guide.

Parameters:

  • status (Status) –

    The new enrollment status of the account.

    The following status options are available:

    • Active - Opts in your account to the Compute Optimizer service. Compute Optimizer begins analyzing the configuration and utilization metrics of your Amazon Web Services resources after you opt in. For more information, see Metrics analyzed by Compute Optimizer in the Compute Optimizer User Guide.

    • Inactive - Opts out your account from the Compute Optimizer service. Your account's recommendations and related metrics data will be deleted from Compute Optimizer after you opt out.

    The Pending and Failed options cannot be used to update the enrollment status of an account. They are returned in the response of a request to update the enrollment status of an account.

  • include_member_accounts (Optional[IncludeMemberAccounts], default: None ) –

    Indicates whether to enroll member accounts of the organization if the account is the management account of an organization.

Raises:

Source code in docs_src/capo_compute_optimizer/_services/async_compute_optimizer.py
async def update_enrollment_status(
    self,
    status: "capo_compute_optimizer.types.status.Status",
    *,
    config_overrides: Optional[AsyncComputeOptimizerClientConfig] = None,
    include_member_accounts: Optional[
        "capo_compute_optimizer.types.include_member_accounts.IncludeMemberAccounts"
    ] = None,
) -> "capo_compute_optimizer.types.update_enrollment_status_response.UpdateEnrollmentStatusResponse":
    """<p>Updates the enrollment (opt in and opt out) status of an account to the Compute Optimizer 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 Compute Optimizer, to view its recommendations, and to opt out. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/security-iam.html">Controlling access with Amazon Web Services Identity and Access Management</a> in the <i>Compute Optimizer User Guide</i>.</p> <p>When you opt in, Compute Optimizer automatically creates a service-linked role in your account to access its data. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/using-service-linked-roles.html">Using Service-Linked Roles for Compute Optimizer</a> in the <i>Compute Optimizer User Guide</i>.</p>

    Args:
        status: <p>The new enrollment status of the account.</p> <p>The following status options are available:</p> <ul> <li> <p> <code>Active</code> - Opts in your account to the Compute Optimizer service. Compute Optimizer begins analyzing the configuration and utilization metrics of your Amazon Web Services resources after you opt in. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/metrics.html">Metrics analyzed by Compute Optimizer</a> in the <i>Compute Optimizer User Guide</i>.</p> </li> <li> <p> <code>Inactive</code> - Opts out your account from the Compute Optimizer service. Your account's recommendations and related metrics data will be deleted from Compute Optimizer after you opt out.</p> </li> </ul> <note> <p>The <code>Pending</code> and <code>Failed</code> options cannot be used to update the enrollment status of an account. They are returned in the response of a request to update the enrollment status of an account.</p> </note>
        include_member_accounts: <p>Indicates whether to enroll member accounts of the organization if the account is the management account of an organization.</p>

    Raises:
        capo_compute_optimizer.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_compute_optimizer.errors.internal_server_exception.InternalServerException: <p>An internal error has occurred. Try your call again.</p>
        capo_compute_optimizer.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value supplied for the input parameter is out of range or not valid.</p>
        capo_compute_optimizer.errors.missing_authentication_token.MissingAuthenticationToken: <p>The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 certificate.</p>
        capo_compute_optimizer.errors.service_unavailable_exception.ServiceUnavailableException: <p>The request has failed due to a temporary failure of the server.</p>
        capo_compute_optimizer.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_compute_optimizer.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_compute_optimizer.types.update_enrollment_status_request.UpdateEnrollmentStatusRequest]",
    ) -> AsyncOperationResponse[
        "capo_compute_optimizer.types.update_enrollment_status_response.UpdateEnrollmentStatusResponse"
    ]:
        import capo_compute_optimizer._operations.compute_optimizer_service.update_enrollment_status

        (
            output,
            http_response,
        ) = await capo_compute_optimizer._operations.compute_optimizer_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_compute_optimizer.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