Skip to content

create_detector_version async

create_detector_version(
    detector_id: identifier,
    rules: RuleList,
    *,
    config_overrides: Optional[AsyncFraudDetectorClientConfig] = None,
    description: Optional[description] = None,
    external_model_endpoints: Optional[ListOfStrings] = None,
    model_versions: Optional[ListOfModelVersions] = None,
    rule_execution_mode: Optional[RuleExecutionMode] = None,
    tags: Optional[tagList] = None,
) -> CreateDetectorVersionResult

Creates a detector version. The detector version starts in a DRAFT status.

Parameters:

  • detector_id (identifier) –

    The ID of the detector under which you want to create a new version.

  • description (Optional[description], default: None ) –

    The description of the detector version.

  • external_model_endpoints (Optional[ListOfStrings], default: None ) –

    The Amazon Sagemaker model endpoints to include in the detector version.

  • rules (RuleList) –

    The rules to include in the detector version.

  • model_versions (Optional[ListOfModelVersions], default: None ) –

    The model versions to include in the detector version.

  • rule_execution_mode (Optional[RuleExecutionMode], default: None ) –

    The rule execution mode for the rules included in the detector version.

    You can define and edit the rule mode at the detector version level, when it is in draft status.

    If you specify FIRST_MATCHED, Amazon Fraud Detector evaluates rules sequentially, first to last, stopping at the first matched rule. Amazon Fraud dectector then provides the outcomes for that single rule.

    If you specifiy ALL_MATCHED, Amazon Fraud Detector evaluates all rules and returns the outcomes for all matched rules.

    The default behavior is FIRST_MATCHED.

  • tags (Optional[tagList], default: None ) –

    A collection of key and value pairs.

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 create_detector_version(
    self,
    detector_id: "capo_frauddetector.types.identifier.identifier",
    rules: "capo_frauddetector.types.rule_list.RuleList",
    *,
    config_overrides: Optional[AsyncFraudDetectorClientConfig] = None,
    description: Optional[
        "capo_frauddetector.types.description.description"
    ] = None,
    external_model_endpoints: Optional[
        "capo_frauddetector.types.list_of_strings.ListOfStrings"
    ] = None,
    model_versions: Optional[
        "capo_frauddetector.types.list_of_model_versions.ListOfModelVersions"
    ] = None,
    rule_execution_mode: Optional[
        "capo_frauddetector.types.rule_execution_mode.RuleExecutionMode"
    ] = None,
    tags: Optional["capo_frauddetector.types.tag_list.tagList"] = None,
) -> "capo_frauddetector.types.create_detector_version_result.CreateDetectorVersionResult":
    """<p>Creates a detector version. The detector version starts in a <code>DRAFT</code> status.</p>

    Args:
        detector_id: <p>The ID of the detector under which you want to create a new version.</p>
        description: <p>The description of the detector version.</p>
        external_model_endpoints: <p>The Amazon Sagemaker model endpoints to include in the detector version.</p>
        rules: <p>The rules to include in the detector version.</p>
        model_versions: <p>The model versions to include in the detector version.</p>
        rule_execution_mode: <p>The rule execution mode for the rules included in the detector version.</p> <p>You can define and edit the rule mode at the detector version level, when it is in draft status.</p> <p>If you specify <code>FIRST_MATCHED</code>, Amazon Fraud Detector evaluates rules sequentially, first to last, stopping at the first matched rule. Amazon Fraud dectector then provides the outcomes for that single rule.</p> <p>If you specifiy <code>ALL_MATCHED</code>, Amazon Fraud Detector evaluates all rules and returns the outcomes for all matched rules. </p> <p>The default behavior is <code>FIRST_MATCHED</code>.</p>
        tags: <p>A collection of key and value pairs.</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.create_detector_version_request.CreateDetectorVersionRequest]",
    ) -> AsyncOperationResponse[
        "capo_frauddetector.types.create_detector_version_result.CreateDetectorVersionResult"
    ]:
        import capo_frauddetector._operations.aws_hawks_nest_service_facade.create_detector_version

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateDetectorVersion")
    )
    input_: capo_frauddetector.types.create_detector_version_request.CreateDetectorVersionRequest = {
        "detector_id": detector_id,
        "rules": rules,
    }
    if description is not None:
        input_["description"] = description
    if external_model_endpoints is not None:
        input_["external_model_endpoints"] = external_model_endpoints
    if model_versions is not None:
        input_["model_versions"] = model_versions
    if rule_execution_mode is not None:
        input_["rule_execution_mode"] = rule_execution_mode
    if tags is not None:
        input_["tags"] = tags

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