<reponame>Kagashino/pulumi-tctest<filename>sdk/dotnet/Clb/ListenerRule.cs// *** 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.Clb
{
    [TctestResourceType("tctest:Clb/listenerRule:ListenerRule")]
    public partial class ListenerRule : Pulumi.CustomResource
    {
        /// <summary>
        /// ID of the client certificate. NOTES: Only supports listeners of HTTPS protocol.
        /// </summary>
        [Output("certificateCaId")]
        public Output<string?> CertificateCaId { get; private set; } = null!;

        /// <summary>
        /// ID of the server certificate. NOTES: Only supports listeners of HTTPS protocol.
        /// </summary>
        [Output("certificateId")]
        public Output<string?> CertificateId { get; private set; } = null!;

        /// <summary>
        /// Type of certificate. Valid values: `UNIDIRECTIONAL`, `MUTUAL`. NOTES: Only supports listeners of HTTPS protocol.
        /// </summary>
        [Output("certificateSslMode")]
        public Output<string?> CertificateSslMode { get; private set; } = null!;

        /// <summary>
        /// ID of CLB instance.
        /// </summary>
        [Output("clbId")]
        public Output<string> ClbId { get; private set; } = null!;

        /// <summary>
        /// Domain name of the listener rule.
        /// </summary>
        [Output("domain")]
        public Output<string> Domain { get; private set; } = null!;

        /// <summary>
        /// Forwarding protocol between the CLB instance and real server. Valid values: `HTTP`, `HTTPS`, `TRPC`.
        /// </summary>
        [Output("forwardType")]
        public Output<string> ForwardType { 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]. NOTES: TCP/UDP/TCP_SSL listener
        /// allows direct configuration, HTTP/HTTPS listener needs to be configured in `tencentcloud_clb_listener_rule`.
        /// </summary>
        [Output("healthCheckHealthNum")]
        public Output<int> HealthCheckHealthNum { get; private set; } = null!;

        /// <summary>
        /// HTTP Status Code. The default is 31. 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. NOTES: The 'HTTP' health check of the 'TCP' listener only supports specifying one health check
        /// status code. NOTES: Only supports listeners of 'HTTP' and 'HTTPS' protocol.
        /// </summary>
        [Output("healthCheckHttpCode")]
        public Output<int> HealthCheckHttpCode { get; private set; } = null!;

        /// <summary>
        /// Domain name of health check. NOTES: Only supports listeners of `HTTP` and `HTTPS` protocol.
        /// </summary>
        [Output("healthCheckHttpDomain")]
        public Output<string> HealthCheckHttpDomain { get; private set; } = null!;

        /// <summary>
        /// Methods of health check. NOTES: Only supports listeners of `HTTP` and `HTTPS` protocol. The default is `HEAD`, the
        /// available value are `HEAD` and `GET`.
        /// </summary>
        [Output("healthCheckHttpMethod")]
        public Output<string> HealthCheckHttpMethod { get; private set; } = null!;

        /// <summary>
        /// Path of health check. NOTES: Only supports listeners of `HTTP` and `HTTPS` protocol.
        /// </summary>
        [Output("healthCheckHttpPath")]
        public Output<string> HealthCheckHttpPath { get; private set; } = null!;

        /// <summary>
        /// Interval time of health check. Valid value ranges: (5~300) sec. and the default is `5` sec. NOTES: TCP/UDP/TCP_SSL
        /// listener allows direct configuration, HTTP/HTTPS listener needs to be configured in `tencentcloud_clb_listener_rule`.
        /// </summary>
        [Output("healthCheckIntervalTime")]
        public Output<int> HealthCheckIntervalTime { get; private set; } = null!;

        /// <summary>
        /// Indicates whether health check is enabled.
        /// </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]. NOTES: TCP/UDP/TCP_SSL listener allows direct
        /// configuration, HTTP/HTTPS listener needs to be configured in `tencentcloud_clb_listener_rule`.
        /// </summary>
        [Output("healthCheckUnhealthNum")]
        public Output<int> HealthCheckUnhealthNum { get; private set; } = null!;

        /// <summary>
        /// Indicate to apply HTTP2.0 protocol or not.
        /// </summary>
        [Output("http2Switch")]
        public Output<bool> Http2Switch { get; private set; } = null!;

        /// <summary>
        /// ID of CLB listener.
        /// </summary>
        [Output("listenerId")]
        public Output<string> ListenerId { get; private set; } = null!;

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

        /// <summary>
        /// Scheduling method of the CLB listener rules. Valid values: `WRR`, `IP HASH`, `LEAST_CONN`. The default is `WRR`. NOTES:
        /// TCP/UDP/TCP_SSL listener allows direct configuration, HTTP/HTTPS listener needs to be configured in
        /// `tencentcloud_clb_listener_rule`.
        /// </summary>
        [Output("scheduler")]
        public Output<string?> Scheduler { get; private set; } = null!;

        /// <summary>
        /// Time of session persistence within the CLB listener. NOTES: Available when scheduler is specified as `WRR`, and not
        /// available when listener protocol is `TCP_SSL`. NOTES: TCP/UDP/TCP_SSL listener allows direct configuration, HTTP/HTTPS
        /// listener needs to be configured in `tencentcloud_clb_listener_rule`.
        /// </summary>
        [Output("sessionExpireTime")]
        public Output<int?> SessionExpireTime { get; private set; } = null!;

        /// <summary>
        /// Backend target type. Valid values: `NODE`, `TARGETGROUP`. `NODE` means to bind ordinary nodes, `TARGETGROUP` means to
        /// bind target group.
        /// </summary>
        [Output("targetType")]
        public Output<string?> TargetType { get; private set; } = null!;

        /// <summary>
        /// Url of the listener rule.
        /// </summary>
        [Output("url")]
        public Output<string> Url { get; private set; } = null!;


        /// <summary>
        /// Create a ListenerRule 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 ListenerRule(string name, ListenerRuleArgs args, CustomResourceOptions? options = null)
            : base("tctest:Clb/listenerRule:ListenerRule", name, args ?? new ListenerRuleArgs(), MakeResourceOptions(options, ""))
        {
        }

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

    public sealed class ListenerRuleArgs : Pulumi.ResourceArgs
    {
        /// <summary>
        /// ID of the client certificate. NOTES: Only supports listeners of HTTPS protocol.
        /// </summary>
        [Input("certificateCaId")]
        public Input<string>? CertificateCaId { get; set; }

        /// <summary>
        /// ID of the server certificate. NOTES: Only supports listeners of HTTPS protocol.
        /// </summary>
        [Input("certificateId")]
        public Input<string>? CertificateId { get; set; }

        /// <summary>
        /// Type of certificate. Valid values: `UNIDIRECTIONAL`, `MUTUAL`. NOTES: Only supports listeners of HTTPS protocol.
        /// </summary>
        [Input("certificateSslMode")]
        public Input<string>? CertificateSslMode { get; set; }

        /// <summary>
        /// ID of CLB instance.
        /// </summary>
        [Input("clbId", required: true)]
        public Input<string> ClbId { get; set; } = null!;

        /// <summary>
        /// Domain name of the listener rule.
        /// </summary>
        [Input("domain", required: true)]
        public Input<string> Domain { get; set; } = null!;

        /// <summary>
        /// Forwarding protocol between the CLB instance and real server. Valid values: `HTTP`, `HTTPS`, `TRPC`.
        /// </summary>
        [Input("forwardType")]
        public Input<string>? ForwardType { 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]. NOTES: TCP/UDP/TCP_SSL listener
        /// allows direct configuration, HTTP/HTTPS listener needs to be configured in `tencentcloud_clb_listener_rule`.
        /// </summary>
        [Input("healthCheckHealthNum")]
        public Input<int>? HealthCheckHealthNum { get; set; }

        /// <summary>
        /// HTTP Status Code. The default is 31. 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. NOTES: The 'HTTP' health check of the 'TCP' listener only supports specifying one health check
        /// status code. NOTES: Only supports listeners of 'HTTP' and 'HTTPS' protocol.
        /// </summary>
        [Input("healthCheckHttpCode")]
        public Input<int>? HealthCheckHttpCode { get; set; }

        /// <summary>
        /// Domain name of health check. NOTES: Only supports listeners of `HTTP` and `HTTPS` protocol.
        /// </summary>
        [Input("healthCheckHttpDomain")]
        public Input<string>? HealthCheckHttpDomain { get; set; }

        /// <summary>
        /// Methods of health check. NOTES: Only supports listeners of `HTTP` and `HTTPS` protocol. The default is `HEAD`, the
        /// available value are `HEAD` and `GET`.
        /// </summary>
        [Input("healthCheckHttpMethod")]
        public Input<string>? HealthCheckHttpMethod { get; set; }

        /// <summary>
        /// Path of health check. NOTES: Only supports listeners of `HTTP` and `HTTPS` protocol.
        /// </summary>
        [Input("healthCheckHttpPath")]
        public Input<string>? HealthCheckHttpPath { get; set; }

        /// <summary>
        /// Interval time of health check. Valid value ranges: (5~300) sec. and the default is `5` sec. NOTES: TCP/UDP/TCP_SSL
        /// listener allows direct configuration, HTTP/HTTPS listener needs to be configured in `tencentcloud_clb_listener_rule`.
        /// </summary>
        [Input("healthCheckIntervalTime")]
        public Input<int>? HealthCheckIntervalTime { get; set; }

        /// <summary>
        /// Indicates whether health check is enabled.
        /// </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]. NOTES: TCP/UDP/TCP_SSL listener allows direct
        /// configuration, HTTP/HTTPS listener needs to be configured in `tencentcloud_clb_listener_rule`.
        /// </summary>
        [Input("healthCheckUnhealthNum")]
        public Input<int>? HealthCheckUnhealthNum { get; set; }

        /// <summary>
        /// Indicate to apply HTTP2.0 protocol or not.
        /// </summary>
        [Input("http2Switch")]
        public Input<bool>? Http2Switch { get; set; }

        /// <summary>
        /// ID of CLB listener.
        /// </summary>
        [Input("listenerId", required: true)]
        public Input<string> ListenerId { get; set; } = null!;

        /// <summary>
        /// Scheduling method of the CLB listener rules. Valid values: `WRR`, `IP HASH`, `LEAST_CONN`. The default is `WRR`. NOTES:
        /// TCP/UDP/TCP_SSL listener allows direct configuration, HTTP/HTTPS listener needs to be configured in
        /// `tencentcloud_clb_listener_rule`.
        /// </summary>
        [Input("scheduler")]
        public Input<string>? Scheduler { get; set; }

        /// <summary>
        /// Time of session persistence within the CLB listener. NOTES: Available when scheduler is specified as `WRR`, and not
        /// available when listener protocol is `TCP_SSL`. NOTES: TCP/UDP/TCP_SSL listener allows direct configuration, HTTP/HTTPS
        /// listener needs to be configured in `tencentcloud_clb_listener_rule`.
        /// </summary>
        [Input("sessionExpireTime")]
        public Input<int>? SessionExpireTime { get; set; }

        /// <summary>
        /// Backend target type. Valid values: `NODE`, `TARGETGROUP`. `NODE` means to bind ordinary nodes, `TARGETGROUP` means to
        /// bind target group.
        /// </summary>
        [Input("targetType")]
        public Input<string>? TargetType { get; set; }

        /// <summary>
        /// Url of the listener rule.
        /// </summary>
        [Input("url", required: true)]
        public Input<string> Url { get; set; } = null!;

        public ListenerRuleArgs()
        {
        }
    }

    public sealed class ListenerRuleState : Pulumi.ResourceArgs
    {
        /// <summary>
        /// ID of the client certificate. NOTES: Only supports listeners of HTTPS protocol.
        /// </summary>
        [Input("certificateCaId")]
        public Input<string>? CertificateCaId { get; set; }

        /// <summary>
        /// ID of the server certificate. NOTES: Only supports listeners of HTTPS protocol.
        /// </summary>
        [Input("certificateId")]
        public Input<string>? CertificateId { get; set; }

        /// <summary>
        /// Type of certificate. Valid values: `UNIDIRECTIONAL`, `MUTUAL`. NOTES: Only supports listeners of HTTPS protocol.
        /// </summary>
        [Input("certificateSslMode")]
        public Input<string>? CertificateSslMode { get; set; }

        /// <summary>
        /// ID of CLB instance.
        /// </summary>
        [Input("clbId")]
        public Input<string>? ClbId { get; set; }

        /// <summary>
        /// Domain name of the listener rule.
        /// </summary>
        [Input("domain")]
        public Input<string>? Domain { get; set; }

        /// <summary>
        /// Forwarding protocol between the CLB instance and real server. Valid values: `HTTP`, `HTTPS`, `TRPC`.
        /// </summary>
        [Input("forwardType")]
        public Input<string>? ForwardType { 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]. NOTES: TCP/UDP/TCP_SSL listener
        /// allows direct configuration, HTTP/HTTPS listener needs to be configured in `tencentcloud_clb_listener_rule`.
        /// </summary>
        [Input("healthCheckHealthNum")]
        public Input<int>? HealthCheckHealthNum { get; set; }

        /// <summary>
        /// HTTP Status Code. The default is 31. 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. NOTES: The 'HTTP' health check of the 'TCP' listener only supports specifying one health check
        /// status code. NOTES: Only supports listeners of 'HTTP' and 'HTTPS' protocol.
        /// </summary>
        [Input("healthCheckHttpCode")]
        public Input<int>? HealthCheckHttpCode { get; set; }

        /// <summary>
        /// Domain name of health check. NOTES: Only supports listeners of `HTTP` and `HTTPS` protocol.
        /// </summary>
        [Input("healthCheckHttpDomain")]
        public Input<string>? HealthCheckHttpDomain { get; set; }

        /// <summary>
        /// Methods of health check. NOTES: Only supports listeners of `HTTP` and `HTTPS` protocol. The default is `HEAD`, the
        /// available value are `HEAD` and `GET`.
        /// </summary>
        [Input("healthCheckHttpMethod")]
        public Input<string>? HealthCheckHttpMethod { get; set; }

        /// <summary>
        /// Path of health check. NOTES: Only supports listeners of `HTTP` and `HTTPS` protocol.
        /// </summary>
        [Input("healthCheckHttpPath")]
        public Input<string>? HealthCheckHttpPath { get; set; }

        /// <summary>
        /// Interval time of health check. Valid value ranges: (5~300) sec. and the default is `5` sec. NOTES: TCP/UDP/TCP_SSL
        /// listener allows direct configuration, HTTP/HTTPS listener needs to be configured in `tencentcloud_clb_listener_rule`.
        /// </summary>
        [Input("healthCheckIntervalTime")]
        public Input<int>? HealthCheckIntervalTime { get; set; }

        /// <summary>
        /// Indicates whether health check is enabled.
        /// </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]. NOTES: TCP/UDP/TCP_SSL listener allows direct
        /// configuration, HTTP/HTTPS listener needs to be configured in `tencentcloud_clb_listener_rule`.
        /// </summary>
        [Input("healthCheckUnhealthNum")]
        public Input<int>? HealthCheckUnhealthNum { get; set; }

        /// <summary>
        /// Indicate to apply HTTP2.0 protocol or not.
        /// </summary>
        [Input("http2Switch")]
        public Input<bool>? Http2Switch { get; set; }

        /// <summary>
        /// ID of CLB listener.
        /// </summary>
        [Input("listenerId")]
        public Input<string>? ListenerId { get; set; }

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

        /// <summary>
        /// Scheduling method of the CLB listener rules. Valid values: `WRR`, `IP HASH`, `LEAST_CONN`. The default is `WRR`. NOTES:
        /// TCP/UDP/TCP_SSL listener allows direct configuration, HTTP/HTTPS listener needs to be configured in
        /// `tencentcloud_clb_listener_rule`.
        /// </summary>
        [Input("scheduler")]
        public Input<string>? Scheduler { get; set; }

        /// <summary>
        /// Time of session persistence within the CLB listener. NOTES: Available when scheduler is specified as `WRR`, and not
        /// available when listener protocol is `TCP_SSL`. NOTES: TCP/UDP/TCP_SSL listener allows direct configuration, HTTP/HTTPS
        /// listener needs to be configured in `tencentcloud_clb_listener_rule`.
        /// </summary>
        [Input("sessionExpireTime")]
        public Input<int>? SessionExpireTime { get; set; }

        /// <summary>
        /// Backend target type. Valid values: `NODE`, `TARGETGROUP`. `NODE` means to bind ordinary nodes, `TARGETGROUP` means to
        /// bind target group.
        /// </summary>
        [Input("targetType")]
        public Input<string>? TargetType { get; set; }

        /// <summary>
        /// Url of the listener rule.
        /// </summary>
        [Input("url")]
        public Input<string>? Url { get; set; }

        public ListenerRuleState()
        {
        }
    }
}
