openshift_openapi/v4_5/api/build/v1/
build_config.rs

1// Generated from definition com.github.openshift.api.build.v1.BuildConfig
2
3/// Build configurations define a build process for new container images. There are three types of builds possible - a container image build using a Dockerfile, a Source-to-Image build that uses a specially prepared base image that accepts source code that it can make runnable, and a custom build that can run // arbitrary container images as a base and accept the build parameters. Builds run on the cluster and on completion are pushed to the container image registry specified in the "output" section. A build can be triggered via a webhook, when the base image changes, or when a user manually requests a new build be // created.
4///
5/// Each build created by a build configuration is numbered and refers back to its parent configuration. Multiple builds can be triggered at once. Builds that do not have "output" set can be used to test code or run a verification build.
6#[derive(Clone, Debug, Default, PartialEq)]
7pub struct BuildConfig {
8    /// metadata for BuildConfig.
9    pub metadata: k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta,
10
11    /// spec holds all the input necessary to produce a new build, and the conditions when to trigger them.
12    pub spec: crate::api::build::v1::BuildConfigSpec,
13
14    /// status holds any relevant information about a build config
15    pub status: crate::api::build::v1::BuildConfigStatus,
16}
17
18// Begin build.openshift.io/v1/BuildConfig
19
20// Generated from operation createBuildOpenshiftIoV1NamespacedBuildConfig
21
22impl BuildConfig {
23    /// create a BuildConfig
24    ///
25    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::CreateResponse`]`<Self>>` constructor, or [`k8s_openapi::CreateResponse`]`<Self>` directly, to parse the HTTP response.
26    ///
27    /// # Arguments
28    ///
29    /// * `namespace`
30    ///
31    ///     object name and auth scope, such as for teams and projects
32    ///
33    /// * `body`
34    ///
35    /// * `optional`
36    ///
37    ///     Optional parameters. Use `Default::default()` to not pass any.
38    #[cfg(feature = "api")]
39    pub fn create_namespaced_build_config(
40        namespace: &str,
41        body: &crate::api::build::v1::BuildConfig,
42        optional: k8s_openapi::CreateOptional<'_>,
43    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::CreateResponse<Self>>), k8s_openapi::RequestError> {
44        let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/buildconfigs?",
45            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
46        );
47        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
48        optional.__serialize(&mut __query_pairs);
49        let __url = __query_pairs.finish();
50
51        let __request = http::Request::post(__url);
52        let __body = serde_json::to_vec(body).map_err(k8s_openapi::RequestError::Json)?;
53        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static("application/json"));
54        match __request.body(__body) {
55            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
56            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
57        }
58    }
59}
60
61// Generated from operation deleteBuildOpenshiftIoV1CollectionNamespacedBuildConfig
62
63impl BuildConfig {
64    /// delete collection of BuildConfig
65    ///
66    /// 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.
67    ///
68    /// # Arguments
69    ///
70    /// * `namespace`
71    ///
72    ///     object name and auth scope, such as for teams and projects
73    ///
74    /// * `delete_optional`
75    ///
76    ///     Delete options. Use `Default::default()` to not pass any.
77    ///
78    /// * `list_optional`
79    ///
80    ///     List options. Use `Default::default()` to not pass any.
81    #[cfg(feature = "api")]
82    pub fn delete_collection_namespaced_build_config(
83        namespace: &str,
84        delete_optional: k8s_openapi::DeleteOptional<'_>,
85        list_optional: k8s_openapi::ListOptional<'_>,
86    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::DeleteResponse<k8s_openapi::List<Self>>>), k8s_openapi::RequestError> {
87        let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/buildconfigs?",
88            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
89        );
90        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
91        list_optional.__serialize(&mut __query_pairs);
92        let __url = __query_pairs.finish();
93
94        let __request = http::Request::delete(__url);
95        let __body = serde_json::to_vec(&delete_optional).map_err(k8s_openapi::RequestError::Json)?;
96        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static("application/json"));
97        match __request.body(__body) {
98            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
99            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
100        }
101    }
102}
103
104// Generated from operation deleteBuildOpenshiftIoV1NamespacedBuildConfig
105
106impl BuildConfig {
107    /// delete a BuildConfig
108    ///
109    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::DeleteResponse`]`<Self>>` constructor, or [`k8s_openapi::DeleteResponse`]`<Self>` directly, to parse the HTTP response.
110    ///
111    /// # Arguments
112    ///
113    /// * `name`
114    ///
115    ///     name of the BuildConfig
116    ///
117    /// * `namespace`
118    ///
119    ///     object name and auth scope, such as for teams and projects
120    ///
121    /// * `optional`
122    ///
123    ///     Optional parameters. Use `Default::default()` to not pass any.
124    #[cfg(feature = "api")]
125    pub fn delete_namespaced_build_config(
126        name: &str,
127        namespace: &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/build.openshift.io/v1/namespaces/{namespace}/buildconfigs/{name}",
131            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
132            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
133        );
134
135        let __request = http::Request::delete(__url);
136        let __body = serde_json::to_vec(&optional).map_err(k8s_openapi::RequestError::Json)?;
137        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static("application/json"));
138        match __request.body(__body) {
139            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
140            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
141        }
142    }
143}
144
145// Generated from operation listBuildOpenshiftIoV1BuildConfigForAllNamespaces
146
147impl BuildConfig {
148    /// list or watch objects of kind BuildConfig
149    ///
150    /// This operation only supports listing all items of this type.
151    ///
152    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::ListResponse`]`<Self>>` constructor, or [`k8s_openapi::ListResponse`]`<Self>` directly, to parse the HTTP response.
153    ///
154    /// # Arguments
155    ///
156    /// * `optional`
157    ///
158    ///     Optional parameters. Use `Default::default()` to not pass any.
159    #[cfg(feature = "api")]
160    pub fn list_build_config_for_all_namespaces(
161        optional: k8s_openapi::ListOptional<'_>,
162    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::ListResponse<Self>>), k8s_openapi::RequestError> {
163        let __url = "/apis/build.openshift.io/v1/buildconfigs?".to_owned();
164        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
165        optional.__serialize(&mut __query_pairs);
166        let __url = __query_pairs.finish();
167
168        let __request = http::Request::get(__url);
169        let __body = vec![];
170        match __request.body(__body) {
171            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
172            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
173        }
174    }
175}
176
177// Generated from operation listBuildOpenshiftIoV1NamespacedBuildConfig
178
179impl BuildConfig {
180    /// list or watch objects of kind BuildConfig
181    ///
182    /// This operation only supports listing all items of this type.
183    ///
184    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::ListResponse`]`<Self>>` constructor, or [`k8s_openapi::ListResponse`]`<Self>` directly, to parse the HTTP response.
185    ///
186    /// # Arguments
187    ///
188    /// * `namespace`
189    ///
190    ///     object name and auth scope, such as for teams and projects
191    ///
192    /// * `optional`
193    ///
194    ///     Optional parameters. Use `Default::default()` to not pass any.
195    #[cfg(feature = "api")]
196    pub fn list_namespaced_build_config(
197        namespace: &str,
198        optional: k8s_openapi::ListOptional<'_>,
199    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::ListResponse<Self>>), k8s_openapi::RequestError> {
200        let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/buildconfigs?",
201            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.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::get(__url);
208        let __body = vec![];
209        match __request.body(__body) {
210            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
211            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
212        }
213    }
214}
215
216// Generated from operation patchBuildOpenshiftIoV1NamespacedBuildConfig
217
218impl BuildConfig {
219    /// partially update the specified BuildConfig
220    ///
221    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::PatchResponse`]`<Self>>` constructor, or [`k8s_openapi::PatchResponse`]`<Self>` directly, to parse the HTTP response.
222    ///
223    /// # Arguments
224    ///
225    /// * `name`
226    ///
227    ///     name of the BuildConfig
228    ///
229    /// * `namespace`
230    ///
231    ///     object name and auth scope, such as for teams and projects
232    ///
233    /// * `body`
234    ///
235    /// * `optional`
236    ///
237    ///     Optional parameters. Use `Default::default()` to not pass any.
238    #[cfg(feature = "api")]
239    pub fn patch_namespaced_build_config(
240        name: &str,
241        namespace: &str,
242        body: &k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch,
243        optional: k8s_openapi::PatchOptional<'_>,
244    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::PatchResponse<Self>>), k8s_openapi::RequestError> {
245        let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/buildconfigs/{name}?",
246            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
247            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
248        );
249        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
250        optional.__serialize(&mut __query_pairs);
251        let __url = __query_pairs.finish();
252
253        let __request = http::Request::patch(__url);
254        let __body = serde_json::to_vec(body).map_err(k8s_openapi::RequestError::Json)?;
255        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static(match body {
256            k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json",
257            k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json",
258            k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json",
259        }));
260        match __request.body(__body) {
261            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
262            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
263        }
264    }
265}
266
267// Generated from operation readBuildOpenshiftIoV1NamespacedBuildConfig
268
269impl BuildConfig {
270    /// read the specified BuildConfig
271    ///
272    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`ReadNamespacedBuildConfigResponse`]`>` constructor, or [`ReadNamespacedBuildConfigResponse`] directly, to parse the HTTP response.
273    ///
274    /// # Arguments
275    ///
276    /// * `name`
277    ///
278    ///     name of the BuildConfig
279    ///
280    /// * `namespace`
281    ///
282    ///     object name and auth scope, such as for teams and projects
283    ///
284    /// * `optional`
285    ///
286    ///     Optional parameters. Use `Default::default()` to not pass any.
287    #[cfg(feature = "api")]
288    pub fn read_namespaced_build_config(
289        name: &str,
290        namespace: &str,
291        optional: ReadNamespacedBuildConfigOptional<'_>,
292    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<ReadNamespacedBuildConfigResponse>), k8s_openapi::RequestError> {
293        let ReadNamespacedBuildConfigOptional {
294            exact,
295            export,
296            pretty,
297        } = optional;
298        let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/buildconfigs/{name}?",
299            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
300            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
301        );
302        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
303        if let Some(exact) = exact {
304            __query_pairs.append_pair("exact", &exact.to_string());
305        }
306        if let Some(export) = export {
307            __query_pairs.append_pair("export", &export.to_string());
308        }
309        if let Some(pretty) = pretty {
310            __query_pairs.append_pair("pretty", pretty);
311        }
312        let __url = __query_pairs.finish();
313
314        let __request = http::Request::get(__url);
315        let __body = vec![];
316        match __request.body(__body) {
317            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
318            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
319        }
320    }
321}
322
323/// Optional parameters of [`BuildConfig::read_namespaced_build_config`]
324#[cfg(feature = "api")]
325#[derive(Clone, Copy, Debug, Default)]
326pub struct ReadNamespacedBuildConfigOptional<'a> {
327    /// Should the export be exact.  Exact export maintains cluster-specific fields like 'Namespace'.
328    pub exact: Option<bool>,
329    /// Should this value be exported.  Export strips fields that a user can not specify.
330    pub export: Option<bool>,
331    /// If 'true', then the output is pretty printed.
332    pub pretty: Option<&'a str>,
333}
334
335/// Use `<ReadNamespacedBuildConfigResponse as Response>::try_from_parts` to parse the HTTP response body of [`BuildConfig::read_namespaced_build_config`]
336#[cfg(feature = "api")]
337#[derive(Debug)]
338pub enum ReadNamespacedBuildConfigResponse {
339    Ok(crate::api::build::v1::BuildConfig),
340    Other(Result<Option<serde_json::Value>, serde_json::Error>),
341}
342
343#[cfg(feature = "api")]
344impl k8s_openapi::Response for ReadNamespacedBuildConfigResponse {
345    fn try_from_parts(status_code: http::StatusCode, buf: &[u8]) -> Result<(Self, usize), k8s_openapi::ResponseError> {
346        match status_code {
347            http::StatusCode::OK => {
348                let result = match serde_json::from_slice(buf) {
349                    Ok(value) => value,
350                    Err(ref err) if err.is_eof() => return Err(k8s_openapi::ResponseError::NeedMoreData),
351                    Err(err) => return Err(k8s_openapi::ResponseError::Json(err)),
352                };
353                Ok((ReadNamespacedBuildConfigResponse::Ok(result), buf.len()))
354            },
355            _ => {
356                let (result, read) =
357                    if buf.is_empty() {
358                        (Ok(None), 0)
359                    }
360                    else {
361                        match serde_json::from_slice(buf) {
362                            Ok(value) => (Ok(Some(value)), buf.len()),
363                            Err(ref err) if err.is_eof() => return Err(k8s_openapi::ResponseError::NeedMoreData),
364                            Err(err) => (Err(err), 0),
365                        }
366                    };
367                Ok((ReadNamespacedBuildConfigResponse::Other(result), read))
368            },
369        }
370    }
371}
372
373// Generated from operation replaceBuildOpenshiftIoV1NamespacedBuildConfig
374
375impl BuildConfig {
376    /// replace the specified BuildConfig
377    ///
378    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::ReplaceResponse`]`<Self>>` constructor, or [`k8s_openapi::ReplaceResponse`]`<Self>` directly, to parse the HTTP response.
379    ///
380    /// # Arguments
381    ///
382    /// * `name`
383    ///
384    ///     name of the BuildConfig
385    ///
386    /// * `namespace`
387    ///
388    ///     object name and auth scope, such as for teams and projects
389    ///
390    /// * `body`
391    ///
392    /// * `optional`
393    ///
394    ///     Optional parameters. Use `Default::default()` to not pass any.
395    #[cfg(feature = "api")]
396    pub fn replace_namespaced_build_config(
397        name: &str,
398        namespace: &str,
399        body: &crate::api::build::v1::BuildConfig,
400        optional: k8s_openapi::ReplaceOptional<'_>,
401    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::ReplaceResponse<Self>>), k8s_openapi::RequestError> {
402        let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/buildconfigs/{name}?",
403            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
404            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
405        );
406        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
407        optional.__serialize(&mut __query_pairs);
408        let __url = __query_pairs.finish();
409
410        let __request = http::Request::put(__url);
411        let __body = serde_json::to_vec(body).map_err(k8s_openapi::RequestError::Json)?;
412        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static("application/json"));
413        match __request.body(__body) {
414            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
415            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
416        }
417    }
418}
419
420// Generated from operation watchBuildOpenshiftIoV1BuildConfigForAllNamespaces
421
422impl BuildConfig {
423    /// list or watch objects of kind BuildConfig
424    ///
425    /// This operation only supports watching one item, or a list of items, of this type for changes.
426    ///
427    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::WatchResponse`]`<Self>>` constructor, or [`k8s_openapi::WatchResponse`]`<Self>` directly, to parse the HTTP response.
428    ///
429    /// # Arguments
430    ///
431    /// * `optional`
432    ///
433    ///     Optional parameters. Use `Default::default()` to not pass any.
434    #[cfg(feature = "api")]
435    pub fn watch_build_config_for_all_namespaces(
436        optional: k8s_openapi::WatchOptional<'_>,
437    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::WatchResponse<Self>>), k8s_openapi::RequestError> {
438        let __url = "/apis/build.openshift.io/v1/buildconfigs?".to_owned();
439        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
440        optional.__serialize(&mut __query_pairs);
441        let __url = __query_pairs.finish();
442
443        let __request = http::Request::get(__url);
444        let __body = vec![];
445        match __request.body(__body) {
446            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
447            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
448        }
449    }
450}
451
452// Generated from operation watchBuildOpenshiftIoV1NamespacedBuildConfig
453
454impl BuildConfig {
455    /// list or watch objects of kind BuildConfig
456    ///
457    /// This operation only supports watching one item, or a list of items, of this type for changes.
458    ///
459    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::WatchResponse`]`<Self>>` constructor, or [`k8s_openapi::WatchResponse`]`<Self>` directly, to parse the HTTP response.
460    ///
461    /// # Arguments
462    ///
463    /// * `namespace`
464    ///
465    ///     object name and auth scope, such as for teams and projects
466    ///
467    /// * `optional`
468    ///
469    ///     Optional parameters. Use `Default::default()` to not pass any.
470    #[cfg(feature = "api")]
471    pub fn watch_namespaced_build_config(
472        namespace: &str,
473        optional: k8s_openapi::WatchOptional<'_>,
474    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::WatchResponse<Self>>), k8s_openapi::RequestError> {
475        let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/buildconfigs?",
476            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
477        );
478        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
479        optional.__serialize(&mut __query_pairs);
480        let __url = __query_pairs.finish();
481
482        let __request = http::Request::get(__url);
483        let __body = vec![];
484        match __request.body(__body) {
485            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
486            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
487        }
488    }
489}
490
491// End build.openshift.io/v1/BuildConfig
492
493impl k8s_openapi::Resource for BuildConfig {
494    const API_VERSION: &'static str = "build.openshift.io/v1";
495    const GROUP: &'static str = "build.openshift.io";
496    const KIND: &'static str = "BuildConfig";
497    const VERSION: &'static str = "v1";
498}
499
500impl k8s_openapi::ListableResource for BuildConfig {
501    const LIST_KIND: &'static str = concat!("BuildConfig", "List");
502}
503
504impl k8s_openapi::Metadata for BuildConfig {
505    type Ty = k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta;
506
507    fn metadata(&self) -> &<Self as k8s_openapi::Metadata>::Ty {
508        &self.metadata
509    }
510
511    fn metadata_mut(&mut self) -> &mut<Self as k8s_openapi::Metadata>::Ty {
512        &mut self.metadata
513    }
514}
515
516impl<'de> serde::Deserialize<'de> for BuildConfig {
517    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: serde::Deserializer<'de> {
518        #[allow(non_camel_case_types)]
519        enum Field {
520            Key_api_version,
521            Key_kind,
522            Key_metadata,
523            Key_spec,
524            Key_status,
525            Other,
526        }
527
528        impl<'de> serde::Deserialize<'de> for Field {
529            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: serde::Deserializer<'de> {
530                struct Visitor;
531
532                impl<'de> serde::de::Visitor<'de> for Visitor {
533                    type Value = Field;
534
535                    fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
536                        f.write_str("field identifier")
537                    }
538
539                    fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: serde::de::Error {
540                        Ok(match v {
541                            "apiVersion" => Field::Key_api_version,
542                            "kind" => Field::Key_kind,
543                            "metadata" => Field::Key_metadata,
544                            "spec" => Field::Key_spec,
545                            "status" => Field::Key_status,
546                            _ => Field::Other,
547                        })
548                    }
549                }
550
551                deserializer.deserialize_identifier(Visitor)
552            }
553        }
554
555        struct Visitor;
556
557        impl<'de> serde::de::Visitor<'de> for Visitor {
558            type Value = BuildConfig;
559
560            fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
561                f.write_str(<Self::Value as k8s_openapi::Resource>::KIND)
562            }
563
564            fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: serde::de::MapAccess<'de> {
565                let mut value_metadata: Option<k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta> = None;
566                let mut value_spec: Option<crate::api::build::v1::BuildConfigSpec> = None;
567                let mut value_status: Option<crate::api::build::v1::BuildConfigStatus> = None;
568
569                while let Some(key) = serde::de::MapAccess::next_key::<Field>(&mut map)? {
570                    match key {
571                        Field::Key_api_version => {
572                            let value_api_version: String = serde::de::MapAccess::next_value(&mut map)?;
573                            if value_api_version != <Self::Value as k8s_openapi::Resource>::API_VERSION {
574                                return Err(serde::de::Error::invalid_value(serde::de::Unexpected::Str(&value_api_version), &<Self::Value as k8s_openapi::Resource>::API_VERSION));
575                            }
576                        },
577                        Field::Key_kind => {
578                            let value_kind: String = serde::de::MapAccess::next_value(&mut map)?;
579                            if value_kind != <Self::Value as k8s_openapi::Resource>::KIND {
580                                return Err(serde::de::Error::invalid_value(serde::de::Unexpected::Str(&value_kind), &<Self::Value as k8s_openapi::Resource>::KIND));
581                            }
582                        },
583                        Field::Key_metadata => value_metadata = Some(serde::de::MapAccess::next_value(&mut map)?),
584                        Field::Key_spec => value_spec = Some(serde::de::MapAccess::next_value(&mut map)?),
585                        Field::Key_status => value_status = Some(serde::de::MapAccess::next_value(&mut map)?),
586                        Field::Other => { let _: serde::de::IgnoredAny = serde::de::MapAccess::next_value(&mut map)?; },
587                    }
588                }
589
590                Ok(BuildConfig {
591                    metadata: value_metadata.ok_or_else(|| serde::de::Error::missing_field("metadata"))?,
592                    spec: value_spec.ok_or_else(|| serde::de::Error::missing_field("spec"))?,
593                    status: value_status.ok_or_else(|| serde::de::Error::missing_field("status"))?,
594                })
595            }
596        }
597
598        deserializer.deserialize_struct(
599            <Self as k8s_openapi::Resource>::KIND,
600            &[
601                "apiVersion",
602                "kind",
603                "metadata",
604                "spec",
605                "status",
606            ],
607            Visitor,
608        )
609    }
610}
611
612impl serde::Serialize for BuildConfig {
613    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: serde::Serializer {
614        let mut state = serializer.serialize_struct(
615            <Self as k8s_openapi::Resource>::KIND,
616            5,
617        )?;
618        serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", <Self as k8s_openapi::Resource>::API_VERSION)?;
619        serde::ser::SerializeStruct::serialize_field(&mut state, "kind", <Self as k8s_openapi::Resource>::KIND)?;
620        serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?;
621        serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?;
622        serde::ser::SerializeStruct::serialize_field(&mut state, "status", &self.status)?;
623        serde::ser::SerializeStruct::end(state)
624    }
625}