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

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

/// ConsulProxy represents a Consul Connect sidecar proxy jobspec block.
///
/// This struct was generated based on the Go types of the official Nomad API.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Builder)]
pub struct ConsulProxy {
    #[serde(
        rename = "local_service_address",
        skip_serializing_if = "Option::is_none"
    )]
    pub local_service_address: Option<String>,

    #[serde(rename = "local_service_port", skip_serializing_if = "Option::is_none")]
    pub local_service_port: Option<i64>,

    #[serde(rename = "expose", skip_serializing_if = "Option::is_none")]
    pub expose: Option<super::ConsulExposeConfig>,

    #[serde(rename = "ExposeConfig", skip_serializing_if = "Option::is_none")]
    pub expose_config: Option<super::ConsulExposeConfig>,

    #[serde(
        rename = "Upstreams",
        deserialize_with = "crate::deserialize_null_as_default"
    )]
    pub upstreams: Vec<super::ConsulUpstream>,

    /// TransparentProxy configures the Envoy sidecar to use "transparent
    /// proxying", which creates IP tables rules inside the network namespace to
    /// ensure traffic flows thru the Envoy proxy
    #[serde(rename = "transparent_proxy", skip_serializing_if = "Option::is_none")]
    pub transparent_proxy: Option<super::ConsulTransparentProxy>,

    #[serde(rename = "Config")]
    pub config: std::collections::HashMap<String, serde_json::Value>,
}
