# 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__, description=None, domain=None, forward_group_config=None, id=None, listener_id=None, priority=None, redirect_config=None, rewrite_config=None, rewrite_enabled=None, rule_action=None, rule_actions=None, rule_conditions=None, rule_id=None, server_group_id=None, traffic_limit_enabled=None, traffic_limit_qps=None, url=None):
        if description and not isinstance(description, str):
            raise TypeError("Expected argument 'description' to be a str")
        pulumi.set(__self__, "description", description)
        if domain and not isinstance(domain, str):
            raise TypeError("Expected argument 'domain' to be a str")
        pulumi.set(__self__, "domain", domain)
        if forward_group_config and not isinstance(forward_group_config, dict):
            raise TypeError("Expected argument 'forward_group_config' to be a dict")
        pulumi.set(__self__, "forward_group_config", forward_group_config)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if listener_id and not isinstance(listener_id, str):
            raise TypeError("Expected argument 'listener_id' to be a str")
        pulumi.set(__self__, "listener_id", listener_id)
        if priority and not isinstance(priority, int):
            raise TypeError("Expected argument 'priority' to be a int")
        pulumi.set(__self__, "priority", priority)
        if redirect_config and not isinstance(redirect_config, dict):
            raise TypeError("Expected argument 'redirect_config' to be a dict")
        pulumi.set(__self__, "redirect_config", redirect_config)
        if rewrite_config and not isinstance(rewrite_config, dict):
            raise TypeError("Expected argument 'rewrite_config' to be a dict")
        pulumi.set(__self__, "rewrite_config", rewrite_config)
        if rewrite_enabled and not isinstance(rewrite_enabled, str):
            raise TypeError("Expected argument 'rewrite_enabled' to be a str")
        pulumi.set(__self__, "rewrite_enabled", rewrite_enabled)
        if rule_action and not isinstance(rule_action, str):
            raise TypeError("Expected argument 'rule_action' to be a str")
        pulumi.set(__self__, "rule_action", rule_action)
        if rule_actions and not isinstance(rule_actions, list):
            raise TypeError("Expected argument 'rule_actions' to be a list")
        pulumi.set(__self__, "rule_actions", rule_actions)
        if rule_conditions and not isinstance(rule_conditions, list):
            raise TypeError("Expected argument 'rule_conditions' to be a list")
        pulumi.set(__self__, "rule_conditions", rule_conditions)
        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 server_group_id and not isinstance(server_group_id, str):
            raise TypeError("Expected argument 'server_group_id' to be a str")
        pulumi.set(__self__, "server_group_id", server_group_id)
        if traffic_limit_enabled and not isinstance(traffic_limit_enabled, str):
            raise TypeError("Expected argument 'traffic_limit_enabled' to be a str")
        pulumi.set(__self__, "traffic_limit_enabled", traffic_limit_enabled)
        if traffic_limit_qps and not isinstance(traffic_limit_qps, int):
            raise TypeError("Expected argument 'traffic_limit_qps' to be a int")
        pulumi.set(__self__, "traffic_limit_qps", traffic_limit_qps)
        if url and not isinstance(url, str):
            raise TypeError("Expected argument 'url' to be a str")
        pulumi.set(__self__, "url", url)

    @property
    @pulumi.getter
    def description(self) -> builtins.str:
        """
        转发规则的描述。
        """
        return pulumi.get(self, "description")

    @property
    @pulumi.getter
    def domain(self) -> builtins.str:
        """
        转发规则的域名。
        """
        return pulumi.get(self, "domain")

    @property
    @pulumi.getter(name="forwardGroupConfig")
    def forward_group_config(self) -> 'outputs.GetRuleForwardGroupConfigResult':
        """
        转发规则服务器组配置
        """
        return pulumi.get(self, "forward_group_config")

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

    @property
    @pulumi.getter(name="listenerId")
    def listener_id(self) -> builtins.str:
        """
        监听器ID。
        """
        return pulumi.get(self, "listener_id")

    @property
    @pulumi.getter
    def priority(self) -> builtins.int:
        """
        标准版转发规则优先级。
        """
        return pulumi.get(self, "priority")

    @property
    @pulumi.getter(name="redirectConfig")
    def redirect_config(self) -> 'outputs.GetRuleRedirectConfigResult':
        """
        重定向相关配置信息。
        """
        return pulumi.get(self, "redirect_config")

    @property
    @pulumi.getter(name="rewriteConfig")
    def rewrite_config(self) -> 'outputs.GetRuleRewriteConfigResult':
        """
        重定向相关配置信息。
        """
        return pulumi.get(self, "rewrite_config")

    @property
    @pulumi.getter(name="rewriteEnabled")
    def rewrite_enabled(self) -> builtins.str:
        """
        转发规则重写配置开关。on：开启。off：关闭。
        """
        return pulumi.get(self, "rewrite_enabled")

    @property
    @pulumi.getter(name="ruleAction")
    def rule_action(self) -> builtins.str:
        """
        转发规则动作。空：默认转发至服务器组。Redirect：重定向。
        """
        return pulumi.get(self, "rule_action")

    @property
    @pulumi.getter(name="ruleActions")
    def rule_actions(self) -> Sequence['outputs.GetRuleRuleActionResult']:
        """
        标准版转发规则动作。
        """
        return pulumi.get(self, "rule_actions")

    @property
    @pulumi.getter(name="ruleConditions")
    def rule_conditions(self) -> Sequence['outputs.GetRuleRuleConditionResult']:
        """
        标准版转发规则条件。
        """
        return pulumi.get(self, "rule_conditions")

    @property
    @pulumi.getter(name="ruleId")
    def rule_id(self) -> builtins.str:
        """
        转发规则ID。
        """
        return pulumi.get(self, "rule_id")

    @property
    @pulumi.getter(name="serverGroupId")
    def server_group_id(self) -> builtins.str:
        """
        转发规则关联的后端服务器组ID。
        """
        return pulumi.get(self, "server_group_id")

    @property
    @pulumi.getter(name="trafficLimitEnabled")
    def traffic_limit_enabled(self) -> builtins.str:
        """
        转发规则 QPS 限速开关。on：开启。off：关闭。
        """
        return pulumi.get(self, "traffic_limit_enabled")

    @property
    @pulumi.getter(name="trafficLimitQps")
    def traffic_limit_qps(self) -> builtins.int:
        """
        每秒请求数。取值范围：100～100000。
        """
        return pulumi.get(self, "traffic_limit_qps")

    @property
    @pulumi.getter
    def url(self) -> builtins.str:
        """
        转发规则的URL。
        """
        return pulumi.get(self, "url")


class AwaitableGetRuleResult(GetRuleResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetRuleResult(
            description=self.description,
            domain=self.domain,
            forward_group_config=self.forward_group_config,
            id=self.id,
            listener_id=self.listener_id,
            priority=self.priority,
            redirect_config=self.redirect_config,
            rewrite_config=self.rewrite_config,
            rewrite_enabled=self.rewrite_enabled,
            rule_action=self.rule_action,
            rule_actions=self.rule_actions,
            rule_conditions=self.rule_conditions,
            rule_id=self.rule_id,
            server_group_id=self.server_group_id,
            traffic_limit_enabled=self.traffic_limit_enabled,
            traffic_limit_qps=self.traffic_limit_qps,
            url=self.url)


def get_rule(id: Optional[builtins.str] = None,
             opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetRuleResult:
    """
    Data Source schema for Byteplus::ALB::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:alb/getRule:getRule', __args__, opts=opts, typ=GetRuleResult).value

    return AwaitableGetRuleResult(
        description=pulumi.get(__ret__, 'description'),
        domain=pulumi.get(__ret__, 'domain'),
        forward_group_config=pulumi.get(__ret__, 'forward_group_config'),
        id=pulumi.get(__ret__, 'id'),
        listener_id=pulumi.get(__ret__, 'listener_id'),
        priority=pulumi.get(__ret__, 'priority'),
        redirect_config=pulumi.get(__ret__, 'redirect_config'),
        rewrite_config=pulumi.get(__ret__, 'rewrite_config'),
        rewrite_enabled=pulumi.get(__ret__, 'rewrite_enabled'),
        rule_action=pulumi.get(__ret__, 'rule_action'),
        rule_actions=pulumi.get(__ret__, 'rule_actions'),
        rule_conditions=pulumi.get(__ret__, 'rule_conditions'),
        rule_id=pulumi.get(__ret__, 'rule_id'),
        server_group_id=pulumi.get(__ret__, 'server_group_id'),
        traffic_limit_enabled=pulumi.get(__ret__, 'traffic_limit_enabled'),
        traffic_limit_qps=pulumi.get(__ret__, 'traffic_limit_qps'),
        url=pulumi.get(__ret__, 'url'))
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::ALB::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:alb/getRule:getRule', __args__, opts=opts, typ=GetRuleResult)
    return __ret__.apply(lambda __response__: GetRuleResult(
        description=pulumi.get(__response__, 'description'),
        domain=pulumi.get(__response__, 'domain'),
        forward_group_config=pulumi.get(__response__, 'forward_group_config'),
        id=pulumi.get(__response__, 'id'),
        listener_id=pulumi.get(__response__, 'listener_id'),
        priority=pulumi.get(__response__, 'priority'),
        redirect_config=pulumi.get(__response__, 'redirect_config'),
        rewrite_config=pulumi.get(__response__, 'rewrite_config'),
        rewrite_enabled=pulumi.get(__response__, 'rewrite_enabled'),
        rule_action=pulumi.get(__response__, 'rule_action'),
        rule_actions=pulumi.get(__response__, 'rule_actions'),
        rule_conditions=pulumi.get(__response__, 'rule_conditions'),
        rule_id=pulumi.get(__response__, 'rule_id'),
        server_group_id=pulumi.get(__response__, 'server_group_id'),
        traffic_limit_enabled=pulumi.get(__response__, 'traffic_limit_enabled'),
        traffic_limit_qps=pulumi.get(__response__, 'traffic_limit_qps'),
        url=pulumi.get(__response__, 'url')))
