Skip to content

create_cloud_watch_alarm_template

create_cloud_watch_alarm_template(
    *,
    config_overrides: Optional[MediaLiveClientConfig] = None,
    comparison_operator: Optional[CloudWatchAlarmTemplateComparisonOperator] = None,
    datapoints_to_alarm: Optional[__integerMin1] = None,
    description: Optional[__stringMin0Max1024] = None,
    evaluation_periods: Optional[__integerMin1] = None,
    group_identifier: Optional[__stringPatternS] = None,
    metric_name: Optional[__stringMax64] = None,
    name: Optional[__stringMin1Max255PatternS] = None,
    period: Optional[__integerMin10Max86400] = None,
    statistic: Optional[CloudWatchAlarmTemplateStatistic] = None,
    tags: Optional[TagMap] = None,
    target_resource_type: Optional[CloudWatchAlarmTemplateTargetResourceType] = None,
    threshold: Optional[__double] = None,
    treat_missing_data: Optional[CloudWatchAlarmTemplateTreatMissingData] = None,
    request_id: Optional[__stringMin1Max256PatternS] = None,
) -> CreateCloudWatchAlarmTemplateResponse

Creates a cloudwatch alarm template to dynamically generate cloudwatch metric alarms on targeted resource types.

Parameters:

  • datapoints_to_alarm (Optional[__integerMin1], default: None ) –

    The number of datapoints within the evaluation period that must be breaching to trigger the alarm.

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

    A resource's optional description.

  • evaluation_periods (Optional[__integerMin1], default: None ) –

    The number of periods over which data is compared to the specified threshold.

  • group_identifier (Optional[__stringPatternS], default: None ) –

    A cloudwatch alarm template group's identifier. Can be either be its id or current name.

  • metric_name (Optional[__stringMax64], default: None ) –

    The name of the metric associated with the alarm. Must be compatible with targetResourceType.

  • name (Optional[__stringMin1Max255PatternS], default: None ) –

    A resource's name. Names must be unique within the scope of a resource type in a specific region.

  • period (Optional[__integerMin10Max86400], default: None ) –

    The period, in seconds, over which the specified statistic is applied.

  • threshold (Optional[__double], default: None ) –

    The threshold value to compare with the specified statistic.

  • request_id (Optional[__stringMin1Max256PatternS], default: None ) –

    An ID that you assign to a create request. This ID ensures idempotency when creating resources.

Raises:

Source code in docs_src/capo_medialive/_services/media_live.py
def create_cloud_watch_alarm_template(
    self,
    *,
    config_overrides: Optional[MediaLiveClientConfig] = None,
    comparison_operator: Optional[
        "capo_medialive.types.cloud_watch_alarm_template_comparison_operator.CloudWatchAlarmTemplateComparisonOperator"
    ] = None,
    datapoints_to_alarm: Optional[
        "capo_medialive.types.__integer_min1.__integerMin1"
    ] = None,
    description: Optional[
        "capo_medialive.types.__string_min0_max1024.__stringMin0Max1024"
    ] = None,
    evaluation_periods: Optional[
        "capo_medialive.types.__integer_min1.__integerMin1"
    ] = None,
    group_identifier: Optional[
        "capo_medialive.types.__string_pattern_s.__stringPatternS"
    ] = None,
    metric_name: Optional[
        "capo_medialive.types.__string_max64.__stringMax64"
    ] = None,
    name: Optional[
        "capo_medialive.types.__string_min1_max255_pattern_s.__stringMin1Max255PatternS"
    ] = None,
    period: Optional[
        "capo_medialive.types.__integer_min10_max86400.__integerMin10Max86400"
    ] = None,
    statistic: Optional[
        "capo_medialive.types.cloud_watch_alarm_template_statistic.CloudWatchAlarmTemplateStatistic"
    ] = None,
    tags: Optional["capo_medialive.types.tag_map.TagMap"] = None,
    target_resource_type: Optional[
        "capo_medialive.types.cloud_watch_alarm_template_target_resource_type.CloudWatchAlarmTemplateTargetResourceType"
    ] = None,
    threshold: Optional["capo_medialive.types.__double.__double"] = None,
    treat_missing_data: Optional[
        "capo_medialive.types.cloud_watch_alarm_template_treat_missing_data.CloudWatchAlarmTemplateTreatMissingData"
    ] = None,
    request_id: Optional[
        "capo_medialive.types.__string_min1_max256_pattern_s.__stringMin1Max256PatternS"
    ] = None,
) -> "capo_medialive.types.create_cloud_watch_alarm_template_response.CreateCloudWatchAlarmTemplateResponse":
    """Creates a cloudwatch alarm template to dynamically generate cloudwatch metric alarms on targeted resource types.

    Args:
        datapoints_to_alarm: The number of datapoints within the evaluation period that must be breaching to trigger the alarm.
        description: A resource's optional description.
        evaluation_periods: The number of periods over which data is compared to the specified threshold.
        group_identifier: A cloudwatch alarm template group's identifier. Can be either be its id or current name.
        metric_name: The name of the metric associated with the alarm. Must be compatible with targetResourceType.
        name: A resource's name. Names must be unique within the scope of a resource type in a specific region.
        period: The period, in seconds, over which the specified statistic is applied.
        threshold: The threshold value to compare with the specified statistic.
        request_id: An ID that you assign to a create request. This ID ensures idempotency when creating resources.

    Raises:
        capo_medialive.errors.bad_request_exception.BadRequestException: Placeholder documentation for BadRequestException
        capo_medialive.errors.conflict_exception.ConflictException: Placeholder documentation for ConflictException
        capo_medialive.errors.forbidden_exception.ForbiddenException: Placeholder documentation for ForbiddenException
        capo_medialive.errors.internal_server_error_exception.InternalServerErrorException: Placeholder documentation for InternalServerErrorException
        capo_medialive.errors.not_found_exception.NotFoundException: Placeholder documentation for NotFoundException
        capo_medialive.errors.too_many_requests_exception.TooManyRequestsException: Placeholder documentation for TooManyRequestsException
        capo_medialive.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_medialive.types.create_cloud_watch_alarm_template_request.CreateCloudWatchAlarmTemplateRequest]",
    ) -> OperationResponse[
        "capo_medialive.types.create_cloud_watch_alarm_template_response.CreateCloudWatchAlarmTemplateResponse"
    ]:
        import capo_medialive._operations.media_live.create_cloud_watch_alarm_template

        output, http_response = (
            capo_medialive._operations.media_live.create_cloud_watch_alarm_template.create_cloud_watch_alarm_template(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateCloudWatchAlarmTemplate")
    )
    input_: capo_medialive.types.create_cloud_watch_alarm_template_request.CreateCloudWatchAlarmTemplateRequest = {}
    if comparison_operator is not None:
        input_["comparison_operator"] = comparison_operator
    if datapoints_to_alarm is not None:
        input_["datapoints_to_alarm"] = datapoints_to_alarm
    if description is not None:
        input_["description"] = description
    if evaluation_periods is not None:
        input_["evaluation_periods"] = evaluation_periods
    if group_identifier is not None:
        input_["group_identifier"] = group_identifier
    if metric_name is not None:
        input_["metric_name"] = metric_name
    if name is not None:
        input_["name"] = name
    if period is not None:
        input_["period"] = period
    if statistic is not None:
        input_["statistic"] = statistic
    if tags is not None:
        input_["tags"] = tags
    if target_resource_type is not None:
        input_["target_resource_type"] = target_resource_type
    if threshold is not None:
        input_["threshold"] = threshold
    if treat_missing_data is not None:
        input_["treat_missing_data"] = treat_missing_data
    if request_id is None:
        request_id = str(uuid.uuid4())
    input_["request_id"] = request_id

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output