Skip to content

create_model async

create_model(
    model_id: modelIdentifier,
    model_type: ModelTypeEnum,
    event_type_name: string,
    *,
    config_overrides: Optional[AsyncFraudDetectorClientConfig] = None,
    description: Optional[description] = None,
    tags: Optional[tagList] = None,
) -> CreateModelResult

Creates a model using the specified model type.

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.

  • 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_model(
    self,
    model_id: "capo_frauddetector.types.model_identifier.modelIdentifier",
    model_type: "capo_frauddetector.types.model_type_enum.ModelTypeEnum",
    event_type_name: "capo_frauddetector.types.string.string",
    *,
    config_overrides: Optional[AsyncFraudDetectorClientConfig] = None,
    description: Optional[
        "capo_frauddetector.types.description.description"
    ] = None,
    tags: Optional["capo_frauddetector.types.tag_list.tagList"] = None,
) -> "capo_frauddetector.types.create_model_result.CreateModelResult":
    """<p>Creates a model using the specified model type.</p>

    Args:
        model_id: <p>The model ID.</p>
        model_type: <p>The model type. </p>
        description: <p>The model description. </p>
        event_type_name: <p>The name of the event type.</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.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_model_request.CreateModelRequest]",
    ) -> AsyncOperationResponse[
        "capo_frauddetector.types.create_model_result.CreateModelResult"
    ]:
        import capo_frauddetector._operations.aws_hawks_nest_service_facade.create_model

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateModel")
    )
    input_: capo_frauddetector.types.create_model_request.CreateModelRequest = {
        "model_id": model_id,
        "model_type": model_type,
        "event_type_name": event_type_name,
    }
    if description is not None:
        input_["description"] = description
    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