1#[derive(Clone, Debug, Default, PartialEq)]
5pub struct Volume {
6 pub aws_elastic_block_store: Option<crate::api::core::v1::AWSElasticBlockStoreVolumeSource>,
8
9 pub azure_disk: Option<crate::api::core::v1::AzureDiskVolumeSource>,
11
12 pub azure_file: Option<crate::api::core::v1::AzureFileVolumeSource>,
14
15 pub cephfs: Option<crate::api::core::v1::CephFSVolumeSource>,
17
18 pub cinder: Option<crate::api::core::v1::CinderVolumeSource>,
20
21 pub config_map: Option<crate::api::core::v1::ConfigMapVolumeSource>,
23
24 pub csi: Option<crate::api::core::v1::CSIVolumeSource>,
26
27 pub downward_api: Option<crate::api::core::v1::DownwardAPIVolumeSource>,
29
30 pub empty_dir: Option<crate::api::core::v1::EmptyDirVolumeSource>,
32
33 pub ephemeral: Option<crate::api::core::v1::EphemeralVolumeSource>,
48
49 pub fc: Option<crate::api::core::v1::FCVolumeSource>,
51
52 pub flex_volume: Option<crate::api::core::v1::FlexVolumeSource>,
54
55 pub flocker: Option<crate::api::core::v1::FlockerVolumeSource>,
57
58 pub gce_persistent_disk: Option<crate::api::core::v1::GCEPersistentDiskVolumeSource>,
60
61 pub git_repo: Option<crate::api::core::v1::GitRepoVolumeSource>,
63
64 pub glusterfs: Option<crate::api::core::v1::GlusterfsVolumeSource>,
66
67 pub host_path: Option<crate::api::core::v1::HostPathVolumeSource>,
69
70 pub image: Option<crate::api::core::v1::ImageVolumeSource>,
76
77 pub iscsi: Option<crate::api::core::v1::ISCSIVolumeSource>,
79
80 pub name: String,
82
83 pub nfs: Option<crate::api::core::v1::NFSVolumeSource>,
85
86 pub persistent_volume_claim: Option<crate::api::core::v1::PersistentVolumeClaimVolumeSource>,
88
89 pub photon_persistent_disk: Option<crate::api::core::v1::PhotonPersistentDiskVolumeSource>,
91
92 pub portworx_volume: Option<crate::api::core::v1::PortworxVolumeSource>,
94
95 pub projected: Option<crate::api::core::v1::ProjectedVolumeSource>,
97
98 pub quobyte: Option<crate::api::core::v1::QuobyteVolumeSource>,
100
101 pub rbd: Option<crate::api::core::v1::RBDVolumeSource>,
103
104 pub scale_io: Option<crate::api::core::v1::ScaleIOVolumeSource>,
106
107 pub secret: Option<crate::api::core::v1::SecretVolumeSource>,
109
110 pub storageos: Option<crate::api::core::v1::StorageOSVolumeSource>,
112
113 pub vsphere_volume: Option<crate::api::core::v1::VsphereVirtualDiskVolumeSource>,
115}
116
117impl crate::DeepMerge for Volume {
118 fn merge_from(&mut self, other: Self) {
119 crate::DeepMerge::merge_from(&mut self.aws_elastic_block_store, other.aws_elastic_block_store);
120 crate::DeepMerge::merge_from(&mut self.azure_disk, other.azure_disk);
121 crate::DeepMerge::merge_from(&mut self.azure_file, other.azure_file);
122 crate::DeepMerge::merge_from(&mut self.cephfs, other.cephfs);
123 crate::DeepMerge::merge_from(&mut self.cinder, other.cinder);
124 crate::DeepMerge::merge_from(&mut self.config_map, other.config_map);
125 crate::DeepMerge::merge_from(&mut self.csi, other.csi);
126 crate::DeepMerge::merge_from(&mut self.downward_api, other.downward_api);
127 crate::DeepMerge::merge_from(&mut self.empty_dir, other.empty_dir);
128 crate::DeepMerge::merge_from(&mut self.ephemeral, other.ephemeral);
129 crate::DeepMerge::merge_from(&mut self.fc, other.fc);
130 crate::DeepMerge::merge_from(&mut self.flex_volume, other.flex_volume);
131 crate::DeepMerge::merge_from(&mut self.flocker, other.flocker);
132 crate::DeepMerge::merge_from(&mut self.gce_persistent_disk, other.gce_persistent_disk);
133 crate::DeepMerge::merge_from(&mut self.git_repo, other.git_repo);
134 crate::DeepMerge::merge_from(&mut self.glusterfs, other.glusterfs);
135 crate::DeepMerge::merge_from(&mut self.host_path, other.host_path);
136 crate::DeepMerge::merge_from(&mut self.image, other.image);
137 crate::DeepMerge::merge_from(&mut self.iscsi, other.iscsi);
138 crate::DeepMerge::merge_from(&mut self.name, other.name);
139 crate::DeepMerge::merge_from(&mut self.nfs, other.nfs);
140 crate::DeepMerge::merge_from(&mut self.persistent_volume_claim, other.persistent_volume_claim);
141 crate::DeepMerge::merge_from(&mut self.photon_persistent_disk, other.photon_persistent_disk);
142 crate::DeepMerge::merge_from(&mut self.portworx_volume, other.portworx_volume);
143 crate::DeepMerge::merge_from(&mut self.projected, other.projected);
144 crate::DeepMerge::merge_from(&mut self.quobyte, other.quobyte);
145 crate::DeepMerge::merge_from(&mut self.rbd, other.rbd);
146 crate::DeepMerge::merge_from(&mut self.scale_io, other.scale_io);
147 crate::DeepMerge::merge_from(&mut self.secret, other.secret);
148 crate::DeepMerge::merge_from(&mut self.storageos, other.storageos);
149 crate::DeepMerge::merge_from(&mut self.vsphere_volume, other.vsphere_volume);
150 }
151}
152
153impl<'de> crate::serde::Deserialize<'de> for Volume {
154 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
155 #[allow(non_camel_case_types)]
156 enum Field {
157 Key_aws_elastic_block_store,
158 Key_azure_disk,
159 Key_azure_file,
160 Key_cephfs,
161 Key_cinder,
162 Key_config_map,
163 Key_csi,
164 Key_downward_api,
165 Key_empty_dir,
166 Key_ephemeral,
167 Key_fc,
168 Key_flex_volume,
169 Key_flocker,
170 Key_gce_persistent_disk,
171 Key_git_repo,
172 Key_glusterfs,
173 Key_host_path,
174 Key_image,
175 Key_iscsi,
176 Key_name,
177 Key_nfs,
178 Key_persistent_volume_claim,
179 Key_photon_persistent_disk,
180 Key_portworx_volume,
181 Key_projected,
182 Key_quobyte,
183 Key_rbd,
184 Key_scale_io,
185 Key_secret,
186 Key_storageos,
187 Key_vsphere_volume,
188 Other,
189 }
190
191 impl<'de> crate::serde::Deserialize<'de> for Field {
192 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
193 struct Visitor;
194
195 impl crate::serde::de::Visitor<'_> for Visitor {
196 type Value = Field;
197
198 fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
199 f.write_str("field identifier")
200 }
201
202 fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: crate::serde::de::Error {
203 Ok(match v {
204 "awsElasticBlockStore" => Field::Key_aws_elastic_block_store,
205 "azureDisk" => Field::Key_azure_disk,
206 "azureFile" => Field::Key_azure_file,
207 "cephfs" => Field::Key_cephfs,
208 "cinder" => Field::Key_cinder,
209 "configMap" => Field::Key_config_map,
210 "csi" => Field::Key_csi,
211 "downwardAPI" => Field::Key_downward_api,
212 "emptyDir" => Field::Key_empty_dir,
213 "ephemeral" => Field::Key_ephemeral,
214 "fc" => Field::Key_fc,
215 "flexVolume" => Field::Key_flex_volume,
216 "flocker" => Field::Key_flocker,
217 "gcePersistentDisk" => Field::Key_gce_persistent_disk,
218 "gitRepo" => Field::Key_git_repo,
219 "glusterfs" => Field::Key_glusterfs,
220 "hostPath" => Field::Key_host_path,
221 "image" => Field::Key_image,
222 "iscsi" => Field::Key_iscsi,
223 "name" => Field::Key_name,
224 "nfs" => Field::Key_nfs,
225 "persistentVolumeClaim" => Field::Key_persistent_volume_claim,
226 "photonPersistentDisk" => Field::Key_photon_persistent_disk,
227 "portworxVolume" => Field::Key_portworx_volume,
228 "projected" => Field::Key_projected,
229 "quobyte" => Field::Key_quobyte,
230 "rbd" => Field::Key_rbd,
231 "scaleIO" => Field::Key_scale_io,
232 "secret" => Field::Key_secret,
233 "storageos" => Field::Key_storageos,
234 "vsphereVolume" => Field::Key_vsphere_volume,
235 _ => Field::Other,
236 })
237 }
238 }
239
240 deserializer.deserialize_identifier(Visitor)
241 }
242 }
243
244 struct Visitor;
245
246 impl<'de> crate::serde::de::Visitor<'de> for Visitor {
247 type Value = Volume;
248
249 fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
250 f.write_str("Volume")
251 }
252
253 fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: crate::serde::de::MapAccess<'de> {
254 let mut value_aws_elastic_block_store: Option<crate::api::core::v1::AWSElasticBlockStoreVolumeSource> = None;
255 let mut value_azure_disk: Option<crate::api::core::v1::AzureDiskVolumeSource> = None;
256 let mut value_azure_file: Option<crate::api::core::v1::AzureFileVolumeSource> = None;
257 let mut value_cephfs: Option<crate::api::core::v1::CephFSVolumeSource> = None;
258 let mut value_cinder: Option<crate::api::core::v1::CinderVolumeSource> = None;
259 let mut value_config_map: Option<crate::api::core::v1::ConfigMapVolumeSource> = None;
260 let mut value_csi: Option<crate::api::core::v1::CSIVolumeSource> = None;
261 let mut value_downward_api: Option<crate::api::core::v1::DownwardAPIVolumeSource> = None;
262 let mut value_empty_dir: Option<crate::api::core::v1::EmptyDirVolumeSource> = None;
263 let mut value_ephemeral: Option<crate::api::core::v1::EphemeralVolumeSource> = None;
264 let mut value_fc: Option<crate::api::core::v1::FCVolumeSource> = None;
265 let mut value_flex_volume: Option<crate::api::core::v1::FlexVolumeSource> = None;
266 let mut value_flocker: Option<crate::api::core::v1::FlockerVolumeSource> = None;
267 let mut value_gce_persistent_disk: Option<crate::api::core::v1::GCEPersistentDiskVolumeSource> = None;
268 let mut value_git_repo: Option<crate::api::core::v1::GitRepoVolumeSource> = None;
269 let mut value_glusterfs: Option<crate::api::core::v1::GlusterfsVolumeSource> = None;
270 let mut value_host_path: Option<crate::api::core::v1::HostPathVolumeSource> = None;
271 let mut value_image: Option<crate::api::core::v1::ImageVolumeSource> = None;
272 let mut value_iscsi: Option<crate::api::core::v1::ISCSIVolumeSource> = None;
273 let mut value_name: Option<String> = None;
274 let mut value_nfs: Option<crate::api::core::v1::NFSVolumeSource> = None;
275 let mut value_persistent_volume_claim: Option<crate::api::core::v1::PersistentVolumeClaimVolumeSource> = None;
276 let mut value_photon_persistent_disk: Option<crate::api::core::v1::PhotonPersistentDiskVolumeSource> = None;
277 let mut value_portworx_volume: Option<crate::api::core::v1::PortworxVolumeSource> = None;
278 let mut value_projected: Option<crate::api::core::v1::ProjectedVolumeSource> = None;
279 let mut value_quobyte: Option<crate::api::core::v1::QuobyteVolumeSource> = None;
280 let mut value_rbd: Option<crate::api::core::v1::RBDVolumeSource> = None;
281 let mut value_scale_io: Option<crate::api::core::v1::ScaleIOVolumeSource> = None;
282 let mut value_secret: Option<crate::api::core::v1::SecretVolumeSource> = None;
283 let mut value_storageos: Option<crate::api::core::v1::StorageOSVolumeSource> = None;
284 let mut value_vsphere_volume: Option<crate::api::core::v1::VsphereVirtualDiskVolumeSource> = None;
285
286 while let Some(key) = crate::serde::de::MapAccess::next_key::<Field>(&mut map)? {
287 match key {
288 Field::Key_aws_elastic_block_store => value_aws_elastic_block_store = crate::serde::de::MapAccess::next_value(&mut map)?,
289 Field::Key_azure_disk => value_azure_disk = crate::serde::de::MapAccess::next_value(&mut map)?,
290 Field::Key_azure_file => value_azure_file = crate::serde::de::MapAccess::next_value(&mut map)?,
291 Field::Key_cephfs => value_cephfs = crate::serde::de::MapAccess::next_value(&mut map)?,
292 Field::Key_cinder => value_cinder = crate::serde::de::MapAccess::next_value(&mut map)?,
293 Field::Key_config_map => value_config_map = crate::serde::de::MapAccess::next_value(&mut map)?,
294 Field::Key_csi => value_csi = crate::serde::de::MapAccess::next_value(&mut map)?,
295 Field::Key_downward_api => value_downward_api = crate::serde::de::MapAccess::next_value(&mut map)?,
296 Field::Key_empty_dir => value_empty_dir = crate::serde::de::MapAccess::next_value(&mut map)?,
297 Field::Key_ephemeral => value_ephemeral = crate::serde::de::MapAccess::next_value(&mut map)?,
298 Field::Key_fc => value_fc = crate::serde::de::MapAccess::next_value(&mut map)?,
299 Field::Key_flex_volume => value_flex_volume = crate::serde::de::MapAccess::next_value(&mut map)?,
300 Field::Key_flocker => value_flocker = crate::serde::de::MapAccess::next_value(&mut map)?,
301 Field::Key_gce_persistent_disk => value_gce_persistent_disk = crate::serde::de::MapAccess::next_value(&mut map)?,
302 Field::Key_git_repo => value_git_repo = crate::serde::de::MapAccess::next_value(&mut map)?,
303 Field::Key_glusterfs => value_glusterfs = crate::serde::de::MapAccess::next_value(&mut map)?,
304 Field::Key_host_path => value_host_path = crate::serde::de::MapAccess::next_value(&mut map)?,
305 Field::Key_image => value_image = crate::serde::de::MapAccess::next_value(&mut map)?,
306 Field::Key_iscsi => value_iscsi = crate::serde::de::MapAccess::next_value(&mut map)?,
307 Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?,
308 Field::Key_nfs => value_nfs = crate::serde::de::MapAccess::next_value(&mut map)?,
309 Field::Key_persistent_volume_claim => value_persistent_volume_claim = crate::serde::de::MapAccess::next_value(&mut map)?,
310 Field::Key_photon_persistent_disk => value_photon_persistent_disk = crate::serde::de::MapAccess::next_value(&mut map)?,
311 Field::Key_portworx_volume => value_portworx_volume = crate::serde::de::MapAccess::next_value(&mut map)?,
312 Field::Key_projected => value_projected = crate::serde::de::MapAccess::next_value(&mut map)?,
313 Field::Key_quobyte => value_quobyte = crate::serde::de::MapAccess::next_value(&mut map)?,
314 Field::Key_rbd => value_rbd = crate::serde::de::MapAccess::next_value(&mut map)?,
315 Field::Key_scale_io => value_scale_io = crate::serde::de::MapAccess::next_value(&mut map)?,
316 Field::Key_secret => value_secret = crate::serde::de::MapAccess::next_value(&mut map)?,
317 Field::Key_storageos => value_storageos = crate::serde::de::MapAccess::next_value(&mut map)?,
318 Field::Key_vsphere_volume => value_vsphere_volume = crate::serde::de::MapAccess::next_value(&mut map)?,
319 Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; },
320 }
321 }
322
323 Ok(Volume {
324 aws_elastic_block_store: value_aws_elastic_block_store,
325 azure_disk: value_azure_disk,
326 azure_file: value_azure_file,
327 cephfs: value_cephfs,
328 cinder: value_cinder,
329 config_map: value_config_map,
330 csi: value_csi,
331 downward_api: value_downward_api,
332 empty_dir: value_empty_dir,
333 ephemeral: value_ephemeral,
334 fc: value_fc,
335 flex_volume: value_flex_volume,
336 flocker: value_flocker,
337 gce_persistent_disk: value_gce_persistent_disk,
338 git_repo: value_git_repo,
339 glusterfs: value_glusterfs,
340 host_path: value_host_path,
341 image: value_image,
342 iscsi: value_iscsi,
343 name: value_name.unwrap_or_default(),
344 nfs: value_nfs,
345 persistent_volume_claim: value_persistent_volume_claim,
346 photon_persistent_disk: value_photon_persistent_disk,
347 portworx_volume: value_portworx_volume,
348 projected: value_projected,
349 quobyte: value_quobyte,
350 rbd: value_rbd,
351 scale_io: value_scale_io,
352 secret: value_secret,
353 storageos: value_storageos,
354 vsphere_volume: value_vsphere_volume,
355 })
356 }
357 }
358
359 deserializer.deserialize_struct(
360 "Volume",
361 &[
362 "awsElasticBlockStore",
363 "azureDisk",
364 "azureFile",
365 "cephfs",
366 "cinder",
367 "configMap",
368 "csi",
369 "downwardAPI",
370 "emptyDir",
371 "ephemeral",
372 "fc",
373 "flexVolume",
374 "flocker",
375 "gcePersistentDisk",
376 "gitRepo",
377 "glusterfs",
378 "hostPath",
379 "image",
380 "iscsi",
381 "name",
382 "nfs",
383 "persistentVolumeClaim",
384 "photonPersistentDisk",
385 "portworxVolume",
386 "projected",
387 "quobyte",
388 "rbd",
389 "scaleIO",
390 "secret",
391 "storageos",
392 "vsphereVolume",
393 ],
394 Visitor,
395 )
396 }
397}
398
399impl crate::serde::Serialize for Volume {
400 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: crate::serde::Serializer {
401 let mut state = serializer.serialize_struct(
402 "Volume",
403 1 +
404 self.aws_elastic_block_store.as_ref().map_or(0, |_| 1) +
405 self.azure_disk.as_ref().map_or(0, |_| 1) +
406 self.azure_file.as_ref().map_or(0, |_| 1) +
407 self.cephfs.as_ref().map_or(0, |_| 1) +
408 self.cinder.as_ref().map_or(0, |_| 1) +
409 self.config_map.as_ref().map_or(0, |_| 1) +
410 self.csi.as_ref().map_or(0, |_| 1) +
411 self.downward_api.as_ref().map_or(0, |_| 1) +
412 self.empty_dir.as_ref().map_or(0, |_| 1) +
413 self.ephemeral.as_ref().map_or(0, |_| 1) +
414 self.fc.as_ref().map_or(0, |_| 1) +
415 self.flex_volume.as_ref().map_or(0, |_| 1) +
416 self.flocker.as_ref().map_or(0, |_| 1) +
417 self.gce_persistent_disk.as_ref().map_or(0, |_| 1) +
418 self.git_repo.as_ref().map_or(0, |_| 1) +
419 self.glusterfs.as_ref().map_or(0, |_| 1) +
420 self.host_path.as_ref().map_or(0, |_| 1) +
421 self.image.as_ref().map_or(0, |_| 1) +
422 self.iscsi.as_ref().map_or(0, |_| 1) +
423 self.nfs.as_ref().map_or(0, |_| 1) +
424 self.persistent_volume_claim.as_ref().map_or(0, |_| 1) +
425 self.photon_persistent_disk.as_ref().map_or(0, |_| 1) +
426 self.portworx_volume.as_ref().map_or(0, |_| 1) +
427 self.projected.as_ref().map_or(0, |_| 1) +
428 self.quobyte.as_ref().map_or(0, |_| 1) +
429 self.rbd.as_ref().map_or(0, |_| 1) +
430 self.scale_io.as_ref().map_or(0, |_| 1) +
431 self.secret.as_ref().map_or(0, |_| 1) +
432 self.storageos.as_ref().map_or(0, |_| 1) +
433 self.vsphere_volume.as_ref().map_or(0, |_| 1),
434 )?;
435 if let Some(value) = &self.aws_elastic_block_store {
436 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "awsElasticBlockStore", value)?;
437 }
438 if let Some(value) = &self.azure_disk {
439 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "azureDisk", value)?;
440 }
441 if let Some(value) = &self.azure_file {
442 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "azureFile", value)?;
443 }
444 if let Some(value) = &self.cephfs {
445 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "cephfs", value)?;
446 }
447 if let Some(value) = &self.cinder {
448 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "cinder", value)?;
449 }
450 if let Some(value) = &self.config_map {
451 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "configMap", value)?;
452 }
453 if let Some(value) = &self.csi {
454 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "csi", value)?;
455 }
456 if let Some(value) = &self.downward_api {
457 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "downwardAPI", value)?;
458 }
459 if let Some(value) = &self.empty_dir {
460 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "emptyDir", value)?;
461 }
462 if let Some(value) = &self.ephemeral {
463 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ephemeral", value)?;
464 }
465 if let Some(value) = &self.fc {
466 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fc", value)?;
467 }
468 if let Some(value) = &self.flex_volume {
469 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "flexVolume", value)?;
470 }
471 if let Some(value) = &self.flocker {
472 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "flocker", value)?;
473 }
474 if let Some(value) = &self.gce_persistent_disk {
475 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "gcePersistentDisk", value)?;
476 }
477 if let Some(value) = &self.git_repo {
478 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "gitRepo", value)?;
479 }
480 if let Some(value) = &self.glusterfs {
481 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "glusterfs", value)?;
482 }
483 if let Some(value) = &self.host_path {
484 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostPath", value)?;
485 }
486 if let Some(value) = &self.image {
487 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "image", value)?;
488 }
489 if let Some(value) = &self.iscsi {
490 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "iscsi", value)?;
491 }
492 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?;
493 if let Some(value) = &self.nfs {
494 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nfs", value)?;
495 }
496 if let Some(value) = &self.persistent_volume_claim {
497 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "persistentVolumeClaim", value)?;
498 }
499 if let Some(value) = &self.photon_persistent_disk {
500 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "photonPersistentDisk", value)?;
501 }
502 if let Some(value) = &self.portworx_volume {
503 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "portworxVolume", value)?;
504 }
505 if let Some(value) = &self.projected {
506 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "projected", value)?;
507 }
508 if let Some(value) = &self.quobyte {
509 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "quobyte", value)?;
510 }
511 if let Some(value) = &self.rbd {
512 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "rbd", value)?;
513 }
514 if let Some(value) = &self.scale_io {
515 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scaleIO", value)?;
516 }
517 if let Some(value) = &self.secret {
518 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secret", value)?;
519 }
520 if let Some(value) = &self.storageos {
521 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storageos", value)?;
522 }
523 if let Some(value) = &self.vsphere_volume {
524 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "vsphereVolume", value)?;
525 }
526 crate::serde::ser::SerializeStruct::end(state)
527 }
528}
529
530#[cfg(feature = "schemars")]
531impl crate::schemars::JsonSchema for Volume {
532 fn schema_name() -> String {
533 "io.k8s.api.core.v1.Volume".to_owned()
534 }
535
536 fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema {
537 crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
538 metadata: Some(Box::new(crate::schemars::schema::Metadata {
539 description: Some("Volume represents a named volume in a pod that may be accessed by any container in the pod.".to_owned()),
540 ..Default::default()
541 })),
542 instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))),
543 object: Some(Box::new(crate::schemars::schema::ObjectValidation {
544 properties: [
545 (
546 "awsElasticBlockStore".to_owned(),
547 {
548 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::AWSElasticBlockStoreVolumeSource>().into_object();
549 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
550 description: Some("awsElasticBlockStore represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Deprecated: AWSElasticBlockStore is deprecated. All operations for the in-tree awsElasticBlockStore type are redirected to the ebs.csi.aws.com CSI driver. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore".to_owned()),
551 ..Default::default()
552 }));
553 crate::schemars::schema::Schema::Object(schema_obj)
554 },
555 ),
556 (
557 "azureDisk".to_owned(),
558 {
559 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::AzureDiskVolumeSource>().into_object();
560 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
561 description: Some("azureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. Deprecated: AzureDisk is deprecated. All operations for the in-tree azureDisk type are redirected to the disk.csi.azure.com CSI driver.".to_owned()),
562 ..Default::default()
563 }));
564 crate::schemars::schema::Schema::Object(schema_obj)
565 },
566 ),
567 (
568 "azureFile".to_owned(),
569 {
570 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::AzureFileVolumeSource>().into_object();
571 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
572 description: Some("azureFile represents an Azure File Service mount on the host and bind mount to the pod. Deprecated: AzureFile is deprecated. All operations for the in-tree azureFile type are redirected to the file.csi.azure.com CSI driver.".to_owned()),
573 ..Default::default()
574 }));
575 crate::schemars::schema::Schema::Object(schema_obj)
576 },
577 ),
578 (
579 "cephfs".to_owned(),
580 {
581 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::CephFSVolumeSource>().into_object();
582 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
583 description: Some("cephFS represents a Ceph FS mount on the host that shares a pod's lifetime. Deprecated: CephFS is deprecated and the in-tree cephfs type is no longer supported.".to_owned()),
584 ..Default::default()
585 }));
586 crate::schemars::schema::Schema::Object(schema_obj)
587 },
588 ),
589 (
590 "cinder".to_owned(),
591 {
592 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::CinderVolumeSource>().into_object();
593 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
594 description: Some("cinder represents a cinder volume attached and mounted on kubelets host machine. Deprecated: Cinder is deprecated. All operations for the in-tree cinder type are redirected to the cinder.csi.openstack.org CSI driver. More info: https://examples.k8s.io/mysql-cinder-pd/README.md".to_owned()),
595 ..Default::default()
596 }));
597 crate::schemars::schema::Schema::Object(schema_obj)
598 },
599 ),
600 (
601 "configMap".to_owned(),
602 {
603 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::ConfigMapVolumeSource>().into_object();
604 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
605 description: Some("configMap represents a configMap that should populate this volume".to_owned()),
606 ..Default::default()
607 }));
608 crate::schemars::schema::Schema::Object(schema_obj)
609 },
610 ),
611 (
612 "csi".to_owned(),
613 {
614 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::CSIVolumeSource>().into_object();
615 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
616 description: Some("csi (Container Storage Interface) represents ephemeral storage that is handled by certain external CSI drivers.".to_owned()),
617 ..Default::default()
618 }));
619 crate::schemars::schema::Schema::Object(schema_obj)
620 },
621 ),
622 (
623 "downwardAPI".to_owned(),
624 {
625 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::DownwardAPIVolumeSource>().into_object();
626 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
627 description: Some("downwardAPI represents downward API about the pod that should populate this volume".to_owned()),
628 ..Default::default()
629 }));
630 crate::schemars::schema::Schema::Object(schema_obj)
631 },
632 ),
633 (
634 "emptyDir".to_owned(),
635 {
636 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::EmptyDirVolumeSource>().into_object();
637 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
638 description: Some("emptyDir represents a temporary directory that shares a pod's lifetime. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir".to_owned()),
639 ..Default::default()
640 }));
641 crate::schemars::schema::Schema::Object(schema_obj)
642 },
643 ),
644 (
645 "ephemeral".to_owned(),
646 {
647 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::EphemeralVolumeSource>().into_object();
648 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
649 description: Some("ephemeral represents a volume that is handled by a cluster storage driver. The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, and deleted when the pod is removed.\n\nUse this if: a) the volume is only needed while the pod runs, b) features of normal volumes like restoring from snapshot or capacity\n tracking are needed,\nc) the storage driver is specified through a storage class, and d) the storage driver supports dynamic volume provisioning through\n a PersistentVolumeClaim (see EphemeralVolumeSource for more\n information on the connection between this volume type\n and PersistentVolumeClaim).\n\nUse PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle of an individual pod.\n\nUse CSI for light-weight local ephemeral volumes if the CSI driver is meant to be used that way - see the documentation of the driver for more information.\n\nA pod can use both types of ephemeral volumes and persistent volumes at the same time.".to_owned()),
650 ..Default::default()
651 }));
652 crate::schemars::schema::Schema::Object(schema_obj)
653 },
654 ),
655 (
656 "fc".to_owned(),
657 {
658 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::FCVolumeSource>().into_object();
659 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
660 description: Some("fc represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.".to_owned()),
661 ..Default::default()
662 }));
663 crate::schemars::schema::Schema::Object(schema_obj)
664 },
665 ),
666 (
667 "flexVolume".to_owned(),
668 {
669 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::FlexVolumeSource>().into_object();
670 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
671 description: Some("flexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. Deprecated: FlexVolume is deprecated. Consider using a CSIDriver instead.".to_owned()),
672 ..Default::default()
673 }));
674 crate::schemars::schema::Schema::Object(schema_obj)
675 },
676 ),
677 (
678 "flocker".to_owned(),
679 {
680 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::FlockerVolumeSource>().into_object();
681 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
682 description: Some("flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running. Deprecated: Flocker is deprecated and the in-tree flocker type is no longer supported.".to_owned()),
683 ..Default::default()
684 }));
685 crate::schemars::schema::Schema::Object(schema_obj)
686 },
687 ),
688 (
689 "gcePersistentDisk".to_owned(),
690 {
691 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::GCEPersistentDiskVolumeSource>().into_object();
692 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
693 description: Some("gcePersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Deprecated: GCEPersistentDisk is deprecated. All operations for the in-tree gcePersistentDisk type are redirected to the pd.csi.storage.gke.io CSI driver. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk".to_owned()),
694 ..Default::default()
695 }));
696 crate::schemars::schema::Schema::Object(schema_obj)
697 },
698 ),
699 (
700 "gitRepo".to_owned(),
701 {
702 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::GitRepoVolumeSource>().into_object();
703 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
704 description: Some("gitRepo represents a git repository at a particular revision. Deprecated: GitRepo is deprecated. To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod's container.".to_owned()),
705 ..Default::default()
706 }));
707 crate::schemars::schema::Schema::Object(schema_obj)
708 },
709 ),
710 (
711 "glusterfs".to_owned(),
712 {
713 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::GlusterfsVolumeSource>().into_object();
714 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
715 description: Some("glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. Deprecated: Glusterfs is deprecated and the in-tree glusterfs type is no longer supported. More info: https://examples.k8s.io/volumes/glusterfs/README.md".to_owned()),
716 ..Default::default()
717 }));
718 crate::schemars::schema::Schema::Object(schema_obj)
719 },
720 ),
721 (
722 "hostPath".to_owned(),
723 {
724 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::HostPathVolumeSource>().into_object();
725 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
726 description: Some("hostPath represents a pre-existing file or directory on the host machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath".to_owned()),
727 ..Default::default()
728 }));
729 crate::schemars::schema::Schema::Object(schema_obj)
730 },
731 ),
732 (
733 "image".to_owned(),
734 {
735 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::ImageVolumeSource>().into_object();
736 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
737 description: Some("image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. The volume is resolved at pod startup depending on which PullPolicy value is provided:\n\n- Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails.\n\nThe volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field. The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images. The volume will be mounted read-only (ro) and non-executable files (noexec). Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath). The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type.".to_owned()),
738 ..Default::default()
739 }));
740 crate::schemars::schema::Schema::Object(schema_obj)
741 },
742 ),
743 (
744 "iscsi".to_owned(),
745 {
746 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::ISCSIVolumeSource>().into_object();
747 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
748 description: Some("iscsi represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://examples.k8s.io/volumes/iscsi/README.md".to_owned()),
749 ..Default::default()
750 }));
751 crate::schemars::schema::Schema::Object(schema_obj)
752 },
753 ),
754 (
755 "name".to_owned(),
756 crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
757 metadata: Some(Box::new(crate::schemars::schema::Metadata {
758 description: Some("name of the volume. Must be a DNS_LABEL and unique within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names".to_owned()),
759 ..Default::default()
760 })),
761 instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))),
762 ..Default::default()
763 }),
764 ),
765 (
766 "nfs".to_owned(),
767 {
768 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::NFSVolumeSource>().into_object();
769 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
770 description: Some("nfs represents an NFS mount on the host that shares a pod's lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs".to_owned()),
771 ..Default::default()
772 }));
773 crate::schemars::schema::Schema::Object(schema_obj)
774 },
775 ),
776 (
777 "persistentVolumeClaim".to_owned(),
778 {
779 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::PersistentVolumeClaimVolumeSource>().into_object();
780 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
781 description: Some("persistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims".to_owned()),
782 ..Default::default()
783 }));
784 crate::schemars::schema::Schema::Object(schema_obj)
785 },
786 ),
787 (
788 "photonPersistentDisk".to_owned(),
789 {
790 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::PhotonPersistentDiskVolumeSource>().into_object();
791 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
792 description: Some("photonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine. Deprecated: PhotonPersistentDisk is deprecated and the in-tree photonPersistentDisk type is no longer supported.".to_owned()),
793 ..Default::default()
794 }));
795 crate::schemars::schema::Schema::Object(schema_obj)
796 },
797 ),
798 (
799 "portworxVolume".to_owned(),
800 {
801 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::PortworxVolumeSource>().into_object();
802 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
803 description: Some("portworxVolume represents a portworx volume attached and mounted on kubelets host machine. Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type are redirected to the pxd.portworx.com CSI driver when the CSIMigrationPortworx feature-gate is on.".to_owned()),
804 ..Default::default()
805 }));
806 crate::schemars::schema::Schema::Object(schema_obj)
807 },
808 ),
809 (
810 "projected".to_owned(),
811 {
812 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::ProjectedVolumeSource>().into_object();
813 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
814 description: Some("projected items for all in one resources secrets, configmaps, and downward API".to_owned()),
815 ..Default::default()
816 }));
817 crate::schemars::schema::Schema::Object(schema_obj)
818 },
819 ),
820 (
821 "quobyte".to_owned(),
822 {
823 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::QuobyteVolumeSource>().into_object();
824 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
825 description: Some("quobyte represents a Quobyte mount on the host that shares a pod's lifetime. Deprecated: Quobyte is deprecated and the in-tree quobyte type is no longer supported.".to_owned()),
826 ..Default::default()
827 }));
828 crate::schemars::schema::Schema::Object(schema_obj)
829 },
830 ),
831 (
832 "rbd".to_owned(),
833 {
834 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::RBDVolumeSource>().into_object();
835 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
836 description: Some("rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. Deprecated: RBD is deprecated and the in-tree rbd type is no longer supported. More info: https://examples.k8s.io/volumes/rbd/README.md".to_owned()),
837 ..Default::default()
838 }));
839 crate::schemars::schema::Schema::Object(schema_obj)
840 },
841 ),
842 (
843 "scaleIO".to_owned(),
844 {
845 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::ScaleIOVolumeSource>().into_object();
846 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
847 description: Some("scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. Deprecated: ScaleIO is deprecated and the in-tree scaleIO type is no longer supported.".to_owned()),
848 ..Default::default()
849 }));
850 crate::schemars::schema::Schema::Object(schema_obj)
851 },
852 ),
853 (
854 "secret".to_owned(),
855 {
856 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::SecretVolumeSource>().into_object();
857 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
858 description: Some("secret represents a secret that should populate this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret".to_owned()),
859 ..Default::default()
860 }));
861 crate::schemars::schema::Schema::Object(schema_obj)
862 },
863 ),
864 (
865 "storageos".to_owned(),
866 {
867 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::StorageOSVolumeSource>().into_object();
868 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
869 description: Some("storageOS represents a StorageOS volume attached and mounted on Kubernetes nodes. Deprecated: StorageOS is deprecated and the in-tree storageos type is no longer supported.".to_owned()),
870 ..Default::default()
871 }));
872 crate::schemars::schema::Schema::Object(schema_obj)
873 },
874 ),
875 (
876 "vsphereVolume".to_owned(),
877 {
878 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::VsphereVirtualDiskVolumeSource>().into_object();
879 schema_obj.metadata = Some(Box::new(crate::schemars::schema::Metadata {
880 description: Some("vsphereVolume represents a vSphere volume attached and mounted on kubelets host machine. Deprecated: VsphereVolume is deprecated. All operations for the in-tree vsphereVolume type are redirected to the csi.vsphere.vmware.com CSI driver.".to_owned()),
881 ..Default::default()
882 }));
883 crate::schemars::schema::Schema::Object(schema_obj)
884 },
885 ),
886 ].into(),
887 required: [
888 "name".to_owned(),
889 ].into(),
890 ..Default::default()
891 })),
892 ..Default::default()
893 })
894 }
895}