# 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 json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables

class LbRule(pulumi.CustomResource):
    backend_ids: pulumi.Output[list]
    """
    The IDs of the backend servers where rule applies, this argument is populated base on the `backend_id` responded from `lb_attachment` create.
    """
    domain: pulumi.Output[str]
    """
    The domain of content forward matching fields. `path` and `domain` cannot coexist. `path` and `domain` must be filled in one.
    """
    listener_id: pulumi.Output[str]
    """
    The ID of a listener server.
    """
    load_balancer_id: pulumi.Output[str]
    """
    The ID of a load balancer.
    """
    path: pulumi.Output[str]
    """
    The path of Content forward matching fields. `path` and `domain` cannot coexist. `path` and `domain` must be filled in one.
    """
    def __init__(__self__, resource_name, opts=None, backend_ids=None, domain=None, listener_id=None, load_balancer_id=None, path=None, __props__=None, __name__=None, __opts__=None):
        """
        Provides a Load Balancer Rule resource to add content forwarding policies for Load Balancer backend resource.
         
        > **Note** The Load Balancer Rule can only be define while the `protocol` of lb listener is one of HTTP and HTTPS. In addition, should set one of `domain` and `path` if defined.
        
        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[list] backend_ids: The IDs of the backend servers where rule applies, this argument is populated base on the `backend_id` responded from `lb_attachment` create.
        :param pulumi.Input[str] domain: The domain of content forward matching fields. `path` and `domain` cannot coexist. `path` and `domain` must be filled in one.
        :param pulumi.Input[str] listener_id: The ID of a listener server.
        :param pulumi.Input[str] load_balancer_id: The ID of a load balancer.
        :param pulumi.Input[str] path: The path of Content forward matching fields. `path` and `domain` cannot coexist. `path` and `domain` must be filled in one.

        > This content is derived from https://github.com/terraform-providers/terraform-provider-ucloud/blob/master/website/docs/r/lb_rule.html.markdown.
        """
        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 backend_ids is None:
                raise TypeError("Missing required property 'backend_ids'")
            __props__['backend_ids'] = backend_ids
            __props__['domain'] = domain
            if listener_id is None:
                raise TypeError("Missing required property 'listener_id'")
            __props__['listener_id'] = listener_id
            if load_balancer_id is None:
                raise TypeError("Missing required property 'load_balancer_id'")
            __props__['load_balancer_id'] = load_balancer_id
            __props__['path'] = path
        super(LbRule, __self__).__init__(
            'ucloud:ulb/lbRule:LbRule',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name, id, opts=None, backend_ids=None, domain=None, listener_id=None, load_balancer_id=None, path=None):
        """
        Get an existing LbRule 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 str id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[list] backend_ids: The IDs of the backend servers where rule applies, this argument is populated base on the `backend_id` responded from `lb_attachment` create.
        :param pulumi.Input[str] domain: The domain of content forward matching fields. `path` and `domain` cannot coexist. `path` and `domain` must be filled in one.
        :param pulumi.Input[str] listener_id: The ID of a listener server.
        :param pulumi.Input[str] load_balancer_id: The ID of a load balancer.
        :param pulumi.Input[str] path: The path of Content forward matching fields. `path` and `domain` cannot coexist. `path` and `domain` must be filled in one.

        > This content is derived from https://github.com/terraform-providers/terraform-provider-ucloud/blob/master/website/docs/r/lb_rule.html.markdown.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()
        __props__["backend_ids"] = backend_ids
        __props__["domain"] = domain
        __props__["listener_id"] = listener_id
        __props__["load_balancer_id"] = load_balancer_id
        __props__["path"] = path
        return LbRule(resource_name, opts=opts, __props__=__props__)
    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

