/*
 * This is an auto-generated file.
 * Any manual changes may be overwritten without notice!
 */

use derive_builder::Builder;
use serde::{Deserialize, Serialize};

/// ConsulIngressService is used to configure a service fronted by the ingress
/// gateway. For more details, consult the Consul documentation:
/// https://developer.hashicorp.com/consul/docs/connect/config-entries/ingress-gateway
///
/// This struct was generated based on the Go types of the official Nomad API.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Builder)]
pub struct ConsulIngressService {
    /// ResponseHeader specifies a set of HTTP-specific header modification rules
    /// applied to responses routed through the gateway
    #[serde(rename = "response_headers", skip_serializing_if = "Option::is_none")]
    pub response_headers: Option<super::ConsulHttpHeaderModifiers>,

    /// MaxConnections specifies the maximum number of HTTP/1.1 connections a
    /// service instance is allowed to establish against the upstream
    #[serde(rename = "max_connections", skip_serializing_if = "Option::is_none")]
    pub max_connections: Option<u32>,

    /// MaxPendingRequests specifies the maximum number of requests that are
    /// allowed to queue while waiting to establish a connection
    #[serde(
        rename = "max_pending_requests",
        skip_serializing_if = "Option::is_none"
    )]
    pub max_pending_requests: Option<u32>,

    /// MaxConcurrentRequests specifies the maximum number of concurrent HTTP/2
    /// traffic requests that are allowed at a single point in time
    #[serde(
        rename = "max_concurrent_requests",
        skip_serializing_if = "Option::is_none"
    )]
    pub max_concurrent_requests: Option<u32>,

    /// Name of the service exposed through this listener.
    #[serde(rename = "Name")]
    pub name: String,

    /// Hosts specifies one or more hosts that the listening services can receive
    /// requests on.
    #[serde(
        rename = "Hosts",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub hosts: Vec<String>,

    /// TLS specifies a TLS configuration override for a specific service. If
    /// unset this will fallback to the ConsulIngressConfigEntry's own TLS field.
    #[serde(rename = "tls", skip_serializing_if = "Option::is_none")]
    pub tls: Option<super::ConsulGatewayTlsConfig>,

    /// RequestHeaders specifies a set of HTTP-specific header modification rules
    /// applied to requests routed through the gateway
    #[serde(rename = "request_headers", skip_serializing_if = "Option::is_none")]
    pub request_headers: Option<super::ConsulHttpHeaderModifiers>,
}
