1#[derive(Clone, Debug, Default, PartialEq)]
5pub struct PersistentVolumeSpec {
6 pub access_modes: Option<std::vec::Vec<std::string::String>>,
8
9 pub aws_elastic_block_store: Option<crate::api::core::v1::AWSElasticBlockStoreVolumeSource>,
11
12 pub azure_disk: Option<crate::api::core::v1::AzureDiskVolumeSource>,
14
15 pub azure_file: Option<crate::api::core::v1::AzureFilePersistentVolumeSource>,
17
18 pub capacity: Option<std::collections::BTreeMap<std::string::String, crate::apimachinery::pkg::api::resource::Quantity>>,
20
21 pub cephfs: Option<crate::api::core::v1::CephFSPersistentVolumeSource>,
23
24 pub cinder: Option<crate::api::core::v1::CinderPersistentVolumeSource>,
26
27 pub claim_ref: Option<crate::api::core::v1::ObjectReference>,
29
30 pub csi: Option<crate::api::core::v1::CSIPersistentVolumeSource>,
32
33 pub fc: Option<crate::api::core::v1::FCVolumeSource>,
35
36 pub flex_volume: Option<crate::api::core::v1::FlexPersistentVolumeSource>,
38
39 pub flocker: Option<crate::api::core::v1::FlockerVolumeSource>,
41
42 pub gce_persistent_disk: Option<crate::api::core::v1::GCEPersistentDiskVolumeSource>,
44
45 pub glusterfs: Option<crate::api::core::v1::GlusterfsPersistentVolumeSource>,
47
48 pub host_path: Option<crate::api::core::v1::HostPathVolumeSource>,
50
51 pub iscsi: Option<crate::api::core::v1::ISCSIPersistentVolumeSource>,
53
54 pub local: Option<crate::api::core::v1::LocalVolumeSource>,
56
57 pub mount_options: Option<std::vec::Vec<std::string::String>>,
59
60 pub nfs: Option<crate::api::core::v1::NFSVolumeSource>,
62
63 pub node_affinity: Option<crate::api::core::v1::VolumeNodeAffinity>,
65
66 pub persistent_volume_reclaim_policy: Option<std::string::String>,
68
69 pub photon_persistent_disk: Option<crate::api::core::v1::PhotonPersistentDiskVolumeSource>,
71
72 pub portworx_volume: Option<crate::api::core::v1::PortworxVolumeSource>,
74
75 pub quobyte: Option<crate::api::core::v1::QuobyteVolumeSource>,
77
78 pub rbd: Option<crate::api::core::v1::RBDPersistentVolumeSource>,
80
81 pub scale_io: Option<crate::api::core::v1::ScaleIOPersistentVolumeSource>,
83
84 pub storage_class_name: Option<std::string::String>,
86
87 pub storageos: Option<crate::api::core::v1::StorageOSPersistentVolumeSource>,
89
90 pub volume_attributes_class_name: Option<std::string::String>,
92
93 pub volume_mode: Option<std::string::String>,
95
96 pub vsphere_volume: Option<crate::api::core::v1::VsphereVirtualDiskVolumeSource>,
98}
99
100impl crate::DeepMerge for PersistentVolumeSpec {
101 fn merge_from(&mut self, other: Self) {
102 crate::merge_strategies::list::atomic(&mut self.access_modes, other.access_modes);
103 crate::DeepMerge::merge_from(&mut self.aws_elastic_block_store, other.aws_elastic_block_store);
104 crate::DeepMerge::merge_from(&mut self.azure_disk, other.azure_disk);
105 crate::DeepMerge::merge_from(&mut self.azure_file, other.azure_file);
106 crate::merge_strategies::map::granular(&mut self.capacity, other.capacity, |current_item, other_item| {
107 crate::DeepMerge::merge_from(current_item, other_item);
108 });
109 crate::DeepMerge::merge_from(&mut self.cephfs, other.cephfs);
110 crate::DeepMerge::merge_from(&mut self.cinder, other.cinder);
111 crate::DeepMerge::merge_from(&mut self.claim_ref, other.claim_ref);
112 crate::DeepMerge::merge_from(&mut self.csi, other.csi);
113 crate::DeepMerge::merge_from(&mut self.fc, other.fc);
114 crate::DeepMerge::merge_from(&mut self.flex_volume, other.flex_volume);
115 crate::DeepMerge::merge_from(&mut self.flocker, other.flocker);
116 crate::DeepMerge::merge_from(&mut self.gce_persistent_disk, other.gce_persistent_disk);
117 crate::DeepMerge::merge_from(&mut self.glusterfs, other.glusterfs);
118 crate::DeepMerge::merge_from(&mut self.host_path, other.host_path);
119 crate::DeepMerge::merge_from(&mut self.iscsi, other.iscsi);
120 crate::DeepMerge::merge_from(&mut self.local, other.local);
121 crate::merge_strategies::list::atomic(&mut self.mount_options, other.mount_options);
122 crate::DeepMerge::merge_from(&mut self.nfs, other.nfs);
123 crate::DeepMerge::merge_from(&mut self.node_affinity, other.node_affinity);
124 crate::DeepMerge::merge_from(&mut self.persistent_volume_reclaim_policy, other.persistent_volume_reclaim_policy);
125 crate::DeepMerge::merge_from(&mut self.photon_persistent_disk, other.photon_persistent_disk);
126 crate::DeepMerge::merge_from(&mut self.portworx_volume, other.portworx_volume);
127 crate::DeepMerge::merge_from(&mut self.quobyte, other.quobyte);
128 crate::DeepMerge::merge_from(&mut self.rbd, other.rbd);
129 crate::DeepMerge::merge_from(&mut self.scale_io, other.scale_io);
130 crate::DeepMerge::merge_from(&mut self.storage_class_name, other.storage_class_name);
131 crate::DeepMerge::merge_from(&mut self.storageos, other.storageos);
132 crate::DeepMerge::merge_from(&mut self.volume_attributes_class_name, other.volume_attributes_class_name);
133 crate::DeepMerge::merge_from(&mut self.volume_mode, other.volume_mode);
134 crate::DeepMerge::merge_from(&mut self.vsphere_volume, other.vsphere_volume);
135 }
136}
137
138impl<'de> crate::serde::Deserialize<'de> for PersistentVolumeSpec {
139 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
140 #[allow(non_camel_case_types)]
141 enum Field {
142 Key_access_modes,
143 Key_aws_elastic_block_store,
144 Key_azure_disk,
145 Key_azure_file,
146 Key_capacity,
147 Key_cephfs,
148 Key_cinder,
149 Key_claim_ref,
150 Key_csi,
151 Key_fc,
152 Key_flex_volume,
153 Key_flocker,
154 Key_gce_persistent_disk,
155 Key_glusterfs,
156 Key_host_path,
157 Key_iscsi,
158 Key_local,
159 Key_mount_options,
160 Key_nfs,
161 Key_node_affinity,
162 Key_persistent_volume_reclaim_policy,
163 Key_photon_persistent_disk,
164 Key_portworx_volume,
165 Key_quobyte,
166 Key_rbd,
167 Key_scale_io,
168 Key_storage_class_name,
169 Key_storageos,
170 Key_volume_attributes_class_name,
171 Key_volume_mode,
172 Key_vsphere_volume,
173 Other,
174 }
175
176 impl<'de> crate::serde::Deserialize<'de> for Field {
177 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
178 struct Visitor;
179
180 impl crate::serde::de::Visitor<'_> for Visitor {
181 type Value = Field;
182
183 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
184 f.write_str("field identifier")
185 }
186
187 fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: crate::serde::de::Error {
188 Ok(match v {
189 "accessModes" => Field::Key_access_modes,
190 "awsElasticBlockStore" => Field::Key_aws_elastic_block_store,
191 "azureDisk" => Field::Key_azure_disk,
192 "azureFile" => Field::Key_azure_file,
193 "capacity" => Field::Key_capacity,
194 "cephfs" => Field::Key_cephfs,
195 "cinder" => Field::Key_cinder,
196 "claimRef" => Field::Key_claim_ref,
197 "csi" => Field::Key_csi,
198 "fc" => Field::Key_fc,
199 "flexVolume" => Field::Key_flex_volume,
200 "flocker" => Field::Key_flocker,
201 "gcePersistentDisk" => Field::Key_gce_persistent_disk,
202 "glusterfs" => Field::Key_glusterfs,
203 "hostPath" => Field::Key_host_path,
204 "iscsi" => Field::Key_iscsi,
205 "local" => Field::Key_local,
206 "mountOptions" => Field::Key_mount_options,
207 "nfs" => Field::Key_nfs,
208 "nodeAffinity" => Field::Key_node_affinity,
209 "persistentVolumeReclaimPolicy" => Field::Key_persistent_volume_reclaim_policy,
210 "photonPersistentDisk" => Field::Key_photon_persistent_disk,
211 "portworxVolume" => Field::Key_portworx_volume,
212 "quobyte" => Field::Key_quobyte,
213 "rbd" => Field::Key_rbd,
214 "scaleIO" => Field::Key_scale_io,
215 "storageClassName" => Field::Key_storage_class_name,
216 "storageos" => Field::Key_storageos,
217 "volumeAttributesClassName" => Field::Key_volume_attributes_class_name,
218 "volumeMode" => Field::Key_volume_mode,
219 "vsphereVolume" => Field::Key_vsphere_volume,
220 _ => Field::Other,
221 })
222 }
223 }
224
225 deserializer.deserialize_identifier(Visitor)
226 }
227 }
228
229 struct Visitor;
230
231 impl<'de> crate::serde::de::Visitor<'de> for Visitor {
232 type Value = PersistentVolumeSpec;
233
234 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
235 f.write_str("PersistentVolumeSpec")
236 }
237
238 fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: crate::serde::de::MapAccess<'de> {
239 let mut value_access_modes: Option<std::vec::Vec<std::string::String>> = None;
240 let mut value_aws_elastic_block_store: Option<crate::api::core::v1::AWSElasticBlockStoreVolumeSource> = None;
241 let mut value_azure_disk: Option<crate::api::core::v1::AzureDiskVolumeSource> = None;
242 let mut value_azure_file: Option<crate::api::core::v1::AzureFilePersistentVolumeSource> = None;
243 let mut value_capacity: Option<std::collections::BTreeMap<std::string::String, crate::apimachinery::pkg::api::resource::Quantity>> = None;
244 let mut value_cephfs: Option<crate::api::core::v1::CephFSPersistentVolumeSource> = None;
245 let mut value_cinder: Option<crate::api::core::v1::CinderPersistentVolumeSource> = None;
246 let mut value_claim_ref: Option<crate::api::core::v1::ObjectReference> = None;
247 let mut value_csi: Option<crate::api::core::v1::CSIPersistentVolumeSource> = None;
248 let mut value_fc: Option<crate::api::core::v1::FCVolumeSource> = None;
249 let mut value_flex_volume: Option<crate::api::core::v1::FlexPersistentVolumeSource> = None;
250 let mut value_flocker: Option<crate::api::core::v1::FlockerVolumeSource> = None;
251 let mut value_gce_persistent_disk: Option<crate::api::core::v1::GCEPersistentDiskVolumeSource> = None;
252 let mut value_glusterfs: Option<crate::api::core::v1::GlusterfsPersistentVolumeSource> = None;
253 let mut value_host_path: Option<crate::api::core::v1::HostPathVolumeSource> = None;
254 let mut value_iscsi: Option<crate::api::core::v1::ISCSIPersistentVolumeSource> = None;
255 let mut value_local: Option<crate::api::core::v1::LocalVolumeSource> = None;
256 let mut value_mount_options: Option<std::vec::Vec<std::string::String>> = None;
257 let mut value_nfs: Option<crate::api::core::v1::NFSVolumeSource> = None;
258 let mut value_node_affinity: Option<crate::api::core::v1::VolumeNodeAffinity> = None;
259 let mut value_persistent_volume_reclaim_policy: Option<std::string::String> = None;
260 let mut value_photon_persistent_disk: Option<crate::api::core::v1::PhotonPersistentDiskVolumeSource> = None;
261 let mut value_portworx_volume: Option<crate::api::core::v1::PortworxVolumeSource> = None;
262 let mut value_quobyte: Option<crate::api::core::v1::QuobyteVolumeSource> = None;
263 let mut value_rbd: Option<crate::api::core::v1::RBDPersistentVolumeSource> = None;
264 let mut value_scale_io: Option<crate::api::core::v1::ScaleIOPersistentVolumeSource> = None;
265 let mut value_storage_class_name: Option<std::string::String> = None;
266 let mut value_storageos: Option<crate::api::core::v1::StorageOSPersistentVolumeSource> = None;
267 let mut value_volume_attributes_class_name: Option<std::string::String> = None;
268 let mut value_volume_mode: Option<std::string::String> = None;
269 let mut value_vsphere_volume: Option<crate::api::core::v1::VsphereVirtualDiskVolumeSource> = None;
270
271 while let Some(key) = crate::serde::de::MapAccess::next_key::<Field>(&mut map)? {
272 match key {
273 Field::Key_access_modes => value_access_modes = crate::serde::de::MapAccess::next_value(&mut map)?,
274 Field::Key_aws_elastic_block_store => value_aws_elastic_block_store = crate::serde::de::MapAccess::next_value(&mut map)?,
275 Field::Key_azure_disk => value_azure_disk = crate::serde::de::MapAccess::next_value(&mut map)?,
276 Field::Key_azure_file => value_azure_file = crate::serde::de::MapAccess::next_value(&mut map)?,
277 Field::Key_capacity => value_capacity = crate::serde::de::MapAccess::next_value(&mut map)?,
278 Field::Key_cephfs => value_cephfs = crate::serde::de::MapAccess::next_value(&mut map)?,
279 Field::Key_cinder => value_cinder = crate::serde::de::MapAccess::next_value(&mut map)?,
280 Field::Key_claim_ref => value_claim_ref = crate::serde::de::MapAccess::next_value(&mut map)?,
281 Field::Key_csi => value_csi = crate::serde::de::MapAccess::next_value(&mut map)?,
282 Field::Key_fc => value_fc = crate::serde::de::MapAccess::next_value(&mut map)?,
283 Field::Key_flex_volume => value_flex_volume = crate::serde::de::MapAccess::next_value(&mut map)?,
284 Field::Key_flocker => value_flocker = crate::serde::de::MapAccess::next_value(&mut map)?,
285 Field::Key_gce_persistent_disk => value_gce_persistent_disk = crate::serde::de::MapAccess::next_value(&mut map)?,
286 Field::Key_glusterfs => value_glusterfs = crate::serde::de::MapAccess::next_value(&mut map)?,
287 Field::Key_host_path => value_host_path = crate::serde::de::MapAccess::next_value(&mut map)?,
288 Field::Key_iscsi => value_iscsi = crate::serde::de::MapAccess::next_value(&mut map)?,
289 Field::Key_local => value_local = crate::serde::de::MapAccess::next_value(&mut map)?,
290 Field::Key_mount_options => value_mount_options = crate::serde::de::MapAccess::next_value(&mut map)?,
291 Field::Key_nfs => value_nfs = crate::serde::de::MapAccess::next_value(&mut map)?,
292 Field::Key_node_affinity => value_node_affinity = crate::serde::de::MapAccess::next_value(&mut map)?,
293 Field::Key_persistent_volume_reclaim_policy => value_persistent_volume_reclaim_policy = crate::serde::de::MapAccess::next_value(&mut map)?,
294 Field::Key_photon_persistent_disk => value_photon_persistent_disk = crate::serde::de::MapAccess::next_value(&mut map)?,
295 Field::Key_portworx_volume => value_portworx_volume = crate::serde::de::MapAccess::next_value(&mut map)?,
296 Field::Key_quobyte => value_quobyte = crate::serde::de::MapAccess::next_value(&mut map)?,
297 Field::Key_rbd => value_rbd = crate::serde::de::MapAccess::next_value(&mut map)?,
298 Field::Key_scale_io => value_scale_io = crate::serde::de::MapAccess::next_value(&mut map)?,
299 Field::Key_storage_class_name => value_storage_class_name = crate::serde::de::MapAccess::next_value(&mut map)?,
300 Field::Key_storageos => value_storageos = crate::serde::de::MapAccess::next_value(&mut map)?,
301 Field::Key_volume_attributes_class_name => value_volume_attributes_class_name = crate::serde::de::MapAccess::next_value(&mut map)?,
302 Field::Key_volume_mode => value_volume_mode = crate::serde::de::MapAccess::next_value(&mut map)?,
303 Field::Key_vsphere_volume => value_vsphere_volume = crate::serde::de::MapAccess::next_value(&mut map)?,
304 Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; },
305 }
306 }
307
308 Ok(PersistentVolumeSpec {
309 access_modes: value_access_modes,
310 aws_elastic_block_store: value_aws_elastic_block_store,
311 azure_disk: value_azure_disk,
312 azure_file: value_azure_file,
313 capacity: value_capacity,
314 cephfs: value_cephfs,
315 cinder: value_cinder,
316 claim_ref: value_claim_ref,
317 csi: value_csi,
318 fc: value_fc,
319 flex_volume: value_flex_volume,
320 flocker: value_flocker,
321 gce_persistent_disk: value_gce_persistent_disk,
322 glusterfs: value_glusterfs,
323 host_path: value_host_path,
324 iscsi: value_iscsi,
325 local: value_local,
326 mount_options: value_mount_options,
327 nfs: value_nfs,
328 node_affinity: value_node_affinity,
329 persistent_volume_reclaim_policy: value_persistent_volume_reclaim_policy,
330 photon_persistent_disk: value_photon_persistent_disk,
331 portworx_volume: value_portworx_volume,
332 quobyte: value_quobyte,
333 rbd: value_rbd,
334 scale_io: value_scale_io,
335 storage_class_name: value_storage_class_name,
336 storageos: value_storageos,
337 volume_attributes_class_name: value_volume_attributes_class_name,
338 volume_mode: value_volume_mode,
339 vsphere_volume: value_vsphere_volume,
340 })
341 }
342 }
343
344 deserializer.deserialize_struct(
345 "PersistentVolumeSpec",
346 &[
347 "accessModes",
348 "awsElasticBlockStore",
349 "azureDisk",
350 "azureFile",
351 "capacity",
352 "cephfs",
353 "cinder",
354 "claimRef",
355 "csi",
356 "fc",
357 "flexVolume",
358 "flocker",
359 "gcePersistentDisk",
360 "glusterfs",
361 "hostPath",
362 "iscsi",
363 "local",
364 "mountOptions",
365 "nfs",
366 "nodeAffinity",
367 "persistentVolumeReclaimPolicy",
368 "photonPersistentDisk",
369 "portworxVolume",
370 "quobyte",
371 "rbd",
372 "scaleIO",
373 "storageClassName",
374 "storageos",
375 "volumeAttributesClassName",
376 "volumeMode",
377 "vsphereVolume",
378 ],
379 Visitor,
380 )
381 }
382}
383
384impl crate::serde::Serialize for PersistentVolumeSpec {
385 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: crate::serde::Serializer {
386 let mut state = serializer.serialize_struct(
387 "PersistentVolumeSpec",
388 self.access_modes.as_ref().map_or(0, |_| 1) +
389 self.aws_elastic_block_store.as_ref().map_or(0, |_| 1) +
390 self.azure_disk.as_ref().map_or(0, |_| 1) +
391 self.azure_file.as_ref().map_or(0, |_| 1) +
392 self.capacity.as_ref().map_or(0, |_| 1) +
393 self.cephfs.as_ref().map_or(0, |_| 1) +
394 self.cinder.as_ref().map_or(0, |_| 1) +
395 self.claim_ref.as_ref().map_or(0, |_| 1) +
396 self.csi.as_ref().map_or(0, |_| 1) +
397 self.fc.as_ref().map_or(0, |_| 1) +
398 self.flex_volume.as_ref().map_or(0, |_| 1) +
399 self.flocker.as_ref().map_or(0, |_| 1) +
400 self.gce_persistent_disk.as_ref().map_or(0, |_| 1) +
401 self.glusterfs.as_ref().map_or(0, |_| 1) +
402 self.host_path.as_ref().map_or(0, |_| 1) +
403 self.iscsi.as_ref().map_or(0, |_| 1) +
404 self.local.as_ref().map_or(0, |_| 1) +
405 self.mount_options.as_ref().map_or(0, |_| 1) +
406 self.nfs.as_ref().map_or(0, |_| 1) +
407 self.node_affinity.as_ref().map_or(0, |_| 1) +
408 self.persistent_volume_reclaim_policy.as_ref().map_or(0, |_| 1) +
409 self.photon_persistent_disk.as_ref().map_or(0, |_| 1) +
410 self.portworx_volume.as_ref().map_or(0, |_| 1) +
411 self.quobyte.as_ref().map_or(0, |_| 1) +
412 self.rbd.as_ref().map_or(0, |_| 1) +
413 self.scale_io.as_ref().map_or(0, |_| 1) +
414 self.storage_class_name.as_ref().map_or(0, |_| 1) +
415 self.storageos.as_ref().map_or(0, |_| 1) +
416 self.volume_attributes_class_name.as_ref().map_or(0, |_| 1) +
417 self.volume_mode.as_ref().map_or(0, |_| 1) +
418 self.vsphere_volume.as_ref().map_or(0, |_| 1),
419 )?;
420 if let Some(value) = &self.access_modes {
421 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "accessModes", value)?;
422 }
423 if let Some(value) = &self.aws_elastic_block_store {
424 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "awsElasticBlockStore", value)?;
425 }
426 if let Some(value) = &self.azure_disk {
427 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "azureDisk", value)?;
428 }
429 if let Some(value) = &self.azure_file {
430 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "azureFile", value)?;
431 }
432 if let Some(value) = &self.capacity {
433 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "capacity", value)?;
434 }
435 if let Some(value) = &self.cephfs {
436 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "cephfs", value)?;
437 }
438 if let Some(value) = &self.cinder {
439 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "cinder", value)?;
440 }
441 if let Some(value) = &self.claim_ref {
442 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "claimRef", value)?;
443 }
444 if let Some(value) = &self.csi {
445 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "csi", value)?;
446 }
447 if let Some(value) = &self.fc {
448 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fc", value)?;
449 }
450 if let Some(value) = &self.flex_volume {
451 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "flexVolume", value)?;
452 }
453 if let Some(value) = &self.flocker {
454 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "flocker", value)?;
455 }
456 if let Some(value) = &self.gce_persistent_disk {
457 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "gcePersistentDisk", value)?;
458 }
459 if let Some(value) = &self.glusterfs {
460 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "glusterfs", value)?;
461 }
462 if let Some(value) = &self.host_path {
463 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostPath", value)?;
464 }
465 if let Some(value) = &self.iscsi {
466 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "iscsi", value)?;
467 }
468 if let Some(value) = &self.local {
469 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "local", value)?;
470 }
471 if let Some(value) = &self.mount_options {
472 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "mountOptions", value)?;
473 }
474 if let Some(value) = &self.nfs {
475 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nfs", value)?;
476 }
477 if let Some(value) = &self.node_affinity {
478 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeAffinity", value)?;
479 }
480 if let Some(value) = &self.persistent_volume_reclaim_policy {
481 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "persistentVolumeReclaimPolicy", value)?;
482 }
483 if let Some(value) = &self.photon_persistent_disk {
484 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "photonPersistentDisk", value)?;
485 }
486 if let Some(value) = &self.portworx_volume {
487 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "portworxVolume", value)?;
488 }
489 if let Some(value) = &self.quobyte {
490 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "quobyte", value)?;
491 }
492 if let Some(value) = &self.rbd {
493 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "rbd", value)?;
494 }
495 if let Some(value) = &self.scale_io {
496 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scaleIO", value)?;
497 }
498 if let Some(value) = &self.storage_class_name {
499 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storageClassName", value)?;
500 }
501 if let Some(value) = &self.storageos {
502 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storageos", value)?;
503 }
504 if let Some(value) = &self.volume_attributes_class_name {
505 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeAttributesClassName", value)?;
506 }
507 if let Some(value) = &self.volume_mode {
508 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeMode", value)?;
509 }
510 if let Some(value) = &self.vsphere_volume {
511 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "vsphereVolume", value)?;
512 }
513 crate::serde::ser::SerializeStruct::end(state)
514 }
515}
516
517#[cfg(feature = "schemars")]
518impl crate::schemars::JsonSchema for PersistentVolumeSpec {
519 fn schema_name() -> std::borrow::Cow<'static, str> {
520 "io.k8s.api.core.v1.PersistentVolumeSpec".into()
521 }
522
523 fn json_schema(__gen: &mut crate::schemars::SchemaGenerator) -> crate::schemars::Schema {
524 crate::schemars::json_schema!({
525 "description": "PersistentVolumeSpec is the specification of a persistent volume.",
526 "type": "object",
527 "properties": {
528 "accessModes": {
529 "description": "accessModes contains all ways the volume can be mounted. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes",
530 "type": "array",
531 "items": {
532 "type": "string",
533 },
534 },
535 "awsElasticBlockStore": ({
536 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::AWSElasticBlockStoreVolumeSource>();
537 schema_obj.ensure_object().insert("description".into(), "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".into());
538 schema_obj
539 }),
540 "azureDisk": ({
541 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::AzureDiskVolumeSource>();
542 schema_obj.ensure_object().insert("description".into(), "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.".into());
543 schema_obj
544 }),
545 "azureFile": ({
546 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::AzureFilePersistentVolumeSource>();
547 schema_obj.ensure_object().insert("description".into(), "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.".into());
548 schema_obj
549 }),
550 "capacity": {
551 "description": "capacity is the description of the persistent volume's resources and capacity. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity",
552 "type": "object",
553 "additionalProperties": (__gen.subschema_for::<crate::apimachinery::pkg::api::resource::Quantity>()),
554 },
555 "cephfs": ({
556 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::CephFSPersistentVolumeSource>();
557 schema_obj.ensure_object().insert("description".into(), "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.".into());
558 schema_obj
559 }),
560 "cinder": ({
561 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::CinderPersistentVolumeSource>();
562 schema_obj.ensure_object().insert("description".into(), "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".into());
563 schema_obj
564 }),
565 "claimRef": ({
566 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::ObjectReference>();
567 schema_obj.ensure_object().insert("description".into(), "claimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim. Expected to be non-nil when bound. claim.VolumeName is the authoritative bind between PV and PVC. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#binding".into());
568 schema_obj
569 }),
570 "csi": ({
571 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::CSIPersistentVolumeSource>();
572 schema_obj.ensure_object().insert("description".into(), "csi represents storage that is handled by an external CSI driver.".into());
573 schema_obj
574 }),
575 "fc": ({
576 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::FCVolumeSource>();
577 schema_obj.ensure_object().insert("description".into(), "fc represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.".into());
578 schema_obj
579 }),
580 "flexVolume": ({
581 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::FlexPersistentVolumeSource>();
582 schema_obj.ensure_object().insert("description".into(), "flexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. Deprecated: FlexVolume is deprecated. Consider using a CSIDriver instead.".into());
583 schema_obj
584 }),
585 "flocker": ({
586 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::FlockerVolumeSource>();
587 schema_obj.ensure_object().insert("description".into(), "flocker represents a Flocker volume attached to a kubelet's host machine and exposed to the pod for its usage. This depends on the Flocker control service being running. Deprecated: Flocker is deprecated and the in-tree flocker type is no longer supported.".into());
588 schema_obj
589 }),
590 "gcePersistentDisk": ({
591 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::GCEPersistentDiskVolumeSource>();
592 schema_obj.ensure_object().insert("description".into(), "gcePersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Provisioned by an admin. 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".into());
593 schema_obj
594 }),
595 "glusterfs": ({
596 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::GlusterfsPersistentVolumeSource>();
597 schema_obj.ensure_object().insert("description".into(), "glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod. Provisioned by an admin. Deprecated: Glusterfs is deprecated and the in-tree glusterfs type is no longer supported. More info: https://examples.k8s.io/volumes/glusterfs/README.md".into());
598 schema_obj
599 }),
600 "hostPath": ({
601 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::HostPathVolumeSource>();
602 schema_obj.ensure_object().insert("description".into(), "hostPath represents a directory on the host. Provisioned by a developer or tester. This is useful for single-node development and testing only! On-host storage is not supported in any way and WILL NOT WORK in a multi-node cluster. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath".into());
603 schema_obj
604 }),
605 "iscsi": ({
606 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::ISCSIPersistentVolumeSource>();
607 schema_obj.ensure_object().insert("description".into(), "iscsi represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Provisioned by an admin.".into());
608 schema_obj
609 }),
610 "local": ({
611 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::LocalVolumeSource>();
612 schema_obj.ensure_object().insert("description".into(), "local represents directly-attached storage with node affinity".into());
613 schema_obj
614 }),
615 "mountOptions": {
616 "description": "mountOptions is the list of mount options, e.g. [\"ro\", \"soft\"]. Not validated - mount will simply fail if one is invalid. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options",
617 "type": "array",
618 "items": {
619 "type": "string",
620 },
621 },
622 "nfs": ({
623 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::NFSVolumeSource>();
624 schema_obj.ensure_object().insert("description".into(), "nfs represents an NFS mount on the host. Provisioned by an admin. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs".into());
625 schema_obj
626 }),
627 "nodeAffinity": ({
628 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::VolumeNodeAffinity>();
629 schema_obj.ensure_object().insert("description".into(), "nodeAffinity defines constraints that limit what nodes this volume can be accessed from. This field influences the scheduling of pods that use this volume. This field is mutable if MutablePVNodeAffinity feature gate is enabled.".into());
630 schema_obj
631 }),
632 "persistentVolumeReclaimPolicy": {
633 "description": "persistentVolumeReclaimPolicy defines what happens to a persistent volume when released from its claim. Valid options are Retain (default for manually created PersistentVolumes), Delete (default for dynamically provisioned PersistentVolumes), and Recycle (deprecated). Recycle must be supported by the volume plugin underlying this PersistentVolume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#reclaiming",
634 "type": "string",
635 },
636 "photonPersistentDisk": ({
637 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::PhotonPersistentDiskVolumeSource>();
638 schema_obj.ensure_object().insert("description".into(), "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.".into());
639 schema_obj
640 }),
641 "portworxVolume": ({
642 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::PortworxVolumeSource>();
643 schema_obj.ensure_object().insert("description".into(), "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.".into());
644 schema_obj
645 }),
646 "quobyte": ({
647 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::QuobyteVolumeSource>();
648 schema_obj.ensure_object().insert("description".into(), "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.".into());
649 schema_obj
650 }),
651 "rbd": ({
652 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::RBDPersistentVolumeSource>();
653 schema_obj.ensure_object().insert("description".into(), "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".into());
654 schema_obj
655 }),
656 "scaleIO": ({
657 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::ScaleIOPersistentVolumeSource>();
658 schema_obj.ensure_object().insert("description".into(), "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.".into());
659 schema_obj
660 }),
661 "storageClassName": {
662 "description": "storageClassName is the name of StorageClass to which this persistent volume belongs. Empty value means that this volume does not belong to any StorageClass.",
663 "type": "string",
664 },
665 "storageos": ({
666 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::StorageOSPersistentVolumeSource>();
667 schema_obj.ensure_object().insert("description".into(), "storageOS represents a StorageOS volume that is attached to the kubelet's host machine and mounted into the pod. Deprecated: StorageOS is deprecated and the in-tree storageos type is no longer supported. More info: https://examples.k8s.io/volumes/storageos/README.md".into());
668 schema_obj
669 }),
670 "volumeAttributesClassName": {
671 "description": "Name of VolumeAttributesClass to which this persistent volume belongs. Empty value is not allowed. When this field is not set, it indicates that this volume does not belong to any VolumeAttributesClass. This field is mutable and can be changed by the CSI driver after a volume has been updated successfully to a new class. For an unbound PersistentVolume, the volumeAttributesClassName will be matched with unbound PersistentVolumeClaims during the binding process.",
672 "type": "string",
673 },
674 "volumeMode": {
675 "description": "volumeMode defines if a volume is intended to be used with a formatted filesystem or to remain in raw block state. Value of Filesystem is implied when not included in spec.",
676 "type": "string",
677 },
678 "vsphereVolume": ({
679 let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::VsphereVirtualDiskVolumeSource>();
680 schema_obj.ensure_object().insert("description".into(), "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.".into());
681 schema_obj
682 }),
683 },
684 })
685 }
686}