podman_autogen_api/models/
container_network_config.rs

1/*
2 * supports a RESTful API for the Libpod library
3 *
4 * This documentation describes the Podman v2.x+ RESTful API. It consists of a Docker-compatible API and a Libpod API providing support for Podman’s unique features such as pods.  To start the service and keep it running for 5,000 seconds (-t 0 runs forever):  podman system service -t 5000 &  You can then use cURL on the socket using requests documented below.  NOTE: if you install the package podman-docker, it will create a symbolic link for /run/docker.sock to /run/podman/podman.sock  NOTE: Some fields in the API response JSON are encoded as omitempty, which means that if said field has a zero value, they will not be encoded in the API response. This is a feature to help reduce the size of the JSON responses returned via the API.  NOTE: Due to the limitations of [go-swagger](https://github.com/go-swagger/go-swagger), some field values that have a complex type show up as null in the docs as well as in the API responses. This is because the zero value for the field type is null. The field description in the docs will state what type the field is expected to be for such cases.  See podman-system-service(1) for more information.  Quick Examples:  'podman info'  curl --unix-socket /run/podman/podman.sock http://d/v5.0.0/libpod/info  'podman pull quay.io/containers/podman'  curl -XPOST --unix-socket /run/podman/podman.sock -v 'http://d/v5.0.0/images/create?fromImage=quay.io%2Fcontainers%2Fpodman'  'podman list images'  curl --unix-socket /run/podman/podman.sock -v 'http://d/v5.0.0/libpod/images/json' | jq
5 *
6 * The version of the OpenAPI document: 5.0.0
7 * Contact: podman@lists.podman.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// ContainerNetworkConfig : ContainerNetworkConfig contains information on a container's network configuration.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ContainerNetworkConfig {
17    /// Map of networks names or ids that the container should join. You can request additional settings for each network, you can set network aliases, static ips, static mac address  and the network interface name for this container on the specific network. If the map is empty and the bridge network mode is set the container will be joined to the default network. Optional.
18    #[serde(rename = "Networks", skip_serializing_if = "Option::is_none")]
19    pub networks: Option<std::collections::HashMap<String, models::PerNetworkOptions>>,
20    /// BaseHostsFile is the path to a hosts file, the entries from this file are added to the containers hosts file. As special value \"image\" is allowed which uses the /etc/hosts file from within the image and \"none\" which uses no base file at all. If it is empty we should default to the base_hosts_file configuration in containers.conf. Optional.
21    #[serde(rename = "base_hosts_file", skip_serializing_if = "Option::is_none")]
22    pub base_hosts_file: Option<String>,
23    /// CNINetworks is a list of CNI networks to join the container to. If this list is empty, the default CNI network will be joined instead. If at least one entry is present, we will not join the default network (unless it is part of this list). Only available if NetNS is set to bridge. Optional. Deprecated: as of podman 4.0 use \"Networks\" instead.
24    #[serde(rename = "cni_networks", skip_serializing_if = "Option::is_none")]
25    pub cni_networks: Option<Vec<String>>,
26    /// DNSOptions is a set of DNS options that will be used in the container's resolv.conf, replacing the host's DNS options which are used by default. Conflicts with UseImageResolvConf. Optional.
27    #[serde(rename = "dns_option", skip_serializing_if = "Option::is_none")]
28    pub dns_option: Option<Vec<String>>,
29    /// DNSSearch is a set of DNS search domains that will be used in the container's resolv.conf, replacing the host's DNS search domains which are used by default. Conflicts with UseImageResolvConf. Optional.
30    #[serde(rename = "dns_search", skip_serializing_if = "Option::is_none")]
31    pub dns_search: Option<Vec<String>>,
32    /// DNSServers is a set of DNS servers that will be used in the container's resolv.conf, replacing the host's DNS Servers which are used by default. Conflicts with UseImageResolvConf. Optional.
33    #[serde(rename = "dns_server", skip_serializing_if = "Option::is_none")]
34    pub dns_server: Option<Vec<String>>,
35    /// Expose is a number of ports that will be forwarded to the container if PublishExposedPorts is set. Expose is a map of uint16 (port number) to a string representing protocol i.e map[uint16]string. Allowed protocols are \"tcp\", \"udp\", and \"sctp\", or some combination of the three separated by commas. If protocol is set to \"\" we will assume TCP. Only available if NetNS is set to Bridge or Slirp, and PublishExposedPorts is set. Optional.
36    #[serde(rename = "expose", skip_serializing_if = "Option::is_none")]
37    pub expose: Option<serde_json::Value>,
38    /// HostAdd is a set of hosts which will be added to the container's etc/hosts file. Conflicts with UseImageHosts. Optional.
39    #[serde(rename = "hostadd", skip_serializing_if = "Option::is_none")]
40    pub hostadd: Option<Vec<String>>,
41    #[serde(rename = "netns", skip_serializing_if = "Option::is_none")]
42    pub netns: Option<Box<models::Namespace>>,
43    /// NetworkOptions are additional options for each network Optional.
44    #[serde(rename = "network_options", skip_serializing_if = "Option::is_none")]
45    pub network_options: Option<std::collections::HashMap<String, Vec<String>>>,
46    /// PortBindings is a set of ports to map into the container. Only available if NetNS is set to bridge, slirp, or pasta. Optional.
47    #[serde(rename = "portmappings", skip_serializing_if = "Option::is_none")]
48    pub portmappings: Option<Vec<models::PortMapping>>,
49    /// PublishExposedPorts will publish ports specified in the image to random unused ports (guaranteed to be above 1024) on the host. This is based on ports set in Expose below, and any ports specified by the Image (if one is given). Only available if NetNS is set to Bridge or Slirp. Optional.
50    #[serde(
51        rename = "publish_image_ports",
52        skip_serializing_if = "Option::is_none"
53    )]
54    pub publish_image_ports: Option<bool>,
55    /// UseImageHosts indicates that /etc/hosts should not be managed by Podman, and instead sourced from the image. Conflicts with HostAdd. Optional.
56    #[serde(rename = "use_image_hosts", skip_serializing_if = "Option::is_none")]
57    pub use_image_hosts: Option<bool>,
58    /// UseImageResolvConf indicates that resolv.conf should not be managed by Podman, but instead sourced from the image. Conflicts with DNSServer, DNSSearch, DNSOption. Optional.
59    #[serde(
60        rename = "use_image_resolve_conf",
61        skip_serializing_if = "Option::is_none"
62    )]
63    pub use_image_resolve_conf: Option<bool>,
64}
65
66impl ContainerNetworkConfig {
67    /// ContainerNetworkConfig contains information on a container's network configuration.
68    pub fn new() -> ContainerNetworkConfig {
69        ContainerNetworkConfig {
70            networks: None,
71            base_hosts_file: None,
72            cni_networks: None,
73            dns_option: None,
74            dns_search: None,
75            dns_server: None,
76            expose: None,
77            hostadd: None,
78            netns: None,
79            network_options: None,
80            portmappings: None,
81            publish_image_ports: None,
82            use_image_hosts: None,
83            use_image_resolve_conf: None,
84        }
85    }
86}