1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
 * supports a RESTful API for the Libpod library
 *
 * 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
 *
 * The version of the OpenAPI document: 5.0.0
 * Contact: podman@lists.podman.io
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// ContainerStorageConfig : ContainerStorageConfig contains information on the storage configuration of a container.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ContainerStorageConfig {
    /// ChrootDirs is an additional set of directories that need to be treated as root directories. Standard bind mounts will be mounted into paths relative to these directories. Optional.
    #[serde(rename = "chroot_directories", skip_serializing_if = "Option::is_none")]
    pub chroot_directories: Option<Vec<String>>,
    /// Create the working directory if it doesn't exist. If unset, it doesn't create it. Optional.
    #[serde(rename = "create_working_dir", skip_serializing_if = "Option::is_none")]
    pub create_working_dir: Option<bool>,
    /// DeviceCgroupRule are device cgroup rules that allow containers to use additional types of devices.
    #[serde(rename = "device_cgroup_rule", skip_serializing_if = "Option::is_none")]
    pub device_cgroup_rule: Option<Vec<models::LinuxDeviceCgroup>>,
    /// Devices are devices that will be added to the container. Optional.
    #[serde(rename = "devices", skip_serializing_if = "Option::is_none")]
    pub devices: Option<Vec<models::LinuxDevice>>,
    /// DevicesFrom specifies that this container will mount the device(s) from other container(s). Optional.
    #[serde(rename = "devices_from", skip_serializing_if = "Option::is_none")]
    pub devices_from: Option<Vec<String>>,
    /// HostDeviceList is used to recreate the mounted device on inherited containers
    #[serde(rename = "host_device_list", skip_serializing_if = "Option::is_none")]
    pub host_device_list: Option<Vec<models::LinuxDevice>>,
    /// Image is the image the container will be based on. The image will be used as the container's root filesystem, and its environment vars, volumes, and other configuration will be applied to the container. Conflicts with Rootfs. At least one of Image or Rootfs must be specified.
    #[serde(rename = "image", skip_serializing_if = "Option::is_none")]
    pub image: Option<String>,
    /// ImageArch is the user-specified image architecture. Used to select a different variant from a manifest list. Optional.
    #[serde(rename = "image_arch", skip_serializing_if = "Option::is_none")]
    pub image_arch: Option<String>,
    /// ImageOS is the user-specified OS of the image. Used to select a different variant from a manifest list. Optional.
    #[serde(rename = "image_os", skip_serializing_if = "Option::is_none")]
    pub image_os: Option<String>,
    /// ImageVariant is the user-specified image variant. Used to select a different variant from a manifest list. Optional.
    #[serde(rename = "image_variant", skip_serializing_if = "Option::is_none")]
    pub image_variant: Option<String>,
    /// ImageVolumeMode indicates how image volumes will be created. Supported modes are \"ignore\" (do not create), \"tmpfs\" (create as tmpfs), and \"anonymous\" (create as anonymous volumes). The default if unset is anonymous. Optional.
    #[serde(rename = "image_volume_mode", skip_serializing_if = "Option::is_none")]
    pub image_volume_mode: Option<String>,
    /// Image volumes bind-mount a container-image mount into the container. Optional.
    #[serde(rename = "image_volumes", skip_serializing_if = "Option::is_none")]
    pub image_volumes: Option<Vec<models::ImageVolume>>,
    /// Init specifies that an init binary will be mounted into the container, and will be used as PID1. Optional.
    #[serde(rename = "init", skip_serializing_if = "Option::is_none")]
    pub init: Option<bool>,
    /// InitPath specifies the path to the init binary that will be added if Init is specified above. If not specified, the default set in the Libpod config will be used. Ignored if Init above is not set. Optional.
    #[serde(rename = "init_path", skip_serializing_if = "Option::is_none")]
    pub init_path: Option<String>,
    #[serde(rename = "ipcns", skip_serializing_if = "Option::is_none")]
    pub ipcns: Option<Box<models::Namespace>>,
    /// Mounts are mounts that will be added to the container. These will supersede Image Volumes and VolumesFrom volumes where there are conflicts. Optional.
    #[serde(rename = "mounts", skip_serializing_if = "Option::is_none")]
    pub mounts: Option<Vec<models::Mount>>,
    /// Overlay volumes are named volumes that will be added to the container. Optional.
    #[serde(rename = "overlay_volumes", skip_serializing_if = "Option::is_none")]
    pub overlay_volumes: Option<Vec<models::OverlayVolume>>,
    /// RawImageName is the user-specified and unprocessed input referring to a local or a remote image. Optional, but strongly encouraged to be set if Image is set.
    #[serde(rename = "raw_image_name", skip_serializing_if = "Option::is_none")]
    pub raw_image_name: Option<String>,
    /// Rootfs is the path to a directory that will be used as the container's root filesystem. No modification will be made to the directory, it will be directly mounted into the container as root. Conflicts with Image. At least one of Image or Rootfs must be specified.
    #[serde(rename = "rootfs", skip_serializing_if = "Option::is_none")]
    pub rootfs: Option<String>,
    /// RootfsMapping specifies if there are UID/GID mappings to apply to the rootfs. Optional.
    #[serde(rename = "rootfs_mapping", skip_serializing_if = "Option::is_none")]
    pub rootfs_mapping: Option<String>,
    /// RootfsOverlay tells if rootfs is actually an overlay on top of base path. Optional.
    #[serde(rename = "rootfs_overlay", skip_serializing_if = "Option::is_none")]
    pub rootfs_overlay: Option<bool>,
    /// RootfsPropagation is the rootfs propagation mode for the container. If not set, the default of rslave will be used. Optional.
    #[serde(rename = "rootfs_propagation", skip_serializing_if = "Option::is_none")]
    pub rootfs_propagation: Option<String>,
    /// Secrets are the secrets that will be added to the container Optional.
    #[serde(rename = "secrets", skip_serializing_if = "Option::is_none")]
    pub secrets: Option<Vec<models::Secret>>,
    /// ShmSize is the size of the tmpfs to mount in at /dev/shm, in bytes. Conflicts with ShmSize if IpcNS is not private. Optional.
    #[serde(rename = "shm_size", skip_serializing_if = "Option::is_none")]
    pub shm_size: Option<i64>,
    /// ShmSizeSystemd is the size of systemd-specific tmpfs mounts specifically /run, /run/lock, /var/log/journal and /tmp. Optional
    #[serde(rename = "shm_size_systemd", skip_serializing_if = "Option::is_none")]
    pub shm_size_systemd: Option<i64>,
    /// StorageOpts is the container's storage options Optional.
    #[serde(rename = "storage_opts", skip_serializing_if = "Option::is_none")]
    pub storage_opts: Option<std::collections::HashMap<String, String>>,
    /// Volatile specifies whether the container storage can be optimized at the cost of not syncing all the dirty files in memory. Optional.
    #[serde(rename = "volatile", skip_serializing_if = "Option::is_none")]
    pub volatile: Option<bool>,
    /// Volumes are named volumes that will be added to the container. These will supersede Image Volumes and VolumesFrom volumes where there are conflicts. Optional.
    #[serde(rename = "volumes", skip_serializing_if = "Option::is_none")]
    pub volumes: Option<Vec<models::NamedVolume>>,
    /// VolumesFrom is a set of containers whose volumes will be added to this container. 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. Optional.
    #[serde(rename = "volumes_from", skip_serializing_if = "Option::is_none")]
    pub volumes_from: Option<Vec<String>>,
    /// WorkDir is the container's working directory. If unset, the default, /, will be used. Optional.
    #[serde(rename = "work_dir", skip_serializing_if = "Option::is_none")]
    pub work_dir: Option<String>,
}

impl ContainerStorageConfig {
    /// ContainerStorageConfig contains information on the storage configuration of a container.
    pub fn new() -> ContainerStorageConfig {
        ContainerStorageConfig {
            chroot_directories: None,
            create_working_dir: None,
            device_cgroup_rule: None,
            devices: None,
            devices_from: None,
            host_device_list: None,
            image: None,
            image_arch: None,
            image_os: None,
            image_variant: None,
            image_volume_mode: None,
            image_volumes: None,
            init: None,
            init_path: None,
            ipcns: None,
            mounts: None,
            overlay_volumes: None,
            raw_image_name: None,
            rootfs: None,
            rootfs_mapping: None,
            rootfs_overlay: None,
            rootfs_propagation: None,
            secrets: None,
            shm_size: None,
            shm_size_systemd: None,
            storage_opts: None,
            volatile: None,
            volumes: None,
            volumes_from: None,
            work_dir: None,
        }
    }
}