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

1// Generated from definition com.github.openshift.api.build.v1.Build
2
3/// Build encapsulates the inputs needed to produce a new deployable image, as well as the status of the execution and a reference to the Pod which executed the build.
4#[derive(Clone, Debug, Default, PartialEq)]
5pub struct Build {
6    /// Standard object's metadata.
7    pub metadata: k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta,
8
9    /// spec is all the inputs used to execute the build.
10    pub spec: Option<crate::api::build::v1::BuildSpec>,
11
12    /// status is the current status of the build.
13    pub status: Option<crate::api::build::v1::BuildStatus>,
14}
15
16// Begin build.openshift.io/v1/Build
17
18// Generated from operation connectBuildOpenshiftIoV1PostNamespacedBuildConfigInstantiatebinary
19
20impl Build {
21    /// connect POST requests to instantiatebinary of BuildConfig
22    ///
23    /// # Arguments
24    ///
25    /// * `name`
26    ///
27    ///     name of the BinaryBuildRequestOptions
28    ///
29    /// * `namespace`
30    ///
31    ///     object name and auth scope, such as for teams and projects
32    ///
33    /// * `optional`
34    ///
35    ///     Optional parameters. Use `Default::default()` to not pass any.
36    #[cfg(feature = "api")]
37    pub fn connect_post_namespaced_build_config_instantiatebinary(
38        name: &str,
39        namespace: &str,
40        optional: ConnectPostNamespacedBuildConfigInstantiatebinaryOptional<'_>,
41    ) -> Result<http::Request<Vec<u8>>, k8s_openapi::RequestError> {
42        let ConnectPostNamespacedBuildConfigInstantiatebinaryOptional {
43            as_file,
44            revision_author_email,
45            revision_author_name,
46            revision_commit,
47            revision_committer_email,
48            revision_committer_name,
49            revision_message,
50        } = optional;
51        let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/buildconfigs/{name}/instantiatebinary?",
52            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
53            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
54        );
55        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
56        if let Some(as_file) = as_file {
57            __query_pairs.append_pair("asFile", as_file);
58        }
59        if let Some(revision_author_email) = revision_author_email {
60            __query_pairs.append_pair("revision.authorEmail", revision_author_email);
61        }
62        if let Some(revision_author_name) = revision_author_name {
63            __query_pairs.append_pair("revision.authorName", revision_author_name);
64        }
65        if let Some(revision_commit) = revision_commit {
66            __query_pairs.append_pair("revision.commit", revision_commit);
67        }
68        if let Some(revision_committer_email) = revision_committer_email {
69            __query_pairs.append_pair("revision.committerEmail", revision_committer_email);
70        }
71        if let Some(revision_committer_name) = revision_committer_name {
72            __query_pairs.append_pair("revision.committerName", revision_committer_name);
73        }
74        if let Some(revision_message) = revision_message {
75            __query_pairs.append_pair("revision.message", revision_message);
76        }
77        let __url = __query_pairs.finish();
78
79        let __request = http::Request::post(__url);
80        let __body = vec![];
81        __request.body(__body).map_err(k8s_openapi::RequestError::Http)
82    }
83}
84
85/// Optional parameters of [`Build::connect_post_namespaced_build_config_instantiatebinary`]
86#[cfg(feature = "api")]
87#[derive(Clone, Copy, Debug, Default)]
88pub struct ConnectPostNamespacedBuildConfigInstantiatebinaryOptional<'a> {
89    /// asFile determines if the binary should be created as a file within the source rather than extracted as an archive
90    pub as_file: Option<&'a str>,
91    /// revision.authorEmail of the source control user
92    pub revision_author_email: Option<&'a str>,
93    /// revision.authorName of the source control user
94    pub revision_author_name: Option<&'a str>,
95    /// revision.commit is the value identifying a specific commit
96    pub revision_commit: Option<&'a str>,
97    /// revision.committerEmail of the source control user
98    pub revision_committer_email: Option<&'a str>,
99    /// revision.committerName of the source control user
100    pub revision_committer_name: Option<&'a str>,
101    /// revision.message is the description of a specific commit
102    pub revision_message: Option<&'a str>,
103}
104
105// Generated from operation connectBuildOpenshiftIoV1PostNamespacedBuildConfigWebhooks
106
107impl Build {
108    /// connect POST requests to webhooks of BuildConfig
109    ///
110    /// # Arguments
111    ///
112    /// * `name`
113    ///
114    ///     name of the Build
115    ///
116    /// * `namespace`
117    ///
118    ///     object name and auth scope, such as for teams and projects
119    ///
120    /// * `optional`
121    ///
122    ///     Optional parameters. Use `Default::default()` to not pass any.
123    #[cfg(feature = "api")]
124    pub fn connect_post_namespaced_build_config_webhooks(
125        name: &str,
126        namespace: &str,
127        optional: ConnectPostNamespacedBuildConfigWebhooksOptional<'_>,
128    ) -> Result<http::Request<Vec<u8>>, k8s_openapi::RequestError> {
129        let ConnectPostNamespacedBuildConfigWebhooksOptional {
130            path,
131        } = optional;
132        let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/buildconfigs/{name}/webhooks?",
133            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
134            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
135        );
136        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
137        if let Some(path) = path {
138            __query_pairs.append_pair("path", path);
139        }
140        let __url = __query_pairs.finish();
141
142        let __request = http::Request::post(__url);
143        let __body = vec![];
144        __request.body(__body).map_err(k8s_openapi::RequestError::Http)
145    }
146}
147
148/// Optional parameters of [`Build::connect_post_namespaced_build_config_webhooks`]
149#[cfg(feature = "api")]
150#[derive(Clone, Copy, Debug, Default)]
151pub struct ConnectPostNamespacedBuildConfigWebhooksOptional<'a> {
152    /// Path is the URL path to use for the current proxy request to pod.
153    pub path: Option<&'a str>,
154}
155
156// Generated from operation connectBuildOpenshiftIoV1PostNamespacedBuildConfigWebhooksWithPath
157
158impl Build {
159    /// connect POST requests to webhooks of BuildConfig
160    ///
161    /// # Arguments
162    ///
163    /// * `name`
164    ///
165    ///     name of the Build
166    ///
167    /// * `namespace`
168    ///
169    ///     object name and auth scope, such as for teams and projects
170    ///
171    /// * `path`
172    ///
173    ///     path to the resource
174    ///
175    /// * `optional`
176    ///
177    ///     Optional parameters. Use `Default::default()` to not pass any.
178    #[cfg(feature = "api")]
179    pub fn connect_post_namespaced_build_config_webhooks_with_path(
180        name: &str,
181        namespace: &str,
182        path: &str,
183        optional: ConnectPostNamespacedBuildConfigWebhooksWithPathOptional<'_>,
184    ) -> Result<http::Request<Vec<u8>>, k8s_openapi::RequestError> {
185        let ConnectPostNamespacedBuildConfigWebhooksWithPathOptional {
186            path_,
187        } = optional;
188        let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/buildconfigs/{name}/webhooks/{path}?",
189            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
190            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
191            path = k8s_openapi::percent_encoding::percent_encode(path.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
192        );
193        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
194        if let Some(path_) = path_ {
195            __query_pairs.append_pair("path", path_);
196        }
197        let __url = __query_pairs.finish();
198
199        let __request = http::Request::post(__url);
200        let __body = vec![];
201        __request.body(__body).map_err(k8s_openapi::RequestError::Http)
202    }
203}
204
205/// Optional parameters of [`Build::connect_post_namespaced_build_config_webhooks_with_path`]
206#[cfg(feature = "api")]
207#[derive(Clone, Copy, Debug, Default)]
208pub struct ConnectPostNamespacedBuildConfigWebhooksWithPathOptional<'a> {
209    /// Path is the URL path to use for the current proxy request to pod.
210    pub path_: Option<&'a str>,
211}
212
213// Generated from operation createBuildOpenshiftIoV1NamespacedBuild
214
215impl Build {
216    /// create a Build
217    ///
218    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::CreateResponse`]`<Self>>` constructor, or [`k8s_openapi::CreateResponse`]`<Self>` directly, to parse the HTTP response.
219    ///
220    /// # Arguments
221    ///
222    /// * `namespace`
223    ///
224    ///     object name and auth scope, such as for teams and projects
225    ///
226    /// * `body`
227    ///
228    /// * `optional`
229    ///
230    ///     Optional parameters. Use `Default::default()` to not pass any.
231    #[cfg(feature = "api")]
232    pub fn create_namespaced_build(
233        namespace: &str,
234        body: &crate::api::build::v1::Build,
235        optional: k8s_openapi::CreateOptional<'_>,
236    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::CreateResponse<Self>>), k8s_openapi::RequestError> {
237        let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/builds?",
238            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
239        );
240        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
241        optional.__serialize(&mut __query_pairs);
242        let __url = __query_pairs.finish();
243
244        let __request = http::Request::post(__url);
245        let __body = serde_json::to_vec(body).map_err(k8s_openapi::RequestError::Json)?;
246        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static("application/json"));
247        match __request.body(__body) {
248            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
249            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
250        }
251    }
252}
253
254// Generated from operation deleteBuildOpenshiftIoV1CollectionNamespacedBuild
255
256impl Build {
257    /// delete collection of Build
258    ///
259    /// 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.
260    ///
261    /// # Arguments
262    ///
263    /// * `namespace`
264    ///
265    ///     object name and auth scope, such as for teams and projects
266    ///
267    /// * `delete_optional`
268    ///
269    ///     Delete options. Use `Default::default()` to not pass any.
270    ///
271    /// * `list_optional`
272    ///
273    ///     List options. Use `Default::default()` to not pass any.
274    #[cfg(feature = "api")]
275    pub fn delete_collection_namespaced_build(
276        namespace: &str,
277        delete_optional: k8s_openapi::DeleteOptional<'_>,
278        list_optional: k8s_openapi::ListOptional<'_>,
279    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::DeleteResponse<k8s_openapi::List<Self>>>), k8s_openapi::RequestError> {
280        let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/builds?",
281            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
282        );
283        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
284        list_optional.__serialize(&mut __query_pairs);
285        let __url = __query_pairs.finish();
286
287        let __request = http::Request::delete(__url);
288        let __body = serde_json::to_vec(&delete_optional).map_err(k8s_openapi::RequestError::Json)?;
289        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static("application/json"));
290        match __request.body(__body) {
291            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
292            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
293        }
294    }
295}
296
297// Generated from operation deleteBuildOpenshiftIoV1NamespacedBuild
298
299impl Build {
300    /// delete a Build
301    ///
302    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::DeleteResponse`]`<Self>>` constructor, or [`k8s_openapi::DeleteResponse`]`<Self>` directly, to parse the HTTP response.
303    ///
304    /// # Arguments
305    ///
306    /// * `name`
307    ///
308    ///     name of the Build
309    ///
310    /// * `namespace`
311    ///
312    ///     object name and auth scope, such as for teams and projects
313    ///
314    /// * `optional`
315    ///
316    ///     Optional parameters. Use `Default::default()` to not pass any.
317    #[cfg(feature = "api")]
318    pub fn delete_namespaced_build(
319        name: &str,
320        namespace: &str,
321        optional: k8s_openapi::DeleteOptional<'_>,
322    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::DeleteResponse<Self>>), k8s_openapi::RequestError> {
323        let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/builds/{name}",
324            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
325            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
326        );
327
328        let __request = http::Request::delete(__url);
329        let __body = serde_json::to_vec(&optional).map_err(k8s_openapi::RequestError::Json)?;
330        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static("application/json"));
331        match __request.body(__body) {
332            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
333            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
334        }
335    }
336}
337
338// Generated from operation listBuildOpenshiftIoV1BuildForAllNamespaces
339
340impl Build {
341    /// list or watch objects of kind Build
342    ///
343    /// This operation only supports listing all items of this type.
344    ///
345    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::ListResponse`]`<Self>>` constructor, or [`k8s_openapi::ListResponse`]`<Self>` directly, to parse the HTTP response.
346    ///
347    /// # Arguments
348    ///
349    /// * `optional`
350    ///
351    ///     Optional parameters. Use `Default::default()` to not pass any.
352    #[cfg(feature = "api")]
353    pub fn list_build_for_all_namespaces(
354        optional: k8s_openapi::ListOptional<'_>,
355    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::ListResponse<Self>>), k8s_openapi::RequestError> {
356        let __url = "/apis/build.openshift.io/v1/builds?".to_owned();
357        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
358        optional.__serialize(&mut __query_pairs);
359        let __url = __query_pairs.finish();
360
361        let __request = http::Request::get(__url);
362        let __body = vec![];
363        match __request.body(__body) {
364            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
365            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
366        }
367    }
368}
369
370// Generated from operation listBuildOpenshiftIoV1NamespacedBuild
371
372impl Build {
373    /// list or watch objects of kind Build
374    ///
375    /// This operation only supports listing all items of this type.
376    ///
377    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::ListResponse`]`<Self>>` constructor, or [`k8s_openapi::ListResponse`]`<Self>` directly, to parse the HTTP response.
378    ///
379    /// # Arguments
380    ///
381    /// * `namespace`
382    ///
383    ///     object name and auth scope, such as for teams and projects
384    ///
385    /// * `optional`
386    ///
387    ///     Optional parameters. Use `Default::default()` to not pass any.
388    #[cfg(feature = "api")]
389    pub fn list_namespaced_build(
390        namespace: &str,
391        optional: k8s_openapi::ListOptional<'_>,
392    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::ListResponse<Self>>), k8s_openapi::RequestError> {
393        let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/builds?",
394            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
395        );
396        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
397        optional.__serialize(&mut __query_pairs);
398        let __url = __query_pairs.finish();
399
400        let __request = http::Request::get(__url);
401        let __body = vec![];
402        match __request.body(__body) {
403            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
404            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
405        }
406    }
407}
408
409// Generated from operation patchBuildOpenshiftIoV1NamespacedBuild
410
411impl Build {
412    /// partially update the specified Build
413    ///
414    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::PatchResponse`]`<Self>>` constructor, or [`k8s_openapi::PatchResponse`]`<Self>` directly, to parse the HTTP response.
415    ///
416    /// # Arguments
417    ///
418    /// * `name`
419    ///
420    ///     name of the Build
421    ///
422    /// * `namespace`
423    ///
424    ///     object name and auth scope, such as for teams and projects
425    ///
426    /// * `body`
427    ///
428    /// * `optional`
429    ///
430    ///     Optional parameters. Use `Default::default()` to not pass any.
431    #[cfg(feature = "api")]
432    pub fn patch_namespaced_build(
433        name: &str,
434        namespace: &str,
435        body: &k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch,
436        optional: k8s_openapi::PatchOptional<'_>,
437    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::PatchResponse<Self>>), k8s_openapi::RequestError> {
438        let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/builds/{name}?",
439            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
440            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
441        );
442        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
443        optional.__serialize(&mut __query_pairs);
444        let __url = __query_pairs.finish();
445
446        let __request = http::Request::patch(__url);
447        let __body = serde_json::to_vec(body).map_err(k8s_openapi::RequestError::Json)?;
448        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static(match body {
449            k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json",
450            k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json",
451            k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json",
452        }));
453        match __request.body(__body) {
454            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
455            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
456        }
457    }
458}
459
460// Generated from operation readBuildOpenshiftIoV1NamespacedBuild
461
462impl Build {
463    /// read the specified Build
464    ///
465    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`ReadNamespacedBuildResponse`]`>` constructor, or [`ReadNamespacedBuildResponse`] directly, to parse the HTTP response.
466    ///
467    /// # Arguments
468    ///
469    /// * `name`
470    ///
471    ///     name of the Build
472    ///
473    /// * `namespace`
474    ///
475    ///     object name and auth scope, such as for teams and projects
476    ///
477    /// * `optional`
478    ///
479    ///     Optional parameters. Use `Default::default()` to not pass any.
480    #[cfg(feature = "api")]
481    pub fn read_namespaced_build(
482        name: &str,
483        namespace: &str,
484        optional: ReadNamespacedBuildOptional<'_>,
485    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<ReadNamespacedBuildResponse>), k8s_openapi::RequestError> {
486        let ReadNamespacedBuildOptional {
487            exact,
488            export,
489            pretty,
490        } = optional;
491        let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/builds/{name}?",
492            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
493            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
494        );
495        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
496        if let Some(exact) = exact {
497            __query_pairs.append_pair("exact", &exact.to_string());
498        }
499        if let Some(export) = export {
500            __query_pairs.append_pair("export", &export.to_string());
501        }
502        if let Some(pretty) = pretty {
503            __query_pairs.append_pair("pretty", pretty);
504        }
505        let __url = __query_pairs.finish();
506
507        let __request = http::Request::get(__url);
508        let __body = vec![];
509        match __request.body(__body) {
510            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
511            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
512        }
513    }
514}
515
516/// Optional parameters of [`Build::read_namespaced_build`]
517#[cfg(feature = "api")]
518#[derive(Clone, Copy, Debug, Default)]
519pub struct ReadNamespacedBuildOptional<'a> {
520    /// Should the export be exact.  Exact export maintains cluster-specific fields like 'Namespace'.
521    pub exact: Option<bool>,
522    /// Should this value be exported.  Export strips fields that a user can not specify.
523    pub export: Option<bool>,
524    /// If 'true', then the output is pretty printed.
525    pub pretty: Option<&'a str>,
526}
527
528/// Use `<ReadNamespacedBuildResponse as Response>::try_from_parts` to parse the HTTP response body of [`Build::read_namespaced_build`]
529#[cfg(feature = "api")]
530#[derive(Debug)]
531pub enum ReadNamespacedBuildResponse {
532    Ok(crate::api::build::v1::Build),
533    Other(Result<Option<serde_json::Value>, serde_json::Error>),
534}
535
536#[cfg(feature = "api")]
537impl k8s_openapi::Response for ReadNamespacedBuildResponse {
538    fn try_from_parts(status_code: http::StatusCode, buf: &[u8]) -> Result<(Self, usize), k8s_openapi::ResponseError> {
539        match status_code {
540            http::StatusCode::OK => {
541                let result = match serde_json::from_slice(buf) {
542                    Ok(value) => value,
543                    Err(ref err) if err.is_eof() => return Err(k8s_openapi::ResponseError::NeedMoreData),
544                    Err(err) => return Err(k8s_openapi::ResponseError::Json(err)),
545                };
546                Ok((ReadNamespacedBuildResponse::Ok(result), buf.len()))
547            },
548            _ => {
549                let (result, read) =
550                    if buf.is_empty() {
551                        (Ok(None), 0)
552                    }
553                    else {
554                        match serde_json::from_slice(buf) {
555                            Ok(value) => (Ok(Some(value)), buf.len()),
556                            Err(ref err) if err.is_eof() => return Err(k8s_openapi::ResponseError::NeedMoreData),
557                            Err(err) => (Err(err), 0),
558                        }
559                    };
560                Ok((ReadNamespacedBuildResponse::Other(result), read))
561            },
562        }
563    }
564}
565
566// Generated from operation replaceBuildOpenshiftIoV1NamespacedBuild
567
568impl Build {
569    /// replace the specified Build
570    ///
571    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::ReplaceResponse`]`<Self>>` constructor, or [`k8s_openapi::ReplaceResponse`]`<Self>` directly, to parse the HTTP response.
572    ///
573    /// # Arguments
574    ///
575    /// * `name`
576    ///
577    ///     name of the Build
578    ///
579    /// * `namespace`
580    ///
581    ///     object name and auth scope, such as for teams and projects
582    ///
583    /// * `body`
584    ///
585    /// * `optional`
586    ///
587    ///     Optional parameters. Use `Default::default()` to not pass any.
588    #[cfg(feature = "api")]
589    pub fn replace_namespaced_build(
590        name: &str,
591        namespace: &str,
592        body: &crate::api::build::v1::Build,
593        optional: k8s_openapi::ReplaceOptional<'_>,
594    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::ReplaceResponse<Self>>), k8s_openapi::RequestError> {
595        let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/builds/{name}?",
596            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
597            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
598        );
599        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
600        optional.__serialize(&mut __query_pairs);
601        let __url = __query_pairs.finish();
602
603        let __request = http::Request::put(__url);
604        let __body = serde_json::to_vec(body).map_err(k8s_openapi::RequestError::Json)?;
605        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static("application/json"));
606        match __request.body(__body) {
607            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
608            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
609        }
610    }
611}
612
613// Generated from operation replaceBuildOpenshiftIoV1NamespacedBuildDetails
614
615impl Build {
616    /// replace details of the specified Build
617    ///
618    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::ReplaceResponse`]`<Self>>` constructor, or [`k8s_openapi::ReplaceResponse`]`<Self>` directly, to parse the HTTP response.
619    ///
620    /// # Arguments
621    ///
622    /// * `name`
623    ///
624    ///     name of the Build
625    ///
626    /// * `namespace`
627    ///
628    ///     object name and auth scope, such as for teams and projects
629    ///
630    /// * `body`
631    ///
632    /// * `optional`
633    ///
634    ///     Optional parameters. Use `Default::default()` to not pass any.
635    #[cfg(feature = "api")]
636    pub fn replace_namespaced_build_details(
637        name: &str,
638        namespace: &str,
639        body: &crate::api::build::v1::Build,
640        optional: k8s_openapi::ReplaceOptional<'_>,
641    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::ReplaceResponse<Self>>), k8s_openapi::RequestError> {
642        let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/builds/{name}/details?",
643            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
644            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
645        );
646        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
647        optional.__serialize(&mut __query_pairs);
648        let __url = __query_pairs.finish();
649
650        let __request = http::Request::put(__url);
651        let __body = serde_json::to_vec(body).map_err(k8s_openapi::RequestError::Json)?;
652        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static("application/json"));
653        match __request.body(__body) {
654            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
655            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
656        }
657    }
658}
659
660// Generated from operation watchBuildOpenshiftIoV1BuildForAllNamespaces
661
662impl Build {
663    /// list or watch objects of kind Build
664    ///
665    /// This operation only supports watching one item, or a list of items, of this type for changes.
666    ///
667    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::WatchResponse`]`<Self>>` constructor, or [`k8s_openapi::WatchResponse`]`<Self>` directly, to parse the HTTP response.
668    ///
669    /// # Arguments
670    ///
671    /// * `optional`
672    ///
673    ///     Optional parameters. Use `Default::default()` to not pass any.
674    #[cfg(feature = "api")]
675    pub fn watch_build_for_all_namespaces(
676        optional: k8s_openapi::WatchOptional<'_>,
677    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::WatchResponse<Self>>), k8s_openapi::RequestError> {
678        let __url = "/apis/build.openshift.io/v1/builds?".to_owned();
679        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
680        optional.__serialize(&mut __query_pairs);
681        let __url = __query_pairs.finish();
682
683        let __request = http::Request::get(__url);
684        let __body = vec![];
685        match __request.body(__body) {
686            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
687            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
688        }
689    }
690}
691
692// Generated from operation watchBuildOpenshiftIoV1NamespacedBuild
693
694impl Build {
695    /// list or watch objects of kind Build
696    ///
697    /// This operation only supports watching one item, or a list of items, of this type for changes.
698    ///
699    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::WatchResponse`]`<Self>>` constructor, or [`k8s_openapi::WatchResponse`]`<Self>` directly, to parse the HTTP response.
700    ///
701    /// # Arguments
702    ///
703    /// * `namespace`
704    ///
705    ///     object name and auth scope, such as for teams and projects
706    ///
707    /// * `optional`
708    ///
709    ///     Optional parameters. Use `Default::default()` to not pass any.
710    #[cfg(feature = "api")]
711    pub fn watch_namespaced_build(
712        namespace: &str,
713        optional: k8s_openapi::WatchOptional<'_>,
714    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::WatchResponse<Self>>), k8s_openapi::RequestError> {
715        let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/builds?",
716            namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
717        );
718        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
719        optional.__serialize(&mut __query_pairs);
720        let __url = __query_pairs.finish();
721
722        let __request = http::Request::get(__url);
723        let __body = vec![];
724        match __request.body(__body) {
725            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
726            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
727        }
728    }
729}
730
731// End build.openshift.io/v1/Build
732
733impl k8s_openapi::Resource for Build {
734    const API_VERSION: &'static str = "build.openshift.io/v1";
735    const GROUP: &'static str = "build.openshift.io";
736    const KIND: &'static str = "Build";
737    const VERSION: &'static str = "v1";
738}
739
740impl k8s_openapi::ListableResource for Build {
741    const LIST_KIND: &'static str = concat!("Build", "List");
742}
743
744impl k8s_openapi::Metadata for Build {
745    type Ty = k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta;
746
747    fn metadata(&self) -> &<Self as k8s_openapi::Metadata>::Ty {
748        &self.metadata
749    }
750
751    fn metadata_mut(&mut self) -> &mut<Self as k8s_openapi::Metadata>::Ty {
752        &mut self.metadata
753    }
754}
755
756impl<'de> serde::Deserialize<'de> for Build {
757    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: serde::Deserializer<'de> {
758        #[allow(non_camel_case_types)]
759        enum Field {
760            Key_api_version,
761            Key_kind,
762            Key_metadata,
763            Key_spec,
764            Key_status,
765            Other,
766        }
767
768        impl<'de> serde::Deserialize<'de> for Field {
769            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: serde::Deserializer<'de> {
770                struct Visitor;
771
772                impl<'de> serde::de::Visitor<'de> for Visitor {
773                    type Value = Field;
774
775                    fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
776                        f.write_str("field identifier")
777                    }
778
779                    fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: serde::de::Error {
780                        Ok(match v {
781                            "apiVersion" => Field::Key_api_version,
782                            "kind" => Field::Key_kind,
783                            "metadata" => Field::Key_metadata,
784                            "spec" => Field::Key_spec,
785                            "status" => Field::Key_status,
786                            _ => Field::Other,
787                        })
788                    }
789                }
790
791                deserializer.deserialize_identifier(Visitor)
792            }
793        }
794
795        struct Visitor;
796
797        impl<'de> serde::de::Visitor<'de> for Visitor {
798            type Value = Build;
799
800            fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
801                f.write_str(<Self::Value as k8s_openapi::Resource>::KIND)
802            }
803
804            fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: serde::de::MapAccess<'de> {
805                let mut value_metadata: Option<k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta> = None;
806                let mut value_spec: Option<crate::api::build::v1::BuildSpec> = None;
807                let mut value_status: Option<crate::api::build::v1::BuildStatus> = None;
808
809                while let Some(key) = serde::de::MapAccess::next_key::<Field>(&mut map)? {
810                    match key {
811                        Field::Key_api_version => {
812                            let value_api_version: String = serde::de::MapAccess::next_value(&mut map)?;
813                            if value_api_version != <Self::Value as k8s_openapi::Resource>::API_VERSION {
814                                return Err(serde::de::Error::invalid_value(serde::de::Unexpected::Str(&value_api_version), &<Self::Value as k8s_openapi::Resource>::API_VERSION));
815                            }
816                        },
817                        Field::Key_kind => {
818                            let value_kind: String = serde::de::MapAccess::next_value(&mut map)?;
819                            if value_kind != <Self::Value as k8s_openapi::Resource>::KIND {
820                                return Err(serde::de::Error::invalid_value(serde::de::Unexpected::Str(&value_kind), &<Self::Value as k8s_openapi::Resource>::KIND));
821                            }
822                        },
823                        Field::Key_metadata => value_metadata = Some(serde::de::MapAccess::next_value(&mut map)?),
824                        Field::Key_spec => value_spec = serde::de::MapAccess::next_value(&mut map)?,
825                        Field::Key_status => value_status = serde::de::MapAccess::next_value(&mut map)?,
826                        Field::Other => { let _: serde::de::IgnoredAny = serde::de::MapAccess::next_value(&mut map)?; },
827                    }
828                }
829
830                Ok(Build {
831                    metadata: value_metadata.ok_or_else(|| serde::de::Error::missing_field("metadata"))?,
832                    spec: value_spec,
833                    status: value_status,
834                })
835            }
836        }
837
838        deserializer.deserialize_struct(
839            <Self as k8s_openapi::Resource>::KIND,
840            &[
841                "apiVersion",
842                "kind",
843                "metadata",
844                "spec",
845                "status",
846            ],
847            Visitor,
848        )
849    }
850}
851
852impl serde::Serialize for Build {
853    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: serde::Serializer {
854        let mut state = serializer.serialize_struct(
855            <Self as k8s_openapi::Resource>::KIND,
856            3 +
857            self.spec.as_ref().map_or(0, |_| 1) +
858            self.status.as_ref().map_or(0, |_| 1),
859        )?;
860        serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", <Self as k8s_openapi::Resource>::API_VERSION)?;
861        serde::ser::SerializeStruct::serialize_field(&mut state, "kind", <Self as k8s_openapi::Resource>::KIND)?;
862        serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?;
863        if let Some(value) = &self.spec {
864            serde::ser::SerializeStruct::serialize_field(&mut state, "spec", value)?;
865        }
866        if let Some(value) = &self.status {
867            serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?;
868        }
869        serde::ser::SerializeStruct::end(state)
870    }
871}