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

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

/// ConsulTransparentProxy is used to configure the Envoy sidecar for
/// "transparent proxying", which creates IP tables rules inside the network
/// namespace to ensure traffic flows thru the Envoy proxy
///
/// This struct was generated based on the Go types of the official Nomad API.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Builder)]
pub struct ConsulTransparentProxy {
    /// OutboundPort is the Envoy proxy's outbound listener port. Inbound TCP
    /// traffic hitting the PROXY_IN_REDIRECT chain will be redirected here.
    /// Defaults to 15001.
    #[serde(rename = "outbound_port", skip_serializing_if = "Option::is_none")]
    pub outbound_port: Option<u16>,

    /// ExcludeInboundPorts is an additional set of ports will be excluded from
    /// redirection to the Envoy proxy. Can be Port.Label or Port.Value. This set
    /// will be added to the ports automatically excluded for the Expose.Port and
    /// Check.Expose fields.
    #[serde(
        rename = "exclude_inbound_ports",
        skip_serializing_if = "Option::is_none"
    )]
    pub exclude_inbound_ports: Option<Vec<String>>,

    /// ExcludeOutboundPorts is a set of outbound ports that will not be
    /// redirected to the Envoy proxy, specified as port numbers.
    #[serde(
        rename = "exclude_outbound_ports",
        skip_serializing_if = "Option::is_none"
    )]
    pub exclude_outbound_ports: Option<Vec<u16>>,

    /// ExcludeOutboundCIDRs is a set of outbound CIDR blocks that will not be
    /// redirected to the Envoy proxy.
    #[serde(
        rename = "exclude_outbound_cidrs",
        skip_serializing_if = "Option::is_none"
    )]
    pub exclude_outbound_cid_rs: Option<Vec<String>>,

    /// ExcludeUIDs is a set of user IDs whose network traffic will not be
    /// redirected through the Envoy proxy.
    #[serde(rename = "exclude_uids", skip_serializing_if = "Option::is_none")]
    pub exclude_ui_ds: Option<Vec<String>>,

    /// NoDNS disables redirection of DNS traffic to Consul DNS. By default NoDNS
    /// is false and transparent proxy will direct DNS traffic to Consul DNS if
    /// available on the client.
    #[serde(rename = "no_dns", skip_serializing_if = "Option::is_none")]
    pub no_dns: Option<bool>,

    /// UID of the Envoy proxy. Defaults to the default Envoy proxy container
    /// image user.
    #[serde(rename = "uid", skip_serializing_if = "Option::is_none")]
    pub uid: Option<String>,
}
