openshift_openapi/v4_5/api/oauth/v1/
o_auth_client.rs

1// Generated from definition com.github.openshift.api.oauth.v1.OAuthClient
2
3/// OAuthClient describes an OAuth client
4#[derive(Clone, Debug, Default, PartialEq)]
5pub struct OAuthClient {
6    /// AccessTokenInactivityTimeoutSeconds overrides the default token inactivity timeout for tokens granted to this client. The value represents the maximum amount of time that can occur between consecutive uses of the token. Tokens become invalid if they are not used within this temporal window. The user will need to acquire a new token to regain access once a token times out. This value needs to be set only if the default set in configuration is not appropriate for this client. Valid values are: - 0: Tokens for this client never time out - X: Tokens time out if there is no activity for X seconds The current minimum allowed value for X is 300 (5 minutes)
7    pub access_token_inactivity_timeout_seconds: Option<i32>,
8
9    /// AccessTokenMaxAgeSeconds overrides the default access token max age for tokens granted to this client. 0 means no expiration.
10    pub access_token_max_age_seconds: Option<i32>,
11
12    /// AdditionalSecrets holds other secrets that may be used to identify the client.  This is useful for rotation and for service account token validation
13    pub additional_secrets: Option<Vec<String>>,
14
15    /// GrantMethod determines how to handle grants for this client. If no method is provided, the cluster default grant handling method will be used. Valid grant handling methods are:
16    ///  - auto:   always approves grant requests, useful for trusted clients
17    ///  - prompt: prompts the end user for approval of grant requests, useful for third-party clients
18    ///  - deny:   always denies grant requests, useful for black-listed clients
19    pub grant_method: Option<String>,
20
21    /// Standard object's metadata.
22    pub metadata: k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta,
23
24    /// RedirectURIs is the valid redirection URIs associated with a client
25    pub redirect_ur_is: Option<Vec<String>>,
26
27    /// RespondWithChallenges indicates whether the client wants authentication needed responses made in the form of challenges instead of redirects
28    pub respond_with_challenges: Option<bool>,
29
30    /// ScopeRestrictions describes which scopes this client can request.  Each requested scope is checked against each restriction.  If any restriction matches, then the scope is allowed. If no restriction matches, then the scope is denied.
31    pub scope_restrictions: Option<Vec<crate::api::oauth::v1::ScopeRestriction>>,
32
33    /// Secret is the unique secret associated with a client
34    pub secret: Option<String>,
35}
36
37// Begin oauth.openshift.io/v1/OAuthClient
38
39// Generated from operation createOauthOpenshiftIoV1OAuthClient
40
41impl OAuthClient {
42    /// create an OAuthClient
43    ///
44    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::CreateResponse`]`<Self>>` constructor, or [`k8s_openapi::CreateResponse`]`<Self>` directly, to parse the HTTP response.
45    ///
46    /// # Arguments
47    ///
48    /// * `body`
49    ///
50    /// * `optional`
51    ///
52    ///     Optional parameters. Use `Default::default()` to not pass any.
53    #[cfg(feature = "api")]
54    pub fn create_o_auth_client(
55        body: &crate::api::oauth::v1::OAuthClient,
56        optional: k8s_openapi::CreateOptional<'_>,
57    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::CreateResponse<Self>>), k8s_openapi::RequestError> {
58        let __url = "/apis/oauth.openshift.io/v1/oauthclients?".to_owned();
59        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
60        optional.__serialize(&mut __query_pairs);
61        let __url = __query_pairs.finish();
62
63        let __request = http::Request::post(__url);
64        let __body = serde_json::to_vec(body).map_err(k8s_openapi::RequestError::Json)?;
65        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static("application/json"));
66        match __request.body(__body) {
67            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
68            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
69        }
70    }
71}
72
73// Generated from operation deleteOauthOpenshiftIoV1CollectionOAuthClient
74
75impl OAuthClient {
76    /// delete collection of OAuthClient
77    ///
78    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::DeleteResponse`]`<`[`k8s_openapi::List`]`<Self>>>` constructor, or [`k8s_openapi::DeleteResponse`]`<`[`k8s_openapi::List`]`<Self>>` directly, to parse the HTTP response.
79    ///
80    /// # Arguments
81    ///
82    /// * `delete_optional`
83    ///
84    ///     Delete options. Use `Default::default()` to not pass any.
85    ///
86    /// * `list_optional`
87    ///
88    ///     List options. Use `Default::default()` to not pass any.
89    #[cfg(feature = "api")]
90    pub fn delete_collection_o_auth_client(
91        delete_optional: k8s_openapi::DeleteOptional<'_>,
92        list_optional: k8s_openapi::ListOptional<'_>,
93    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::DeleteResponse<k8s_openapi::List<Self>>>), k8s_openapi::RequestError> {
94        let __url = "/apis/oauth.openshift.io/v1/oauthclients?".to_owned();
95        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
96        list_optional.__serialize(&mut __query_pairs);
97        let __url = __query_pairs.finish();
98
99        let __request = http::Request::delete(__url);
100        let __body = serde_json::to_vec(&delete_optional).map_err(k8s_openapi::RequestError::Json)?;
101        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static("application/json"));
102        match __request.body(__body) {
103            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
104            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
105        }
106    }
107}
108
109// Generated from operation deleteOauthOpenshiftIoV1OAuthClient
110
111impl OAuthClient {
112    /// delete an OAuthClient
113    ///
114    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::DeleteResponse`]`<Self>>` constructor, or [`k8s_openapi::DeleteResponse`]`<Self>` directly, to parse the HTTP response.
115    ///
116    /// # Arguments
117    ///
118    /// * `name`
119    ///
120    ///     name of the OAuthClient
121    ///
122    /// * `optional`
123    ///
124    ///     Optional parameters. Use `Default::default()` to not pass any.
125    #[cfg(feature = "api")]
126    pub fn delete_o_auth_client(
127        name: &str,
128        optional: k8s_openapi::DeleteOptional<'_>,
129    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::DeleteResponse<Self>>), k8s_openapi::RequestError> {
130        let __url = format!("/apis/oauth.openshift.io/v1/oauthclients/{name}",
131            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
132        );
133
134        let __request = http::Request::delete(__url);
135        let __body = serde_json::to_vec(&optional).map_err(k8s_openapi::RequestError::Json)?;
136        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static("application/json"));
137        match __request.body(__body) {
138            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
139            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
140        }
141    }
142}
143
144// Generated from operation listOauthOpenshiftIoV1OAuthClient
145
146impl OAuthClient {
147    /// list or watch objects of kind OAuthClient
148    ///
149    /// This operation only supports listing all items of this type.
150    ///
151    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::ListResponse`]`<Self>>` constructor, or [`k8s_openapi::ListResponse`]`<Self>` directly, to parse the HTTP response.
152    ///
153    /// # Arguments
154    ///
155    /// * `optional`
156    ///
157    ///     Optional parameters. Use `Default::default()` to not pass any.
158    #[cfg(feature = "api")]
159    pub fn list_o_auth_client(
160        optional: k8s_openapi::ListOptional<'_>,
161    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::ListResponse<Self>>), k8s_openapi::RequestError> {
162        let __url = "/apis/oauth.openshift.io/v1/oauthclients?".to_owned();
163        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
164        optional.__serialize(&mut __query_pairs);
165        let __url = __query_pairs.finish();
166
167        let __request = http::Request::get(__url);
168        let __body = vec![];
169        match __request.body(__body) {
170            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
171            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
172        }
173    }
174}
175
176// Generated from operation patchOauthOpenshiftIoV1OAuthClient
177
178impl OAuthClient {
179    /// partially update the specified OAuthClient
180    ///
181    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::PatchResponse`]`<Self>>` constructor, or [`k8s_openapi::PatchResponse`]`<Self>` directly, to parse the HTTP response.
182    ///
183    /// # Arguments
184    ///
185    /// * `name`
186    ///
187    ///     name of the OAuthClient
188    ///
189    /// * `body`
190    ///
191    /// * `optional`
192    ///
193    ///     Optional parameters. Use `Default::default()` to not pass any.
194    #[cfg(feature = "api")]
195    pub fn patch_o_auth_client(
196        name: &str,
197        body: &k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch,
198        optional: k8s_openapi::PatchOptional<'_>,
199    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::PatchResponse<Self>>), k8s_openapi::RequestError> {
200        let __url = format!("/apis/oauth.openshift.io/v1/oauthclients/{name}?",
201            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
202        );
203        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
204        optional.__serialize(&mut __query_pairs);
205        let __url = __query_pairs.finish();
206
207        let __request = http::Request::patch(__url);
208        let __body = serde_json::to_vec(body).map_err(k8s_openapi::RequestError::Json)?;
209        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static(match body {
210            k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch::Json(_) => "application/json-patch+json",
211            k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch::Merge(_) => "application/merge-patch+json",
212            k8s_openapi::apimachinery::pkg::apis::meta::v1::Patch::StrategicMerge(_) => "application/strategic-merge-patch+json",
213        }));
214        match __request.body(__body) {
215            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
216            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
217        }
218    }
219}
220
221// Generated from operation readOauthOpenshiftIoV1OAuthClient
222
223impl OAuthClient {
224    /// read the specified OAuthClient
225    ///
226    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`ReadOAuthClientResponse`]`>` constructor, or [`ReadOAuthClientResponse`] directly, to parse the HTTP response.
227    ///
228    /// # Arguments
229    ///
230    /// * `name`
231    ///
232    ///     name of the OAuthClient
233    ///
234    /// * `optional`
235    ///
236    ///     Optional parameters. Use `Default::default()` to not pass any.
237    #[cfg(feature = "api")]
238    pub fn read_o_auth_client(
239        name: &str,
240        optional: ReadOAuthClientOptional<'_>,
241    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<ReadOAuthClientResponse>), k8s_openapi::RequestError> {
242        let ReadOAuthClientOptional {
243            exact,
244            export,
245            pretty,
246        } = optional;
247        let __url = format!("/apis/oauth.openshift.io/v1/oauthclients/{name}?",
248            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
249        );
250        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
251        if let Some(exact) = exact {
252            __query_pairs.append_pair("exact", &exact.to_string());
253        }
254        if let Some(export) = export {
255            __query_pairs.append_pair("export", &export.to_string());
256        }
257        if let Some(pretty) = pretty {
258            __query_pairs.append_pair("pretty", pretty);
259        }
260        let __url = __query_pairs.finish();
261
262        let __request = http::Request::get(__url);
263        let __body = vec![];
264        match __request.body(__body) {
265            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
266            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
267        }
268    }
269}
270
271/// Optional parameters of [`OAuthClient::read_o_auth_client`]
272#[cfg(feature = "api")]
273#[derive(Clone, Copy, Debug, Default)]
274pub struct ReadOAuthClientOptional<'a> {
275    /// Should the export be exact.  Exact export maintains cluster-specific fields like 'Namespace'.
276    pub exact: Option<bool>,
277    /// Should this value be exported.  Export strips fields that a user can not specify.
278    pub export: Option<bool>,
279    /// If 'true', then the output is pretty printed.
280    pub pretty: Option<&'a str>,
281}
282
283/// Use `<ReadOAuthClientResponse as Response>::try_from_parts` to parse the HTTP response body of [`OAuthClient::read_o_auth_client`]
284#[cfg(feature = "api")]
285#[derive(Debug)]
286pub enum ReadOAuthClientResponse {
287    Ok(crate::api::oauth::v1::OAuthClient),
288    Other(Result<Option<serde_json::Value>, serde_json::Error>),
289}
290
291#[cfg(feature = "api")]
292impl k8s_openapi::Response for ReadOAuthClientResponse {
293    fn try_from_parts(status_code: http::StatusCode, buf: &[u8]) -> Result<(Self, usize), k8s_openapi::ResponseError> {
294        match status_code {
295            http::StatusCode::OK => {
296                let result = match serde_json::from_slice(buf) {
297                    Ok(value) => value,
298                    Err(ref err) if err.is_eof() => return Err(k8s_openapi::ResponseError::NeedMoreData),
299                    Err(err) => return Err(k8s_openapi::ResponseError::Json(err)),
300                };
301                Ok((ReadOAuthClientResponse::Ok(result), buf.len()))
302            },
303            _ => {
304                let (result, read) =
305                    if buf.is_empty() {
306                        (Ok(None), 0)
307                    }
308                    else {
309                        match serde_json::from_slice(buf) {
310                            Ok(value) => (Ok(Some(value)), buf.len()),
311                            Err(ref err) if err.is_eof() => return Err(k8s_openapi::ResponseError::NeedMoreData),
312                            Err(err) => (Err(err), 0),
313                        }
314                    };
315                Ok((ReadOAuthClientResponse::Other(result), read))
316            },
317        }
318    }
319}
320
321// Generated from operation replaceOauthOpenshiftIoV1OAuthClient
322
323impl OAuthClient {
324    /// replace the specified OAuthClient
325    ///
326    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::ReplaceResponse`]`<Self>>` constructor, or [`k8s_openapi::ReplaceResponse`]`<Self>` directly, to parse the HTTP response.
327    ///
328    /// # Arguments
329    ///
330    /// * `name`
331    ///
332    ///     name of the OAuthClient
333    ///
334    /// * `body`
335    ///
336    /// * `optional`
337    ///
338    ///     Optional parameters. Use `Default::default()` to not pass any.
339    #[cfg(feature = "api")]
340    pub fn replace_o_auth_client(
341        name: &str,
342        body: &crate::api::oauth::v1::OAuthClient,
343        optional: k8s_openapi::ReplaceOptional<'_>,
344    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::ReplaceResponse<Self>>), k8s_openapi::RequestError> {
345        let __url = format!("/apis/oauth.openshift.io/v1/oauthclients/{name}?",
346            name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
347        );
348        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
349        optional.__serialize(&mut __query_pairs);
350        let __url = __query_pairs.finish();
351
352        let __request = http::Request::put(__url);
353        let __body = serde_json::to_vec(body).map_err(k8s_openapi::RequestError::Json)?;
354        let __request = __request.header(http::header::CONTENT_TYPE, http::header::HeaderValue::from_static("application/json"));
355        match __request.body(__body) {
356            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
357            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
358        }
359    }
360}
361
362// Generated from operation watchOauthOpenshiftIoV1OAuthClient
363
364impl OAuthClient {
365    /// list or watch objects of kind OAuthClient
366    ///
367    /// This operation only supports watching one item, or a list of items, of this type for changes.
368    ///
369    /// Use the returned [`k8s_openapi::ResponseBody`]`<`[`k8s_openapi::WatchResponse`]`<Self>>` constructor, or [`k8s_openapi::WatchResponse`]`<Self>` directly, to parse the HTTP response.
370    ///
371    /// # Arguments
372    ///
373    /// * `optional`
374    ///
375    ///     Optional parameters. Use `Default::default()` to not pass any.
376    #[cfg(feature = "api")]
377    pub fn watch_o_auth_client(
378        optional: k8s_openapi::WatchOptional<'_>,
379    ) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<k8s_openapi::WatchResponse<Self>>), k8s_openapi::RequestError> {
380        let __url = "/apis/oauth.openshift.io/v1/oauthclients?".to_owned();
381        let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
382        optional.__serialize(&mut __query_pairs);
383        let __url = __query_pairs.finish();
384
385        let __request = http::Request::get(__url);
386        let __body = vec![];
387        match __request.body(__body) {
388            Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
389            Err(err) => Err(k8s_openapi::RequestError::Http(err)),
390        }
391    }
392}
393
394// End oauth.openshift.io/v1/OAuthClient
395
396impl k8s_openapi::Resource for OAuthClient {
397    const API_VERSION: &'static str = "oauth.openshift.io/v1";
398    const GROUP: &'static str = "oauth.openshift.io";
399    const KIND: &'static str = "OAuthClient";
400    const VERSION: &'static str = "v1";
401}
402
403impl k8s_openapi::ListableResource for OAuthClient {
404    const LIST_KIND: &'static str = concat!("OAuthClient", "List");
405}
406
407impl k8s_openapi::Metadata for OAuthClient {
408    type Ty = k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta;
409
410    fn metadata(&self) -> &<Self as k8s_openapi::Metadata>::Ty {
411        &self.metadata
412    }
413
414    fn metadata_mut(&mut self) -> &mut<Self as k8s_openapi::Metadata>::Ty {
415        &mut self.metadata
416    }
417}
418
419impl<'de> serde::Deserialize<'de> for OAuthClient {
420    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: serde::Deserializer<'de> {
421        #[allow(non_camel_case_types)]
422        enum Field {
423            Key_api_version,
424            Key_kind,
425            Key_access_token_inactivity_timeout_seconds,
426            Key_access_token_max_age_seconds,
427            Key_additional_secrets,
428            Key_grant_method,
429            Key_metadata,
430            Key_redirect_ur_is,
431            Key_respond_with_challenges,
432            Key_scope_restrictions,
433            Key_secret,
434            Other,
435        }
436
437        impl<'de> serde::Deserialize<'de> for Field {
438            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: serde::Deserializer<'de> {
439                struct Visitor;
440
441                impl<'de> serde::de::Visitor<'de> for Visitor {
442                    type Value = Field;
443
444                    fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
445                        f.write_str("field identifier")
446                    }
447
448                    fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: serde::de::Error {
449                        Ok(match v {
450                            "apiVersion" => Field::Key_api_version,
451                            "kind" => Field::Key_kind,
452                            "accessTokenInactivityTimeoutSeconds" => Field::Key_access_token_inactivity_timeout_seconds,
453                            "accessTokenMaxAgeSeconds" => Field::Key_access_token_max_age_seconds,
454                            "additionalSecrets" => Field::Key_additional_secrets,
455                            "grantMethod" => Field::Key_grant_method,
456                            "metadata" => Field::Key_metadata,
457                            "redirectURIs" => Field::Key_redirect_ur_is,
458                            "respondWithChallenges" => Field::Key_respond_with_challenges,
459                            "scopeRestrictions" => Field::Key_scope_restrictions,
460                            "secret" => Field::Key_secret,
461                            _ => Field::Other,
462                        })
463                    }
464                }
465
466                deserializer.deserialize_identifier(Visitor)
467            }
468        }
469
470        struct Visitor;
471
472        impl<'de> serde::de::Visitor<'de> for Visitor {
473            type Value = OAuthClient;
474
475            fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
476                f.write_str(<Self::Value as k8s_openapi::Resource>::KIND)
477            }
478
479            fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: serde::de::MapAccess<'de> {
480                let mut value_access_token_inactivity_timeout_seconds: Option<i32> = None;
481                let mut value_access_token_max_age_seconds: Option<i32> = None;
482                let mut value_additional_secrets: Option<Vec<String>> = None;
483                let mut value_grant_method: Option<String> = None;
484                let mut value_metadata: Option<k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta> = None;
485                let mut value_redirect_ur_is: Option<Vec<String>> = None;
486                let mut value_respond_with_challenges: Option<bool> = None;
487                let mut value_scope_restrictions: Option<Vec<crate::api::oauth::v1::ScopeRestriction>> = None;
488                let mut value_secret: Option<String> = None;
489
490                while let Some(key) = serde::de::MapAccess::next_key::<Field>(&mut map)? {
491                    match key {
492                        Field::Key_api_version => {
493                            let value_api_version: String = serde::de::MapAccess::next_value(&mut map)?;
494                            if value_api_version != <Self::Value as k8s_openapi::Resource>::API_VERSION {
495                                return Err(serde::de::Error::invalid_value(serde::de::Unexpected::Str(&value_api_version), &<Self::Value as k8s_openapi::Resource>::API_VERSION));
496                            }
497                        },
498                        Field::Key_kind => {
499                            let value_kind: String = serde::de::MapAccess::next_value(&mut map)?;
500                            if value_kind != <Self::Value as k8s_openapi::Resource>::KIND {
501                                return Err(serde::de::Error::invalid_value(serde::de::Unexpected::Str(&value_kind), &<Self::Value as k8s_openapi::Resource>::KIND));
502                            }
503                        },
504                        Field::Key_access_token_inactivity_timeout_seconds => value_access_token_inactivity_timeout_seconds = serde::de::MapAccess::next_value(&mut map)?,
505                        Field::Key_access_token_max_age_seconds => value_access_token_max_age_seconds = serde::de::MapAccess::next_value(&mut map)?,
506                        Field::Key_additional_secrets => value_additional_secrets = serde::de::MapAccess::next_value(&mut map)?,
507                        Field::Key_grant_method => value_grant_method = serde::de::MapAccess::next_value(&mut map)?,
508                        Field::Key_metadata => value_metadata = Some(serde::de::MapAccess::next_value(&mut map)?),
509                        Field::Key_redirect_ur_is => value_redirect_ur_is = serde::de::MapAccess::next_value(&mut map)?,
510                        Field::Key_respond_with_challenges => value_respond_with_challenges = serde::de::MapAccess::next_value(&mut map)?,
511                        Field::Key_scope_restrictions => value_scope_restrictions = serde::de::MapAccess::next_value(&mut map)?,
512                        Field::Key_secret => value_secret = serde::de::MapAccess::next_value(&mut map)?,
513                        Field::Other => { let _: serde::de::IgnoredAny = serde::de::MapAccess::next_value(&mut map)?; },
514                    }
515                }
516
517                Ok(OAuthClient {
518                    access_token_inactivity_timeout_seconds: value_access_token_inactivity_timeout_seconds,
519                    access_token_max_age_seconds: value_access_token_max_age_seconds,
520                    additional_secrets: value_additional_secrets,
521                    grant_method: value_grant_method,
522                    metadata: value_metadata.ok_or_else(|| serde::de::Error::missing_field("metadata"))?,
523                    redirect_ur_is: value_redirect_ur_is,
524                    respond_with_challenges: value_respond_with_challenges,
525                    scope_restrictions: value_scope_restrictions,
526                    secret: value_secret,
527                })
528            }
529        }
530
531        deserializer.deserialize_struct(
532            <Self as k8s_openapi::Resource>::KIND,
533            &[
534                "apiVersion",
535                "kind",
536                "accessTokenInactivityTimeoutSeconds",
537                "accessTokenMaxAgeSeconds",
538                "additionalSecrets",
539                "grantMethod",
540                "metadata",
541                "redirectURIs",
542                "respondWithChallenges",
543                "scopeRestrictions",
544                "secret",
545            ],
546            Visitor,
547        )
548    }
549}
550
551impl serde::Serialize for OAuthClient {
552    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: serde::Serializer {
553        let mut state = serializer.serialize_struct(
554            <Self as k8s_openapi::Resource>::KIND,
555            3 +
556            self.access_token_inactivity_timeout_seconds.as_ref().map_or(0, |_| 1) +
557            self.access_token_max_age_seconds.as_ref().map_or(0, |_| 1) +
558            self.additional_secrets.as_ref().map_or(0, |_| 1) +
559            self.grant_method.as_ref().map_or(0, |_| 1) +
560            self.redirect_ur_is.as_ref().map_or(0, |_| 1) +
561            self.respond_with_challenges.as_ref().map_or(0, |_| 1) +
562            self.scope_restrictions.as_ref().map_or(0, |_| 1) +
563            self.secret.as_ref().map_or(0, |_| 1),
564        )?;
565        serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", <Self as k8s_openapi::Resource>::API_VERSION)?;
566        serde::ser::SerializeStruct::serialize_field(&mut state, "kind", <Self as k8s_openapi::Resource>::KIND)?;
567        if let Some(value) = &self.access_token_inactivity_timeout_seconds {
568            serde::ser::SerializeStruct::serialize_field(&mut state, "accessTokenInactivityTimeoutSeconds", value)?;
569        }
570        if let Some(value) = &self.access_token_max_age_seconds {
571            serde::ser::SerializeStruct::serialize_field(&mut state, "accessTokenMaxAgeSeconds", value)?;
572        }
573        if let Some(value) = &self.additional_secrets {
574            serde::ser::SerializeStruct::serialize_field(&mut state, "additionalSecrets", value)?;
575        }
576        if let Some(value) = &self.grant_method {
577            serde::ser::SerializeStruct::serialize_field(&mut state, "grantMethod", value)?;
578        }
579        serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?;
580        if let Some(value) = &self.redirect_ur_is {
581            serde::ser::SerializeStruct::serialize_field(&mut state, "redirectURIs", value)?;
582        }
583        if let Some(value) = &self.respond_with_challenges {
584            serde::ser::SerializeStruct::serialize_field(&mut state, "respondWithChallenges", value)?;
585        }
586        if let Some(value) = &self.scope_restrictions {
587            serde::ser::SerializeStruct::serialize_field(&mut state, "scopeRestrictions", value)?;
588        }
589        if let Some(value) = &self.secret {
590            serde::ser::SerializeStruct::serialize_field(&mut state, "secret", value)?;
591        }
592        serde::ser::SerializeStruct::end(state)
593    }
594}