podman_rest_client/v5/models/spec_generator.rs
1use serde::{Deserialize, Serialize};
2#[derive(Default, Debug, Serialize, Deserialize)]
3/// SpecGenerator creates an OCI spec and Libpod configuration options to create
4/// a container based on the given configuration.
5pub struct SpecGenerator {
6    /// Map of networks names or ids that the container should join.
7    /// You can request additional settings for each network, you can
8    /// set network aliases, static ips, static mac address  and the
9    /// network interface name for this container on the specific network.
10    /// If the map is empty and the bridge network mode is set the container
11    /// will be joined to the default network.
12    /// Optional.
13    #[serde(rename = "Networks")]
14    pub networks: Option<std::collections::HashMap<String, crate::v5::models::PerNetworkOptions>>,
15    /// Annotations are key-value options passed into the container runtime
16    /// that can be used to trigger special behavior.
17    /// Optional.
18    pub annotations: Option<std::collections::HashMap<String, String>>,
19    /// ApparmorProfile is the name of the Apparmor profile the container
20    /// will use.
21    /// Optional.
22    pub apparmor_profile: Option<String>,
23    /// BaseHostsFile is the path to a hosts file, the entries from this file
24    /// are added to the containers hosts file. As special value "image" is
25    /// allowed which uses the /etc/hosts file from within the image and "none"
26    /// which uses no base file at all. If it is empty we should default
27    /// to the base_hosts_file configuration in containers.conf.
28    /// Optional.
29    pub base_hosts_file: Option<String>,
30    /// CapAdd are capabilities which will be added to the container.
31    /// Conflicts with Privileged.
32    /// Optional.
33    pub cap_add: Option<Vec<String>>,
34    /// CapDrop are capabilities which will be removed from the container.
35    /// Conflicts with Privileged.
36    /// Optional.
37    pub cap_drop: Option<Vec<String>>,
38    /// CgroupParent is the container's Cgroup parent.
39    /// If not set, the default for the current cgroup driver will be used.
40    /// Optional.
41    pub cgroup_parent: Option<String>,
42    pub cgroupns: Option<crate::v5::models::Namespace>,
43    /// CgroupsMode sets a policy for how cgroups will be created for the
44    /// container, including the ability to disable creation entirely.
45    /// Optional.
46    pub cgroups_mode: Option<String>,
47    /// ChrootDirs is an additional set of directories that need to be
48    /// treated as root directories. Standard bind mounts will be mounted
49    /// into paths relative to these directories.
50    /// Optional.
51    pub chroot_directories: Option<Vec<String>>,
52    /// CNINetworks is a list of CNI networks to join the container to.
53    /// If this list is empty, the default CNI network will be joined
54    /// instead. If at least one entry is present, we will not join the
55    /// default network (unless it is part of this list).
56    /// Only available if NetNS is set to bridge.
57    /// Optional.
58    /// Deprecated: as of podman 4.0 use "Networks" instead.
59    pub cni_networks: Option<Vec<String>>,
60    /// Command is the container's command.
61    /// If not given and Image is specified, this will be populated by the
62    /// image's configuration.
63    /// Optional.
64    pub command: Option<Vec<String>>,
65    /// ConmonPidFile is a path at which a PID file for Conmon will be
66    /// placed.
67    /// If not given, a default location will be used.
68    /// Optional.
69    pub conmon_pid_file: Option<String>,
70    /// ContainerCreateCommand is the command that was used to create this
71    /// container.
72    /// This will be shown in the output of Inspect() on the container, and
73    /// may also be used by some tools that wish to recreate the container
74    /// (e.g. `podman generate systemd --new`).
75    /// Optional.
76    #[serde(rename = "containerCreateCommand")]
77    pub container_create_command: Option<Vec<String>>,
78    /// Create the working directory if it doesn't exist.
79    /// If unset, it doesn't create it.
80    /// Optional.
81    pub create_working_dir: Option<bool>,
82    /// DependencyContainers is an array of containers this container
83    /// depends on. Dependency containers must be started before this
84    /// container. Dependencies can be specified by name or full/partial ID.
85    /// Optional.
86    #[serde(rename = "dependencyContainers")]
87    pub dependency_containers: Option<Vec<String>>,
88    /// DeviceCgroupRule are device cgroup rules that allow containers
89    /// to use additional types of devices.
90    pub device_cgroup_rule: Option<Vec<crate::v5::models::LinuxDeviceCgroup>>,
91    /// Devices are devices that will be added to the container.
92    /// Optional.
93    pub devices: Option<Vec<crate::v5::models::LinuxDevice>>,
94    /// DevicesFrom specifies that this container will mount the device(s) from other container(s).
95    /// Optional.
96    pub devices_from: Option<Vec<String>>,
97    /// DNSOptions is a set of DNS options that will be used in the
98    /// container's resolv.conf, replacing the host's DNS options which are
99    /// used by default.
100    /// Conflicts with UseImageResolvConf.
101    /// Optional.
102    pub dns_option: Option<Vec<String>>,
103    /// DNSSearch is a set of DNS search domains that will be used in the
104    /// container's resolv.conf, replacing the host's DNS search domains
105    /// which are used by default.
106    /// Conflicts with UseImageResolvConf.
107    /// Optional.
108    pub dns_search: Option<Vec<String>>,
109    /// DNSServers is a set of DNS servers that will be used in the
110    /// container's resolv.conf, replacing the host's DNS Servers which are
111    /// used by default.
112    /// Conflicts with UseImageResolvConf.
113    /// Optional.
114    pub dns_server: Option<Vec<String>>,
115    /// Entrypoint is the container's entrypoint.
116    /// If not given and Image is specified, this will be populated by the
117    /// image's configuration.
118    /// Optional.
119    pub entrypoint: Option<Vec<String>>,
120    /// Env is a set of environment variables that will be set in the
121    /// container.
122    /// Optional.
123    pub env: Option<std::collections::HashMap<String, String>>,
124    /// EnvHost indicates that the host environment should be added to container
125    /// Optional.
126    pub env_host: Option<bool>,
127    /// EnvMerge takes the specified environment variables from image and preprocess them before injecting them into the
128    /// container.
129    /// Optional.
130    pub envmerge: Option<Vec<String>>,
131    /// Expose is a number of ports that will be forwarded to the container
132    /// if PublishExposedPorts is set.
133    /// Expose is a map of uint16 (port number) to a string representing
134    /// protocol i.e map[uint16]string. Allowed protocols are "tcp", "udp", and "sctp", or some
135    /// combination of the three separated by commas.
136    /// If protocol is set to "" we will assume TCP.
137    /// Only available if NetNS is set to Bridge or Slirp, and
138    /// PublishExposedPorts is set.
139    /// Optional.
140    pub expose: Option<()>,
141    /// GroupEntry specifies an arbitrary string to append to the container's /etc/group file.
142    /// Optional.
143    pub group_entry: Option<String>,
144    /// Groups are a list of supplemental groups the container's user will
145    /// be granted access to.
146    /// Optional.
147    pub groups: Option<Vec<String>>,
148    pub health_check_on_failure_action: Option<i64>,
149    pub healthconfig: Option<crate::v5::models::Schema2HealthConfig>,
150    /// HostDeviceList is used to recreate the mounted device on inherited containers
151    pub host_device_list: Option<Vec<crate::v5::models::LinuxDevice>>,
152    /// HostAdd is a set of hosts which will be added to the container's
153    /// etc/hosts file.
154    /// Conflicts with UseImageHosts.
155    /// Optional.
156    pub hostadd: Option<Vec<String>>,
157    /// Hostname is the container's hostname. If not set, the hostname will
158    /// not be modified (if UtsNS is not private) or will be set to the
159    /// container ID (if UtsNS is private).
160    /// Conflicts with UtsNS if UtsNS is not set to private.
161    /// Optional.
162    pub hostname: Option<String>,
163    /// HostUsers is a list of host usernames or UIDs to add to the container
164    /// etc/passwd file
165    pub hostusers: Option<Vec<String>>,
166    /// EnvHTTPProxy indicates that the http host proxy environment variables
167    /// should be added to container
168    /// Optional.
169    pub httpproxy: Option<bool>,
170    pub idmappings: Option<crate::v5::models::IdMappingOptions>,
171    /// Image is the image the container will be based on. The image will be
172    /// used as the container's root filesystem, and its environment vars,
173    /// volumes, and other configuration will be applied to the container.
174    /// Conflicts with Rootfs.
175    /// At least one of Image or Rootfs must be specified.
176    pub image: Option<String>,
177    /// ImageArch is the user-specified image architecture.
178    /// Used to select a different variant from a manifest list.
179    /// Optional.
180    pub image_arch: Option<String>,
181    /// ImageOS is the user-specified OS of the image.
182    /// Used to select a different variant from a manifest list.
183    /// Optional.
184    pub image_os: Option<String>,
185    /// ImageVariant is the user-specified image variant.
186    /// Used to select a different variant from a manifest list.
187    /// Optional.
188    pub image_variant: Option<String>,
189    /// ImageVolumeMode indicates how image volumes will be created.
190    /// Supported modes are "ignore" (do not create), "tmpfs" (create as
191    /// tmpfs), and "anonymous" (create as anonymous volumes).
192    /// The default if unset is anonymous.
193    /// Optional.
194    pub image_volume_mode: Option<String>,
195    /// Image volumes bind-mount a container-image mount into the container.
196    /// Optional.
197    pub image_volumes: Option<Vec<crate::v5::models::ImageVolume>>,
198    /// Init specifies that an init binary will be mounted into the
199    /// container, and will be used as PID1.
200    /// Optional.
201    pub init: Option<bool>,
202    /// InitContainerType describes if this container is an init container
203    /// and if so, what type: always or once.
204    /// Optional.
205    pub init_container_type: Option<String>,
206    /// InitPath specifies the path to the init binary that will be added if
207    /// Init is specified above. If not specified, the default set in the
208    /// Libpod config will be used. Ignored if Init above is not set.
209    /// Optional.
210    pub init_path: Option<String>,
211    #[serde(rename = "intelRdt")]
212    pub intel_rdt: Option<crate::v5::models::LinuxIntelRdt>,
213    pub ipcns: Option<crate::v5::models::Namespace>,
214    /// LabelNested indicates whether or not the container is allowed to
215    /// run fully nested containers including SELinux labelling.
216    /// Optional.
217    pub label_nested: Option<bool>,
218    /// Labels are key-value pairs that are used to add metadata to
219    /// containers.
220    /// Optional.
221    pub labels: Option<std::collections::HashMap<String, String>>,
222    pub log_configuration: Option<crate::v5::models::LogConfigLibpod>,
223    /// Passwd is a container run option that determines if we are validating users/groups before running the container
224    pub manage_password: Option<bool>,
225    /// Mask is the path we want to mask in the container. This masks the paths
226    /// given in addition to the default list.
227    /// Optional
228    pub mask: Option<Vec<String>>,
229    /// Mounts are mounts that will be added to the container.
230    /// These will supersede Image Volumes and VolumesFrom volumes where
231    /// there are conflicts.
232    /// Optional.
233    pub mounts: Option<Vec<crate::v5::models::Mount>>,
234    /// Name is the name the container will be given.
235    /// If no name is provided, one will be randomly generated.
236    /// Optional.
237    pub name: Option<String>,
238    pub netns: Option<crate::v5::models::Namespace>,
239    /// NetworkOptions are additional options for each network
240    /// Optional.
241    pub network_options: Option<std::collections::HashMap<String, Vec<String>>>,
242    /// NoNewPrivileges is whether the container will set the no new
243    /// privileges flag on create, which disables gaining additional
244    /// privileges (e.g. via setuid) in the container.
245    /// Optional.
246    pub no_new_privileges: Option<bool>,
247    /// OCIRuntime is the name of the OCI runtime that will be used to create
248    /// the container.
249    /// If not specified, the default will be used.
250    /// Optional.
251    pub oci_runtime: Option<String>,
252    /// OOMScoreAdj adjusts the score used by the OOM killer to determine
253    /// processes to kill for the container's process.
254    /// Optional.
255    pub oom_score_adj: Option<i64>,
256    /// Overlay volumes are named volumes that will be added to the container.
257    /// Optional.
258    pub overlay_volumes: Option<Vec<crate::v5::models::OverlayVolume>>,
259    /// PasswdEntry specifies an arbitrary string to append to the container's /etc/passwd file.
260    /// Optional.
261    pub passwd_entry: Option<String>,
262    pub personality: Option<crate::v5::models::LinuxPersonality>,
263    pub pidns: Option<crate::v5::models::Namespace>,
264    /// Pod is the ID of the pod the container will join.
265    /// Optional.
266    pub pod: Option<String>,
267    /// PortBindings is a set of ports to map into the container.
268    /// Only available if NetNS is set to bridge, slirp, or pasta.
269    /// Optional.
270    pub portmappings: Option<Vec<crate::v5::models::PortMapping>>,
271    /// Privileged is whether the container is privileged.
272    /// Privileged does the following:
273    /// Adds all devices on the system to the container.
274    /// Adds all capabilities to the container.
275    /// Disables Seccomp, SELinux, and Apparmor confinement.
276    /// (Though SELinux can be manually re-enabled).
277    /// TODO: this conflicts with things.
278    /// TODO: this does more.
279    /// Optional.
280    pub privileged: Option<bool>,
281    /// ProcOpts are the options used for the proc mount.
282    pub procfs_opts: Option<Vec<String>>,
283    /// PublishExposedPorts will publish ports specified in the image to
284    /// random unused ports (guaranteed to be above 1024) on the host.
285    /// This is based on ports set in Expose below, and any ports specified
286    /// by the Image (if one is given).
287    /// Only available if NetNS is set to Bridge or Slirp.
288    /// Optional.
289    pub publish_image_ports: Option<bool>,
290    /// Rlimits are POSIX rlimits to apply to the container.
291    /// Optional.
292    pub r_limits: Option<Vec<crate::v5::models::PosixRlimit>>,
293    /// RawImageName is the user-specified and unprocessed input referring
294    /// to a local or a remote image.
295    /// Optional, but strongly encouraged to be set if Image is set.
296    pub raw_image_name: Option<String>,
297    /// ReadOnlyFilesystem indicates that everything will be mounted
298    /// as read-only.
299    /// Optional.
300    pub read_only_filesystem: Option<bool>,
301    /// ReadWriteTmpfs indicates that when running with a ReadOnlyFilesystem
302    /// mount temporary file systems.
303    /// Optional.
304    pub read_write_tmpfs: Option<bool>,
305    /// Remove indicates if the container should be removed once it has been started
306    /// and exits.
307    /// Optional.
308    pub remove: Option<bool>,
309    pub resource_limits: Option<crate::v5::models::LinuxResources>,
310    /// RestartPolicy is the container's restart policy - an action which
311    /// will be taken when the container exits.
312    /// If not given, the default policy, which does nothing, will be used.
313    /// Optional.
314    pub restart_policy: Option<String>,
315    /// RestartRetries is the number of attempts that will be made to restart
316    /// the container.
317    /// Only available when RestartPolicy is set to "on-failure".
318    /// Optional.
319    pub restart_tries: Option<u64>,
320    /// Rootfs is the path to a directory that will be used as the
321    /// container's root filesystem. No modification will be made to the
322    /// directory, it will be directly mounted into the container as root.
323    /// Conflicts with Image.
324    /// At least one of Image or Rootfs must be specified.
325    pub rootfs: Option<String>,
326    /// RootfsMapping specifies if there are UID/GID mappings to apply to the rootfs.
327    /// Optional.
328    pub rootfs_mapping: Option<String>,
329    /// RootfsOverlay tells if rootfs is actually an overlay on top of base path.
330    /// Optional.
331    pub rootfs_overlay: Option<bool>,
332    /// RootfsPropagation is the rootfs propagation mode for the container.
333    /// If not set, the default of rslave will be used.
334    /// Optional.
335    pub rootfs_propagation: Option<String>,
336    /// Determine how to handle the NOTIFY_SOCKET - do we participate or pass it through
337    /// "container" - let the OCI runtime deal with it, advertise conmon's MAINPID
338    /// "conmon-only" - advertise conmon's MAINPID, send READY when started, don't pass to OCI
339    /// "ignore" - unset NOTIFY_SOCKET
340    /// Optional.
341    #[serde(rename = "sdnotifyMode")]
342    pub sdnotify_mode: Option<String>,
343    /// SeccompPolicy determines which seccomp profile gets applied
344    /// the container. valid values: empty,default,image
345    pub seccomp_policy: Option<String>,
346    /// SeccompProfilePath is the path to a JSON file containing the
347    /// container's Seccomp profile.
348    /// If not specified, no Seccomp profile will be used.
349    /// Optional.
350    pub seccomp_profile_path: Option<String>,
351    /// EnvSecrets are secrets that will be set as environment variables
352    /// Optional.
353    pub secret_env: Option<std::collections::HashMap<String, String>>,
354    /// Secrets are the secrets that will be added to the container
355    /// Optional.
356    pub secrets: Option<Vec<crate::v5::models::Secret>>,
357    /// SelinuxProcessLabel is the process label the container will use.
358    /// If SELinux is enabled and this is not specified, a label will be
359    /// automatically generated if not specified.
360    /// Optional.
361    pub selinux_opts: Option<Vec<String>>,
362    /// ShmSize is the size of the tmpfs to mount in at /dev/shm, in bytes.
363    /// Conflicts with ShmSize if IpcNS is not private.
364    /// Optional.
365    pub shm_size: Option<i64>,
366    /// ShmSizeSystemd is the size of systemd-specific tmpfs mounts
367    /// specifically /run, /run/lock, /var/log/journal and /tmp.
368    /// Optional
369    pub shm_size_systemd: Option<i64>,
370    #[serde(rename = "startupHealthConfig")]
371    pub startup_health_config: Option<crate::v5::models::StartupHealthCheck>,
372    /// Stdin is whether the container will keep its STDIN open.
373    /// Optional.
374    pub stdin: Option<bool>,
375    pub stop_signal: Option<i64>,
376    /// StopTimeout is a timeout between the container's stop signal being
377    /// sent and SIGKILL being sent.
378    /// If not provided, the default will be used.
379    /// If 0 is used, stop signal will not be sent, and SIGKILL will be sent
380    /// instead.
381    /// Optional.
382    pub stop_timeout: Option<u64>,
383    /// StorageOpts is the container's storage options
384    /// Optional.
385    pub storage_opts: Option<std::collections::HashMap<String, String>>,
386    /// Sysctl sets kernel parameters for the container
387    pub sysctl: Option<std::collections::HashMap<String, String>>,
388    /// Systemd is whether the container will be started in systemd mode.
389    /// Valid options are "true", "false", and "always".
390    /// "true" enables this mode only if the binary run in the container is
391    /// sbin/init or systemd. "always" unconditionally enables systemd mode.
392    /// "false" unconditionally disables systemd mode.
393    /// If enabled, mounts and stop signal will be modified.
394    /// If set to "always" or set to "true" and conditionally triggered,
395    /// conflicts with StopSignal.
396    /// If not specified, "false" will be assumed.
397    /// Optional.
398    pub systemd: Option<String>,
399    /// Terminal is whether the container will create a PTY.
400    /// Optional.
401    pub terminal: Option<bool>,
402    /// IO read rate limit per cgroup per device, bytes per second
403    #[serde(rename = "throttleReadBpsDevice")]
404    pub throttle_read_bps_device:
405        Option<std::collections::HashMap<String, crate::v5::models::LinuxThrottleDevice>>,
406    /// IO read rate limit per cgroup per device, IO per second
407    #[serde(rename = "throttleReadIOPSDevice")]
408    pub throttle_read_iops_device:
409        Option<std::collections::HashMap<String, crate::v5::models::LinuxThrottleDevice>>,
410    /// IO write rate limit per cgroup per device, bytes per second
411    #[serde(rename = "throttleWriteBpsDevice")]
412    pub throttle_write_bps_device:
413        Option<std::collections::HashMap<String, crate::v5::models::LinuxThrottleDevice>>,
414    /// IO write rate limit per cgroup per device, IO per second
415    #[serde(rename = "throttleWriteIOPSDevice")]
416    pub throttle_write_iops_device:
417        Option<std::collections::HashMap<String, crate::v5::models::LinuxThrottleDevice>>,
418    /// Timeout is a maximum time in seconds the container will run before
419    /// main process is sent SIGKILL.
420    /// If 0 is used, signal will not be sent. Container can run indefinitely
421    /// if they do not stop after the default termination signal.
422    /// Optional.
423    pub timeout: Option<u64>,
424    /// Timezone is the timezone inside the container.
425    /// Local means it has the same timezone as the host machine
426    /// Optional.
427    pub timezone: Option<String>,
428    /// Umask is the umask the init process of the container will be run with.
429    pub umask: Option<String>,
430    /// CgroupConf are key-value options passed into the container runtime
431    /// that are used to configure cgroup v2.
432    /// Optional.
433    pub unified: Option<std::collections::HashMap<String, String>>,
434    /// Unmask a path in the container. Some paths are masked by default,
435    /// preventing them from being accessed within the container; this undoes
436    /// that masking. If ALL is passed, all paths will be unmasked.
437    /// Optional.
438    pub unmask: Option<Vec<String>>,
439    /// UnsetEnv unsets the specified default environment variables from the image or from buildin or containers.conf
440    /// Optional.
441    pub unsetenv: Option<Vec<String>>,
442    /// UnsetEnvAll unsetall default environment variables from the image or from buildin or containers.conf
443    /// UnsetEnvAll unsets all default environment variables from the image or from buildin
444    /// Optional.
445    pub unsetenvall: Option<bool>,
446    /// UseImageHosts indicates that /etc/hosts should not be managed by
447    /// Podman, and instead sourced from the image.
448    /// Conflicts with HostAdd.
449    /// Optional.
450    pub use_image_hosts: Option<bool>,
451    /// UseImageResolvConf indicates that resolv.conf should not be managed
452    /// by Podman, but instead sourced from the image.
453    /// Conflicts with DNSServer, DNSSearch, DNSOption.
454    /// Optional.
455    pub use_image_resolve_conf: Option<bool>,
456    /// User is the user the container will be run as.
457    /// Can be given as a UID or a username; if a username, it will be
458    /// resolved within the container, using the container's /etc/passwd.
459    /// If unset, the container will be run as root.
460    /// Optional.
461    pub user: Option<String>,
462    pub userns: Option<crate::v5::models::Namespace>,
463    pub utsns: Option<crate::v5::models::Namespace>,
464    /// Volatile specifies whether the container storage can be optimized
465    /// at the cost of not syncing all the dirty files in memory.
466    /// Optional.
467    pub volatile: Option<bool>,
468    /// Volumes are named volumes that will be added to the container.
469    /// These will supersede Image Volumes and VolumesFrom volumes where
470    /// there are conflicts.
471    /// Optional.
472    pub volumes: Option<Vec<crate::v5::models::NamedVolume>>,
473    /// VolumesFrom is a set of containers whose volumes will be added to
474    /// this container. The name or ID of the container must be provided, and
475    /// may optionally be followed by a : and then one or more
476    /// comma-separated options. Valid options are 'ro', 'rw', and 'z'.
477    /// Options will be used for all volumes sourced from the container.
478    /// Optional.
479    pub volumes_from: Option<Vec<String>>,
480    /// Weight per cgroup per device, can override BlkioWeight
481    #[serde(rename = "weightDevice")]
482    pub weight_device:
483        Option<std::collections::HashMap<String, crate::v5::models::LinuxWeightDevice>>,
484    /// WorkDir is the container's working directory.
485    /// If unset, the default, /, will be used.
486    /// Optional.
487    pub work_dir: Option<String>,
488}