podman_autogen_api/models/
pod_spec_generator.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/// PodSpecGenerator : PodSpecGenerator describes options to create a pod
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct PodSpecGenerator {
17    /// Map of networks names to ids the container should join to. 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.
18    #[serde(rename = "Networks", skip_serializing_if = "Option::is_none")]
19    pub networks: Option<std::collections::HashMap<String, models::PerNetworkOptions>>,
20    /// CgroupParent is the parent for the Cgroup that the pod will create. This pod cgroup will, in turn, be the default cgroup parent for all containers in the pod. Optional.
21    #[serde(rename = "cgroup_parent", skip_serializing_if = "Option::is_none")]
22    pub cgroup_parent: 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    /// CPU period of the cpuset, determined by --cpus
27    #[serde(rename = "cpu_period", skip_serializing_if = "Option::is_none")]
28    pub cpu_period: Option<i32>,
29    /// CPU quota of the cpuset, determined by --cpus
30    #[serde(rename = "cpu_quota", skip_serializing_if = "Option::is_none")]
31    pub cpu_quota: Option<i64>,
32    /// DNSOption is a set of DNS options that will be used in the infra container's resolv.conf, which will, by default, be shared with all containers in the pod. Conflicts with NoInfra=true. Optional.
33    #[serde(rename = "dns_option", skip_serializing_if = "Option::is_none")]
34    pub dns_option: Option<Vec<String>>,
35    /// DNSSearch is a set of DNS search domains that will be used in the infra container's resolv.conf, which will, by default, be shared with all containers in the pod. If not provided, DNS search domains from the host's resolv.conf will be used. Conflicts with NoInfra=true. Optional.
36    #[serde(rename = "dns_search", skip_serializing_if = "Option::is_none")]
37    pub dns_search: Option<Vec<String>>,
38    /// DNSServer is a set of DNS servers that will be used in the infra container's resolv.conf, which will, by default, be shared with all containers in the pod. If not provided, the host's DNS servers will be used, unless the only server set is a localhost address. As the container cannot connect to the host's localhost, a default server will instead be set. Conflicts with NoInfra=true. Optional.
39    #[serde(rename = "dns_server", skip_serializing_if = "Option::is_none")]
40    pub dns_server: Option<Vec<String>>,
41    /// ExitPolicy determines the pod's exit and stop behaviour.
42    #[serde(rename = "exit_policy", skip_serializing_if = "Option::is_none")]
43    pub exit_policy: Option<String>,
44    /// HostAdd is a set of hosts that will be added to the infra container's etc/hosts that will, by default, be shared with all containers in the pod. Conflicts with NoInfra=true and NoManageHosts. Optional.
45    #[serde(rename = "hostadd", skip_serializing_if = "Option::is_none")]
46    pub hostadd: Option<Vec<String>>,
47    /// Hostname is the pod's hostname. If not set, the name of the pod will be used (if a name was not provided here, the name auto-generated for the pod will be used). This will be used by the infra container and all containers in the pod as long as the UTS namespace is shared. Optional.
48    #[serde(rename = "hostname", skip_serializing_if = "Option::is_none")]
49    pub hostname: Option<String>,
50    #[serde(rename = "idmappings", skip_serializing_if = "Option::is_none")]
51    pub idmappings: Option<Box<models::IdMappingOptions>>,
52    /// Image volumes bind-mount a container-image mount into the pod's infra container. Optional.
53    #[serde(rename = "image_volumes", skip_serializing_if = "Option::is_none")]
54    pub image_volumes: Option<Vec<models::ImageVolume>>,
55    /// InfraCommand sets the command that will be used to start the infra container. If not set, the default set in the Libpod configuration file will be used. Conflicts with NoInfra=true. Optional.
56    #[serde(rename = "infra_command", skip_serializing_if = "Option::is_none")]
57    pub infra_command: Option<Vec<String>>,
58    /// InfraConmonPidFile is a custom path to store the infra container's conmon PID.
59    #[serde(
60        rename = "infra_conmon_pid_file",
61        skip_serializing_if = "Option::is_none"
62    )]
63    pub infra_conmon_pid_file: Option<String>,
64    /// InfraImage is the image that will be used for the infra container. If not set, the default set in the Libpod configuration file will be used. Conflicts with NoInfra=true. Optional.
65    #[serde(rename = "infra_image", skip_serializing_if = "Option::is_none")]
66    pub infra_image: Option<String>,
67    /// InfraName is the name that will be used for the infra container. If not set, the default set in the Libpod configuration file will be used. Conflicts with NoInfra=true. Optional.
68    #[serde(rename = "infra_name", skip_serializing_if = "Option::is_none")]
69    pub infra_name: Option<String>,
70    #[serde(rename = "ipcns", skip_serializing_if = "Option::is_none")]
71    pub ipcns: Option<Box<models::Namespace>>,
72    /// Labels are key-value pairs that are used to add metadata to pods. Optional.
73    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
74    pub labels: Option<std::collections::HashMap<String, String>>,
75    /// Mounts are mounts that will be added to the pod. These will supersede Image Volumes and VolumesFrom volumes where there are conflicts. Optional.
76    #[serde(rename = "mounts", skip_serializing_if = "Option::is_none")]
77    pub mounts: Option<Vec<models::Mount>>,
78    /// Name is the name of the pod. If not provided, a name will be generated when the pod is created. Optional.
79    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
80    pub name: Option<String>,
81    #[serde(rename = "netns", skip_serializing_if = "Option::is_none")]
82    pub netns: Option<Box<models::Namespace>>,
83    /// NetworkOptions are additional options for each network Optional.
84    #[serde(rename = "network_options", skip_serializing_if = "Option::is_none")]
85    pub network_options: Option<std::collections::HashMap<String, Vec<String>>>,
86    /// NoInfra tells the pod not to create an infra container. If this is done, many networking-related options will become unavailable. Conflicts with setting any options in PodNetworkConfig, and the InfraCommand and InfraImages in this struct. Optional.
87    #[serde(rename = "no_infra", skip_serializing_if = "Option::is_none")]
88    pub no_infra: Option<bool>,
89    /// NoManageHosts indicates that /etc/hosts should not be managed by the pod. Instead, each container will create a separate /etc/hosts as they would if not in a pod. Conflicts with HostAdd.
90    #[serde(rename = "no_manage_hosts", skip_serializing_if = "Option::is_none")]
91    pub no_manage_hosts: Option<bool>,
92    /// NoManageResolvConf indicates that /etc/resolv.conf should not be managed by the pod. Instead, each container will create and manage a separate resolv.conf as if they had not joined a pod. Conflicts with NoInfra=true and DNSServer, DNSSearch, DNSOption. Optional.
93    #[serde(
94        rename = "no_manage_resolv_conf",
95        skip_serializing_if = "Option::is_none"
96    )]
97    pub no_manage_resolv_conf: Option<bool>,
98    /// Overlay volumes are named volumes that will be added to the pod. Optional.
99    #[serde(rename = "overlay_volumes", skip_serializing_if = "Option::is_none")]
100    pub overlay_volumes: Option<Vec<models::OverlayVolume>>,
101    #[serde(rename = "pidns", skip_serializing_if = "Option::is_none")]
102    pub pidns: Option<Box<models::Namespace>>,
103    #[serde(rename = "pod_create_command", skip_serializing_if = "Option::is_none")]
104    pub pod_create_command: Option<Vec<String>>,
105    /// Devices contains user specified Devices to be added to the Pod
106    #[serde(rename = "pod_devices", skip_serializing_if = "Option::is_none")]
107    pub pod_devices: Option<Vec<String>>,
108    /// PortMappings is a set of ports to map into the infra container. As, by default, containers share their network with the infra container, this will forward the ports to the entire pod. Only available if NetNS is set to Bridge, Slirp, or Pasta. Optional.
109    #[serde(rename = "portmappings", skip_serializing_if = "Option::is_none")]
110    pub portmappings: Option<Vec<models::PortMapping>>,
111    #[serde(rename = "resource_limits", skip_serializing_if = "Option::is_none")]
112    pub resource_limits: Option<Box<models::LinuxResources>>,
113    /// RestartPolicy is the pod's restart policy - an action which will be taken when one or all the containers in the pod exits. If not given, the default policy will be set to Always, which restarts the containers in the pod when they exit indefinitely. Optional.
114    #[serde(rename = "restart_policy", skip_serializing_if = "Option::is_none")]
115    pub restart_policy: Option<String>,
116    /// RestartRetries is the number of attempts that will be made to restart the container. Only available when RestartPolicy is set to \"on-failure\". Optional.
117    #[serde(rename = "restart_tries", skip_serializing_if = "Option::is_none")]
118    pub restart_tries: Option<i32>,
119    #[serde(rename = "security_opt", skip_serializing_if = "Option::is_none")]
120    pub security_opt: Option<Vec<String>>,
121    /// The ID of the pod's service container.
122    #[serde(rename = "serviceContainerID", skip_serializing_if = "Option::is_none")]
123    pub service_container_id: Option<String>,
124    /// PodCreateCommand is the command used to create this pod. This will be shown in the output of Inspect() on the pod, and may also be used by some tools that wish to recreate the pod (e.g. `podman generate systemd --new`). Optional. ShareParent determines if all containers in the pod will share the pod's cgroup as the cgroup parent
125    #[serde(rename = "share_parent", skip_serializing_if = "Option::is_none")]
126    pub share_parent: Option<bool>,
127    /// SharedNamespaces instructs the pod to share a set of namespaces. Shared namespaces will be joined (by default) by every container which joins the pod. If not set and NoInfra is false, the pod will set a default set of namespaces to share. Conflicts with NoInfra=true. Optional.
128    #[serde(rename = "shared_namespaces", skip_serializing_if = "Option::is_none")]
129    pub shared_namespaces: Option<Vec<String>>,
130    /// ShmSize is the size of the tmpfs to mount in at /dev/shm, in bytes. Conflicts with ShmSize if IpcNS is not private. Optional.
131    #[serde(rename = "shm_size", skip_serializing_if = "Option::is_none")]
132    pub shm_size: Option<i64>,
133    /// ShmSizeSystemd is the size of systemd-specific tmpfs mounts specifically /run, /run/lock, /var/log/journal and /tmp. Optional
134    #[serde(rename = "shm_size_systemd", skip_serializing_if = "Option::is_none")]
135    pub shm_size_systemd: Option<i64>,
136    /// Sysctl sets kernel parameters for the pod
137    #[serde(rename = "sysctl", skip_serializing_if = "Option::is_none")]
138    pub sysctl: Option<std::collections::HashMap<String, String>>,
139    /// ThrottleReadBpsDevice contains the rate at which the devices in the pod can be read from/accessed
140    #[serde(
141        rename = "throttleReadBpsDevice",
142        skip_serializing_if = "Option::is_none"
143    )]
144    pub throttle_read_bps_device:
145        Option<std::collections::HashMap<String, models::LinuxThrottleDevice>>,
146    #[serde(rename = "userns", skip_serializing_if = "Option::is_none")]
147    pub userns: Option<Box<models::Namespace>>,
148    #[serde(rename = "utsns", skip_serializing_if = "Option::is_none")]
149    pub utsns: Option<Box<models::Namespace>>,
150    /// Volumes are named volumes that will be added to the pod. These will supersede Image Volumes and VolumesFrom  volumes where there are conflicts. Optional.
151    #[serde(rename = "volumes", skip_serializing_if = "Option::is_none")]
152    pub volumes: Option<Vec<models::NamedVolume>>,
153    /// VolumesFrom is a set of containers whose volumes will be added to this pod. The name or ID of the container must be provided, and may optionally be followed by a : and then one or more comma-separated options. Valid options are 'ro', 'rw', and 'z'. Options will be used for all volumes sourced from the container.
154    #[serde(rename = "volumes_from", skip_serializing_if = "Option::is_none")]
155    pub volumes_from: Option<Vec<String>>,
156}
157
158impl PodSpecGenerator {
159    /// PodSpecGenerator describes options to create a pod
160    pub fn new() -> PodSpecGenerator {
161        PodSpecGenerator {
162            networks: None,
163            cgroup_parent: None,
164            cni_networks: None,
165            cpu_period: None,
166            cpu_quota: None,
167            dns_option: None,
168            dns_search: None,
169            dns_server: None,
170            exit_policy: None,
171            hostadd: None,
172            hostname: None,
173            idmappings: None,
174            image_volumes: None,
175            infra_command: None,
176            infra_conmon_pid_file: None,
177            infra_image: None,
178            infra_name: None,
179            ipcns: None,
180            labels: None,
181            mounts: None,
182            name: None,
183            netns: None,
184            network_options: None,
185            no_infra: None,
186            no_manage_hosts: None,
187            no_manage_resolv_conf: None,
188            overlay_volumes: None,
189            pidns: None,
190            pod_create_command: None,
191            pod_devices: None,
192            portmappings: None,
193            resource_limits: None,
194            restart_policy: None,
195            restart_tries: None,
196            security_opt: None,
197            service_container_id: None,
198            share_parent: None,
199            shared_namespaces: None,
200            shm_size: None,
201            shm_size_systemd: None,
202            sysctl: None,
203            throttle_read_bps_device: None,
204            userns: None,
205            utsns: None,
206            volumes: None,
207            volumes_from: None,
208        }
209    }
210}