use ipnet::IpNet;
use std::collections::HashMap;
use std::net::IpAddr;
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Network {
#[serde(rename = "dns_enabled")]
pub dns_enabled: bool,
#[serde(rename = "driver")]
pub driver: String,
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "internal")]
pub internal: bool,
#[serde(rename = "ipv6_enabled")]
pub ipv6_enabled: bool,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "network_interface")]
pub network_interface: Option<String>,
#[serde(rename = "options")]
pub options: Option<HashMap<String, String>>,
#[serde(rename = "ipam_options")]
pub ipam_options: Option<HashMap<String, String>>,
#[serde(rename = "subnets")]
pub subnets: Option<Vec<Subnet>>,
#[serde(rename = "routes")]
pub routes: Option<Vec<Route>>,
#[serde(rename = "network_dns_servers")]
pub network_dns_servers: Option<Vec<IpAddr>>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct NetworkOptions {
#[serde(rename = "container_id")]
pub container_id: String,
#[serde(rename = "container_name")]
pub container_name: String,
#[serde(rename = "networks")]
pub networks: HashMap<String, PerNetworkOptions>,
#[serde(rename = "network_info")]
pub network_info: HashMap<String, Network>,
#[serde(rename = "port_mappings")]
pub port_mappings: Option<Vec<PortMapping>>,
#[serde(rename = "dns_servers")]
pub dns_servers: Option<Vec<IpAddr>>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct PerNetworkOptions {
#[serde(rename = "aliases")]
pub aliases: Option<Vec<String>>,
#[serde(rename = "interface_name")]
pub interface_name: String,
#[serde(rename = "static_ips")]
pub static_ips: Option<Vec<IpAddr>>,
#[serde(rename = "static_mac")]
pub static_mac: Option<String>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct PortMapping {
#[serde(rename = "container_port")]
pub container_port: u16,
#[serde(rename = "host_ip")]
pub host_ip: String,
#[serde(rename = "host_port")]
pub host_port: u16,
#[serde(rename = "protocol")]
pub protocol: String,
#[serde(rename = "range")]
pub range: u16,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct StatusBlock {
#[serde(rename = "dns_search_domains")]
pub dns_search_domains: Option<Vec<String>>,
#[serde(rename = "dns_server_ips")]
pub dns_server_ips: Option<Vec<IpAddr>>,
#[serde(rename = "interfaces")]
pub interfaces: Option<HashMap<String, NetInterface>>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct NetInterface {
#[serde(rename = "mac_address")]
pub mac_address: String,
#[serde(rename = "subnets")]
pub subnets: Option<Vec<NetAddress>>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct NetAddress {
#[serde(rename = "gateway")]
pub gateway: Option<IpAddr>,
#[serde(rename = "ipnet")]
pub ipnet: IpNet,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Subnet {
#[serde(rename = "gateway")]
pub gateway: Option<IpAddr>,
#[serde(rename = "lease_range")]
pub lease_range: Option<LeaseRange>,
#[serde(rename = "subnet")]
pub subnet: IpNet,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Route {
#[serde(rename = "gateway")]
pub gateway: IpAddr,
#[serde(rename = "destination")]
pub destination: IpNet,
#[serde(rename = "metric")]
pub metric: Option<u32>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct LeaseRange {
#[serde(rename = "end_ip")]
pub end_ip: Option<String>,
#[serde(rename = "start_ip")]
pub start_ip: Option<String>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct NetworkPluginExec {
#[serde(rename = "container_id")]
pub container_id: String,
#[serde(rename = "container_name")]
pub container_name: String,
#[serde(rename = "port_mappings")]
pub port_mappings: Option<Vec<PortMapping>>,
pub network: Network,
pub network_options: PerNetworkOptions,
}