// *** 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! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.Tctest.Dayu
{
    [TctestResourceType("tctest:Dayu/l4Rule:L4Rule")]
    public partial class L4Rule : Pulumi.CustomResource
    {
        /// <summary>
        /// The destination port of the L4 rule.
        /// </summary>
        [Output("dPort")]
        public Output<int> DPort { get; private set; } = null!;

        /// <summary>
        /// Health threshold of health check, and the default is 3. If a success result is returned for the health check 3
        /// consecutive times, indicates that the forwarding is normal. The value range is 2-10.
        /// </summary>
        [Output("healthCheckHealthNum")]
        public Output<int> HealthCheckHealthNum { get; private set; } = null!;

        /// <summary>
        /// Interval time of health check. The value range is 10-60 sec, and the default is 15 sec.
        /// </summary>
        [Output("healthCheckInterval")]
        public Output<int> HealthCheckInterval { get; private set; } = null!;

        /// <summary>
        /// Indicates whether health check is enabled. The default is `false`. Only valid when source list has more than one source
        /// item.
        /// </summary>
        [Output("healthCheckSwitch")]
        public Output<bool> HealthCheckSwitch { get; private set; } = null!;

        /// <summary>
        /// HTTP Status Code. The default is 26 and value range is 2-60.
        /// </summary>
        [Output("healthCheckTimeout")]
        public Output<int> HealthCheckTimeout { get; private set; } = null!;

        /// <summary>
        /// Unhealthy threshold of health check, and the default is 3. If the unhealthy result is returned 3 consecutive times,
        /// indicates that the forwarding is abnormal. The value range is 2-10.
        /// </summary>
        [Output("healthCheckUnhealthNum")]
        public Output<int> HealthCheckUnhealthNum { get; private set; } = null!;

        /// <summary>
        /// LB type of the rule. Valid values: `1`, `2`. `1` for weight cycling and `2` for IP hash.
        /// </summary>
        [Output("lbType")]
        public Output<int> LbType { get; private set; } = null!;

        /// <summary>
        /// Name of the rule. When the `resource_type` is `net`, this field should be set with valid domain.
        /// </summary>
        [Output("name")]
        public Output<string> Name { get; private set; } = null!;

        /// <summary>
        /// Protocol of the rule. Valid values: `http`, `https`. When `source_type` is 1(host source), the value of this field can
        /// only set with `tcp`.
        /// </summary>
        [Output("protocol")]
        public Output<string> Protocol { get; private set; } = null!;

        /// <summary>
        /// ID of the resource that the layer 4 rule works for.
        /// </summary>
        [Output("resourceId")]
        public Output<string> ResourceId { get; private set; } = null!;

        /// <summary>
        /// Type of the resource that the layer 4 rule works for. Valid values: `bgpip` and `net`.
        /// </summary>
        [Output("resourceType")]
        public Output<string> ResourceType { get; private set; } = null!;

        /// <summary>
        /// ID of the layer 4 rule.
        /// </summary>
        [Output("ruleId")]
        public Output<string> RuleId { get; private set; } = null!;

        /// <summary>
        /// The source port of the L4 rule.
        /// </summary>
        [Output("sPort")]
        public Output<int> SPort { get; private set; } = null!;

        /// <summary>
        /// Indicate that the session will keep or not, and default value is `false`.
        /// </summary>
        [Output("sessionSwitch")]
        public Output<bool?> SessionSwitch { get; private set; } = null!;

        /// <summary>
        /// Session keep time, only valid when `session_switch` is true, the available value ranges from 1 to 300 and unit is
        /// second.
        /// </summary>
        [Output("sessionTime")]
        public Output<int> SessionTime { get; private set; } = null!;

        /// <summary>
        /// Source list of the rule, it can be a set of ip sources or a set of domain sources. The number of items ranges from 1 to
        /// 20.
        /// </summary>
        [Output("sourceLists")]
        public Output<ImmutableArray<Outputs.L4RuleSourceList>> SourceLists { get; private set; } = null!;

        /// <summary>
        /// Source type, `1` for source of host, `2` for source of IP.
        /// </summary>
        [Output("sourceType")]
        public Output<int> SourceType { get; private set; } = null!;


        /// <summary>
        /// Create a L4Rule resource with the given unique name, arguments, and options.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resource</param>
        /// <param name="args">The arguments used to populate this resource's properties</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public L4Rule(string name, L4RuleArgs args, CustomResourceOptions? options = null)
            : base("tctest:Dayu/l4Rule:L4Rule", name, args ?? new L4RuleArgs(), MakeResourceOptions(options, ""))
        {
        }

        private L4Rule(string name, Input<string> id, L4RuleState? state = null, CustomResourceOptions? options = null)
            : base("tctest:Dayu/l4Rule:L4Rule", name, state, MakeResourceOptions(options, id))
        {
        }

        private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
        {
            var defaultOptions = new CustomResourceOptions
            {
                Version = Utilities.Version,
            };
            var merged = CustomResourceOptions.Merge(defaultOptions, options);
            // Override the ID if one was specified for consistency with other language SDKs.
            merged.Id = id ?? merged.Id;
            return merged;
        }
        /// <summary>
        /// Get an existing L4Rule resource's state with the given name, ID, and optional extra
        /// properties used to qualify the lookup.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resulting resource.</param>
        /// <param name="id">The unique provider ID of the resource to lookup.</param>
        /// <param name="state">Any extra arguments used during the lookup.</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public static L4Rule Get(string name, Input<string> id, L4RuleState? state = null, CustomResourceOptions? options = null)
        {
            return new L4Rule(name, id, state, options);
        }
    }

    public sealed class L4RuleArgs : Pulumi.ResourceArgs
    {
        /// <summary>
        /// The destination port of the L4 rule.
        /// </summary>
        [Input("dPort", required: true)]
        public Input<int> DPort { get; set; } = null!;

        /// <summary>
        /// Health threshold of health check, and the default is 3. If a success result is returned for the health check 3
        /// consecutive times, indicates that the forwarding is normal. The value range is 2-10.
        /// </summary>
        [Input("healthCheckHealthNum")]
        public Input<int>? HealthCheckHealthNum { get; set; }

        /// <summary>
        /// Interval time of health check. The value range is 10-60 sec, and the default is 15 sec.
        /// </summary>
        [Input("healthCheckInterval")]
        public Input<int>? HealthCheckInterval { get; set; }

        /// <summary>
        /// Indicates whether health check is enabled. The default is `false`. Only valid when source list has more than one source
        /// item.
        /// </summary>
        [Input("healthCheckSwitch")]
        public Input<bool>? HealthCheckSwitch { get; set; }

        /// <summary>
        /// HTTP Status Code. The default is 26 and value range is 2-60.
        /// </summary>
        [Input("healthCheckTimeout")]
        public Input<int>? HealthCheckTimeout { get; set; }

        /// <summary>
        /// Unhealthy threshold of health check, and the default is 3. If the unhealthy result is returned 3 consecutive times,
        /// indicates that the forwarding is abnormal. The value range is 2-10.
        /// </summary>
        [Input("healthCheckUnhealthNum")]
        public Input<int>? HealthCheckUnhealthNum { get; set; }

        /// <summary>
        /// Name of the rule. When the `resource_type` is `net`, this field should be set with valid domain.
        /// </summary>
        [Input("name")]
        public Input<string>? Name { get; set; }

        /// <summary>
        /// Protocol of the rule. Valid values: `http`, `https`. When `source_type` is 1(host source), the value of this field can
        /// only set with `tcp`.
        /// </summary>
        [Input("protocol", required: true)]
        public Input<string> Protocol { get; set; } = null!;

        /// <summary>
        /// ID of the resource that the layer 4 rule works for.
        /// </summary>
        [Input("resourceId", required: true)]
        public Input<string> ResourceId { get; set; } = null!;

        /// <summary>
        /// Type of the resource that the layer 4 rule works for. Valid values: `bgpip` and `net`.
        /// </summary>
        [Input("resourceType", required: true)]
        public Input<string> ResourceType { get; set; } = null!;

        /// <summary>
        /// The source port of the L4 rule.
        /// </summary>
        [Input("sPort", required: true)]
        public Input<int> SPort { get; set; } = null!;

        /// <summary>
        /// Indicate that the session will keep or not, and default value is `false`.
        /// </summary>
        [Input("sessionSwitch")]
        public Input<bool>? SessionSwitch { get; set; }

        /// <summary>
        /// Session keep time, only valid when `session_switch` is true, the available value ranges from 1 to 300 and unit is
        /// second.
        /// </summary>
        [Input("sessionTime")]
        public Input<int>? SessionTime { get; set; }

        [Input("sourceLists", required: true)]
        private InputList<Inputs.L4RuleSourceListArgs>? _sourceLists;

        /// <summary>
        /// Source list of the rule, it can be a set of ip sources or a set of domain sources. The number of items ranges from 1 to
        /// 20.
        /// </summary>
        public InputList<Inputs.L4RuleSourceListArgs> SourceLists
        {
            get => _sourceLists ?? (_sourceLists = new InputList<Inputs.L4RuleSourceListArgs>());
            set => _sourceLists = value;
        }

        /// <summary>
        /// Source type, `1` for source of host, `2` for source of IP.
        /// </summary>
        [Input("sourceType", required: true)]
        public Input<int> SourceType { get; set; } = null!;

        public L4RuleArgs()
        {
        }
    }

    public sealed class L4RuleState : Pulumi.ResourceArgs
    {
        /// <summary>
        /// The destination port of the L4 rule.
        /// </summary>
        [Input("dPort")]
        public Input<int>? DPort { get; set; }

        /// <summary>
        /// Health threshold of health check, and the default is 3. If a success result is returned for the health check 3
        /// consecutive times, indicates that the forwarding is normal. The value range is 2-10.
        /// </summary>
        [Input("healthCheckHealthNum")]
        public Input<int>? HealthCheckHealthNum { get; set; }

        /// <summary>
        /// Interval time of health check. The value range is 10-60 sec, and the default is 15 sec.
        /// </summary>
        [Input("healthCheckInterval")]
        public Input<int>? HealthCheckInterval { get; set; }

        /// <summary>
        /// Indicates whether health check is enabled. The default is `false`. Only valid when source list has more than one source
        /// item.
        /// </summary>
        [Input("healthCheckSwitch")]
        public Input<bool>? HealthCheckSwitch { get; set; }

        /// <summary>
        /// HTTP Status Code. The default is 26 and value range is 2-60.
        /// </summary>
        [Input("healthCheckTimeout")]
        public Input<int>? HealthCheckTimeout { get; set; }

        /// <summary>
        /// Unhealthy threshold of health check, and the default is 3. If the unhealthy result is returned 3 consecutive times,
        /// indicates that the forwarding is abnormal. The value range is 2-10.
        /// </summary>
        [Input("healthCheckUnhealthNum")]
        public Input<int>? HealthCheckUnhealthNum { get; set; }

        /// <summary>
        /// LB type of the rule. Valid values: `1`, `2`. `1` for weight cycling and `2` for IP hash.
        /// </summary>
        [Input("lbType")]
        public Input<int>? LbType { get; set; }

        /// <summary>
        /// Name of the rule. When the `resource_type` is `net`, this field should be set with valid domain.
        /// </summary>
        [Input("name")]
        public Input<string>? Name { get; set; }

        /// <summary>
        /// Protocol of the rule. Valid values: `http`, `https`. When `source_type` is 1(host source), the value of this field can
        /// only set with `tcp`.
        /// </summary>
        [Input("protocol")]
        public Input<string>? Protocol { get; set; }

        /// <summary>
        /// ID of the resource that the layer 4 rule works for.
        /// </summary>
        [Input("resourceId")]
        public Input<string>? ResourceId { get; set; }

        /// <summary>
        /// Type of the resource that the layer 4 rule works for. Valid values: `bgpip` and `net`.
        /// </summary>
        [Input("resourceType")]
        public Input<string>? ResourceType { get; set; }

        /// <summary>
        /// ID of the layer 4 rule.
        /// </summary>
        [Input("ruleId")]
        public Input<string>? RuleId { get; set; }

        /// <summary>
        /// The source port of the L4 rule.
        /// </summary>
        [Input("sPort")]
        public Input<int>? SPort { get; set; }

        /// <summary>
        /// Indicate that the session will keep or not, and default value is `false`.
        /// </summary>
        [Input("sessionSwitch")]
        public Input<bool>? SessionSwitch { get; set; }

        /// <summary>
        /// Session keep time, only valid when `session_switch` is true, the available value ranges from 1 to 300 and unit is
        /// second.
        /// </summary>
        [Input("sessionTime")]
        public Input<int>? SessionTime { get; set; }

        [Input("sourceLists")]
        private InputList<Inputs.L4RuleSourceListGetArgs>? _sourceLists;

        /// <summary>
        /// Source list of the rule, it can be a set of ip sources or a set of domain sources. The number of items ranges from 1 to
        /// 20.
        /// </summary>
        public InputList<Inputs.L4RuleSourceListGetArgs> SourceLists
        {
            get => _sourceLists ?? (_sourceLists = new InputList<Inputs.L4RuleSourceListGetArgs>());
            set => _sourceLists = value;
        }

        /// <summary>
        /// Source type, `1` for source of host, `2` for source of IP.
        /// </summary>
        [Input("sourceType")]
        public Input<int>? SourceType { get; set; }

        public L4RuleState()
        {
        }
    }
}
