Skip to content

list_automation_rules

list_automation_rules(
    *,
    config_overrides: Optional[SecurityHubClientConfig] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
) -> ListAutomationRulesResponse

A list of automation rules and their metadata for the calling account.

Parameters:

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

    A token to specify where to start paginating the response. This is the NextToken from a previously truncated response. On your first call to the ListAutomationRules API, set the value of this parameter to NULL.

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

    The maximum number of rules to return in the response. This currently ranges from 1 to 100.

Raises:

  • AccessDeniedException –

    You don't have permission to perform the action specified in the request.

  • InternalException –

    Internal server error.

  • InvalidAccessException –

    The account doesn't have permission to perform this action.

  • InvalidInputException –

    The request was rejected because you supplied an invalid or out-of-range value for an input parameter.

  • LimitExceededException –

    The request was rejected because it attempted to create resources beyond the current Amazon Web Services account or throttling limits. The error code describes the limit exceeded.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

To list automation rules The following example lists automation rules and rule metadata in the calling account.

>>> client.list_automation_rules(next_token='example-token', max_results=2)
Source code in docs_src/capo_securityhub/_services/security_hub.py
def list_automation_rules(
    self,
    *,
    config_overrides: Optional[SecurityHubClientConfig] = None,
    next_token: Optional["capo_securityhub.types.next_token.NextToken"] = None,
    max_results: Optional["capo_securityhub.types.max_results.MaxResults"] = None,
) -> "capo_securityhub.types.list_automation_rules_response.ListAutomationRulesResponse":
    """<p> A list of automation rules and their metadata for the calling account. </p>

    Args:
        next_token: <p> A token to specify where to start paginating the response. This is the <code>NextToken</code> from a previously truncated response. On your first call to the <code>ListAutomationRules</code> API, set the value of this parameter to <code>NULL</code>. </p>
        max_results: <p> The maximum number of rules to return in the response. This currently ranges from 1 to 100. </p>

    Raises:
        capo_securityhub.errors.access_denied_exception.AccessDeniedException: <p>You don't have permission to perform the action specified in the request.</p>
        capo_securityhub.errors.internal_exception.InternalException: <p>Internal server error.</p>
        capo_securityhub.errors.invalid_access_exception.InvalidAccessException: <p>The account doesn't have permission to perform this action.</p>
        capo_securityhub.errors.invalid_input_exception.InvalidInputException: <p>The request was rejected because you supplied an invalid or out-of-range value for an input parameter.</p>
        capo_securityhub.errors.limit_exceeded_exception.LimitExceededException: <p>The request was rejected because it attempted to create resources beyond the current Amazon Web Services account or throttling limits. The error code describes the limit exceeded.</p>
        capo_securityhub.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To list automation rules
        The following example lists automation rules and rule metadata in the calling account.

        >>> client.list_automation_rules(next_token='example-token', max_results=2)
    """

    def _handler(
        req: "OperationRequest[capo_securityhub.types.list_automation_rules_request.ListAutomationRulesRequest]",
    ) -> OperationResponse[
        "capo_securityhub.types.list_automation_rules_response.ListAutomationRulesResponse"
    ]:
        import capo_securityhub._operations.security_hub_api_service.list_automation_rules

        output, http_response = (
            capo_securityhub._operations.security_hub_api_service.list_automation_rules.list_automation_rules(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListAutomationRules")
    )
    input_: capo_securityhub.types.list_automation_rules_request.ListAutomationRulesRequest = {}
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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