openshift_openapi/v4_5/api/image/v1/
image.rs

1// Generated from definition com.github.openshift.api.image.v1.Image
2
3/// Image is an immutable representation of a container image and metadata at a point in time.
4#[derive(Clone, Debug, Default, PartialEq)]
5pub struct Image {
6    /// DockerImageConfig is a JSON blob that the runtime uses to set up the container. This is a part of manifest schema v2.
7    pub docker_image_config: Option<String>,
8
9    /// DockerImageLayers represents the layers in the image. May not be set if the image does not define that data.
10    pub docker_image_layers: Vec<crate::api::image::v1::ImageLayer>,
11
12    /// DockerImageManifest is the raw JSON of the manifest
13    pub docker_image_manifest: Option<String>,
14
15    /// DockerImageManifestMediaType specifies the mediaType of manifest. This is a part of manifest schema v2.
16    pub docker_image_manifest_media_type: Option<String>,
17
18    /// DockerImageMetadata contains metadata about this image
19    pub docker_image_metadata: Option<k8s_openapi::apimachinery::pkg::runtime::RawExtension>,
20
21    /// DockerImageMetadataVersion conveys the version of the object, which if empty defaults to "1.0"
22    pub docker_image_metadata_version: Option<String>,
23
24    /// DockerImageReference is the string that can be used to pull this image.
25    pub docker_image_reference: Option<String>,
26
27    /// DockerImageSignatures provides the signatures as opaque blobs. This is a part of manifest schema v1.
28    pub docker_image_signatures: Option<Vec<k8s_openapi::ByteString>>,
29
30    /// Standard object's metadata.
31    pub metadata: k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta,
32
33    /// Signatures holds all signatures of the image.
34    pub signatures: Option<Vec<crate::api::image::v1::ImageSignature>>,
35}
36
37// Begin image.openshift.io/v1/Image
38
39// Generated from operation createImageOpenshiftIoV1Image
40
41impl Image {
42    /// create an Image
43    ///
44    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::CreateResponse`]`<Self>>` constructor, or [`k8s_openapi::CreateResponse`]`<Self>` directly, to parse the HTTP response.
45    ///
46    /// # Arguments
47    ///
48    /// * `body`
49    ///
50    /// * `optional`
51    ///
52    ///     Optional parameters. Use `Default::default()` to not pass any.
53    #[cfg(feature = "api")]
54    pub fn create_image(
55        body: &crate::api::image::v1::Image,
56        optional: k8s_openapi::CreateOptional<'_>,
57    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::CreateResponse<Self>>), k8s_openapi::RequestError> {
58        let __url = "/apis/image.openshift.io/v1/images?".to_owned();
59        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
60        optional.__serialize(&mut __query_pairs);
61        let __url = __query_pairs.finish();
62
63        let __request = http::Request::post(__url);
64        let __body = serde_json::to_vec(body).map_err(k8s_openapi::RequestError::Json)?;
65        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static("application/json"));
66        match __request.body(__body) {
67            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
68            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
69        }
70    }
71}
72
73// Generated from operation deleteImageOpenshiftIoV1CollectionImage
74
75impl Image {
76    /// delete collection of Image
77    ///
78    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::DeleteResponse`]`<`[`k8s_openapi::List`]`<Self>>>` constructor, or [`k8s_openapi::DeleteResponse`]`<`[`k8s_openapi::List`]`<Self>>` directly, to parse the HTTP response.
79    ///
80    /// # Arguments
81    ///
82    /// * `delete_optional`
83    ///
84    ///     Delete options. Use `Default::default()` to not pass any.
85    ///
86    /// * `list_optional`
87    ///
88    ///     List options. Use `Default::default()` to not pass any.
89    #[cfg(feature = "api")]
90    pub fn delete_collection_image(
91        delete_optional: k8s_openapi::DeleteOptional<'_>,
92        list_optional: k8s_openapi::ListOptional<'_>,
93    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::DeleteResponse<k8s_openapi::List<Self>>>), k8s_openapi::RequestError> {
94        let __url = "/apis/image.openshift.io/v1/images?".to_owned();
95        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
96        list_optional.__serialize(&mut __query_pairs);
97        let __url = __query_pairs.finish();
98
99        let __request = http::Request::delete(__url);
100        let __body = serde_json::to_vec(&delete_optional).map_err(k8s_openapi::RequestError::Json)?;
101        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static("application/json"));
102        match __request.body(__body) {
103            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
104            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
105        }
106    }
107}
108
109// Generated from operation deleteImageOpenshiftIoV1Image
110
111impl Image {
112    /// delete an Image
113    ///
114    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::DeleteResponse`]`<Self>>` constructor, or [`k8s_openapi::DeleteResponse`]`<Self>` directly, to parse the HTTP response.
115    ///
116    /// # Arguments
117    ///
118    /// * `name`
119    ///
120    ///     name of the Image
121    ///
122    /// * `optional`
123    ///
124    ///     Optional parameters. Use `Default::default()` to not pass any.
125    #[cfg(feature = "api")]
126    pub fn delete_image(
127        name: &str,
128        optional: k8s_openapi::DeleteOptional<'_>,
129    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::DeleteResponse<Self>>), k8s_openapi::RequestError> {
130        let __url = format!("/apis/image.openshift.io/v1/images/{name}",
131            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
132        );
133
134        let __request = http::Request::delete(__url);
135        let __body = serde_json::to_vec(&optional).map_err(k8s_openapi::RequestError::Json)?;
136        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static("application/json"));
137        match __request.body(__body) {
138            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
139            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
140        }
141    }
142}
143
144// Generated from operation listImageOpenshiftIoV1Image
145
146impl Image {
147    /// list or watch objects of kind Image
148    ///
149    /// This operation only supports listing all items of this type.
150    ///
151    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::ListResponse`]`<Self>>` constructor, or [`k8s_openapi::ListResponse`]`<Self>` directly, to parse the HTTP response.
152    ///
153    /// # Arguments
154    ///
155    /// * `optional`
156    ///
157    ///     Optional parameters. Use `Default::default()` to not pass any.
158    #[cfg(feature = "api")]
159    pub fn list_image(
160        optional: k8s_openapi::ListOptional<'_>,
161    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::ListResponse<Self>>), k8s_openapi::RequestError> {
162        let __url = "/apis/image.openshift.io/v1/images?".to_owned();
163        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
164        optional.__serialize(&mut __query_pairs);
165        let __url = __query_pairs.finish();
166
167        let __request = http::Request::get(__url);
168        let __body = vec![];
169        match __request.body(__body) {
170            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
171            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
172        }
173    }
174}
175
176// Generated from operation patchImageOpenshiftIoV1Image
177
178impl Image {
179    /// partially update the specified Image
180    ///
181    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::PatchResponse`]`<Self>>` constructor, or [`k8s_openapi::PatchResponse`]`<Self>` directly, to parse the HTTP response.
182    ///
183    /// # Arguments
184    ///
185    /// * `name`
186    ///
187    ///     name of the Image
188    ///
189    /// * `body`
190    ///
191    /// * `optional`
192    ///
193    ///     Optional parameters. Use `Default::default()` to not pass any.
194    #[cfg(feature = "api")]
195    pub fn patch_image(
196        name: &str,
197        body: &k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch,
198        optional: k8s_openapi::PatchOptional<'_>,
199    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::PatchResponse<Self>>), k8s_openapi::RequestError> {
200        let __url = format!("/apis/image.openshift.io/v1/images/{name}?",
201            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
202        );
203        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
204        optional.__serialize(&mut __query_pairs);
205        let __url = __query_pairs.finish();
206
207        let __request = http::Request::patch(__url);
208        let __body = serde_json::to_vec(body).map_err(k8s_openapi::RequestError::Json)?;
209        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static(match body {
210            k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json",
211            k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json",
212            k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json",
213        }));
214        match __request.body(__body) {
215            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
216            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
217        }
218    }
219}
220
221// Generated from operation readImageOpenshiftIoV1Image
222
223impl Image {
224    /// read the specified Image
225    ///
226    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`ReadImageResponse`]`>` constructor, or [`ReadImageResponse`] directly, to parse the HTTP response.
227    ///
228    /// # Arguments
229    ///
230    /// * `name`
231    ///
232    ///     name of the Image
233    ///
234    /// * `optional`
235    ///
236    ///     Optional parameters. Use `Default::default()` to not pass any.
237    #[cfg(feature = "api")]
238    pub fn read_image(
239        name: &str,
240        optional: ReadImageOptional<'_>,
241    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<ReadImageResponse>), k8s_openapi::RequestError> {
242        let ReadImageOptional {
243            exact,
244            export,
245            pretty,
246        } = optional;
247        let __url = format!("/apis/image.openshift.io/v1/images/{name}?",
248            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
249        );
250        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
251        if let Some(exact) = exact {
252            __query_pairs.append_pair("exact", &exact.to_string());
253        }
254        if let Some(export) = export {
255            __query_pairs.append_pair("export", &export.to_string());
256        }
257        if let Some(pretty) = pretty {
258            __query_pairs.append_pair("pretty", pretty);
259        }
260        let __url = __query_pairs.finish();
261
262        let __request = http::Request::get(__url);
263        let __body = vec![];
264        match __request.body(__body) {
265            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
266            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
267        }
268    }
269}
270
271/// Optional parameters of [`Image::read_image`]
272#[cfg(feature = "api")]
273#[derive(Clone, Copy, Debug, Default)]
274pub struct ReadImageOptional<'a> {
275    /// Should the export be exact.  Exact export maintains cluster-specific fields like 'Namespace'.
276    pub exact: Option<bool>,
277    /// Should this value be exported.  Export strips fields that a user can not specify.
278    pub export: Option<bool>,
279    /// If 'true', then the output is pretty printed.
280    pub pretty: Option<&'a str>,
281}
282
283/// Use `<ReadImageResponse as Response>::try_from_parts` to parse the HTTP response body of [`Image::read_image`]
284#[cfg(feature = "api")]
285#[derive(Debug)]
286pub enum ReadImageResponse {
287    Ok(crate::api::image::v1::Image),
288    Other(Result<Option<serde_json::Value>, serde_json::Error>),
289}
290
291#[cfg(feature = "api")]
292impl k8s_openapi::Response for ReadImageResponse {
293    fn try_from_parts(status_code: http::StatusCode, buf: &[u8]) -> Result<(Self, usize), k8s_openapi::ResponseError> {
294        match status_code {
295            http::StatusCode::OK => {
296                let result = match serde_json::from_slice(buf) {
297                    Ok(value) => value,
298                    Err(ref err) if err.is_eof() => return Err(k8s_openapi::ResponseError::NeedMoreData),
299                    Err(err) => return Err(k8s_openapi::ResponseError::Json(err)),
300                };
301                Ok((ReadImageResponse::Ok(result), buf.len()))
302            },
303            _ => {
304                let (result, read) =
305                    if buf.is_empty() {
306                        (Ok(None), 0)
307                    }
308                    else {
309                        match serde_json::from_slice(buf) {
310                            Ok(value) => (Ok(Some(value)), buf.len()),
311                            Err(ref err) if err.is_eof() => return Err(k8s_openapi::ResponseError::NeedMoreData),
312                            Err(err) => (Err(err), 0),
313                        }
314                    };
315                Ok((ReadImageResponse::Other(result), read))
316            },
317        }
318    }
319}
320
321// Generated from operation replaceImageOpenshiftIoV1Image
322
323impl Image {
324    /// replace the specified Image
325    ///
326    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::ReplaceResponse`]`<Self>>` constructor, or [`k8s_openapi::ReplaceResponse`]`<Self>` directly, to parse the HTTP response.
327    ///
328    /// # Arguments
329    ///
330    /// * `name`
331    ///
332    ///     name of the Image
333    ///
334    /// * `body`
335    ///
336    /// * `optional`
337    ///
338    ///     Optional parameters. Use `Default::default()` to not pass any.
339    #[cfg(feature = "api")]
340    pub fn replace_image(
341        name: &str,
342        body: &crate::api::image::v1::Image,
343        optional: k8s_openapi::ReplaceOptional<'_>,
344    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::ReplaceResponse<Self>>), k8s_openapi::RequestError> {
345        let __url = format!("/apis/image.openshift.io/v1/images/{name}?",
346            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
347        );
348        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
349        optional.__serialize(&mut __query_pairs);
350        let __url = __query_pairs.finish();
351
352        let __request = http::Request::put(__url);
353        let __body = serde_json::to_vec(body).map_err(k8s_openapi::RequestError::Json)?;
354        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static("application/json"));
355        match __request.body(__body) {
356            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
357            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
358        }
359    }
360}
361
362// Generated from operation watchImageOpenshiftIoV1Image
363
364impl Image {
365    /// list or watch objects of kind Image
366    ///
367    /// This operation only supports watching one item, or a list of items, of this type for changes.
368    ///
369    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::WatchResponse`]`<Self>>` constructor, or [`k8s_openapi::WatchResponse`]`<Self>` directly, to parse the HTTP response.
370    ///
371    /// # Arguments
372    ///
373    /// * `optional`
374    ///
375    ///     Optional parameters. Use `Default::default()` to not pass any.
376    #[cfg(feature = "api")]
377    pub fn watch_image(
378        optional: k8s_openapi::WatchOptional<'_>,
379    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::WatchResponse<Self>>), k8s_openapi::RequestError> {
380        let __url = "/apis/image.openshift.io/v1/images?".to_owned();
381        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
382        optional.__serialize(&mut __query_pairs);
383        let __url = __query_pairs.finish();
384
385        let __request = http::Request::get(__url);
386        let __body = vec![];
387        match __request.body(__body) {
388            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
389            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
390        }
391    }
392}
393
394// End image.openshift.io/v1/Image
395
396impl k8s_openapi::Resource for Image {
397    const API_VERSION: &'static str = "image.openshift.io/v1";
398    const GROUP: &'static str = "image.openshift.io";
399    const KIND: &'static str = "Image";
400    const VERSION: &'static str = "v1";
401}
402
403impl k8s_openapi::ListableResource for Image {
404    const LIST_KIND: &'static str = concat!("Image", "List");
405}
406
407impl k8s_openapi::Metadata for Image {
408    type Ty = k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta;
409
410    fn metadata(&self) -> &<Self as k8s_openapi::Metadata>::Ty {
411        &self.metadata
412    }
413
414    fn metadata_mut(&mut self) -> &mut<Self as k8s_openapi::Metadata>::Ty {
415        &mut self.metadata
416    }
417}
418
419impl<'de> serde::Deserialize<'de> for Image {
420    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: serde::Deserializer<'de> {
421        #[allow(non_camel_case_types)]
422        enum Field {
423            Key_api_version,
424            Key_kind,
425            Key_docker_image_config,
426            Key_docker_image_layers,
427            Key_docker_image_manifest,
428            Key_docker_image_manifest_media_type,
429            Key_docker_image_metadata,
430            Key_docker_image_metadata_version,
431            Key_docker_image_reference,
432            Key_docker_image_signatures,
433            Key_metadata,
434            Key_signatures,
435            Other,
436        }
437
438        impl<'de> serde::Deserialize<'de> for Field {
439            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: serde::Deserializer<'de> {
440                struct Visitor;
441
442                impl<'de> serde::de::Visitor<'de> for Visitor {
443                    type Value = Field;
444
445                    fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
446                        f.write_str("field identifier")
447                    }
448
449                    fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: serde::de::Error {
450                        Ok(match v {
451                            "apiVersion" => Field::Key_api_version,
452                            "kind" => Field::Key_kind,
453                            "dockerImageConfig" => Field::Key_docker_image_config,
454                            "dockerImageLayers" => Field::Key_docker_image_layers,
455                            "dockerImageManifest" => Field::Key_docker_image_manifest,
456                            "dockerImageManifestMediaType" => Field::Key_docker_image_manifest_media_type,
457                            "dockerImageMetadata" => Field::Key_docker_image_metadata,
458                            "dockerImageMetadataVersion" => Field::Key_docker_image_metadata_version,
459                            "dockerImageReference" => Field::Key_docker_image_reference,
460                            "dockerImageSignatures" => Field::Key_docker_image_signatures,
461                            "metadata" => Field::Key_metadata,
462                            "signatures" => Field::Key_signatures,
463                            _ => Field::Other,
464                        })
465                    }
466                }
467
468                deserializer.deserialize_identifier(Visitor)
469            }
470        }
471
472        struct Visitor;
473
474        impl<'de> serde::de::Visitor<'de> for Visitor {
475            type Value = Image;
476
477            fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
478                f.write_str(<Self::Value as k8s_openapi::Resource>::KIND)
479            }
480
481            fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: serde::de::MapAccess<'de> {
482                let mut value_docker_image_config: Option<String> = None;
483                let mut value_docker_image_layers: Option<Vec<crate::api::image::v1::ImageLayer>> = None;
484                let mut value_docker_image_manifest: Option<String> = None;
485                let mut value_docker_image_manifest_media_type: Option<String> = None;
486                let mut value_docker_image_metadata: Option<k8s_openapi::apimachinery::pkg::runtime::RawExtension> = None;
487                let mut value_docker_image_metadata_version: Option<String> = None;
488                let mut value_docker_image_reference: Option<String> = None;
489                let mut value_docker_image_signatures: Option<Vec<k8s_openapi::ByteString>> = None;
490                let mut value_metadata: Option<k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta> = None;
491                let mut value_signatures: Option<Vec<crate::api::image::v1::ImageSignature>> = None;
492
493                while let Some(key) = serde::de::MapAccess::next_key::<Field>(&mut map)? {
494                    match key {
495                        Field::Key_api_version => {
496                            let value_api_version: String = serde::de::MapAccess::next_value(&mut map)?;
497                            if value_api_version != <Self::Value as k8s_openapi::Resource>::API_VERSION {
498                                return Err(serde::de::Error::invalid_value(serde::de::Unexpected::Str(&value_api_version), &<Self::Value as k8s_openapi::Resource>::API_VERSION));
499                            }
500                        },
501                        Field::Key_kind => {
502                            let value_kind: String = serde::de::MapAccess::next_value(&mut map)?;
503                            if value_kind != <Self::Value as k8s_openapi::Resource>::KIND {
504                                return Err(serde::de::Error::invalid_value(serde::de::Unexpected::Str(&value_kind), &<Self::Value as k8s_openapi::Resource>::KIND));
505                            }
506                        },
507                        Field::Key_docker_image_config => value_docker_image_config = serde::de::MapAccess::next_value(&mut map)?,
508                        Field::Key_docker_image_layers => value_docker_image_layers = Some(serde::de::MapAccess::next_value(&mut map)?),
509                        Field::Key_docker_image_manifest => value_docker_image_manifest = serde::de::MapAccess::next_value(&mut map)?,
510                        Field::Key_docker_image_manifest_media_type => value_docker_image_manifest_media_type = serde::de::MapAccess::next_value(&mut map)?,
511                        Field::Key_docker_image_metadata => value_docker_image_metadata = serde::de::MapAccess::next_value(&mut map)?,
512                        Field::Key_docker_image_metadata_version => value_docker_image_metadata_version = serde::de::MapAccess::next_value(&mut map)?,
513                        Field::Key_docker_image_reference => value_docker_image_reference = serde::de::MapAccess::next_value(&mut map)?,
514                        Field::Key_docker_image_signatures => value_docker_image_signatures = serde::de::MapAccess::next_value(&mut map)?,
515                        Field::Key_metadata => value_metadata = Some(serde::de::MapAccess::next_value(&mut map)?),
516                        Field::Key_signatures => value_signatures = serde::de::MapAccess::next_value(&mut map)?,
517                        Field::Other => { let _: serde::de::IgnoredAny = serde::de::MapAccess::next_value(&mut map)?; },
518                    }
519                }
520
521                Ok(Image {
522                    docker_image_config: value_docker_image_config,
523                    docker_image_layers: value_docker_image_layers.ok_or_else(|| serde::de::Error::missing_field("dockerImageLayers"))?,
524                    docker_image_manifest: value_docker_image_manifest,
525                    docker_image_manifest_media_type: value_docker_image_manifest_media_type,
526                    docker_image_metadata: value_docker_image_metadata,
527                    docker_image_metadata_version: value_docker_image_metadata_version,
528                    docker_image_reference: value_docker_image_reference,
529                    docker_image_signatures: value_docker_image_signatures,
530                    metadata: value_metadata.ok_or_else(|| serde::de::Error::missing_field("metadata"))?,
531                    signatures: value_signatures,
532                })
533            }
534        }
535
536        deserializer.deserialize_struct(
537            <Self as k8s_openapi::Resource>::KIND,
538            &[
539                "apiVersion",
540                "kind",
541                "dockerImageConfig",
542                "dockerImageLayers",
543                "dockerImageManifest",
544                "dockerImageManifestMediaType",
545                "dockerImageMetadata",
546                "dockerImageMetadataVersion",
547                "dockerImageReference",
548                "dockerImageSignatures",
549                "metadata",
550                "signatures",
551            ],
552            Visitor,
553        )
554    }
555}
556
557impl serde::Serialize for Image {
558    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: serde::Serializer {
559        let mut state = serializer.serialize_struct(
560            <Self as k8s_openapi::Resource>::KIND,
561            4 +
562            self.docker_image_config.as_ref().map_or(0, |_| 1) +
563            self.docker_image_manifest.as_ref().map_or(0, |_| 1) +
564            self.docker_image_manifest_media_type.as_ref().map_or(0, |_| 1) +
565            self.docker_image_metadata.as_ref().map_or(0, |_| 1) +
566            self.docker_image_metadata_version.as_ref().map_or(0, |_| 1) +
567            self.docker_image_reference.as_ref().map_or(0, |_| 1) +
568            self.docker_image_signatures.as_ref().map_or(0, |_| 1) +
569            self.signatures.as_ref().map_or(0, |_| 1),
570        )?;
571        serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", <Self as k8s_openapi::Resource>::API_VERSION)?;
572        serde::ser::SerializeStruct::serialize_field(&mut state, "kind", <Self as k8s_openapi::Resource>::KIND)?;
573        if let Some(value) = &self.docker_image_config {
574            serde::ser::SerializeStruct::serialize_field(&mut state, "dockerImageConfig", value)?;
575        }
576        serde::ser::SerializeStruct::serialize_field(&mut state, "dockerImageLayers", &self.docker_image_layers)?;
577        if let Some(value) = &self.docker_image_manifest {
578            serde::ser::SerializeStruct::serialize_field(&mut state, "dockerImageManifest", value)?;
579        }
580        if let Some(value) = &self.docker_image_manifest_media_type {
581            serde::ser::SerializeStruct::serialize_field(&mut state, "dockerImageManifestMediaType", value)?;
582        }
583        if let Some(value) = &self.docker_image_metadata {
584            serde::ser::SerializeStruct::serialize_field(&mut state, "dockerImageMetadata", value)?;
585        }
586        if let Some(value) = &self.docker_image_metadata_version {
587            serde::ser::SerializeStruct::serialize_field(&mut state, "dockerImageMetadataVersion", value)?;
588        }
589        if let Some(value) = &self.docker_image_reference {
590            serde::ser::SerializeStruct::serialize_field(&mut state, "dockerImageReference", value)?;
591        }
592        if let Some(value) = &self.docker_image_signatures {
593            serde::ser::SerializeStruct::serialize_field(&mut state, "dockerImageSignatures", value)?;
594        }
595        serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?;
596        if let Some(value) = &self.signatures {
597            serde::ser::SerializeStruct::serialize_field(&mut state, "signatures", value)?;
598        }
599        serde::ser::SerializeStruct::end(state)
600    }
601}