Skip to content

create_detector_model async

create_detector_model(
    detector_model_name: DetectorModelName,
    detector_model_definition: DetectorModelDefinition,
    role_arn: AmazonResourceName,
    *,
    config_overrides: Optional[AsyncIoTEventsClientConfig] = None,
    detector_model_description: Optional[DetectorModelDescription] = None,
    key: Optional[AttributeJsonPath] = None,
    tags: Optional[Tags] = None,
    evaluation_method: Optional[EvaluationMethod] = None,
) -> CreateDetectorModelResponse

Creates a detector model.

Parameters:

  • detector_model_name (DetectorModelName) –

    The name of the detector model.

  • detector_model_definition (DetectorModelDefinition) –

    Information that defines how the detectors operate.

  • detector_model_description (Optional[DetectorModelDescription], default: None ) –

    A brief description of the detector model.

  • key (Optional[AttributeJsonPath], default: None ) –

    The input attribute key used to identify a device or system to create a detector (an instance of the detector model) and then to route each input received to the appropriate detector (instance). This parameter uses a JSON-path expression in the message payload of each input to specify the attribute-value pair that is used to identify the device associated with the input.

  • role_arn (AmazonResourceName) –

    The ARN of the role that grants permission to AWS IoT Events to perform its operations.

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

    Metadata that can be used to manage the detector model.

  • evaluation_method (Optional[EvaluationMethod], default: None ) –

    Information about the order in which events are evaluated and how actions are executed.

Raises:

Source code in docs_src/capo_iot_events/_services/async_io_t_events.py
async def create_detector_model(
    self,
    detector_model_name: "capo_iot_events.types.detector_model_name.DetectorModelName",
    detector_model_definition: "capo_iot_events.types.detector_model_definition.DetectorModelDefinition",
    role_arn: "capo_iot_events.types.amazon_resource_name.AmazonResourceName",
    *,
    config_overrides: Optional[AsyncIoTEventsClientConfig] = None,
    detector_model_description: Optional[
        "capo_iot_events.types.detector_model_description.DetectorModelDescription"
    ] = None,
    key: Optional[
        "capo_iot_events.types.attribute_json_path.AttributeJsonPath"
    ] = None,
    tags: Optional["capo_iot_events.types.tags.Tags"] = None,
    evaluation_method: Optional[
        "capo_iot_events.types.evaluation_method.EvaluationMethod"
    ] = None,
) -> "capo_iot_events.types.create_detector_model_response.CreateDetectorModelResponse":
    """<p>Creates a detector model.</p>

    Args:
        detector_model_name: <p>The name of the detector model.</p>
        detector_model_definition: <p>Information that defines how the detectors operate.</p>
        detector_model_description: <p>A brief description of the detector model.</p>
        key: <p>The input attribute key used to identify a device or system to create a detector (an instance of the detector model) and then to route each input received to the appropriate detector (instance). This parameter uses a JSON-path expression in the message payload of each input to specify the attribute-value pair that is used to identify the device associated with the input.</p>
        role_arn: <p>The ARN of the role that grants permission to AWS IoT Events to perform its operations.</p>
        tags: <p>Metadata that can be used to manage the detector model.</p>
        evaluation_method: <p>Information about the order in which events are evaluated and how actions are executed. </p>

    Raises:
        capo_iot_events.errors.internal_failure_exception.InternalFailureException: <p>An internal failure occurred.</p>
        capo_iot_events.errors.invalid_request_exception.InvalidRequestException: <p>The request was invalid.</p>
        capo_iot_events.errors.limit_exceeded_exception.LimitExceededException: <p>A limit was exceeded.</p>
        capo_iot_events.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The resource already exists.</p>
        capo_iot_events.errors.resource_in_use_exception.ResourceInUseException: <p>The resource is in use.</p>
        capo_iot_events.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is currently unavailable.</p>
        capo_iot_events.errors.throttling_exception.ThrottlingException: <p>The request could not be completed due to throttling.</p>
        capo_iot_events.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iot_events.types.create_detector_model_request.CreateDetectorModelRequest]",
    ) -> AsyncOperationResponse[
        "capo_iot_events.types.create_detector_model_response.CreateDetectorModelResponse"
    ]:
        import capo_iot_events._operations.iot_columbo_service.create_detector_model

        (
            output,
            http_response,
        ) = await capo_iot_events._operations.iot_columbo_service.create_detector_model.async_create_detector_model(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateDetectorModel")
    )
    input_: capo_iot_events.types.create_detector_model_request.CreateDetectorModelRequest = {
        "detector_model_name": detector_model_name,
        "detector_model_definition": detector_model_definition,
        "role_arn": role_arn,
    }
    if detector_model_description is not None:
        input_["detector_model_description"] = detector_model_description
    if key is not None:
        input_["key"] = key
    if tags is not None:
        input_["tags"] = tags
    if evaluation_method is not None:
        input_["evaluation_method"] = evaluation_method

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