openshift_openapi/v4_5/api/quota/v1/
cluster_resource_quota.rs

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