// *** 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/l7Rule:L7Rule")]
    public partial class L7Rule : Pulumi.CustomResource
    {
        /// <summary>
        /// Domain that the layer 7 rule works for. Valid string length ranges from 0 to 80.
        /// </summary>
        [Output("domain")]
        public Output<string> Domain { get; private set; } = null!;

        /// <summary>
        /// HTTP Status Code. The default is `26`. Valid value ranges: [1~31]. `1` means the return value '1xx' is health. `2` means
        /// the return value '2xx' is health. `4` means the return value '3xx' is health. `8` means the return value '4xx' is
        /// health. `16` means the return value '5xx' is health. If you want multiple return codes to indicate health, need to add
        /// the corresponding values.
        /// </summary>
        [Output("healthCheckCode")]
        public Output<int> HealthCheckCode { 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. Valid value ranges: [10~60]sec. The default is 15 sec.
        /// </summary>
        [Output("healthCheckInterval")]
        public Output<int> HealthCheckInterval { get; private set; } = null!;

        /// <summary>
        /// Methods of health check. The default is 'HEAD', the available value are 'HEAD' and 'GET'.
        /// </summary>
        [Output("healthCheckMethod")]
        public Output<string> HealthCheckMethod { get; private set; } = null!;

        /// <summary>
        /// Path of health check. The default is `/`.
        /// </summary>
        [Output("healthCheckPath")]
        public Output<string> HealthCheckPath { get; private set; } = null!;

        /// <summary>
        /// Indicates whether health check is enabled. The default is `false`.
        /// </summary>
        [Output("healthCheckSwitch")]
        public Output<bool> HealthCheckSwitch { 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>
        /// Name of the rule.
        /// </summary>
        [Output("name")]
        public Output<string> Name { get; private set; } = null!;

        /// <summary>
        /// Protocol of the rule. Valid values: `http`, `https`.
        /// </summary>
        [Output("protocol")]
        public Output<string> Protocol { get; private set; } = null!;

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

        /// <summary>
        /// Type of the resource that the layer 7 rule works for, valid value is `bgpip`.
        /// </summary>
        [Output("resourceType")]
        public Output<string> ResourceType { get; private set; } = null!;

        /// <summary>
        /// ID of the layer 7 rule.
        /// </summary>
        [Output("ruleId")]
        public Output<string> RuleId { 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
        /// 16.
        /// </summary>
        [Output("sourceLists")]
        public Output<ImmutableArray<string>> 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>
        /// SSL ID, when the `protocol` is `https`, the field should be set with valid SSL id.
        /// </summary>
        [Output("sslId")]
        public Output<string?> SslId { get; private set; } = null!;

        /// <summary>
        /// Status of the rule. `0` for create/modify success, `2` for create/modify fail, `3` for delete success, `5` for delete
        /// failed, `6` for waiting to be created/modified, `7` for waiting to be deleted and 8 for waiting to get SSL ID.
        /// </summary>
        [Output("status")]
        public Output<int> Status { get; private set; } = null!;

        /// <summary>
        /// Indicate the rule will take effect or not.
        /// </summary>
        [Output("switch")]
        public Output<bool> Switch { get; private set; } = null!;


        /// <summary>
        /// Create a L7Rule 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 L7Rule(string name, L7RuleArgs args, CustomResourceOptions? options = null)
            : base("tctest:Dayu/l7Rule:L7Rule", name, args ?? new L7RuleArgs(), MakeResourceOptions(options, ""))
        {
        }

        private L7Rule(string name, Input<string> id, L7RuleState? state = null, CustomResourceOptions? options = null)
            : base("tctest:Dayu/l7Rule:L7Rule", 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 L7Rule 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 L7Rule Get(string name, Input<string> id, L7RuleState? state = null, CustomResourceOptions? options = null)
        {
            return new L7Rule(name, id, state, options);
        }
    }

    public sealed class L7RuleArgs : Pulumi.ResourceArgs
    {
        /// <summary>
        /// Domain that the layer 7 rule works for. Valid string length ranges from 0 to 80.
        /// </summary>
        [Input("domain", required: true)]
        public Input<string> Domain { get; set; } = null!;

        /// <summary>
        /// HTTP Status Code. The default is `26`. Valid value ranges: [1~31]. `1` means the return value '1xx' is health. `2` means
        /// the return value '2xx' is health. `4` means the return value '3xx' is health. `8` means the return value '4xx' is
        /// health. `16` means the return value '5xx' is health. If you want multiple return codes to indicate health, need to add
        /// the corresponding values.
        /// </summary>
        [Input("healthCheckCode")]
        public Input<int>? HealthCheckCode { 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. Valid value ranges: [10~60]sec. The default is 15 sec.
        /// </summary>
        [Input("healthCheckInterval")]
        public Input<int>? HealthCheckInterval { get; set; }

        /// <summary>
        /// Methods of health check. The default is 'HEAD', the available value are 'HEAD' and 'GET'.
        /// </summary>
        [Input("healthCheckMethod")]
        public Input<string>? HealthCheckMethod { get; set; }

        /// <summary>
        /// Path of health check. The default is `/`.
        /// </summary>
        [Input("healthCheckPath")]
        public Input<string>? HealthCheckPath { get; set; }

        /// <summary>
        /// Indicates whether health check is enabled. The default is `false`.
        /// </summary>
        [Input("healthCheckSwitch")]
        public Input<bool>? HealthCheckSwitch { 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.
        /// </summary>
        [Input("name")]
        public Input<string>? Name { get; set; }

        /// <summary>
        /// Protocol of the rule. Valid values: `http`, `https`.
        /// </summary>
        [Input("protocol", required: true)]
        public Input<string> Protocol { get; set; } = null!;

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

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

        [Input("sourceLists", required: true)]
        private InputList<string>? _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
        /// 16.
        /// </summary>
        public InputList<string> SourceLists
        {
            get => _sourceLists ?? (_sourceLists = new InputList<string>());
            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!;

        /// <summary>
        /// SSL ID, when the `protocol` is `https`, the field should be set with valid SSL id.
        /// </summary>
        [Input("sslId")]
        public Input<string>? SslId { get; set; }

        /// <summary>
        /// Indicate the rule will take effect or not.
        /// </summary>
        [Input("switch", required: true)]
        public Input<bool> Switch { get; set; } = null!;

        public L7RuleArgs()
        {
        }
    }

    public sealed class L7RuleState : Pulumi.ResourceArgs
    {
        /// <summary>
        /// Domain that the layer 7 rule works for. Valid string length ranges from 0 to 80.
        /// </summary>
        [Input("domain")]
        public Input<string>? Domain { get; set; }

        /// <summary>
        /// HTTP Status Code. The default is `26`. Valid value ranges: [1~31]. `1` means the return value '1xx' is health. `2` means
        /// the return value '2xx' is health. `4` means the return value '3xx' is health. `8` means the return value '4xx' is
        /// health. `16` means the return value '5xx' is health. If you want multiple return codes to indicate health, need to add
        /// the corresponding values.
        /// </summary>
        [Input("healthCheckCode")]
        public Input<int>? HealthCheckCode { 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. Valid value ranges: [10~60]sec. The default is 15 sec.
        /// </summary>
        [Input("healthCheckInterval")]
        public Input<int>? HealthCheckInterval { get; set; }

        /// <summary>
        /// Methods of health check. The default is 'HEAD', the available value are 'HEAD' and 'GET'.
        /// </summary>
        [Input("healthCheckMethod")]
        public Input<string>? HealthCheckMethod { get; set; }

        /// <summary>
        /// Path of health check. The default is `/`.
        /// </summary>
        [Input("healthCheckPath")]
        public Input<string>? HealthCheckPath { get; set; }

        /// <summary>
        /// Indicates whether health check is enabled. The default is `false`.
        /// </summary>
        [Input("healthCheckSwitch")]
        public Input<bool>? HealthCheckSwitch { 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.
        /// </summary>
        [Input("name")]
        public Input<string>? Name { get; set; }

        /// <summary>
        /// Protocol of the rule. Valid values: `http`, `https`.
        /// </summary>
        [Input("protocol")]
        public Input<string>? Protocol { get; set; }

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

        /// <summary>
        /// Type of the resource that the layer 7 rule works for, valid value is `bgpip`.
        /// </summary>
        [Input("resourceType")]
        public Input<string>? ResourceType { get; set; }

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

        [Input("sourceLists")]
        private InputList<string>? _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
        /// 16.
        /// </summary>
        public InputList<string> SourceLists
        {
            get => _sourceLists ?? (_sourceLists = new InputList<string>());
            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; }

        /// <summary>
        /// SSL ID, when the `protocol` is `https`, the field should be set with valid SSL id.
        /// </summary>
        [Input("sslId")]
        public Input<string>? SslId { get; set; }

        /// <summary>
        /// Status of the rule. `0` for create/modify success, `2` for create/modify fail, `3` for delete success, `5` for delete
        /// failed, `6` for waiting to be created/modified, `7` for waiting to be deleted and 8 for waiting to get SSL ID.
        /// </summary>
        [Input("status")]
        public Input<int>? Status { get; set; }

        /// <summary>
        /// Indicate the rule will take effect or not.
        /// </summary>
        [Input("switch")]
        public Input<bool>? Switch { get; set; }

        public L7RuleState()
        {
        }
    }
}
