# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables
from . import outputs
from ._inputs import *

__all__ = ['GroupMetricRule']


class GroupMetricRule(pulumi.CustomResource):
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 category: Optional[pulumi.Input[str]] = None,
                 contact_groups: Optional[pulumi.Input[str]] = None,
                 dimensions: Optional[pulumi.Input[str]] = None,
                 effective_interval: Optional[pulumi.Input[str]] = None,
                 email_subject: Optional[pulumi.Input[str]] = None,
                 escalations: Optional[pulumi.Input[pulumi.InputType['GroupMetricRuleEscalationsArgs']]] = None,
                 group_id: Optional[pulumi.Input[str]] = None,
                 group_metric_rule_name: Optional[pulumi.Input[str]] = None,
                 interval: Optional[pulumi.Input[str]] = None,
                 metric_name: Optional[pulumi.Input[str]] = None,
                 namespace: Optional[pulumi.Input[str]] = None,
                 no_effective_interval: Optional[pulumi.Input[str]] = None,
                 period: Optional[pulumi.Input[int]] = None,
                 rule_id: Optional[pulumi.Input[str]] = None,
                 silence_time: Optional[pulumi.Input[int]] = None,
                 webhook: Optional[pulumi.Input[str]] = None,
                 __props__=None,
                 __name__=None,
                 __opts__=None):
        """
        Provides a Cloud Monitor Service Group Metric Rule resource.

        For information about Cloud Monitor Service Group Metric Rule and how to use it, see [What is Group Metric Rule](https://www.alibabacloud.com/help/en/doc-detail/114943.htm).

        > **NOTE:** Available in v1.104.0+.

        ## Import

        Cloud Monitor Service Group Metric Rule can be imported using the id, e.g.

        ```sh
         $ pulumi import alicloud:cms/groupMetricRule:GroupMetricRule example <rule_id>
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] category: The abbreviation of the service name.
        :param pulumi.Input[str] contact_groups: Alarm contact group.
        :param pulumi.Input[str] dimensions: The dimensions that specify the resources to be associated with the alert rule.
        :param pulumi.Input[str] effective_interval: The time period during which the alert rule is effective.
        :param pulumi.Input[str] email_subject: The subject of the alert notification email.                                         .
        :param pulumi.Input[pulumi.InputType['GroupMetricRuleEscalationsArgs']] escalations: Alarm level. See the block for escalations.
        :param pulumi.Input[str] group_id: The ID of the application group.
        :param pulumi.Input[str] group_metric_rule_name: The name of the alert rule.
        :param pulumi.Input[str] interval: The interval at which Cloud Monitor checks whether the alert rule is triggered. Unit: seconds.
        :param pulumi.Input[str] metric_name: The name of the metric.
        :param pulumi.Input[str] namespace: The namespace of the service.
        :param pulumi.Input[str] no_effective_interval: The time period during which the alert rule is ineffective.
        :param pulumi.Input[int] period: The aggregation period of the monitoring data. Unit: seconds. The value is an integral multiple of 60. Default value: `300`.
        :param pulumi.Input[str] rule_id: The ID of the alert rule.
        :param pulumi.Input[int] silence_time: The mute period during which new alerts are not reported even if the alert trigger conditions are met. Unit: seconds. Default value: `86400`, which is equivalent to one day.
        :param pulumi.Input[str] webhook: The callback URL.
        """
        if __name__ is not None:
            warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
            resource_name = __name__
        if __opts__ is not None:
            warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
            opts = __opts__
        if opts is None:
            opts = pulumi.ResourceOptions()
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.version is None:
            opts.version = _utilities.get_version()
        if opts.id is None:
            if __props__ is not None:
                raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
            __props__ = dict()

            if category is None and not opts.urn:
                raise TypeError("Missing required property 'category'")
            __props__['category'] = category
            __props__['contact_groups'] = contact_groups
            __props__['dimensions'] = dimensions
            __props__['effective_interval'] = effective_interval
            __props__['email_subject'] = email_subject
            if escalations is None and not opts.urn:
                raise TypeError("Missing required property 'escalations'")
            __props__['escalations'] = escalations
            if group_id is None and not opts.urn:
                raise TypeError("Missing required property 'group_id'")
            __props__['group_id'] = group_id
            if group_metric_rule_name is None and not opts.urn:
                raise TypeError("Missing required property 'group_metric_rule_name'")
            __props__['group_metric_rule_name'] = group_metric_rule_name
            __props__['interval'] = interval
            if metric_name is None and not opts.urn:
                raise TypeError("Missing required property 'metric_name'")
            __props__['metric_name'] = metric_name
            if namespace is None and not opts.urn:
                raise TypeError("Missing required property 'namespace'")
            __props__['namespace'] = namespace
            __props__['no_effective_interval'] = no_effective_interval
            __props__['period'] = period
            if rule_id is None and not opts.urn:
                raise TypeError("Missing required property 'rule_id'")
            __props__['rule_id'] = rule_id
            __props__['silence_time'] = silence_time
            __props__['webhook'] = webhook
            __props__['status'] = None
        super(GroupMetricRule, __self__).__init__(
            'alicloud:cms/groupMetricRule:GroupMetricRule',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            category: Optional[pulumi.Input[str]] = None,
            contact_groups: Optional[pulumi.Input[str]] = None,
            dimensions: Optional[pulumi.Input[str]] = None,
            effective_interval: Optional[pulumi.Input[str]] = None,
            email_subject: Optional[pulumi.Input[str]] = None,
            escalations: Optional[pulumi.Input[pulumi.InputType['GroupMetricRuleEscalationsArgs']]] = None,
            group_id: Optional[pulumi.Input[str]] = None,
            group_metric_rule_name: Optional[pulumi.Input[str]] = None,
            interval: Optional[pulumi.Input[str]] = None,
            metric_name: Optional[pulumi.Input[str]] = None,
            namespace: Optional[pulumi.Input[str]] = None,
            no_effective_interval: Optional[pulumi.Input[str]] = None,
            period: Optional[pulumi.Input[int]] = None,
            rule_id: Optional[pulumi.Input[str]] = None,
            silence_time: Optional[pulumi.Input[int]] = None,
            status: Optional[pulumi.Input[str]] = None,
            webhook: Optional[pulumi.Input[str]] = None) -> 'GroupMetricRule':
        """
        Get an existing GroupMetricRule resource's state with the given name, id, and optional extra
        properties used to qualify the lookup.

        :param str resource_name: The unique name of the resulting resource.
        :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] category: The abbreviation of the service name.
        :param pulumi.Input[str] contact_groups: Alarm contact group.
        :param pulumi.Input[str] dimensions: The dimensions that specify the resources to be associated with the alert rule.
        :param pulumi.Input[str] effective_interval: The time period during which the alert rule is effective.
        :param pulumi.Input[str] email_subject: The subject of the alert notification email.                                         .
        :param pulumi.Input[pulumi.InputType['GroupMetricRuleEscalationsArgs']] escalations: Alarm level. See the block for escalations.
        :param pulumi.Input[str] group_id: The ID of the application group.
        :param pulumi.Input[str] group_metric_rule_name: The name of the alert rule.
        :param pulumi.Input[str] interval: The interval at which Cloud Monitor checks whether the alert rule is triggered. Unit: seconds.
        :param pulumi.Input[str] metric_name: The name of the metric.
        :param pulumi.Input[str] namespace: The namespace of the service.
        :param pulumi.Input[str] no_effective_interval: The time period during which the alert rule is ineffective.
        :param pulumi.Input[int] period: The aggregation period of the monitoring data. Unit: seconds. The value is an integral multiple of 60. Default value: `300`.
        :param pulumi.Input[str] rule_id: The ID of the alert rule.
        :param pulumi.Input[int] silence_time: The mute period during which new alerts are not reported even if the alert trigger conditions are met. Unit: seconds. Default value: `86400`, which is equivalent to one day.
        :param pulumi.Input[str] status: The status of Group Metric Rule.
        :param pulumi.Input[str] webhook: The callback URL.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["category"] = category
        __props__["contact_groups"] = contact_groups
        __props__["dimensions"] = dimensions
        __props__["effective_interval"] = effective_interval
        __props__["email_subject"] = email_subject
        __props__["escalations"] = escalations
        __props__["group_id"] = group_id
        __props__["group_metric_rule_name"] = group_metric_rule_name
        __props__["interval"] = interval
        __props__["metric_name"] = metric_name
        __props__["namespace"] = namespace
        __props__["no_effective_interval"] = no_effective_interval
        __props__["period"] = period
        __props__["rule_id"] = rule_id
        __props__["silence_time"] = silence_time
        __props__["status"] = status
        __props__["webhook"] = webhook
        return GroupMetricRule(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter
    def category(self) -> pulumi.Output[str]:
        """
        The abbreviation of the service name.
        """
        return pulumi.get(self, "category")

    @property
    @pulumi.getter(name="contactGroups")
    def contact_groups(self) -> pulumi.Output[str]:
        """
        Alarm contact group.
        """
        return pulumi.get(self, "contact_groups")

    @property
    @pulumi.getter
    def dimensions(self) -> pulumi.Output[str]:
        """
        The dimensions that specify the resources to be associated with the alert rule.
        """
        return pulumi.get(self, "dimensions")

    @property
    @pulumi.getter(name="effectiveInterval")
    def effective_interval(self) -> pulumi.Output[Optional[str]]:
        """
        The time period during which the alert rule is effective.
        """
        return pulumi.get(self, "effective_interval")

    @property
    @pulumi.getter(name="emailSubject")
    def email_subject(self) -> pulumi.Output[str]:
        """
        The subject of the alert notification email.                                         .
        """
        return pulumi.get(self, "email_subject")

    @property
    @pulumi.getter
    def escalations(self) -> pulumi.Output['outputs.GroupMetricRuleEscalations']:
        """
        Alarm level. See the block for escalations.
        """
        return pulumi.get(self, "escalations")

    @property
    @pulumi.getter(name="groupId")
    def group_id(self) -> pulumi.Output[str]:
        """
        The ID of the application group.
        """
        return pulumi.get(self, "group_id")

    @property
    @pulumi.getter(name="groupMetricRuleName")
    def group_metric_rule_name(self) -> pulumi.Output[str]:
        """
        The name of the alert rule.
        """
        return pulumi.get(self, "group_metric_rule_name")

    @property
    @pulumi.getter
    def interval(self) -> pulumi.Output[Optional[str]]:
        """
        The interval at which Cloud Monitor checks whether the alert rule is triggered. Unit: seconds.
        """
        return pulumi.get(self, "interval")

    @property
    @pulumi.getter(name="metricName")
    def metric_name(self) -> pulumi.Output[str]:
        """
        The name of the metric.
        """
        return pulumi.get(self, "metric_name")

    @property
    @pulumi.getter
    def namespace(self) -> pulumi.Output[str]:
        """
        The namespace of the service.
        """
        return pulumi.get(self, "namespace")

    @property
    @pulumi.getter(name="noEffectiveInterval")
    def no_effective_interval(self) -> pulumi.Output[Optional[str]]:
        """
        The time period during which the alert rule is ineffective.
        """
        return pulumi.get(self, "no_effective_interval")

    @property
    @pulumi.getter
    def period(self) -> pulumi.Output[Optional[int]]:
        """
        The aggregation period of the monitoring data. Unit: seconds. The value is an integral multiple of 60. Default value: `300`.
        """
        return pulumi.get(self, "period")

    @property
    @pulumi.getter(name="ruleId")
    def rule_id(self) -> pulumi.Output[str]:
        """
        The ID of the alert rule.
        """
        return pulumi.get(self, "rule_id")

    @property
    @pulumi.getter(name="silenceTime")
    def silence_time(self) -> pulumi.Output[Optional[int]]:
        """
        The mute period during which new alerts are not reported even if the alert trigger conditions are met. Unit: seconds. Default value: `86400`, which is equivalent to one day.
        """
        return pulumi.get(self, "silence_time")

    @property
    @pulumi.getter
    def status(self) -> pulumi.Output[str]:
        """
        The status of Group Metric Rule.
        """
        return pulumi.get(self, "status")

    @property
    @pulumi.getter
    def webhook(self) -> pulumi.Output[Optional[str]]:
        """
        The callback URL.
        """
        return pulumi.get(self, "webhook")

    def translate_output_property(self, prop):
        return _tables.CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop

    def translate_input_property(self, prop):
        return _tables.SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop

