# 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 builtins
import copy
import warnings
import sys
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
if sys.version_info >= (3, 11):
    from typing import NotRequired, TypedDict, TypeAlias
else:
    from typing_extensions import NotRequired, TypedDict, TypeAlias
from .. import _utilities
from . import outputs

__all__ = [
    'GetRuleResult',
    'AwaitableGetRuleResult',
    'get_rule',
    'get_rule_output',
]

@pulumi.output_type
class GetRuleResult:
    """
    A collection of values returned by getRule.
    """
    def __init__(__self__, alert_methods=None, alert_state=None, condition_operator=None, conditions=None, contact_group_ids=None, created_at=None, description=None, dimension_conditions=None, effect_end_at=None, effect_start_at=None, enable_state=None, evaluation_count=None, id=None, level=None, level_conditions=None, multiple_conditions=None, namespace=None, no_data=None, notification_id=None, notify_templates=None, original_dimensions=None, project_name=None, recovery_notify=None, regions=None, resource_type=None, rule_id=None, rule_name=None, rule_type=None, silence_time=None, sub_namespace=None, tags=None, updated_at=None, webhook=None, webhook_ids=None):
        if alert_methods and not isinstance(alert_methods, list):
            raise TypeError("Expected argument 'alert_methods' to be a list")
        pulumi.set(__self__, "alert_methods", alert_methods)
        if alert_state and not isinstance(alert_state, str):
            raise TypeError("Expected argument 'alert_state' to be a str")
        pulumi.set(__self__, "alert_state", alert_state)
        if condition_operator and not isinstance(condition_operator, str):
            raise TypeError("Expected argument 'condition_operator' to be a str")
        pulumi.set(__self__, "condition_operator", condition_operator)
        if conditions and not isinstance(conditions, list):
            raise TypeError("Expected argument 'conditions' to be a list")
        pulumi.set(__self__, "conditions", conditions)
        if contact_group_ids and not isinstance(contact_group_ids, list):
            raise TypeError("Expected argument 'contact_group_ids' to be a list")
        pulumi.set(__self__, "contact_group_ids", contact_group_ids)
        if created_at and not isinstance(created_at, str):
            raise TypeError("Expected argument 'created_at' to be a str")
        pulumi.set(__self__, "created_at", created_at)
        if description and not isinstance(description, str):
            raise TypeError("Expected argument 'description' to be a str")
        pulumi.set(__self__, "description", description)
        if dimension_conditions and not isinstance(dimension_conditions, dict):
            raise TypeError("Expected argument 'dimension_conditions' to be a dict")
        pulumi.set(__self__, "dimension_conditions", dimension_conditions)
        if effect_end_at and not isinstance(effect_end_at, str):
            raise TypeError("Expected argument 'effect_end_at' to be a str")
        pulumi.set(__self__, "effect_end_at", effect_end_at)
        if effect_start_at and not isinstance(effect_start_at, str):
            raise TypeError("Expected argument 'effect_start_at' to be a str")
        pulumi.set(__self__, "effect_start_at", effect_start_at)
        if enable_state and not isinstance(enable_state, str):
            raise TypeError("Expected argument 'enable_state' to be a str")
        pulumi.set(__self__, "enable_state", enable_state)
        if evaluation_count and not isinstance(evaluation_count, int):
            raise TypeError("Expected argument 'evaluation_count' to be a int")
        pulumi.set(__self__, "evaluation_count", evaluation_count)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if level and not isinstance(level, str):
            raise TypeError("Expected argument 'level' to be a str")
        pulumi.set(__self__, "level", level)
        if level_conditions and not isinstance(level_conditions, list):
            raise TypeError("Expected argument 'level_conditions' to be a list")
        pulumi.set(__self__, "level_conditions", level_conditions)
        if multiple_conditions and not isinstance(multiple_conditions, bool):
            raise TypeError("Expected argument 'multiple_conditions' to be a bool")
        pulumi.set(__self__, "multiple_conditions", multiple_conditions)
        if namespace and not isinstance(namespace, str):
            raise TypeError("Expected argument 'namespace' to be a str")
        pulumi.set(__self__, "namespace", namespace)
        if no_data and not isinstance(no_data, dict):
            raise TypeError("Expected argument 'no_data' to be a dict")
        pulumi.set(__self__, "no_data", no_data)
        if notification_id and not isinstance(notification_id, str):
            raise TypeError("Expected argument 'notification_id' to be a str")
        pulumi.set(__self__, "notification_id", notification_id)
        if notify_templates and not isinstance(notify_templates, list):
            raise TypeError("Expected argument 'notify_templates' to be a list")
        pulumi.set(__self__, "notify_templates", notify_templates)
        if original_dimensions and not isinstance(original_dimensions, dict):
            raise TypeError("Expected argument 'original_dimensions' to be a dict")
        pulumi.set(__self__, "original_dimensions", original_dimensions)
        if project_name and not isinstance(project_name, str):
            raise TypeError("Expected argument 'project_name' to be a str")
        pulumi.set(__self__, "project_name", project_name)
        if recovery_notify and not isinstance(recovery_notify, dict):
            raise TypeError("Expected argument 'recovery_notify' to be a dict")
        pulumi.set(__self__, "recovery_notify", recovery_notify)
        if regions and not isinstance(regions, list):
            raise TypeError("Expected argument 'regions' to be a list")
        pulumi.set(__self__, "regions", regions)
        if resource_type and not isinstance(resource_type, str):
            raise TypeError("Expected argument 'resource_type' to be a str")
        pulumi.set(__self__, "resource_type", resource_type)
        if rule_id and not isinstance(rule_id, str):
            raise TypeError("Expected argument 'rule_id' to be a str")
        pulumi.set(__self__, "rule_id", rule_id)
        if rule_name and not isinstance(rule_name, str):
            raise TypeError("Expected argument 'rule_name' to be a str")
        pulumi.set(__self__, "rule_name", rule_name)
        if rule_type and not isinstance(rule_type, str):
            raise TypeError("Expected argument 'rule_type' to be a str")
        pulumi.set(__self__, "rule_type", rule_type)
        if silence_time and not isinstance(silence_time, int):
            raise TypeError("Expected argument 'silence_time' to be a int")
        pulumi.set(__self__, "silence_time", silence_time)
        if sub_namespace and not isinstance(sub_namespace, str):
            raise TypeError("Expected argument 'sub_namespace' to be a str")
        pulumi.set(__self__, "sub_namespace", sub_namespace)
        if tags and not isinstance(tags, list):
            raise TypeError("Expected argument 'tags' to be a list")
        pulumi.set(__self__, "tags", tags)
        if updated_at and not isinstance(updated_at, str):
            raise TypeError("Expected argument 'updated_at' to be a str")
        pulumi.set(__self__, "updated_at", updated_at)
        if webhook and not isinstance(webhook, str):
            raise TypeError("Expected argument 'webhook' to be a str")
        pulumi.set(__self__, "webhook", webhook)
        if webhook_ids and not isinstance(webhook_ids, list):
            raise TypeError("Expected argument 'webhook_ids' to be a list")
        pulumi.set(__self__, "webhook_ids", webhook_ids)

    @property
    @pulumi.getter(name="alertMethods")
    def alert_methods(self) -> Sequence[builtins.str]:
        """
        告警通知的方式。Email：邮件 Phone：电话 SMS：短信 Webhook：告警回调。
        """
        return pulumi.get(self, "alert_methods")

    @property
    @pulumi.getter(name="alertState")
    def alert_state(self) -> builtins.str:
        """
        告警状态。 alerting：告警中 normal：正常。
        """
        return pulumi.get(self, "alert_state")

    @property
    @pulumi.getter(name="conditionOperator")
    def condition_operator(self) -> builtins.str:
        """
        多指标判定条件。&&：多个指标同时成立才判定为触发告警,||：任意指标满足条件触发判定为告警。
        """
        return pulumi.get(self, "condition_operator")

    @property
    @pulumi.getter
    def conditions(self) -> Sequence['outputs.GetRuleConditionResult']:
        """
        告警条件。数组形式，支持填写多个指标判断语句，最多 10 个。
        """
        return pulumi.get(self, "conditions")

    @property
    @pulumi.getter(name="contactGroupIds")
    def contact_group_ids(self) -> Sequence[builtins.str]:
        """
        告警策略绑定的告警通知组 ID。
        """
        return pulumi.get(self, "contact_group_ids")

    @property
    @pulumi.getter(name="createdAt")
    def created_at(self) -> builtins.str:
        """
        告警策略创建时间，时间戳格式。
        """
        return pulumi.get(self, "created_at")

    @property
    @pulumi.getter
    def description(self) -> builtins.str:
        """
        告警策略描述信息。
        """
        return pulumi.get(self, "description")

    @property
    @pulumi.getter(name="dimensionConditions")
    def dimension_conditions(self) -> 'outputs.GetRuleDimensionConditionsResult':
        """
        Dimension 配置。
        """
        return pulumi.get(self, "dimension_conditions")

    @property
    @pulumi.getter(name="effectEndAt")
    def effect_end_at(self) -> builtins.str:
        """
        策略生效的截止时间，格式为HH:MM。
        """
        return pulumi.get(self, "effect_end_at")

    @property
    @pulumi.getter(name="effectStartAt")
    def effect_start_at(self) -> builtins.str:
        """
        告警策略生效的开始时间，格式为HH:MM。
        """
        return pulumi.get(self, "effect_start_at")

    @property
    @pulumi.getter(name="enableState")
    def enable_state(self) -> builtins.str:
        """
        告警策略的开启状态。,enable：开启,disable：禁用
        """
        return pulumi.get(self, "enable_state")

    @property
    @pulumi.getter(name="evaluationCount")
    def evaluation_count(self) -> builtins.int:
        """
        触发告警需要持续的周期。单位为分钟。
        """
        return pulumi.get(self, "evaluation_count")

    @property
    @pulumi.getter
    def id(self) -> builtins.str:
        """
        Uniquely identifies the resource.
        """
        return pulumi.get(self, "id")

    @property
    @pulumi.getter
    def level(self) -> builtins.str:
        """
        告警级别。critical：严重,warning：警告,notice：通知
        """
        return pulumi.get(self, "level")

    @property
    @pulumi.getter(name="levelConditions")
    def level_conditions(self) -> Sequence['outputs.GetRuleLevelConditionResult']:
        """
        告警分级配置。
        """
        return pulumi.get(self, "level_conditions")

    @property
    @pulumi.getter(name="multipleConditions")
    def multiple_conditions(self) -> builtins.bool:
        """
        告警策略是否用多指标。true：多指标,false：单指标（默认）。
        """
        return pulumi.get(self, "multiple_conditions")

    @property
    @pulumi.getter
    def namespace(self) -> builtins.str:
        """
        监控指标所属的云产品。详情请参见 云产品监控指标 下各产品的 Namespace。
        """
        return pulumi.get(self, "namespace")

    @property
    @pulumi.getter(name="noData")
    def no_data(self) -> 'outputs.GetRuleNoDataResult':
        """
        无数据告警。
        """
        return pulumi.get(self, "no_data")

    @property
    @pulumi.getter(name="notificationId")
    def notification_id(self) -> builtins.str:
        """
        通知策略 ID。
        """
        return pulumi.get(self, "notification_id")

    @property
    @pulumi.getter(name="notifyTemplates")
    def notify_templates(self) -> Sequence['outputs.GetRuleNotifyTemplateResult']:
        """
        通知模版配置。
        """
        return pulumi.get(self, "notify_templates")

    @property
    @pulumi.getter(name="originalDimensions")
    def original_dimensions(self) -> 'outputs.GetRuleOriginalDimensionsResult':
        """
        告警策略检测的资源 ID。
        """
        return pulumi.get(self, "original_dimensions")

    @property
    @pulumi.getter(name="projectName")
    def project_name(self) -> builtins.str:
        """
        告警策略所属项目。
        """
        return pulumi.get(self, "project_name")

    @property
    @pulumi.getter(name="recoveryNotify")
    def recovery_notify(self) -> 'outputs.GetRuleRecoveryNotifyResult':
        """
        告警恢复通知。
        """
        return pulumi.get(self, "recovery_notify")

    @property
    @pulumi.getter
    def regions(self) -> Sequence[builtins.str]:
        """
        云产品所属可用区 ID。
        """
        return pulumi.get(self, "regions")

    @property
    @pulumi.getter(name="resourceType")
    def resource_type(self) -> builtins.str:
        """
        告警策略检测的资源类型。
        """
        return pulumi.get(self, "resource_type")

    @property
    @pulumi.getter(name="ruleId")
    def rule_id(self) -> builtins.str:
        """
        告警策略 ID。
        """
        return pulumi.get(self, "rule_id")

    @property
    @pulumi.getter(name="ruleName")
    def rule_name(self) -> builtins.str:
        """
        告警策略名称。
        """
        return pulumi.get(self, "rule_name")

    @property
    @pulumi.getter(name="ruleType")
    def rule_type(self) -> builtins.str:
        """
        告警策略的类型。static：手动选择。dynamic：通过资源名称、项目和标签选择。
        """
        return pulumi.get(self, "rule_type")

    @property
    @pulumi.getter(name="silenceTime")
    def silence_time(self) -> builtins.int:
        """
        告警发送周期。单位为分钟。支持配置为 5、10、15、30、60、180、360、720、1440。
        """
        return pulumi.get(self, "silence_time")

    @property
    @pulumi.getter(name="subNamespace")
    def sub_namespace(self) -> builtins.str:
        """
        此策略引用的指标所属的维度。详情请参见 云产品监控指标 下各产品的 SubNamespace。
        """
        return pulumi.get(self, "sub_namespace")

    @property
    @pulumi.getter
    def tags(self) -> Sequence['outputs.GetRuleTagResult']:
        """
        告警策略绑定 Tag。
        """
        return pulumi.get(self, "tags")

    @property
    @pulumi.getter(name="updatedAt")
    def updated_at(self) -> builtins.str:
        """
        告警策略更新时间，时间戳格式。
        """
        return pulumi.get(self, "updated_at")

    @property
    @pulumi.getter
    def webhook(self) -> builtins.str:
        """
        告警策略绑定的告警回调 URL 地址。
        """
        return pulumi.get(self, "webhook")

    @property
    @pulumi.getter(name="webhookIds")
    def webhook_ids(self) -> Sequence[builtins.str]:
        """
        告警发生时告警回调 ID 列表。
        """
        return pulumi.get(self, "webhook_ids")


class AwaitableGetRuleResult(GetRuleResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetRuleResult(
            alert_methods=self.alert_methods,
            alert_state=self.alert_state,
            condition_operator=self.condition_operator,
            conditions=self.conditions,
            contact_group_ids=self.contact_group_ids,
            created_at=self.created_at,
            description=self.description,
            dimension_conditions=self.dimension_conditions,
            effect_end_at=self.effect_end_at,
            effect_start_at=self.effect_start_at,
            enable_state=self.enable_state,
            evaluation_count=self.evaluation_count,
            id=self.id,
            level=self.level,
            level_conditions=self.level_conditions,
            multiple_conditions=self.multiple_conditions,
            namespace=self.namespace,
            no_data=self.no_data,
            notification_id=self.notification_id,
            notify_templates=self.notify_templates,
            original_dimensions=self.original_dimensions,
            project_name=self.project_name,
            recovery_notify=self.recovery_notify,
            regions=self.regions,
            resource_type=self.resource_type,
            rule_id=self.rule_id,
            rule_name=self.rule_name,
            rule_type=self.rule_type,
            silence_time=self.silence_time,
            sub_namespace=self.sub_namespace,
            tags=self.tags,
            updated_at=self.updated_at,
            webhook=self.webhook,
            webhook_ids=self.webhook_ids)


def get_rule(id: Optional[builtins.str] = None,
             opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetRuleResult:
    """
    Data Source schema for Byteplus::CloudMonitor::Rule


    :param builtins.str id: Uniquely identifies the resource.
    """
    __args__ = dict()
    __args__['id'] = id
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('bytepluscc:cloudmonitor/getRule:getRule', __args__, opts=opts, typ=GetRuleResult).value

    return AwaitableGetRuleResult(
        alert_methods=pulumi.get(__ret__, 'alert_methods'),
        alert_state=pulumi.get(__ret__, 'alert_state'),
        condition_operator=pulumi.get(__ret__, 'condition_operator'),
        conditions=pulumi.get(__ret__, 'conditions'),
        contact_group_ids=pulumi.get(__ret__, 'contact_group_ids'),
        created_at=pulumi.get(__ret__, 'created_at'),
        description=pulumi.get(__ret__, 'description'),
        dimension_conditions=pulumi.get(__ret__, 'dimension_conditions'),
        effect_end_at=pulumi.get(__ret__, 'effect_end_at'),
        effect_start_at=pulumi.get(__ret__, 'effect_start_at'),
        enable_state=pulumi.get(__ret__, 'enable_state'),
        evaluation_count=pulumi.get(__ret__, 'evaluation_count'),
        id=pulumi.get(__ret__, 'id'),
        level=pulumi.get(__ret__, 'level'),
        level_conditions=pulumi.get(__ret__, 'level_conditions'),
        multiple_conditions=pulumi.get(__ret__, 'multiple_conditions'),
        namespace=pulumi.get(__ret__, 'namespace'),
        no_data=pulumi.get(__ret__, 'no_data'),
        notification_id=pulumi.get(__ret__, 'notification_id'),
        notify_templates=pulumi.get(__ret__, 'notify_templates'),
        original_dimensions=pulumi.get(__ret__, 'original_dimensions'),
        project_name=pulumi.get(__ret__, 'project_name'),
        recovery_notify=pulumi.get(__ret__, 'recovery_notify'),
        regions=pulumi.get(__ret__, 'regions'),
        resource_type=pulumi.get(__ret__, 'resource_type'),
        rule_id=pulumi.get(__ret__, 'rule_id'),
        rule_name=pulumi.get(__ret__, 'rule_name'),
        rule_type=pulumi.get(__ret__, 'rule_type'),
        silence_time=pulumi.get(__ret__, 'silence_time'),
        sub_namespace=pulumi.get(__ret__, 'sub_namespace'),
        tags=pulumi.get(__ret__, 'tags'),
        updated_at=pulumi.get(__ret__, 'updated_at'),
        webhook=pulumi.get(__ret__, 'webhook'),
        webhook_ids=pulumi.get(__ret__, 'webhook_ids'))
def get_rule_output(id: Optional[pulumi.Input[builtins.str]] = None,
                    opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetRuleResult]:
    """
    Data Source schema for Byteplus::CloudMonitor::Rule


    :param builtins.str id: Uniquely identifies the resource.
    """
    __args__ = dict()
    __args__['id'] = id
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('bytepluscc:cloudmonitor/getRule:getRule', __args__, opts=opts, typ=GetRuleResult)
    return __ret__.apply(lambda __response__: GetRuleResult(
        alert_methods=pulumi.get(__response__, 'alert_methods'),
        alert_state=pulumi.get(__response__, 'alert_state'),
        condition_operator=pulumi.get(__response__, 'condition_operator'),
        conditions=pulumi.get(__response__, 'conditions'),
        contact_group_ids=pulumi.get(__response__, 'contact_group_ids'),
        created_at=pulumi.get(__response__, 'created_at'),
        description=pulumi.get(__response__, 'description'),
        dimension_conditions=pulumi.get(__response__, 'dimension_conditions'),
        effect_end_at=pulumi.get(__response__, 'effect_end_at'),
        effect_start_at=pulumi.get(__response__, 'effect_start_at'),
        enable_state=pulumi.get(__response__, 'enable_state'),
        evaluation_count=pulumi.get(__response__, 'evaluation_count'),
        id=pulumi.get(__response__, 'id'),
        level=pulumi.get(__response__, 'level'),
        level_conditions=pulumi.get(__response__, 'level_conditions'),
        multiple_conditions=pulumi.get(__response__, 'multiple_conditions'),
        namespace=pulumi.get(__response__, 'namespace'),
        no_data=pulumi.get(__response__, 'no_data'),
        notification_id=pulumi.get(__response__, 'notification_id'),
        notify_templates=pulumi.get(__response__, 'notify_templates'),
        original_dimensions=pulumi.get(__response__, 'original_dimensions'),
        project_name=pulumi.get(__response__, 'project_name'),
        recovery_notify=pulumi.get(__response__, 'recovery_notify'),
        regions=pulumi.get(__response__, 'regions'),
        resource_type=pulumi.get(__response__, 'resource_type'),
        rule_id=pulumi.get(__response__, 'rule_id'),
        rule_name=pulumi.get(__response__, 'rule_name'),
        rule_type=pulumi.get(__response__, 'rule_type'),
        silence_time=pulumi.get(__response__, 'silence_time'),
        sub_namespace=pulumi.get(__response__, 'sub_namespace'),
        tags=pulumi.get(__response__, 'tags'),
        updated_at=pulumi.get(__response__, 'updated_at'),
        webhook=pulumi.get(__response__, 'webhook'),
        webhook_ids=pulumi.get(__response__, 'webhook_ids')))
