# 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__, action_type=None, description=None, domain=None, id=None, listener_id=None, redirect_config=None, rule_id=None, server_group_id=None, tags=None, url=None):
        if action_type and not isinstance(action_type, str):
            raise TypeError("Expected argument 'action_type' to be a str")
        pulumi.set(__self__, "action_type", action_type)
        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 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 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 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 tags and not isinstance(tags, list):
            raise TypeError("Expected argument 'tags' to be a list")
        pulumi.set(__self__, "tags", tags)
        if url and not isinstance(url, str):
            raise TypeError("Expected argument 'url' to be a str")
        pulumi.set(__self__, "url", url)

    @property
    @pulumi.getter(name="actionType")
    def action_type(self) -> builtins.str:
        """
        转发规则的转发动作。取值如下：Forward：转发至。Redirect：重定向至。
        """
        return pulumi.get(self, "action_type")

    @property
    @pulumi.getter
    def description(self) -> builtins.str:
        """
        转发规则的描述，默认值为空字符串。规范如下：必须以字母、数字或中文开头，可包含字母、数字、中文及以下特殊字符：英文逗号（,）、点号（.）、下划线（_）、空格（ ）、等号（=）、中划线（-）、中文逗号（，）、中文句号（。）。长度限制为0 ～ 255个字符。
        """
        return pulumi.get(self, "description")

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

    @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(name="redirectConfig")
    def redirect_config(self) -> 'outputs.GetRuleRedirectConfigResult':
        """
        重定向相关配置信息。
        """
        return pulumi.get(self, "redirect_config")

    @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
    def tags(self) -> Sequence['outputs.GetRuleTagResult']:
        """
        标签列表。
        """
        return pulumi.get(self, "tags")

    @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(
            action_type=self.action_type,
            description=self.description,
            domain=self.domain,
            id=self.id,
            listener_id=self.listener_id,
            redirect_config=self.redirect_config,
            rule_id=self.rule_id,
            server_group_id=self.server_group_id,
            tags=self.tags,
            url=self.url)


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

    return AwaitableGetRuleResult(
        action_type=pulumi.get(__ret__, 'action_type'),
        description=pulumi.get(__ret__, 'description'),
        domain=pulumi.get(__ret__, 'domain'),
        id=pulumi.get(__ret__, 'id'),
        listener_id=pulumi.get(__ret__, 'listener_id'),
        redirect_config=pulumi.get(__ret__, 'redirect_config'),
        rule_id=pulumi.get(__ret__, 'rule_id'),
        server_group_id=pulumi.get(__ret__, 'server_group_id'),
        tags=pulumi.get(__ret__, 'tags'),
        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::CLB::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:clb/getRule:getRule', __args__, opts=opts, typ=GetRuleResult)
    return __ret__.apply(lambda __response__: GetRuleResult(
        action_type=pulumi.get(__response__, 'action_type'),
        description=pulumi.get(__response__, 'description'),
        domain=pulumi.get(__response__, 'domain'),
        id=pulumi.get(__response__, 'id'),
        listener_id=pulumi.get(__response__, 'listener_id'),
        redirect_config=pulumi.get(__response__, 'redirect_config'),
        rule_id=pulumi.get(__response__, 'rule_id'),
        server_group_id=pulumi.get(__response__, 'server_group_id'),
        tags=pulumi.get(__response__, 'tags'),
        url=pulumi.get(__response__, 'url')))
