Skip to content

start_automation_event async

start_automation_event(
    recommended_action_id: RecommendedActionId,
    *,
    config_overrides: Optional[AsyncComputeOptimizerAutomationClientConfig] = None,
    client_token: Optional[ClientToken] = None,
) -> StartAutomationEventResponse

Initiates a one-time, on-demand automation for the specified recommended action.

Management accounts and delegated administrators can initiate recommended actions for member accounts that are associated using AssociateAccounts or have an applicable organization enrollment configuration with organizationRuleMode set to AnyAllowed.

Parameters:

  • recommended_action_id (RecommendedActionId) –

    The ID of the recommended action to automate.

  • client_token (Optional[ClientToken], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Must be 1-64 characters long and contain only alphanumeric characters, underscores, and hyphens.

Raises:

Source code in docs_src/capo_compute_optimizer_automation/_services/async_compute_optimizer_automation.py
async def start_automation_event(
    self,
    recommended_action_id: "capo_compute_optimizer_automation.types.recommended_action_id.RecommendedActionId",
    *,
    config_overrides: Optional[AsyncComputeOptimizerAutomationClientConfig] = None,
    client_token: Optional[
        "capo_compute_optimizer_automation.types.client_token.ClientToken"
    ] = None,
) -> "capo_compute_optimizer_automation.types.start_automation_event_response.StartAutomationEventResponse":
    """<p> Initiates a one-time, on-demand automation for the specified recommended action. </p> <note> <p>Management accounts and delegated administrators can initiate recommended actions for member accounts that are associated using <code>AssociateAccounts</code> or have an applicable organization enrollment configuration with <code>organizationRuleMode</code> set to <code>AnyAllowed</code>.</p> </note>

    Args:
        recommended_action_id: <p> The ID of the recommended action to automate. </p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Must be 1-64 characters long and contain only alphanumeric characters, underscores, and hyphens.</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.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.resource_not_found_exception.ResourceNotFoundException: <p> The specified resource was not found. </p>
        capo_compute_optimizer_automation.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p> The request would exceed service quotas. </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.start_automation_event_request.StartAutomationEventRequest]",
    ) -> AsyncOperationResponse[
        "capo_compute_optimizer_automation.types.start_automation_event_response.StartAutomationEventResponse"
    ]:
        if req.options.protocol == "awsJson1_0":
            import capo_compute_optimizer_automation._operations.compute_optimizer_automation_service.aws_json1_0.start_automation_event

            (
                output,
                http_response,
            ) = await capo_compute_optimizer_automation._operations.compute_optimizer_automation_service.aws_json1_0.start_automation_event.async_start_automation_event(
                req.options, req.input
            )
        elif req.options.protocol == "rpcv2Cbor":
            import capo_compute_optimizer_automation._operations.compute_optimizer_automation_service.rpcv2_cbor.start_automation_event

            (
                output,
                http_response,
            ) = await capo_compute_optimizer_automation._operations.compute_optimizer_automation_service.rpcv2_cbor.start_automation_event.async_start_automation_event(
                req.options, req.input
            )
        else:
            raise ValueError(f"unknown protocol {req.options.protocol!r}")
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartAutomationEvent")
    )
    input_: capo_compute_optimizer_automation.types.start_automation_event_request.StartAutomationEventRequest = {
        "recommended_action_id": recommended_action_id
    }
    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