Skip to content

create_alarm_model async

create_alarm_model(
    alarm_model_name: AlarmModelName,
    role_arn: AmazonResourceName,
    alarm_rule: AlarmRule,
    *,
    config_overrides: Optional[AsyncIoTEventsClientConfig] = None,
    alarm_model_description: Optional[AlarmModelDescription] = None,
    tags: Optional[Tags] = None,
    key: Optional[AttributeJsonPath] = None,
    severity: Optional[Severity] = None,
    alarm_notification: Optional[AlarmNotification] = None,
    alarm_event_actions: Optional[AlarmEventActions] = None,
    alarm_capabilities: Optional[AlarmCapabilities] = None,
) -> CreateAlarmModelResponse

Creates an alarm model to monitor an AWS IoT Events input attribute. You can use the alarm to get notified when the value is outside a specified range. For more information, see Create an alarm model in the AWS IoT Events Developer Guide.

Parameters:

  • alarm_model_name (AlarmModelName) –

    A unique name that helps you identify the alarm model. You can't change this name after you create the alarm model.

  • alarm_model_description (Optional[AlarmModelDescription], default: None ) –

    A description that tells you what the alarm model detects.

  • role_arn (AmazonResourceName) –

    The ARN of the IAM role that allows the alarm to perform actions and access AWS resources. For more information, see Amazon Resource Names (ARNs) in the AWS General Reference.

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

    A list of key-value pairs that contain metadata for the alarm model. The tags help you manage the alarm model. For more information, see Tagging your AWS IoT Events resources in the AWS IoT Events Developer Guide.

    You can create up to 50 tags for one alarm model.

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

    An input attribute used as a key to create an alarm. AWS IoT Events routes inputs associated with this key to the alarm.

  • severity (Optional[Severity], default: None ) –

    A non-negative integer that reflects the severity level of the alarm.

  • alarm_rule (AlarmRule) –

    Defines when your alarm is invoked.

  • alarm_notification (Optional[AlarmNotification], default: None ) –

    Contains information about one or more notification actions.

  • alarm_event_actions (Optional[AlarmEventActions], default: None ) –

    Contains information about one or more alarm actions.

  • alarm_capabilities (Optional[AlarmCapabilities], default: None ) –

    Contains the configuration information of alarm state changes.

Raises:

Source code in docs_src/capo_iot_events/_services/async_io_t_events.py
async def create_alarm_model(
    self,
    alarm_model_name: "capo_iot_events.types.alarm_model_name.AlarmModelName",
    role_arn: "capo_iot_events.types.amazon_resource_name.AmazonResourceName",
    alarm_rule: "capo_iot_events.types.alarm_rule.AlarmRule",
    *,
    config_overrides: Optional[AsyncIoTEventsClientConfig] = None,
    alarm_model_description: Optional[
        "capo_iot_events.types.alarm_model_description.AlarmModelDescription"
    ] = None,
    tags: Optional["capo_iot_events.types.tags.Tags"] = None,
    key: Optional[
        "capo_iot_events.types.attribute_json_path.AttributeJsonPath"
    ] = None,
    severity: Optional["capo_iot_events.types.severity.Severity"] = None,
    alarm_notification: Optional[
        "capo_iot_events.types.alarm_notification.AlarmNotification"
    ] = None,
    alarm_event_actions: Optional[
        "capo_iot_events.types.alarm_event_actions.AlarmEventActions"
    ] = None,
    alarm_capabilities: Optional[
        "capo_iot_events.types.alarm_capabilities.AlarmCapabilities"
    ] = None,
) -> "capo_iot_events.types.create_alarm_model_response.CreateAlarmModelResponse":
    """<p>Creates an alarm model to monitor an AWS IoT Events input attribute. You can use the alarm to get notified when the value is outside a specified range. For more information, see <a href="https://docs.aws.amazon.com/iotevents/latest/developerguide/create-alarms.html">Create an alarm model</a> in the <i>AWS IoT Events Developer Guide</i>.</p>

    Args:
        alarm_model_name: <p>A unique name that helps you identify the alarm model. You can't change this name after you create the alarm model.</p>
        alarm_model_description: <p>A description that tells you what the alarm model detects.</p>
        role_arn: <p>The ARN of the IAM role that allows the alarm to perform actions and access AWS resources. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs)</a> in the <i>AWS General Reference</i>.</p>
        tags: <p>A list of key-value pairs that contain metadata for the alarm model. The tags help you manage the alarm model. For more information, see <a href="https://docs.aws.amazon.com/iotevents/latest/developerguide/tagging-iotevents.html">Tagging your AWS IoT Events resources</a> in the <i>AWS IoT Events Developer Guide</i>.</p> <p>You can create up to 50 tags for one alarm model.</p>
        key: <p>An input attribute used as a key to create an alarm. AWS IoT Events routes <a href="https://docs.aws.amazon.com/iotevents/latest/apireference/API_Input.html">inputs</a> associated with this key to the alarm.</p>
        severity: <p>A non-negative integer that reflects the severity level of the alarm.</p>
        alarm_rule: <p>Defines when your alarm is invoked.</p>
        alarm_notification: <p>Contains information about one or more notification actions.</p>
        alarm_event_actions: <p>Contains information about one or more alarm actions.</p>
        alarm_capabilities: <p>Contains the configuration information of alarm state changes.</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_alarm_model_request.CreateAlarmModelRequest]",
    ) -> AsyncOperationResponse[
        "capo_iot_events.types.create_alarm_model_response.CreateAlarmModelResponse"
    ]:
        import capo_iot_events._operations.iot_columbo_service.create_alarm_model

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateAlarmModel")
    )
    input_: capo_iot_events.types.create_alarm_model_request.CreateAlarmModelRequest = {
        "alarm_model_name": alarm_model_name,
        "role_arn": role_arn,
        "alarm_rule": alarm_rule,
    }
    if alarm_model_description is not None:
        input_["alarm_model_description"] = alarm_model_description
    if tags is not None:
        input_["tags"] = tags
    if key is not None:
        input_["key"] = key
    if severity is not None:
        input_["severity"] = severity
    if alarm_notification is not None:
        input_["alarm_notification"] = alarm_notification
    if alarm_event_actions is not None:
        input_["alarm_event_actions"] = alarm_event_actions
    if alarm_capabilities is not None:
        input_["alarm_capabilities"] = alarm_capabilities

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