Skip to content

get_rules async

get_rules(
    detector_id: identifier,
    *,
    config_overrides: Optional[AsyncFraudDetectorClientConfig] = None,
    rule_id: Optional[identifier] = None,
    rule_version: Optional[wholeNumberVersionString] = None,
    next_token: Optional[string] = None,
    max_results: Optional[RulesMaxResults] = None,
) -> GetRulesResult

Get all rules for a detector (paginated) if ruleId and ruleVersion are not specified. Gets all rules for the detector and the ruleId if present (paginated). Gets a specific rule if both the ruleId and the ruleVersion are specified.

This is a paginated API. Providing null maxResults results in retrieving maximum of 100 records per page. If you provide maxResults the value must be between 50 and 100. To get the next page result, a provide a pagination token from GetRulesResult as part of your request. Null pagination token fetches the records from the beginning.

Parameters:

Raises:

  • AccessDeniedException –

    An exception indicating Amazon Fraud Detector does not have the needed permissions. This can occur if you submit a request, such as PutExternalModel, that specifies a role that is not in your account.

  • InternalServerException –

    An exception indicating an internal server error.

  • ResourceNotFoundException –

    An exception indicating the specified resource was not found.

  • ThrottlingException –

    An exception indicating a throttling error.

  • ValidationException –

    An exception indicating a specified value is not allowed.

  • UnknownServiceError –

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

Source code in docs_src/capo_frauddetector/_services/async_fraud_detector.py
async def get_rules(
    self,
    detector_id: "capo_frauddetector.types.identifier.identifier",
    *,
    config_overrides: Optional[AsyncFraudDetectorClientConfig] = None,
    rule_id: Optional["capo_frauddetector.types.identifier.identifier"] = None,
    rule_version: Optional[
        "capo_frauddetector.types.whole_number_version_string.wholeNumberVersionString"
    ] = None,
    next_token: Optional["capo_frauddetector.types.string.string"] = None,
    max_results: Optional[
        "capo_frauddetector.types.rules_max_results.RulesMaxResults"
    ] = None,
) -> "capo_frauddetector.types.get_rules_result.GetRulesResult":
    """<p>Get all rules for a detector (paginated) if <code>ruleId</code> and <code>ruleVersion</code> are not specified. Gets all rules for the detector and the <code>ruleId</code> if present (paginated). Gets a specific rule if both the <code>ruleId</code> and the <code>ruleVersion</code> are specified.</p> <p>This is a paginated API. Providing null maxResults results in retrieving maximum of 100 records per page. If you provide maxResults the value must be between 50 and 100. To get the next page result, a provide a pagination token from GetRulesResult as part of your request. Null pagination token fetches the records from the beginning.</p>

    Args:
        rule_id: <p>The rule ID.</p>
        detector_id: <p>The detector ID.</p>
        rule_version: <p>The rule version.</p>
        next_token: <p>The next page token.</p>
        max_results: <p>The maximum number of rules to return for the request.</p>

    Raises:
        capo_frauddetector.errors.access_denied_exception.AccessDeniedException: <p>An exception indicating Amazon Fraud Detector does not have the needed permissions. This can occur if you submit a request, such as <code>PutExternalModel</code>, that specifies a role that is not in your account.</p>
        capo_frauddetector.errors.internal_server_exception.InternalServerException: <p>An exception indicating an internal server error.</p>
        capo_frauddetector.errors.resource_not_found_exception.ResourceNotFoundException: <p>An exception indicating the specified resource was not found.</p>
        capo_frauddetector.errors.throttling_exception.ThrottlingException: <p>An exception indicating a throttling error.</p>
        capo_frauddetector.errors.validation_exception.ValidationException: <p>An exception indicating a specified value is not allowed.</p>
        capo_frauddetector.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_frauddetector.types.get_rules_request.GetRulesRequest]",
    ) -> AsyncOperationResponse[
        "capo_frauddetector.types.get_rules_result.GetRulesResult"
    ]:
        import capo_frauddetector._operations.aws_hawks_nest_service_facade.get_rules

        (
            output,
            http_response,
        ) = await capo_frauddetector._operations.aws_hawks_nest_service_facade.get_rules.async_get_rules(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_frauddetector.types.get_rules_result.GetRulesResult",
    ) -> dict[str, Any]:
        import capo_frauddetector.types.get_rules_result

        return capo_frauddetector.types.get_rules_result.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetRules", redact_output=_redact_output)
    )
    input_: capo_frauddetector.types.get_rules_request.GetRulesRequest = {
        "detector_id": detector_id
    }
    if rule_id is not None:
        input_["rule_id"] = rule_id
    if rule_version is not None:
        input_["rule_version"] = rule_version
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output