Skip to content

list_automation_rule_preview

list_automation_rule_preview(
    rule_type: RuleType,
    recommended_action_types: RecommendedActionTypeList,
    *,
    config_overrides: Optional[ComputeOptimizerAutomationClientConfig] = None,
    organization_scope: Optional[OrganizationScope] = None,
    criteria: Optional[Criteria] = None,
    max_results: Optional[int] = None,
    next_token: Optional[NextToken] = None,
) -> ListAutomationRulePreviewResponse

Returns a preview of the recommended actions that match your Automation rule's configuration and criteria.

Parameters:

  • rule_type (RuleType) –

    The type of rule.

    Only the management account or a delegated administrator can set the ruleType to be OrganizationRule.

  • organization_scope (Optional[OrganizationScope], default: None ) –

    The organizational scope for the rule preview.

  • recommended_action_types (RecommendedActionTypeList) –

    The types of recommended actions to include in the preview.

  • criteria (Optional[Criteria], default: None ) –

    A set of conditions that specify which recommended action qualify for implementation. When a rule is active and a recommended action matches these criteria, Compute Optimizer implements the action at the scheduled run time.

  • max_results (Optional[int], default: None ) –

    The maximum number of automation rule preview results to return in a single response. Valid range is 1-1000.

  • next_token (Optional[NextToken], default: None ) –

    A token used for pagination to retrieve the next set of results when the response is truncated.

Raises:

Source code in docs_src/capo_compute_optimizer_automation/_services/compute_optimizer_automation.py
def list_automation_rule_preview(
    self,
    rule_type: "capo_compute_optimizer_automation.types.rule_type.RuleType",
    recommended_action_types: "capo_compute_optimizer_automation.types.recommended_action_type_list.RecommendedActionTypeList",
    *,
    config_overrides: Optional[ComputeOptimizerAutomationClientConfig] = None,
    organization_scope: Optional[
        "capo_compute_optimizer_automation.types.organization_scope.OrganizationScope"
    ] = None,
    criteria: Optional[
        "capo_compute_optimizer_automation.types.criteria.Criteria"
    ] = None,
    max_results: Optional[int] = None,
    next_token: Optional[
        "capo_compute_optimizer_automation.types.next_token.NextToken"
    ] = None,
) -> "capo_compute_optimizer_automation.types.list_automation_rule_preview_response.ListAutomationRulePreviewResponse":
    """<p>Returns a preview of the recommended actions that match your Automation rule's configuration and criteria. </p>

    Args:
        rule_type: <p> The type of rule. </p> <note> <p>Only the management account or a delegated administrator can set the ruleType to be OrganizationRule.</p> </note>
        organization_scope: <p> The organizational scope for the rule preview. </p>
        recommended_action_types: <p> The types of recommended actions to include in the preview. </p>
        criteria: <p>A set of conditions that specify which recommended action qualify for implementation. When a rule is active and a recommended action matches these criteria, Compute Optimizer implements the action at the scheduled run time. </p>
        max_results: <p>The maximum number of automation rule preview results to return in a single response. Valid range is 1-1000.</p>
        next_token: <p>A token used for pagination to retrieve the next set of results when the response is truncated.</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.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.
    """

    def _handler(
        req: "OperationRequest[capo_compute_optimizer_automation.types.list_automation_rule_preview_request.ListAutomationRulePreviewRequest]",
    ) -> OperationResponse[
        "capo_compute_optimizer_automation.types.list_automation_rule_preview_response.ListAutomationRulePreviewResponse"
    ]:
        import capo_compute_optimizer_automation._operations.compute_optimizer_automation_service.list_automation_rule_preview

        output, http_response = (
            capo_compute_optimizer_automation._operations.compute_optimizer_automation_service.list_automation_rule_preview.list_automation_rule_preview(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListAutomationRulePreview")
    )
    input_: capo_compute_optimizer_automation.types.list_automation_rule_preview_request.ListAutomationRulePreviewRequest = {
        "rule_type": rule_type,
        "recommended_action_types": recommended_action_types,
    }
    if organization_scope is not None:
        input_["organization_scope"] = organization_scope
    if criteria is not None:
        input_["criteria"] = criteria
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output