google_cloud_managedkafka_v1/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate lazy_static;
25extern crate location;
26extern crate longrunning;
27extern crate lro;
28extern crate reqwest;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36/// Request for ListClusters.
37#[derive(Clone, Debug, Default, PartialEq)]
38#[non_exhaustive]
39pub struct ListClustersRequest {
40    /// Required. The parent location whose clusters are to be listed. Structured
41    /// like `projects/{project}/locations/{location}`.
42    pub parent: std::string::String,
43
44    /// Optional. The maximum number of clusters to return. The service may return
45    /// fewer than this value. If unspecified, server will pick an appropriate
46    /// default.
47    pub page_size: i32,
48
49    /// Optional. A page token, received from a previous `ListClusters` call.
50    /// Provide this to retrieve the subsequent page.
51    ///
52    /// When paginating, all other parameters provided to `ListClusters` must match
53    /// the call that provided the page token.
54    pub page_token: std::string::String,
55
56    /// Optional. Filter expression for the result.
57    pub filter: std::string::String,
58
59    /// Optional. Order by fields for the result.
60    pub order_by: std::string::String,
61
62    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
63}
64
65impl ListClustersRequest {
66    pub fn new() -> Self {
67        std::default::Default::default()
68    }
69
70    /// Sets the value of [parent][crate::model::ListClustersRequest::parent].
71    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
72        self.parent = v.into();
73        self
74    }
75
76    /// Sets the value of [page_size][crate::model::ListClustersRequest::page_size].
77    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
78        self.page_size = v.into();
79        self
80    }
81
82    /// Sets the value of [page_token][crate::model::ListClustersRequest::page_token].
83    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
84        self.page_token = v.into();
85        self
86    }
87
88    /// Sets the value of [filter][crate::model::ListClustersRequest::filter].
89    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
90        self.filter = v.into();
91        self
92    }
93
94    /// Sets the value of [order_by][crate::model::ListClustersRequest::order_by].
95    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
96        self.order_by = v.into();
97        self
98    }
99}
100
101impl wkt::message::Message for ListClustersRequest {
102    fn typename() -> &'static str {
103        "type.googleapis.com/google.cloud.managedkafka.v1.ListClustersRequest"
104    }
105}
106
107#[doc(hidden)]
108impl<'de> serde::de::Deserialize<'de> for ListClustersRequest {
109    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
110    where
111        D: serde::Deserializer<'de>,
112    {
113        #[allow(non_camel_case_types)]
114        #[doc(hidden)]
115        #[derive(PartialEq, Eq, Hash)]
116        enum __FieldTag {
117            __parent,
118            __page_size,
119            __page_token,
120            __filter,
121            __order_by,
122            Unknown(std::string::String),
123        }
124        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
125            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
126            where
127                D: serde::Deserializer<'de>,
128            {
129                struct Visitor;
130                impl<'de> serde::de::Visitor<'de> for Visitor {
131                    type Value = __FieldTag;
132                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
133                        formatter.write_str("a field name for ListClustersRequest")
134                    }
135                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
136                    where
137                        E: serde::de::Error,
138                    {
139                        use std::result::Result::Ok;
140                        use std::string::ToString;
141                        match value {
142                            "parent" => Ok(__FieldTag::__parent),
143                            "pageSize" => Ok(__FieldTag::__page_size),
144                            "page_size" => Ok(__FieldTag::__page_size),
145                            "pageToken" => Ok(__FieldTag::__page_token),
146                            "page_token" => Ok(__FieldTag::__page_token),
147                            "filter" => Ok(__FieldTag::__filter),
148                            "orderBy" => Ok(__FieldTag::__order_by),
149                            "order_by" => Ok(__FieldTag::__order_by),
150                            _ => Ok(__FieldTag::Unknown(value.to_string())),
151                        }
152                    }
153                }
154                deserializer.deserialize_identifier(Visitor)
155            }
156        }
157        struct Visitor;
158        impl<'de> serde::de::Visitor<'de> for Visitor {
159            type Value = ListClustersRequest;
160            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
161                formatter.write_str("struct ListClustersRequest")
162            }
163            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
164            where
165                A: serde::de::MapAccess<'de>,
166            {
167                #[allow(unused_imports)]
168                use serde::de::Error;
169                use std::option::Option::Some;
170                let mut fields = std::collections::HashSet::new();
171                let mut result = Self::Value::new();
172                while let Some(tag) = map.next_key::<__FieldTag>()? {
173                    #[allow(clippy::match_single_binding)]
174                    match tag {
175                        __FieldTag::__parent => {
176                            if !fields.insert(__FieldTag::__parent) {
177                                return std::result::Result::Err(A::Error::duplicate_field(
178                                    "multiple values for parent",
179                                ));
180                            }
181                            result.parent = map
182                                .next_value::<std::option::Option<std::string::String>>()?
183                                .unwrap_or_default();
184                        }
185                        __FieldTag::__page_size => {
186                            if !fields.insert(__FieldTag::__page_size) {
187                                return std::result::Result::Err(A::Error::duplicate_field(
188                                    "multiple values for page_size",
189                                ));
190                            }
191                            struct __With(std::option::Option<i32>);
192                            impl<'de> serde::de::Deserialize<'de> for __With {
193                                fn deserialize<D>(
194                                    deserializer: D,
195                                ) -> std::result::Result<Self, D::Error>
196                                where
197                                    D: serde::de::Deserializer<'de>,
198                                {
199                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
200                                }
201                            }
202                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
203                        }
204                        __FieldTag::__page_token => {
205                            if !fields.insert(__FieldTag::__page_token) {
206                                return std::result::Result::Err(A::Error::duplicate_field(
207                                    "multiple values for page_token",
208                                ));
209                            }
210                            result.page_token = map
211                                .next_value::<std::option::Option<std::string::String>>()?
212                                .unwrap_or_default();
213                        }
214                        __FieldTag::__filter => {
215                            if !fields.insert(__FieldTag::__filter) {
216                                return std::result::Result::Err(A::Error::duplicate_field(
217                                    "multiple values for filter",
218                                ));
219                            }
220                            result.filter = map
221                                .next_value::<std::option::Option<std::string::String>>()?
222                                .unwrap_or_default();
223                        }
224                        __FieldTag::__order_by => {
225                            if !fields.insert(__FieldTag::__order_by) {
226                                return std::result::Result::Err(A::Error::duplicate_field(
227                                    "multiple values for order_by",
228                                ));
229                            }
230                            result.order_by = map
231                                .next_value::<std::option::Option<std::string::String>>()?
232                                .unwrap_or_default();
233                        }
234                        __FieldTag::Unknown(key) => {
235                            let value = map.next_value::<serde_json::Value>()?;
236                            result._unknown_fields.insert(key, value);
237                        }
238                    }
239                }
240                std::result::Result::Ok(result)
241            }
242        }
243        deserializer.deserialize_any(Visitor)
244    }
245}
246
247#[doc(hidden)]
248impl serde::ser::Serialize for ListClustersRequest {
249    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
250    where
251        S: serde::ser::Serializer,
252    {
253        use serde::ser::SerializeMap;
254        #[allow(unused_imports)]
255        use std::option::Option::Some;
256        let mut state = serializer.serialize_map(std::option::Option::None)?;
257        if !self.parent.is_empty() {
258            state.serialize_entry("parent", &self.parent)?;
259        }
260        if !wkt::internal::is_default(&self.page_size) {
261            struct __With<'a>(&'a i32);
262            impl<'a> serde::ser::Serialize for __With<'a> {
263                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
264                where
265                    S: serde::ser::Serializer,
266                {
267                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
268                }
269            }
270            state.serialize_entry("pageSize", &__With(&self.page_size))?;
271        }
272        if !self.page_token.is_empty() {
273            state.serialize_entry("pageToken", &self.page_token)?;
274        }
275        if !self.filter.is_empty() {
276            state.serialize_entry("filter", &self.filter)?;
277        }
278        if !self.order_by.is_empty() {
279            state.serialize_entry("orderBy", &self.order_by)?;
280        }
281        if !self._unknown_fields.is_empty() {
282            for (key, value) in self._unknown_fields.iter() {
283                state.serialize_entry(key, &value)?;
284            }
285        }
286        state.end()
287    }
288}
289
290/// Response for ListClusters.
291#[derive(Clone, Debug, Default, PartialEq)]
292#[non_exhaustive]
293pub struct ListClustersResponse {
294    /// The list of Clusters in the requested parent.
295    pub clusters: std::vec::Vec<crate::model::Cluster>,
296
297    /// A token that can be sent as `page_token` to retrieve the next page of
298    /// results. If this field is omitted, there are no more results.
299    pub next_page_token: std::string::String,
300
301    /// Locations that could not be reached.
302    pub unreachable: std::vec::Vec<std::string::String>,
303
304    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
305}
306
307impl ListClustersResponse {
308    pub fn new() -> Self {
309        std::default::Default::default()
310    }
311
312    /// Sets the value of [clusters][crate::model::ListClustersResponse::clusters].
313    pub fn set_clusters<T, V>(mut self, v: T) -> Self
314    where
315        T: std::iter::IntoIterator<Item = V>,
316        V: std::convert::Into<crate::model::Cluster>,
317    {
318        use std::iter::Iterator;
319        self.clusters = v.into_iter().map(|i| i.into()).collect();
320        self
321    }
322
323    /// Sets the value of [next_page_token][crate::model::ListClustersResponse::next_page_token].
324    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
325        self.next_page_token = v.into();
326        self
327    }
328
329    /// Sets the value of [unreachable][crate::model::ListClustersResponse::unreachable].
330    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
331    where
332        T: std::iter::IntoIterator<Item = V>,
333        V: std::convert::Into<std::string::String>,
334    {
335        use std::iter::Iterator;
336        self.unreachable = v.into_iter().map(|i| i.into()).collect();
337        self
338    }
339}
340
341impl wkt::message::Message for ListClustersResponse {
342    fn typename() -> &'static str {
343        "type.googleapis.com/google.cloud.managedkafka.v1.ListClustersResponse"
344    }
345}
346
347#[doc(hidden)]
348impl gax::paginator::internal::PageableResponse for ListClustersResponse {
349    type PageItem = crate::model::Cluster;
350
351    fn items(self) -> std::vec::Vec<Self::PageItem> {
352        self.clusters
353    }
354
355    fn next_page_token(&self) -> std::string::String {
356        use std::clone::Clone;
357        self.next_page_token.clone()
358    }
359}
360
361#[doc(hidden)]
362impl<'de> serde::de::Deserialize<'de> for ListClustersResponse {
363    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
364    where
365        D: serde::Deserializer<'de>,
366    {
367        #[allow(non_camel_case_types)]
368        #[doc(hidden)]
369        #[derive(PartialEq, Eq, Hash)]
370        enum __FieldTag {
371            __clusters,
372            __next_page_token,
373            __unreachable,
374            Unknown(std::string::String),
375        }
376        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
377            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
378            where
379                D: serde::Deserializer<'de>,
380            {
381                struct Visitor;
382                impl<'de> serde::de::Visitor<'de> for Visitor {
383                    type Value = __FieldTag;
384                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
385                        formatter.write_str("a field name for ListClustersResponse")
386                    }
387                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
388                    where
389                        E: serde::de::Error,
390                    {
391                        use std::result::Result::Ok;
392                        use std::string::ToString;
393                        match value {
394                            "clusters" => Ok(__FieldTag::__clusters),
395                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
396                            "next_page_token" => Ok(__FieldTag::__next_page_token),
397                            "unreachable" => Ok(__FieldTag::__unreachable),
398                            _ => Ok(__FieldTag::Unknown(value.to_string())),
399                        }
400                    }
401                }
402                deserializer.deserialize_identifier(Visitor)
403            }
404        }
405        struct Visitor;
406        impl<'de> serde::de::Visitor<'de> for Visitor {
407            type Value = ListClustersResponse;
408            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
409                formatter.write_str("struct ListClustersResponse")
410            }
411            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
412            where
413                A: serde::de::MapAccess<'de>,
414            {
415                #[allow(unused_imports)]
416                use serde::de::Error;
417                use std::option::Option::Some;
418                let mut fields = std::collections::HashSet::new();
419                let mut result = Self::Value::new();
420                while let Some(tag) = map.next_key::<__FieldTag>()? {
421                    #[allow(clippy::match_single_binding)]
422                    match tag {
423                        __FieldTag::__clusters => {
424                            if !fields.insert(__FieldTag::__clusters) {
425                                return std::result::Result::Err(A::Error::duplicate_field(
426                                    "multiple values for clusters",
427                                ));
428                            }
429                            result.clusters = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Cluster>>>()?.unwrap_or_default();
430                        }
431                        __FieldTag::__next_page_token => {
432                            if !fields.insert(__FieldTag::__next_page_token) {
433                                return std::result::Result::Err(A::Error::duplicate_field(
434                                    "multiple values for next_page_token",
435                                ));
436                            }
437                            result.next_page_token = map
438                                .next_value::<std::option::Option<std::string::String>>()?
439                                .unwrap_or_default();
440                        }
441                        __FieldTag::__unreachable => {
442                            if !fields.insert(__FieldTag::__unreachable) {
443                                return std::result::Result::Err(A::Error::duplicate_field(
444                                    "multiple values for unreachable",
445                                ));
446                            }
447                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
448                        }
449                        __FieldTag::Unknown(key) => {
450                            let value = map.next_value::<serde_json::Value>()?;
451                            result._unknown_fields.insert(key, value);
452                        }
453                    }
454                }
455                std::result::Result::Ok(result)
456            }
457        }
458        deserializer.deserialize_any(Visitor)
459    }
460}
461
462#[doc(hidden)]
463impl serde::ser::Serialize for ListClustersResponse {
464    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
465    where
466        S: serde::ser::Serializer,
467    {
468        use serde::ser::SerializeMap;
469        #[allow(unused_imports)]
470        use std::option::Option::Some;
471        let mut state = serializer.serialize_map(std::option::Option::None)?;
472        if !self.clusters.is_empty() {
473            state.serialize_entry("clusters", &self.clusters)?;
474        }
475        if !self.next_page_token.is_empty() {
476            state.serialize_entry("nextPageToken", &self.next_page_token)?;
477        }
478        if !self.unreachable.is_empty() {
479            state.serialize_entry("unreachable", &self.unreachable)?;
480        }
481        if !self._unknown_fields.is_empty() {
482            for (key, value) in self._unknown_fields.iter() {
483                state.serialize_entry(key, &value)?;
484            }
485        }
486        state.end()
487    }
488}
489
490/// Request for GetCluster.
491#[derive(Clone, Debug, Default, PartialEq)]
492#[non_exhaustive]
493pub struct GetClusterRequest {
494    /// Required. The name of the cluster whose configuration to return.
495    pub name: std::string::String,
496
497    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
498}
499
500impl GetClusterRequest {
501    pub fn new() -> Self {
502        std::default::Default::default()
503    }
504
505    /// Sets the value of [name][crate::model::GetClusterRequest::name].
506    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
507        self.name = v.into();
508        self
509    }
510}
511
512impl wkt::message::Message for GetClusterRequest {
513    fn typename() -> &'static str {
514        "type.googleapis.com/google.cloud.managedkafka.v1.GetClusterRequest"
515    }
516}
517
518#[doc(hidden)]
519impl<'de> serde::de::Deserialize<'de> for GetClusterRequest {
520    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
521    where
522        D: serde::Deserializer<'de>,
523    {
524        #[allow(non_camel_case_types)]
525        #[doc(hidden)]
526        #[derive(PartialEq, Eq, Hash)]
527        enum __FieldTag {
528            __name,
529            Unknown(std::string::String),
530        }
531        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
532            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
533            where
534                D: serde::Deserializer<'de>,
535            {
536                struct Visitor;
537                impl<'de> serde::de::Visitor<'de> for Visitor {
538                    type Value = __FieldTag;
539                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
540                        formatter.write_str("a field name for GetClusterRequest")
541                    }
542                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
543                    where
544                        E: serde::de::Error,
545                    {
546                        use std::result::Result::Ok;
547                        use std::string::ToString;
548                        match value {
549                            "name" => Ok(__FieldTag::__name),
550                            _ => Ok(__FieldTag::Unknown(value.to_string())),
551                        }
552                    }
553                }
554                deserializer.deserialize_identifier(Visitor)
555            }
556        }
557        struct Visitor;
558        impl<'de> serde::de::Visitor<'de> for Visitor {
559            type Value = GetClusterRequest;
560            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
561                formatter.write_str("struct GetClusterRequest")
562            }
563            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
564            where
565                A: serde::de::MapAccess<'de>,
566            {
567                #[allow(unused_imports)]
568                use serde::de::Error;
569                use std::option::Option::Some;
570                let mut fields = std::collections::HashSet::new();
571                let mut result = Self::Value::new();
572                while let Some(tag) = map.next_key::<__FieldTag>()? {
573                    #[allow(clippy::match_single_binding)]
574                    match tag {
575                        __FieldTag::__name => {
576                            if !fields.insert(__FieldTag::__name) {
577                                return std::result::Result::Err(A::Error::duplicate_field(
578                                    "multiple values for name",
579                                ));
580                            }
581                            result.name = map
582                                .next_value::<std::option::Option<std::string::String>>()?
583                                .unwrap_or_default();
584                        }
585                        __FieldTag::Unknown(key) => {
586                            let value = map.next_value::<serde_json::Value>()?;
587                            result._unknown_fields.insert(key, value);
588                        }
589                    }
590                }
591                std::result::Result::Ok(result)
592            }
593        }
594        deserializer.deserialize_any(Visitor)
595    }
596}
597
598#[doc(hidden)]
599impl serde::ser::Serialize for GetClusterRequest {
600    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
601    where
602        S: serde::ser::Serializer,
603    {
604        use serde::ser::SerializeMap;
605        #[allow(unused_imports)]
606        use std::option::Option::Some;
607        let mut state = serializer.serialize_map(std::option::Option::None)?;
608        if !self.name.is_empty() {
609            state.serialize_entry("name", &self.name)?;
610        }
611        if !self._unknown_fields.is_empty() {
612            for (key, value) in self._unknown_fields.iter() {
613                state.serialize_entry(key, &value)?;
614            }
615        }
616        state.end()
617    }
618}
619
620/// Request for CreateCluster.
621#[derive(Clone, Debug, Default, PartialEq)]
622#[non_exhaustive]
623pub struct CreateClusterRequest {
624    /// Required. The parent region in which to create the cluster. Structured like
625    /// `projects/{project}/locations/{location}`.
626    pub parent: std::string::String,
627
628    /// Required. The ID to use for the cluster, which will become the final
629    /// component of the cluster's name. The ID must be 1-63 characters long, and
630    /// match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` to comply with
631    /// RFC 1035.
632    ///
633    /// This value is structured like: `my-cluster-id`.
634    pub cluster_id: std::string::String,
635
636    /// Required. Configuration of the cluster to create. Its `name` field is
637    /// ignored.
638    pub cluster: std::option::Option<crate::model::Cluster>,
639
640    /// Optional. An optional request ID to identify requests. Specify a unique
641    /// request ID to avoid duplication of requests. If a request times out or
642    /// fails, retrying with the same ID allows the server to recognize the
643    /// previous attempt. For at least 60 minutes, the server ignores duplicate
644    /// requests bearing the same ID.
645    ///
646    /// For example, consider a situation where you make an initial request and the
647    /// request times out. If you make the request again with the same request ID
648    /// within 60 minutes of the last request, the server checks if an original
649    /// operation with the same request ID was received. If so, the server ignores
650    /// the second request.
651    ///
652    /// The request ID must be a valid UUID. A zero UUID is not supported
653    /// (00000000-0000-0000-0000-000000000000).
654    pub request_id: std::string::String,
655
656    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
657}
658
659impl CreateClusterRequest {
660    pub fn new() -> Self {
661        std::default::Default::default()
662    }
663
664    /// Sets the value of [parent][crate::model::CreateClusterRequest::parent].
665    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
666        self.parent = v.into();
667        self
668    }
669
670    /// Sets the value of [cluster_id][crate::model::CreateClusterRequest::cluster_id].
671    pub fn set_cluster_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
672        self.cluster_id = v.into();
673        self
674    }
675
676    /// Sets the value of [cluster][crate::model::CreateClusterRequest::cluster].
677    pub fn set_cluster<T>(mut self, v: T) -> Self
678    where
679        T: std::convert::Into<crate::model::Cluster>,
680    {
681        self.cluster = std::option::Option::Some(v.into());
682        self
683    }
684
685    /// Sets or clears the value of [cluster][crate::model::CreateClusterRequest::cluster].
686    pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
687    where
688        T: std::convert::Into<crate::model::Cluster>,
689    {
690        self.cluster = v.map(|x| x.into());
691        self
692    }
693
694    /// Sets the value of [request_id][crate::model::CreateClusterRequest::request_id].
695    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
696        self.request_id = v.into();
697        self
698    }
699}
700
701impl wkt::message::Message for CreateClusterRequest {
702    fn typename() -> &'static str {
703        "type.googleapis.com/google.cloud.managedkafka.v1.CreateClusterRequest"
704    }
705}
706
707#[doc(hidden)]
708impl<'de> serde::de::Deserialize<'de> for CreateClusterRequest {
709    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
710    where
711        D: serde::Deserializer<'de>,
712    {
713        #[allow(non_camel_case_types)]
714        #[doc(hidden)]
715        #[derive(PartialEq, Eq, Hash)]
716        enum __FieldTag {
717            __parent,
718            __cluster_id,
719            __cluster,
720            __request_id,
721            Unknown(std::string::String),
722        }
723        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
724            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
725            where
726                D: serde::Deserializer<'de>,
727            {
728                struct Visitor;
729                impl<'de> serde::de::Visitor<'de> for Visitor {
730                    type Value = __FieldTag;
731                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
732                        formatter.write_str("a field name for CreateClusterRequest")
733                    }
734                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
735                    where
736                        E: serde::de::Error,
737                    {
738                        use std::result::Result::Ok;
739                        use std::string::ToString;
740                        match value {
741                            "parent" => Ok(__FieldTag::__parent),
742                            "clusterId" => Ok(__FieldTag::__cluster_id),
743                            "cluster_id" => Ok(__FieldTag::__cluster_id),
744                            "cluster" => Ok(__FieldTag::__cluster),
745                            "requestId" => Ok(__FieldTag::__request_id),
746                            "request_id" => Ok(__FieldTag::__request_id),
747                            _ => Ok(__FieldTag::Unknown(value.to_string())),
748                        }
749                    }
750                }
751                deserializer.deserialize_identifier(Visitor)
752            }
753        }
754        struct Visitor;
755        impl<'de> serde::de::Visitor<'de> for Visitor {
756            type Value = CreateClusterRequest;
757            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
758                formatter.write_str("struct CreateClusterRequest")
759            }
760            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
761            where
762                A: serde::de::MapAccess<'de>,
763            {
764                #[allow(unused_imports)]
765                use serde::de::Error;
766                use std::option::Option::Some;
767                let mut fields = std::collections::HashSet::new();
768                let mut result = Self::Value::new();
769                while let Some(tag) = map.next_key::<__FieldTag>()? {
770                    #[allow(clippy::match_single_binding)]
771                    match tag {
772                        __FieldTag::__parent => {
773                            if !fields.insert(__FieldTag::__parent) {
774                                return std::result::Result::Err(A::Error::duplicate_field(
775                                    "multiple values for parent",
776                                ));
777                            }
778                            result.parent = map
779                                .next_value::<std::option::Option<std::string::String>>()?
780                                .unwrap_or_default();
781                        }
782                        __FieldTag::__cluster_id => {
783                            if !fields.insert(__FieldTag::__cluster_id) {
784                                return std::result::Result::Err(A::Error::duplicate_field(
785                                    "multiple values for cluster_id",
786                                ));
787                            }
788                            result.cluster_id = map
789                                .next_value::<std::option::Option<std::string::String>>()?
790                                .unwrap_or_default();
791                        }
792                        __FieldTag::__cluster => {
793                            if !fields.insert(__FieldTag::__cluster) {
794                                return std::result::Result::Err(A::Error::duplicate_field(
795                                    "multiple values for cluster",
796                                ));
797                            }
798                            result.cluster =
799                                map.next_value::<std::option::Option<crate::model::Cluster>>()?;
800                        }
801                        __FieldTag::__request_id => {
802                            if !fields.insert(__FieldTag::__request_id) {
803                                return std::result::Result::Err(A::Error::duplicate_field(
804                                    "multiple values for request_id",
805                                ));
806                            }
807                            result.request_id = map
808                                .next_value::<std::option::Option<std::string::String>>()?
809                                .unwrap_or_default();
810                        }
811                        __FieldTag::Unknown(key) => {
812                            let value = map.next_value::<serde_json::Value>()?;
813                            result._unknown_fields.insert(key, value);
814                        }
815                    }
816                }
817                std::result::Result::Ok(result)
818            }
819        }
820        deserializer.deserialize_any(Visitor)
821    }
822}
823
824#[doc(hidden)]
825impl serde::ser::Serialize for CreateClusterRequest {
826    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
827    where
828        S: serde::ser::Serializer,
829    {
830        use serde::ser::SerializeMap;
831        #[allow(unused_imports)]
832        use std::option::Option::Some;
833        let mut state = serializer.serialize_map(std::option::Option::None)?;
834        if !self.parent.is_empty() {
835            state.serialize_entry("parent", &self.parent)?;
836        }
837        if !self.cluster_id.is_empty() {
838            state.serialize_entry("clusterId", &self.cluster_id)?;
839        }
840        if self.cluster.is_some() {
841            state.serialize_entry("cluster", &self.cluster)?;
842        }
843        if !self.request_id.is_empty() {
844            state.serialize_entry("requestId", &self.request_id)?;
845        }
846        if !self._unknown_fields.is_empty() {
847            for (key, value) in self._unknown_fields.iter() {
848                state.serialize_entry(key, &value)?;
849            }
850        }
851        state.end()
852    }
853}
854
855/// Request for UpdateCluster.
856#[derive(Clone, Debug, Default, PartialEq)]
857#[non_exhaustive]
858pub struct UpdateClusterRequest {
859    /// Required. Field mask is used to specify the fields to be overwritten in the
860    /// cluster resource by the update. The fields specified in the update_mask are
861    /// relative to the resource, not the full request. A field will be overwritten
862    /// if it is in the mask. The mask is required and a value of * will update all
863    /// fields.
864    pub update_mask: std::option::Option<wkt::FieldMask>,
865
866    /// Required. The cluster to update. Its `name` field must be populated.
867    pub cluster: std::option::Option<crate::model::Cluster>,
868
869    /// Optional. An optional request ID to identify requests. Specify a unique
870    /// request ID to avoid duplication of requests. If a request times out or
871    /// fails, retrying with the same ID allows the server to recognize the
872    /// previous attempt. For at least 60 minutes, the server ignores duplicate
873    /// requests bearing the same ID.
874    ///
875    /// For example, consider a situation where you make an initial request and the
876    /// request times out. If you make the request again with the same request ID
877    /// within 60 minutes of the last request, the server checks if an original
878    /// operation with the same request ID was received. If so, the server ignores
879    /// the second request.
880    ///
881    /// The request ID must be a valid UUID. A zero UUID is not supported
882    /// (00000000-0000-0000-0000-000000000000).
883    pub request_id: std::string::String,
884
885    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
886}
887
888impl UpdateClusterRequest {
889    pub fn new() -> Self {
890        std::default::Default::default()
891    }
892
893    /// Sets the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
894    pub fn set_update_mask<T>(mut self, v: T) -> Self
895    where
896        T: std::convert::Into<wkt::FieldMask>,
897    {
898        self.update_mask = std::option::Option::Some(v.into());
899        self
900    }
901
902    /// Sets or clears the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
903    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
904    where
905        T: std::convert::Into<wkt::FieldMask>,
906    {
907        self.update_mask = v.map(|x| x.into());
908        self
909    }
910
911    /// Sets the value of [cluster][crate::model::UpdateClusterRequest::cluster].
912    pub fn set_cluster<T>(mut self, v: T) -> Self
913    where
914        T: std::convert::Into<crate::model::Cluster>,
915    {
916        self.cluster = std::option::Option::Some(v.into());
917        self
918    }
919
920    /// Sets or clears the value of [cluster][crate::model::UpdateClusterRequest::cluster].
921    pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
922    where
923        T: std::convert::Into<crate::model::Cluster>,
924    {
925        self.cluster = v.map(|x| x.into());
926        self
927    }
928
929    /// Sets the value of [request_id][crate::model::UpdateClusterRequest::request_id].
930    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
931        self.request_id = v.into();
932        self
933    }
934}
935
936impl wkt::message::Message for UpdateClusterRequest {
937    fn typename() -> &'static str {
938        "type.googleapis.com/google.cloud.managedkafka.v1.UpdateClusterRequest"
939    }
940}
941
942#[doc(hidden)]
943impl<'de> serde::de::Deserialize<'de> for UpdateClusterRequest {
944    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
945    where
946        D: serde::Deserializer<'de>,
947    {
948        #[allow(non_camel_case_types)]
949        #[doc(hidden)]
950        #[derive(PartialEq, Eq, Hash)]
951        enum __FieldTag {
952            __update_mask,
953            __cluster,
954            __request_id,
955            Unknown(std::string::String),
956        }
957        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
958            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
959            where
960                D: serde::Deserializer<'de>,
961            {
962                struct Visitor;
963                impl<'de> serde::de::Visitor<'de> for Visitor {
964                    type Value = __FieldTag;
965                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
966                        formatter.write_str("a field name for UpdateClusterRequest")
967                    }
968                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
969                    where
970                        E: serde::de::Error,
971                    {
972                        use std::result::Result::Ok;
973                        use std::string::ToString;
974                        match value {
975                            "updateMask" => Ok(__FieldTag::__update_mask),
976                            "update_mask" => Ok(__FieldTag::__update_mask),
977                            "cluster" => Ok(__FieldTag::__cluster),
978                            "requestId" => Ok(__FieldTag::__request_id),
979                            "request_id" => Ok(__FieldTag::__request_id),
980                            _ => Ok(__FieldTag::Unknown(value.to_string())),
981                        }
982                    }
983                }
984                deserializer.deserialize_identifier(Visitor)
985            }
986        }
987        struct Visitor;
988        impl<'de> serde::de::Visitor<'de> for Visitor {
989            type Value = UpdateClusterRequest;
990            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
991                formatter.write_str("struct UpdateClusterRequest")
992            }
993            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
994            where
995                A: serde::de::MapAccess<'de>,
996            {
997                #[allow(unused_imports)]
998                use serde::de::Error;
999                use std::option::Option::Some;
1000                let mut fields = std::collections::HashSet::new();
1001                let mut result = Self::Value::new();
1002                while let Some(tag) = map.next_key::<__FieldTag>()? {
1003                    #[allow(clippy::match_single_binding)]
1004                    match tag {
1005                        __FieldTag::__update_mask => {
1006                            if !fields.insert(__FieldTag::__update_mask) {
1007                                return std::result::Result::Err(A::Error::duplicate_field(
1008                                    "multiple values for update_mask",
1009                                ));
1010                            }
1011                            result.update_mask =
1012                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
1013                        }
1014                        __FieldTag::__cluster => {
1015                            if !fields.insert(__FieldTag::__cluster) {
1016                                return std::result::Result::Err(A::Error::duplicate_field(
1017                                    "multiple values for cluster",
1018                                ));
1019                            }
1020                            result.cluster =
1021                                map.next_value::<std::option::Option<crate::model::Cluster>>()?;
1022                        }
1023                        __FieldTag::__request_id => {
1024                            if !fields.insert(__FieldTag::__request_id) {
1025                                return std::result::Result::Err(A::Error::duplicate_field(
1026                                    "multiple values for request_id",
1027                                ));
1028                            }
1029                            result.request_id = map
1030                                .next_value::<std::option::Option<std::string::String>>()?
1031                                .unwrap_or_default();
1032                        }
1033                        __FieldTag::Unknown(key) => {
1034                            let value = map.next_value::<serde_json::Value>()?;
1035                            result._unknown_fields.insert(key, value);
1036                        }
1037                    }
1038                }
1039                std::result::Result::Ok(result)
1040            }
1041        }
1042        deserializer.deserialize_any(Visitor)
1043    }
1044}
1045
1046#[doc(hidden)]
1047impl serde::ser::Serialize for UpdateClusterRequest {
1048    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1049    where
1050        S: serde::ser::Serializer,
1051    {
1052        use serde::ser::SerializeMap;
1053        #[allow(unused_imports)]
1054        use std::option::Option::Some;
1055        let mut state = serializer.serialize_map(std::option::Option::None)?;
1056        if self.update_mask.is_some() {
1057            state.serialize_entry("updateMask", &self.update_mask)?;
1058        }
1059        if self.cluster.is_some() {
1060            state.serialize_entry("cluster", &self.cluster)?;
1061        }
1062        if !self.request_id.is_empty() {
1063            state.serialize_entry("requestId", &self.request_id)?;
1064        }
1065        if !self._unknown_fields.is_empty() {
1066            for (key, value) in self._unknown_fields.iter() {
1067                state.serialize_entry(key, &value)?;
1068            }
1069        }
1070        state.end()
1071    }
1072}
1073
1074/// Request for DeleteCluster.
1075#[derive(Clone, Debug, Default, PartialEq)]
1076#[non_exhaustive]
1077pub struct DeleteClusterRequest {
1078    /// Required. The name of the cluster to delete.
1079    pub name: std::string::String,
1080
1081    /// Optional. An optional request ID to identify requests. Specify a unique
1082    /// request ID to avoid duplication of requests. If a request times out or
1083    /// fails, retrying with the same ID allows the server to recognize the
1084    /// previous attempt. For at least 60 minutes, the server ignores duplicate
1085    /// requests bearing the same ID.
1086    ///
1087    /// For example, consider a situation where you make an initial request and the
1088    /// request times out. If you make the request again with the same request ID
1089    /// within 60 minutes of the last request, the server checks if an original
1090    /// operation with the same request ID was received. If so, the server ignores
1091    /// the second request.
1092    ///
1093    /// The request ID must be a valid UUID. A zero UUID is not supported
1094    /// (00000000-0000-0000-0000-000000000000).
1095    pub request_id: std::string::String,
1096
1097    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1098}
1099
1100impl DeleteClusterRequest {
1101    pub fn new() -> Self {
1102        std::default::Default::default()
1103    }
1104
1105    /// Sets the value of [name][crate::model::DeleteClusterRequest::name].
1106    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1107        self.name = v.into();
1108        self
1109    }
1110
1111    /// Sets the value of [request_id][crate::model::DeleteClusterRequest::request_id].
1112    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1113        self.request_id = v.into();
1114        self
1115    }
1116}
1117
1118impl wkt::message::Message for DeleteClusterRequest {
1119    fn typename() -> &'static str {
1120        "type.googleapis.com/google.cloud.managedkafka.v1.DeleteClusterRequest"
1121    }
1122}
1123
1124#[doc(hidden)]
1125impl<'de> serde::de::Deserialize<'de> for DeleteClusterRequest {
1126    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1127    where
1128        D: serde::Deserializer<'de>,
1129    {
1130        #[allow(non_camel_case_types)]
1131        #[doc(hidden)]
1132        #[derive(PartialEq, Eq, Hash)]
1133        enum __FieldTag {
1134            __name,
1135            __request_id,
1136            Unknown(std::string::String),
1137        }
1138        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1139            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1140            where
1141                D: serde::Deserializer<'de>,
1142            {
1143                struct Visitor;
1144                impl<'de> serde::de::Visitor<'de> for Visitor {
1145                    type Value = __FieldTag;
1146                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1147                        formatter.write_str("a field name for DeleteClusterRequest")
1148                    }
1149                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1150                    where
1151                        E: serde::de::Error,
1152                    {
1153                        use std::result::Result::Ok;
1154                        use std::string::ToString;
1155                        match value {
1156                            "name" => Ok(__FieldTag::__name),
1157                            "requestId" => Ok(__FieldTag::__request_id),
1158                            "request_id" => Ok(__FieldTag::__request_id),
1159                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1160                        }
1161                    }
1162                }
1163                deserializer.deserialize_identifier(Visitor)
1164            }
1165        }
1166        struct Visitor;
1167        impl<'de> serde::de::Visitor<'de> for Visitor {
1168            type Value = DeleteClusterRequest;
1169            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1170                formatter.write_str("struct DeleteClusterRequest")
1171            }
1172            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1173            where
1174                A: serde::de::MapAccess<'de>,
1175            {
1176                #[allow(unused_imports)]
1177                use serde::de::Error;
1178                use std::option::Option::Some;
1179                let mut fields = std::collections::HashSet::new();
1180                let mut result = Self::Value::new();
1181                while let Some(tag) = map.next_key::<__FieldTag>()? {
1182                    #[allow(clippy::match_single_binding)]
1183                    match tag {
1184                        __FieldTag::__name => {
1185                            if !fields.insert(__FieldTag::__name) {
1186                                return std::result::Result::Err(A::Error::duplicate_field(
1187                                    "multiple values for name",
1188                                ));
1189                            }
1190                            result.name = map
1191                                .next_value::<std::option::Option<std::string::String>>()?
1192                                .unwrap_or_default();
1193                        }
1194                        __FieldTag::__request_id => {
1195                            if !fields.insert(__FieldTag::__request_id) {
1196                                return std::result::Result::Err(A::Error::duplicate_field(
1197                                    "multiple values for request_id",
1198                                ));
1199                            }
1200                            result.request_id = map
1201                                .next_value::<std::option::Option<std::string::String>>()?
1202                                .unwrap_or_default();
1203                        }
1204                        __FieldTag::Unknown(key) => {
1205                            let value = map.next_value::<serde_json::Value>()?;
1206                            result._unknown_fields.insert(key, value);
1207                        }
1208                    }
1209                }
1210                std::result::Result::Ok(result)
1211            }
1212        }
1213        deserializer.deserialize_any(Visitor)
1214    }
1215}
1216
1217#[doc(hidden)]
1218impl serde::ser::Serialize for DeleteClusterRequest {
1219    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1220    where
1221        S: serde::ser::Serializer,
1222    {
1223        use serde::ser::SerializeMap;
1224        #[allow(unused_imports)]
1225        use std::option::Option::Some;
1226        let mut state = serializer.serialize_map(std::option::Option::None)?;
1227        if !self.name.is_empty() {
1228            state.serialize_entry("name", &self.name)?;
1229        }
1230        if !self.request_id.is_empty() {
1231            state.serialize_entry("requestId", &self.request_id)?;
1232        }
1233        if !self._unknown_fields.is_empty() {
1234            for (key, value) in self._unknown_fields.iter() {
1235                state.serialize_entry(key, &value)?;
1236            }
1237        }
1238        state.end()
1239    }
1240}
1241
1242/// Request for ListTopics.
1243#[derive(Clone, Debug, Default, PartialEq)]
1244#[non_exhaustive]
1245pub struct ListTopicsRequest {
1246    /// Required. The parent cluster whose topics are to be listed. Structured like
1247    /// `projects/{project}/locations/{location}/clusters/{cluster}`.
1248    pub parent: std::string::String,
1249
1250    /// Optional. The maximum number of topics to return. The service may return
1251    /// fewer than this value. If unset or zero, all topics for the parent is
1252    /// returned.
1253    pub page_size: i32,
1254
1255    /// Optional. A page token, received from a previous `ListTopics` call.
1256    /// Provide this to retrieve the subsequent page.
1257    ///
1258    /// When paginating, all other parameters provided to `ListTopics` must match
1259    /// the call that provided the page token.
1260    pub page_token: std::string::String,
1261
1262    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1263}
1264
1265impl ListTopicsRequest {
1266    pub fn new() -> Self {
1267        std::default::Default::default()
1268    }
1269
1270    /// Sets the value of [parent][crate::model::ListTopicsRequest::parent].
1271    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1272        self.parent = v.into();
1273        self
1274    }
1275
1276    /// Sets the value of [page_size][crate::model::ListTopicsRequest::page_size].
1277    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1278        self.page_size = v.into();
1279        self
1280    }
1281
1282    /// Sets the value of [page_token][crate::model::ListTopicsRequest::page_token].
1283    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1284        self.page_token = v.into();
1285        self
1286    }
1287}
1288
1289impl wkt::message::Message for ListTopicsRequest {
1290    fn typename() -> &'static str {
1291        "type.googleapis.com/google.cloud.managedkafka.v1.ListTopicsRequest"
1292    }
1293}
1294
1295#[doc(hidden)]
1296impl<'de> serde::de::Deserialize<'de> for ListTopicsRequest {
1297    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1298    where
1299        D: serde::Deserializer<'de>,
1300    {
1301        #[allow(non_camel_case_types)]
1302        #[doc(hidden)]
1303        #[derive(PartialEq, Eq, Hash)]
1304        enum __FieldTag {
1305            __parent,
1306            __page_size,
1307            __page_token,
1308            Unknown(std::string::String),
1309        }
1310        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1311            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1312            where
1313                D: serde::Deserializer<'de>,
1314            {
1315                struct Visitor;
1316                impl<'de> serde::de::Visitor<'de> for Visitor {
1317                    type Value = __FieldTag;
1318                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1319                        formatter.write_str("a field name for ListTopicsRequest")
1320                    }
1321                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1322                    where
1323                        E: serde::de::Error,
1324                    {
1325                        use std::result::Result::Ok;
1326                        use std::string::ToString;
1327                        match value {
1328                            "parent" => Ok(__FieldTag::__parent),
1329                            "pageSize" => Ok(__FieldTag::__page_size),
1330                            "page_size" => Ok(__FieldTag::__page_size),
1331                            "pageToken" => Ok(__FieldTag::__page_token),
1332                            "page_token" => Ok(__FieldTag::__page_token),
1333                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1334                        }
1335                    }
1336                }
1337                deserializer.deserialize_identifier(Visitor)
1338            }
1339        }
1340        struct Visitor;
1341        impl<'de> serde::de::Visitor<'de> for Visitor {
1342            type Value = ListTopicsRequest;
1343            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1344                formatter.write_str("struct ListTopicsRequest")
1345            }
1346            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1347            where
1348                A: serde::de::MapAccess<'de>,
1349            {
1350                #[allow(unused_imports)]
1351                use serde::de::Error;
1352                use std::option::Option::Some;
1353                let mut fields = std::collections::HashSet::new();
1354                let mut result = Self::Value::new();
1355                while let Some(tag) = map.next_key::<__FieldTag>()? {
1356                    #[allow(clippy::match_single_binding)]
1357                    match tag {
1358                        __FieldTag::__parent => {
1359                            if !fields.insert(__FieldTag::__parent) {
1360                                return std::result::Result::Err(A::Error::duplicate_field(
1361                                    "multiple values for parent",
1362                                ));
1363                            }
1364                            result.parent = map
1365                                .next_value::<std::option::Option<std::string::String>>()?
1366                                .unwrap_or_default();
1367                        }
1368                        __FieldTag::__page_size => {
1369                            if !fields.insert(__FieldTag::__page_size) {
1370                                return std::result::Result::Err(A::Error::duplicate_field(
1371                                    "multiple values for page_size",
1372                                ));
1373                            }
1374                            struct __With(std::option::Option<i32>);
1375                            impl<'de> serde::de::Deserialize<'de> for __With {
1376                                fn deserialize<D>(
1377                                    deserializer: D,
1378                                ) -> std::result::Result<Self, D::Error>
1379                                where
1380                                    D: serde::de::Deserializer<'de>,
1381                                {
1382                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
1383                                }
1384                            }
1385                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
1386                        }
1387                        __FieldTag::__page_token => {
1388                            if !fields.insert(__FieldTag::__page_token) {
1389                                return std::result::Result::Err(A::Error::duplicate_field(
1390                                    "multiple values for page_token",
1391                                ));
1392                            }
1393                            result.page_token = map
1394                                .next_value::<std::option::Option<std::string::String>>()?
1395                                .unwrap_or_default();
1396                        }
1397                        __FieldTag::Unknown(key) => {
1398                            let value = map.next_value::<serde_json::Value>()?;
1399                            result._unknown_fields.insert(key, value);
1400                        }
1401                    }
1402                }
1403                std::result::Result::Ok(result)
1404            }
1405        }
1406        deserializer.deserialize_any(Visitor)
1407    }
1408}
1409
1410#[doc(hidden)]
1411impl serde::ser::Serialize for ListTopicsRequest {
1412    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1413    where
1414        S: serde::ser::Serializer,
1415    {
1416        use serde::ser::SerializeMap;
1417        #[allow(unused_imports)]
1418        use std::option::Option::Some;
1419        let mut state = serializer.serialize_map(std::option::Option::None)?;
1420        if !self.parent.is_empty() {
1421            state.serialize_entry("parent", &self.parent)?;
1422        }
1423        if !wkt::internal::is_default(&self.page_size) {
1424            struct __With<'a>(&'a i32);
1425            impl<'a> serde::ser::Serialize for __With<'a> {
1426                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1427                where
1428                    S: serde::ser::Serializer,
1429                {
1430                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
1431                }
1432            }
1433            state.serialize_entry("pageSize", &__With(&self.page_size))?;
1434        }
1435        if !self.page_token.is_empty() {
1436            state.serialize_entry("pageToken", &self.page_token)?;
1437        }
1438        if !self._unknown_fields.is_empty() {
1439            for (key, value) in self._unknown_fields.iter() {
1440                state.serialize_entry(key, &value)?;
1441            }
1442        }
1443        state.end()
1444    }
1445}
1446
1447/// Response for ListTopics.
1448#[derive(Clone, Debug, Default, PartialEq)]
1449#[non_exhaustive]
1450pub struct ListTopicsResponse {
1451    /// The list of topics in the requested parent. The order of the topics is
1452    /// unspecified.
1453    pub topics: std::vec::Vec<crate::model::Topic>,
1454
1455    /// A token that can be sent as `page_token` to retrieve the next page of
1456    /// results. If this field is omitted, there are no more results.
1457    pub next_page_token: std::string::String,
1458
1459    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1460}
1461
1462impl ListTopicsResponse {
1463    pub fn new() -> Self {
1464        std::default::Default::default()
1465    }
1466
1467    /// Sets the value of [topics][crate::model::ListTopicsResponse::topics].
1468    pub fn set_topics<T, V>(mut self, v: T) -> Self
1469    where
1470        T: std::iter::IntoIterator<Item = V>,
1471        V: std::convert::Into<crate::model::Topic>,
1472    {
1473        use std::iter::Iterator;
1474        self.topics = v.into_iter().map(|i| i.into()).collect();
1475        self
1476    }
1477
1478    /// Sets the value of [next_page_token][crate::model::ListTopicsResponse::next_page_token].
1479    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1480        self.next_page_token = v.into();
1481        self
1482    }
1483}
1484
1485impl wkt::message::Message for ListTopicsResponse {
1486    fn typename() -> &'static str {
1487        "type.googleapis.com/google.cloud.managedkafka.v1.ListTopicsResponse"
1488    }
1489}
1490
1491#[doc(hidden)]
1492impl gax::paginator::internal::PageableResponse for ListTopicsResponse {
1493    type PageItem = crate::model::Topic;
1494
1495    fn items(self) -> std::vec::Vec<Self::PageItem> {
1496        self.topics
1497    }
1498
1499    fn next_page_token(&self) -> std::string::String {
1500        use std::clone::Clone;
1501        self.next_page_token.clone()
1502    }
1503}
1504
1505#[doc(hidden)]
1506impl<'de> serde::de::Deserialize<'de> for ListTopicsResponse {
1507    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1508    where
1509        D: serde::Deserializer<'de>,
1510    {
1511        #[allow(non_camel_case_types)]
1512        #[doc(hidden)]
1513        #[derive(PartialEq, Eq, Hash)]
1514        enum __FieldTag {
1515            __topics,
1516            __next_page_token,
1517            Unknown(std::string::String),
1518        }
1519        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1520            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1521            where
1522                D: serde::Deserializer<'de>,
1523            {
1524                struct Visitor;
1525                impl<'de> serde::de::Visitor<'de> for Visitor {
1526                    type Value = __FieldTag;
1527                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1528                        formatter.write_str("a field name for ListTopicsResponse")
1529                    }
1530                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1531                    where
1532                        E: serde::de::Error,
1533                    {
1534                        use std::result::Result::Ok;
1535                        use std::string::ToString;
1536                        match value {
1537                            "topics" => Ok(__FieldTag::__topics),
1538                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
1539                            "next_page_token" => Ok(__FieldTag::__next_page_token),
1540                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1541                        }
1542                    }
1543                }
1544                deserializer.deserialize_identifier(Visitor)
1545            }
1546        }
1547        struct Visitor;
1548        impl<'de> serde::de::Visitor<'de> for Visitor {
1549            type Value = ListTopicsResponse;
1550            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1551                formatter.write_str("struct ListTopicsResponse")
1552            }
1553            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1554            where
1555                A: serde::de::MapAccess<'de>,
1556            {
1557                #[allow(unused_imports)]
1558                use serde::de::Error;
1559                use std::option::Option::Some;
1560                let mut fields = std::collections::HashSet::new();
1561                let mut result = Self::Value::new();
1562                while let Some(tag) = map.next_key::<__FieldTag>()? {
1563                    #[allow(clippy::match_single_binding)]
1564                    match tag {
1565                        __FieldTag::__topics => {
1566                            if !fields.insert(__FieldTag::__topics) {
1567                                return std::result::Result::Err(A::Error::duplicate_field(
1568                                    "multiple values for topics",
1569                                ));
1570                            }
1571                            result.topics = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Topic>>>()?.unwrap_or_default();
1572                        }
1573                        __FieldTag::__next_page_token => {
1574                            if !fields.insert(__FieldTag::__next_page_token) {
1575                                return std::result::Result::Err(A::Error::duplicate_field(
1576                                    "multiple values for next_page_token",
1577                                ));
1578                            }
1579                            result.next_page_token = map
1580                                .next_value::<std::option::Option<std::string::String>>()?
1581                                .unwrap_or_default();
1582                        }
1583                        __FieldTag::Unknown(key) => {
1584                            let value = map.next_value::<serde_json::Value>()?;
1585                            result._unknown_fields.insert(key, value);
1586                        }
1587                    }
1588                }
1589                std::result::Result::Ok(result)
1590            }
1591        }
1592        deserializer.deserialize_any(Visitor)
1593    }
1594}
1595
1596#[doc(hidden)]
1597impl serde::ser::Serialize for ListTopicsResponse {
1598    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1599    where
1600        S: serde::ser::Serializer,
1601    {
1602        use serde::ser::SerializeMap;
1603        #[allow(unused_imports)]
1604        use std::option::Option::Some;
1605        let mut state = serializer.serialize_map(std::option::Option::None)?;
1606        if !self.topics.is_empty() {
1607            state.serialize_entry("topics", &self.topics)?;
1608        }
1609        if !self.next_page_token.is_empty() {
1610            state.serialize_entry("nextPageToken", &self.next_page_token)?;
1611        }
1612        if !self._unknown_fields.is_empty() {
1613            for (key, value) in self._unknown_fields.iter() {
1614                state.serialize_entry(key, &value)?;
1615            }
1616        }
1617        state.end()
1618    }
1619}
1620
1621/// Request for GetTopic.
1622#[derive(Clone, Debug, Default, PartialEq)]
1623#[non_exhaustive]
1624pub struct GetTopicRequest {
1625    /// Required. The name of the topic whose configuration to return. Structured
1626    /// like:
1627    /// projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}.
1628    pub name: std::string::String,
1629
1630    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1631}
1632
1633impl GetTopicRequest {
1634    pub fn new() -> Self {
1635        std::default::Default::default()
1636    }
1637
1638    /// Sets the value of [name][crate::model::GetTopicRequest::name].
1639    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1640        self.name = v.into();
1641        self
1642    }
1643}
1644
1645impl wkt::message::Message for GetTopicRequest {
1646    fn typename() -> &'static str {
1647        "type.googleapis.com/google.cloud.managedkafka.v1.GetTopicRequest"
1648    }
1649}
1650
1651#[doc(hidden)]
1652impl<'de> serde::de::Deserialize<'de> for GetTopicRequest {
1653    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1654    where
1655        D: serde::Deserializer<'de>,
1656    {
1657        #[allow(non_camel_case_types)]
1658        #[doc(hidden)]
1659        #[derive(PartialEq, Eq, Hash)]
1660        enum __FieldTag {
1661            __name,
1662            Unknown(std::string::String),
1663        }
1664        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1665            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1666            where
1667                D: serde::Deserializer<'de>,
1668            {
1669                struct Visitor;
1670                impl<'de> serde::de::Visitor<'de> for Visitor {
1671                    type Value = __FieldTag;
1672                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1673                        formatter.write_str("a field name for GetTopicRequest")
1674                    }
1675                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1676                    where
1677                        E: serde::de::Error,
1678                    {
1679                        use std::result::Result::Ok;
1680                        use std::string::ToString;
1681                        match value {
1682                            "name" => Ok(__FieldTag::__name),
1683                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1684                        }
1685                    }
1686                }
1687                deserializer.deserialize_identifier(Visitor)
1688            }
1689        }
1690        struct Visitor;
1691        impl<'de> serde::de::Visitor<'de> for Visitor {
1692            type Value = GetTopicRequest;
1693            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1694                formatter.write_str("struct GetTopicRequest")
1695            }
1696            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1697            where
1698                A: serde::de::MapAccess<'de>,
1699            {
1700                #[allow(unused_imports)]
1701                use serde::de::Error;
1702                use std::option::Option::Some;
1703                let mut fields = std::collections::HashSet::new();
1704                let mut result = Self::Value::new();
1705                while let Some(tag) = map.next_key::<__FieldTag>()? {
1706                    #[allow(clippy::match_single_binding)]
1707                    match tag {
1708                        __FieldTag::__name => {
1709                            if !fields.insert(__FieldTag::__name) {
1710                                return std::result::Result::Err(A::Error::duplicate_field(
1711                                    "multiple values for name",
1712                                ));
1713                            }
1714                            result.name = map
1715                                .next_value::<std::option::Option<std::string::String>>()?
1716                                .unwrap_or_default();
1717                        }
1718                        __FieldTag::Unknown(key) => {
1719                            let value = map.next_value::<serde_json::Value>()?;
1720                            result._unknown_fields.insert(key, value);
1721                        }
1722                    }
1723                }
1724                std::result::Result::Ok(result)
1725            }
1726        }
1727        deserializer.deserialize_any(Visitor)
1728    }
1729}
1730
1731#[doc(hidden)]
1732impl serde::ser::Serialize for GetTopicRequest {
1733    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1734    where
1735        S: serde::ser::Serializer,
1736    {
1737        use serde::ser::SerializeMap;
1738        #[allow(unused_imports)]
1739        use std::option::Option::Some;
1740        let mut state = serializer.serialize_map(std::option::Option::None)?;
1741        if !self.name.is_empty() {
1742            state.serialize_entry("name", &self.name)?;
1743        }
1744        if !self._unknown_fields.is_empty() {
1745            for (key, value) in self._unknown_fields.iter() {
1746                state.serialize_entry(key, &value)?;
1747            }
1748        }
1749        state.end()
1750    }
1751}
1752
1753/// Request for CreateTopic.
1754#[derive(Clone, Debug, Default, PartialEq)]
1755#[non_exhaustive]
1756pub struct CreateTopicRequest {
1757    /// Required. The parent cluster in which to create the topic.
1758    /// Structured like
1759    /// `projects/{project}/locations/{location}/clusters/{cluster}`.
1760    pub parent: std::string::String,
1761
1762    /// Required. The ID to use for the topic, which will become the final
1763    /// component of the topic's name.
1764    ///
1765    /// This value is structured like: `my-topic-name`.
1766    pub topic_id: std::string::String,
1767
1768    /// Required. Configuration of the topic to create. Its `name` field is
1769    /// ignored.
1770    pub topic: std::option::Option<crate::model::Topic>,
1771
1772    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1773}
1774
1775impl CreateTopicRequest {
1776    pub fn new() -> Self {
1777        std::default::Default::default()
1778    }
1779
1780    /// Sets the value of [parent][crate::model::CreateTopicRequest::parent].
1781    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1782        self.parent = v.into();
1783        self
1784    }
1785
1786    /// Sets the value of [topic_id][crate::model::CreateTopicRequest::topic_id].
1787    pub fn set_topic_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1788        self.topic_id = v.into();
1789        self
1790    }
1791
1792    /// Sets the value of [topic][crate::model::CreateTopicRequest::topic].
1793    pub fn set_topic<T>(mut self, v: T) -> Self
1794    where
1795        T: std::convert::Into<crate::model::Topic>,
1796    {
1797        self.topic = std::option::Option::Some(v.into());
1798        self
1799    }
1800
1801    /// Sets or clears the value of [topic][crate::model::CreateTopicRequest::topic].
1802    pub fn set_or_clear_topic<T>(mut self, v: std::option::Option<T>) -> Self
1803    where
1804        T: std::convert::Into<crate::model::Topic>,
1805    {
1806        self.topic = v.map(|x| x.into());
1807        self
1808    }
1809}
1810
1811impl wkt::message::Message for CreateTopicRequest {
1812    fn typename() -> &'static str {
1813        "type.googleapis.com/google.cloud.managedkafka.v1.CreateTopicRequest"
1814    }
1815}
1816
1817#[doc(hidden)]
1818impl<'de> serde::de::Deserialize<'de> for CreateTopicRequest {
1819    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1820    where
1821        D: serde::Deserializer<'de>,
1822    {
1823        #[allow(non_camel_case_types)]
1824        #[doc(hidden)]
1825        #[derive(PartialEq, Eq, Hash)]
1826        enum __FieldTag {
1827            __parent,
1828            __topic_id,
1829            __topic,
1830            Unknown(std::string::String),
1831        }
1832        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1833            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1834            where
1835                D: serde::Deserializer<'de>,
1836            {
1837                struct Visitor;
1838                impl<'de> serde::de::Visitor<'de> for Visitor {
1839                    type Value = __FieldTag;
1840                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1841                        formatter.write_str("a field name for CreateTopicRequest")
1842                    }
1843                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1844                    where
1845                        E: serde::de::Error,
1846                    {
1847                        use std::result::Result::Ok;
1848                        use std::string::ToString;
1849                        match value {
1850                            "parent" => Ok(__FieldTag::__parent),
1851                            "topicId" => Ok(__FieldTag::__topic_id),
1852                            "topic_id" => Ok(__FieldTag::__topic_id),
1853                            "topic" => Ok(__FieldTag::__topic),
1854                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1855                        }
1856                    }
1857                }
1858                deserializer.deserialize_identifier(Visitor)
1859            }
1860        }
1861        struct Visitor;
1862        impl<'de> serde::de::Visitor<'de> for Visitor {
1863            type Value = CreateTopicRequest;
1864            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1865                formatter.write_str("struct CreateTopicRequest")
1866            }
1867            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1868            where
1869                A: serde::de::MapAccess<'de>,
1870            {
1871                #[allow(unused_imports)]
1872                use serde::de::Error;
1873                use std::option::Option::Some;
1874                let mut fields = std::collections::HashSet::new();
1875                let mut result = Self::Value::new();
1876                while let Some(tag) = map.next_key::<__FieldTag>()? {
1877                    #[allow(clippy::match_single_binding)]
1878                    match tag {
1879                        __FieldTag::__parent => {
1880                            if !fields.insert(__FieldTag::__parent) {
1881                                return std::result::Result::Err(A::Error::duplicate_field(
1882                                    "multiple values for parent",
1883                                ));
1884                            }
1885                            result.parent = map
1886                                .next_value::<std::option::Option<std::string::String>>()?
1887                                .unwrap_or_default();
1888                        }
1889                        __FieldTag::__topic_id => {
1890                            if !fields.insert(__FieldTag::__topic_id) {
1891                                return std::result::Result::Err(A::Error::duplicate_field(
1892                                    "multiple values for topic_id",
1893                                ));
1894                            }
1895                            result.topic_id = map
1896                                .next_value::<std::option::Option<std::string::String>>()?
1897                                .unwrap_or_default();
1898                        }
1899                        __FieldTag::__topic => {
1900                            if !fields.insert(__FieldTag::__topic) {
1901                                return std::result::Result::Err(A::Error::duplicate_field(
1902                                    "multiple values for topic",
1903                                ));
1904                            }
1905                            result.topic =
1906                                map.next_value::<std::option::Option<crate::model::Topic>>()?;
1907                        }
1908                        __FieldTag::Unknown(key) => {
1909                            let value = map.next_value::<serde_json::Value>()?;
1910                            result._unknown_fields.insert(key, value);
1911                        }
1912                    }
1913                }
1914                std::result::Result::Ok(result)
1915            }
1916        }
1917        deserializer.deserialize_any(Visitor)
1918    }
1919}
1920
1921#[doc(hidden)]
1922impl serde::ser::Serialize for CreateTopicRequest {
1923    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1924    where
1925        S: serde::ser::Serializer,
1926    {
1927        use serde::ser::SerializeMap;
1928        #[allow(unused_imports)]
1929        use std::option::Option::Some;
1930        let mut state = serializer.serialize_map(std::option::Option::None)?;
1931        if !self.parent.is_empty() {
1932            state.serialize_entry("parent", &self.parent)?;
1933        }
1934        if !self.topic_id.is_empty() {
1935            state.serialize_entry("topicId", &self.topic_id)?;
1936        }
1937        if self.topic.is_some() {
1938            state.serialize_entry("topic", &self.topic)?;
1939        }
1940        if !self._unknown_fields.is_empty() {
1941            for (key, value) in self._unknown_fields.iter() {
1942                state.serialize_entry(key, &value)?;
1943            }
1944        }
1945        state.end()
1946    }
1947}
1948
1949/// Request for UpdateTopic.
1950#[derive(Clone, Debug, Default, PartialEq)]
1951#[non_exhaustive]
1952pub struct UpdateTopicRequest {
1953    /// Required. Field mask is used to specify the fields to be overwritten in the
1954    /// Topic resource by the update. The fields specified in the update_mask are
1955    /// relative to the resource, not the full request. A field will be overwritten
1956    /// if it is in the mask. The mask is required and a value of * will update all
1957    /// fields.
1958    pub update_mask: std::option::Option<wkt::FieldMask>,
1959
1960    /// Required. The topic to update. Its `name` field must be populated.
1961    pub topic: std::option::Option<crate::model::Topic>,
1962
1963    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1964}
1965
1966impl UpdateTopicRequest {
1967    pub fn new() -> Self {
1968        std::default::Default::default()
1969    }
1970
1971    /// Sets the value of [update_mask][crate::model::UpdateTopicRequest::update_mask].
1972    pub fn set_update_mask<T>(mut self, v: T) -> Self
1973    where
1974        T: std::convert::Into<wkt::FieldMask>,
1975    {
1976        self.update_mask = std::option::Option::Some(v.into());
1977        self
1978    }
1979
1980    /// Sets or clears the value of [update_mask][crate::model::UpdateTopicRequest::update_mask].
1981    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1982    where
1983        T: std::convert::Into<wkt::FieldMask>,
1984    {
1985        self.update_mask = v.map(|x| x.into());
1986        self
1987    }
1988
1989    /// Sets the value of [topic][crate::model::UpdateTopicRequest::topic].
1990    pub fn set_topic<T>(mut self, v: T) -> Self
1991    where
1992        T: std::convert::Into<crate::model::Topic>,
1993    {
1994        self.topic = std::option::Option::Some(v.into());
1995        self
1996    }
1997
1998    /// Sets or clears the value of [topic][crate::model::UpdateTopicRequest::topic].
1999    pub fn set_or_clear_topic<T>(mut self, v: std::option::Option<T>) -> Self
2000    where
2001        T: std::convert::Into<crate::model::Topic>,
2002    {
2003        self.topic = v.map(|x| x.into());
2004        self
2005    }
2006}
2007
2008impl wkt::message::Message for UpdateTopicRequest {
2009    fn typename() -> &'static str {
2010        "type.googleapis.com/google.cloud.managedkafka.v1.UpdateTopicRequest"
2011    }
2012}
2013
2014#[doc(hidden)]
2015impl<'de> serde::de::Deserialize<'de> for UpdateTopicRequest {
2016    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2017    where
2018        D: serde::Deserializer<'de>,
2019    {
2020        #[allow(non_camel_case_types)]
2021        #[doc(hidden)]
2022        #[derive(PartialEq, Eq, Hash)]
2023        enum __FieldTag {
2024            __update_mask,
2025            __topic,
2026            Unknown(std::string::String),
2027        }
2028        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2029            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2030            where
2031                D: serde::Deserializer<'de>,
2032            {
2033                struct Visitor;
2034                impl<'de> serde::de::Visitor<'de> for Visitor {
2035                    type Value = __FieldTag;
2036                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2037                        formatter.write_str("a field name for UpdateTopicRequest")
2038                    }
2039                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2040                    where
2041                        E: serde::de::Error,
2042                    {
2043                        use std::result::Result::Ok;
2044                        use std::string::ToString;
2045                        match value {
2046                            "updateMask" => Ok(__FieldTag::__update_mask),
2047                            "update_mask" => Ok(__FieldTag::__update_mask),
2048                            "topic" => Ok(__FieldTag::__topic),
2049                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2050                        }
2051                    }
2052                }
2053                deserializer.deserialize_identifier(Visitor)
2054            }
2055        }
2056        struct Visitor;
2057        impl<'de> serde::de::Visitor<'de> for Visitor {
2058            type Value = UpdateTopicRequest;
2059            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2060                formatter.write_str("struct UpdateTopicRequest")
2061            }
2062            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2063            where
2064                A: serde::de::MapAccess<'de>,
2065            {
2066                #[allow(unused_imports)]
2067                use serde::de::Error;
2068                use std::option::Option::Some;
2069                let mut fields = std::collections::HashSet::new();
2070                let mut result = Self::Value::new();
2071                while let Some(tag) = map.next_key::<__FieldTag>()? {
2072                    #[allow(clippy::match_single_binding)]
2073                    match tag {
2074                        __FieldTag::__update_mask => {
2075                            if !fields.insert(__FieldTag::__update_mask) {
2076                                return std::result::Result::Err(A::Error::duplicate_field(
2077                                    "multiple values for update_mask",
2078                                ));
2079                            }
2080                            result.update_mask =
2081                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
2082                        }
2083                        __FieldTag::__topic => {
2084                            if !fields.insert(__FieldTag::__topic) {
2085                                return std::result::Result::Err(A::Error::duplicate_field(
2086                                    "multiple values for topic",
2087                                ));
2088                            }
2089                            result.topic =
2090                                map.next_value::<std::option::Option<crate::model::Topic>>()?;
2091                        }
2092                        __FieldTag::Unknown(key) => {
2093                            let value = map.next_value::<serde_json::Value>()?;
2094                            result._unknown_fields.insert(key, value);
2095                        }
2096                    }
2097                }
2098                std::result::Result::Ok(result)
2099            }
2100        }
2101        deserializer.deserialize_any(Visitor)
2102    }
2103}
2104
2105#[doc(hidden)]
2106impl serde::ser::Serialize for UpdateTopicRequest {
2107    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2108    where
2109        S: serde::ser::Serializer,
2110    {
2111        use serde::ser::SerializeMap;
2112        #[allow(unused_imports)]
2113        use std::option::Option::Some;
2114        let mut state = serializer.serialize_map(std::option::Option::None)?;
2115        if self.update_mask.is_some() {
2116            state.serialize_entry("updateMask", &self.update_mask)?;
2117        }
2118        if self.topic.is_some() {
2119            state.serialize_entry("topic", &self.topic)?;
2120        }
2121        if !self._unknown_fields.is_empty() {
2122            for (key, value) in self._unknown_fields.iter() {
2123                state.serialize_entry(key, &value)?;
2124            }
2125        }
2126        state.end()
2127    }
2128}
2129
2130/// Request for DeleteTopic.
2131#[derive(Clone, Debug, Default, PartialEq)]
2132#[non_exhaustive]
2133pub struct DeleteTopicRequest {
2134    /// Required. The name of the topic to delete.
2135    /// `projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}`.
2136    pub name: std::string::String,
2137
2138    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2139}
2140
2141impl DeleteTopicRequest {
2142    pub fn new() -> Self {
2143        std::default::Default::default()
2144    }
2145
2146    /// Sets the value of [name][crate::model::DeleteTopicRequest::name].
2147    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2148        self.name = v.into();
2149        self
2150    }
2151}
2152
2153impl wkt::message::Message for DeleteTopicRequest {
2154    fn typename() -> &'static str {
2155        "type.googleapis.com/google.cloud.managedkafka.v1.DeleteTopicRequest"
2156    }
2157}
2158
2159#[doc(hidden)]
2160impl<'de> serde::de::Deserialize<'de> for DeleteTopicRequest {
2161    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2162    where
2163        D: serde::Deserializer<'de>,
2164    {
2165        #[allow(non_camel_case_types)]
2166        #[doc(hidden)]
2167        #[derive(PartialEq, Eq, Hash)]
2168        enum __FieldTag {
2169            __name,
2170            Unknown(std::string::String),
2171        }
2172        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2173            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2174            where
2175                D: serde::Deserializer<'de>,
2176            {
2177                struct Visitor;
2178                impl<'de> serde::de::Visitor<'de> for Visitor {
2179                    type Value = __FieldTag;
2180                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2181                        formatter.write_str("a field name for DeleteTopicRequest")
2182                    }
2183                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2184                    where
2185                        E: serde::de::Error,
2186                    {
2187                        use std::result::Result::Ok;
2188                        use std::string::ToString;
2189                        match value {
2190                            "name" => Ok(__FieldTag::__name),
2191                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2192                        }
2193                    }
2194                }
2195                deserializer.deserialize_identifier(Visitor)
2196            }
2197        }
2198        struct Visitor;
2199        impl<'de> serde::de::Visitor<'de> for Visitor {
2200            type Value = DeleteTopicRequest;
2201            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2202                formatter.write_str("struct DeleteTopicRequest")
2203            }
2204            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2205            where
2206                A: serde::de::MapAccess<'de>,
2207            {
2208                #[allow(unused_imports)]
2209                use serde::de::Error;
2210                use std::option::Option::Some;
2211                let mut fields = std::collections::HashSet::new();
2212                let mut result = Self::Value::new();
2213                while let Some(tag) = map.next_key::<__FieldTag>()? {
2214                    #[allow(clippy::match_single_binding)]
2215                    match tag {
2216                        __FieldTag::__name => {
2217                            if !fields.insert(__FieldTag::__name) {
2218                                return std::result::Result::Err(A::Error::duplicate_field(
2219                                    "multiple values for name",
2220                                ));
2221                            }
2222                            result.name = map
2223                                .next_value::<std::option::Option<std::string::String>>()?
2224                                .unwrap_or_default();
2225                        }
2226                        __FieldTag::Unknown(key) => {
2227                            let value = map.next_value::<serde_json::Value>()?;
2228                            result._unknown_fields.insert(key, value);
2229                        }
2230                    }
2231                }
2232                std::result::Result::Ok(result)
2233            }
2234        }
2235        deserializer.deserialize_any(Visitor)
2236    }
2237}
2238
2239#[doc(hidden)]
2240impl serde::ser::Serialize for DeleteTopicRequest {
2241    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2242    where
2243        S: serde::ser::Serializer,
2244    {
2245        use serde::ser::SerializeMap;
2246        #[allow(unused_imports)]
2247        use std::option::Option::Some;
2248        let mut state = serializer.serialize_map(std::option::Option::None)?;
2249        if !self.name.is_empty() {
2250            state.serialize_entry("name", &self.name)?;
2251        }
2252        if !self._unknown_fields.is_empty() {
2253            for (key, value) in self._unknown_fields.iter() {
2254                state.serialize_entry(key, &value)?;
2255            }
2256        }
2257        state.end()
2258    }
2259}
2260
2261/// Request for ListConsumerGroups.
2262#[derive(Clone, Debug, Default, PartialEq)]
2263#[non_exhaustive]
2264pub struct ListConsumerGroupsRequest {
2265    /// Required. The parent cluster whose consumer groups are to be listed.
2266    /// Structured like
2267    /// `projects/{project}/locations/{location}/clusters/{cluster}`.
2268    pub parent: std::string::String,
2269
2270    /// Optional. The maximum number of consumer groups to return. The service may
2271    /// return fewer than this value. If unset or zero, all consumer groups for the
2272    /// parent is returned.
2273    pub page_size: i32,
2274
2275    /// Optional. A page token, received from a previous `ListConsumerGroups` call.
2276    /// Provide this to retrieve the subsequent page.
2277    ///
2278    /// When paginating, all other parameters provided to `ListConsumerGroups` must
2279    /// match the call that provided the page token.
2280    pub page_token: std::string::String,
2281
2282    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2283}
2284
2285impl ListConsumerGroupsRequest {
2286    pub fn new() -> Self {
2287        std::default::Default::default()
2288    }
2289
2290    /// Sets the value of [parent][crate::model::ListConsumerGroupsRequest::parent].
2291    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2292        self.parent = v.into();
2293        self
2294    }
2295
2296    /// Sets the value of [page_size][crate::model::ListConsumerGroupsRequest::page_size].
2297    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2298        self.page_size = v.into();
2299        self
2300    }
2301
2302    /// Sets the value of [page_token][crate::model::ListConsumerGroupsRequest::page_token].
2303    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2304        self.page_token = v.into();
2305        self
2306    }
2307}
2308
2309impl wkt::message::Message for ListConsumerGroupsRequest {
2310    fn typename() -> &'static str {
2311        "type.googleapis.com/google.cloud.managedkafka.v1.ListConsumerGroupsRequest"
2312    }
2313}
2314
2315#[doc(hidden)]
2316impl<'de> serde::de::Deserialize<'de> for ListConsumerGroupsRequest {
2317    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2318    where
2319        D: serde::Deserializer<'de>,
2320    {
2321        #[allow(non_camel_case_types)]
2322        #[doc(hidden)]
2323        #[derive(PartialEq, Eq, Hash)]
2324        enum __FieldTag {
2325            __parent,
2326            __page_size,
2327            __page_token,
2328            Unknown(std::string::String),
2329        }
2330        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2331            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2332            where
2333                D: serde::Deserializer<'de>,
2334            {
2335                struct Visitor;
2336                impl<'de> serde::de::Visitor<'de> for Visitor {
2337                    type Value = __FieldTag;
2338                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2339                        formatter.write_str("a field name for ListConsumerGroupsRequest")
2340                    }
2341                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2342                    where
2343                        E: serde::de::Error,
2344                    {
2345                        use std::result::Result::Ok;
2346                        use std::string::ToString;
2347                        match value {
2348                            "parent" => Ok(__FieldTag::__parent),
2349                            "pageSize" => Ok(__FieldTag::__page_size),
2350                            "page_size" => Ok(__FieldTag::__page_size),
2351                            "pageToken" => Ok(__FieldTag::__page_token),
2352                            "page_token" => Ok(__FieldTag::__page_token),
2353                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2354                        }
2355                    }
2356                }
2357                deserializer.deserialize_identifier(Visitor)
2358            }
2359        }
2360        struct Visitor;
2361        impl<'de> serde::de::Visitor<'de> for Visitor {
2362            type Value = ListConsumerGroupsRequest;
2363            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2364                formatter.write_str("struct ListConsumerGroupsRequest")
2365            }
2366            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2367            where
2368                A: serde::de::MapAccess<'de>,
2369            {
2370                #[allow(unused_imports)]
2371                use serde::de::Error;
2372                use std::option::Option::Some;
2373                let mut fields = std::collections::HashSet::new();
2374                let mut result = Self::Value::new();
2375                while let Some(tag) = map.next_key::<__FieldTag>()? {
2376                    #[allow(clippy::match_single_binding)]
2377                    match tag {
2378                        __FieldTag::__parent => {
2379                            if !fields.insert(__FieldTag::__parent) {
2380                                return std::result::Result::Err(A::Error::duplicate_field(
2381                                    "multiple values for parent",
2382                                ));
2383                            }
2384                            result.parent = map
2385                                .next_value::<std::option::Option<std::string::String>>()?
2386                                .unwrap_or_default();
2387                        }
2388                        __FieldTag::__page_size => {
2389                            if !fields.insert(__FieldTag::__page_size) {
2390                                return std::result::Result::Err(A::Error::duplicate_field(
2391                                    "multiple values for page_size",
2392                                ));
2393                            }
2394                            struct __With(std::option::Option<i32>);
2395                            impl<'de> serde::de::Deserialize<'de> for __With {
2396                                fn deserialize<D>(
2397                                    deserializer: D,
2398                                ) -> std::result::Result<Self, D::Error>
2399                                where
2400                                    D: serde::de::Deserializer<'de>,
2401                                {
2402                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2403                                }
2404                            }
2405                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
2406                        }
2407                        __FieldTag::__page_token => {
2408                            if !fields.insert(__FieldTag::__page_token) {
2409                                return std::result::Result::Err(A::Error::duplicate_field(
2410                                    "multiple values for page_token",
2411                                ));
2412                            }
2413                            result.page_token = map
2414                                .next_value::<std::option::Option<std::string::String>>()?
2415                                .unwrap_or_default();
2416                        }
2417                        __FieldTag::Unknown(key) => {
2418                            let value = map.next_value::<serde_json::Value>()?;
2419                            result._unknown_fields.insert(key, value);
2420                        }
2421                    }
2422                }
2423                std::result::Result::Ok(result)
2424            }
2425        }
2426        deserializer.deserialize_any(Visitor)
2427    }
2428}
2429
2430#[doc(hidden)]
2431impl serde::ser::Serialize for ListConsumerGroupsRequest {
2432    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2433    where
2434        S: serde::ser::Serializer,
2435    {
2436        use serde::ser::SerializeMap;
2437        #[allow(unused_imports)]
2438        use std::option::Option::Some;
2439        let mut state = serializer.serialize_map(std::option::Option::None)?;
2440        if !self.parent.is_empty() {
2441            state.serialize_entry("parent", &self.parent)?;
2442        }
2443        if !wkt::internal::is_default(&self.page_size) {
2444            struct __With<'a>(&'a i32);
2445            impl<'a> serde::ser::Serialize for __With<'a> {
2446                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2447                where
2448                    S: serde::ser::Serializer,
2449                {
2450                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2451                }
2452            }
2453            state.serialize_entry("pageSize", &__With(&self.page_size))?;
2454        }
2455        if !self.page_token.is_empty() {
2456            state.serialize_entry("pageToken", &self.page_token)?;
2457        }
2458        if !self._unknown_fields.is_empty() {
2459            for (key, value) in self._unknown_fields.iter() {
2460                state.serialize_entry(key, &value)?;
2461            }
2462        }
2463        state.end()
2464    }
2465}
2466
2467/// Response for ListConsumerGroups.
2468#[derive(Clone, Debug, Default, PartialEq)]
2469#[non_exhaustive]
2470pub struct ListConsumerGroupsResponse {
2471    /// The list of consumer group in the requested parent. The order of the
2472    /// consumer groups is unspecified.
2473    pub consumer_groups: std::vec::Vec<crate::model::ConsumerGroup>,
2474
2475    /// A token that can be sent as `page_token` to retrieve the next page of
2476    /// results. If this field is omitted, there are no more results.
2477    pub next_page_token: std::string::String,
2478
2479    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2480}
2481
2482impl ListConsumerGroupsResponse {
2483    pub fn new() -> Self {
2484        std::default::Default::default()
2485    }
2486
2487    /// Sets the value of [consumer_groups][crate::model::ListConsumerGroupsResponse::consumer_groups].
2488    pub fn set_consumer_groups<T, V>(mut self, v: T) -> Self
2489    where
2490        T: std::iter::IntoIterator<Item = V>,
2491        V: std::convert::Into<crate::model::ConsumerGroup>,
2492    {
2493        use std::iter::Iterator;
2494        self.consumer_groups = v.into_iter().map(|i| i.into()).collect();
2495        self
2496    }
2497
2498    /// Sets the value of [next_page_token][crate::model::ListConsumerGroupsResponse::next_page_token].
2499    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2500        self.next_page_token = v.into();
2501        self
2502    }
2503}
2504
2505impl wkt::message::Message for ListConsumerGroupsResponse {
2506    fn typename() -> &'static str {
2507        "type.googleapis.com/google.cloud.managedkafka.v1.ListConsumerGroupsResponse"
2508    }
2509}
2510
2511#[doc(hidden)]
2512impl gax::paginator::internal::PageableResponse for ListConsumerGroupsResponse {
2513    type PageItem = crate::model::ConsumerGroup;
2514
2515    fn items(self) -> std::vec::Vec<Self::PageItem> {
2516        self.consumer_groups
2517    }
2518
2519    fn next_page_token(&self) -> std::string::String {
2520        use std::clone::Clone;
2521        self.next_page_token.clone()
2522    }
2523}
2524
2525#[doc(hidden)]
2526impl<'de> serde::de::Deserialize<'de> for ListConsumerGroupsResponse {
2527    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2528    where
2529        D: serde::Deserializer<'de>,
2530    {
2531        #[allow(non_camel_case_types)]
2532        #[doc(hidden)]
2533        #[derive(PartialEq, Eq, Hash)]
2534        enum __FieldTag {
2535            __consumer_groups,
2536            __next_page_token,
2537            Unknown(std::string::String),
2538        }
2539        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2540            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2541            where
2542                D: serde::Deserializer<'de>,
2543            {
2544                struct Visitor;
2545                impl<'de> serde::de::Visitor<'de> for Visitor {
2546                    type Value = __FieldTag;
2547                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2548                        formatter.write_str("a field name for ListConsumerGroupsResponse")
2549                    }
2550                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2551                    where
2552                        E: serde::de::Error,
2553                    {
2554                        use std::result::Result::Ok;
2555                        use std::string::ToString;
2556                        match value {
2557                            "consumerGroups" => Ok(__FieldTag::__consumer_groups),
2558                            "consumer_groups" => Ok(__FieldTag::__consumer_groups),
2559                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
2560                            "next_page_token" => Ok(__FieldTag::__next_page_token),
2561                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2562                        }
2563                    }
2564                }
2565                deserializer.deserialize_identifier(Visitor)
2566            }
2567        }
2568        struct Visitor;
2569        impl<'de> serde::de::Visitor<'de> for Visitor {
2570            type Value = ListConsumerGroupsResponse;
2571            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2572                formatter.write_str("struct ListConsumerGroupsResponse")
2573            }
2574            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2575            where
2576                A: serde::de::MapAccess<'de>,
2577            {
2578                #[allow(unused_imports)]
2579                use serde::de::Error;
2580                use std::option::Option::Some;
2581                let mut fields = std::collections::HashSet::new();
2582                let mut result = Self::Value::new();
2583                while let Some(tag) = map.next_key::<__FieldTag>()? {
2584                    #[allow(clippy::match_single_binding)]
2585                    match tag {
2586                        __FieldTag::__consumer_groups => {
2587                            if !fields.insert(__FieldTag::__consumer_groups) {
2588                                return std::result::Result::Err(A::Error::duplicate_field(
2589                                    "multiple values for consumer_groups",
2590                                ));
2591                            }
2592                            result.consumer_groups = map.next_value::<std::option::Option<std::vec::Vec<crate::model::ConsumerGroup>>>()?.unwrap_or_default();
2593                        }
2594                        __FieldTag::__next_page_token => {
2595                            if !fields.insert(__FieldTag::__next_page_token) {
2596                                return std::result::Result::Err(A::Error::duplicate_field(
2597                                    "multiple values for next_page_token",
2598                                ));
2599                            }
2600                            result.next_page_token = map
2601                                .next_value::<std::option::Option<std::string::String>>()?
2602                                .unwrap_or_default();
2603                        }
2604                        __FieldTag::Unknown(key) => {
2605                            let value = map.next_value::<serde_json::Value>()?;
2606                            result._unknown_fields.insert(key, value);
2607                        }
2608                    }
2609                }
2610                std::result::Result::Ok(result)
2611            }
2612        }
2613        deserializer.deserialize_any(Visitor)
2614    }
2615}
2616
2617#[doc(hidden)]
2618impl serde::ser::Serialize for ListConsumerGroupsResponse {
2619    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2620    where
2621        S: serde::ser::Serializer,
2622    {
2623        use serde::ser::SerializeMap;
2624        #[allow(unused_imports)]
2625        use std::option::Option::Some;
2626        let mut state = serializer.serialize_map(std::option::Option::None)?;
2627        if !self.consumer_groups.is_empty() {
2628            state.serialize_entry("consumerGroups", &self.consumer_groups)?;
2629        }
2630        if !self.next_page_token.is_empty() {
2631            state.serialize_entry("nextPageToken", &self.next_page_token)?;
2632        }
2633        if !self._unknown_fields.is_empty() {
2634            for (key, value) in self._unknown_fields.iter() {
2635                state.serialize_entry(key, &value)?;
2636            }
2637        }
2638        state.end()
2639    }
2640}
2641
2642/// Request for GetConsumerGroup.
2643#[derive(Clone, Debug, Default, PartialEq)]
2644#[non_exhaustive]
2645pub struct GetConsumerGroupRequest {
2646    /// Required. The name of the consumer group whose configuration to return.
2647    /// `projects/{project}/locations/{location}/clusters/{cluster}/consumerGroups/{consumerGroup}`.
2648    pub name: std::string::String,
2649
2650    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2651}
2652
2653impl GetConsumerGroupRequest {
2654    pub fn new() -> Self {
2655        std::default::Default::default()
2656    }
2657
2658    /// Sets the value of [name][crate::model::GetConsumerGroupRequest::name].
2659    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2660        self.name = v.into();
2661        self
2662    }
2663}
2664
2665impl wkt::message::Message for GetConsumerGroupRequest {
2666    fn typename() -> &'static str {
2667        "type.googleapis.com/google.cloud.managedkafka.v1.GetConsumerGroupRequest"
2668    }
2669}
2670
2671#[doc(hidden)]
2672impl<'de> serde::de::Deserialize<'de> for GetConsumerGroupRequest {
2673    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2674    where
2675        D: serde::Deserializer<'de>,
2676    {
2677        #[allow(non_camel_case_types)]
2678        #[doc(hidden)]
2679        #[derive(PartialEq, Eq, Hash)]
2680        enum __FieldTag {
2681            __name,
2682            Unknown(std::string::String),
2683        }
2684        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2685            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2686            where
2687                D: serde::Deserializer<'de>,
2688            {
2689                struct Visitor;
2690                impl<'de> serde::de::Visitor<'de> for Visitor {
2691                    type Value = __FieldTag;
2692                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2693                        formatter.write_str("a field name for GetConsumerGroupRequest")
2694                    }
2695                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2696                    where
2697                        E: serde::de::Error,
2698                    {
2699                        use std::result::Result::Ok;
2700                        use std::string::ToString;
2701                        match value {
2702                            "name" => Ok(__FieldTag::__name),
2703                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2704                        }
2705                    }
2706                }
2707                deserializer.deserialize_identifier(Visitor)
2708            }
2709        }
2710        struct Visitor;
2711        impl<'de> serde::de::Visitor<'de> for Visitor {
2712            type Value = GetConsumerGroupRequest;
2713            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2714                formatter.write_str("struct GetConsumerGroupRequest")
2715            }
2716            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2717            where
2718                A: serde::de::MapAccess<'de>,
2719            {
2720                #[allow(unused_imports)]
2721                use serde::de::Error;
2722                use std::option::Option::Some;
2723                let mut fields = std::collections::HashSet::new();
2724                let mut result = Self::Value::new();
2725                while let Some(tag) = map.next_key::<__FieldTag>()? {
2726                    #[allow(clippy::match_single_binding)]
2727                    match tag {
2728                        __FieldTag::__name => {
2729                            if !fields.insert(__FieldTag::__name) {
2730                                return std::result::Result::Err(A::Error::duplicate_field(
2731                                    "multiple values for name",
2732                                ));
2733                            }
2734                            result.name = map
2735                                .next_value::<std::option::Option<std::string::String>>()?
2736                                .unwrap_or_default();
2737                        }
2738                        __FieldTag::Unknown(key) => {
2739                            let value = map.next_value::<serde_json::Value>()?;
2740                            result._unknown_fields.insert(key, value);
2741                        }
2742                    }
2743                }
2744                std::result::Result::Ok(result)
2745            }
2746        }
2747        deserializer.deserialize_any(Visitor)
2748    }
2749}
2750
2751#[doc(hidden)]
2752impl serde::ser::Serialize for GetConsumerGroupRequest {
2753    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2754    where
2755        S: serde::ser::Serializer,
2756    {
2757        use serde::ser::SerializeMap;
2758        #[allow(unused_imports)]
2759        use std::option::Option::Some;
2760        let mut state = serializer.serialize_map(std::option::Option::None)?;
2761        if !self.name.is_empty() {
2762            state.serialize_entry("name", &self.name)?;
2763        }
2764        if !self._unknown_fields.is_empty() {
2765            for (key, value) in self._unknown_fields.iter() {
2766                state.serialize_entry(key, &value)?;
2767            }
2768        }
2769        state.end()
2770    }
2771}
2772
2773/// Request for UpdateConsumerGroup.
2774#[derive(Clone, Debug, Default, PartialEq)]
2775#[non_exhaustive]
2776pub struct UpdateConsumerGroupRequest {
2777    /// Required. Field mask is used to specify the fields to be overwritten in the
2778    /// ConsumerGroup resource by the update.
2779    /// The fields specified in the update_mask are relative to the resource, not
2780    /// the full request. A field will be overwritten if it is in the mask. The
2781    /// mask is required and a value of * will update all fields.
2782    pub update_mask: std::option::Option<wkt::FieldMask>,
2783
2784    /// Required. The consumer group to update. Its `name` field must be populated.
2785    pub consumer_group: std::option::Option<crate::model::ConsumerGroup>,
2786
2787    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2788}
2789
2790impl UpdateConsumerGroupRequest {
2791    pub fn new() -> Self {
2792        std::default::Default::default()
2793    }
2794
2795    /// Sets the value of [update_mask][crate::model::UpdateConsumerGroupRequest::update_mask].
2796    pub fn set_update_mask<T>(mut self, v: T) -> Self
2797    where
2798        T: std::convert::Into<wkt::FieldMask>,
2799    {
2800        self.update_mask = std::option::Option::Some(v.into());
2801        self
2802    }
2803
2804    /// Sets or clears the value of [update_mask][crate::model::UpdateConsumerGroupRequest::update_mask].
2805    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2806    where
2807        T: std::convert::Into<wkt::FieldMask>,
2808    {
2809        self.update_mask = v.map(|x| x.into());
2810        self
2811    }
2812
2813    /// Sets the value of [consumer_group][crate::model::UpdateConsumerGroupRequest::consumer_group].
2814    pub fn set_consumer_group<T>(mut self, v: T) -> Self
2815    where
2816        T: std::convert::Into<crate::model::ConsumerGroup>,
2817    {
2818        self.consumer_group = std::option::Option::Some(v.into());
2819        self
2820    }
2821
2822    /// Sets or clears the value of [consumer_group][crate::model::UpdateConsumerGroupRequest::consumer_group].
2823    pub fn set_or_clear_consumer_group<T>(mut self, v: std::option::Option<T>) -> Self
2824    where
2825        T: std::convert::Into<crate::model::ConsumerGroup>,
2826    {
2827        self.consumer_group = v.map(|x| x.into());
2828        self
2829    }
2830}
2831
2832impl wkt::message::Message for UpdateConsumerGroupRequest {
2833    fn typename() -> &'static str {
2834        "type.googleapis.com/google.cloud.managedkafka.v1.UpdateConsumerGroupRequest"
2835    }
2836}
2837
2838#[doc(hidden)]
2839impl<'de> serde::de::Deserialize<'de> for UpdateConsumerGroupRequest {
2840    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2841    where
2842        D: serde::Deserializer<'de>,
2843    {
2844        #[allow(non_camel_case_types)]
2845        #[doc(hidden)]
2846        #[derive(PartialEq, Eq, Hash)]
2847        enum __FieldTag {
2848            __update_mask,
2849            __consumer_group,
2850            Unknown(std::string::String),
2851        }
2852        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2853            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2854            where
2855                D: serde::Deserializer<'de>,
2856            {
2857                struct Visitor;
2858                impl<'de> serde::de::Visitor<'de> for Visitor {
2859                    type Value = __FieldTag;
2860                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2861                        formatter.write_str("a field name for UpdateConsumerGroupRequest")
2862                    }
2863                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2864                    where
2865                        E: serde::de::Error,
2866                    {
2867                        use std::result::Result::Ok;
2868                        use std::string::ToString;
2869                        match value {
2870                            "updateMask" => Ok(__FieldTag::__update_mask),
2871                            "update_mask" => Ok(__FieldTag::__update_mask),
2872                            "consumerGroup" => Ok(__FieldTag::__consumer_group),
2873                            "consumer_group" => Ok(__FieldTag::__consumer_group),
2874                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2875                        }
2876                    }
2877                }
2878                deserializer.deserialize_identifier(Visitor)
2879            }
2880        }
2881        struct Visitor;
2882        impl<'de> serde::de::Visitor<'de> for Visitor {
2883            type Value = UpdateConsumerGroupRequest;
2884            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2885                formatter.write_str("struct UpdateConsumerGroupRequest")
2886            }
2887            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2888            where
2889                A: serde::de::MapAccess<'de>,
2890            {
2891                #[allow(unused_imports)]
2892                use serde::de::Error;
2893                use std::option::Option::Some;
2894                let mut fields = std::collections::HashSet::new();
2895                let mut result = Self::Value::new();
2896                while let Some(tag) = map.next_key::<__FieldTag>()? {
2897                    #[allow(clippy::match_single_binding)]
2898                    match tag {
2899                        __FieldTag::__update_mask => {
2900                            if !fields.insert(__FieldTag::__update_mask) {
2901                                return std::result::Result::Err(A::Error::duplicate_field(
2902                                    "multiple values for update_mask",
2903                                ));
2904                            }
2905                            result.update_mask =
2906                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
2907                        }
2908                        __FieldTag::__consumer_group => {
2909                            if !fields.insert(__FieldTag::__consumer_group) {
2910                                return std::result::Result::Err(A::Error::duplicate_field(
2911                                    "multiple values for consumer_group",
2912                                ));
2913                            }
2914                            result.consumer_group = map
2915                                .next_value::<std::option::Option<crate::model::ConsumerGroup>>()?;
2916                        }
2917                        __FieldTag::Unknown(key) => {
2918                            let value = map.next_value::<serde_json::Value>()?;
2919                            result._unknown_fields.insert(key, value);
2920                        }
2921                    }
2922                }
2923                std::result::Result::Ok(result)
2924            }
2925        }
2926        deserializer.deserialize_any(Visitor)
2927    }
2928}
2929
2930#[doc(hidden)]
2931impl serde::ser::Serialize for UpdateConsumerGroupRequest {
2932    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2933    where
2934        S: serde::ser::Serializer,
2935    {
2936        use serde::ser::SerializeMap;
2937        #[allow(unused_imports)]
2938        use std::option::Option::Some;
2939        let mut state = serializer.serialize_map(std::option::Option::None)?;
2940        if self.update_mask.is_some() {
2941            state.serialize_entry("updateMask", &self.update_mask)?;
2942        }
2943        if self.consumer_group.is_some() {
2944            state.serialize_entry("consumerGroup", &self.consumer_group)?;
2945        }
2946        if !self._unknown_fields.is_empty() {
2947            for (key, value) in self._unknown_fields.iter() {
2948                state.serialize_entry(key, &value)?;
2949            }
2950        }
2951        state.end()
2952    }
2953}
2954
2955/// Request for DeleteConsumerGroup.
2956#[derive(Clone, Debug, Default, PartialEq)]
2957#[non_exhaustive]
2958pub struct DeleteConsumerGroupRequest {
2959    /// Required. The name of the consumer group to delete.
2960    /// `projects/{project}/locations/{location}/clusters/{cluster}/consumerGroups/{consumerGroup}`.
2961    pub name: std::string::String,
2962
2963    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2964}
2965
2966impl DeleteConsumerGroupRequest {
2967    pub fn new() -> Self {
2968        std::default::Default::default()
2969    }
2970
2971    /// Sets the value of [name][crate::model::DeleteConsumerGroupRequest::name].
2972    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2973        self.name = v.into();
2974        self
2975    }
2976}
2977
2978impl wkt::message::Message for DeleteConsumerGroupRequest {
2979    fn typename() -> &'static str {
2980        "type.googleapis.com/google.cloud.managedkafka.v1.DeleteConsumerGroupRequest"
2981    }
2982}
2983
2984#[doc(hidden)]
2985impl<'de> serde::de::Deserialize<'de> for DeleteConsumerGroupRequest {
2986    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2987    where
2988        D: serde::Deserializer<'de>,
2989    {
2990        #[allow(non_camel_case_types)]
2991        #[doc(hidden)]
2992        #[derive(PartialEq, Eq, Hash)]
2993        enum __FieldTag {
2994            __name,
2995            Unknown(std::string::String),
2996        }
2997        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2998            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2999            where
3000                D: serde::Deserializer<'de>,
3001            {
3002                struct Visitor;
3003                impl<'de> serde::de::Visitor<'de> for Visitor {
3004                    type Value = __FieldTag;
3005                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3006                        formatter.write_str("a field name for DeleteConsumerGroupRequest")
3007                    }
3008                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3009                    where
3010                        E: serde::de::Error,
3011                    {
3012                        use std::result::Result::Ok;
3013                        use std::string::ToString;
3014                        match value {
3015                            "name" => Ok(__FieldTag::__name),
3016                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3017                        }
3018                    }
3019                }
3020                deserializer.deserialize_identifier(Visitor)
3021            }
3022        }
3023        struct Visitor;
3024        impl<'de> serde::de::Visitor<'de> for Visitor {
3025            type Value = DeleteConsumerGroupRequest;
3026            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3027                formatter.write_str("struct DeleteConsumerGroupRequest")
3028            }
3029            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3030            where
3031                A: serde::de::MapAccess<'de>,
3032            {
3033                #[allow(unused_imports)]
3034                use serde::de::Error;
3035                use std::option::Option::Some;
3036                let mut fields = std::collections::HashSet::new();
3037                let mut result = Self::Value::new();
3038                while let Some(tag) = map.next_key::<__FieldTag>()? {
3039                    #[allow(clippy::match_single_binding)]
3040                    match tag {
3041                        __FieldTag::__name => {
3042                            if !fields.insert(__FieldTag::__name) {
3043                                return std::result::Result::Err(A::Error::duplicate_field(
3044                                    "multiple values for name",
3045                                ));
3046                            }
3047                            result.name = map
3048                                .next_value::<std::option::Option<std::string::String>>()?
3049                                .unwrap_or_default();
3050                        }
3051                        __FieldTag::Unknown(key) => {
3052                            let value = map.next_value::<serde_json::Value>()?;
3053                            result._unknown_fields.insert(key, value);
3054                        }
3055                    }
3056                }
3057                std::result::Result::Ok(result)
3058            }
3059        }
3060        deserializer.deserialize_any(Visitor)
3061    }
3062}
3063
3064#[doc(hidden)]
3065impl serde::ser::Serialize for DeleteConsumerGroupRequest {
3066    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3067    where
3068        S: serde::ser::Serializer,
3069    {
3070        use serde::ser::SerializeMap;
3071        #[allow(unused_imports)]
3072        use std::option::Option::Some;
3073        let mut state = serializer.serialize_map(std::option::Option::None)?;
3074        if !self.name.is_empty() {
3075            state.serialize_entry("name", &self.name)?;
3076        }
3077        if !self._unknown_fields.is_empty() {
3078            for (key, value) in self._unknown_fields.iter() {
3079                state.serialize_entry(key, &value)?;
3080            }
3081        }
3082        state.end()
3083    }
3084}
3085
3086/// Request for ListAcls.
3087#[derive(Clone, Debug, Default, PartialEq)]
3088#[non_exhaustive]
3089pub struct ListAclsRequest {
3090    /// Required. The parent cluster whose acls are to be listed.
3091    /// Structured like
3092    /// `projects/{project}/locations/{location}/clusters/{cluster}`.
3093    pub parent: std::string::String,
3094
3095    /// Optional. The maximum number of acls to return. The service may return
3096    /// fewer than this value. If unset or zero, all acls for the parent is
3097    /// returned.
3098    pub page_size: i32,
3099
3100    /// Optional. A page token, received from a previous `ListAcls` call.
3101    /// Provide this to retrieve the subsequent page.
3102    ///
3103    /// When paginating, all other parameters provided to `ListAcls` must match
3104    /// the call that provided the page token.
3105    pub page_token: std::string::String,
3106
3107    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3108}
3109
3110impl ListAclsRequest {
3111    pub fn new() -> Self {
3112        std::default::Default::default()
3113    }
3114
3115    /// Sets the value of [parent][crate::model::ListAclsRequest::parent].
3116    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3117        self.parent = v.into();
3118        self
3119    }
3120
3121    /// Sets the value of [page_size][crate::model::ListAclsRequest::page_size].
3122    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3123        self.page_size = v.into();
3124        self
3125    }
3126
3127    /// Sets the value of [page_token][crate::model::ListAclsRequest::page_token].
3128    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3129        self.page_token = v.into();
3130        self
3131    }
3132}
3133
3134impl wkt::message::Message for ListAclsRequest {
3135    fn typename() -> &'static str {
3136        "type.googleapis.com/google.cloud.managedkafka.v1.ListAclsRequest"
3137    }
3138}
3139
3140#[doc(hidden)]
3141impl<'de> serde::de::Deserialize<'de> for ListAclsRequest {
3142    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3143    where
3144        D: serde::Deserializer<'de>,
3145    {
3146        #[allow(non_camel_case_types)]
3147        #[doc(hidden)]
3148        #[derive(PartialEq, Eq, Hash)]
3149        enum __FieldTag {
3150            __parent,
3151            __page_size,
3152            __page_token,
3153            Unknown(std::string::String),
3154        }
3155        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3156            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3157            where
3158                D: serde::Deserializer<'de>,
3159            {
3160                struct Visitor;
3161                impl<'de> serde::de::Visitor<'de> for Visitor {
3162                    type Value = __FieldTag;
3163                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3164                        formatter.write_str("a field name for ListAclsRequest")
3165                    }
3166                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3167                    where
3168                        E: serde::de::Error,
3169                    {
3170                        use std::result::Result::Ok;
3171                        use std::string::ToString;
3172                        match value {
3173                            "parent" => Ok(__FieldTag::__parent),
3174                            "pageSize" => Ok(__FieldTag::__page_size),
3175                            "page_size" => Ok(__FieldTag::__page_size),
3176                            "pageToken" => Ok(__FieldTag::__page_token),
3177                            "page_token" => Ok(__FieldTag::__page_token),
3178                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3179                        }
3180                    }
3181                }
3182                deserializer.deserialize_identifier(Visitor)
3183            }
3184        }
3185        struct Visitor;
3186        impl<'de> serde::de::Visitor<'de> for Visitor {
3187            type Value = ListAclsRequest;
3188            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3189                formatter.write_str("struct ListAclsRequest")
3190            }
3191            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3192            where
3193                A: serde::de::MapAccess<'de>,
3194            {
3195                #[allow(unused_imports)]
3196                use serde::de::Error;
3197                use std::option::Option::Some;
3198                let mut fields = std::collections::HashSet::new();
3199                let mut result = Self::Value::new();
3200                while let Some(tag) = map.next_key::<__FieldTag>()? {
3201                    #[allow(clippy::match_single_binding)]
3202                    match tag {
3203                        __FieldTag::__parent => {
3204                            if !fields.insert(__FieldTag::__parent) {
3205                                return std::result::Result::Err(A::Error::duplicate_field(
3206                                    "multiple values for parent",
3207                                ));
3208                            }
3209                            result.parent = map
3210                                .next_value::<std::option::Option<std::string::String>>()?
3211                                .unwrap_or_default();
3212                        }
3213                        __FieldTag::__page_size => {
3214                            if !fields.insert(__FieldTag::__page_size) {
3215                                return std::result::Result::Err(A::Error::duplicate_field(
3216                                    "multiple values for page_size",
3217                                ));
3218                            }
3219                            struct __With(std::option::Option<i32>);
3220                            impl<'de> serde::de::Deserialize<'de> for __With {
3221                                fn deserialize<D>(
3222                                    deserializer: D,
3223                                ) -> std::result::Result<Self, D::Error>
3224                                where
3225                                    D: serde::de::Deserializer<'de>,
3226                                {
3227                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3228                                }
3229                            }
3230                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
3231                        }
3232                        __FieldTag::__page_token => {
3233                            if !fields.insert(__FieldTag::__page_token) {
3234                                return std::result::Result::Err(A::Error::duplicate_field(
3235                                    "multiple values for page_token",
3236                                ));
3237                            }
3238                            result.page_token = map
3239                                .next_value::<std::option::Option<std::string::String>>()?
3240                                .unwrap_or_default();
3241                        }
3242                        __FieldTag::Unknown(key) => {
3243                            let value = map.next_value::<serde_json::Value>()?;
3244                            result._unknown_fields.insert(key, value);
3245                        }
3246                    }
3247                }
3248                std::result::Result::Ok(result)
3249            }
3250        }
3251        deserializer.deserialize_any(Visitor)
3252    }
3253}
3254
3255#[doc(hidden)]
3256impl serde::ser::Serialize for ListAclsRequest {
3257    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3258    where
3259        S: serde::ser::Serializer,
3260    {
3261        use serde::ser::SerializeMap;
3262        #[allow(unused_imports)]
3263        use std::option::Option::Some;
3264        let mut state = serializer.serialize_map(std::option::Option::None)?;
3265        if !self.parent.is_empty() {
3266            state.serialize_entry("parent", &self.parent)?;
3267        }
3268        if !wkt::internal::is_default(&self.page_size) {
3269            struct __With<'a>(&'a i32);
3270            impl<'a> serde::ser::Serialize for __With<'a> {
3271                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3272                where
3273                    S: serde::ser::Serializer,
3274                {
3275                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3276                }
3277            }
3278            state.serialize_entry("pageSize", &__With(&self.page_size))?;
3279        }
3280        if !self.page_token.is_empty() {
3281            state.serialize_entry("pageToken", &self.page_token)?;
3282        }
3283        if !self._unknown_fields.is_empty() {
3284            for (key, value) in self._unknown_fields.iter() {
3285                state.serialize_entry(key, &value)?;
3286            }
3287        }
3288        state.end()
3289    }
3290}
3291
3292/// Response for ListAcls.
3293#[derive(Clone, Debug, Default, PartialEq)]
3294#[non_exhaustive]
3295pub struct ListAclsResponse {
3296    /// The list of acls in the requested parent. The order of the acls is
3297    /// unspecified.
3298    pub acls: std::vec::Vec<crate::model::Acl>,
3299
3300    /// A token that can be sent as `page_token` to retrieve the next page of
3301    /// results. If this field is omitted, there are no more results.
3302    pub next_page_token: std::string::String,
3303
3304    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3305}
3306
3307impl ListAclsResponse {
3308    pub fn new() -> Self {
3309        std::default::Default::default()
3310    }
3311
3312    /// Sets the value of [acls][crate::model::ListAclsResponse::acls].
3313    pub fn set_acls<T, V>(mut self, v: T) -> Self
3314    where
3315        T: std::iter::IntoIterator<Item = V>,
3316        V: std::convert::Into<crate::model::Acl>,
3317    {
3318        use std::iter::Iterator;
3319        self.acls = v.into_iter().map(|i| i.into()).collect();
3320        self
3321    }
3322
3323    /// Sets the value of [next_page_token][crate::model::ListAclsResponse::next_page_token].
3324    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3325        self.next_page_token = v.into();
3326        self
3327    }
3328}
3329
3330impl wkt::message::Message for ListAclsResponse {
3331    fn typename() -> &'static str {
3332        "type.googleapis.com/google.cloud.managedkafka.v1.ListAclsResponse"
3333    }
3334}
3335
3336#[doc(hidden)]
3337impl gax::paginator::internal::PageableResponse for ListAclsResponse {
3338    type PageItem = crate::model::Acl;
3339
3340    fn items(self) -> std::vec::Vec<Self::PageItem> {
3341        self.acls
3342    }
3343
3344    fn next_page_token(&self) -> std::string::String {
3345        use std::clone::Clone;
3346        self.next_page_token.clone()
3347    }
3348}
3349
3350#[doc(hidden)]
3351impl<'de> serde::de::Deserialize<'de> for ListAclsResponse {
3352    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3353    where
3354        D: serde::Deserializer<'de>,
3355    {
3356        #[allow(non_camel_case_types)]
3357        #[doc(hidden)]
3358        #[derive(PartialEq, Eq, Hash)]
3359        enum __FieldTag {
3360            __acls,
3361            __next_page_token,
3362            Unknown(std::string::String),
3363        }
3364        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3365            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3366            where
3367                D: serde::Deserializer<'de>,
3368            {
3369                struct Visitor;
3370                impl<'de> serde::de::Visitor<'de> for Visitor {
3371                    type Value = __FieldTag;
3372                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3373                        formatter.write_str("a field name for ListAclsResponse")
3374                    }
3375                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3376                    where
3377                        E: serde::de::Error,
3378                    {
3379                        use std::result::Result::Ok;
3380                        use std::string::ToString;
3381                        match value {
3382                            "acls" => Ok(__FieldTag::__acls),
3383                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
3384                            "next_page_token" => Ok(__FieldTag::__next_page_token),
3385                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3386                        }
3387                    }
3388                }
3389                deserializer.deserialize_identifier(Visitor)
3390            }
3391        }
3392        struct Visitor;
3393        impl<'de> serde::de::Visitor<'de> for Visitor {
3394            type Value = ListAclsResponse;
3395            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3396                formatter.write_str("struct ListAclsResponse")
3397            }
3398            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3399            where
3400                A: serde::de::MapAccess<'de>,
3401            {
3402                #[allow(unused_imports)]
3403                use serde::de::Error;
3404                use std::option::Option::Some;
3405                let mut fields = std::collections::HashSet::new();
3406                let mut result = Self::Value::new();
3407                while let Some(tag) = map.next_key::<__FieldTag>()? {
3408                    #[allow(clippy::match_single_binding)]
3409                    match tag {
3410                        __FieldTag::__acls => {
3411                            if !fields.insert(__FieldTag::__acls) {
3412                                return std::result::Result::Err(A::Error::duplicate_field(
3413                                    "multiple values for acls",
3414                                ));
3415                            }
3416                            result.acls = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Acl>>>()?.unwrap_or_default();
3417                        }
3418                        __FieldTag::__next_page_token => {
3419                            if !fields.insert(__FieldTag::__next_page_token) {
3420                                return std::result::Result::Err(A::Error::duplicate_field(
3421                                    "multiple values for next_page_token",
3422                                ));
3423                            }
3424                            result.next_page_token = map
3425                                .next_value::<std::option::Option<std::string::String>>()?
3426                                .unwrap_or_default();
3427                        }
3428                        __FieldTag::Unknown(key) => {
3429                            let value = map.next_value::<serde_json::Value>()?;
3430                            result._unknown_fields.insert(key, value);
3431                        }
3432                    }
3433                }
3434                std::result::Result::Ok(result)
3435            }
3436        }
3437        deserializer.deserialize_any(Visitor)
3438    }
3439}
3440
3441#[doc(hidden)]
3442impl serde::ser::Serialize for ListAclsResponse {
3443    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3444    where
3445        S: serde::ser::Serializer,
3446    {
3447        use serde::ser::SerializeMap;
3448        #[allow(unused_imports)]
3449        use std::option::Option::Some;
3450        let mut state = serializer.serialize_map(std::option::Option::None)?;
3451        if !self.acls.is_empty() {
3452            state.serialize_entry("acls", &self.acls)?;
3453        }
3454        if !self.next_page_token.is_empty() {
3455            state.serialize_entry("nextPageToken", &self.next_page_token)?;
3456        }
3457        if !self._unknown_fields.is_empty() {
3458            for (key, value) in self._unknown_fields.iter() {
3459                state.serialize_entry(key, &value)?;
3460            }
3461        }
3462        state.end()
3463    }
3464}
3465
3466/// Request for GetAcl.
3467#[derive(Clone, Debug, Default, PartialEq)]
3468#[non_exhaustive]
3469pub struct GetAclRequest {
3470    /// Required. The name of the acl to return.
3471    /// Structured like:
3472    /// `projects/{project}/locations/{location}/clusters/{cluster}/acls/{acl_id}`.
3473    ///
3474    /// The structure of `acl_id` defines the Resource Pattern (resource_type,
3475    /// resource_name, pattern_type) of the acl. See `Acl.name` for
3476    /// details.
3477    pub name: std::string::String,
3478
3479    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3480}
3481
3482impl GetAclRequest {
3483    pub fn new() -> Self {
3484        std::default::Default::default()
3485    }
3486
3487    /// Sets the value of [name][crate::model::GetAclRequest::name].
3488    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3489        self.name = v.into();
3490        self
3491    }
3492}
3493
3494impl wkt::message::Message for GetAclRequest {
3495    fn typename() -> &'static str {
3496        "type.googleapis.com/google.cloud.managedkafka.v1.GetAclRequest"
3497    }
3498}
3499
3500#[doc(hidden)]
3501impl<'de> serde::de::Deserialize<'de> for GetAclRequest {
3502    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3503    where
3504        D: serde::Deserializer<'de>,
3505    {
3506        #[allow(non_camel_case_types)]
3507        #[doc(hidden)]
3508        #[derive(PartialEq, Eq, Hash)]
3509        enum __FieldTag {
3510            __name,
3511            Unknown(std::string::String),
3512        }
3513        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3514            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3515            where
3516                D: serde::Deserializer<'de>,
3517            {
3518                struct Visitor;
3519                impl<'de> serde::de::Visitor<'de> for Visitor {
3520                    type Value = __FieldTag;
3521                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3522                        formatter.write_str("a field name for GetAclRequest")
3523                    }
3524                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3525                    where
3526                        E: serde::de::Error,
3527                    {
3528                        use std::result::Result::Ok;
3529                        use std::string::ToString;
3530                        match value {
3531                            "name" => Ok(__FieldTag::__name),
3532                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3533                        }
3534                    }
3535                }
3536                deserializer.deserialize_identifier(Visitor)
3537            }
3538        }
3539        struct Visitor;
3540        impl<'de> serde::de::Visitor<'de> for Visitor {
3541            type Value = GetAclRequest;
3542            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3543                formatter.write_str("struct GetAclRequest")
3544            }
3545            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3546            where
3547                A: serde::de::MapAccess<'de>,
3548            {
3549                #[allow(unused_imports)]
3550                use serde::de::Error;
3551                use std::option::Option::Some;
3552                let mut fields = std::collections::HashSet::new();
3553                let mut result = Self::Value::new();
3554                while let Some(tag) = map.next_key::<__FieldTag>()? {
3555                    #[allow(clippy::match_single_binding)]
3556                    match tag {
3557                        __FieldTag::__name => {
3558                            if !fields.insert(__FieldTag::__name) {
3559                                return std::result::Result::Err(A::Error::duplicate_field(
3560                                    "multiple values for name",
3561                                ));
3562                            }
3563                            result.name = map
3564                                .next_value::<std::option::Option<std::string::String>>()?
3565                                .unwrap_or_default();
3566                        }
3567                        __FieldTag::Unknown(key) => {
3568                            let value = map.next_value::<serde_json::Value>()?;
3569                            result._unknown_fields.insert(key, value);
3570                        }
3571                    }
3572                }
3573                std::result::Result::Ok(result)
3574            }
3575        }
3576        deserializer.deserialize_any(Visitor)
3577    }
3578}
3579
3580#[doc(hidden)]
3581impl serde::ser::Serialize for GetAclRequest {
3582    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3583    where
3584        S: serde::ser::Serializer,
3585    {
3586        use serde::ser::SerializeMap;
3587        #[allow(unused_imports)]
3588        use std::option::Option::Some;
3589        let mut state = serializer.serialize_map(std::option::Option::None)?;
3590        if !self.name.is_empty() {
3591            state.serialize_entry("name", &self.name)?;
3592        }
3593        if !self._unknown_fields.is_empty() {
3594            for (key, value) in self._unknown_fields.iter() {
3595                state.serialize_entry(key, &value)?;
3596            }
3597        }
3598        state.end()
3599    }
3600}
3601
3602/// Request for CreateAcl.
3603#[derive(Clone, Debug, Default, PartialEq)]
3604#[non_exhaustive]
3605pub struct CreateAclRequest {
3606    /// Required. The parent cluster in which to create the acl.
3607    /// Structured like
3608    /// `projects/{project}/locations/{location}/clusters/{cluster}`.
3609    pub parent: std::string::String,
3610
3611    /// Required. The ID to use for the acl, which will become the final component
3612    /// of the acl's name. The structure of `acl_id` defines the Resource Pattern
3613    /// (resource_type, resource_name, pattern_type) of the acl. `acl_id` is
3614    /// structured like one of the following:
3615    ///
3616    /// For acls on the cluster:
3617    /// `cluster`
3618    ///
3619    /// For acls on a single resource within the cluster:
3620    /// `topic/{resource_name}`
3621    /// `consumerGroup/{resource_name}`
3622    /// `transactionalId/{resource_name}`
3623    ///
3624    /// For acls on all resources that match a prefix:
3625    /// `topicPrefixed/{resource_name}`
3626    /// `consumerGroupPrefixed/{resource_name}`
3627    /// `transactionalIdPrefixed/{resource_name}`
3628    ///
3629    /// For acls on all resources of a given type (i.e. the wildcard literal "*"):
3630    /// `allTopics` (represents `topic/*`)
3631    /// `allConsumerGroups` (represents `consumerGroup/*`)
3632    /// `allTransactionalIds` (represents `transactionalId/*`)
3633    pub acl_id: std::string::String,
3634
3635    /// Required. Configuration of the acl to create. Its `name` field is ignored.
3636    pub acl: std::option::Option<crate::model::Acl>,
3637
3638    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3639}
3640
3641impl CreateAclRequest {
3642    pub fn new() -> Self {
3643        std::default::Default::default()
3644    }
3645
3646    /// Sets the value of [parent][crate::model::CreateAclRequest::parent].
3647    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3648        self.parent = v.into();
3649        self
3650    }
3651
3652    /// Sets the value of [acl_id][crate::model::CreateAclRequest::acl_id].
3653    pub fn set_acl_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3654        self.acl_id = v.into();
3655        self
3656    }
3657
3658    /// Sets the value of [acl][crate::model::CreateAclRequest::acl].
3659    pub fn set_acl<T>(mut self, v: T) -> Self
3660    where
3661        T: std::convert::Into<crate::model::Acl>,
3662    {
3663        self.acl = std::option::Option::Some(v.into());
3664        self
3665    }
3666
3667    /// Sets or clears the value of [acl][crate::model::CreateAclRequest::acl].
3668    pub fn set_or_clear_acl<T>(mut self, v: std::option::Option<T>) -> Self
3669    where
3670        T: std::convert::Into<crate::model::Acl>,
3671    {
3672        self.acl = v.map(|x| x.into());
3673        self
3674    }
3675}
3676
3677impl wkt::message::Message for CreateAclRequest {
3678    fn typename() -> &'static str {
3679        "type.googleapis.com/google.cloud.managedkafka.v1.CreateAclRequest"
3680    }
3681}
3682
3683#[doc(hidden)]
3684impl<'de> serde::de::Deserialize<'de> for CreateAclRequest {
3685    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3686    where
3687        D: serde::Deserializer<'de>,
3688    {
3689        #[allow(non_camel_case_types)]
3690        #[doc(hidden)]
3691        #[derive(PartialEq, Eq, Hash)]
3692        enum __FieldTag {
3693            __parent,
3694            __acl_id,
3695            __acl,
3696            Unknown(std::string::String),
3697        }
3698        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3699            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3700            where
3701                D: serde::Deserializer<'de>,
3702            {
3703                struct Visitor;
3704                impl<'de> serde::de::Visitor<'de> for Visitor {
3705                    type Value = __FieldTag;
3706                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3707                        formatter.write_str("a field name for CreateAclRequest")
3708                    }
3709                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3710                    where
3711                        E: serde::de::Error,
3712                    {
3713                        use std::result::Result::Ok;
3714                        use std::string::ToString;
3715                        match value {
3716                            "parent" => Ok(__FieldTag::__parent),
3717                            "aclId" => Ok(__FieldTag::__acl_id),
3718                            "acl_id" => Ok(__FieldTag::__acl_id),
3719                            "acl" => Ok(__FieldTag::__acl),
3720                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3721                        }
3722                    }
3723                }
3724                deserializer.deserialize_identifier(Visitor)
3725            }
3726        }
3727        struct Visitor;
3728        impl<'de> serde::de::Visitor<'de> for Visitor {
3729            type Value = CreateAclRequest;
3730            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3731                formatter.write_str("struct CreateAclRequest")
3732            }
3733            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3734            where
3735                A: serde::de::MapAccess<'de>,
3736            {
3737                #[allow(unused_imports)]
3738                use serde::de::Error;
3739                use std::option::Option::Some;
3740                let mut fields = std::collections::HashSet::new();
3741                let mut result = Self::Value::new();
3742                while let Some(tag) = map.next_key::<__FieldTag>()? {
3743                    #[allow(clippy::match_single_binding)]
3744                    match tag {
3745                        __FieldTag::__parent => {
3746                            if !fields.insert(__FieldTag::__parent) {
3747                                return std::result::Result::Err(A::Error::duplicate_field(
3748                                    "multiple values for parent",
3749                                ));
3750                            }
3751                            result.parent = map
3752                                .next_value::<std::option::Option<std::string::String>>()?
3753                                .unwrap_or_default();
3754                        }
3755                        __FieldTag::__acl_id => {
3756                            if !fields.insert(__FieldTag::__acl_id) {
3757                                return std::result::Result::Err(A::Error::duplicate_field(
3758                                    "multiple values for acl_id",
3759                                ));
3760                            }
3761                            result.acl_id = map
3762                                .next_value::<std::option::Option<std::string::String>>()?
3763                                .unwrap_or_default();
3764                        }
3765                        __FieldTag::__acl => {
3766                            if !fields.insert(__FieldTag::__acl) {
3767                                return std::result::Result::Err(A::Error::duplicate_field(
3768                                    "multiple values for acl",
3769                                ));
3770                            }
3771                            result.acl =
3772                                map.next_value::<std::option::Option<crate::model::Acl>>()?;
3773                        }
3774                        __FieldTag::Unknown(key) => {
3775                            let value = map.next_value::<serde_json::Value>()?;
3776                            result._unknown_fields.insert(key, value);
3777                        }
3778                    }
3779                }
3780                std::result::Result::Ok(result)
3781            }
3782        }
3783        deserializer.deserialize_any(Visitor)
3784    }
3785}
3786
3787#[doc(hidden)]
3788impl serde::ser::Serialize for CreateAclRequest {
3789    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3790    where
3791        S: serde::ser::Serializer,
3792    {
3793        use serde::ser::SerializeMap;
3794        #[allow(unused_imports)]
3795        use std::option::Option::Some;
3796        let mut state = serializer.serialize_map(std::option::Option::None)?;
3797        if !self.parent.is_empty() {
3798            state.serialize_entry("parent", &self.parent)?;
3799        }
3800        if !self.acl_id.is_empty() {
3801            state.serialize_entry("aclId", &self.acl_id)?;
3802        }
3803        if self.acl.is_some() {
3804            state.serialize_entry("acl", &self.acl)?;
3805        }
3806        if !self._unknown_fields.is_empty() {
3807            for (key, value) in self._unknown_fields.iter() {
3808                state.serialize_entry(key, &value)?;
3809            }
3810        }
3811        state.end()
3812    }
3813}
3814
3815/// Request for UpdateAcl.
3816#[derive(Clone, Debug, Default, PartialEq)]
3817#[non_exhaustive]
3818pub struct UpdateAclRequest {
3819    /// Required. The updated acl. Its `name` and `etag` fields must be populated.
3820    /// `acl_entries` must not be empty in the updated acl; to remove all acl
3821    /// entries for an acl, use DeleteAcl.
3822    pub acl: std::option::Option<crate::model::Acl>,
3823
3824    /// Optional. Field mask is used to specify the fields to be overwritten in the
3825    /// Acl resource by the update. The fields specified in the update_mask are
3826    /// relative to the resource, not the full request. A field will be overwritten
3827    /// if it is in the mask.
3828    pub update_mask: std::option::Option<wkt::FieldMask>,
3829
3830    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3831}
3832
3833impl UpdateAclRequest {
3834    pub fn new() -> Self {
3835        std::default::Default::default()
3836    }
3837
3838    /// Sets the value of [acl][crate::model::UpdateAclRequest::acl].
3839    pub fn set_acl<T>(mut self, v: T) -> Self
3840    where
3841        T: std::convert::Into<crate::model::Acl>,
3842    {
3843        self.acl = std::option::Option::Some(v.into());
3844        self
3845    }
3846
3847    /// Sets or clears the value of [acl][crate::model::UpdateAclRequest::acl].
3848    pub fn set_or_clear_acl<T>(mut self, v: std::option::Option<T>) -> Self
3849    where
3850        T: std::convert::Into<crate::model::Acl>,
3851    {
3852        self.acl = v.map(|x| x.into());
3853        self
3854    }
3855
3856    /// Sets the value of [update_mask][crate::model::UpdateAclRequest::update_mask].
3857    pub fn set_update_mask<T>(mut self, v: T) -> Self
3858    where
3859        T: std::convert::Into<wkt::FieldMask>,
3860    {
3861        self.update_mask = std::option::Option::Some(v.into());
3862        self
3863    }
3864
3865    /// Sets or clears the value of [update_mask][crate::model::UpdateAclRequest::update_mask].
3866    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3867    where
3868        T: std::convert::Into<wkt::FieldMask>,
3869    {
3870        self.update_mask = v.map(|x| x.into());
3871        self
3872    }
3873}
3874
3875impl wkt::message::Message for UpdateAclRequest {
3876    fn typename() -> &'static str {
3877        "type.googleapis.com/google.cloud.managedkafka.v1.UpdateAclRequest"
3878    }
3879}
3880
3881#[doc(hidden)]
3882impl<'de> serde::de::Deserialize<'de> for UpdateAclRequest {
3883    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3884    where
3885        D: serde::Deserializer<'de>,
3886    {
3887        #[allow(non_camel_case_types)]
3888        #[doc(hidden)]
3889        #[derive(PartialEq, Eq, Hash)]
3890        enum __FieldTag {
3891            __acl,
3892            __update_mask,
3893            Unknown(std::string::String),
3894        }
3895        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3896            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3897            where
3898                D: serde::Deserializer<'de>,
3899            {
3900                struct Visitor;
3901                impl<'de> serde::de::Visitor<'de> for Visitor {
3902                    type Value = __FieldTag;
3903                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3904                        formatter.write_str("a field name for UpdateAclRequest")
3905                    }
3906                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3907                    where
3908                        E: serde::de::Error,
3909                    {
3910                        use std::result::Result::Ok;
3911                        use std::string::ToString;
3912                        match value {
3913                            "acl" => Ok(__FieldTag::__acl),
3914                            "updateMask" => Ok(__FieldTag::__update_mask),
3915                            "update_mask" => Ok(__FieldTag::__update_mask),
3916                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3917                        }
3918                    }
3919                }
3920                deserializer.deserialize_identifier(Visitor)
3921            }
3922        }
3923        struct Visitor;
3924        impl<'de> serde::de::Visitor<'de> for Visitor {
3925            type Value = UpdateAclRequest;
3926            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3927                formatter.write_str("struct UpdateAclRequest")
3928            }
3929            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3930            where
3931                A: serde::de::MapAccess<'de>,
3932            {
3933                #[allow(unused_imports)]
3934                use serde::de::Error;
3935                use std::option::Option::Some;
3936                let mut fields = std::collections::HashSet::new();
3937                let mut result = Self::Value::new();
3938                while let Some(tag) = map.next_key::<__FieldTag>()? {
3939                    #[allow(clippy::match_single_binding)]
3940                    match tag {
3941                        __FieldTag::__acl => {
3942                            if !fields.insert(__FieldTag::__acl) {
3943                                return std::result::Result::Err(A::Error::duplicate_field(
3944                                    "multiple values for acl",
3945                                ));
3946                            }
3947                            result.acl =
3948                                map.next_value::<std::option::Option<crate::model::Acl>>()?;
3949                        }
3950                        __FieldTag::__update_mask => {
3951                            if !fields.insert(__FieldTag::__update_mask) {
3952                                return std::result::Result::Err(A::Error::duplicate_field(
3953                                    "multiple values for update_mask",
3954                                ));
3955                            }
3956                            result.update_mask =
3957                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
3958                        }
3959                        __FieldTag::Unknown(key) => {
3960                            let value = map.next_value::<serde_json::Value>()?;
3961                            result._unknown_fields.insert(key, value);
3962                        }
3963                    }
3964                }
3965                std::result::Result::Ok(result)
3966            }
3967        }
3968        deserializer.deserialize_any(Visitor)
3969    }
3970}
3971
3972#[doc(hidden)]
3973impl serde::ser::Serialize for UpdateAclRequest {
3974    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3975    where
3976        S: serde::ser::Serializer,
3977    {
3978        use serde::ser::SerializeMap;
3979        #[allow(unused_imports)]
3980        use std::option::Option::Some;
3981        let mut state = serializer.serialize_map(std::option::Option::None)?;
3982        if self.acl.is_some() {
3983            state.serialize_entry("acl", &self.acl)?;
3984        }
3985        if self.update_mask.is_some() {
3986            state.serialize_entry("updateMask", &self.update_mask)?;
3987        }
3988        if !self._unknown_fields.is_empty() {
3989            for (key, value) in self._unknown_fields.iter() {
3990                state.serialize_entry(key, &value)?;
3991            }
3992        }
3993        state.end()
3994    }
3995}
3996
3997/// Request for DeleteAcl.
3998#[derive(Clone, Debug, Default, PartialEq)]
3999#[non_exhaustive]
4000pub struct DeleteAclRequest {
4001    /// Required. The name of the acl to delete.
4002    /// Structured like:
4003    /// `projects/{project}/locations/{location}/clusters/{cluster}/acls/{acl_id}`.
4004    ///
4005    /// The structure of `acl_id` defines the Resource Pattern (resource_type,
4006    /// resource_name, pattern_type) of the acl. See `Acl.name` for details.
4007    pub name: std::string::String,
4008
4009    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4010}
4011
4012impl DeleteAclRequest {
4013    pub fn new() -> Self {
4014        std::default::Default::default()
4015    }
4016
4017    /// Sets the value of [name][crate::model::DeleteAclRequest::name].
4018    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4019        self.name = v.into();
4020        self
4021    }
4022}
4023
4024impl wkt::message::Message for DeleteAclRequest {
4025    fn typename() -> &'static str {
4026        "type.googleapis.com/google.cloud.managedkafka.v1.DeleteAclRequest"
4027    }
4028}
4029
4030#[doc(hidden)]
4031impl<'de> serde::de::Deserialize<'de> for DeleteAclRequest {
4032    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4033    where
4034        D: serde::Deserializer<'de>,
4035    {
4036        #[allow(non_camel_case_types)]
4037        #[doc(hidden)]
4038        #[derive(PartialEq, Eq, Hash)]
4039        enum __FieldTag {
4040            __name,
4041            Unknown(std::string::String),
4042        }
4043        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4044            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4045            where
4046                D: serde::Deserializer<'de>,
4047            {
4048                struct Visitor;
4049                impl<'de> serde::de::Visitor<'de> for Visitor {
4050                    type Value = __FieldTag;
4051                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4052                        formatter.write_str("a field name for DeleteAclRequest")
4053                    }
4054                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4055                    where
4056                        E: serde::de::Error,
4057                    {
4058                        use std::result::Result::Ok;
4059                        use std::string::ToString;
4060                        match value {
4061                            "name" => Ok(__FieldTag::__name),
4062                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4063                        }
4064                    }
4065                }
4066                deserializer.deserialize_identifier(Visitor)
4067            }
4068        }
4069        struct Visitor;
4070        impl<'de> serde::de::Visitor<'de> for Visitor {
4071            type Value = DeleteAclRequest;
4072            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4073                formatter.write_str("struct DeleteAclRequest")
4074            }
4075            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4076            where
4077                A: serde::de::MapAccess<'de>,
4078            {
4079                #[allow(unused_imports)]
4080                use serde::de::Error;
4081                use std::option::Option::Some;
4082                let mut fields = std::collections::HashSet::new();
4083                let mut result = Self::Value::new();
4084                while let Some(tag) = map.next_key::<__FieldTag>()? {
4085                    #[allow(clippy::match_single_binding)]
4086                    match tag {
4087                        __FieldTag::__name => {
4088                            if !fields.insert(__FieldTag::__name) {
4089                                return std::result::Result::Err(A::Error::duplicate_field(
4090                                    "multiple values for name",
4091                                ));
4092                            }
4093                            result.name = map
4094                                .next_value::<std::option::Option<std::string::String>>()?
4095                                .unwrap_or_default();
4096                        }
4097                        __FieldTag::Unknown(key) => {
4098                            let value = map.next_value::<serde_json::Value>()?;
4099                            result._unknown_fields.insert(key, value);
4100                        }
4101                    }
4102                }
4103                std::result::Result::Ok(result)
4104            }
4105        }
4106        deserializer.deserialize_any(Visitor)
4107    }
4108}
4109
4110#[doc(hidden)]
4111impl serde::ser::Serialize for DeleteAclRequest {
4112    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4113    where
4114        S: serde::ser::Serializer,
4115    {
4116        use serde::ser::SerializeMap;
4117        #[allow(unused_imports)]
4118        use std::option::Option::Some;
4119        let mut state = serializer.serialize_map(std::option::Option::None)?;
4120        if !self.name.is_empty() {
4121            state.serialize_entry("name", &self.name)?;
4122        }
4123        if !self._unknown_fields.is_empty() {
4124            for (key, value) in self._unknown_fields.iter() {
4125                state.serialize_entry(key, &value)?;
4126            }
4127        }
4128        state.end()
4129    }
4130}
4131
4132/// Request for AddAclEntry.
4133#[derive(Clone, Debug, Default, PartialEq)]
4134#[non_exhaustive]
4135pub struct AddAclEntryRequest {
4136    /// Required. The name of the acl to add the acl entry to.
4137    /// Structured like:
4138    /// `projects/{project}/locations/{location}/clusters/{cluster}/acls/{acl_id}`.
4139    ///
4140    /// The structure of `acl_id` defines the Resource Pattern (resource_type,
4141    /// resource_name, pattern_type) of the acl. See `Acl.name` for
4142    /// details.
4143    pub acl: std::string::String,
4144
4145    /// Required. The acl entry to add.
4146    pub acl_entry: std::option::Option<crate::model::AclEntry>,
4147
4148    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4149}
4150
4151impl AddAclEntryRequest {
4152    pub fn new() -> Self {
4153        std::default::Default::default()
4154    }
4155
4156    /// Sets the value of [acl][crate::model::AddAclEntryRequest::acl].
4157    pub fn set_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4158        self.acl = v.into();
4159        self
4160    }
4161
4162    /// Sets the value of [acl_entry][crate::model::AddAclEntryRequest::acl_entry].
4163    pub fn set_acl_entry<T>(mut self, v: T) -> Self
4164    where
4165        T: std::convert::Into<crate::model::AclEntry>,
4166    {
4167        self.acl_entry = std::option::Option::Some(v.into());
4168        self
4169    }
4170
4171    /// Sets or clears the value of [acl_entry][crate::model::AddAclEntryRequest::acl_entry].
4172    pub fn set_or_clear_acl_entry<T>(mut self, v: std::option::Option<T>) -> Self
4173    where
4174        T: std::convert::Into<crate::model::AclEntry>,
4175    {
4176        self.acl_entry = v.map(|x| x.into());
4177        self
4178    }
4179}
4180
4181impl wkt::message::Message for AddAclEntryRequest {
4182    fn typename() -> &'static str {
4183        "type.googleapis.com/google.cloud.managedkafka.v1.AddAclEntryRequest"
4184    }
4185}
4186
4187#[doc(hidden)]
4188impl<'de> serde::de::Deserialize<'de> for AddAclEntryRequest {
4189    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4190    where
4191        D: serde::Deserializer<'de>,
4192    {
4193        #[allow(non_camel_case_types)]
4194        #[doc(hidden)]
4195        #[derive(PartialEq, Eq, Hash)]
4196        enum __FieldTag {
4197            __acl,
4198            __acl_entry,
4199            Unknown(std::string::String),
4200        }
4201        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4202            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4203            where
4204                D: serde::Deserializer<'de>,
4205            {
4206                struct Visitor;
4207                impl<'de> serde::de::Visitor<'de> for Visitor {
4208                    type Value = __FieldTag;
4209                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4210                        formatter.write_str("a field name for AddAclEntryRequest")
4211                    }
4212                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4213                    where
4214                        E: serde::de::Error,
4215                    {
4216                        use std::result::Result::Ok;
4217                        use std::string::ToString;
4218                        match value {
4219                            "acl" => Ok(__FieldTag::__acl),
4220                            "aclEntry" => Ok(__FieldTag::__acl_entry),
4221                            "acl_entry" => Ok(__FieldTag::__acl_entry),
4222                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4223                        }
4224                    }
4225                }
4226                deserializer.deserialize_identifier(Visitor)
4227            }
4228        }
4229        struct Visitor;
4230        impl<'de> serde::de::Visitor<'de> for Visitor {
4231            type Value = AddAclEntryRequest;
4232            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4233                formatter.write_str("struct AddAclEntryRequest")
4234            }
4235            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4236            where
4237                A: serde::de::MapAccess<'de>,
4238            {
4239                #[allow(unused_imports)]
4240                use serde::de::Error;
4241                use std::option::Option::Some;
4242                let mut fields = std::collections::HashSet::new();
4243                let mut result = Self::Value::new();
4244                while let Some(tag) = map.next_key::<__FieldTag>()? {
4245                    #[allow(clippy::match_single_binding)]
4246                    match tag {
4247                        __FieldTag::__acl => {
4248                            if !fields.insert(__FieldTag::__acl) {
4249                                return std::result::Result::Err(A::Error::duplicate_field(
4250                                    "multiple values for acl",
4251                                ));
4252                            }
4253                            result.acl = map
4254                                .next_value::<std::option::Option<std::string::String>>()?
4255                                .unwrap_or_default();
4256                        }
4257                        __FieldTag::__acl_entry => {
4258                            if !fields.insert(__FieldTag::__acl_entry) {
4259                                return std::result::Result::Err(A::Error::duplicate_field(
4260                                    "multiple values for acl_entry",
4261                                ));
4262                            }
4263                            result.acl_entry =
4264                                map.next_value::<std::option::Option<crate::model::AclEntry>>()?;
4265                        }
4266                        __FieldTag::Unknown(key) => {
4267                            let value = map.next_value::<serde_json::Value>()?;
4268                            result._unknown_fields.insert(key, value);
4269                        }
4270                    }
4271                }
4272                std::result::Result::Ok(result)
4273            }
4274        }
4275        deserializer.deserialize_any(Visitor)
4276    }
4277}
4278
4279#[doc(hidden)]
4280impl serde::ser::Serialize for AddAclEntryRequest {
4281    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4282    where
4283        S: serde::ser::Serializer,
4284    {
4285        use serde::ser::SerializeMap;
4286        #[allow(unused_imports)]
4287        use std::option::Option::Some;
4288        let mut state = serializer.serialize_map(std::option::Option::None)?;
4289        if !self.acl.is_empty() {
4290            state.serialize_entry("acl", &self.acl)?;
4291        }
4292        if self.acl_entry.is_some() {
4293            state.serialize_entry("aclEntry", &self.acl_entry)?;
4294        }
4295        if !self._unknown_fields.is_empty() {
4296            for (key, value) in self._unknown_fields.iter() {
4297                state.serialize_entry(key, &value)?;
4298            }
4299        }
4300        state.end()
4301    }
4302}
4303
4304/// Response for AddAclEntry.
4305#[derive(Clone, Debug, Default, PartialEq)]
4306#[non_exhaustive]
4307pub struct AddAclEntryResponse {
4308    /// The updated acl.
4309    pub acl: std::option::Option<crate::model::Acl>,
4310
4311    /// Whether the acl was created as a result of adding the acl entry.
4312    pub acl_created: bool,
4313
4314    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4315}
4316
4317impl AddAclEntryResponse {
4318    pub fn new() -> Self {
4319        std::default::Default::default()
4320    }
4321
4322    /// Sets the value of [acl][crate::model::AddAclEntryResponse::acl].
4323    pub fn set_acl<T>(mut self, v: T) -> Self
4324    where
4325        T: std::convert::Into<crate::model::Acl>,
4326    {
4327        self.acl = std::option::Option::Some(v.into());
4328        self
4329    }
4330
4331    /// Sets or clears the value of [acl][crate::model::AddAclEntryResponse::acl].
4332    pub fn set_or_clear_acl<T>(mut self, v: std::option::Option<T>) -> Self
4333    where
4334        T: std::convert::Into<crate::model::Acl>,
4335    {
4336        self.acl = v.map(|x| x.into());
4337        self
4338    }
4339
4340    /// Sets the value of [acl_created][crate::model::AddAclEntryResponse::acl_created].
4341    pub fn set_acl_created<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4342        self.acl_created = v.into();
4343        self
4344    }
4345}
4346
4347impl wkt::message::Message for AddAclEntryResponse {
4348    fn typename() -> &'static str {
4349        "type.googleapis.com/google.cloud.managedkafka.v1.AddAclEntryResponse"
4350    }
4351}
4352
4353#[doc(hidden)]
4354impl<'de> serde::de::Deserialize<'de> for AddAclEntryResponse {
4355    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4356    where
4357        D: serde::Deserializer<'de>,
4358    {
4359        #[allow(non_camel_case_types)]
4360        #[doc(hidden)]
4361        #[derive(PartialEq, Eq, Hash)]
4362        enum __FieldTag {
4363            __acl,
4364            __acl_created,
4365            Unknown(std::string::String),
4366        }
4367        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4368            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4369            where
4370                D: serde::Deserializer<'de>,
4371            {
4372                struct Visitor;
4373                impl<'de> serde::de::Visitor<'de> for Visitor {
4374                    type Value = __FieldTag;
4375                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4376                        formatter.write_str("a field name for AddAclEntryResponse")
4377                    }
4378                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4379                    where
4380                        E: serde::de::Error,
4381                    {
4382                        use std::result::Result::Ok;
4383                        use std::string::ToString;
4384                        match value {
4385                            "acl" => Ok(__FieldTag::__acl),
4386                            "aclCreated" => Ok(__FieldTag::__acl_created),
4387                            "acl_created" => Ok(__FieldTag::__acl_created),
4388                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4389                        }
4390                    }
4391                }
4392                deserializer.deserialize_identifier(Visitor)
4393            }
4394        }
4395        struct Visitor;
4396        impl<'de> serde::de::Visitor<'de> for Visitor {
4397            type Value = AddAclEntryResponse;
4398            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4399                formatter.write_str("struct AddAclEntryResponse")
4400            }
4401            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4402            where
4403                A: serde::de::MapAccess<'de>,
4404            {
4405                #[allow(unused_imports)]
4406                use serde::de::Error;
4407                use std::option::Option::Some;
4408                let mut fields = std::collections::HashSet::new();
4409                let mut result = Self::Value::new();
4410                while let Some(tag) = map.next_key::<__FieldTag>()? {
4411                    #[allow(clippy::match_single_binding)]
4412                    match tag {
4413                        __FieldTag::__acl => {
4414                            if !fields.insert(__FieldTag::__acl) {
4415                                return std::result::Result::Err(A::Error::duplicate_field(
4416                                    "multiple values for acl",
4417                                ));
4418                            }
4419                            result.acl =
4420                                map.next_value::<std::option::Option<crate::model::Acl>>()?;
4421                        }
4422                        __FieldTag::__acl_created => {
4423                            if !fields.insert(__FieldTag::__acl_created) {
4424                                return std::result::Result::Err(A::Error::duplicate_field(
4425                                    "multiple values for acl_created",
4426                                ));
4427                            }
4428                            result.acl_created = map
4429                                .next_value::<std::option::Option<bool>>()?
4430                                .unwrap_or_default();
4431                        }
4432                        __FieldTag::Unknown(key) => {
4433                            let value = map.next_value::<serde_json::Value>()?;
4434                            result._unknown_fields.insert(key, value);
4435                        }
4436                    }
4437                }
4438                std::result::Result::Ok(result)
4439            }
4440        }
4441        deserializer.deserialize_any(Visitor)
4442    }
4443}
4444
4445#[doc(hidden)]
4446impl serde::ser::Serialize for AddAclEntryResponse {
4447    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4448    where
4449        S: serde::ser::Serializer,
4450    {
4451        use serde::ser::SerializeMap;
4452        #[allow(unused_imports)]
4453        use std::option::Option::Some;
4454        let mut state = serializer.serialize_map(std::option::Option::None)?;
4455        if self.acl.is_some() {
4456            state.serialize_entry("acl", &self.acl)?;
4457        }
4458        if !wkt::internal::is_default(&self.acl_created) {
4459            state.serialize_entry("aclCreated", &self.acl_created)?;
4460        }
4461        if !self._unknown_fields.is_empty() {
4462            for (key, value) in self._unknown_fields.iter() {
4463                state.serialize_entry(key, &value)?;
4464            }
4465        }
4466        state.end()
4467    }
4468}
4469
4470/// Request for RemoveAclEntry.
4471#[derive(Clone, Debug, Default, PartialEq)]
4472#[non_exhaustive]
4473pub struct RemoveAclEntryRequest {
4474    /// Required. The name of the acl to remove the acl entry from.
4475    /// Structured like:
4476    /// `projects/{project}/locations/{location}/clusters/{cluster}/acls/{acl_id}`.
4477    ///
4478    /// The structure of `acl_id` defines the Resource Pattern (resource_type,
4479    /// resource_name, pattern_type) of the acl. See `Acl.name` for
4480    /// details.
4481    pub acl: std::string::String,
4482
4483    /// Required. The acl entry to remove.
4484    pub acl_entry: std::option::Option<crate::model::AclEntry>,
4485
4486    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4487}
4488
4489impl RemoveAclEntryRequest {
4490    pub fn new() -> Self {
4491        std::default::Default::default()
4492    }
4493
4494    /// Sets the value of [acl][crate::model::RemoveAclEntryRequest::acl].
4495    pub fn set_acl<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4496        self.acl = v.into();
4497        self
4498    }
4499
4500    /// Sets the value of [acl_entry][crate::model::RemoveAclEntryRequest::acl_entry].
4501    pub fn set_acl_entry<T>(mut self, v: T) -> Self
4502    where
4503        T: std::convert::Into<crate::model::AclEntry>,
4504    {
4505        self.acl_entry = std::option::Option::Some(v.into());
4506        self
4507    }
4508
4509    /// Sets or clears the value of [acl_entry][crate::model::RemoveAclEntryRequest::acl_entry].
4510    pub fn set_or_clear_acl_entry<T>(mut self, v: std::option::Option<T>) -> Self
4511    where
4512        T: std::convert::Into<crate::model::AclEntry>,
4513    {
4514        self.acl_entry = v.map(|x| x.into());
4515        self
4516    }
4517}
4518
4519impl wkt::message::Message for RemoveAclEntryRequest {
4520    fn typename() -> &'static str {
4521        "type.googleapis.com/google.cloud.managedkafka.v1.RemoveAclEntryRequest"
4522    }
4523}
4524
4525#[doc(hidden)]
4526impl<'de> serde::de::Deserialize<'de> for RemoveAclEntryRequest {
4527    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4528    where
4529        D: serde::Deserializer<'de>,
4530    {
4531        #[allow(non_camel_case_types)]
4532        #[doc(hidden)]
4533        #[derive(PartialEq, Eq, Hash)]
4534        enum __FieldTag {
4535            __acl,
4536            __acl_entry,
4537            Unknown(std::string::String),
4538        }
4539        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4540            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4541            where
4542                D: serde::Deserializer<'de>,
4543            {
4544                struct Visitor;
4545                impl<'de> serde::de::Visitor<'de> for Visitor {
4546                    type Value = __FieldTag;
4547                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4548                        formatter.write_str("a field name for RemoveAclEntryRequest")
4549                    }
4550                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4551                    where
4552                        E: serde::de::Error,
4553                    {
4554                        use std::result::Result::Ok;
4555                        use std::string::ToString;
4556                        match value {
4557                            "acl" => Ok(__FieldTag::__acl),
4558                            "aclEntry" => Ok(__FieldTag::__acl_entry),
4559                            "acl_entry" => Ok(__FieldTag::__acl_entry),
4560                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4561                        }
4562                    }
4563                }
4564                deserializer.deserialize_identifier(Visitor)
4565            }
4566        }
4567        struct Visitor;
4568        impl<'de> serde::de::Visitor<'de> for Visitor {
4569            type Value = RemoveAclEntryRequest;
4570            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4571                formatter.write_str("struct RemoveAclEntryRequest")
4572            }
4573            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4574            where
4575                A: serde::de::MapAccess<'de>,
4576            {
4577                #[allow(unused_imports)]
4578                use serde::de::Error;
4579                use std::option::Option::Some;
4580                let mut fields = std::collections::HashSet::new();
4581                let mut result = Self::Value::new();
4582                while let Some(tag) = map.next_key::<__FieldTag>()? {
4583                    #[allow(clippy::match_single_binding)]
4584                    match tag {
4585                        __FieldTag::__acl => {
4586                            if !fields.insert(__FieldTag::__acl) {
4587                                return std::result::Result::Err(A::Error::duplicate_field(
4588                                    "multiple values for acl",
4589                                ));
4590                            }
4591                            result.acl = map
4592                                .next_value::<std::option::Option<std::string::String>>()?
4593                                .unwrap_or_default();
4594                        }
4595                        __FieldTag::__acl_entry => {
4596                            if !fields.insert(__FieldTag::__acl_entry) {
4597                                return std::result::Result::Err(A::Error::duplicate_field(
4598                                    "multiple values for acl_entry",
4599                                ));
4600                            }
4601                            result.acl_entry =
4602                                map.next_value::<std::option::Option<crate::model::AclEntry>>()?;
4603                        }
4604                        __FieldTag::Unknown(key) => {
4605                            let value = map.next_value::<serde_json::Value>()?;
4606                            result._unknown_fields.insert(key, value);
4607                        }
4608                    }
4609                }
4610                std::result::Result::Ok(result)
4611            }
4612        }
4613        deserializer.deserialize_any(Visitor)
4614    }
4615}
4616
4617#[doc(hidden)]
4618impl serde::ser::Serialize for RemoveAclEntryRequest {
4619    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4620    where
4621        S: serde::ser::Serializer,
4622    {
4623        use serde::ser::SerializeMap;
4624        #[allow(unused_imports)]
4625        use std::option::Option::Some;
4626        let mut state = serializer.serialize_map(std::option::Option::None)?;
4627        if !self.acl.is_empty() {
4628            state.serialize_entry("acl", &self.acl)?;
4629        }
4630        if self.acl_entry.is_some() {
4631            state.serialize_entry("aclEntry", &self.acl_entry)?;
4632        }
4633        if !self._unknown_fields.is_empty() {
4634            for (key, value) in self._unknown_fields.iter() {
4635                state.serialize_entry(key, &value)?;
4636            }
4637        }
4638        state.end()
4639    }
4640}
4641
4642/// Response for RemoveAclEntry.
4643#[derive(Clone, Debug, Default, PartialEq)]
4644#[non_exhaustive]
4645pub struct RemoveAclEntryResponse {
4646    /// The result of removing the acl entry, depending on whether the acl was
4647    /// deleted as a result of removing the acl entry.
4648    pub result: std::option::Option<crate::model::remove_acl_entry_response::Result>,
4649
4650    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4651}
4652
4653impl RemoveAclEntryResponse {
4654    pub fn new() -> Self {
4655        std::default::Default::default()
4656    }
4657
4658    /// Sets the value of [result][crate::model::RemoveAclEntryResponse::result].
4659    ///
4660    /// Note that all the setters affecting `result` are mutually
4661    /// exclusive.
4662    pub fn set_result<
4663        T: std::convert::Into<std::option::Option<crate::model::remove_acl_entry_response::Result>>,
4664    >(
4665        mut self,
4666        v: T,
4667    ) -> Self {
4668        self.result = v.into();
4669        self
4670    }
4671
4672    /// The value of [result][crate::model::RemoveAclEntryResponse::result]
4673    /// if it holds a `Acl`, `None` if the field is not set or
4674    /// holds a different branch.
4675    pub fn acl(&self) -> std::option::Option<&std::boxed::Box<crate::model::Acl>> {
4676        #[allow(unreachable_patterns)]
4677        self.result.as_ref().and_then(|v| match v {
4678            crate::model::remove_acl_entry_response::Result::Acl(v) => std::option::Option::Some(v),
4679            _ => std::option::Option::None,
4680        })
4681    }
4682
4683    /// Sets the value of [result][crate::model::RemoveAclEntryResponse::result]
4684    /// to hold a `Acl`.
4685    ///
4686    /// Note that all the setters affecting `result` are
4687    /// mutually exclusive.
4688    pub fn set_acl<T: std::convert::Into<std::boxed::Box<crate::model::Acl>>>(
4689        mut self,
4690        v: T,
4691    ) -> Self {
4692        self.result = std::option::Option::Some(
4693            crate::model::remove_acl_entry_response::Result::Acl(v.into()),
4694        );
4695        self
4696    }
4697
4698    /// The value of [result][crate::model::RemoveAclEntryResponse::result]
4699    /// if it holds a `AclDeleted`, `None` if the field is not set or
4700    /// holds a different branch.
4701    pub fn acl_deleted(&self) -> std::option::Option<&bool> {
4702        #[allow(unreachable_patterns)]
4703        self.result.as_ref().and_then(|v| match v {
4704            crate::model::remove_acl_entry_response::Result::AclDeleted(v) => {
4705                std::option::Option::Some(v)
4706            }
4707            _ => std::option::Option::None,
4708        })
4709    }
4710
4711    /// Sets the value of [result][crate::model::RemoveAclEntryResponse::result]
4712    /// to hold a `AclDeleted`.
4713    ///
4714    /// Note that all the setters affecting `result` are
4715    /// mutually exclusive.
4716    pub fn set_acl_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4717        self.result = std::option::Option::Some(
4718            crate::model::remove_acl_entry_response::Result::AclDeleted(v.into()),
4719        );
4720        self
4721    }
4722}
4723
4724impl wkt::message::Message for RemoveAclEntryResponse {
4725    fn typename() -> &'static str {
4726        "type.googleapis.com/google.cloud.managedkafka.v1.RemoveAclEntryResponse"
4727    }
4728}
4729
4730#[doc(hidden)]
4731impl<'de> serde::de::Deserialize<'de> for RemoveAclEntryResponse {
4732    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4733    where
4734        D: serde::Deserializer<'de>,
4735    {
4736        #[allow(non_camel_case_types)]
4737        #[doc(hidden)]
4738        #[derive(PartialEq, Eq, Hash)]
4739        enum __FieldTag {
4740            __acl,
4741            __acl_deleted,
4742            Unknown(std::string::String),
4743        }
4744        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4745            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4746            where
4747                D: serde::Deserializer<'de>,
4748            {
4749                struct Visitor;
4750                impl<'de> serde::de::Visitor<'de> for Visitor {
4751                    type Value = __FieldTag;
4752                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4753                        formatter.write_str("a field name for RemoveAclEntryResponse")
4754                    }
4755                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4756                    where
4757                        E: serde::de::Error,
4758                    {
4759                        use std::result::Result::Ok;
4760                        use std::string::ToString;
4761                        match value {
4762                            "acl" => Ok(__FieldTag::__acl),
4763                            "aclDeleted" => Ok(__FieldTag::__acl_deleted),
4764                            "acl_deleted" => Ok(__FieldTag::__acl_deleted),
4765                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4766                        }
4767                    }
4768                }
4769                deserializer.deserialize_identifier(Visitor)
4770            }
4771        }
4772        struct Visitor;
4773        impl<'de> serde::de::Visitor<'de> for Visitor {
4774            type Value = RemoveAclEntryResponse;
4775            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4776                formatter.write_str("struct RemoveAclEntryResponse")
4777            }
4778            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4779            where
4780                A: serde::de::MapAccess<'de>,
4781            {
4782                #[allow(unused_imports)]
4783                use serde::de::Error;
4784                use std::option::Option::Some;
4785                let mut fields = std::collections::HashSet::new();
4786                let mut result = Self::Value::new();
4787                while let Some(tag) = map.next_key::<__FieldTag>()? {
4788                    #[allow(clippy::match_single_binding)]
4789                    match tag {
4790                        __FieldTag::__acl => {
4791                            if !fields.insert(__FieldTag::__acl) {
4792                                return std::result::Result::Err(A::Error::duplicate_field(
4793                                    "multiple values for acl",
4794                                ));
4795                            }
4796                            if result.result.is_some() {
4797                                return std::result::Result::Err(A::Error::duplicate_field(
4798                                    "multiple values for `result`, a oneof with full ID .google.cloud.managedkafka.v1.RemoveAclEntryResponse.acl, latest field was acl",
4799                                ));
4800                            }
4801                            result.result = std::option::Option::Some(
4802                                crate::model::remove_acl_entry_response::Result::Acl(
4803                                    map.next_value::<std::option::Option<std::boxed::Box<crate::model::Acl>>>()?.unwrap_or_default()
4804                                ),
4805                            );
4806                        }
4807                        __FieldTag::__acl_deleted => {
4808                            if !fields.insert(__FieldTag::__acl_deleted) {
4809                                return std::result::Result::Err(A::Error::duplicate_field(
4810                                    "multiple values for acl_deleted",
4811                                ));
4812                            }
4813                            if result.result.is_some() {
4814                                return std::result::Result::Err(A::Error::duplicate_field(
4815                                    "multiple values for `result`, a oneof with full ID .google.cloud.managedkafka.v1.RemoveAclEntryResponse.acl_deleted, latest field was aclDeleted",
4816                                ));
4817                            }
4818                            result.result = std::option::Option::Some(
4819                                crate::model::remove_acl_entry_response::Result::AclDeleted(
4820                                    map.next_value::<std::option::Option<bool>>()?
4821                                        .unwrap_or_default(),
4822                                ),
4823                            );
4824                        }
4825                        __FieldTag::Unknown(key) => {
4826                            let value = map.next_value::<serde_json::Value>()?;
4827                            result._unknown_fields.insert(key, value);
4828                        }
4829                    }
4830                }
4831                std::result::Result::Ok(result)
4832            }
4833        }
4834        deserializer.deserialize_any(Visitor)
4835    }
4836}
4837
4838#[doc(hidden)]
4839impl serde::ser::Serialize for RemoveAclEntryResponse {
4840    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4841    where
4842        S: serde::ser::Serializer,
4843    {
4844        use serde::ser::SerializeMap;
4845        #[allow(unused_imports)]
4846        use std::option::Option::Some;
4847        let mut state = serializer.serialize_map(std::option::Option::None)?;
4848        if let Some(value) = self.acl() {
4849            state.serialize_entry("acl", value)?;
4850        }
4851        if let Some(value) = self.acl_deleted() {
4852            state.serialize_entry("aclDeleted", value)?;
4853        }
4854        if !self._unknown_fields.is_empty() {
4855            for (key, value) in self._unknown_fields.iter() {
4856                state.serialize_entry(key, &value)?;
4857            }
4858        }
4859        state.end()
4860    }
4861}
4862
4863/// Defines additional types related to [RemoveAclEntryResponse].
4864pub mod remove_acl_entry_response {
4865    #[allow(unused_imports)]
4866    use super::*;
4867
4868    /// The result of removing the acl entry, depending on whether the acl was
4869    /// deleted as a result of removing the acl entry.
4870    #[derive(Clone, Debug, PartialEq)]
4871    #[non_exhaustive]
4872    pub enum Result {
4873        /// The updated acl. Returned if the removed acl entry was not the last entry
4874        /// in the acl.
4875        Acl(std::boxed::Box<crate::model::Acl>),
4876        /// Returned with value true if the removed acl entry was the last entry in
4877        /// the acl, resulting in acl deletion.
4878        AclDeleted(bool),
4879    }
4880}
4881
4882/// Request for GetConnectCluster.
4883#[derive(Clone, Debug, Default, PartialEq)]
4884#[non_exhaustive]
4885pub struct GetConnectClusterRequest {
4886    /// Required. The name of the Kafka Connect cluster whose configuration to
4887    /// return. Structured like
4888    /// `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`.
4889    pub name: std::string::String,
4890
4891    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4892}
4893
4894impl GetConnectClusterRequest {
4895    pub fn new() -> Self {
4896        std::default::Default::default()
4897    }
4898
4899    /// Sets the value of [name][crate::model::GetConnectClusterRequest::name].
4900    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4901        self.name = v.into();
4902        self
4903    }
4904}
4905
4906impl wkt::message::Message for GetConnectClusterRequest {
4907    fn typename() -> &'static str {
4908        "type.googleapis.com/google.cloud.managedkafka.v1.GetConnectClusterRequest"
4909    }
4910}
4911
4912#[doc(hidden)]
4913impl<'de> serde::de::Deserialize<'de> for GetConnectClusterRequest {
4914    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4915    where
4916        D: serde::Deserializer<'de>,
4917    {
4918        #[allow(non_camel_case_types)]
4919        #[doc(hidden)]
4920        #[derive(PartialEq, Eq, Hash)]
4921        enum __FieldTag {
4922            __name,
4923            Unknown(std::string::String),
4924        }
4925        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4926            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4927            where
4928                D: serde::Deserializer<'de>,
4929            {
4930                struct Visitor;
4931                impl<'de> serde::de::Visitor<'de> for Visitor {
4932                    type Value = __FieldTag;
4933                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4934                        formatter.write_str("a field name for GetConnectClusterRequest")
4935                    }
4936                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4937                    where
4938                        E: serde::de::Error,
4939                    {
4940                        use std::result::Result::Ok;
4941                        use std::string::ToString;
4942                        match value {
4943                            "name" => Ok(__FieldTag::__name),
4944                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4945                        }
4946                    }
4947                }
4948                deserializer.deserialize_identifier(Visitor)
4949            }
4950        }
4951        struct Visitor;
4952        impl<'de> serde::de::Visitor<'de> for Visitor {
4953            type Value = GetConnectClusterRequest;
4954            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4955                formatter.write_str("struct GetConnectClusterRequest")
4956            }
4957            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4958            where
4959                A: serde::de::MapAccess<'de>,
4960            {
4961                #[allow(unused_imports)]
4962                use serde::de::Error;
4963                use std::option::Option::Some;
4964                let mut fields = std::collections::HashSet::new();
4965                let mut result = Self::Value::new();
4966                while let Some(tag) = map.next_key::<__FieldTag>()? {
4967                    #[allow(clippy::match_single_binding)]
4968                    match tag {
4969                        __FieldTag::__name => {
4970                            if !fields.insert(__FieldTag::__name) {
4971                                return std::result::Result::Err(A::Error::duplicate_field(
4972                                    "multiple values for name",
4973                                ));
4974                            }
4975                            result.name = map
4976                                .next_value::<std::option::Option<std::string::String>>()?
4977                                .unwrap_or_default();
4978                        }
4979                        __FieldTag::Unknown(key) => {
4980                            let value = map.next_value::<serde_json::Value>()?;
4981                            result._unknown_fields.insert(key, value);
4982                        }
4983                    }
4984                }
4985                std::result::Result::Ok(result)
4986            }
4987        }
4988        deserializer.deserialize_any(Visitor)
4989    }
4990}
4991
4992#[doc(hidden)]
4993impl serde::ser::Serialize for GetConnectClusterRequest {
4994    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4995    where
4996        S: serde::ser::Serializer,
4997    {
4998        use serde::ser::SerializeMap;
4999        #[allow(unused_imports)]
5000        use std::option::Option::Some;
5001        let mut state = serializer.serialize_map(std::option::Option::None)?;
5002        if !self.name.is_empty() {
5003            state.serialize_entry("name", &self.name)?;
5004        }
5005        if !self._unknown_fields.is_empty() {
5006            for (key, value) in self._unknown_fields.iter() {
5007                state.serialize_entry(key, &value)?;
5008            }
5009        }
5010        state.end()
5011    }
5012}
5013
5014/// Request for CreateConnectCluster.
5015#[derive(Clone, Debug, Default, PartialEq)]
5016#[non_exhaustive]
5017pub struct CreateConnectClusterRequest {
5018    /// Required. The parent project/location in which to create the Kafka Connect
5019    /// cluster. Structured like
5020    /// `projects/{project}/locations/{location}/`.
5021    pub parent: std::string::String,
5022
5023    /// Required. The ID to use for the Connect cluster, which will become the
5024    /// final component of the cluster's name. The ID must be 1-63 characters long,
5025    /// and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` to comply
5026    /// with RFC 1035.
5027    ///
5028    /// This value is structured like: `my-cluster-id`.
5029    pub connect_cluster_id: std::string::String,
5030
5031    /// Required. Configuration of the Kafka Connect cluster to create. Its `name`
5032    /// field is ignored.
5033    pub connect_cluster: std::option::Option<crate::model::ConnectCluster>,
5034
5035    /// Optional. An optional request ID to identify requests. Specify a unique
5036    /// request ID to avoid duplication of requests. If a request times out or
5037    /// fails, retrying with the same ID allows the server to recognize the
5038    /// previous attempt. For at least 60 minutes, the server ignores duplicate
5039    /// requests bearing the same ID.
5040    ///
5041    /// For example, consider a situation where you make an initial request and the
5042    /// request times out. If you make the request again with the same request ID
5043    /// within 60 minutes of the last request, the server checks if an original
5044    /// operation with the same request ID was received. If so, the server ignores
5045    /// the second request.
5046    ///
5047    /// The request ID must be a valid UUID. A zero UUID is not supported
5048    /// (00000000-0000-0000-0000-000000000000).
5049    pub request_id: std::string::String,
5050
5051    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5052}
5053
5054impl CreateConnectClusterRequest {
5055    pub fn new() -> Self {
5056        std::default::Default::default()
5057    }
5058
5059    /// Sets the value of [parent][crate::model::CreateConnectClusterRequest::parent].
5060    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5061        self.parent = v.into();
5062        self
5063    }
5064
5065    /// Sets the value of [connect_cluster_id][crate::model::CreateConnectClusterRequest::connect_cluster_id].
5066    pub fn set_connect_cluster_id<T: std::convert::Into<std::string::String>>(
5067        mut self,
5068        v: T,
5069    ) -> Self {
5070        self.connect_cluster_id = v.into();
5071        self
5072    }
5073
5074    /// Sets the value of [connect_cluster][crate::model::CreateConnectClusterRequest::connect_cluster].
5075    pub fn set_connect_cluster<T>(mut self, v: T) -> Self
5076    where
5077        T: std::convert::Into<crate::model::ConnectCluster>,
5078    {
5079        self.connect_cluster = std::option::Option::Some(v.into());
5080        self
5081    }
5082
5083    /// Sets or clears the value of [connect_cluster][crate::model::CreateConnectClusterRequest::connect_cluster].
5084    pub fn set_or_clear_connect_cluster<T>(mut self, v: std::option::Option<T>) -> Self
5085    where
5086        T: std::convert::Into<crate::model::ConnectCluster>,
5087    {
5088        self.connect_cluster = v.map(|x| x.into());
5089        self
5090    }
5091
5092    /// Sets the value of [request_id][crate::model::CreateConnectClusterRequest::request_id].
5093    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5094        self.request_id = v.into();
5095        self
5096    }
5097}
5098
5099impl wkt::message::Message for CreateConnectClusterRequest {
5100    fn typename() -> &'static str {
5101        "type.googleapis.com/google.cloud.managedkafka.v1.CreateConnectClusterRequest"
5102    }
5103}
5104
5105#[doc(hidden)]
5106impl<'de> serde::de::Deserialize<'de> for CreateConnectClusterRequest {
5107    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5108    where
5109        D: serde::Deserializer<'de>,
5110    {
5111        #[allow(non_camel_case_types)]
5112        #[doc(hidden)]
5113        #[derive(PartialEq, Eq, Hash)]
5114        enum __FieldTag {
5115            __parent,
5116            __connect_cluster_id,
5117            __connect_cluster,
5118            __request_id,
5119            Unknown(std::string::String),
5120        }
5121        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5122            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5123            where
5124                D: serde::Deserializer<'de>,
5125            {
5126                struct Visitor;
5127                impl<'de> serde::de::Visitor<'de> for Visitor {
5128                    type Value = __FieldTag;
5129                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5130                        formatter.write_str("a field name for CreateConnectClusterRequest")
5131                    }
5132                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5133                    where
5134                        E: serde::de::Error,
5135                    {
5136                        use std::result::Result::Ok;
5137                        use std::string::ToString;
5138                        match value {
5139                            "parent" => Ok(__FieldTag::__parent),
5140                            "connectClusterId" => Ok(__FieldTag::__connect_cluster_id),
5141                            "connect_cluster_id" => Ok(__FieldTag::__connect_cluster_id),
5142                            "connectCluster" => Ok(__FieldTag::__connect_cluster),
5143                            "connect_cluster" => Ok(__FieldTag::__connect_cluster),
5144                            "requestId" => Ok(__FieldTag::__request_id),
5145                            "request_id" => Ok(__FieldTag::__request_id),
5146                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5147                        }
5148                    }
5149                }
5150                deserializer.deserialize_identifier(Visitor)
5151            }
5152        }
5153        struct Visitor;
5154        impl<'de> serde::de::Visitor<'de> for Visitor {
5155            type Value = CreateConnectClusterRequest;
5156            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5157                formatter.write_str("struct CreateConnectClusterRequest")
5158            }
5159            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5160            where
5161                A: serde::de::MapAccess<'de>,
5162            {
5163                #[allow(unused_imports)]
5164                use serde::de::Error;
5165                use std::option::Option::Some;
5166                let mut fields = std::collections::HashSet::new();
5167                let mut result = Self::Value::new();
5168                while let Some(tag) = map.next_key::<__FieldTag>()? {
5169                    #[allow(clippy::match_single_binding)]
5170                    match tag {
5171                        __FieldTag::__parent => {
5172                            if !fields.insert(__FieldTag::__parent) {
5173                                return std::result::Result::Err(A::Error::duplicate_field(
5174                                    "multiple values for parent",
5175                                ));
5176                            }
5177                            result.parent = map
5178                                .next_value::<std::option::Option<std::string::String>>()?
5179                                .unwrap_or_default();
5180                        }
5181                        __FieldTag::__connect_cluster_id => {
5182                            if !fields.insert(__FieldTag::__connect_cluster_id) {
5183                                return std::result::Result::Err(A::Error::duplicate_field(
5184                                    "multiple values for connect_cluster_id",
5185                                ));
5186                            }
5187                            result.connect_cluster_id = map
5188                                .next_value::<std::option::Option<std::string::String>>()?
5189                                .unwrap_or_default();
5190                        }
5191                        __FieldTag::__connect_cluster => {
5192                            if !fields.insert(__FieldTag::__connect_cluster) {
5193                                return std::result::Result::Err(A::Error::duplicate_field(
5194                                    "multiple values for connect_cluster",
5195                                ));
5196                            }
5197                            result.connect_cluster = map
5198                                .next_value::<std::option::Option<crate::model::ConnectCluster>>(
5199                                )?;
5200                        }
5201                        __FieldTag::__request_id => {
5202                            if !fields.insert(__FieldTag::__request_id) {
5203                                return std::result::Result::Err(A::Error::duplicate_field(
5204                                    "multiple values for request_id",
5205                                ));
5206                            }
5207                            result.request_id = map
5208                                .next_value::<std::option::Option<std::string::String>>()?
5209                                .unwrap_or_default();
5210                        }
5211                        __FieldTag::Unknown(key) => {
5212                            let value = map.next_value::<serde_json::Value>()?;
5213                            result._unknown_fields.insert(key, value);
5214                        }
5215                    }
5216                }
5217                std::result::Result::Ok(result)
5218            }
5219        }
5220        deserializer.deserialize_any(Visitor)
5221    }
5222}
5223
5224#[doc(hidden)]
5225impl serde::ser::Serialize for CreateConnectClusterRequest {
5226    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5227    where
5228        S: serde::ser::Serializer,
5229    {
5230        use serde::ser::SerializeMap;
5231        #[allow(unused_imports)]
5232        use std::option::Option::Some;
5233        let mut state = serializer.serialize_map(std::option::Option::None)?;
5234        if !self.parent.is_empty() {
5235            state.serialize_entry("parent", &self.parent)?;
5236        }
5237        if !self.connect_cluster_id.is_empty() {
5238            state.serialize_entry("connectClusterId", &self.connect_cluster_id)?;
5239        }
5240        if self.connect_cluster.is_some() {
5241            state.serialize_entry("connectCluster", &self.connect_cluster)?;
5242        }
5243        if !self.request_id.is_empty() {
5244            state.serialize_entry("requestId", &self.request_id)?;
5245        }
5246        if !self._unknown_fields.is_empty() {
5247            for (key, value) in self._unknown_fields.iter() {
5248                state.serialize_entry(key, &value)?;
5249            }
5250        }
5251        state.end()
5252    }
5253}
5254
5255/// Request for UpdateConnectCluster.
5256#[derive(Clone, Debug, Default, PartialEq)]
5257#[non_exhaustive]
5258pub struct UpdateConnectClusterRequest {
5259    /// Required. Field mask is used to specify the fields to be overwritten in the
5260    /// cluster resource by the update. The fields specified in the update_mask are
5261    /// relative to the resource, not the full request. A field will be overwritten
5262    /// if it is in the mask. The mask is required and a value of * will update all
5263    /// fields.
5264    pub update_mask: std::option::Option<wkt::FieldMask>,
5265
5266    /// Required. The Kafka Connect cluster to update. Its `name` field must be
5267    /// populated.
5268    pub connect_cluster: std::option::Option<crate::model::ConnectCluster>,
5269
5270    /// Optional. An optional request ID to identify requests. Specify a unique
5271    /// request ID to avoid duplication of requests. If a request times out or
5272    /// fails, retrying with the same ID allows the server to recognize the
5273    /// previous attempt. For at least 60 minutes, the server ignores duplicate
5274    /// requests bearing the same ID.
5275    ///
5276    /// For example, consider a situation where you make an initial request and the
5277    /// request times out. If you make the request again with the same request ID
5278    /// within 60 minutes of the last request, the server checks if an original
5279    /// operation with the same request ID was received. If so, the server ignores
5280    /// the second request.
5281    ///
5282    /// The request ID must be a valid UUID. A zero UUID is not supported
5283    /// (00000000-0000-0000-0000-000000000000).
5284    pub request_id: std::string::String,
5285
5286    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5287}
5288
5289impl UpdateConnectClusterRequest {
5290    pub fn new() -> Self {
5291        std::default::Default::default()
5292    }
5293
5294    /// Sets the value of [update_mask][crate::model::UpdateConnectClusterRequest::update_mask].
5295    pub fn set_update_mask<T>(mut self, v: T) -> Self
5296    where
5297        T: std::convert::Into<wkt::FieldMask>,
5298    {
5299        self.update_mask = std::option::Option::Some(v.into());
5300        self
5301    }
5302
5303    /// Sets or clears the value of [update_mask][crate::model::UpdateConnectClusterRequest::update_mask].
5304    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5305    where
5306        T: std::convert::Into<wkt::FieldMask>,
5307    {
5308        self.update_mask = v.map(|x| x.into());
5309        self
5310    }
5311
5312    /// Sets the value of [connect_cluster][crate::model::UpdateConnectClusterRequest::connect_cluster].
5313    pub fn set_connect_cluster<T>(mut self, v: T) -> Self
5314    where
5315        T: std::convert::Into<crate::model::ConnectCluster>,
5316    {
5317        self.connect_cluster = std::option::Option::Some(v.into());
5318        self
5319    }
5320
5321    /// Sets or clears the value of [connect_cluster][crate::model::UpdateConnectClusterRequest::connect_cluster].
5322    pub fn set_or_clear_connect_cluster<T>(mut self, v: std::option::Option<T>) -> Self
5323    where
5324        T: std::convert::Into<crate::model::ConnectCluster>,
5325    {
5326        self.connect_cluster = v.map(|x| x.into());
5327        self
5328    }
5329
5330    /// Sets the value of [request_id][crate::model::UpdateConnectClusterRequest::request_id].
5331    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5332        self.request_id = v.into();
5333        self
5334    }
5335}
5336
5337impl wkt::message::Message for UpdateConnectClusterRequest {
5338    fn typename() -> &'static str {
5339        "type.googleapis.com/google.cloud.managedkafka.v1.UpdateConnectClusterRequest"
5340    }
5341}
5342
5343#[doc(hidden)]
5344impl<'de> serde::de::Deserialize<'de> for UpdateConnectClusterRequest {
5345    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5346    where
5347        D: serde::Deserializer<'de>,
5348    {
5349        #[allow(non_camel_case_types)]
5350        #[doc(hidden)]
5351        #[derive(PartialEq, Eq, Hash)]
5352        enum __FieldTag {
5353            __update_mask,
5354            __connect_cluster,
5355            __request_id,
5356            Unknown(std::string::String),
5357        }
5358        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5359            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5360            where
5361                D: serde::Deserializer<'de>,
5362            {
5363                struct Visitor;
5364                impl<'de> serde::de::Visitor<'de> for Visitor {
5365                    type Value = __FieldTag;
5366                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5367                        formatter.write_str("a field name for UpdateConnectClusterRequest")
5368                    }
5369                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5370                    where
5371                        E: serde::de::Error,
5372                    {
5373                        use std::result::Result::Ok;
5374                        use std::string::ToString;
5375                        match value {
5376                            "updateMask" => Ok(__FieldTag::__update_mask),
5377                            "update_mask" => Ok(__FieldTag::__update_mask),
5378                            "connectCluster" => Ok(__FieldTag::__connect_cluster),
5379                            "connect_cluster" => Ok(__FieldTag::__connect_cluster),
5380                            "requestId" => Ok(__FieldTag::__request_id),
5381                            "request_id" => Ok(__FieldTag::__request_id),
5382                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5383                        }
5384                    }
5385                }
5386                deserializer.deserialize_identifier(Visitor)
5387            }
5388        }
5389        struct Visitor;
5390        impl<'de> serde::de::Visitor<'de> for Visitor {
5391            type Value = UpdateConnectClusterRequest;
5392            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5393                formatter.write_str("struct UpdateConnectClusterRequest")
5394            }
5395            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5396            where
5397                A: serde::de::MapAccess<'de>,
5398            {
5399                #[allow(unused_imports)]
5400                use serde::de::Error;
5401                use std::option::Option::Some;
5402                let mut fields = std::collections::HashSet::new();
5403                let mut result = Self::Value::new();
5404                while let Some(tag) = map.next_key::<__FieldTag>()? {
5405                    #[allow(clippy::match_single_binding)]
5406                    match tag {
5407                        __FieldTag::__update_mask => {
5408                            if !fields.insert(__FieldTag::__update_mask) {
5409                                return std::result::Result::Err(A::Error::duplicate_field(
5410                                    "multiple values for update_mask",
5411                                ));
5412                            }
5413                            result.update_mask =
5414                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
5415                        }
5416                        __FieldTag::__connect_cluster => {
5417                            if !fields.insert(__FieldTag::__connect_cluster) {
5418                                return std::result::Result::Err(A::Error::duplicate_field(
5419                                    "multiple values for connect_cluster",
5420                                ));
5421                            }
5422                            result.connect_cluster = map
5423                                .next_value::<std::option::Option<crate::model::ConnectCluster>>(
5424                                )?;
5425                        }
5426                        __FieldTag::__request_id => {
5427                            if !fields.insert(__FieldTag::__request_id) {
5428                                return std::result::Result::Err(A::Error::duplicate_field(
5429                                    "multiple values for request_id",
5430                                ));
5431                            }
5432                            result.request_id = map
5433                                .next_value::<std::option::Option<std::string::String>>()?
5434                                .unwrap_or_default();
5435                        }
5436                        __FieldTag::Unknown(key) => {
5437                            let value = map.next_value::<serde_json::Value>()?;
5438                            result._unknown_fields.insert(key, value);
5439                        }
5440                    }
5441                }
5442                std::result::Result::Ok(result)
5443            }
5444        }
5445        deserializer.deserialize_any(Visitor)
5446    }
5447}
5448
5449#[doc(hidden)]
5450impl serde::ser::Serialize for UpdateConnectClusterRequest {
5451    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5452    where
5453        S: serde::ser::Serializer,
5454    {
5455        use serde::ser::SerializeMap;
5456        #[allow(unused_imports)]
5457        use std::option::Option::Some;
5458        let mut state = serializer.serialize_map(std::option::Option::None)?;
5459        if self.update_mask.is_some() {
5460            state.serialize_entry("updateMask", &self.update_mask)?;
5461        }
5462        if self.connect_cluster.is_some() {
5463            state.serialize_entry("connectCluster", &self.connect_cluster)?;
5464        }
5465        if !self.request_id.is_empty() {
5466            state.serialize_entry("requestId", &self.request_id)?;
5467        }
5468        if !self._unknown_fields.is_empty() {
5469            for (key, value) in self._unknown_fields.iter() {
5470                state.serialize_entry(key, &value)?;
5471            }
5472        }
5473        state.end()
5474    }
5475}
5476
5477/// Request for DeleteConnectCluster.
5478#[derive(Clone, Debug, Default, PartialEq)]
5479#[non_exhaustive]
5480pub struct DeleteConnectClusterRequest {
5481    /// Required. The name of the Kafka Connect cluster to delete.
5482    /// Structured like
5483    /// `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`.
5484    pub name: std::string::String,
5485
5486    /// Optional. An optional request ID to identify requests. Specify a unique
5487    /// request ID to avoid duplication of requests. If a request times out or
5488    /// fails, retrying with the same ID allows the server to recognize the
5489    /// previous attempt. For at least 60 minutes, the server ignores duplicate
5490    /// requests bearing the same ID.
5491    ///
5492    /// For example, consider a situation where you make an initial request and the
5493    /// request times out. If you make the request again with the same request ID
5494    /// within 60 minutes of the last request, the server checks if an original
5495    /// operation with the same request ID was received. If so, the server ignores
5496    /// the second request.
5497    ///
5498    /// The request ID must be a valid UUID. A zero UUID is not supported
5499    /// (00000000-0000-0000-0000-000000000000).
5500    pub request_id: std::string::String,
5501
5502    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5503}
5504
5505impl DeleteConnectClusterRequest {
5506    pub fn new() -> Self {
5507        std::default::Default::default()
5508    }
5509
5510    /// Sets the value of [name][crate::model::DeleteConnectClusterRequest::name].
5511    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5512        self.name = v.into();
5513        self
5514    }
5515
5516    /// Sets the value of [request_id][crate::model::DeleteConnectClusterRequest::request_id].
5517    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5518        self.request_id = v.into();
5519        self
5520    }
5521}
5522
5523impl wkt::message::Message for DeleteConnectClusterRequest {
5524    fn typename() -> &'static str {
5525        "type.googleapis.com/google.cloud.managedkafka.v1.DeleteConnectClusterRequest"
5526    }
5527}
5528
5529#[doc(hidden)]
5530impl<'de> serde::de::Deserialize<'de> for DeleteConnectClusterRequest {
5531    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5532    where
5533        D: serde::Deserializer<'de>,
5534    {
5535        #[allow(non_camel_case_types)]
5536        #[doc(hidden)]
5537        #[derive(PartialEq, Eq, Hash)]
5538        enum __FieldTag {
5539            __name,
5540            __request_id,
5541            Unknown(std::string::String),
5542        }
5543        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5544            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5545            where
5546                D: serde::Deserializer<'de>,
5547            {
5548                struct Visitor;
5549                impl<'de> serde::de::Visitor<'de> for Visitor {
5550                    type Value = __FieldTag;
5551                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5552                        formatter.write_str("a field name for DeleteConnectClusterRequest")
5553                    }
5554                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5555                    where
5556                        E: serde::de::Error,
5557                    {
5558                        use std::result::Result::Ok;
5559                        use std::string::ToString;
5560                        match value {
5561                            "name" => Ok(__FieldTag::__name),
5562                            "requestId" => Ok(__FieldTag::__request_id),
5563                            "request_id" => Ok(__FieldTag::__request_id),
5564                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5565                        }
5566                    }
5567                }
5568                deserializer.deserialize_identifier(Visitor)
5569            }
5570        }
5571        struct Visitor;
5572        impl<'de> serde::de::Visitor<'de> for Visitor {
5573            type Value = DeleteConnectClusterRequest;
5574            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5575                formatter.write_str("struct DeleteConnectClusterRequest")
5576            }
5577            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5578            where
5579                A: serde::de::MapAccess<'de>,
5580            {
5581                #[allow(unused_imports)]
5582                use serde::de::Error;
5583                use std::option::Option::Some;
5584                let mut fields = std::collections::HashSet::new();
5585                let mut result = Self::Value::new();
5586                while let Some(tag) = map.next_key::<__FieldTag>()? {
5587                    #[allow(clippy::match_single_binding)]
5588                    match tag {
5589                        __FieldTag::__name => {
5590                            if !fields.insert(__FieldTag::__name) {
5591                                return std::result::Result::Err(A::Error::duplicate_field(
5592                                    "multiple values for name",
5593                                ));
5594                            }
5595                            result.name = map
5596                                .next_value::<std::option::Option<std::string::String>>()?
5597                                .unwrap_or_default();
5598                        }
5599                        __FieldTag::__request_id => {
5600                            if !fields.insert(__FieldTag::__request_id) {
5601                                return std::result::Result::Err(A::Error::duplicate_field(
5602                                    "multiple values for request_id",
5603                                ));
5604                            }
5605                            result.request_id = map
5606                                .next_value::<std::option::Option<std::string::String>>()?
5607                                .unwrap_or_default();
5608                        }
5609                        __FieldTag::Unknown(key) => {
5610                            let value = map.next_value::<serde_json::Value>()?;
5611                            result._unknown_fields.insert(key, value);
5612                        }
5613                    }
5614                }
5615                std::result::Result::Ok(result)
5616            }
5617        }
5618        deserializer.deserialize_any(Visitor)
5619    }
5620}
5621
5622#[doc(hidden)]
5623impl serde::ser::Serialize for DeleteConnectClusterRequest {
5624    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5625    where
5626        S: serde::ser::Serializer,
5627    {
5628        use serde::ser::SerializeMap;
5629        #[allow(unused_imports)]
5630        use std::option::Option::Some;
5631        let mut state = serializer.serialize_map(std::option::Option::None)?;
5632        if !self.name.is_empty() {
5633            state.serialize_entry("name", &self.name)?;
5634        }
5635        if !self.request_id.is_empty() {
5636            state.serialize_entry("requestId", &self.request_id)?;
5637        }
5638        if !self._unknown_fields.is_empty() {
5639            for (key, value) in self._unknown_fields.iter() {
5640                state.serialize_entry(key, &value)?;
5641            }
5642        }
5643        state.end()
5644    }
5645}
5646
5647/// Request for ListConnectClusters.
5648#[derive(Clone, Debug, Default, PartialEq)]
5649#[non_exhaustive]
5650pub struct ListConnectClustersRequest {
5651    /// Required. The parent project/location whose Connect clusters are to be
5652    /// listed. Structured like `projects/{project}/locations/{location}`.
5653    pub parent: std::string::String,
5654
5655    /// Optional. The maximum number of Connect clusters to return. The service may
5656    /// return fewer than this value. If unspecified, server will pick an
5657    /// appropriate default.
5658    pub page_size: i32,
5659
5660    /// Optional. A page token, received from a previous `ListConnectClusters`
5661    /// call. Provide this to retrieve the subsequent page.
5662    ///
5663    /// When paginating, all other parameters provided to `ListConnectClusters`
5664    /// must match the call that provided the page token.
5665    pub page_token: std::string::String,
5666
5667    /// Optional. Filter expression for the result.
5668    pub filter: std::string::String,
5669
5670    /// Optional. Order by fields for the result.
5671    pub order_by: std::string::String,
5672
5673    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5674}
5675
5676impl ListConnectClustersRequest {
5677    pub fn new() -> Self {
5678        std::default::Default::default()
5679    }
5680
5681    /// Sets the value of [parent][crate::model::ListConnectClustersRequest::parent].
5682    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5683        self.parent = v.into();
5684        self
5685    }
5686
5687    /// Sets the value of [page_size][crate::model::ListConnectClustersRequest::page_size].
5688    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5689        self.page_size = v.into();
5690        self
5691    }
5692
5693    /// Sets the value of [page_token][crate::model::ListConnectClustersRequest::page_token].
5694    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5695        self.page_token = v.into();
5696        self
5697    }
5698
5699    /// Sets the value of [filter][crate::model::ListConnectClustersRequest::filter].
5700    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5701        self.filter = v.into();
5702        self
5703    }
5704
5705    /// Sets the value of [order_by][crate::model::ListConnectClustersRequest::order_by].
5706    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5707        self.order_by = v.into();
5708        self
5709    }
5710}
5711
5712impl wkt::message::Message for ListConnectClustersRequest {
5713    fn typename() -> &'static str {
5714        "type.googleapis.com/google.cloud.managedkafka.v1.ListConnectClustersRequest"
5715    }
5716}
5717
5718#[doc(hidden)]
5719impl<'de> serde::de::Deserialize<'de> for ListConnectClustersRequest {
5720    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5721    where
5722        D: serde::Deserializer<'de>,
5723    {
5724        #[allow(non_camel_case_types)]
5725        #[doc(hidden)]
5726        #[derive(PartialEq, Eq, Hash)]
5727        enum __FieldTag {
5728            __parent,
5729            __page_size,
5730            __page_token,
5731            __filter,
5732            __order_by,
5733            Unknown(std::string::String),
5734        }
5735        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5736            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5737            where
5738                D: serde::Deserializer<'de>,
5739            {
5740                struct Visitor;
5741                impl<'de> serde::de::Visitor<'de> for Visitor {
5742                    type Value = __FieldTag;
5743                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5744                        formatter.write_str("a field name for ListConnectClustersRequest")
5745                    }
5746                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5747                    where
5748                        E: serde::de::Error,
5749                    {
5750                        use std::result::Result::Ok;
5751                        use std::string::ToString;
5752                        match value {
5753                            "parent" => Ok(__FieldTag::__parent),
5754                            "pageSize" => Ok(__FieldTag::__page_size),
5755                            "page_size" => Ok(__FieldTag::__page_size),
5756                            "pageToken" => Ok(__FieldTag::__page_token),
5757                            "page_token" => Ok(__FieldTag::__page_token),
5758                            "filter" => Ok(__FieldTag::__filter),
5759                            "orderBy" => Ok(__FieldTag::__order_by),
5760                            "order_by" => Ok(__FieldTag::__order_by),
5761                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5762                        }
5763                    }
5764                }
5765                deserializer.deserialize_identifier(Visitor)
5766            }
5767        }
5768        struct Visitor;
5769        impl<'de> serde::de::Visitor<'de> for Visitor {
5770            type Value = ListConnectClustersRequest;
5771            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5772                formatter.write_str("struct ListConnectClustersRequest")
5773            }
5774            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5775            where
5776                A: serde::de::MapAccess<'de>,
5777            {
5778                #[allow(unused_imports)]
5779                use serde::de::Error;
5780                use std::option::Option::Some;
5781                let mut fields = std::collections::HashSet::new();
5782                let mut result = Self::Value::new();
5783                while let Some(tag) = map.next_key::<__FieldTag>()? {
5784                    #[allow(clippy::match_single_binding)]
5785                    match tag {
5786                        __FieldTag::__parent => {
5787                            if !fields.insert(__FieldTag::__parent) {
5788                                return std::result::Result::Err(A::Error::duplicate_field(
5789                                    "multiple values for parent",
5790                                ));
5791                            }
5792                            result.parent = map
5793                                .next_value::<std::option::Option<std::string::String>>()?
5794                                .unwrap_or_default();
5795                        }
5796                        __FieldTag::__page_size => {
5797                            if !fields.insert(__FieldTag::__page_size) {
5798                                return std::result::Result::Err(A::Error::duplicate_field(
5799                                    "multiple values for page_size",
5800                                ));
5801                            }
5802                            struct __With(std::option::Option<i32>);
5803                            impl<'de> serde::de::Deserialize<'de> for __With {
5804                                fn deserialize<D>(
5805                                    deserializer: D,
5806                                ) -> std::result::Result<Self, D::Error>
5807                                where
5808                                    D: serde::de::Deserializer<'de>,
5809                                {
5810                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
5811                                }
5812                            }
5813                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
5814                        }
5815                        __FieldTag::__page_token => {
5816                            if !fields.insert(__FieldTag::__page_token) {
5817                                return std::result::Result::Err(A::Error::duplicate_field(
5818                                    "multiple values for page_token",
5819                                ));
5820                            }
5821                            result.page_token = map
5822                                .next_value::<std::option::Option<std::string::String>>()?
5823                                .unwrap_or_default();
5824                        }
5825                        __FieldTag::__filter => {
5826                            if !fields.insert(__FieldTag::__filter) {
5827                                return std::result::Result::Err(A::Error::duplicate_field(
5828                                    "multiple values for filter",
5829                                ));
5830                            }
5831                            result.filter = map
5832                                .next_value::<std::option::Option<std::string::String>>()?
5833                                .unwrap_or_default();
5834                        }
5835                        __FieldTag::__order_by => {
5836                            if !fields.insert(__FieldTag::__order_by) {
5837                                return std::result::Result::Err(A::Error::duplicate_field(
5838                                    "multiple values for order_by",
5839                                ));
5840                            }
5841                            result.order_by = map
5842                                .next_value::<std::option::Option<std::string::String>>()?
5843                                .unwrap_or_default();
5844                        }
5845                        __FieldTag::Unknown(key) => {
5846                            let value = map.next_value::<serde_json::Value>()?;
5847                            result._unknown_fields.insert(key, value);
5848                        }
5849                    }
5850                }
5851                std::result::Result::Ok(result)
5852            }
5853        }
5854        deserializer.deserialize_any(Visitor)
5855    }
5856}
5857
5858#[doc(hidden)]
5859impl serde::ser::Serialize for ListConnectClustersRequest {
5860    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5861    where
5862        S: serde::ser::Serializer,
5863    {
5864        use serde::ser::SerializeMap;
5865        #[allow(unused_imports)]
5866        use std::option::Option::Some;
5867        let mut state = serializer.serialize_map(std::option::Option::None)?;
5868        if !self.parent.is_empty() {
5869            state.serialize_entry("parent", &self.parent)?;
5870        }
5871        if !wkt::internal::is_default(&self.page_size) {
5872            struct __With<'a>(&'a i32);
5873            impl<'a> serde::ser::Serialize for __With<'a> {
5874                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5875                where
5876                    S: serde::ser::Serializer,
5877                {
5878                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
5879                }
5880            }
5881            state.serialize_entry("pageSize", &__With(&self.page_size))?;
5882        }
5883        if !self.page_token.is_empty() {
5884            state.serialize_entry("pageToken", &self.page_token)?;
5885        }
5886        if !self.filter.is_empty() {
5887            state.serialize_entry("filter", &self.filter)?;
5888        }
5889        if !self.order_by.is_empty() {
5890            state.serialize_entry("orderBy", &self.order_by)?;
5891        }
5892        if !self._unknown_fields.is_empty() {
5893            for (key, value) in self._unknown_fields.iter() {
5894                state.serialize_entry(key, &value)?;
5895            }
5896        }
5897        state.end()
5898    }
5899}
5900
5901/// Response for ListConnectClusters.
5902#[derive(Clone, Debug, Default, PartialEq)]
5903#[non_exhaustive]
5904pub struct ListConnectClustersResponse {
5905    /// The list of Connect clusters in the requested parent.
5906    pub connect_clusters: std::vec::Vec<crate::model::ConnectCluster>,
5907
5908    /// A token that can be sent as `page_token` to retrieve the next page of
5909    /// results. If this field is omitted, there are no more results.
5910    pub next_page_token: std::string::String,
5911
5912    /// Locations that could not be reached.
5913    pub unreachable: std::vec::Vec<std::string::String>,
5914
5915    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5916}
5917
5918impl ListConnectClustersResponse {
5919    pub fn new() -> Self {
5920        std::default::Default::default()
5921    }
5922
5923    /// Sets the value of [connect_clusters][crate::model::ListConnectClustersResponse::connect_clusters].
5924    pub fn set_connect_clusters<T, V>(mut self, v: T) -> Self
5925    where
5926        T: std::iter::IntoIterator<Item = V>,
5927        V: std::convert::Into<crate::model::ConnectCluster>,
5928    {
5929        use std::iter::Iterator;
5930        self.connect_clusters = v.into_iter().map(|i| i.into()).collect();
5931        self
5932    }
5933
5934    /// Sets the value of [next_page_token][crate::model::ListConnectClustersResponse::next_page_token].
5935    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5936        self.next_page_token = v.into();
5937        self
5938    }
5939
5940    /// Sets the value of [unreachable][crate::model::ListConnectClustersResponse::unreachable].
5941    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
5942    where
5943        T: std::iter::IntoIterator<Item = V>,
5944        V: std::convert::Into<std::string::String>,
5945    {
5946        use std::iter::Iterator;
5947        self.unreachable = v.into_iter().map(|i| i.into()).collect();
5948        self
5949    }
5950}
5951
5952impl wkt::message::Message for ListConnectClustersResponse {
5953    fn typename() -> &'static str {
5954        "type.googleapis.com/google.cloud.managedkafka.v1.ListConnectClustersResponse"
5955    }
5956}
5957
5958#[doc(hidden)]
5959impl gax::paginator::internal::PageableResponse for ListConnectClustersResponse {
5960    type PageItem = crate::model::ConnectCluster;
5961
5962    fn items(self) -> std::vec::Vec<Self::PageItem> {
5963        self.connect_clusters
5964    }
5965
5966    fn next_page_token(&self) -> std::string::String {
5967        use std::clone::Clone;
5968        self.next_page_token.clone()
5969    }
5970}
5971
5972#[doc(hidden)]
5973impl<'de> serde::de::Deserialize<'de> for ListConnectClustersResponse {
5974    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5975    where
5976        D: serde::Deserializer<'de>,
5977    {
5978        #[allow(non_camel_case_types)]
5979        #[doc(hidden)]
5980        #[derive(PartialEq, Eq, Hash)]
5981        enum __FieldTag {
5982            __connect_clusters,
5983            __next_page_token,
5984            __unreachable,
5985            Unknown(std::string::String),
5986        }
5987        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5988            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5989            where
5990                D: serde::Deserializer<'de>,
5991            {
5992                struct Visitor;
5993                impl<'de> serde::de::Visitor<'de> for Visitor {
5994                    type Value = __FieldTag;
5995                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5996                        formatter.write_str("a field name for ListConnectClustersResponse")
5997                    }
5998                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5999                    where
6000                        E: serde::de::Error,
6001                    {
6002                        use std::result::Result::Ok;
6003                        use std::string::ToString;
6004                        match value {
6005                            "connectClusters" => Ok(__FieldTag::__connect_clusters),
6006                            "connect_clusters" => Ok(__FieldTag::__connect_clusters),
6007                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
6008                            "next_page_token" => Ok(__FieldTag::__next_page_token),
6009                            "unreachable" => Ok(__FieldTag::__unreachable),
6010                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6011                        }
6012                    }
6013                }
6014                deserializer.deserialize_identifier(Visitor)
6015            }
6016        }
6017        struct Visitor;
6018        impl<'de> serde::de::Visitor<'de> for Visitor {
6019            type Value = ListConnectClustersResponse;
6020            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6021                formatter.write_str("struct ListConnectClustersResponse")
6022            }
6023            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6024            where
6025                A: serde::de::MapAccess<'de>,
6026            {
6027                #[allow(unused_imports)]
6028                use serde::de::Error;
6029                use std::option::Option::Some;
6030                let mut fields = std::collections::HashSet::new();
6031                let mut result = Self::Value::new();
6032                while let Some(tag) = map.next_key::<__FieldTag>()? {
6033                    #[allow(clippy::match_single_binding)]
6034                    match tag {
6035                        __FieldTag::__connect_clusters => {
6036                            if !fields.insert(__FieldTag::__connect_clusters) {
6037                                return std::result::Result::Err(A::Error::duplicate_field(
6038                                    "multiple values for connect_clusters",
6039                                ));
6040                            }
6041                            result.connect_clusters =
6042                                map.next_value::<std::option::Option<
6043                                    std::vec::Vec<crate::model::ConnectCluster>,
6044                                >>()?
6045                                .unwrap_or_default();
6046                        }
6047                        __FieldTag::__next_page_token => {
6048                            if !fields.insert(__FieldTag::__next_page_token) {
6049                                return std::result::Result::Err(A::Error::duplicate_field(
6050                                    "multiple values for next_page_token",
6051                                ));
6052                            }
6053                            result.next_page_token = map
6054                                .next_value::<std::option::Option<std::string::String>>()?
6055                                .unwrap_or_default();
6056                        }
6057                        __FieldTag::__unreachable => {
6058                            if !fields.insert(__FieldTag::__unreachable) {
6059                                return std::result::Result::Err(A::Error::duplicate_field(
6060                                    "multiple values for unreachable",
6061                                ));
6062                            }
6063                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
6064                        }
6065                        __FieldTag::Unknown(key) => {
6066                            let value = map.next_value::<serde_json::Value>()?;
6067                            result._unknown_fields.insert(key, value);
6068                        }
6069                    }
6070                }
6071                std::result::Result::Ok(result)
6072            }
6073        }
6074        deserializer.deserialize_any(Visitor)
6075    }
6076}
6077
6078#[doc(hidden)]
6079impl serde::ser::Serialize for ListConnectClustersResponse {
6080    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6081    where
6082        S: serde::ser::Serializer,
6083    {
6084        use serde::ser::SerializeMap;
6085        #[allow(unused_imports)]
6086        use std::option::Option::Some;
6087        let mut state = serializer.serialize_map(std::option::Option::None)?;
6088        if !self.connect_clusters.is_empty() {
6089            state.serialize_entry("connectClusters", &self.connect_clusters)?;
6090        }
6091        if !self.next_page_token.is_empty() {
6092            state.serialize_entry("nextPageToken", &self.next_page_token)?;
6093        }
6094        if !self.unreachable.is_empty() {
6095            state.serialize_entry("unreachable", &self.unreachable)?;
6096        }
6097        if !self._unknown_fields.is_empty() {
6098            for (key, value) in self._unknown_fields.iter() {
6099                state.serialize_entry(key, &value)?;
6100            }
6101        }
6102        state.end()
6103    }
6104}
6105
6106/// Request for GetConnector.
6107#[derive(Clone, Debug, Default, PartialEq)]
6108#[non_exhaustive]
6109pub struct GetConnectorRequest {
6110    /// Required. The name of the connector whose configuration to return.
6111    /// Structured like:
6112    /// projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector}
6113    pub name: std::string::String,
6114
6115    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6116}
6117
6118impl GetConnectorRequest {
6119    pub fn new() -> Self {
6120        std::default::Default::default()
6121    }
6122
6123    /// Sets the value of [name][crate::model::GetConnectorRequest::name].
6124    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6125        self.name = v.into();
6126        self
6127    }
6128}
6129
6130impl wkt::message::Message for GetConnectorRequest {
6131    fn typename() -> &'static str {
6132        "type.googleapis.com/google.cloud.managedkafka.v1.GetConnectorRequest"
6133    }
6134}
6135
6136#[doc(hidden)]
6137impl<'de> serde::de::Deserialize<'de> for GetConnectorRequest {
6138    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6139    where
6140        D: serde::Deserializer<'de>,
6141    {
6142        #[allow(non_camel_case_types)]
6143        #[doc(hidden)]
6144        #[derive(PartialEq, Eq, Hash)]
6145        enum __FieldTag {
6146            __name,
6147            Unknown(std::string::String),
6148        }
6149        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6150            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6151            where
6152                D: serde::Deserializer<'de>,
6153            {
6154                struct Visitor;
6155                impl<'de> serde::de::Visitor<'de> for Visitor {
6156                    type Value = __FieldTag;
6157                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6158                        formatter.write_str("a field name for GetConnectorRequest")
6159                    }
6160                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6161                    where
6162                        E: serde::de::Error,
6163                    {
6164                        use std::result::Result::Ok;
6165                        use std::string::ToString;
6166                        match value {
6167                            "name" => Ok(__FieldTag::__name),
6168                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6169                        }
6170                    }
6171                }
6172                deserializer.deserialize_identifier(Visitor)
6173            }
6174        }
6175        struct Visitor;
6176        impl<'de> serde::de::Visitor<'de> for Visitor {
6177            type Value = GetConnectorRequest;
6178            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6179                formatter.write_str("struct GetConnectorRequest")
6180            }
6181            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6182            where
6183                A: serde::de::MapAccess<'de>,
6184            {
6185                #[allow(unused_imports)]
6186                use serde::de::Error;
6187                use std::option::Option::Some;
6188                let mut fields = std::collections::HashSet::new();
6189                let mut result = Self::Value::new();
6190                while let Some(tag) = map.next_key::<__FieldTag>()? {
6191                    #[allow(clippy::match_single_binding)]
6192                    match tag {
6193                        __FieldTag::__name => {
6194                            if !fields.insert(__FieldTag::__name) {
6195                                return std::result::Result::Err(A::Error::duplicate_field(
6196                                    "multiple values for name",
6197                                ));
6198                            }
6199                            result.name = map
6200                                .next_value::<std::option::Option<std::string::String>>()?
6201                                .unwrap_or_default();
6202                        }
6203                        __FieldTag::Unknown(key) => {
6204                            let value = map.next_value::<serde_json::Value>()?;
6205                            result._unknown_fields.insert(key, value);
6206                        }
6207                    }
6208                }
6209                std::result::Result::Ok(result)
6210            }
6211        }
6212        deserializer.deserialize_any(Visitor)
6213    }
6214}
6215
6216#[doc(hidden)]
6217impl serde::ser::Serialize for GetConnectorRequest {
6218    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6219    where
6220        S: serde::ser::Serializer,
6221    {
6222        use serde::ser::SerializeMap;
6223        #[allow(unused_imports)]
6224        use std::option::Option::Some;
6225        let mut state = serializer.serialize_map(std::option::Option::None)?;
6226        if !self.name.is_empty() {
6227            state.serialize_entry("name", &self.name)?;
6228        }
6229        if !self._unknown_fields.is_empty() {
6230            for (key, value) in self._unknown_fields.iter() {
6231                state.serialize_entry(key, &value)?;
6232            }
6233        }
6234        state.end()
6235    }
6236}
6237
6238/// Request for CreateConnector.
6239#[derive(Clone, Debug, Default, PartialEq)]
6240#[non_exhaustive]
6241pub struct CreateConnectorRequest {
6242    /// Required. The parent Connect cluster in which to create the connector.
6243    /// Structured like
6244    /// `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`.
6245    pub parent: std::string::String,
6246
6247    /// Required. The ID to use for the connector, which will become the final
6248    /// component of the connector's name. The ID must be 1-63 characters long, and
6249    /// match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` to comply with
6250    /// RFC 1035.
6251    ///
6252    /// This value is structured like: `my-connector-id`.
6253    pub connector_id: std::string::String,
6254
6255    /// Required. The connector to create.
6256    pub connector: std::option::Option<crate::model::Connector>,
6257
6258    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6259}
6260
6261impl CreateConnectorRequest {
6262    pub fn new() -> Self {
6263        std::default::Default::default()
6264    }
6265
6266    /// Sets the value of [parent][crate::model::CreateConnectorRequest::parent].
6267    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6268        self.parent = v.into();
6269        self
6270    }
6271
6272    /// Sets the value of [connector_id][crate::model::CreateConnectorRequest::connector_id].
6273    pub fn set_connector_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6274        self.connector_id = v.into();
6275        self
6276    }
6277
6278    /// Sets the value of [connector][crate::model::CreateConnectorRequest::connector].
6279    pub fn set_connector<T>(mut self, v: T) -> Self
6280    where
6281        T: std::convert::Into<crate::model::Connector>,
6282    {
6283        self.connector = std::option::Option::Some(v.into());
6284        self
6285    }
6286
6287    /// Sets or clears the value of [connector][crate::model::CreateConnectorRequest::connector].
6288    pub fn set_or_clear_connector<T>(mut self, v: std::option::Option<T>) -> Self
6289    where
6290        T: std::convert::Into<crate::model::Connector>,
6291    {
6292        self.connector = v.map(|x| x.into());
6293        self
6294    }
6295}
6296
6297impl wkt::message::Message for CreateConnectorRequest {
6298    fn typename() -> &'static str {
6299        "type.googleapis.com/google.cloud.managedkafka.v1.CreateConnectorRequest"
6300    }
6301}
6302
6303#[doc(hidden)]
6304impl<'de> serde::de::Deserialize<'de> for CreateConnectorRequest {
6305    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6306    where
6307        D: serde::Deserializer<'de>,
6308    {
6309        #[allow(non_camel_case_types)]
6310        #[doc(hidden)]
6311        #[derive(PartialEq, Eq, Hash)]
6312        enum __FieldTag {
6313            __parent,
6314            __connector_id,
6315            __connector,
6316            Unknown(std::string::String),
6317        }
6318        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6319            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6320            where
6321                D: serde::Deserializer<'de>,
6322            {
6323                struct Visitor;
6324                impl<'de> serde::de::Visitor<'de> for Visitor {
6325                    type Value = __FieldTag;
6326                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6327                        formatter.write_str("a field name for CreateConnectorRequest")
6328                    }
6329                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6330                    where
6331                        E: serde::de::Error,
6332                    {
6333                        use std::result::Result::Ok;
6334                        use std::string::ToString;
6335                        match value {
6336                            "parent" => Ok(__FieldTag::__parent),
6337                            "connectorId" => Ok(__FieldTag::__connector_id),
6338                            "connector_id" => Ok(__FieldTag::__connector_id),
6339                            "connector" => Ok(__FieldTag::__connector),
6340                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6341                        }
6342                    }
6343                }
6344                deserializer.deserialize_identifier(Visitor)
6345            }
6346        }
6347        struct Visitor;
6348        impl<'de> serde::de::Visitor<'de> for Visitor {
6349            type Value = CreateConnectorRequest;
6350            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6351                formatter.write_str("struct CreateConnectorRequest")
6352            }
6353            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6354            where
6355                A: serde::de::MapAccess<'de>,
6356            {
6357                #[allow(unused_imports)]
6358                use serde::de::Error;
6359                use std::option::Option::Some;
6360                let mut fields = std::collections::HashSet::new();
6361                let mut result = Self::Value::new();
6362                while let Some(tag) = map.next_key::<__FieldTag>()? {
6363                    #[allow(clippy::match_single_binding)]
6364                    match tag {
6365                        __FieldTag::__parent => {
6366                            if !fields.insert(__FieldTag::__parent) {
6367                                return std::result::Result::Err(A::Error::duplicate_field(
6368                                    "multiple values for parent",
6369                                ));
6370                            }
6371                            result.parent = map
6372                                .next_value::<std::option::Option<std::string::String>>()?
6373                                .unwrap_or_default();
6374                        }
6375                        __FieldTag::__connector_id => {
6376                            if !fields.insert(__FieldTag::__connector_id) {
6377                                return std::result::Result::Err(A::Error::duplicate_field(
6378                                    "multiple values for connector_id",
6379                                ));
6380                            }
6381                            result.connector_id = map
6382                                .next_value::<std::option::Option<std::string::String>>()?
6383                                .unwrap_or_default();
6384                        }
6385                        __FieldTag::__connector => {
6386                            if !fields.insert(__FieldTag::__connector) {
6387                                return std::result::Result::Err(A::Error::duplicate_field(
6388                                    "multiple values for connector",
6389                                ));
6390                            }
6391                            result.connector =
6392                                map.next_value::<std::option::Option<crate::model::Connector>>()?;
6393                        }
6394                        __FieldTag::Unknown(key) => {
6395                            let value = map.next_value::<serde_json::Value>()?;
6396                            result._unknown_fields.insert(key, value);
6397                        }
6398                    }
6399                }
6400                std::result::Result::Ok(result)
6401            }
6402        }
6403        deserializer.deserialize_any(Visitor)
6404    }
6405}
6406
6407#[doc(hidden)]
6408impl serde::ser::Serialize for CreateConnectorRequest {
6409    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6410    where
6411        S: serde::ser::Serializer,
6412    {
6413        use serde::ser::SerializeMap;
6414        #[allow(unused_imports)]
6415        use std::option::Option::Some;
6416        let mut state = serializer.serialize_map(std::option::Option::None)?;
6417        if !self.parent.is_empty() {
6418            state.serialize_entry("parent", &self.parent)?;
6419        }
6420        if !self.connector_id.is_empty() {
6421            state.serialize_entry("connectorId", &self.connector_id)?;
6422        }
6423        if self.connector.is_some() {
6424            state.serialize_entry("connector", &self.connector)?;
6425        }
6426        if !self._unknown_fields.is_empty() {
6427            for (key, value) in self._unknown_fields.iter() {
6428                state.serialize_entry(key, &value)?;
6429            }
6430        }
6431        state.end()
6432    }
6433}
6434
6435/// Request for UpdateConnector.
6436#[derive(Clone, Debug, Default, PartialEq)]
6437#[non_exhaustive]
6438pub struct UpdateConnectorRequest {
6439    /// Required. Field mask is used to specify the fields to be overwritten in the
6440    /// cluster resource by the update. The fields specified in the update_mask are
6441    /// relative to the resource, not the full request. A field will be overwritten
6442    /// if it is in the mask. The mask is required and a value of * will update all
6443    /// fields.
6444    pub update_mask: std::option::Option<wkt::FieldMask>,
6445
6446    /// Required. The connector to update. Its `name` field must be populated.
6447    pub connector: std::option::Option<crate::model::Connector>,
6448
6449    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6450}
6451
6452impl UpdateConnectorRequest {
6453    pub fn new() -> Self {
6454        std::default::Default::default()
6455    }
6456
6457    /// Sets the value of [update_mask][crate::model::UpdateConnectorRequest::update_mask].
6458    pub fn set_update_mask<T>(mut self, v: T) -> Self
6459    where
6460        T: std::convert::Into<wkt::FieldMask>,
6461    {
6462        self.update_mask = std::option::Option::Some(v.into());
6463        self
6464    }
6465
6466    /// Sets or clears the value of [update_mask][crate::model::UpdateConnectorRequest::update_mask].
6467    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6468    where
6469        T: std::convert::Into<wkt::FieldMask>,
6470    {
6471        self.update_mask = v.map(|x| x.into());
6472        self
6473    }
6474
6475    /// Sets the value of [connector][crate::model::UpdateConnectorRequest::connector].
6476    pub fn set_connector<T>(mut self, v: T) -> Self
6477    where
6478        T: std::convert::Into<crate::model::Connector>,
6479    {
6480        self.connector = std::option::Option::Some(v.into());
6481        self
6482    }
6483
6484    /// Sets or clears the value of [connector][crate::model::UpdateConnectorRequest::connector].
6485    pub fn set_or_clear_connector<T>(mut self, v: std::option::Option<T>) -> Self
6486    where
6487        T: std::convert::Into<crate::model::Connector>,
6488    {
6489        self.connector = v.map(|x| x.into());
6490        self
6491    }
6492}
6493
6494impl wkt::message::Message for UpdateConnectorRequest {
6495    fn typename() -> &'static str {
6496        "type.googleapis.com/google.cloud.managedkafka.v1.UpdateConnectorRequest"
6497    }
6498}
6499
6500#[doc(hidden)]
6501impl<'de> serde::de::Deserialize<'de> for UpdateConnectorRequest {
6502    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6503    where
6504        D: serde::Deserializer<'de>,
6505    {
6506        #[allow(non_camel_case_types)]
6507        #[doc(hidden)]
6508        #[derive(PartialEq, Eq, Hash)]
6509        enum __FieldTag {
6510            __update_mask,
6511            __connector,
6512            Unknown(std::string::String),
6513        }
6514        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6515            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6516            where
6517                D: serde::Deserializer<'de>,
6518            {
6519                struct Visitor;
6520                impl<'de> serde::de::Visitor<'de> for Visitor {
6521                    type Value = __FieldTag;
6522                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6523                        formatter.write_str("a field name for UpdateConnectorRequest")
6524                    }
6525                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6526                    where
6527                        E: serde::de::Error,
6528                    {
6529                        use std::result::Result::Ok;
6530                        use std::string::ToString;
6531                        match value {
6532                            "updateMask" => Ok(__FieldTag::__update_mask),
6533                            "update_mask" => Ok(__FieldTag::__update_mask),
6534                            "connector" => Ok(__FieldTag::__connector),
6535                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6536                        }
6537                    }
6538                }
6539                deserializer.deserialize_identifier(Visitor)
6540            }
6541        }
6542        struct Visitor;
6543        impl<'de> serde::de::Visitor<'de> for Visitor {
6544            type Value = UpdateConnectorRequest;
6545            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6546                formatter.write_str("struct UpdateConnectorRequest")
6547            }
6548            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6549            where
6550                A: serde::de::MapAccess<'de>,
6551            {
6552                #[allow(unused_imports)]
6553                use serde::de::Error;
6554                use std::option::Option::Some;
6555                let mut fields = std::collections::HashSet::new();
6556                let mut result = Self::Value::new();
6557                while let Some(tag) = map.next_key::<__FieldTag>()? {
6558                    #[allow(clippy::match_single_binding)]
6559                    match tag {
6560                        __FieldTag::__update_mask => {
6561                            if !fields.insert(__FieldTag::__update_mask) {
6562                                return std::result::Result::Err(A::Error::duplicate_field(
6563                                    "multiple values for update_mask",
6564                                ));
6565                            }
6566                            result.update_mask =
6567                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
6568                        }
6569                        __FieldTag::__connector => {
6570                            if !fields.insert(__FieldTag::__connector) {
6571                                return std::result::Result::Err(A::Error::duplicate_field(
6572                                    "multiple values for connector",
6573                                ));
6574                            }
6575                            result.connector =
6576                                map.next_value::<std::option::Option<crate::model::Connector>>()?;
6577                        }
6578                        __FieldTag::Unknown(key) => {
6579                            let value = map.next_value::<serde_json::Value>()?;
6580                            result._unknown_fields.insert(key, value);
6581                        }
6582                    }
6583                }
6584                std::result::Result::Ok(result)
6585            }
6586        }
6587        deserializer.deserialize_any(Visitor)
6588    }
6589}
6590
6591#[doc(hidden)]
6592impl serde::ser::Serialize for UpdateConnectorRequest {
6593    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6594    where
6595        S: serde::ser::Serializer,
6596    {
6597        use serde::ser::SerializeMap;
6598        #[allow(unused_imports)]
6599        use std::option::Option::Some;
6600        let mut state = serializer.serialize_map(std::option::Option::None)?;
6601        if self.update_mask.is_some() {
6602            state.serialize_entry("updateMask", &self.update_mask)?;
6603        }
6604        if self.connector.is_some() {
6605            state.serialize_entry("connector", &self.connector)?;
6606        }
6607        if !self._unknown_fields.is_empty() {
6608            for (key, value) in self._unknown_fields.iter() {
6609                state.serialize_entry(key, &value)?;
6610            }
6611        }
6612        state.end()
6613    }
6614}
6615
6616/// Request for DeleteConnector.
6617#[derive(Clone, Debug, Default, PartialEq)]
6618#[non_exhaustive]
6619pub struct DeleteConnectorRequest {
6620    /// Required. The name of the connector to delete.
6621    /// Structured like:
6622    /// projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector}
6623    pub name: std::string::String,
6624
6625    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6626}
6627
6628impl DeleteConnectorRequest {
6629    pub fn new() -> Self {
6630        std::default::Default::default()
6631    }
6632
6633    /// Sets the value of [name][crate::model::DeleteConnectorRequest::name].
6634    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6635        self.name = v.into();
6636        self
6637    }
6638}
6639
6640impl wkt::message::Message for DeleteConnectorRequest {
6641    fn typename() -> &'static str {
6642        "type.googleapis.com/google.cloud.managedkafka.v1.DeleteConnectorRequest"
6643    }
6644}
6645
6646#[doc(hidden)]
6647impl<'de> serde::de::Deserialize<'de> for DeleteConnectorRequest {
6648    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6649    where
6650        D: serde::Deserializer<'de>,
6651    {
6652        #[allow(non_camel_case_types)]
6653        #[doc(hidden)]
6654        #[derive(PartialEq, Eq, Hash)]
6655        enum __FieldTag {
6656            __name,
6657            Unknown(std::string::String),
6658        }
6659        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6660            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6661            where
6662                D: serde::Deserializer<'de>,
6663            {
6664                struct Visitor;
6665                impl<'de> serde::de::Visitor<'de> for Visitor {
6666                    type Value = __FieldTag;
6667                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6668                        formatter.write_str("a field name for DeleteConnectorRequest")
6669                    }
6670                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6671                    where
6672                        E: serde::de::Error,
6673                    {
6674                        use std::result::Result::Ok;
6675                        use std::string::ToString;
6676                        match value {
6677                            "name" => Ok(__FieldTag::__name),
6678                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6679                        }
6680                    }
6681                }
6682                deserializer.deserialize_identifier(Visitor)
6683            }
6684        }
6685        struct Visitor;
6686        impl<'de> serde::de::Visitor<'de> for Visitor {
6687            type Value = DeleteConnectorRequest;
6688            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6689                formatter.write_str("struct DeleteConnectorRequest")
6690            }
6691            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6692            where
6693                A: serde::de::MapAccess<'de>,
6694            {
6695                #[allow(unused_imports)]
6696                use serde::de::Error;
6697                use std::option::Option::Some;
6698                let mut fields = std::collections::HashSet::new();
6699                let mut result = Self::Value::new();
6700                while let Some(tag) = map.next_key::<__FieldTag>()? {
6701                    #[allow(clippy::match_single_binding)]
6702                    match tag {
6703                        __FieldTag::__name => {
6704                            if !fields.insert(__FieldTag::__name) {
6705                                return std::result::Result::Err(A::Error::duplicate_field(
6706                                    "multiple values for name",
6707                                ));
6708                            }
6709                            result.name = map
6710                                .next_value::<std::option::Option<std::string::String>>()?
6711                                .unwrap_or_default();
6712                        }
6713                        __FieldTag::Unknown(key) => {
6714                            let value = map.next_value::<serde_json::Value>()?;
6715                            result._unknown_fields.insert(key, value);
6716                        }
6717                    }
6718                }
6719                std::result::Result::Ok(result)
6720            }
6721        }
6722        deserializer.deserialize_any(Visitor)
6723    }
6724}
6725
6726#[doc(hidden)]
6727impl serde::ser::Serialize for DeleteConnectorRequest {
6728    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6729    where
6730        S: serde::ser::Serializer,
6731    {
6732        use serde::ser::SerializeMap;
6733        #[allow(unused_imports)]
6734        use std::option::Option::Some;
6735        let mut state = serializer.serialize_map(std::option::Option::None)?;
6736        if !self.name.is_empty() {
6737            state.serialize_entry("name", &self.name)?;
6738        }
6739        if !self._unknown_fields.is_empty() {
6740            for (key, value) in self._unknown_fields.iter() {
6741                state.serialize_entry(key, &value)?;
6742            }
6743        }
6744        state.end()
6745    }
6746}
6747
6748/// Request for ListConnectors.
6749#[derive(Clone, Debug, Default, PartialEq)]
6750#[non_exhaustive]
6751pub struct ListConnectorsRequest {
6752    /// Required. The parent Connect cluster whose connectors are to be listed.
6753    /// Structured like
6754    /// `projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}`.
6755    pub parent: std::string::String,
6756
6757    /// Optional. The maximum number of connectors to return. The service may
6758    /// return fewer than this value. If unspecified, server will pick an
6759    /// appropriate default.
6760    pub page_size: i32,
6761
6762    /// Optional. A page token, received from a previous `ListConnectors` call.
6763    /// Provide this to retrieve the subsequent page.
6764    ///
6765    /// When paginating, all other parameters provided to `ListConnectors`
6766    /// must match the call that provided the page token.
6767    pub page_token: std::string::String,
6768
6769    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6770}
6771
6772impl ListConnectorsRequest {
6773    pub fn new() -> Self {
6774        std::default::Default::default()
6775    }
6776
6777    /// Sets the value of [parent][crate::model::ListConnectorsRequest::parent].
6778    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6779        self.parent = v.into();
6780        self
6781    }
6782
6783    /// Sets the value of [page_size][crate::model::ListConnectorsRequest::page_size].
6784    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6785        self.page_size = v.into();
6786        self
6787    }
6788
6789    /// Sets the value of [page_token][crate::model::ListConnectorsRequest::page_token].
6790    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6791        self.page_token = v.into();
6792        self
6793    }
6794}
6795
6796impl wkt::message::Message for ListConnectorsRequest {
6797    fn typename() -> &'static str {
6798        "type.googleapis.com/google.cloud.managedkafka.v1.ListConnectorsRequest"
6799    }
6800}
6801
6802#[doc(hidden)]
6803impl<'de> serde::de::Deserialize<'de> for ListConnectorsRequest {
6804    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6805    where
6806        D: serde::Deserializer<'de>,
6807    {
6808        #[allow(non_camel_case_types)]
6809        #[doc(hidden)]
6810        #[derive(PartialEq, Eq, Hash)]
6811        enum __FieldTag {
6812            __parent,
6813            __page_size,
6814            __page_token,
6815            Unknown(std::string::String),
6816        }
6817        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6818            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6819            where
6820                D: serde::Deserializer<'de>,
6821            {
6822                struct Visitor;
6823                impl<'de> serde::de::Visitor<'de> for Visitor {
6824                    type Value = __FieldTag;
6825                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6826                        formatter.write_str("a field name for ListConnectorsRequest")
6827                    }
6828                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6829                    where
6830                        E: serde::de::Error,
6831                    {
6832                        use std::result::Result::Ok;
6833                        use std::string::ToString;
6834                        match value {
6835                            "parent" => Ok(__FieldTag::__parent),
6836                            "pageSize" => Ok(__FieldTag::__page_size),
6837                            "page_size" => Ok(__FieldTag::__page_size),
6838                            "pageToken" => Ok(__FieldTag::__page_token),
6839                            "page_token" => Ok(__FieldTag::__page_token),
6840                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6841                        }
6842                    }
6843                }
6844                deserializer.deserialize_identifier(Visitor)
6845            }
6846        }
6847        struct Visitor;
6848        impl<'de> serde::de::Visitor<'de> for Visitor {
6849            type Value = ListConnectorsRequest;
6850            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6851                formatter.write_str("struct ListConnectorsRequest")
6852            }
6853            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6854            where
6855                A: serde::de::MapAccess<'de>,
6856            {
6857                #[allow(unused_imports)]
6858                use serde::de::Error;
6859                use std::option::Option::Some;
6860                let mut fields = std::collections::HashSet::new();
6861                let mut result = Self::Value::new();
6862                while let Some(tag) = map.next_key::<__FieldTag>()? {
6863                    #[allow(clippy::match_single_binding)]
6864                    match tag {
6865                        __FieldTag::__parent => {
6866                            if !fields.insert(__FieldTag::__parent) {
6867                                return std::result::Result::Err(A::Error::duplicate_field(
6868                                    "multiple values for parent",
6869                                ));
6870                            }
6871                            result.parent = map
6872                                .next_value::<std::option::Option<std::string::String>>()?
6873                                .unwrap_or_default();
6874                        }
6875                        __FieldTag::__page_size => {
6876                            if !fields.insert(__FieldTag::__page_size) {
6877                                return std::result::Result::Err(A::Error::duplicate_field(
6878                                    "multiple values for page_size",
6879                                ));
6880                            }
6881                            struct __With(std::option::Option<i32>);
6882                            impl<'de> serde::de::Deserialize<'de> for __With {
6883                                fn deserialize<D>(
6884                                    deserializer: D,
6885                                ) -> std::result::Result<Self, D::Error>
6886                                where
6887                                    D: serde::de::Deserializer<'de>,
6888                                {
6889                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
6890                                }
6891                            }
6892                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
6893                        }
6894                        __FieldTag::__page_token => {
6895                            if !fields.insert(__FieldTag::__page_token) {
6896                                return std::result::Result::Err(A::Error::duplicate_field(
6897                                    "multiple values for page_token",
6898                                ));
6899                            }
6900                            result.page_token = map
6901                                .next_value::<std::option::Option<std::string::String>>()?
6902                                .unwrap_or_default();
6903                        }
6904                        __FieldTag::Unknown(key) => {
6905                            let value = map.next_value::<serde_json::Value>()?;
6906                            result._unknown_fields.insert(key, value);
6907                        }
6908                    }
6909                }
6910                std::result::Result::Ok(result)
6911            }
6912        }
6913        deserializer.deserialize_any(Visitor)
6914    }
6915}
6916
6917#[doc(hidden)]
6918impl serde::ser::Serialize for ListConnectorsRequest {
6919    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6920    where
6921        S: serde::ser::Serializer,
6922    {
6923        use serde::ser::SerializeMap;
6924        #[allow(unused_imports)]
6925        use std::option::Option::Some;
6926        let mut state = serializer.serialize_map(std::option::Option::None)?;
6927        if !self.parent.is_empty() {
6928            state.serialize_entry("parent", &self.parent)?;
6929        }
6930        if !wkt::internal::is_default(&self.page_size) {
6931            struct __With<'a>(&'a i32);
6932            impl<'a> serde::ser::Serialize for __With<'a> {
6933                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6934                where
6935                    S: serde::ser::Serializer,
6936                {
6937                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
6938                }
6939            }
6940            state.serialize_entry("pageSize", &__With(&self.page_size))?;
6941        }
6942        if !self.page_token.is_empty() {
6943            state.serialize_entry("pageToken", &self.page_token)?;
6944        }
6945        if !self._unknown_fields.is_empty() {
6946            for (key, value) in self._unknown_fields.iter() {
6947                state.serialize_entry(key, &value)?;
6948            }
6949        }
6950        state.end()
6951    }
6952}
6953
6954/// Response for ListConnectors.
6955#[derive(Clone, Debug, Default, PartialEq)]
6956#[non_exhaustive]
6957pub struct ListConnectorsResponse {
6958    /// The list of connectors in the requested parent.
6959    pub connectors: std::vec::Vec<crate::model::Connector>,
6960
6961    /// A token that can be sent as `page_token` to retrieve the next page of
6962    /// results. If this field is omitted, there are no more results.
6963    pub next_page_token: std::string::String,
6964
6965    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6966}
6967
6968impl ListConnectorsResponse {
6969    pub fn new() -> Self {
6970        std::default::Default::default()
6971    }
6972
6973    /// Sets the value of [connectors][crate::model::ListConnectorsResponse::connectors].
6974    pub fn set_connectors<T, V>(mut self, v: T) -> Self
6975    where
6976        T: std::iter::IntoIterator<Item = V>,
6977        V: std::convert::Into<crate::model::Connector>,
6978    {
6979        use std::iter::Iterator;
6980        self.connectors = v.into_iter().map(|i| i.into()).collect();
6981        self
6982    }
6983
6984    /// Sets the value of [next_page_token][crate::model::ListConnectorsResponse::next_page_token].
6985    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6986        self.next_page_token = v.into();
6987        self
6988    }
6989}
6990
6991impl wkt::message::Message for ListConnectorsResponse {
6992    fn typename() -> &'static str {
6993        "type.googleapis.com/google.cloud.managedkafka.v1.ListConnectorsResponse"
6994    }
6995}
6996
6997#[doc(hidden)]
6998impl gax::paginator::internal::PageableResponse for ListConnectorsResponse {
6999    type PageItem = crate::model::Connector;
7000
7001    fn items(self) -> std::vec::Vec<Self::PageItem> {
7002        self.connectors
7003    }
7004
7005    fn next_page_token(&self) -> std::string::String {
7006        use std::clone::Clone;
7007        self.next_page_token.clone()
7008    }
7009}
7010
7011#[doc(hidden)]
7012impl<'de> serde::de::Deserialize<'de> for ListConnectorsResponse {
7013    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7014    where
7015        D: serde::Deserializer<'de>,
7016    {
7017        #[allow(non_camel_case_types)]
7018        #[doc(hidden)]
7019        #[derive(PartialEq, Eq, Hash)]
7020        enum __FieldTag {
7021            __connectors,
7022            __next_page_token,
7023            Unknown(std::string::String),
7024        }
7025        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7026            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7027            where
7028                D: serde::Deserializer<'de>,
7029            {
7030                struct Visitor;
7031                impl<'de> serde::de::Visitor<'de> for Visitor {
7032                    type Value = __FieldTag;
7033                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7034                        formatter.write_str("a field name for ListConnectorsResponse")
7035                    }
7036                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7037                    where
7038                        E: serde::de::Error,
7039                    {
7040                        use std::result::Result::Ok;
7041                        use std::string::ToString;
7042                        match value {
7043                            "connectors" => Ok(__FieldTag::__connectors),
7044                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
7045                            "next_page_token" => Ok(__FieldTag::__next_page_token),
7046                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7047                        }
7048                    }
7049                }
7050                deserializer.deserialize_identifier(Visitor)
7051            }
7052        }
7053        struct Visitor;
7054        impl<'de> serde::de::Visitor<'de> for Visitor {
7055            type Value = ListConnectorsResponse;
7056            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7057                formatter.write_str("struct ListConnectorsResponse")
7058            }
7059            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7060            where
7061                A: serde::de::MapAccess<'de>,
7062            {
7063                #[allow(unused_imports)]
7064                use serde::de::Error;
7065                use std::option::Option::Some;
7066                let mut fields = std::collections::HashSet::new();
7067                let mut result = Self::Value::new();
7068                while let Some(tag) = map.next_key::<__FieldTag>()? {
7069                    #[allow(clippy::match_single_binding)]
7070                    match tag {
7071                        __FieldTag::__connectors => {
7072                            if !fields.insert(__FieldTag::__connectors) {
7073                                return std::result::Result::Err(A::Error::duplicate_field(
7074                                    "multiple values for connectors",
7075                                ));
7076                            }
7077                            result.connectors = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Connector>>>()?.unwrap_or_default();
7078                        }
7079                        __FieldTag::__next_page_token => {
7080                            if !fields.insert(__FieldTag::__next_page_token) {
7081                                return std::result::Result::Err(A::Error::duplicate_field(
7082                                    "multiple values for next_page_token",
7083                                ));
7084                            }
7085                            result.next_page_token = map
7086                                .next_value::<std::option::Option<std::string::String>>()?
7087                                .unwrap_or_default();
7088                        }
7089                        __FieldTag::Unknown(key) => {
7090                            let value = map.next_value::<serde_json::Value>()?;
7091                            result._unknown_fields.insert(key, value);
7092                        }
7093                    }
7094                }
7095                std::result::Result::Ok(result)
7096            }
7097        }
7098        deserializer.deserialize_any(Visitor)
7099    }
7100}
7101
7102#[doc(hidden)]
7103impl serde::ser::Serialize for ListConnectorsResponse {
7104    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7105    where
7106        S: serde::ser::Serializer,
7107    {
7108        use serde::ser::SerializeMap;
7109        #[allow(unused_imports)]
7110        use std::option::Option::Some;
7111        let mut state = serializer.serialize_map(std::option::Option::None)?;
7112        if !self.connectors.is_empty() {
7113            state.serialize_entry("connectors", &self.connectors)?;
7114        }
7115        if !self.next_page_token.is_empty() {
7116            state.serialize_entry("nextPageToken", &self.next_page_token)?;
7117        }
7118        if !self._unknown_fields.is_empty() {
7119            for (key, value) in self._unknown_fields.iter() {
7120                state.serialize_entry(key, &value)?;
7121            }
7122        }
7123        state.end()
7124    }
7125}
7126
7127/// Request for PauseConnector.
7128#[derive(Clone, Debug, Default, PartialEq)]
7129#[non_exhaustive]
7130pub struct PauseConnectorRequest {
7131    /// Required. The name of the connector to pause.
7132    /// Structured like:
7133    /// projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector}
7134    pub name: std::string::String,
7135
7136    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7137}
7138
7139impl PauseConnectorRequest {
7140    pub fn new() -> Self {
7141        std::default::Default::default()
7142    }
7143
7144    /// Sets the value of [name][crate::model::PauseConnectorRequest::name].
7145    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7146        self.name = v.into();
7147        self
7148    }
7149}
7150
7151impl wkt::message::Message for PauseConnectorRequest {
7152    fn typename() -> &'static str {
7153        "type.googleapis.com/google.cloud.managedkafka.v1.PauseConnectorRequest"
7154    }
7155}
7156
7157#[doc(hidden)]
7158impl<'de> serde::de::Deserialize<'de> for PauseConnectorRequest {
7159    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7160    where
7161        D: serde::Deserializer<'de>,
7162    {
7163        #[allow(non_camel_case_types)]
7164        #[doc(hidden)]
7165        #[derive(PartialEq, Eq, Hash)]
7166        enum __FieldTag {
7167            __name,
7168            Unknown(std::string::String),
7169        }
7170        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7171            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7172            where
7173                D: serde::Deserializer<'de>,
7174            {
7175                struct Visitor;
7176                impl<'de> serde::de::Visitor<'de> for Visitor {
7177                    type Value = __FieldTag;
7178                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7179                        formatter.write_str("a field name for PauseConnectorRequest")
7180                    }
7181                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7182                    where
7183                        E: serde::de::Error,
7184                    {
7185                        use std::result::Result::Ok;
7186                        use std::string::ToString;
7187                        match value {
7188                            "name" => Ok(__FieldTag::__name),
7189                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7190                        }
7191                    }
7192                }
7193                deserializer.deserialize_identifier(Visitor)
7194            }
7195        }
7196        struct Visitor;
7197        impl<'de> serde::de::Visitor<'de> for Visitor {
7198            type Value = PauseConnectorRequest;
7199            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7200                formatter.write_str("struct PauseConnectorRequest")
7201            }
7202            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7203            where
7204                A: serde::de::MapAccess<'de>,
7205            {
7206                #[allow(unused_imports)]
7207                use serde::de::Error;
7208                use std::option::Option::Some;
7209                let mut fields = std::collections::HashSet::new();
7210                let mut result = Self::Value::new();
7211                while let Some(tag) = map.next_key::<__FieldTag>()? {
7212                    #[allow(clippy::match_single_binding)]
7213                    match tag {
7214                        __FieldTag::__name => {
7215                            if !fields.insert(__FieldTag::__name) {
7216                                return std::result::Result::Err(A::Error::duplicate_field(
7217                                    "multiple values for name",
7218                                ));
7219                            }
7220                            result.name = map
7221                                .next_value::<std::option::Option<std::string::String>>()?
7222                                .unwrap_or_default();
7223                        }
7224                        __FieldTag::Unknown(key) => {
7225                            let value = map.next_value::<serde_json::Value>()?;
7226                            result._unknown_fields.insert(key, value);
7227                        }
7228                    }
7229                }
7230                std::result::Result::Ok(result)
7231            }
7232        }
7233        deserializer.deserialize_any(Visitor)
7234    }
7235}
7236
7237#[doc(hidden)]
7238impl serde::ser::Serialize for PauseConnectorRequest {
7239    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7240    where
7241        S: serde::ser::Serializer,
7242    {
7243        use serde::ser::SerializeMap;
7244        #[allow(unused_imports)]
7245        use std::option::Option::Some;
7246        let mut state = serializer.serialize_map(std::option::Option::None)?;
7247        if !self.name.is_empty() {
7248            state.serialize_entry("name", &self.name)?;
7249        }
7250        if !self._unknown_fields.is_empty() {
7251            for (key, value) in self._unknown_fields.iter() {
7252                state.serialize_entry(key, &value)?;
7253            }
7254        }
7255        state.end()
7256    }
7257}
7258
7259/// Response for PauseConnector.
7260#[derive(Clone, Debug, Default, PartialEq)]
7261#[non_exhaustive]
7262pub struct PauseConnectorResponse {
7263    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7264}
7265
7266impl PauseConnectorResponse {
7267    pub fn new() -> Self {
7268        std::default::Default::default()
7269    }
7270}
7271
7272impl wkt::message::Message for PauseConnectorResponse {
7273    fn typename() -> &'static str {
7274        "type.googleapis.com/google.cloud.managedkafka.v1.PauseConnectorResponse"
7275    }
7276}
7277
7278#[doc(hidden)]
7279impl<'de> serde::de::Deserialize<'de> for PauseConnectorResponse {
7280    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7281    where
7282        D: serde::Deserializer<'de>,
7283    {
7284        #[allow(non_camel_case_types)]
7285        #[doc(hidden)]
7286        #[derive(PartialEq, Eq, Hash)]
7287        enum __FieldTag {
7288            Unknown(std::string::String),
7289        }
7290        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7291            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7292            where
7293                D: serde::Deserializer<'de>,
7294            {
7295                struct Visitor;
7296                impl<'de> serde::de::Visitor<'de> for Visitor {
7297                    type Value = __FieldTag;
7298                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7299                        formatter.write_str("a field name for PauseConnectorResponse")
7300                    }
7301                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7302                    where
7303                        E: serde::de::Error,
7304                    {
7305                        use std::result::Result::Ok;
7306                        use std::string::ToString;
7307                        Ok(__FieldTag::Unknown(value.to_string()))
7308                    }
7309                }
7310                deserializer.deserialize_identifier(Visitor)
7311            }
7312        }
7313        struct Visitor;
7314        impl<'de> serde::de::Visitor<'de> for Visitor {
7315            type Value = PauseConnectorResponse;
7316            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7317                formatter.write_str("struct PauseConnectorResponse")
7318            }
7319            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7320            where
7321                A: serde::de::MapAccess<'de>,
7322            {
7323                #[allow(unused_imports)]
7324                use serde::de::Error;
7325                use std::option::Option::Some;
7326                let mut result = Self::Value::new();
7327                while let Some(tag) = map.next_key::<__FieldTag>()? {
7328                    #[allow(clippy::match_single_binding)]
7329                    match tag {
7330                        __FieldTag::Unknown(key) => {
7331                            let value = map.next_value::<serde_json::Value>()?;
7332                            result._unknown_fields.insert(key, value);
7333                        }
7334                    }
7335                }
7336                std::result::Result::Ok(result)
7337            }
7338        }
7339        deserializer.deserialize_any(Visitor)
7340    }
7341}
7342
7343#[doc(hidden)]
7344impl serde::ser::Serialize for PauseConnectorResponse {
7345    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7346    where
7347        S: serde::ser::Serializer,
7348    {
7349        use serde::ser::SerializeMap;
7350        #[allow(unused_imports)]
7351        use std::option::Option::Some;
7352        let mut state = serializer.serialize_map(std::option::Option::None)?;
7353        if !self._unknown_fields.is_empty() {
7354            for (key, value) in self._unknown_fields.iter() {
7355                state.serialize_entry(key, &value)?;
7356            }
7357        }
7358        state.end()
7359    }
7360}
7361
7362/// Request for ResumeConnector.
7363#[derive(Clone, Debug, Default, PartialEq)]
7364#[non_exhaustive]
7365pub struct ResumeConnectorRequest {
7366    /// Required. The name of the connector to pause.
7367    /// Structured like:
7368    /// projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector}
7369    pub name: std::string::String,
7370
7371    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7372}
7373
7374impl ResumeConnectorRequest {
7375    pub fn new() -> Self {
7376        std::default::Default::default()
7377    }
7378
7379    /// Sets the value of [name][crate::model::ResumeConnectorRequest::name].
7380    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7381        self.name = v.into();
7382        self
7383    }
7384}
7385
7386impl wkt::message::Message for ResumeConnectorRequest {
7387    fn typename() -> &'static str {
7388        "type.googleapis.com/google.cloud.managedkafka.v1.ResumeConnectorRequest"
7389    }
7390}
7391
7392#[doc(hidden)]
7393impl<'de> serde::de::Deserialize<'de> for ResumeConnectorRequest {
7394    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7395    where
7396        D: serde::Deserializer<'de>,
7397    {
7398        #[allow(non_camel_case_types)]
7399        #[doc(hidden)]
7400        #[derive(PartialEq, Eq, Hash)]
7401        enum __FieldTag {
7402            __name,
7403            Unknown(std::string::String),
7404        }
7405        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7406            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7407            where
7408                D: serde::Deserializer<'de>,
7409            {
7410                struct Visitor;
7411                impl<'de> serde::de::Visitor<'de> for Visitor {
7412                    type Value = __FieldTag;
7413                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7414                        formatter.write_str("a field name for ResumeConnectorRequest")
7415                    }
7416                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7417                    where
7418                        E: serde::de::Error,
7419                    {
7420                        use std::result::Result::Ok;
7421                        use std::string::ToString;
7422                        match value {
7423                            "name" => Ok(__FieldTag::__name),
7424                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7425                        }
7426                    }
7427                }
7428                deserializer.deserialize_identifier(Visitor)
7429            }
7430        }
7431        struct Visitor;
7432        impl<'de> serde::de::Visitor<'de> for Visitor {
7433            type Value = ResumeConnectorRequest;
7434            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7435                formatter.write_str("struct ResumeConnectorRequest")
7436            }
7437            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7438            where
7439                A: serde::de::MapAccess<'de>,
7440            {
7441                #[allow(unused_imports)]
7442                use serde::de::Error;
7443                use std::option::Option::Some;
7444                let mut fields = std::collections::HashSet::new();
7445                let mut result = Self::Value::new();
7446                while let Some(tag) = map.next_key::<__FieldTag>()? {
7447                    #[allow(clippy::match_single_binding)]
7448                    match tag {
7449                        __FieldTag::__name => {
7450                            if !fields.insert(__FieldTag::__name) {
7451                                return std::result::Result::Err(A::Error::duplicate_field(
7452                                    "multiple values for name",
7453                                ));
7454                            }
7455                            result.name = map
7456                                .next_value::<std::option::Option<std::string::String>>()?
7457                                .unwrap_or_default();
7458                        }
7459                        __FieldTag::Unknown(key) => {
7460                            let value = map.next_value::<serde_json::Value>()?;
7461                            result._unknown_fields.insert(key, value);
7462                        }
7463                    }
7464                }
7465                std::result::Result::Ok(result)
7466            }
7467        }
7468        deserializer.deserialize_any(Visitor)
7469    }
7470}
7471
7472#[doc(hidden)]
7473impl serde::ser::Serialize for ResumeConnectorRequest {
7474    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7475    where
7476        S: serde::ser::Serializer,
7477    {
7478        use serde::ser::SerializeMap;
7479        #[allow(unused_imports)]
7480        use std::option::Option::Some;
7481        let mut state = serializer.serialize_map(std::option::Option::None)?;
7482        if !self.name.is_empty() {
7483            state.serialize_entry("name", &self.name)?;
7484        }
7485        if !self._unknown_fields.is_empty() {
7486            for (key, value) in self._unknown_fields.iter() {
7487                state.serialize_entry(key, &value)?;
7488            }
7489        }
7490        state.end()
7491    }
7492}
7493
7494/// Response for ResumeConnector.
7495#[derive(Clone, Debug, Default, PartialEq)]
7496#[non_exhaustive]
7497pub struct ResumeConnectorResponse {
7498    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7499}
7500
7501impl ResumeConnectorResponse {
7502    pub fn new() -> Self {
7503        std::default::Default::default()
7504    }
7505}
7506
7507impl wkt::message::Message for ResumeConnectorResponse {
7508    fn typename() -> &'static str {
7509        "type.googleapis.com/google.cloud.managedkafka.v1.ResumeConnectorResponse"
7510    }
7511}
7512
7513#[doc(hidden)]
7514impl<'de> serde::de::Deserialize<'de> for ResumeConnectorResponse {
7515    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7516    where
7517        D: serde::Deserializer<'de>,
7518    {
7519        #[allow(non_camel_case_types)]
7520        #[doc(hidden)]
7521        #[derive(PartialEq, Eq, Hash)]
7522        enum __FieldTag {
7523            Unknown(std::string::String),
7524        }
7525        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7526            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7527            where
7528                D: serde::Deserializer<'de>,
7529            {
7530                struct Visitor;
7531                impl<'de> serde::de::Visitor<'de> for Visitor {
7532                    type Value = __FieldTag;
7533                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7534                        formatter.write_str("a field name for ResumeConnectorResponse")
7535                    }
7536                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7537                    where
7538                        E: serde::de::Error,
7539                    {
7540                        use std::result::Result::Ok;
7541                        use std::string::ToString;
7542                        Ok(__FieldTag::Unknown(value.to_string()))
7543                    }
7544                }
7545                deserializer.deserialize_identifier(Visitor)
7546            }
7547        }
7548        struct Visitor;
7549        impl<'de> serde::de::Visitor<'de> for Visitor {
7550            type Value = ResumeConnectorResponse;
7551            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7552                formatter.write_str("struct ResumeConnectorResponse")
7553            }
7554            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7555            where
7556                A: serde::de::MapAccess<'de>,
7557            {
7558                #[allow(unused_imports)]
7559                use serde::de::Error;
7560                use std::option::Option::Some;
7561                let mut result = Self::Value::new();
7562                while let Some(tag) = map.next_key::<__FieldTag>()? {
7563                    #[allow(clippy::match_single_binding)]
7564                    match tag {
7565                        __FieldTag::Unknown(key) => {
7566                            let value = map.next_value::<serde_json::Value>()?;
7567                            result._unknown_fields.insert(key, value);
7568                        }
7569                    }
7570                }
7571                std::result::Result::Ok(result)
7572            }
7573        }
7574        deserializer.deserialize_any(Visitor)
7575    }
7576}
7577
7578#[doc(hidden)]
7579impl serde::ser::Serialize for ResumeConnectorResponse {
7580    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7581    where
7582        S: serde::ser::Serializer,
7583    {
7584        use serde::ser::SerializeMap;
7585        #[allow(unused_imports)]
7586        use std::option::Option::Some;
7587        let mut state = serializer.serialize_map(std::option::Option::None)?;
7588        if !self._unknown_fields.is_empty() {
7589            for (key, value) in self._unknown_fields.iter() {
7590                state.serialize_entry(key, &value)?;
7591            }
7592        }
7593        state.end()
7594    }
7595}
7596
7597/// Request for RestartConnector.
7598#[derive(Clone, Debug, Default, PartialEq)]
7599#[non_exhaustive]
7600pub struct RestartConnectorRequest {
7601    /// Required. The name of the connector to restart.
7602    /// Structured like:
7603    /// projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector}
7604    pub name: std::string::String,
7605
7606    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7607}
7608
7609impl RestartConnectorRequest {
7610    pub fn new() -> Self {
7611        std::default::Default::default()
7612    }
7613
7614    /// Sets the value of [name][crate::model::RestartConnectorRequest::name].
7615    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7616        self.name = v.into();
7617        self
7618    }
7619}
7620
7621impl wkt::message::Message for RestartConnectorRequest {
7622    fn typename() -> &'static str {
7623        "type.googleapis.com/google.cloud.managedkafka.v1.RestartConnectorRequest"
7624    }
7625}
7626
7627#[doc(hidden)]
7628impl<'de> serde::de::Deserialize<'de> for RestartConnectorRequest {
7629    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7630    where
7631        D: serde::Deserializer<'de>,
7632    {
7633        #[allow(non_camel_case_types)]
7634        #[doc(hidden)]
7635        #[derive(PartialEq, Eq, Hash)]
7636        enum __FieldTag {
7637            __name,
7638            Unknown(std::string::String),
7639        }
7640        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7641            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7642            where
7643                D: serde::Deserializer<'de>,
7644            {
7645                struct Visitor;
7646                impl<'de> serde::de::Visitor<'de> for Visitor {
7647                    type Value = __FieldTag;
7648                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7649                        formatter.write_str("a field name for RestartConnectorRequest")
7650                    }
7651                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7652                    where
7653                        E: serde::de::Error,
7654                    {
7655                        use std::result::Result::Ok;
7656                        use std::string::ToString;
7657                        match value {
7658                            "name" => Ok(__FieldTag::__name),
7659                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7660                        }
7661                    }
7662                }
7663                deserializer.deserialize_identifier(Visitor)
7664            }
7665        }
7666        struct Visitor;
7667        impl<'de> serde::de::Visitor<'de> for Visitor {
7668            type Value = RestartConnectorRequest;
7669            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7670                formatter.write_str("struct RestartConnectorRequest")
7671            }
7672            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7673            where
7674                A: serde::de::MapAccess<'de>,
7675            {
7676                #[allow(unused_imports)]
7677                use serde::de::Error;
7678                use std::option::Option::Some;
7679                let mut fields = std::collections::HashSet::new();
7680                let mut result = Self::Value::new();
7681                while let Some(tag) = map.next_key::<__FieldTag>()? {
7682                    #[allow(clippy::match_single_binding)]
7683                    match tag {
7684                        __FieldTag::__name => {
7685                            if !fields.insert(__FieldTag::__name) {
7686                                return std::result::Result::Err(A::Error::duplicate_field(
7687                                    "multiple values for name",
7688                                ));
7689                            }
7690                            result.name = map
7691                                .next_value::<std::option::Option<std::string::String>>()?
7692                                .unwrap_or_default();
7693                        }
7694                        __FieldTag::Unknown(key) => {
7695                            let value = map.next_value::<serde_json::Value>()?;
7696                            result._unknown_fields.insert(key, value);
7697                        }
7698                    }
7699                }
7700                std::result::Result::Ok(result)
7701            }
7702        }
7703        deserializer.deserialize_any(Visitor)
7704    }
7705}
7706
7707#[doc(hidden)]
7708impl serde::ser::Serialize for RestartConnectorRequest {
7709    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7710    where
7711        S: serde::ser::Serializer,
7712    {
7713        use serde::ser::SerializeMap;
7714        #[allow(unused_imports)]
7715        use std::option::Option::Some;
7716        let mut state = serializer.serialize_map(std::option::Option::None)?;
7717        if !self.name.is_empty() {
7718            state.serialize_entry("name", &self.name)?;
7719        }
7720        if !self._unknown_fields.is_empty() {
7721            for (key, value) in self._unknown_fields.iter() {
7722                state.serialize_entry(key, &value)?;
7723            }
7724        }
7725        state.end()
7726    }
7727}
7728
7729/// Response for RestartConnector.
7730#[derive(Clone, Debug, Default, PartialEq)]
7731#[non_exhaustive]
7732pub struct RestartConnectorResponse {
7733    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7734}
7735
7736impl RestartConnectorResponse {
7737    pub fn new() -> Self {
7738        std::default::Default::default()
7739    }
7740}
7741
7742impl wkt::message::Message for RestartConnectorResponse {
7743    fn typename() -> &'static str {
7744        "type.googleapis.com/google.cloud.managedkafka.v1.RestartConnectorResponse"
7745    }
7746}
7747
7748#[doc(hidden)]
7749impl<'de> serde::de::Deserialize<'de> for RestartConnectorResponse {
7750    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7751    where
7752        D: serde::Deserializer<'de>,
7753    {
7754        #[allow(non_camel_case_types)]
7755        #[doc(hidden)]
7756        #[derive(PartialEq, Eq, Hash)]
7757        enum __FieldTag {
7758            Unknown(std::string::String),
7759        }
7760        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7761            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7762            where
7763                D: serde::Deserializer<'de>,
7764            {
7765                struct Visitor;
7766                impl<'de> serde::de::Visitor<'de> for Visitor {
7767                    type Value = __FieldTag;
7768                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7769                        formatter.write_str("a field name for RestartConnectorResponse")
7770                    }
7771                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7772                    where
7773                        E: serde::de::Error,
7774                    {
7775                        use std::result::Result::Ok;
7776                        use std::string::ToString;
7777                        Ok(__FieldTag::Unknown(value.to_string()))
7778                    }
7779                }
7780                deserializer.deserialize_identifier(Visitor)
7781            }
7782        }
7783        struct Visitor;
7784        impl<'de> serde::de::Visitor<'de> for Visitor {
7785            type Value = RestartConnectorResponse;
7786            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7787                formatter.write_str("struct RestartConnectorResponse")
7788            }
7789            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7790            where
7791                A: serde::de::MapAccess<'de>,
7792            {
7793                #[allow(unused_imports)]
7794                use serde::de::Error;
7795                use std::option::Option::Some;
7796                let mut result = Self::Value::new();
7797                while let Some(tag) = map.next_key::<__FieldTag>()? {
7798                    #[allow(clippy::match_single_binding)]
7799                    match tag {
7800                        __FieldTag::Unknown(key) => {
7801                            let value = map.next_value::<serde_json::Value>()?;
7802                            result._unknown_fields.insert(key, value);
7803                        }
7804                    }
7805                }
7806                std::result::Result::Ok(result)
7807            }
7808        }
7809        deserializer.deserialize_any(Visitor)
7810    }
7811}
7812
7813#[doc(hidden)]
7814impl serde::ser::Serialize for RestartConnectorResponse {
7815    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7816    where
7817        S: serde::ser::Serializer,
7818    {
7819        use serde::ser::SerializeMap;
7820        #[allow(unused_imports)]
7821        use std::option::Option::Some;
7822        let mut state = serializer.serialize_map(std::option::Option::None)?;
7823        if !self._unknown_fields.is_empty() {
7824            for (key, value) in self._unknown_fields.iter() {
7825                state.serialize_entry(key, &value)?;
7826            }
7827        }
7828        state.end()
7829    }
7830}
7831
7832/// Request for StopConnector.
7833#[derive(Clone, Debug, Default, PartialEq)]
7834#[non_exhaustive]
7835pub struct StopConnectorRequest {
7836    /// Required. The name of the connector to stop.
7837    /// Structured like:
7838    /// projects/{project}/locations/{location}/connectClusters/{connectCluster}/connectors/{connector}
7839    pub name: std::string::String,
7840
7841    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7842}
7843
7844impl StopConnectorRequest {
7845    pub fn new() -> Self {
7846        std::default::Default::default()
7847    }
7848
7849    /// Sets the value of [name][crate::model::StopConnectorRequest::name].
7850    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7851        self.name = v.into();
7852        self
7853    }
7854}
7855
7856impl wkt::message::Message for StopConnectorRequest {
7857    fn typename() -> &'static str {
7858        "type.googleapis.com/google.cloud.managedkafka.v1.StopConnectorRequest"
7859    }
7860}
7861
7862#[doc(hidden)]
7863impl<'de> serde::de::Deserialize<'de> for StopConnectorRequest {
7864    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7865    where
7866        D: serde::Deserializer<'de>,
7867    {
7868        #[allow(non_camel_case_types)]
7869        #[doc(hidden)]
7870        #[derive(PartialEq, Eq, Hash)]
7871        enum __FieldTag {
7872            __name,
7873            Unknown(std::string::String),
7874        }
7875        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7876            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7877            where
7878                D: serde::Deserializer<'de>,
7879            {
7880                struct Visitor;
7881                impl<'de> serde::de::Visitor<'de> for Visitor {
7882                    type Value = __FieldTag;
7883                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7884                        formatter.write_str("a field name for StopConnectorRequest")
7885                    }
7886                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7887                    where
7888                        E: serde::de::Error,
7889                    {
7890                        use std::result::Result::Ok;
7891                        use std::string::ToString;
7892                        match value {
7893                            "name" => Ok(__FieldTag::__name),
7894                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7895                        }
7896                    }
7897                }
7898                deserializer.deserialize_identifier(Visitor)
7899            }
7900        }
7901        struct Visitor;
7902        impl<'de> serde::de::Visitor<'de> for Visitor {
7903            type Value = StopConnectorRequest;
7904            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7905                formatter.write_str("struct StopConnectorRequest")
7906            }
7907            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7908            where
7909                A: serde::de::MapAccess<'de>,
7910            {
7911                #[allow(unused_imports)]
7912                use serde::de::Error;
7913                use std::option::Option::Some;
7914                let mut fields = std::collections::HashSet::new();
7915                let mut result = Self::Value::new();
7916                while let Some(tag) = map.next_key::<__FieldTag>()? {
7917                    #[allow(clippy::match_single_binding)]
7918                    match tag {
7919                        __FieldTag::__name => {
7920                            if !fields.insert(__FieldTag::__name) {
7921                                return std::result::Result::Err(A::Error::duplicate_field(
7922                                    "multiple values for name",
7923                                ));
7924                            }
7925                            result.name = map
7926                                .next_value::<std::option::Option<std::string::String>>()?
7927                                .unwrap_or_default();
7928                        }
7929                        __FieldTag::Unknown(key) => {
7930                            let value = map.next_value::<serde_json::Value>()?;
7931                            result._unknown_fields.insert(key, value);
7932                        }
7933                    }
7934                }
7935                std::result::Result::Ok(result)
7936            }
7937        }
7938        deserializer.deserialize_any(Visitor)
7939    }
7940}
7941
7942#[doc(hidden)]
7943impl serde::ser::Serialize for StopConnectorRequest {
7944    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7945    where
7946        S: serde::ser::Serializer,
7947    {
7948        use serde::ser::SerializeMap;
7949        #[allow(unused_imports)]
7950        use std::option::Option::Some;
7951        let mut state = serializer.serialize_map(std::option::Option::None)?;
7952        if !self.name.is_empty() {
7953            state.serialize_entry("name", &self.name)?;
7954        }
7955        if !self._unknown_fields.is_empty() {
7956            for (key, value) in self._unknown_fields.iter() {
7957                state.serialize_entry(key, &value)?;
7958            }
7959        }
7960        state.end()
7961    }
7962}
7963
7964/// Response for StopConnector.
7965#[derive(Clone, Debug, Default, PartialEq)]
7966#[non_exhaustive]
7967pub struct StopConnectorResponse {
7968    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7969}
7970
7971impl StopConnectorResponse {
7972    pub fn new() -> Self {
7973        std::default::Default::default()
7974    }
7975}
7976
7977impl wkt::message::Message for StopConnectorResponse {
7978    fn typename() -> &'static str {
7979        "type.googleapis.com/google.cloud.managedkafka.v1.StopConnectorResponse"
7980    }
7981}
7982
7983#[doc(hidden)]
7984impl<'de> serde::de::Deserialize<'de> for StopConnectorResponse {
7985    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7986    where
7987        D: serde::Deserializer<'de>,
7988    {
7989        #[allow(non_camel_case_types)]
7990        #[doc(hidden)]
7991        #[derive(PartialEq, Eq, Hash)]
7992        enum __FieldTag {
7993            Unknown(std::string::String),
7994        }
7995        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7996            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7997            where
7998                D: serde::Deserializer<'de>,
7999            {
8000                struct Visitor;
8001                impl<'de> serde::de::Visitor<'de> for Visitor {
8002                    type Value = __FieldTag;
8003                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8004                        formatter.write_str("a field name for StopConnectorResponse")
8005                    }
8006                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8007                    where
8008                        E: serde::de::Error,
8009                    {
8010                        use std::result::Result::Ok;
8011                        use std::string::ToString;
8012                        Ok(__FieldTag::Unknown(value.to_string()))
8013                    }
8014                }
8015                deserializer.deserialize_identifier(Visitor)
8016            }
8017        }
8018        struct Visitor;
8019        impl<'de> serde::de::Visitor<'de> for Visitor {
8020            type Value = StopConnectorResponse;
8021            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8022                formatter.write_str("struct StopConnectorResponse")
8023            }
8024            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8025            where
8026                A: serde::de::MapAccess<'de>,
8027            {
8028                #[allow(unused_imports)]
8029                use serde::de::Error;
8030                use std::option::Option::Some;
8031                let mut result = Self::Value::new();
8032                while let Some(tag) = map.next_key::<__FieldTag>()? {
8033                    #[allow(clippy::match_single_binding)]
8034                    match tag {
8035                        __FieldTag::Unknown(key) => {
8036                            let value = map.next_value::<serde_json::Value>()?;
8037                            result._unknown_fields.insert(key, value);
8038                        }
8039                    }
8040                }
8041                std::result::Result::Ok(result)
8042            }
8043        }
8044        deserializer.deserialize_any(Visitor)
8045    }
8046}
8047
8048#[doc(hidden)]
8049impl serde::ser::Serialize for StopConnectorResponse {
8050    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8051    where
8052        S: serde::ser::Serializer,
8053    {
8054        use serde::ser::SerializeMap;
8055        #[allow(unused_imports)]
8056        use std::option::Option::Some;
8057        let mut state = serializer.serialize_map(std::option::Option::None)?;
8058        if !self._unknown_fields.is_empty() {
8059            for (key, value) in self._unknown_fields.iter() {
8060                state.serialize_entry(key, &value)?;
8061            }
8062        }
8063        state.end()
8064    }
8065}
8066
8067/// An Apache Kafka cluster deployed in a location.
8068#[derive(Clone, Debug, Default, PartialEq)]
8069#[non_exhaustive]
8070pub struct Cluster {
8071    /// Identifier. The name of the cluster. Structured like:
8072    /// projects/{project_number}/locations/{location}/clusters/{cluster_id}
8073    pub name: std::string::String,
8074
8075    /// Output only. The time when the cluster was created.
8076    pub create_time: std::option::Option<wkt::Timestamp>,
8077
8078    /// Output only. The time when the cluster was last updated.
8079    pub update_time: std::option::Option<wkt::Timestamp>,
8080
8081    /// Optional. Labels as key value pairs.
8082    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
8083
8084    /// Required. Capacity configuration for the Kafka cluster.
8085    pub capacity_config: std::option::Option<crate::model::CapacityConfig>,
8086
8087    /// Optional. Rebalance configuration for the Kafka cluster.
8088    pub rebalance_config: std::option::Option<crate::model::RebalanceConfig>,
8089
8090    /// Output only. The current state of the cluster.
8091    pub state: crate::model::cluster::State,
8092
8093    /// Output only. Reserved for future use.
8094    pub satisfies_pzi: std::option::Option<bool>,
8095
8096    /// Output only. Reserved for future use.
8097    pub satisfies_pzs: std::option::Option<bool>,
8098
8099    /// Platform specific configuration properties for a Kafka cluster.
8100    pub platform_config: std::option::Option<crate::model::cluster::PlatformConfig>,
8101
8102    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8103}
8104
8105impl Cluster {
8106    pub fn new() -> Self {
8107        std::default::Default::default()
8108    }
8109
8110    /// Sets the value of [name][crate::model::Cluster::name].
8111    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8112        self.name = v.into();
8113        self
8114    }
8115
8116    /// Sets the value of [create_time][crate::model::Cluster::create_time].
8117    pub fn set_create_time<T>(mut self, v: T) -> Self
8118    where
8119        T: std::convert::Into<wkt::Timestamp>,
8120    {
8121        self.create_time = std::option::Option::Some(v.into());
8122        self
8123    }
8124
8125    /// Sets or clears the value of [create_time][crate::model::Cluster::create_time].
8126    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8127    where
8128        T: std::convert::Into<wkt::Timestamp>,
8129    {
8130        self.create_time = v.map(|x| x.into());
8131        self
8132    }
8133
8134    /// Sets the value of [update_time][crate::model::Cluster::update_time].
8135    pub fn set_update_time<T>(mut self, v: T) -> Self
8136    where
8137        T: std::convert::Into<wkt::Timestamp>,
8138    {
8139        self.update_time = std::option::Option::Some(v.into());
8140        self
8141    }
8142
8143    /// Sets or clears the value of [update_time][crate::model::Cluster::update_time].
8144    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
8145    where
8146        T: std::convert::Into<wkt::Timestamp>,
8147    {
8148        self.update_time = v.map(|x| x.into());
8149        self
8150    }
8151
8152    /// Sets the value of [labels][crate::model::Cluster::labels].
8153    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
8154    where
8155        T: std::iter::IntoIterator<Item = (K, V)>,
8156        K: std::convert::Into<std::string::String>,
8157        V: std::convert::Into<std::string::String>,
8158    {
8159        use std::iter::Iterator;
8160        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8161        self
8162    }
8163
8164    /// Sets the value of [capacity_config][crate::model::Cluster::capacity_config].
8165    pub fn set_capacity_config<T>(mut self, v: T) -> Self
8166    where
8167        T: std::convert::Into<crate::model::CapacityConfig>,
8168    {
8169        self.capacity_config = std::option::Option::Some(v.into());
8170        self
8171    }
8172
8173    /// Sets or clears the value of [capacity_config][crate::model::Cluster::capacity_config].
8174    pub fn set_or_clear_capacity_config<T>(mut self, v: std::option::Option<T>) -> Self
8175    where
8176        T: std::convert::Into<crate::model::CapacityConfig>,
8177    {
8178        self.capacity_config = v.map(|x| x.into());
8179        self
8180    }
8181
8182    /// Sets the value of [rebalance_config][crate::model::Cluster::rebalance_config].
8183    pub fn set_rebalance_config<T>(mut self, v: T) -> Self
8184    where
8185        T: std::convert::Into<crate::model::RebalanceConfig>,
8186    {
8187        self.rebalance_config = std::option::Option::Some(v.into());
8188        self
8189    }
8190
8191    /// Sets or clears the value of [rebalance_config][crate::model::Cluster::rebalance_config].
8192    pub fn set_or_clear_rebalance_config<T>(mut self, v: std::option::Option<T>) -> Self
8193    where
8194        T: std::convert::Into<crate::model::RebalanceConfig>,
8195    {
8196        self.rebalance_config = v.map(|x| x.into());
8197        self
8198    }
8199
8200    /// Sets the value of [state][crate::model::Cluster::state].
8201    pub fn set_state<T: std::convert::Into<crate::model::cluster::State>>(mut self, v: T) -> Self {
8202        self.state = v.into();
8203        self
8204    }
8205
8206    /// Sets the value of [satisfies_pzi][crate::model::Cluster::satisfies_pzi].
8207    pub fn set_satisfies_pzi<T>(mut self, v: T) -> Self
8208    where
8209        T: std::convert::Into<bool>,
8210    {
8211        self.satisfies_pzi = std::option::Option::Some(v.into());
8212        self
8213    }
8214
8215    /// Sets or clears the value of [satisfies_pzi][crate::model::Cluster::satisfies_pzi].
8216    pub fn set_or_clear_satisfies_pzi<T>(mut self, v: std::option::Option<T>) -> Self
8217    where
8218        T: std::convert::Into<bool>,
8219    {
8220        self.satisfies_pzi = v.map(|x| x.into());
8221        self
8222    }
8223
8224    /// Sets the value of [satisfies_pzs][crate::model::Cluster::satisfies_pzs].
8225    pub fn set_satisfies_pzs<T>(mut self, v: T) -> Self
8226    where
8227        T: std::convert::Into<bool>,
8228    {
8229        self.satisfies_pzs = std::option::Option::Some(v.into());
8230        self
8231    }
8232
8233    /// Sets or clears the value of [satisfies_pzs][crate::model::Cluster::satisfies_pzs].
8234    pub fn set_or_clear_satisfies_pzs<T>(mut self, v: std::option::Option<T>) -> Self
8235    where
8236        T: std::convert::Into<bool>,
8237    {
8238        self.satisfies_pzs = v.map(|x| x.into());
8239        self
8240    }
8241
8242    /// Sets the value of [platform_config][crate::model::Cluster::platform_config].
8243    ///
8244    /// Note that all the setters affecting `platform_config` are mutually
8245    /// exclusive.
8246    pub fn set_platform_config<
8247        T: std::convert::Into<std::option::Option<crate::model::cluster::PlatformConfig>>,
8248    >(
8249        mut self,
8250        v: T,
8251    ) -> Self {
8252        self.platform_config = v.into();
8253        self
8254    }
8255
8256    /// The value of [platform_config][crate::model::Cluster::platform_config]
8257    /// if it holds a `GcpConfig`, `None` if the field is not set or
8258    /// holds a different branch.
8259    pub fn gcp_config(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcpConfig>> {
8260        #[allow(unreachable_patterns)]
8261        self.platform_config.as_ref().and_then(|v| match v {
8262            crate::model::cluster::PlatformConfig::GcpConfig(v) => std::option::Option::Some(v),
8263            _ => std::option::Option::None,
8264        })
8265    }
8266
8267    /// Sets the value of [platform_config][crate::model::Cluster::platform_config]
8268    /// to hold a `GcpConfig`.
8269    ///
8270    /// Note that all the setters affecting `platform_config` are
8271    /// mutually exclusive.
8272    pub fn set_gcp_config<T: std::convert::Into<std::boxed::Box<crate::model::GcpConfig>>>(
8273        mut self,
8274        v: T,
8275    ) -> Self {
8276        self.platform_config =
8277            std::option::Option::Some(crate::model::cluster::PlatformConfig::GcpConfig(v.into()));
8278        self
8279    }
8280}
8281
8282impl wkt::message::Message for Cluster {
8283    fn typename() -> &'static str {
8284        "type.googleapis.com/google.cloud.managedkafka.v1.Cluster"
8285    }
8286}
8287
8288#[doc(hidden)]
8289impl<'de> serde::de::Deserialize<'de> for Cluster {
8290    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8291    where
8292        D: serde::Deserializer<'de>,
8293    {
8294        #[allow(non_camel_case_types)]
8295        #[doc(hidden)]
8296        #[derive(PartialEq, Eq, Hash)]
8297        enum __FieldTag {
8298            __gcp_config,
8299            __name,
8300            __create_time,
8301            __update_time,
8302            __labels,
8303            __capacity_config,
8304            __rebalance_config,
8305            __state,
8306            __satisfies_pzi,
8307            __satisfies_pzs,
8308            Unknown(std::string::String),
8309        }
8310        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8311            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8312            where
8313                D: serde::Deserializer<'de>,
8314            {
8315                struct Visitor;
8316                impl<'de> serde::de::Visitor<'de> for Visitor {
8317                    type Value = __FieldTag;
8318                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8319                        formatter.write_str("a field name for Cluster")
8320                    }
8321                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8322                    where
8323                        E: serde::de::Error,
8324                    {
8325                        use std::result::Result::Ok;
8326                        use std::string::ToString;
8327                        match value {
8328                            "gcpConfig" => Ok(__FieldTag::__gcp_config),
8329                            "gcp_config" => Ok(__FieldTag::__gcp_config),
8330                            "name" => Ok(__FieldTag::__name),
8331                            "createTime" => Ok(__FieldTag::__create_time),
8332                            "create_time" => Ok(__FieldTag::__create_time),
8333                            "updateTime" => Ok(__FieldTag::__update_time),
8334                            "update_time" => Ok(__FieldTag::__update_time),
8335                            "labels" => Ok(__FieldTag::__labels),
8336                            "capacityConfig" => Ok(__FieldTag::__capacity_config),
8337                            "capacity_config" => Ok(__FieldTag::__capacity_config),
8338                            "rebalanceConfig" => Ok(__FieldTag::__rebalance_config),
8339                            "rebalance_config" => Ok(__FieldTag::__rebalance_config),
8340                            "state" => Ok(__FieldTag::__state),
8341                            "satisfiesPzi" => Ok(__FieldTag::__satisfies_pzi),
8342                            "satisfies_pzi" => Ok(__FieldTag::__satisfies_pzi),
8343                            "satisfiesPzs" => Ok(__FieldTag::__satisfies_pzs),
8344                            "satisfies_pzs" => Ok(__FieldTag::__satisfies_pzs),
8345                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8346                        }
8347                    }
8348                }
8349                deserializer.deserialize_identifier(Visitor)
8350            }
8351        }
8352        struct Visitor;
8353        impl<'de> serde::de::Visitor<'de> for Visitor {
8354            type Value = Cluster;
8355            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8356                formatter.write_str("struct Cluster")
8357            }
8358            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8359            where
8360                A: serde::de::MapAccess<'de>,
8361            {
8362                #[allow(unused_imports)]
8363                use serde::de::Error;
8364                use std::option::Option::Some;
8365                let mut fields = std::collections::HashSet::new();
8366                let mut result = Self::Value::new();
8367                while let Some(tag) = map.next_key::<__FieldTag>()? {
8368                    #[allow(clippy::match_single_binding)]
8369                    match tag {
8370                        __FieldTag::__gcp_config => {
8371                            if !fields.insert(__FieldTag::__gcp_config) {
8372                                return std::result::Result::Err(A::Error::duplicate_field(
8373                                    "multiple values for gcp_config",
8374                                ));
8375                            }
8376                            if result.platform_config.is_some() {
8377                                return std::result::Result::Err(A::Error::duplicate_field(
8378                                    "multiple values for `platform_config`, a oneof with full ID .google.cloud.managedkafka.v1.Cluster.gcp_config, latest field was gcpConfig",
8379                                ));
8380                            }
8381                            result.platform_config = std::option::Option::Some(
8382                                crate::model::cluster::PlatformConfig::GcpConfig(
8383                                    map.next_value::<std::option::Option<
8384                                        std::boxed::Box<crate::model::GcpConfig>,
8385                                    >>()?
8386                                    .unwrap_or_default(),
8387                                ),
8388                            );
8389                        }
8390                        __FieldTag::__name => {
8391                            if !fields.insert(__FieldTag::__name) {
8392                                return std::result::Result::Err(A::Error::duplicate_field(
8393                                    "multiple values for name",
8394                                ));
8395                            }
8396                            result.name = map
8397                                .next_value::<std::option::Option<std::string::String>>()?
8398                                .unwrap_or_default();
8399                        }
8400                        __FieldTag::__create_time => {
8401                            if !fields.insert(__FieldTag::__create_time) {
8402                                return std::result::Result::Err(A::Error::duplicate_field(
8403                                    "multiple values for create_time",
8404                                ));
8405                            }
8406                            result.create_time =
8407                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
8408                        }
8409                        __FieldTag::__update_time => {
8410                            if !fields.insert(__FieldTag::__update_time) {
8411                                return std::result::Result::Err(A::Error::duplicate_field(
8412                                    "multiple values for update_time",
8413                                ));
8414                            }
8415                            result.update_time =
8416                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
8417                        }
8418                        __FieldTag::__labels => {
8419                            if !fields.insert(__FieldTag::__labels) {
8420                                return std::result::Result::Err(A::Error::duplicate_field(
8421                                    "multiple values for labels",
8422                                ));
8423                            }
8424                            result.labels = map
8425                                .next_value::<std::option::Option<
8426                                    std::collections::HashMap<
8427                                        std::string::String,
8428                                        std::string::String,
8429                                    >,
8430                                >>()?
8431                                .unwrap_or_default();
8432                        }
8433                        __FieldTag::__capacity_config => {
8434                            if !fields.insert(__FieldTag::__capacity_config) {
8435                                return std::result::Result::Err(A::Error::duplicate_field(
8436                                    "multiple values for capacity_config",
8437                                ));
8438                            }
8439                            result.capacity_config = map
8440                                .next_value::<std::option::Option<crate::model::CapacityConfig>>(
8441                                )?;
8442                        }
8443                        __FieldTag::__rebalance_config => {
8444                            if !fields.insert(__FieldTag::__rebalance_config) {
8445                                return std::result::Result::Err(A::Error::duplicate_field(
8446                                    "multiple values for rebalance_config",
8447                                ));
8448                            }
8449                            result.rebalance_config = map
8450                                .next_value::<std::option::Option<crate::model::RebalanceConfig>>(
8451                                )?;
8452                        }
8453                        __FieldTag::__state => {
8454                            if !fields.insert(__FieldTag::__state) {
8455                                return std::result::Result::Err(A::Error::duplicate_field(
8456                                    "multiple values for state",
8457                                ));
8458                            }
8459                            result.state = map
8460                                .next_value::<std::option::Option<crate::model::cluster::State>>()?
8461                                .unwrap_or_default();
8462                        }
8463                        __FieldTag::__satisfies_pzi => {
8464                            if !fields.insert(__FieldTag::__satisfies_pzi) {
8465                                return std::result::Result::Err(A::Error::duplicate_field(
8466                                    "multiple values for satisfies_pzi",
8467                                ));
8468                            }
8469                            result.satisfies_pzi = map.next_value::<std::option::Option<bool>>()?;
8470                        }
8471                        __FieldTag::__satisfies_pzs => {
8472                            if !fields.insert(__FieldTag::__satisfies_pzs) {
8473                                return std::result::Result::Err(A::Error::duplicate_field(
8474                                    "multiple values for satisfies_pzs",
8475                                ));
8476                            }
8477                            result.satisfies_pzs = map.next_value::<std::option::Option<bool>>()?;
8478                        }
8479                        __FieldTag::Unknown(key) => {
8480                            let value = map.next_value::<serde_json::Value>()?;
8481                            result._unknown_fields.insert(key, value);
8482                        }
8483                    }
8484                }
8485                std::result::Result::Ok(result)
8486            }
8487        }
8488        deserializer.deserialize_any(Visitor)
8489    }
8490}
8491
8492#[doc(hidden)]
8493impl serde::ser::Serialize for Cluster {
8494    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8495    where
8496        S: serde::ser::Serializer,
8497    {
8498        use serde::ser::SerializeMap;
8499        #[allow(unused_imports)]
8500        use std::option::Option::Some;
8501        let mut state = serializer.serialize_map(std::option::Option::None)?;
8502        if let Some(value) = self.gcp_config() {
8503            state.serialize_entry("gcpConfig", value)?;
8504        }
8505        if !self.name.is_empty() {
8506            state.serialize_entry("name", &self.name)?;
8507        }
8508        if self.create_time.is_some() {
8509            state.serialize_entry("createTime", &self.create_time)?;
8510        }
8511        if self.update_time.is_some() {
8512            state.serialize_entry("updateTime", &self.update_time)?;
8513        }
8514        if !self.labels.is_empty() {
8515            state.serialize_entry("labels", &self.labels)?;
8516        }
8517        if self.capacity_config.is_some() {
8518            state.serialize_entry("capacityConfig", &self.capacity_config)?;
8519        }
8520        if self.rebalance_config.is_some() {
8521            state.serialize_entry("rebalanceConfig", &self.rebalance_config)?;
8522        }
8523        if !wkt::internal::is_default(&self.state) {
8524            state.serialize_entry("state", &self.state)?;
8525        }
8526        if self.satisfies_pzi.is_some() {
8527            state.serialize_entry("satisfiesPzi", &self.satisfies_pzi)?;
8528        }
8529        if self.satisfies_pzs.is_some() {
8530            state.serialize_entry("satisfiesPzs", &self.satisfies_pzs)?;
8531        }
8532        if !self._unknown_fields.is_empty() {
8533            for (key, value) in self._unknown_fields.iter() {
8534                state.serialize_entry(key, &value)?;
8535            }
8536        }
8537        state.end()
8538    }
8539}
8540
8541/// Defines additional types related to [Cluster].
8542pub mod cluster {
8543    #[allow(unused_imports)]
8544    use super::*;
8545
8546    /// The state of the cluster.
8547    ///
8548    /// # Working with unknown values
8549    ///
8550    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8551    /// additional enum variants at any time. Adding new variants is not considered
8552    /// a breaking change. Applications should write their code in anticipation of:
8553    ///
8554    /// - New values appearing in future releases of the client library, **and**
8555    /// - New values received dynamically, without application changes.
8556    ///
8557    /// Please consult the [Working with enums] section in the user guide for some
8558    /// guidelines.
8559    ///
8560    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8561    #[derive(Clone, Debug, PartialEq)]
8562    #[non_exhaustive]
8563    pub enum State {
8564        /// A state was not specified.
8565        Unspecified,
8566        /// The cluster is being created.
8567        Creating,
8568        /// The cluster is active.
8569        Active,
8570        /// The cluster is being deleted.
8571        Deleting,
8572        /// If set, the enum was initialized with an unknown value.
8573        ///
8574        /// Applications can examine the value using [State::value] or
8575        /// [State::name].
8576        UnknownValue(state::UnknownValue),
8577    }
8578
8579    #[doc(hidden)]
8580    pub mod state {
8581        #[allow(unused_imports)]
8582        use super::*;
8583        #[derive(Clone, Debug, PartialEq)]
8584        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8585    }
8586
8587    impl State {
8588        /// Gets the enum value.
8589        ///
8590        /// Returns `None` if the enum contains an unknown value deserialized from
8591        /// the string representation of enums.
8592        pub fn value(&self) -> std::option::Option<i32> {
8593            match self {
8594                Self::Unspecified => std::option::Option::Some(0),
8595                Self::Creating => std::option::Option::Some(1),
8596                Self::Active => std::option::Option::Some(2),
8597                Self::Deleting => std::option::Option::Some(3),
8598                Self::UnknownValue(u) => u.0.value(),
8599            }
8600        }
8601
8602        /// Gets the enum value as a string.
8603        ///
8604        /// Returns `None` if the enum contains an unknown value deserialized from
8605        /// the integer representation of enums.
8606        pub fn name(&self) -> std::option::Option<&str> {
8607            match self {
8608                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
8609                Self::Creating => std::option::Option::Some("CREATING"),
8610                Self::Active => std::option::Option::Some("ACTIVE"),
8611                Self::Deleting => std::option::Option::Some("DELETING"),
8612                Self::UnknownValue(u) => u.0.name(),
8613            }
8614        }
8615    }
8616
8617    impl std::default::Default for State {
8618        fn default() -> Self {
8619            use std::convert::From;
8620            Self::from(0)
8621        }
8622    }
8623
8624    impl std::fmt::Display for State {
8625        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8626            wkt::internal::display_enum(f, self.name(), self.value())
8627        }
8628    }
8629
8630    impl std::convert::From<i32> for State {
8631        fn from(value: i32) -> Self {
8632            match value {
8633                0 => Self::Unspecified,
8634                1 => Self::Creating,
8635                2 => Self::Active,
8636                3 => Self::Deleting,
8637                _ => Self::UnknownValue(state::UnknownValue(
8638                    wkt::internal::UnknownEnumValue::Integer(value),
8639                )),
8640            }
8641        }
8642    }
8643
8644    impl std::convert::From<&str> for State {
8645        fn from(value: &str) -> Self {
8646            use std::string::ToString;
8647            match value {
8648                "STATE_UNSPECIFIED" => Self::Unspecified,
8649                "CREATING" => Self::Creating,
8650                "ACTIVE" => Self::Active,
8651                "DELETING" => Self::Deleting,
8652                _ => Self::UnknownValue(state::UnknownValue(
8653                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8654                )),
8655            }
8656        }
8657    }
8658
8659    impl serde::ser::Serialize for State {
8660        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8661        where
8662            S: serde::Serializer,
8663        {
8664            match self {
8665                Self::Unspecified => serializer.serialize_i32(0),
8666                Self::Creating => serializer.serialize_i32(1),
8667                Self::Active => serializer.serialize_i32(2),
8668                Self::Deleting => serializer.serialize_i32(3),
8669                Self::UnknownValue(u) => u.0.serialize(serializer),
8670            }
8671        }
8672    }
8673
8674    impl<'de> serde::de::Deserialize<'de> for State {
8675        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8676        where
8677            D: serde::Deserializer<'de>,
8678        {
8679            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
8680                ".google.cloud.managedkafka.v1.Cluster.State",
8681            ))
8682        }
8683    }
8684
8685    /// Platform specific configuration properties for a Kafka cluster.
8686    #[derive(Clone, Debug, PartialEq)]
8687    #[non_exhaustive]
8688    pub enum PlatformConfig {
8689        /// Required. Configuration properties for a Kafka cluster deployed to Google
8690        /// Cloud Platform.
8691        GcpConfig(std::boxed::Box<crate::model::GcpConfig>),
8692    }
8693}
8694
8695/// A capacity configuration of a Kafka cluster.
8696#[derive(Clone, Debug, Default, PartialEq)]
8697#[non_exhaustive]
8698pub struct CapacityConfig {
8699    /// Required. The number of vCPUs to provision for the cluster. Minimum: 3.
8700    pub vcpu_count: i64,
8701
8702    /// Required. The memory to provision for the cluster in bytes.
8703    /// The CPU:memory ratio (vCPU:GiB) must be between 1:1 and 1:8.
8704    /// Minimum: 3221225472 (3 GiB).
8705    pub memory_bytes: i64,
8706
8707    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8708}
8709
8710impl CapacityConfig {
8711    pub fn new() -> Self {
8712        std::default::Default::default()
8713    }
8714
8715    /// Sets the value of [vcpu_count][crate::model::CapacityConfig::vcpu_count].
8716    pub fn set_vcpu_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8717        self.vcpu_count = v.into();
8718        self
8719    }
8720
8721    /// Sets the value of [memory_bytes][crate::model::CapacityConfig::memory_bytes].
8722    pub fn set_memory_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8723        self.memory_bytes = v.into();
8724        self
8725    }
8726}
8727
8728impl wkt::message::Message for CapacityConfig {
8729    fn typename() -> &'static str {
8730        "type.googleapis.com/google.cloud.managedkafka.v1.CapacityConfig"
8731    }
8732}
8733
8734#[doc(hidden)]
8735impl<'de> serde::de::Deserialize<'de> for CapacityConfig {
8736    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8737    where
8738        D: serde::Deserializer<'de>,
8739    {
8740        #[allow(non_camel_case_types)]
8741        #[doc(hidden)]
8742        #[derive(PartialEq, Eq, Hash)]
8743        enum __FieldTag {
8744            __vcpu_count,
8745            __memory_bytes,
8746            Unknown(std::string::String),
8747        }
8748        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8749            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8750            where
8751                D: serde::Deserializer<'de>,
8752            {
8753                struct Visitor;
8754                impl<'de> serde::de::Visitor<'de> for Visitor {
8755                    type Value = __FieldTag;
8756                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8757                        formatter.write_str("a field name for CapacityConfig")
8758                    }
8759                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8760                    where
8761                        E: serde::de::Error,
8762                    {
8763                        use std::result::Result::Ok;
8764                        use std::string::ToString;
8765                        match value {
8766                            "vcpuCount" => Ok(__FieldTag::__vcpu_count),
8767                            "vcpu_count" => Ok(__FieldTag::__vcpu_count),
8768                            "memoryBytes" => Ok(__FieldTag::__memory_bytes),
8769                            "memory_bytes" => Ok(__FieldTag::__memory_bytes),
8770                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8771                        }
8772                    }
8773                }
8774                deserializer.deserialize_identifier(Visitor)
8775            }
8776        }
8777        struct Visitor;
8778        impl<'de> serde::de::Visitor<'de> for Visitor {
8779            type Value = CapacityConfig;
8780            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8781                formatter.write_str("struct CapacityConfig")
8782            }
8783            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8784            where
8785                A: serde::de::MapAccess<'de>,
8786            {
8787                #[allow(unused_imports)]
8788                use serde::de::Error;
8789                use std::option::Option::Some;
8790                let mut fields = std::collections::HashSet::new();
8791                let mut result = Self::Value::new();
8792                while let Some(tag) = map.next_key::<__FieldTag>()? {
8793                    #[allow(clippy::match_single_binding)]
8794                    match tag {
8795                        __FieldTag::__vcpu_count => {
8796                            if !fields.insert(__FieldTag::__vcpu_count) {
8797                                return std::result::Result::Err(A::Error::duplicate_field(
8798                                    "multiple values for vcpu_count",
8799                                ));
8800                            }
8801                            struct __With(std::option::Option<i64>);
8802                            impl<'de> serde::de::Deserialize<'de> for __With {
8803                                fn deserialize<D>(
8804                                    deserializer: D,
8805                                ) -> std::result::Result<Self, D::Error>
8806                                where
8807                                    D: serde::de::Deserializer<'de>,
8808                                {
8809                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
8810                                }
8811                            }
8812                            result.vcpu_count = map.next_value::<__With>()?.0.unwrap_or_default();
8813                        }
8814                        __FieldTag::__memory_bytes => {
8815                            if !fields.insert(__FieldTag::__memory_bytes) {
8816                                return std::result::Result::Err(A::Error::duplicate_field(
8817                                    "multiple values for memory_bytes",
8818                                ));
8819                            }
8820                            struct __With(std::option::Option<i64>);
8821                            impl<'de> serde::de::Deserialize<'de> for __With {
8822                                fn deserialize<D>(
8823                                    deserializer: D,
8824                                ) -> std::result::Result<Self, D::Error>
8825                                where
8826                                    D: serde::de::Deserializer<'de>,
8827                                {
8828                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
8829                                }
8830                            }
8831                            result.memory_bytes = map.next_value::<__With>()?.0.unwrap_or_default();
8832                        }
8833                        __FieldTag::Unknown(key) => {
8834                            let value = map.next_value::<serde_json::Value>()?;
8835                            result._unknown_fields.insert(key, value);
8836                        }
8837                    }
8838                }
8839                std::result::Result::Ok(result)
8840            }
8841        }
8842        deserializer.deserialize_any(Visitor)
8843    }
8844}
8845
8846#[doc(hidden)]
8847impl serde::ser::Serialize for CapacityConfig {
8848    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8849    where
8850        S: serde::ser::Serializer,
8851    {
8852        use serde::ser::SerializeMap;
8853        #[allow(unused_imports)]
8854        use std::option::Option::Some;
8855        let mut state = serializer.serialize_map(std::option::Option::None)?;
8856        if !wkt::internal::is_default(&self.vcpu_count) {
8857            struct __With<'a>(&'a i64);
8858            impl<'a> serde::ser::Serialize for __With<'a> {
8859                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8860                where
8861                    S: serde::ser::Serializer,
8862                {
8863                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
8864                }
8865            }
8866            state.serialize_entry("vcpuCount", &__With(&self.vcpu_count))?;
8867        }
8868        if !wkt::internal::is_default(&self.memory_bytes) {
8869            struct __With<'a>(&'a i64);
8870            impl<'a> serde::ser::Serialize for __With<'a> {
8871                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8872                where
8873                    S: serde::ser::Serializer,
8874                {
8875                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
8876                }
8877            }
8878            state.serialize_entry("memoryBytes", &__With(&self.memory_bytes))?;
8879        }
8880        if !self._unknown_fields.is_empty() {
8881            for (key, value) in self._unknown_fields.iter() {
8882                state.serialize_entry(key, &value)?;
8883            }
8884        }
8885        state.end()
8886    }
8887}
8888
8889/// Defines rebalancing behavior of a Kafka cluster.
8890#[derive(Clone, Debug, Default, PartialEq)]
8891#[non_exhaustive]
8892pub struct RebalanceConfig {
8893    /// Optional. The rebalance behavior for the cluster.
8894    /// When not specified, defaults to `NO_REBALANCE`.
8895    pub mode: crate::model::rebalance_config::Mode,
8896
8897    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8898}
8899
8900impl RebalanceConfig {
8901    pub fn new() -> Self {
8902        std::default::Default::default()
8903    }
8904
8905    /// Sets the value of [mode][crate::model::RebalanceConfig::mode].
8906    pub fn set_mode<T: std::convert::Into<crate::model::rebalance_config::Mode>>(
8907        mut self,
8908        v: T,
8909    ) -> Self {
8910        self.mode = v.into();
8911        self
8912    }
8913}
8914
8915impl wkt::message::Message for RebalanceConfig {
8916    fn typename() -> &'static str {
8917        "type.googleapis.com/google.cloud.managedkafka.v1.RebalanceConfig"
8918    }
8919}
8920
8921#[doc(hidden)]
8922impl<'de> serde::de::Deserialize<'de> for RebalanceConfig {
8923    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8924    where
8925        D: serde::Deserializer<'de>,
8926    {
8927        #[allow(non_camel_case_types)]
8928        #[doc(hidden)]
8929        #[derive(PartialEq, Eq, Hash)]
8930        enum __FieldTag {
8931            __mode,
8932            Unknown(std::string::String),
8933        }
8934        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8935            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8936            where
8937                D: serde::Deserializer<'de>,
8938            {
8939                struct Visitor;
8940                impl<'de> serde::de::Visitor<'de> for Visitor {
8941                    type Value = __FieldTag;
8942                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8943                        formatter.write_str("a field name for RebalanceConfig")
8944                    }
8945                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8946                    where
8947                        E: serde::de::Error,
8948                    {
8949                        use std::result::Result::Ok;
8950                        use std::string::ToString;
8951                        match value {
8952                            "mode" => Ok(__FieldTag::__mode),
8953                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8954                        }
8955                    }
8956                }
8957                deserializer.deserialize_identifier(Visitor)
8958            }
8959        }
8960        struct Visitor;
8961        impl<'de> serde::de::Visitor<'de> for Visitor {
8962            type Value = RebalanceConfig;
8963            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8964                formatter.write_str("struct RebalanceConfig")
8965            }
8966            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8967            where
8968                A: serde::de::MapAccess<'de>,
8969            {
8970                #[allow(unused_imports)]
8971                use serde::de::Error;
8972                use std::option::Option::Some;
8973                let mut fields = std::collections::HashSet::new();
8974                let mut result = Self::Value::new();
8975                while let Some(tag) = map.next_key::<__FieldTag>()? {
8976                    #[allow(clippy::match_single_binding)]
8977                    match tag {
8978                        __FieldTag::__mode => {
8979                            if !fields.insert(__FieldTag::__mode) {
8980                                return std::result::Result::Err(A::Error::duplicate_field(
8981                                    "multiple values for mode",
8982                                ));
8983                            }
8984                            result.mode = map.next_value::<std::option::Option<crate::model::rebalance_config::Mode>>()?.unwrap_or_default();
8985                        }
8986                        __FieldTag::Unknown(key) => {
8987                            let value = map.next_value::<serde_json::Value>()?;
8988                            result._unknown_fields.insert(key, value);
8989                        }
8990                    }
8991                }
8992                std::result::Result::Ok(result)
8993            }
8994        }
8995        deserializer.deserialize_any(Visitor)
8996    }
8997}
8998
8999#[doc(hidden)]
9000impl serde::ser::Serialize for RebalanceConfig {
9001    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9002    where
9003        S: serde::ser::Serializer,
9004    {
9005        use serde::ser::SerializeMap;
9006        #[allow(unused_imports)]
9007        use std::option::Option::Some;
9008        let mut state = serializer.serialize_map(std::option::Option::None)?;
9009        if !wkt::internal::is_default(&self.mode) {
9010            state.serialize_entry("mode", &self.mode)?;
9011        }
9012        if !self._unknown_fields.is_empty() {
9013            for (key, value) in self._unknown_fields.iter() {
9014                state.serialize_entry(key, &value)?;
9015            }
9016        }
9017        state.end()
9018    }
9019}
9020
9021/// Defines additional types related to [RebalanceConfig].
9022pub mod rebalance_config {
9023    #[allow(unused_imports)]
9024    use super::*;
9025
9026    /// The partition rebalance mode for the cluster.
9027    ///
9028    /// # Working with unknown values
9029    ///
9030    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9031    /// additional enum variants at any time. Adding new variants is not considered
9032    /// a breaking change. Applications should write their code in anticipation of:
9033    ///
9034    /// - New values appearing in future releases of the client library, **and**
9035    /// - New values received dynamically, without application changes.
9036    ///
9037    /// Please consult the [Working with enums] section in the user guide for some
9038    /// guidelines.
9039    ///
9040    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9041    #[derive(Clone, Debug, PartialEq)]
9042    #[non_exhaustive]
9043    pub enum Mode {
9044        /// A mode was not specified. Do not use.
9045        Unspecified,
9046        /// Do not rebalance automatically.
9047        NoRebalance,
9048        /// Automatically rebalance topic partitions among brokers when the
9049        /// cluster is scaled up.
9050        AutoRebalanceOnScaleUp,
9051        /// If set, the enum was initialized with an unknown value.
9052        ///
9053        /// Applications can examine the value using [Mode::value] or
9054        /// [Mode::name].
9055        UnknownValue(mode::UnknownValue),
9056    }
9057
9058    #[doc(hidden)]
9059    pub mod mode {
9060        #[allow(unused_imports)]
9061        use super::*;
9062        #[derive(Clone, Debug, PartialEq)]
9063        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9064    }
9065
9066    impl Mode {
9067        /// Gets the enum value.
9068        ///
9069        /// Returns `None` if the enum contains an unknown value deserialized from
9070        /// the string representation of enums.
9071        pub fn value(&self) -> std::option::Option<i32> {
9072            match self {
9073                Self::Unspecified => std::option::Option::Some(0),
9074                Self::NoRebalance => std::option::Option::Some(1),
9075                Self::AutoRebalanceOnScaleUp => std::option::Option::Some(2),
9076                Self::UnknownValue(u) => u.0.value(),
9077            }
9078        }
9079
9080        /// Gets the enum value as a string.
9081        ///
9082        /// Returns `None` if the enum contains an unknown value deserialized from
9083        /// the integer representation of enums.
9084        pub fn name(&self) -> std::option::Option<&str> {
9085            match self {
9086                Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
9087                Self::NoRebalance => std::option::Option::Some("NO_REBALANCE"),
9088                Self::AutoRebalanceOnScaleUp => {
9089                    std::option::Option::Some("AUTO_REBALANCE_ON_SCALE_UP")
9090                }
9091                Self::UnknownValue(u) => u.0.name(),
9092            }
9093        }
9094    }
9095
9096    impl std::default::Default for Mode {
9097        fn default() -> Self {
9098            use std::convert::From;
9099            Self::from(0)
9100        }
9101    }
9102
9103    impl std::fmt::Display for Mode {
9104        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9105            wkt::internal::display_enum(f, self.name(), self.value())
9106        }
9107    }
9108
9109    impl std::convert::From<i32> for Mode {
9110        fn from(value: i32) -> Self {
9111            match value {
9112                0 => Self::Unspecified,
9113                1 => Self::NoRebalance,
9114                2 => Self::AutoRebalanceOnScaleUp,
9115                _ => Self::UnknownValue(mode::UnknownValue(
9116                    wkt::internal::UnknownEnumValue::Integer(value),
9117                )),
9118            }
9119        }
9120    }
9121
9122    impl std::convert::From<&str> for Mode {
9123        fn from(value: &str) -> Self {
9124            use std::string::ToString;
9125            match value {
9126                "MODE_UNSPECIFIED" => Self::Unspecified,
9127                "NO_REBALANCE" => Self::NoRebalance,
9128                "AUTO_REBALANCE_ON_SCALE_UP" => Self::AutoRebalanceOnScaleUp,
9129                _ => Self::UnknownValue(mode::UnknownValue(
9130                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9131                )),
9132            }
9133        }
9134    }
9135
9136    impl serde::ser::Serialize for Mode {
9137        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9138        where
9139            S: serde::Serializer,
9140        {
9141            match self {
9142                Self::Unspecified => serializer.serialize_i32(0),
9143                Self::NoRebalance => serializer.serialize_i32(1),
9144                Self::AutoRebalanceOnScaleUp => serializer.serialize_i32(2),
9145                Self::UnknownValue(u) => u.0.serialize(serializer),
9146            }
9147        }
9148    }
9149
9150    impl<'de> serde::de::Deserialize<'de> for Mode {
9151        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9152        where
9153            D: serde::Deserializer<'de>,
9154        {
9155            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
9156                ".google.cloud.managedkafka.v1.RebalanceConfig.Mode",
9157            ))
9158        }
9159    }
9160}
9161
9162/// The configuration of a Virtual Private Cloud (VPC) network that can access
9163/// the Kafka cluster.
9164#[derive(Clone, Debug, Default, PartialEq)]
9165#[non_exhaustive]
9166pub struct NetworkConfig {
9167    /// Required. Name of the VPC subnet in which to create Private Service Connect
9168    /// (PSC) endpoints for the Kafka brokers and bootstrap address. Structured
9169    /// like: projects/{project}/regions/{region}/subnetworks/{subnet_id}
9170    ///
9171    /// The subnet must be located in the same region as the Kafka cluster. The
9172    /// project may differ. Multiple subnets from the same parent network must not
9173    /// be specified.
9174    pub subnet: std::string::String,
9175
9176    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9177}
9178
9179impl NetworkConfig {
9180    pub fn new() -> Self {
9181        std::default::Default::default()
9182    }
9183
9184    /// Sets the value of [subnet][crate::model::NetworkConfig::subnet].
9185    pub fn set_subnet<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9186        self.subnet = v.into();
9187        self
9188    }
9189}
9190
9191impl wkt::message::Message for NetworkConfig {
9192    fn typename() -> &'static str {
9193        "type.googleapis.com/google.cloud.managedkafka.v1.NetworkConfig"
9194    }
9195}
9196
9197#[doc(hidden)]
9198impl<'de> serde::de::Deserialize<'de> for NetworkConfig {
9199    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9200    where
9201        D: serde::Deserializer<'de>,
9202    {
9203        #[allow(non_camel_case_types)]
9204        #[doc(hidden)]
9205        #[derive(PartialEq, Eq, Hash)]
9206        enum __FieldTag {
9207            __subnet,
9208            Unknown(std::string::String),
9209        }
9210        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9211            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9212            where
9213                D: serde::Deserializer<'de>,
9214            {
9215                struct Visitor;
9216                impl<'de> serde::de::Visitor<'de> for Visitor {
9217                    type Value = __FieldTag;
9218                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9219                        formatter.write_str("a field name for NetworkConfig")
9220                    }
9221                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9222                    where
9223                        E: serde::de::Error,
9224                    {
9225                        use std::result::Result::Ok;
9226                        use std::string::ToString;
9227                        match value {
9228                            "subnet" => Ok(__FieldTag::__subnet),
9229                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9230                        }
9231                    }
9232                }
9233                deserializer.deserialize_identifier(Visitor)
9234            }
9235        }
9236        struct Visitor;
9237        impl<'de> serde::de::Visitor<'de> for Visitor {
9238            type Value = NetworkConfig;
9239            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9240                formatter.write_str("struct NetworkConfig")
9241            }
9242            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9243            where
9244                A: serde::de::MapAccess<'de>,
9245            {
9246                #[allow(unused_imports)]
9247                use serde::de::Error;
9248                use std::option::Option::Some;
9249                let mut fields = std::collections::HashSet::new();
9250                let mut result = Self::Value::new();
9251                while let Some(tag) = map.next_key::<__FieldTag>()? {
9252                    #[allow(clippy::match_single_binding)]
9253                    match tag {
9254                        __FieldTag::__subnet => {
9255                            if !fields.insert(__FieldTag::__subnet) {
9256                                return std::result::Result::Err(A::Error::duplicate_field(
9257                                    "multiple values for subnet",
9258                                ));
9259                            }
9260                            result.subnet = map
9261                                .next_value::<std::option::Option<std::string::String>>()?
9262                                .unwrap_or_default();
9263                        }
9264                        __FieldTag::Unknown(key) => {
9265                            let value = map.next_value::<serde_json::Value>()?;
9266                            result._unknown_fields.insert(key, value);
9267                        }
9268                    }
9269                }
9270                std::result::Result::Ok(result)
9271            }
9272        }
9273        deserializer.deserialize_any(Visitor)
9274    }
9275}
9276
9277#[doc(hidden)]
9278impl serde::ser::Serialize for NetworkConfig {
9279    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9280    where
9281        S: serde::ser::Serializer,
9282    {
9283        use serde::ser::SerializeMap;
9284        #[allow(unused_imports)]
9285        use std::option::Option::Some;
9286        let mut state = serializer.serialize_map(std::option::Option::None)?;
9287        if !self.subnet.is_empty() {
9288            state.serialize_entry("subnet", &self.subnet)?;
9289        }
9290        if !self._unknown_fields.is_empty() {
9291            for (key, value) in self._unknown_fields.iter() {
9292                state.serialize_entry(key, &value)?;
9293            }
9294        }
9295        state.end()
9296    }
9297}
9298
9299/// The configuration of access to the Kafka cluster.
9300#[derive(Clone, Debug, Default, PartialEq)]
9301#[non_exhaustive]
9302pub struct AccessConfig {
9303    /// Required. Virtual Private Cloud (VPC) networks that must be granted direct
9304    /// access to the Kafka cluster. Minimum of 1 network is required. Maximum 10
9305    /// networks can be specified.
9306    pub network_configs: std::vec::Vec<crate::model::NetworkConfig>,
9307
9308    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9309}
9310
9311impl AccessConfig {
9312    pub fn new() -> Self {
9313        std::default::Default::default()
9314    }
9315
9316    /// Sets the value of [network_configs][crate::model::AccessConfig::network_configs].
9317    pub fn set_network_configs<T, V>(mut self, v: T) -> Self
9318    where
9319        T: std::iter::IntoIterator<Item = V>,
9320        V: std::convert::Into<crate::model::NetworkConfig>,
9321    {
9322        use std::iter::Iterator;
9323        self.network_configs = v.into_iter().map(|i| i.into()).collect();
9324        self
9325    }
9326}
9327
9328impl wkt::message::Message for AccessConfig {
9329    fn typename() -> &'static str {
9330        "type.googleapis.com/google.cloud.managedkafka.v1.AccessConfig"
9331    }
9332}
9333
9334#[doc(hidden)]
9335impl<'de> serde::de::Deserialize<'de> for AccessConfig {
9336    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9337    where
9338        D: serde::Deserializer<'de>,
9339    {
9340        #[allow(non_camel_case_types)]
9341        #[doc(hidden)]
9342        #[derive(PartialEq, Eq, Hash)]
9343        enum __FieldTag {
9344            __network_configs,
9345            Unknown(std::string::String),
9346        }
9347        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9348            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9349            where
9350                D: serde::Deserializer<'de>,
9351            {
9352                struct Visitor;
9353                impl<'de> serde::de::Visitor<'de> for Visitor {
9354                    type Value = __FieldTag;
9355                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9356                        formatter.write_str("a field name for AccessConfig")
9357                    }
9358                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9359                    where
9360                        E: serde::de::Error,
9361                    {
9362                        use std::result::Result::Ok;
9363                        use std::string::ToString;
9364                        match value {
9365                            "networkConfigs" => Ok(__FieldTag::__network_configs),
9366                            "network_configs" => Ok(__FieldTag::__network_configs),
9367                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9368                        }
9369                    }
9370                }
9371                deserializer.deserialize_identifier(Visitor)
9372            }
9373        }
9374        struct Visitor;
9375        impl<'de> serde::de::Visitor<'de> for Visitor {
9376            type Value = AccessConfig;
9377            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9378                formatter.write_str("struct AccessConfig")
9379            }
9380            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9381            where
9382                A: serde::de::MapAccess<'de>,
9383            {
9384                #[allow(unused_imports)]
9385                use serde::de::Error;
9386                use std::option::Option::Some;
9387                let mut fields = std::collections::HashSet::new();
9388                let mut result = Self::Value::new();
9389                while let Some(tag) = map.next_key::<__FieldTag>()? {
9390                    #[allow(clippy::match_single_binding)]
9391                    match tag {
9392                        __FieldTag::__network_configs => {
9393                            if !fields.insert(__FieldTag::__network_configs) {
9394                                return std::result::Result::Err(A::Error::duplicate_field(
9395                                    "multiple values for network_configs",
9396                                ));
9397                            }
9398                            result.network_configs = map.next_value::<std::option::Option<std::vec::Vec<crate::model::NetworkConfig>>>()?.unwrap_or_default();
9399                        }
9400                        __FieldTag::Unknown(key) => {
9401                            let value = map.next_value::<serde_json::Value>()?;
9402                            result._unknown_fields.insert(key, value);
9403                        }
9404                    }
9405                }
9406                std::result::Result::Ok(result)
9407            }
9408        }
9409        deserializer.deserialize_any(Visitor)
9410    }
9411}
9412
9413#[doc(hidden)]
9414impl serde::ser::Serialize for AccessConfig {
9415    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9416    where
9417        S: serde::ser::Serializer,
9418    {
9419        use serde::ser::SerializeMap;
9420        #[allow(unused_imports)]
9421        use std::option::Option::Some;
9422        let mut state = serializer.serialize_map(std::option::Option::None)?;
9423        if !self.network_configs.is_empty() {
9424            state.serialize_entry("networkConfigs", &self.network_configs)?;
9425        }
9426        if !self._unknown_fields.is_empty() {
9427            for (key, value) in self._unknown_fields.iter() {
9428                state.serialize_entry(key, &value)?;
9429            }
9430        }
9431        state.end()
9432    }
9433}
9434
9435/// Configuration properties for a Kafka cluster deployed to Google Cloud
9436/// Platform.
9437#[derive(Clone, Debug, Default, PartialEq)]
9438#[non_exhaustive]
9439pub struct GcpConfig {
9440    /// Required. Access configuration for the Kafka cluster.
9441    pub access_config: std::option::Option<crate::model::AccessConfig>,
9442
9443    /// Optional. Immutable. The Cloud KMS Key name to use for encryption. The key
9444    /// must be located in the same region as the cluster and cannot be changed.
9445    /// Structured like:
9446    /// projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}.
9447    pub kms_key: std::string::String,
9448
9449    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9450}
9451
9452impl GcpConfig {
9453    pub fn new() -> Self {
9454        std::default::Default::default()
9455    }
9456
9457    /// Sets the value of [access_config][crate::model::GcpConfig::access_config].
9458    pub fn set_access_config<T>(mut self, v: T) -> Self
9459    where
9460        T: std::convert::Into<crate::model::AccessConfig>,
9461    {
9462        self.access_config = std::option::Option::Some(v.into());
9463        self
9464    }
9465
9466    /// Sets or clears the value of [access_config][crate::model::GcpConfig::access_config].
9467    pub fn set_or_clear_access_config<T>(mut self, v: std::option::Option<T>) -> Self
9468    where
9469        T: std::convert::Into<crate::model::AccessConfig>,
9470    {
9471        self.access_config = v.map(|x| x.into());
9472        self
9473    }
9474
9475    /// Sets the value of [kms_key][crate::model::GcpConfig::kms_key].
9476    pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9477        self.kms_key = v.into();
9478        self
9479    }
9480}
9481
9482impl wkt::message::Message for GcpConfig {
9483    fn typename() -> &'static str {
9484        "type.googleapis.com/google.cloud.managedkafka.v1.GcpConfig"
9485    }
9486}
9487
9488#[doc(hidden)]
9489impl<'de> serde::de::Deserialize<'de> for GcpConfig {
9490    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9491    where
9492        D: serde::Deserializer<'de>,
9493    {
9494        #[allow(non_camel_case_types)]
9495        #[doc(hidden)]
9496        #[derive(PartialEq, Eq, Hash)]
9497        enum __FieldTag {
9498            __access_config,
9499            __kms_key,
9500            Unknown(std::string::String),
9501        }
9502        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9503            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9504            where
9505                D: serde::Deserializer<'de>,
9506            {
9507                struct Visitor;
9508                impl<'de> serde::de::Visitor<'de> for Visitor {
9509                    type Value = __FieldTag;
9510                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9511                        formatter.write_str("a field name for GcpConfig")
9512                    }
9513                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9514                    where
9515                        E: serde::de::Error,
9516                    {
9517                        use std::result::Result::Ok;
9518                        use std::string::ToString;
9519                        match value {
9520                            "accessConfig" => Ok(__FieldTag::__access_config),
9521                            "access_config" => Ok(__FieldTag::__access_config),
9522                            "kmsKey" => Ok(__FieldTag::__kms_key),
9523                            "kms_key" => Ok(__FieldTag::__kms_key),
9524                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9525                        }
9526                    }
9527                }
9528                deserializer.deserialize_identifier(Visitor)
9529            }
9530        }
9531        struct Visitor;
9532        impl<'de> serde::de::Visitor<'de> for Visitor {
9533            type Value = GcpConfig;
9534            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9535                formatter.write_str("struct GcpConfig")
9536            }
9537            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9538            where
9539                A: serde::de::MapAccess<'de>,
9540            {
9541                #[allow(unused_imports)]
9542                use serde::de::Error;
9543                use std::option::Option::Some;
9544                let mut fields = std::collections::HashSet::new();
9545                let mut result = Self::Value::new();
9546                while let Some(tag) = map.next_key::<__FieldTag>()? {
9547                    #[allow(clippy::match_single_binding)]
9548                    match tag {
9549                        __FieldTag::__access_config => {
9550                            if !fields.insert(__FieldTag::__access_config) {
9551                                return std::result::Result::Err(A::Error::duplicate_field(
9552                                    "multiple values for access_config",
9553                                ));
9554                            }
9555                            result.access_config = map
9556                                .next_value::<std::option::Option<crate::model::AccessConfig>>()?;
9557                        }
9558                        __FieldTag::__kms_key => {
9559                            if !fields.insert(__FieldTag::__kms_key) {
9560                                return std::result::Result::Err(A::Error::duplicate_field(
9561                                    "multiple values for kms_key",
9562                                ));
9563                            }
9564                            result.kms_key = map
9565                                .next_value::<std::option::Option<std::string::String>>()?
9566                                .unwrap_or_default();
9567                        }
9568                        __FieldTag::Unknown(key) => {
9569                            let value = map.next_value::<serde_json::Value>()?;
9570                            result._unknown_fields.insert(key, value);
9571                        }
9572                    }
9573                }
9574                std::result::Result::Ok(result)
9575            }
9576        }
9577        deserializer.deserialize_any(Visitor)
9578    }
9579}
9580
9581#[doc(hidden)]
9582impl serde::ser::Serialize for GcpConfig {
9583    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9584    where
9585        S: serde::ser::Serializer,
9586    {
9587        use serde::ser::SerializeMap;
9588        #[allow(unused_imports)]
9589        use std::option::Option::Some;
9590        let mut state = serializer.serialize_map(std::option::Option::None)?;
9591        if self.access_config.is_some() {
9592            state.serialize_entry("accessConfig", &self.access_config)?;
9593        }
9594        if !self.kms_key.is_empty() {
9595            state.serialize_entry("kmsKey", &self.kms_key)?;
9596        }
9597        if !self._unknown_fields.is_empty() {
9598            for (key, value) in self._unknown_fields.iter() {
9599                state.serialize_entry(key, &value)?;
9600            }
9601        }
9602        state.end()
9603    }
9604}
9605
9606/// A Kafka topic in a given cluster.
9607#[derive(Clone, Debug, Default, PartialEq)]
9608#[non_exhaustive]
9609pub struct Topic {
9610    /// Identifier. The name of the topic. The `topic` segment is used when
9611    /// connecting directly to the cluster. Structured like:
9612    /// projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}
9613    pub name: std::string::String,
9614
9615    /// Required. The number of partitions this topic has. The partition count can
9616    /// only be increased, not decreased. Please note that if partitions are
9617    /// increased for a topic that has a key, the partitioning logic or the
9618    /// ordering of the messages will be affected.
9619    pub partition_count: i32,
9620
9621    /// Required. Immutable. The number of replicas of each partition. A
9622    /// replication factor of 3 is recommended for high availability.
9623    pub replication_factor: i32,
9624
9625    /// Optional. Configurations for the topic that are overridden from the cluster
9626    /// defaults. The key of the map is a Kafka topic property name, for example:
9627    /// `cleanup.policy`, `compression.type`.
9628    pub configs: std::collections::HashMap<std::string::String, std::string::String>,
9629
9630    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9631}
9632
9633impl Topic {
9634    pub fn new() -> Self {
9635        std::default::Default::default()
9636    }
9637
9638    /// Sets the value of [name][crate::model::Topic::name].
9639    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9640        self.name = v.into();
9641        self
9642    }
9643
9644    /// Sets the value of [partition_count][crate::model::Topic::partition_count].
9645    pub fn set_partition_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9646        self.partition_count = v.into();
9647        self
9648    }
9649
9650    /// Sets the value of [replication_factor][crate::model::Topic::replication_factor].
9651    pub fn set_replication_factor<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9652        self.replication_factor = v.into();
9653        self
9654    }
9655
9656    /// Sets the value of [configs][crate::model::Topic::configs].
9657    pub fn set_configs<T, K, V>(mut self, v: T) -> Self
9658    where
9659        T: std::iter::IntoIterator<Item = (K, V)>,
9660        K: std::convert::Into<std::string::String>,
9661        V: std::convert::Into<std::string::String>,
9662    {
9663        use std::iter::Iterator;
9664        self.configs = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9665        self
9666    }
9667}
9668
9669impl wkt::message::Message for Topic {
9670    fn typename() -> &'static str {
9671        "type.googleapis.com/google.cloud.managedkafka.v1.Topic"
9672    }
9673}
9674
9675#[doc(hidden)]
9676impl<'de> serde::de::Deserialize<'de> for Topic {
9677    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9678    where
9679        D: serde::Deserializer<'de>,
9680    {
9681        #[allow(non_camel_case_types)]
9682        #[doc(hidden)]
9683        #[derive(PartialEq, Eq, Hash)]
9684        enum __FieldTag {
9685            __name,
9686            __partition_count,
9687            __replication_factor,
9688            __configs,
9689            Unknown(std::string::String),
9690        }
9691        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9692            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9693            where
9694                D: serde::Deserializer<'de>,
9695            {
9696                struct Visitor;
9697                impl<'de> serde::de::Visitor<'de> for Visitor {
9698                    type Value = __FieldTag;
9699                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9700                        formatter.write_str("a field name for Topic")
9701                    }
9702                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9703                    where
9704                        E: serde::de::Error,
9705                    {
9706                        use std::result::Result::Ok;
9707                        use std::string::ToString;
9708                        match value {
9709                            "name" => Ok(__FieldTag::__name),
9710                            "partitionCount" => Ok(__FieldTag::__partition_count),
9711                            "partition_count" => Ok(__FieldTag::__partition_count),
9712                            "replicationFactor" => Ok(__FieldTag::__replication_factor),
9713                            "replication_factor" => Ok(__FieldTag::__replication_factor),
9714                            "configs" => Ok(__FieldTag::__configs),
9715                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9716                        }
9717                    }
9718                }
9719                deserializer.deserialize_identifier(Visitor)
9720            }
9721        }
9722        struct Visitor;
9723        impl<'de> serde::de::Visitor<'de> for Visitor {
9724            type Value = Topic;
9725            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9726                formatter.write_str("struct Topic")
9727            }
9728            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9729            where
9730                A: serde::de::MapAccess<'de>,
9731            {
9732                #[allow(unused_imports)]
9733                use serde::de::Error;
9734                use std::option::Option::Some;
9735                let mut fields = std::collections::HashSet::new();
9736                let mut result = Self::Value::new();
9737                while let Some(tag) = map.next_key::<__FieldTag>()? {
9738                    #[allow(clippy::match_single_binding)]
9739                    match tag {
9740                        __FieldTag::__name => {
9741                            if !fields.insert(__FieldTag::__name) {
9742                                return std::result::Result::Err(A::Error::duplicate_field(
9743                                    "multiple values for name",
9744                                ));
9745                            }
9746                            result.name = map
9747                                .next_value::<std::option::Option<std::string::String>>()?
9748                                .unwrap_or_default();
9749                        }
9750                        __FieldTag::__partition_count => {
9751                            if !fields.insert(__FieldTag::__partition_count) {
9752                                return std::result::Result::Err(A::Error::duplicate_field(
9753                                    "multiple values for partition_count",
9754                                ));
9755                            }
9756                            struct __With(std::option::Option<i32>);
9757                            impl<'de> serde::de::Deserialize<'de> for __With {
9758                                fn deserialize<D>(
9759                                    deserializer: D,
9760                                ) -> std::result::Result<Self, D::Error>
9761                                where
9762                                    D: serde::de::Deserializer<'de>,
9763                                {
9764                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
9765                                }
9766                            }
9767                            result.partition_count =
9768                                map.next_value::<__With>()?.0.unwrap_or_default();
9769                        }
9770                        __FieldTag::__replication_factor => {
9771                            if !fields.insert(__FieldTag::__replication_factor) {
9772                                return std::result::Result::Err(A::Error::duplicate_field(
9773                                    "multiple values for replication_factor",
9774                                ));
9775                            }
9776                            struct __With(std::option::Option<i32>);
9777                            impl<'de> serde::de::Deserialize<'de> for __With {
9778                                fn deserialize<D>(
9779                                    deserializer: D,
9780                                ) -> std::result::Result<Self, D::Error>
9781                                where
9782                                    D: serde::de::Deserializer<'de>,
9783                                {
9784                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
9785                                }
9786                            }
9787                            result.replication_factor =
9788                                map.next_value::<__With>()?.0.unwrap_or_default();
9789                        }
9790                        __FieldTag::__configs => {
9791                            if !fields.insert(__FieldTag::__configs) {
9792                                return std::result::Result::Err(A::Error::duplicate_field(
9793                                    "multiple values for configs",
9794                                ));
9795                            }
9796                            result.configs = map
9797                                .next_value::<std::option::Option<
9798                                    std::collections::HashMap<
9799                                        std::string::String,
9800                                        std::string::String,
9801                                    >,
9802                                >>()?
9803                                .unwrap_or_default();
9804                        }
9805                        __FieldTag::Unknown(key) => {
9806                            let value = map.next_value::<serde_json::Value>()?;
9807                            result._unknown_fields.insert(key, value);
9808                        }
9809                    }
9810                }
9811                std::result::Result::Ok(result)
9812            }
9813        }
9814        deserializer.deserialize_any(Visitor)
9815    }
9816}
9817
9818#[doc(hidden)]
9819impl serde::ser::Serialize for Topic {
9820    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9821    where
9822        S: serde::ser::Serializer,
9823    {
9824        use serde::ser::SerializeMap;
9825        #[allow(unused_imports)]
9826        use std::option::Option::Some;
9827        let mut state = serializer.serialize_map(std::option::Option::None)?;
9828        if !self.name.is_empty() {
9829            state.serialize_entry("name", &self.name)?;
9830        }
9831        if !wkt::internal::is_default(&self.partition_count) {
9832            struct __With<'a>(&'a i32);
9833            impl<'a> serde::ser::Serialize for __With<'a> {
9834                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9835                where
9836                    S: serde::ser::Serializer,
9837                {
9838                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
9839                }
9840            }
9841            state.serialize_entry("partitionCount", &__With(&self.partition_count))?;
9842        }
9843        if !wkt::internal::is_default(&self.replication_factor) {
9844            struct __With<'a>(&'a i32);
9845            impl<'a> serde::ser::Serialize for __With<'a> {
9846                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9847                where
9848                    S: serde::ser::Serializer,
9849                {
9850                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
9851                }
9852            }
9853            state.serialize_entry("replicationFactor", &__With(&self.replication_factor))?;
9854        }
9855        if !self.configs.is_empty() {
9856            state.serialize_entry("configs", &self.configs)?;
9857        }
9858        if !self._unknown_fields.is_empty() {
9859            for (key, value) in self._unknown_fields.iter() {
9860                state.serialize_entry(key, &value)?;
9861            }
9862        }
9863        state.end()
9864    }
9865}
9866
9867/// Metadata for a consumer group corresponding to a specific topic.
9868#[derive(Clone, Debug, Default, PartialEq)]
9869#[non_exhaustive]
9870pub struct ConsumerTopicMetadata {
9871    /// Optional. Metadata for this consumer group and topic for all partition
9872    /// indexes it has metadata for.
9873    pub partitions: std::collections::HashMap<i32, crate::model::ConsumerPartitionMetadata>,
9874
9875    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9876}
9877
9878impl ConsumerTopicMetadata {
9879    pub fn new() -> Self {
9880        std::default::Default::default()
9881    }
9882
9883    /// Sets the value of [partitions][crate::model::ConsumerTopicMetadata::partitions].
9884    pub fn set_partitions<T, K, V>(mut self, v: T) -> Self
9885    where
9886        T: std::iter::IntoIterator<Item = (K, V)>,
9887        K: std::convert::Into<i32>,
9888        V: std::convert::Into<crate::model::ConsumerPartitionMetadata>,
9889    {
9890        use std::iter::Iterator;
9891        self.partitions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9892        self
9893    }
9894}
9895
9896impl wkt::message::Message for ConsumerTopicMetadata {
9897    fn typename() -> &'static str {
9898        "type.googleapis.com/google.cloud.managedkafka.v1.ConsumerTopicMetadata"
9899    }
9900}
9901
9902#[doc(hidden)]
9903impl<'de> serde::de::Deserialize<'de> for ConsumerTopicMetadata {
9904    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9905    where
9906        D: serde::Deserializer<'de>,
9907    {
9908        #[allow(non_camel_case_types)]
9909        #[doc(hidden)]
9910        #[derive(PartialEq, Eq, Hash)]
9911        enum __FieldTag {
9912            __partitions,
9913            Unknown(std::string::String),
9914        }
9915        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9916            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9917            where
9918                D: serde::Deserializer<'de>,
9919            {
9920                struct Visitor;
9921                impl<'de> serde::de::Visitor<'de> for Visitor {
9922                    type Value = __FieldTag;
9923                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9924                        formatter.write_str("a field name for ConsumerTopicMetadata")
9925                    }
9926                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9927                    where
9928                        E: serde::de::Error,
9929                    {
9930                        use std::result::Result::Ok;
9931                        use std::string::ToString;
9932                        match value {
9933                            "partitions" => Ok(__FieldTag::__partitions),
9934                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9935                        }
9936                    }
9937                }
9938                deserializer.deserialize_identifier(Visitor)
9939            }
9940        }
9941        struct Visitor;
9942        impl<'de> serde::de::Visitor<'de> for Visitor {
9943            type Value = ConsumerTopicMetadata;
9944            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9945                formatter.write_str("struct ConsumerTopicMetadata")
9946            }
9947            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9948            where
9949                A: serde::de::MapAccess<'de>,
9950            {
9951                #[allow(unused_imports)]
9952                use serde::de::Error;
9953                use std::option::Option::Some;
9954                let mut fields = std::collections::HashSet::new();
9955                let mut result = Self::Value::new();
9956                while let Some(tag) = map.next_key::<__FieldTag>()? {
9957                    #[allow(clippy::match_single_binding)]
9958                    match tag {
9959                        __FieldTag::__partitions => {
9960                            if !fields.insert(__FieldTag::__partitions) {
9961                                return std::result::Result::Err(A::Error::duplicate_field(
9962                                    "multiple values for partitions",
9963                                ));
9964                            }
9965                            struct __With(
9966                                std::option::Option<
9967                                    std::collections::HashMap<
9968                                        i32,
9969                                        crate::model::ConsumerPartitionMetadata,
9970                                    >,
9971                                >,
9972                            );
9973                            impl<'de> serde::de::Deserialize<'de> for __With {
9974                                fn deserialize<D>(
9975                                    deserializer: D,
9976                                ) -> std::result::Result<Self, D::Error>
9977                                where
9978                                    D: serde::de::Deserializer<'de>,
9979                                {
9980                                    serde_with::As::<
9981                                        std::option::Option<
9982                                            std::collections::HashMap<
9983                                                wkt::internal::I32,
9984                                                serde_with::Same,
9985                                            >,
9986                                        >,
9987                                    >::deserialize(deserializer)
9988                                    .map(__With)
9989                                }
9990                            }
9991                            result.partitions = map.next_value::<__With>()?.0.unwrap_or_default();
9992                        }
9993                        __FieldTag::Unknown(key) => {
9994                            let value = map.next_value::<serde_json::Value>()?;
9995                            result._unknown_fields.insert(key, value);
9996                        }
9997                    }
9998                }
9999                std::result::Result::Ok(result)
10000            }
10001        }
10002        deserializer.deserialize_any(Visitor)
10003    }
10004}
10005
10006#[doc(hidden)]
10007impl serde::ser::Serialize for ConsumerTopicMetadata {
10008    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10009    where
10010        S: serde::ser::Serializer,
10011    {
10012        use serde::ser::SerializeMap;
10013        #[allow(unused_imports)]
10014        use std::option::Option::Some;
10015        let mut state = serializer.serialize_map(std::option::Option::None)?;
10016        if !self.partitions.is_empty() {
10017            struct __With<'a>(
10018                &'a std::collections::HashMap<i32, crate::model::ConsumerPartitionMetadata>,
10019            );
10020            impl<'a> serde::ser::Serialize for __With<'a> {
10021                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10022                where
10023                    S: serde::ser::Serializer,
10024                {
10025                    serde_with::As::< std::collections::HashMap<wkt::internal::I32, serde_with::Same> >::serialize(self.0, serializer)
10026                }
10027            }
10028            state.serialize_entry("partitions", &__With(&self.partitions))?;
10029        }
10030        if !self._unknown_fields.is_empty() {
10031            for (key, value) in self._unknown_fields.iter() {
10032                state.serialize_entry(key, &value)?;
10033            }
10034        }
10035        state.end()
10036    }
10037}
10038
10039/// Metadata for a consumer group corresponding to a specific partition.
10040#[derive(Clone, Debug, Default, PartialEq)]
10041#[non_exhaustive]
10042pub struct ConsumerPartitionMetadata {
10043    /// Required. The current offset for this partition, or 0 if no offset has been
10044    /// committed.
10045    pub offset: i64,
10046
10047    /// Optional. The associated metadata for this partition, or empty if it does
10048    /// not exist.
10049    pub metadata: std::string::String,
10050
10051    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10052}
10053
10054impl ConsumerPartitionMetadata {
10055    pub fn new() -> Self {
10056        std::default::Default::default()
10057    }
10058
10059    /// Sets the value of [offset][crate::model::ConsumerPartitionMetadata::offset].
10060    pub fn set_offset<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
10061        self.offset = v.into();
10062        self
10063    }
10064
10065    /// Sets the value of [metadata][crate::model::ConsumerPartitionMetadata::metadata].
10066    pub fn set_metadata<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10067        self.metadata = v.into();
10068        self
10069    }
10070}
10071
10072impl wkt::message::Message for ConsumerPartitionMetadata {
10073    fn typename() -> &'static str {
10074        "type.googleapis.com/google.cloud.managedkafka.v1.ConsumerPartitionMetadata"
10075    }
10076}
10077
10078#[doc(hidden)]
10079impl<'de> serde::de::Deserialize<'de> for ConsumerPartitionMetadata {
10080    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10081    where
10082        D: serde::Deserializer<'de>,
10083    {
10084        #[allow(non_camel_case_types)]
10085        #[doc(hidden)]
10086        #[derive(PartialEq, Eq, Hash)]
10087        enum __FieldTag {
10088            __offset,
10089            __metadata,
10090            Unknown(std::string::String),
10091        }
10092        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10093            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10094            where
10095                D: serde::Deserializer<'de>,
10096            {
10097                struct Visitor;
10098                impl<'de> serde::de::Visitor<'de> for Visitor {
10099                    type Value = __FieldTag;
10100                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10101                        formatter.write_str("a field name for ConsumerPartitionMetadata")
10102                    }
10103                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10104                    where
10105                        E: serde::de::Error,
10106                    {
10107                        use std::result::Result::Ok;
10108                        use std::string::ToString;
10109                        match value {
10110                            "offset" => Ok(__FieldTag::__offset),
10111                            "metadata" => Ok(__FieldTag::__metadata),
10112                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10113                        }
10114                    }
10115                }
10116                deserializer.deserialize_identifier(Visitor)
10117            }
10118        }
10119        struct Visitor;
10120        impl<'de> serde::de::Visitor<'de> for Visitor {
10121            type Value = ConsumerPartitionMetadata;
10122            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10123                formatter.write_str("struct ConsumerPartitionMetadata")
10124            }
10125            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10126            where
10127                A: serde::de::MapAccess<'de>,
10128            {
10129                #[allow(unused_imports)]
10130                use serde::de::Error;
10131                use std::option::Option::Some;
10132                let mut fields = std::collections::HashSet::new();
10133                let mut result = Self::Value::new();
10134                while let Some(tag) = map.next_key::<__FieldTag>()? {
10135                    #[allow(clippy::match_single_binding)]
10136                    match tag {
10137                        __FieldTag::__offset => {
10138                            if !fields.insert(__FieldTag::__offset) {
10139                                return std::result::Result::Err(A::Error::duplicate_field(
10140                                    "multiple values for offset",
10141                                ));
10142                            }
10143                            struct __With(std::option::Option<i64>);
10144                            impl<'de> serde::de::Deserialize<'de> for __With {
10145                                fn deserialize<D>(
10146                                    deserializer: D,
10147                                ) -> std::result::Result<Self, D::Error>
10148                                where
10149                                    D: serde::de::Deserializer<'de>,
10150                                {
10151                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
10152                                }
10153                            }
10154                            result.offset = map.next_value::<__With>()?.0.unwrap_or_default();
10155                        }
10156                        __FieldTag::__metadata => {
10157                            if !fields.insert(__FieldTag::__metadata) {
10158                                return std::result::Result::Err(A::Error::duplicate_field(
10159                                    "multiple values for metadata",
10160                                ));
10161                            }
10162                            result.metadata = map
10163                                .next_value::<std::option::Option<std::string::String>>()?
10164                                .unwrap_or_default();
10165                        }
10166                        __FieldTag::Unknown(key) => {
10167                            let value = map.next_value::<serde_json::Value>()?;
10168                            result._unknown_fields.insert(key, value);
10169                        }
10170                    }
10171                }
10172                std::result::Result::Ok(result)
10173            }
10174        }
10175        deserializer.deserialize_any(Visitor)
10176    }
10177}
10178
10179#[doc(hidden)]
10180impl serde::ser::Serialize for ConsumerPartitionMetadata {
10181    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10182    where
10183        S: serde::ser::Serializer,
10184    {
10185        use serde::ser::SerializeMap;
10186        #[allow(unused_imports)]
10187        use std::option::Option::Some;
10188        let mut state = serializer.serialize_map(std::option::Option::None)?;
10189        if !wkt::internal::is_default(&self.offset) {
10190            struct __With<'a>(&'a i64);
10191            impl<'a> serde::ser::Serialize for __With<'a> {
10192                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10193                where
10194                    S: serde::ser::Serializer,
10195                {
10196                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
10197                }
10198            }
10199            state.serialize_entry("offset", &__With(&self.offset))?;
10200        }
10201        if !self.metadata.is_empty() {
10202            state.serialize_entry("metadata", &self.metadata)?;
10203        }
10204        if !self._unknown_fields.is_empty() {
10205            for (key, value) in self._unknown_fields.iter() {
10206                state.serialize_entry(key, &value)?;
10207            }
10208        }
10209        state.end()
10210    }
10211}
10212
10213/// A Kafka consumer group in a given cluster.
10214#[derive(Clone, Debug, Default, PartialEq)]
10215#[non_exhaustive]
10216pub struct ConsumerGroup {
10217    /// Identifier. The name of the consumer group. The `consumer_group` segment is
10218    /// used when connecting directly to the cluster. Structured like:
10219    /// projects/{project}/locations/{location}/clusters/{cluster}/consumerGroups/{consumer_group}
10220    pub name: std::string::String,
10221
10222    /// Optional. Metadata for this consumer group for all topics it has metadata
10223    /// for. The key of the map is a topic name, structured like:
10224    /// projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}
10225    pub topics: std::collections::HashMap<std::string::String, crate::model::ConsumerTopicMetadata>,
10226
10227    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10228}
10229
10230impl ConsumerGroup {
10231    pub fn new() -> Self {
10232        std::default::Default::default()
10233    }
10234
10235    /// Sets the value of [name][crate::model::ConsumerGroup::name].
10236    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10237        self.name = v.into();
10238        self
10239    }
10240
10241    /// Sets the value of [topics][crate::model::ConsumerGroup::topics].
10242    pub fn set_topics<T, K, V>(mut self, v: T) -> Self
10243    where
10244        T: std::iter::IntoIterator<Item = (K, V)>,
10245        K: std::convert::Into<std::string::String>,
10246        V: std::convert::Into<crate::model::ConsumerTopicMetadata>,
10247    {
10248        use std::iter::Iterator;
10249        self.topics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10250        self
10251    }
10252}
10253
10254impl wkt::message::Message for ConsumerGroup {
10255    fn typename() -> &'static str {
10256        "type.googleapis.com/google.cloud.managedkafka.v1.ConsumerGroup"
10257    }
10258}
10259
10260#[doc(hidden)]
10261impl<'de> serde::de::Deserialize<'de> for ConsumerGroup {
10262    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10263    where
10264        D: serde::Deserializer<'de>,
10265    {
10266        #[allow(non_camel_case_types)]
10267        #[doc(hidden)]
10268        #[derive(PartialEq, Eq, Hash)]
10269        enum __FieldTag {
10270            __name,
10271            __topics,
10272            Unknown(std::string::String),
10273        }
10274        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10275            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10276            where
10277                D: serde::Deserializer<'de>,
10278            {
10279                struct Visitor;
10280                impl<'de> serde::de::Visitor<'de> for Visitor {
10281                    type Value = __FieldTag;
10282                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10283                        formatter.write_str("a field name for ConsumerGroup")
10284                    }
10285                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10286                    where
10287                        E: serde::de::Error,
10288                    {
10289                        use std::result::Result::Ok;
10290                        use std::string::ToString;
10291                        match value {
10292                            "name" => Ok(__FieldTag::__name),
10293                            "topics" => Ok(__FieldTag::__topics),
10294                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10295                        }
10296                    }
10297                }
10298                deserializer.deserialize_identifier(Visitor)
10299            }
10300        }
10301        struct Visitor;
10302        impl<'de> serde::de::Visitor<'de> for Visitor {
10303            type Value = ConsumerGroup;
10304            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10305                formatter.write_str("struct ConsumerGroup")
10306            }
10307            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10308            where
10309                A: serde::de::MapAccess<'de>,
10310            {
10311                #[allow(unused_imports)]
10312                use serde::de::Error;
10313                use std::option::Option::Some;
10314                let mut fields = std::collections::HashSet::new();
10315                let mut result = Self::Value::new();
10316                while let Some(tag) = map.next_key::<__FieldTag>()? {
10317                    #[allow(clippy::match_single_binding)]
10318                    match tag {
10319                        __FieldTag::__name => {
10320                            if !fields.insert(__FieldTag::__name) {
10321                                return std::result::Result::Err(A::Error::duplicate_field(
10322                                    "multiple values for name",
10323                                ));
10324                            }
10325                            result.name = map
10326                                .next_value::<std::option::Option<std::string::String>>()?
10327                                .unwrap_or_default();
10328                        }
10329                        __FieldTag::__topics => {
10330                            if !fields.insert(__FieldTag::__topics) {
10331                                return std::result::Result::Err(A::Error::duplicate_field(
10332                                    "multiple values for topics",
10333                                ));
10334                            }
10335                            result.topics = map
10336                                .next_value::<std::option::Option<
10337                                    std::collections::HashMap<
10338                                        std::string::String,
10339                                        crate::model::ConsumerTopicMetadata,
10340                                    >,
10341                                >>()?
10342                                .unwrap_or_default();
10343                        }
10344                        __FieldTag::Unknown(key) => {
10345                            let value = map.next_value::<serde_json::Value>()?;
10346                            result._unknown_fields.insert(key, value);
10347                        }
10348                    }
10349                }
10350                std::result::Result::Ok(result)
10351            }
10352        }
10353        deserializer.deserialize_any(Visitor)
10354    }
10355}
10356
10357#[doc(hidden)]
10358impl serde::ser::Serialize for ConsumerGroup {
10359    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10360    where
10361        S: serde::ser::Serializer,
10362    {
10363        use serde::ser::SerializeMap;
10364        #[allow(unused_imports)]
10365        use std::option::Option::Some;
10366        let mut state = serializer.serialize_map(std::option::Option::None)?;
10367        if !self.name.is_empty() {
10368            state.serialize_entry("name", &self.name)?;
10369        }
10370        if !self.topics.is_empty() {
10371            state.serialize_entry("topics", &self.topics)?;
10372        }
10373        if !self._unknown_fields.is_empty() {
10374            for (key, value) in self._unknown_fields.iter() {
10375                state.serialize_entry(key, &value)?;
10376            }
10377        }
10378        state.end()
10379    }
10380}
10381
10382/// Represents the metadata of the long-running operation.
10383#[derive(Clone, Debug, Default, PartialEq)]
10384#[non_exhaustive]
10385pub struct OperationMetadata {
10386    /// Output only. The time the operation was created.
10387    pub create_time: std::option::Option<wkt::Timestamp>,
10388
10389    /// Output only. The time the operation finished running.
10390    pub end_time: std::option::Option<wkt::Timestamp>,
10391
10392    /// Output only. Server-defined resource path for the target of the operation.
10393    pub target: std::string::String,
10394
10395    /// Output only. Name of the verb executed by the operation.
10396    pub verb: std::string::String,
10397
10398    /// Output only. Human-readable status of the operation, if any.
10399    pub status_message: std::string::String,
10400
10401    /// Output only. Identifies whether the user has requested cancellation
10402    /// of the operation. Operations that have been cancelled successfully
10403    /// have [Operation.error][] value with a
10404    /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
10405    /// `Code.CANCELLED`.
10406    ///
10407    /// [google.rpc.Status.code]: rpc::model::Status::code
10408    pub requested_cancellation: bool,
10409
10410    /// Output only. API version used to start the operation.
10411    pub api_version: std::string::String,
10412
10413    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10414}
10415
10416impl OperationMetadata {
10417    pub fn new() -> Self {
10418        std::default::Default::default()
10419    }
10420
10421    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
10422    pub fn set_create_time<T>(mut self, v: T) -> Self
10423    where
10424        T: std::convert::Into<wkt::Timestamp>,
10425    {
10426        self.create_time = std::option::Option::Some(v.into());
10427        self
10428    }
10429
10430    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
10431    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10432    where
10433        T: std::convert::Into<wkt::Timestamp>,
10434    {
10435        self.create_time = v.map(|x| x.into());
10436        self
10437    }
10438
10439    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
10440    pub fn set_end_time<T>(mut self, v: T) -> Self
10441    where
10442        T: std::convert::Into<wkt::Timestamp>,
10443    {
10444        self.end_time = std::option::Option::Some(v.into());
10445        self
10446    }
10447
10448    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
10449    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
10450    where
10451        T: std::convert::Into<wkt::Timestamp>,
10452    {
10453        self.end_time = v.map(|x| x.into());
10454        self
10455    }
10456
10457    /// Sets the value of [target][crate::model::OperationMetadata::target].
10458    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10459        self.target = v.into();
10460        self
10461    }
10462
10463    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
10464    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10465        self.verb = v.into();
10466        self
10467    }
10468
10469    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
10470    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10471        self.status_message = v.into();
10472        self
10473    }
10474
10475    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
10476    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10477        self.requested_cancellation = v.into();
10478        self
10479    }
10480
10481    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
10482    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10483        self.api_version = v.into();
10484        self
10485    }
10486}
10487
10488impl wkt::message::Message for OperationMetadata {
10489    fn typename() -> &'static str {
10490        "type.googleapis.com/google.cloud.managedkafka.v1.OperationMetadata"
10491    }
10492}
10493
10494#[doc(hidden)]
10495impl<'de> serde::de::Deserialize<'de> for OperationMetadata {
10496    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10497    where
10498        D: serde::Deserializer<'de>,
10499    {
10500        #[allow(non_camel_case_types)]
10501        #[doc(hidden)]
10502        #[derive(PartialEq, Eq, Hash)]
10503        enum __FieldTag {
10504            __create_time,
10505            __end_time,
10506            __target,
10507            __verb,
10508            __status_message,
10509            __requested_cancellation,
10510            __api_version,
10511            Unknown(std::string::String),
10512        }
10513        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10514            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10515            where
10516                D: serde::Deserializer<'de>,
10517            {
10518                struct Visitor;
10519                impl<'de> serde::de::Visitor<'de> for Visitor {
10520                    type Value = __FieldTag;
10521                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10522                        formatter.write_str("a field name for OperationMetadata")
10523                    }
10524                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10525                    where
10526                        E: serde::de::Error,
10527                    {
10528                        use std::result::Result::Ok;
10529                        use std::string::ToString;
10530                        match value {
10531                            "createTime" => Ok(__FieldTag::__create_time),
10532                            "create_time" => Ok(__FieldTag::__create_time),
10533                            "endTime" => Ok(__FieldTag::__end_time),
10534                            "end_time" => Ok(__FieldTag::__end_time),
10535                            "target" => Ok(__FieldTag::__target),
10536                            "verb" => Ok(__FieldTag::__verb),
10537                            "statusMessage" => Ok(__FieldTag::__status_message),
10538                            "status_message" => Ok(__FieldTag::__status_message),
10539                            "requestedCancellation" => Ok(__FieldTag::__requested_cancellation),
10540                            "requested_cancellation" => Ok(__FieldTag::__requested_cancellation),
10541                            "apiVersion" => Ok(__FieldTag::__api_version),
10542                            "api_version" => Ok(__FieldTag::__api_version),
10543                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10544                        }
10545                    }
10546                }
10547                deserializer.deserialize_identifier(Visitor)
10548            }
10549        }
10550        struct Visitor;
10551        impl<'de> serde::de::Visitor<'de> for Visitor {
10552            type Value = OperationMetadata;
10553            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10554                formatter.write_str("struct OperationMetadata")
10555            }
10556            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10557            where
10558                A: serde::de::MapAccess<'de>,
10559            {
10560                #[allow(unused_imports)]
10561                use serde::de::Error;
10562                use std::option::Option::Some;
10563                let mut fields = std::collections::HashSet::new();
10564                let mut result = Self::Value::new();
10565                while let Some(tag) = map.next_key::<__FieldTag>()? {
10566                    #[allow(clippy::match_single_binding)]
10567                    match tag {
10568                        __FieldTag::__create_time => {
10569                            if !fields.insert(__FieldTag::__create_time) {
10570                                return std::result::Result::Err(A::Error::duplicate_field(
10571                                    "multiple values for create_time",
10572                                ));
10573                            }
10574                            result.create_time =
10575                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
10576                        }
10577                        __FieldTag::__end_time => {
10578                            if !fields.insert(__FieldTag::__end_time) {
10579                                return std::result::Result::Err(A::Error::duplicate_field(
10580                                    "multiple values for end_time",
10581                                ));
10582                            }
10583                            result.end_time =
10584                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
10585                        }
10586                        __FieldTag::__target => {
10587                            if !fields.insert(__FieldTag::__target) {
10588                                return std::result::Result::Err(A::Error::duplicate_field(
10589                                    "multiple values for target",
10590                                ));
10591                            }
10592                            result.target = map
10593                                .next_value::<std::option::Option<std::string::String>>()?
10594                                .unwrap_or_default();
10595                        }
10596                        __FieldTag::__verb => {
10597                            if !fields.insert(__FieldTag::__verb) {
10598                                return std::result::Result::Err(A::Error::duplicate_field(
10599                                    "multiple values for verb",
10600                                ));
10601                            }
10602                            result.verb = map
10603                                .next_value::<std::option::Option<std::string::String>>()?
10604                                .unwrap_or_default();
10605                        }
10606                        __FieldTag::__status_message => {
10607                            if !fields.insert(__FieldTag::__status_message) {
10608                                return std::result::Result::Err(A::Error::duplicate_field(
10609                                    "multiple values for status_message",
10610                                ));
10611                            }
10612                            result.status_message = map
10613                                .next_value::<std::option::Option<std::string::String>>()?
10614                                .unwrap_or_default();
10615                        }
10616                        __FieldTag::__requested_cancellation => {
10617                            if !fields.insert(__FieldTag::__requested_cancellation) {
10618                                return std::result::Result::Err(A::Error::duplicate_field(
10619                                    "multiple values for requested_cancellation",
10620                                ));
10621                            }
10622                            result.requested_cancellation = map
10623                                .next_value::<std::option::Option<bool>>()?
10624                                .unwrap_or_default();
10625                        }
10626                        __FieldTag::__api_version => {
10627                            if !fields.insert(__FieldTag::__api_version) {
10628                                return std::result::Result::Err(A::Error::duplicate_field(
10629                                    "multiple values for api_version",
10630                                ));
10631                            }
10632                            result.api_version = map
10633                                .next_value::<std::option::Option<std::string::String>>()?
10634                                .unwrap_or_default();
10635                        }
10636                        __FieldTag::Unknown(key) => {
10637                            let value = map.next_value::<serde_json::Value>()?;
10638                            result._unknown_fields.insert(key, value);
10639                        }
10640                    }
10641                }
10642                std::result::Result::Ok(result)
10643            }
10644        }
10645        deserializer.deserialize_any(Visitor)
10646    }
10647}
10648
10649#[doc(hidden)]
10650impl serde::ser::Serialize for OperationMetadata {
10651    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10652    where
10653        S: serde::ser::Serializer,
10654    {
10655        use serde::ser::SerializeMap;
10656        #[allow(unused_imports)]
10657        use std::option::Option::Some;
10658        let mut state = serializer.serialize_map(std::option::Option::None)?;
10659        if self.create_time.is_some() {
10660            state.serialize_entry("createTime", &self.create_time)?;
10661        }
10662        if self.end_time.is_some() {
10663            state.serialize_entry("endTime", &self.end_time)?;
10664        }
10665        if !self.target.is_empty() {
10666            state.serialize_entry("target", &self.target)?;
10667        }
10668        if !self.verb.is_empty() {
10669            state.serialize_entry("verb", &self.verb)?;
10670        }
10671        if !self.status_message.is_empty() {
10672            state.serialize_entry("statusMessage", &self.status_message)?;
10673        }
10674        if !wkt::internal::is_default(&self.requested_cancellation) {
10675            state.serialize_entry("requestedCancellation", &self.requested_cancellation)?;
10676        }
10677        if !self.api_version.is_empty() {
10678            state.serialize_entry("apiVersion", &self.api_version)?;
10679        }
10680        if !self._unknown_fields.is_empty() {
10681            for (key, value) in self._unknown_fields.iter() {
10682                state.serialize_entry(key, &value)?;
10683            }
10684        }
10685        state.end()
10686    }
10687}
10688
10689/// An Apache Kafka Connect cluster deployed in a location.
10690#[derive(Clone, Debug, Default, PartialEq)]
10691#[non_exhaustive]
10692pub struct ConnectCluster {
10693    /// Identifier. The name of the Kafka Connect cluster. Structured like:
10694    /// projects/{project_number}/locations/{location}/connectClusters/{connect_cluster_id}
10695    pub name: std::string::String,
10696
10697    /// Required. Immutable. The name of the Kafka cluster this Kafka Connect
10698    /// cluster is attached to. Structured like:
10699    /// projects/{project}/locations/{location}/clusters/{cluster}
10700    pub kafka_cluster: std::string::String,
10701
10702    /// Output only. The time when the cluster was created.
10703    pub create_time: std::option::Option<wkt::Timestamp>,
10704
10705    /// Output only. The time when the cluster was last updated.
10706    pub update_time: std::option::Option<wkt::Timestamp>,
10707
10708    /// Optional. Labels as key value pairs.
10709    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10710
10711    /// Required. Capacity configuration for the Kafka Connect cluster.
10712    pub capacity_config: std::option::Option<crate::model::CapacityConfig>,
10713
10714    /// Output only. The current state of the cluster.
10715    pub state: crate::model::connect_cluster::State,
10716
10717    /// Optional. Configurations for the worker that are overridden from the
10718    /// defaults. The key of the map is a Kafka Connect worker property name, for
10719    /// example: `exactly.once.source.support`.
10720    pub config: std::collections::HashMap<std::string::String, std::string::String>,
10721
10722    /// Platform specific configuration properties for a Kafka Connect cluster.
10723    pub platform_config: std::option::Option<crate::model::connect_cluster::PlatformConfig>,
10724
10725    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10726}
10727
10728impl ConnectCluster {
10729    pub fn new() -> Self {
10730        std::default::Default::default()
10731    }
10732
10733    /// Sets the value of [name][crate::model::ConnectCluster::name].
10734    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10735        self.name = v.into();
10736        self
10737    }
10738
10739    /// Sets the value of [kafka_cluster][crate::model::ConnectCluster::kafka_cluster].
10740    pub fn set_kafka_cluster<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10741        self.kafka_cluster = v.into();
10742        self
10743    }
10744
10745    /// Sets the value of [create_time][crate::model::ConnectCluster::create_time].
10746    pub fn set_create_time<T>(mut self, v: T) -> Self
10747    where
10748        T: std::convert::Into<wkt::Timestamp>,
10749    {
10750        self.create_time = std::option::Option::Some(v.into());
10751        self
10752    }
10753
10754    /// Sets or clears the value of [create_time][crate::model::ConnectCluster::create_time].
10755    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10756    where
10757        T: std::convert::Into<wkt::Timestamp>,
10758    {
10759        self.create_time = v.map(|x| x.into());
10760        self
10761    }
10762
10763    /// Sets the value of [update_time][crate::model::ConnectCluster::update_time].
10764    pub fn set_update_time<T>(mut self, v: T) -> Self
10765    where
10766        T: std::convert::Into<wkt::Timestamp>,
10767    {
10768        self.update_time = std::option::Option::Some(v.into());
10769        self
10770    }
10771
10772    /// Sets or clears the value of [update_time][crate::model::ConnectCluster::update_time].
10773    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
10774    where
10775        T: std::convert::Into<wkt::Timestamp>,
10776    {
10777        self.update_time = v.map(|x| x.into());
10778        self
10779    }
10780
10781    /// Sets the value of [labels][crate::model::ConnectCluster::labels].
10782    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10783    where
10784        T: std::iter::IntoIterator<Item = (K, V)>,
10785        K: std::convert::Into<std::string::String>,
10786        V: std::convert::Into<std::string::String>,
10787    {
10788        use std::iter::Iterator;
10789        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10790        self
10791    }
10792
10793    /// Sets the value of [capacity_config][crate::model::ConnectCluster::capacity_config].
10794    pub fn set_capacity_config<T>(mut self, v: T) -> Self
10795    where
10796        T: std::convert::Into<crate::model::CapacityConfig>,
10797    {
10798        self.capacity_config = std::option::Option::Some(v.into());
10799        self
10800    }
10801
10802    /// Sets or clears the value of [capacity_config][crate::model::ConnectCluster::capacity_config].
10803    pub fn set_or_clear_capacity_config<T>(mut self, v: std::option::Option<T>) -> Self
10804    where
10805        T: std::convert::Into<crate::model::CapacityConfig>,
10806    {
10807        self.capacity_config = v.map(|x| x.into());
10808        self
10809    }
10810
10811    /// Sets the value of [state][crate::model::ConnectCluster::state].
10812    pub fn set_state<T: std::convert::Into<crate::model::connect_cluster::State>>(
10813        mut self,
10814        v: T,
10815    ) -> Self {
10816        self.state = v.into();
10817        self
10818    }
10819
10820    /// Sets the value of [config][crate::model::ConnectCluster::config].
10821    pub fn set_config<T, K, V>(mut self, v: T) -> Self
10822    where
10823        T: std::iter::IntoIterator<Item = (K, V)>,
10824        K: std::convert::Into<std::string::String>,
10825        V: std::convert::Into<std::string::String>,
10826    {
10827        use std::iter::Iterator;
10828        self.config = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10829        self
10830    }
10831
10832    /// Sets the value of [platform_config][crate::model::ConnectCluster::platform_config].
10833    ///
10834    /// Note that all the setters affecting `platform_config` are mutually
10835    /// exclusive.
10836    pub fn set_platform_config<
10837        T: std::convert::Into<std::option::Option<crate::model::connect_cluster::PlatformConfig>>,
10838    >(
10839        mut self,
10840        v: T,
10841    ) -> Self {
10842        self.platform_config = v.into();
10843        self
10844    }
10845
10846    /// The value of [platform_config][crate::model::ConnectCluster::platform_config]
10847    /// if it holds a `GcpConfig`, `None` if the field is not set or
10848    /// holds a different branch.
10849    pub fn gcp_config(
10850        &self,
10851    ) -> std::option::Option<&std::boxed::Box<crate::model::ConnectGcpConfig>> {
10852        #[allow(unreachable_patterns)]
10853        self.platform_config.as_ref().and_then(|v| match v {
10854            crate::model::connect_cluster::PlatformConfig::GcpConfig(v) => {
10855                std::option::Option::Some(v)
10856            }
10857            _ => std::option::Option::None,
10858        })
10859    }
10860
10861    /// Sets the value of [platform_config][crate::model::ConnectCluster::platform_config]
10862    /// to hold a `GcpConfig`.
10863    ///
10864    /// Note that all the setters affecting `platform_config` are
10865    /// mutually exclusive.
10866    pub fn set_gcp_config<
10867        T: std::convert::Into<std::boxed::Box<crate::model::ConnectGcpConfig>>,
10868    >(
10869        mut self,
10870        v: T,
10871    ) -> Self {
10872        self.platform_config = std::option::Option::Some(
10873            crate::model::connect_cluster::PlatformConfig::GcpConfig(v.into()),
10874        );
10875        self
10876    }
10877}
10878
10879impl wkt::message::Message for ConnectCluster {
10880    fn typename() -> &'static str {
10881        "type.googleapis.com/google.cloud.managedkafka.v1.ConnectCluster"
10882    }
10883}
10884
10885#[doc(hidden)]
10886impl<'de> serde::de::Deserialize<'de> for ConnectCluster {
10887    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10888    where
10889        D: serde::Deserializer<'de>,
10890    {
10891        #[allow(non_camel_case_types)]
10892        #[doc(hidden)]
10893        #[derive(PartialEq, Eq, Hash)]
10894        enum __FieldTag {
10895            __gcp_config,
10896            __name,
10897            __kafka_cluster,
10898            __create_time,
10899            __update_time,
10900            __labels,
10901            __capacity_config,
10902            __state,
10903            __config,
10904            Unknown(std::string::String),
10905        }
10906        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10907            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10908            where
10909                D: serde::Deserializer<'de>,
10910            {
10911                struct Visitor;
10912                impl<'de> serde::de::Visitor<'de> for Visitor {
10913                    type Value = __FieldTag;
10914                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10915                        formatter.write_str("a field name for ConnectCluster")
10916                    }
10917                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10918                    where
10919                        E: serde::de::Error,
10920                    {
10921                        use std::result::Result::Ok;
10922                        use std::string::ToString;
10923                        match value {
10924                            "gcpConfig" => Ok(__FieldTag::__gcp_config),
10925                            "gcp_config" => Ok(__FieldTag::__gcp_config),
10926                            "name" => Ok(__FieldTag::__name),
10927                            "kafkaCluster" => Ok(__FieldTag::__kafka_cluster),
10928                            "kafka_cluster" => Ok(__FieldTag::__kafka_cluster),
10929                            "createTime" => Ok(__FieldTag::__create_time),
10930                            "create_time" => Ok(__FieldTag::__create_time),
10931                            "updateTime" => Ok(__FieldTag::__update_time),
10932                            "update_time" => Ok(__FieldTag::__update_time),
10933                            "labels" => Ok(__FieldTag::__labels),
10934                            "capacityConfig" => Ok(__FieldTag::__capacity_config),
10935                            "capacity_config" => Ok(__FieldTag::__capacity_config),
10936                            "state" => Ok(__FieldTag::__state),
10937                            "config" => Ok(__FieldTag::__config),
10938                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10939                        }
10940                    }
10941                }
10942                deserializer.deserialize_identifier(Visitor)
10943            }
10944        }
10945        struct Visitor;
10946        impl<'de> serde::de::Visitor<'de> for Visitor {
10947            type Value = ConnectCluster;
10948            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10949                formatter.write_str("struct ConnectCluster")
10950            }
10951            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10952            where
10953                A: serde::de::MapAccess<'de>,
10954            {
10955                #[allow(unused_imports)]
10956                use serde::de::Error;
10957                use std::option::Option::Some;
10958                let mut fields = std::collections::HashSet::new();
10959                let mut result = Self::Value::new();
10960                while let Some(tag) = map.next_key::<__FieldTag>()? {
10961                    #[allow(clippy::match_single_binding)]
10962                    match tag {
10963                        __FieldTag::__gcp_config => {
10964                            if !fields.insert(__FieldTag::__gcp_config) {
10965                                return std::result::Result::Err(A::Error::duplicate_field(
10966                                    "multiple values for gcp_config",
10967                                ));
10968                            }
10969                            if result.platform_config.is_some() {
10970                                return std::result::Result::Err(A::Error::duplicate_field(
10971                                    "multiple values for `platform_config`, a oneof with full ID .google.cloud.managedkafka.v1.ConnectCluster.gcp_config, latest field was gcpConfig",
10972                                ));
10973                            }
10974                            result.platform_config = std::option::Option::Some(
10975                                crate::model::connect_cluster::PlatformConfig::GcpConfig(
10976                                    map.next_value::<std::option::Option<
10977                                        std::boxed::Box<crate::model::ConnectGcpConfig>,
10978                                    >>()?
10979                                    .unwrap_or_default(),
10980                                ),
10981                            );
10982                        }
10983                        __FieldTag::__name => {
10984                            if !fields.insert(__FieldTag::__name) {
10985                                return std::result::Result::Err(A::Error::duplicate_field(
10986                                    "multiple values for name",
10987                                ));
10988                            }
10989                            result.name = map
10990                                .next_value::<std::option::Option<std::string::String>>()?
10991                                .unwrap_or_default();
10992                        }
10993                        __FieldTag::__kafka_cluster => {
10994                            if !fields.insert(__FieldTag::__kafka_cluster) {
10995                                return std::result::Result::Err(A::Error::duplicate_field(
10996                                    "multiple values for kafka_cluster",
10997                                ));
10998                            }
10999                            result.kafka_cluster = map
11000                                .next_value::<std::option::Option<std::string::String>>()?
11001                                .unwrap_or_default();
11002                        }
11003                        __FieldTag::__create_time => {
11004                            if !fields.insert(__FieldTag::__create_time) {
11005                                return std::result::Result::Err(A::Error::duplicate_field(
11006                                    "multiple values for create_time",
11007                                ));
11008                            }
11009                            result.create_time =
11010                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
11011                        }
11012                        __FieldTag::__update_time => {
11013                            if !fields.insert(__FieldTag::__update_time) {
11014                                return std::result::Result::Err(A::Error::duplicate_field(
11015                                    "multiple values for update_time",
11016                                ));
11017                            }
11018                            result.update_time =
11019                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
11020                        }
11021                        __FieldTag::__labels => {
11022                            if !fields.insert(__FieldTag::__labels) {
11023                                return std::result::Result::Err(A::Error::duplicate_field(
11024                                    "multiple values for labels",
11025                                ));
11026                            }
11027                            result.labels = map
11028                                .next_value::<std::option::Option<
11029                                    std::collections::HashMap<
11030                                        std::string::String,
11031                                        std::string::String,
11032                                    >,
11033                                >>()?
11034                                .unwrap_or_default();
11035                        }
11036                        __FieldTag::__capacity_config => {
11037                            if !fields.insert(__FieldTag::__capacity_config) {
11038                                return std::result::Result::Err(A::Error::duplicate_field(
11039                                    "multiple values for capacity_config",
11040                                ));
11041                            }
11042                            result.capacity_config = map
11043                                .next_value::<std::option::Option<crate::model::CapacityConfig>>(
11044                                )?;
11045                        }
11046                        __FieldTag::__state => {
11047                            if !fields.insert(__FieldTag::__state) {
11048                                return std::result::Result::Err(A::Error::duplicate_field(
11049                                    "multiple values for state",
11050                                ));
11051                            }
11052                            result.state = map.next_value::<std::option::Option<crate::model::connect_cluster::State>>()?.unwrap_or_default();
11053                        }
11054                        __FieldTag::__config => {
11055                            if !fields.insert(__FieldTag::__config) {
11056                                return std::result::Result::Err(A::Error::duplicate_field(
11057                                    "multiple values for config",
11058                                ));
11059                            }
11060                            result.config = map
11061                                .next_value::<std::option::Option<
11062                                    std::collections::HashMap<
11063                                        std::string::String,
11064                                        std::string::String,
11065                                    >,
11066                                >>()?
11067                                .unwrap_or_default();
11068                        }
11069                        __FieldTag::Unknown(key) => {
11070                            let value = map.next_value::<serde_json::Value>()?;
11071                            result._unknown_fields.insert(key, value);
11072                        }
11073                    }
11074                }
11075                std::result::Result::Ok(result)
11076            }
11077        }
11078        deserializer.deserialize_any(Visitor)
11079    }
11080}
11081
11082#[doc(hidden)]
11083impl serde::ser::Serialize for ConnectCluster {
11084    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11085    where
11086        S: serde::ser::Serializer,
11087    {
11088        use serde::ser::SerializeMap;
11089        #[allow(unused_imports)]
11090        use std::option::Option::Some;
11091        let mut state = serializer.serialize_map(std::option::Option::None)?;
11092        if let Some(value) = self.gcp_config() {
11093            state.serialize_entry("gcpConfig", value)?;
11094        }
11095        if !self.name.is_empty() {
11096            state.serialize_entry("name", &self.name)?;
11097        }
11098        if !self.kafka_cluster.is_empty() {
11099            state.serialize_entry("kafkaCluster", &self.kafka_cluster)?;
11100        }
11101        if self.create_time.is_some() {
11102            state.serialize_entry("createTime", &self.create_time)?;
11103        }
11104        if self.update_time.is_some() {
11105            state.serialize_entry("updateTime", &self.update_time)?;
11106        }
11107        if !self.labels.is_empty() {
11108            state.serialize_entry("labels", &self.labels)?;
11109        }
11110        if self.capacity_config.is_some() {
11111            state.serialize_entry("capacityConfig", &self.capacity_config)?;
11112        }
11113        if !wkt::internal::is_default(&self.state) {
11114            state.serialize_entry("state", &self.state)?;
11115        }
11116        if !self.config.is_empty() {
11117            state.serialize_entry("config", &self.config)?;
11118        }
11119        if !self._unknown_fields.is_empty() {
11120            for (key, value) in self._unknown_fields.iter() {
11121                state.serialize_entry(key, &value)?;
11122            }
11123        }
11124        state.end()
11125    }
11126}
11127
11128/// Defines additional types related to [ConnectCluster].
11129pub mod connect_cluster {
11130    #[allow(unused_imports)]
11131    use super::*;
11132
11133    /// The state of the cluster.
11134    ///
11135    /// # Working with unknown values
11136    ///
11137    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11138    /// additional enum variants at any time. Adding new variants is not considered
11139    /// a breaking change. Applications should write their code in anticipation of:
11140    ///
11141    /// - New values appearing in future releases of the client library, **and**
11142    /// - New values received dynamically, without application changes.
11143    ///
11144    /// Please consult the [Working with enums] section in the user guide for some
11145    /// guidelines.
11146    ///
11147    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11148    #[derive(Clone, Debug, PartialEq)]
11149    #[non_exhaustive]
11150    pub enum State {
11151        /// A state was not specified.
11152        Unspecified,
11153        /// The cluster is being created.
11154        Creating,
11155        /// The cluster is active.
11156        Active,
11157        /// The cluster is being deleted.
11158        Deleting,
11159        /// If set, the enum was initialized with an unknown value.
11160        ///
11161        /// Applications can examine the value using [State::value] or
11162        /// [State::name].
11163        UnknownValue(state::UnknownValue),
11164    }
11165
11166    #[doc(hidden)]
11167    pub mod state {
11168        #[allow(unused_imports)]
11169        use super::*;
11170        #[derive(Clone, Debug, PartialEq)]
11171        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11172    }
11173
11174    impl State {
11175        /// Gets the enum value.
11176        ///
11177        /// Returns `None` if the enum contains an unknown value deserialized from
11178        /// the string representation of enums.
11179        pub fn value(&self) -> std::option::Option<i32> {
11180            match self {
11181                Self::Unspecified => std::option::Option::Some(0),
11182                Self::Creating => std::option::Option::Some(1),
11183                Self::Active => std::option::Option::Some(2),
11184                Self::Deleting => std::option::Option::Some(3),
11185                Self::UnknownValue(u) => u.0.value(),
11186            }
11187        }
11188
11189        /// Gets the enum value as a string.
11190        ///
11191        /// Returns `None` if the enum contains an unknown value deserialized from
11192        /// the integer representation of enums.
11193        pub fn name(&self) -> std::option::Option<&str> {
11194            match self {
11195                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
11196                Self::Creating => std::option::Option::Some("CREATING"),
11197                Self::Active => std::option::Option::Some("ACTIVE"),
11198                Self::Deleting => std::option::Option::Some("DELETING"),
11199                Self::UnknownValue(u) => u.0.name(),
11200            }
11201        }
11202    }
11203
11204    impl std::default::Default for State {
11205        fn default() -> Self {
11206            use std::convert::From;
11207            Self::from(0)
11208        }
11209    }
11210
11211    impl std::fmt::Display for State {
11212        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11213            wkt::internal::display_enum(f, self.name(), self.value())
11214        }
11215    }
11216
11217    impl std::convert::From<i32> for State {
11218        fn from(value: i32) -> Self {
11219            match value {
11220                0 => Self::Unspecified,
11221                1 => Self::Creating,
11222                2 => Self::Active,
11223                3 => Self::Deleting,
11224                _ => Self::UnknownValue(state::UnknownValue(
11225                    wkt::internal::UnknownEnumValue::Integer(value),
11226                )),
11227            }
11228        }
11229    }
11230
11231    impl std::convert::From<&str> for State {
11232        fn from(value: &str) -> Self {
11233            use std::string::ToString;
11234            match value {
11235                "STATE_UNSPECIFIED" => Self::Unspecified,
11236                "CREATING" => Self::Creating,
11237                "ACTIVE" => Self::Active,
11238                "DELETING" => Self::Deleting,
11239                _ => Self::UnknownValue(state::UnknownValue(
11240                    wkt::internal::UnknownEnumValue::String(value.to_string()),
11241                )),
11242            }
11243        }
11244    }
11245
11246    impl serde::ser::Serialize for State {
11247        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11248        where
11249            S: serde::Serializer,
11250        {
11251            match self {
11252                Self::Unspecified => serializer.serialize_i32(0),
11253                Self::Creating => serializer.serialize_i32(1),
11254                Self::Active => serializer.serialize_i32(2),
11255                Self::Deleting => serializer.serialize_i32(3),
11256                Self::UnknownValue(u) => u.0.serialize(serializer),
11257            }
11258        }
11259    }
11260
11261    impl<'de> serde::de::Deserialize<'de> for State {
11262        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11263        where
11264            D: serde::Deserializer<'de>,
11265        {
11266            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
11267                ".google.cloud.managedkafka.v1.ConnectCluster.State",
11268            ))
11269        }
11270    }
11271
11272    /// Platform specific configuration properties for a Kafka Connect cluster.
11273    #[derive(Clone, Debug, PartialEq)]
11274    #[non_exhaustive]
11275    pub enum PlatformConfig {
11276        /// Required. Configuration properties for a Kafka Connect cluster deployed
11277        /// to Google Cloud Platform.
11278        GcpConfig(std::boxed::Box<crate::model::ConnectGcpConfig>),
11279    }
11280}
11281
11282/// The configuration of a Virtual Private Cloud (VPC) network that can access
11283/// the Kafka Connect cluster.
11284#[derive(Clone, Debug, Default, PartialEq)]
11285#[non_exhaustive]
11286pub struct ConnectNetworkConfig {
11287    /// Required. VPC subnet to make available to the Kafka Connect cluster.
11288    /// Structured like:
11289    /// projects/{project}/regions/{region}/subnetworks/{subnet_id}
11290    ///
11291    /// It is used to create a Private Service Connect (PSC) interface for the
11292    /// Kafka Connect workers. It must be located in the same region as the
11293    /// Kafka Connect cluster.
11294    ///
11295    /// The CIDR range of the subnet must be within the IPv4 address ranges for
11296    /// private networks, as specified in RFC 1918. The primary subnet CIDR range
11297    /// must have a minimum size of /22 (1024 addresses).
11298    pub primary_subnet: std::string::String,
11299
11300    /// Optional. Additional subnets may be specified. They may be in another
11301    /// region, but must be in the same VPC network. The Connect workers can
11302    /// communicate with network endpoints in either the primary or additional
11303    /// subnets.
11304    pub additional_subnets: std::vec::Vec<std::string::String>,
11305
11306    /// Optional. Additional DNS domain names from the subnet's network to be made
11307    /// visible to the Connect Cluster. When using MirrorMaker2, it's necessary to
11308    /// add the bootstrap address's dns domain name of the target cluster to make
11309    /// it visible to the connector. For example:
11310    /// my-kafka-cluster.us-central1.managedkafka.my-project.cloud.goog
11311    pub dns_domain_names: std::vec::Vec<std::string::String>,
11312
11313    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11314}
11315
11316impl ConnectNetworkConfig {
11317    pub fn new() -> Self {
11318        std::default::Default::default()
11319    }
11320
11321    /// Sets the value of [primary_subnet][crate::model::ConnectNetworkConfig::primary_subnet].
11322    pub fn set_primary_subnet<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11323        self.primary_subnet = v.into();
11324        self
11325    }
11326
11327    /// Sets the value of [additional_subnets][crate::model::ConnectNetworkConfig::additional_subnets].
11328    pub fn set_additional_subnets<T, V>(mut self, v: T) -> Self
11329    where
11330        T: std::iter::IntoIterator<Item = V>,
11331        V: std::convert::Into<std::string::String>,
11332    {
11333        use std::iter::Iterator;
11334        self.additional_subnets = v.into_iter().map(|i| i.into()).collect();
11335        self
11336    }
11337
11338    /// Sets the value of [dns_domain_names][crate::model::ConnectNetworkConfig::dns_domain_names].
11339    pub fn set_dns_domain_names<T, V>(mut self, v: T) -> Self
11340    where
11341        T: std::iter::IntoIterator<Item = V>,
11342        V: std::convert::Into<std::string::String>,
11343    {
11344        use std::iter::Iterator;
11345        self.dns_domain_names = v.into_iter().map(|i| i.into()).collect();
11346        self
11347    }
11348}
11349
11350impl wkt::message::Message for ConnectNetworkConfig {
11351    fn typename() -> &'static str {
11352        "type.googleapis.com/google.cloud.managedkafka.v1.ConnectNetworkConfig"
11353    }
11354}
11355
11356#[doc(hidden)]
11357impl<'de> serde::de::Deserialize<'de> for ConnectNetworkConfig {
11358    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11359    where
11360        D: serde::Deserializer<'de>,
11361    {
11362        #[allow(non_camel_case_types)]
11363        #[doc(hidden)]
11364        #[derive(PartialEq, Eq, Hash)]
11365        enum __FieldTag {
11366            __primary_subnet,
11367            __additional_subnets,
11368            __dns_domain_names,
11369            Unknown(std::string::String),
11370        }
11371        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11372            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11373            where
11374                D: serde::Deserializer<'de>,
11375            {
11376                struct Visitor;
11377                impl<'de> serde::de::Visitor<'de> for Visitor {
11378                    type Value = __FieldTag;
11379                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11380                        formatter.write_str("a field name for ConnectNetworkConfig")
11381                    }
11382                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11383                    where
11384                        E: serde::de::Error,
11385                    {
11386                        use std::result::Result::Ok;
11387                        use std::string::ToString;
11388                        match value {
11389                            "primarySubnet" => Ok(__FieldTag::__primary_subnet),
11390                            "primary_subnet" => Ok(__FieldTag::__primary_subnet),
11391                            "additionalSubnets" => Ok(__FieldTag::__additional_subnets),
11392                            "additional_subnets" => Ok(__FieldTag::__additional_subnets),
11393                            "dnsDomainNames" => Ok(__FieldTag::__dns_domain_names),
11394                            "dns_domain_names" => Ok(__FieldTag::__dns_domain_names),
11395                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11396                        }
11397                    }
11398                }
11399                deserializer.deserialize_identifier(Visitor)
11400            }
11401        }
11402        struct Visitor;
11403        impl<'de> serde::de::Visitor<'de> for Visitor {
11404            type Value = ConnectNetworkConfig;
11405            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11406                formatter.write_str("struct ConnectNetworkConfig")
11407            }
11408            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11409            where
11410                A: serde::de::MapAccess<'de>,
11411            {
11412                #[allow(unused_imports)]
11413                use serde::de::Error;
11414                use std::option::Option::Some;
11415                let mut fields = std::collections::HashSet::new();
11416                let mut result = Self::Value::new();
11417                while let Some(tag) = map.next_key::<__FieldTag>()? {
11418                    #[allow(clippy::match_single_binding)]
11419                    match tag {
11420                        __FieldTag::__primary_subnet => {
11421                            if !fields.insert(__FieldTag::__primary_subnet) {
11422                                return std::result::Result::Err(A::Error::duplicate_field(
11423                                    "multiple values for primary_subnet",
11424                                ));
11425                            }
11426                            result.primary_subnet = map
11427                                .next_value::<std::option::Option<std::string::String>>()?
11428                                .unwrap_or_default();
11429                        }
11430                        __FieldTag::__additional_subnets => {
11431                            if !fields.insert(__FieldTag::__additional_subnets) {
11432                                return std::result::Result::Err(A::Error::duplicate_field(
11433                                    "multiple values for additional_subnets",
11434                                ));
11435                            }
11436                            result.additional_subnets = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
11437                        }
11438                        __FieldTag::__dns_domain_names => {
11439                            if !fields.insert(__FieldTag::__dns_domain_names) {
11440                                return std::result::Result::Err(A::Error::duplicate_field(
11441                                    "multiple values for dns_domain_names",
11442                                ));
11443                            }
11444                            result.dns_domain_names = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
11445                        }
11446                        __FieldTag::Unknown(key) => {
11447                            let value = map.next_value::<serde_json::Value>()?;
11448                            result._unknown_fields.insert(key, value);
11449                        }
11450                    }
11451                }
11452                std::result::Result::Ok(result)
11453            }
11454        }
11455        deserializer.deserialize_any(Visitor)
11456    }
11457}
11458
11459#[doc(hidden)]
11460impl serde::ser::Serialize for ConnectNetworkConfig {
11461    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11462    where
11463        S: serde::ser::Serializer,
11464    {
11465        use serde::ser::SerializeMap;
11466        #[allow(unused_imports)]
11467        use std::option::Option::Some;
11468        let mut state = serializer.serialize_map(std::option::Option::None)?;
11469        if !self.primary_subnet.is_empty() {
11470            state.serialize_entry("primarySubnet", &self.primary_subnet)?;
11471        }
11472        if !self.additional_subnets.is_empty() {
11473            state.serialize_entry("additionalSubnets", &self.additional_subnets)?;
11474        }
11475        if !self.dns_domain_names.is_empty() {
11476            state.serialize_entry("dnsDomainNames", &self.dns_domain_names)?;
11477        }
11478        if !self._unknown_fields.is_empty() {
11479            for (key, value) in self._unknown_fields.iter() {
11480                state.serialize_entry(key, &value)?;
11481            }
11482        }
11483        state.end()
11484    }
11485}
11486
11487/// The configuration of access to the Kafka Connect cluster.
11488#[derive(Clone, Debug, Default, PartialEq)]
11489#[non_exhaustive]
11490pub struct ConnectAccessConfig {
11491    /// Required.
11492    /// Virtual Private Cloud (VPC) networks that must be granted direct access to
11493    /// the Kafka Connect cluster. Minimum of 1 network is required. Maximum 10
11494    /// networks can be specified.
11495    pub network_configs: std::vec::Vec<crate::model::ConnectNetworkConfig>,
11496
11497    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11498}
11499
11500impl ConnectAccessConfig {
11501    pub fn new() -> Self {
11502        std::default::Default::default()
11503    }
11504
11505    /// Sets the value of [network_configs][crate::model::ConnectAccessConfig::network_configs].
11506    pub fn set_network_configs<T, V>(mut self, v: T) -> Self
11507    where
11508        T: std::iter::IntoIterator<Item = V>,
11509        V: std::convert::Into<crate::model::ConnectNetworkConfig>,
11510    {
11511        use std::iter::Iterator;
11512        self.network_configs = v.into_iter().map(|i| i.into()).collect();
11513        self
11514    }
11515}
11516
11517impl wkt::message::Message for ConnectAccessConfig {
11518    fn typename() -> &'static str {
11519        "type.googleapis.com/google.cloud.managedkafka.v1.ConnectAccessConfig"
11520    }
11521}
11522
11523#[doc(hidden)]
11524impl<'de> serde::de::Deserialize<'de> for ConnectAccessConfig {
11525    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11526    where
11527        D: serde::Deserializer<'de>,
11528    {
11529        #[allow(non_camel_case_types)]
11530        #[doc(hidden)]
11531        #[derive(PartialEq, Eq, Hash)]
11532        enum __FieldTag {
11533            __network_configs,
11534            Unknown(std::string::String),
11535        }
11536        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11537            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11538            where
11539                D: serde::Deserializer<'de>,
11540            {
11541                struct Visitor;
11542                impl<'de> serde::de::Visitor<'de> for Visitor {
11543                    type Value = __FieldTag;
11544                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11545                        formatter.write_str("a field name for ConnectAccessConfig")
11546                    }
11547                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11548                    where
11549                        E: serde::de::Error,
11550                    {
11551                        use std::result::Result::Ok;
11552                        use std::string::ToString;
11553                        match value {
11554                            "networkConfigs" => Ok(__FieldTag::__network_configs),
11555                            "network_configs" => Ok(__FieldTag::__network_configs),
11556                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11557                        }
11558                    }
11559                }
11560                deserializer.deserialize_identifier(Visitor)
11561            }
11562        }
11563        struct Visitor;
11564        impl<'de> serde::de::Visitor<'de> for Visitor {
11565            type Value = ConnectAccessConfig;
11566            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11567                formatter.write_str("struct ConnectAccessConfig")
11568            }
11569            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11570            where
11571                A: serde::de::MapAccess<'de>,
11572            {
11573                #[allow(unused_imports)]
11574                use serde::de::Error;
11575                use std::option::Option::Some;
11576                let mut fields = std::collections::HashSet::new();
11577                let mut result = Self::Value::new();
11578                while let Some(tag) = map.next_key::<__FieldTag>()? {
11579                    #[allow(clippy::match_single_binding)]
11580                    match tag {
11581                        __FieldTag::__network_configs => {
11582                            if !fields.insert(__FieldTag::__network_configs) {
11583                                return std::result::Result::Err(A::Error::duplicate_field(
11584                                    "multiple values for network_configs",
11585                                ));
11586                            }
11587                            result.network_configs = map
11588                                .next_value::<std::option::Option<
11589                                    std::vec::Vec<crate::model::ConnectNetworkConfig>,
11590                                >>()?
11591                                .unwrap_or_default();
11592                        }
11593                        __FieldTag::Unknown(key) => {
11594                            let value = map.next_value::<serde_json::Value>()?;
11595                            result._unknown_fields.insert(key, value);
11596                        }
11597                    }
11598                }
11599                std::result::Result::Ok(result)
11600            }
11601        }
11602        deserializer.deserialize_any(Visitor)
11603    }
11604}
11605
11606#[doc(hidden)]
11607impl serde::ser::Serialize for ConnectAccessConfig {
11608    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11609    where
11610        S: serde::ser::Serializer,
11611    {
11612        use serde::ser::SerializeMap;
11613        #[allow(unused_imports)]
11614        use std::option::Option::Some;
11615        let mut state = serializer.serialize_map(std::option::Option::None)?;
11616        if !self.network_configs.is_empty() {
11617            state.serialize_entry("networkConfigs", &self.network_configs)?;
11618        }
11619        if !self._unknown_fields.is_empty() {
11620            for (key, value) in self._unknown_fields.iter() {
11621                state.serialize_entry(key, &value)?;
11622            }
11623        }
11624        state.end()
11625    }
11626}
11627
11628/// Configuration properties for a Kafka Connect cluster deployed to Google Cloud
11629/// Platform.
11630#[derive(Clone, Debug, Default, PartialEq)]
11631#[non_exhaustive]
11632pub struct ConnectGcpConfig {
11633    /// Required. Access configuration for the Kafka Connect cluster.
11634    pub access_config: std::option::Option<crate::model::ConnectAccessConfig>,
11635
11636    /// Optional. Secrets to load into workers. Exact SecretVersions from Secret
11637    /// Manager must be provided -- aliases are not supported. Up to 32 secrets may
11638    /// be loaded into one cluster. Format:
11639    /// projects/\<project-id\>/secrets/\<secret-name\>/versions/\<version-id\>
11640    pub secret_paths: std::vec::Vec<std::string::String>,
11641
11642    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11643}
11644
11645impl ConnectGcpConfig {
11646    pub fn new() -> Self {
11647        std::default::Default::default()
11648    }
11649
11650    /// Sets the value of [access_config][crate::model::ConnectGcpConfig::access_config].
11651    pub fn set_access_config<T>(mut self, v: T) -> Self
11652    where
11653        T: std::convert::Into<crate::model::ConnectAccessConfig>,
11654    {
11655        self.access_config = std::option::Option::Some(v.into());
11656        self
11657    }
11658
11659    /// Sets or clears the value of [access_config][crate::model::ConnectGcpConfig::access_config].
11660    pub fn set_or_clear_access_config<T>(mut self, v: std::option::Option<T>) -> Self
11661    where
11662        T: std::convert::Into<crate::model::ConnectAccessConfig>,
11663    {
11664        self.access_config = v.map(|x| x.into());
11665        self
11666    }
11667
11668    /// Sets the value of [secret_paths][crate::model::ConnectGcpConfig::secret_paths].
11669    pub fn set_secret_paths<T, V>(mut self, v: T) -> Self
11670    where
11671        T: std::iter::IntoIterator<Item = V>,
11672        V: std::convert::Into<std::string::String>,
11673    {
11674        use std::iter::Iterator;
11675        self.secret_paths = v.into_iter().map(|i| i.into()).collect();
11676        self
11677    }
11678}
11679
11680impl wkt::message::Message for ConnectGcpConfig {
11681    fn typename() -> &'static str {
11682        "type.googleapis.com/google.cloud.managedkafka.v1.ConnectGcpConfig"
11683    }
11684}
11685
11686#[doc(hidden)]
11687impl<'de> serde::de::Deserialize<'de> for ConnectGcpConfig {
11688    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11689    where
11690        D: serde::Deserializer<'de>,
11691    {
11692        #[allow(non_camel_case_types)]
11693        #[doc(hidden)]
11694        #[derive(PartialEq, Eq, Hash)]
11695        enum __FieldTag {
11696            __access_config,
11697            __secret_paths,
11698            Unknown(std::string::String),
11699        }
11700        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11701            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11702            where
11703                D: serde::Deserializer<'de>,
11704            {
11705                struct Visitor;
11706                impl<'de> serde::de::Visitor<'de> for Visitor {
11707                    type Value = __FieldTag;
11708                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11709                        formatter.write_str("a field name for ConnectGcpConfig")
11710                    }
11711                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11712                    where
11713                        E: serde::de::Error,
11714                    {
11715                        use std::result::Result::Ok;
11716                        use std::string::ToString;
11717                        match value {
11718                            "accessConfig" => Ok(__FieldTag::__access_config),
11719                            "access_config" => Ok(__FieldTag::__access_config),
11720                            "secretPaths" => Ok(__FieldTag::__secret_paths),
11721                            "secret_paths" => Ok(__FieldTag::__secret_paths),
11722                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11723                        }
11724                    }
11725                }
11726                deserializer.deserialize_identifier(Visitor)
11727            }
11728        }
11729        struct Visitor;
11730        impl<'de> serde::de::Visitor<'de> for Visitor {
11731            type Value = ConnectGcpConfig;
11732            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11733                formatter.write_str("struct ConnectGcpConfig")
11734            }
11735            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11736            where
11737                A: serde::de::MapAccess<'de>,
11738            {
11739                #[allow(unused_imports)]
11740                use serde::de::Error;
11741                use std::option::Option::Some;
11742                let mut fields = std::collections::HashSet::new();
11743                let mut result = Self::Value::new();
11744                while let Some(tag) = map.next_key::<__FieldTag>()? {
11745                    #[allow(clippy::match_single_binding)]
11746                    match tag {
11747                        __FieldTag::__access_config => {
11748                            if !fields.insert(__FieldTag::__access_config) {
11749                                return std::result::Result::Err(A::Error::duplicate_field(
11750                                    "multiple values for access_config",
11751                                ));
11752                            }
11753                            result.access_config = map.next_value::<std::option::Option<crate::model::ConnectAccessConfig>>()?
11754                                ;
11755                        }
11756                        __FieldTag::__secret_paths => {
11757                            if !fields.insert(__FieldTag::__secret_paths) {
11758                                return std::result::Result::Err(A::Error::duplicate_field(
11759                                    "multiple values for secret_paths",
11760                                ));
11761                            }
11762                            result.secret_paths = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
11763                        }
11764                        __FieldTag::Unknown(key) => {
11765                            let value = map.next_value::<serde_json::Value>()?;
11766                            result._unknown_fields.insert(key, value);
11767                        }
11768                    }
11769                }
11770                std::result::Result::Ok(result)
11771            }
11772        }
11773        deserializer.deserialize_any(Visitor)
11774    }
11775}
11776
11777#[doc(hidden)]
11778impl serde::ser::Serialize for ConnectGcpConfig {
11779    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11780    where
11781        S: serde::ser::Serializer,
11782    {
11783        use serde::ser::SerializeMap;
11784        #[allow(unused_imports)]
11785        use std::option::Option::Some;
11786        let mut state = serializer.serialize_map(std::option::Option::None)?;
11787        if self.access_config.is_some() {
11788            state.serialize_entry("accessConfig", &self.access_config)?;
11789        }
11790        if !self.secret_paths.is_empty() {
11791            state.serialize_entry("secretPaths", &self.secret_paths)?;
11792        }
11793        if !self._unknown_fields.is_empty() {
11794            for (key, value) in self._unknown_fields.iter() {
11795                state.serialize_entry(key, &value)?;
11796            }
11797        }
11798        state.end()
11799    }
11800}
11801
11802/// A Kafka Connect connector in a given ConnectCluster.
11803#[derive(Clone, Debug, Default, PartialEq)]
11804#[non_exhaustive]
11805pub struct Connector {
11806    /// Identifier. The name of the connector.
11807    /// Structured like:
11808    /// projects/{project}/locations/{location}/connectClusters/{connect_cluster}/connectors/{connector}
11809    pub name: std::string::String,
11810
11811    /// Optional. Connector config as keys/values.
11812    /// The keys of the map are connector property names, for example:
11813    /// `connector.class`, `tasks.max`, `key.converter`.
11814    pub configs: std::collections::HashMap<std::string::String, std::string::String>,
11815
11816    /// Output only. The current state of the connector.
11817    pub state: crate::model::connector::State,
11818
11819    /// A policy that specifies how to restart the failed connectors/tasks in a
11820    /// Cluster resource. If not set, the failed connectors/tasks won't be
11821    /// restarted.
11822    pub restart_policy: std::option::Option<crate::model::connector::RestartPolicy>,
11823
11824    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11825}
11826
11827impl Connector {
11828    pub fn new() -> Self {
11829        std::default::Default::default()
11830    }
11831
11832    /// Sets the value of [name][crate::model::Connector::name].
11833    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11834        self.name = v.into();
11835        self
11836    }
11837
11838    /// Sets the value of [configs][crate::model::Connector::configs].
11839    pub fn set_configs<T, K, V>(mut self, v: T) -> Self
11840    where
11841        T: std::iter::IntoIterator<Item = (K, V)>,
11842        K: std::convert::Into<std::string::String>,
11843        V: std::convert::Into<std::string::String>,
11844    {
11845        use std::iter::Iterator;
11846        self.configs = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11847        self
11848    }
11849
11850    /// Sets the value of [state][crate::model::Connector::state].
11851    pub fn set_state<T: std::convert::Into<crate::model::connector::State>>(
11852        mut self,
11853        v: T,
11854    ) -> Self {
11855        self.state = v.into();
11856        self
11857    }
11858
11859    /// Sets the value of [restart_policy][crate::model::Connector::restart_policy].
11860    ///
11861    /// Note that all the setters affecting `restart_policy` are mutually
11862    /// exclusive.
11863    pub fn set_restart_policy<
11864        T: std::convert::Into<std::option::Option<crate::model::connector::RestartPolicy>>,
11865    >(
11866        mut self,
11867        v: T,
11868    ) -> Self {
11869        self.restart_policy = v.into();
11870        self
11871    }
11872
11873    /// The value of [restart_policy][crate::model::Connector::restart_policy]
11874    /// if it holds a `TaskRestartPolicy`, `None` if the field is not set or
11875    /// holds a different branch.
11876    pub fn task_restart_policy(
11877        &self,
11878    ) -> std::option::Option<&std::boxed::Box<crate::model::TaskRetryPolicy>> {
11879        #[allow(unreachable_patterns)]
11880        self.restart_policy.as_ref().and_then(|v| match v {
11881            crate::model::connector::RestartPolicy::TaskRestartPolicy(v) => {
11882                std::option::Option::Some(v)
11883            }
11884            _ => std::option::Option::None,
11885        })
11886    }
11887
11888    /// Sets the value of [restart_policy][crate::model::Connector::restart_policy]
11889    /// to hold a `TaskRestartPolicy`.
11890    ///
11891    /// Note that all the setters affecting `restart_policy` are
11892    /// mutually exclusive.
11893    pub fn set_task_restart_policy<
11894        T: std::convert::Into<std::boxed::Box<crate::model::TaskRetryPolicy>>,
11895    >(
11896        mut self,
11897        v: T,
11898    ) -> Self {
11899        self.restart_policy = std::option::Option::Some(
11900            crate::model::connector::RestartPolicy::TaskRestartPolicy(v.into()),
11901        );
11902        self
11903    }
11904}
11905
11906impl wkt::message::Message for Connector {
11907    fn typename() -> &'static str {
11908        "type.googleapis.com/google.cloud.managedkafka.v1.Connector"
11909    }
11910}
11911
11912#[doc(hidden)]
11913impl<'de> serde::de::Deserialize<'de> for Connector {
11914    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11915    where
11916        D: serde::Deserializer<'de>,
11917    {
11918        #[allow(non_camel_case_types)]
11919        #[doc(hidden)]
11920        #[derive(PartialEq, Eq, Hash)]
11921        enum __FieldTag {
11922            __task_restart_policy,
11923            __name,
11924            __configs,
11925            __state,
11926            Unknown(std::string::String),
11927        }
11928        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11929            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11930            where
11931                D: serde::Deserializer<'de>,
11932            {
11933                struct Visitor;
11934                impl<'de> serde::de::Visitor<'de> for Visitor {
11935                    type Value = __FieldTag;
11936                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11937                        formatter.write_str("a field name for Connector")
11938                    }
11939                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11940                    where
11941                        E: serde::de::Error,
11942                    {
11943                        use std::result::Result::Ok;
11944                        use std::string::ToString;
11945                        match value {
11946                            "taskRestartPolicy" => Ok(__FieldTag::__task_restart_policy),
11947                            "task_restart_policy" => Ok(__FieldTag::__task_restart_policy),
11948                            "name" => Ok(__FieldTag::__name),
11949                            "configs" => Ok(__FieldTag::__configs),
11950                            "state" => Ok(__FieldTag::__state),
11951                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11952                        }
11953                    }
11954                }
11955                deserializer.deserialize_identifier(Visitor)
11956            }
11957        }
11958        struct Visitor;
11959        impl<'de> serde::de::Visitor<'de> for Visitor {
11960            type Value = Connector;
11961            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11962                formatter.write_str("struct Connector")
11963            }
11964            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11965            where
11966                A: serde::de::MapAccess<'de>,
11967            {
11968                #[allow(unused_imports)]
11969                use serde::de::Error;
11970                use std::option::Option::Some;
11971                let mut fields = std::collections::HashSet::new();
11972                let mut result = Self::Value::new();
11973                while let Some(tag) = map.next_key::<__FieldTag>()? {
11974                    #[allow(clippy::match_single_binding)]
11975                    match tag {
11976                        __FieldTag::__task_restart_policy => {
11977                            if !fields.insert(__FieldTag::__task_restart_policy) {
11978                                return std::result::Result::Err(A::Error::duplicate_field(
11979                                    "multiple values for task_restart_policy",
11980                                ));
11981                            }
11982                            if result.restart_policy.is_some() {
11983                                return std::result::Result::Err(A::Error::duplicate_field(
11984                                    "multiple values for `restart_policy`, a oneof with full ID .google.cloud.managedkafka.v1.Connector.task_restart_policy, latest field was taskRestartPolicy",
11985                                ));
11986                            }
11987                            result.restart_policy = std::option::Option::Some(
11988                                crate::model::connector::RestartPolicy::TaskRestartPolicy(
11989                                    map.next_value::<std::option::Option<
11990                                        std::boxed::Box<crate::model::TaskRetryPolicy>,
11991                                    >>()?
11992                                    .unwrap_or_default(),
11993                                ),
11994                            );
11995                        }
11996                        __FieldTag::__name => {
11997                            if !fields.insert(__FieldTag::__name) {
11998                                return std::result::Result::Err(A::Error::duplicate_field(
11999                                    "multiple values for name",
12000                                ));
12001                            }
12002                            result.name = map
12003                                .next_value::<std::option::Option<std::string::String>>()?
12004                                .unwrap_or_default();
12005                        }
12006                        __FieldTag::__configs => {
12007                            if !fields.insert(__FieldTag::__configs) {
12008                                return std::result::Result::Err(A::Error::duplicate_field(
12009                                    "multiple values for configs",
12010                                ));
12011                            }
12012                            result.configs = map
12013                                .next_value::<std::option::Option<
12014                                    std::collections::HashMap<
12015                                        std::string::String,
12016                                        std::string::String,
12017                                    >,
12018                                >>()?
12019                                .unwrap_or_default();
12020                        }
12021                        __FieldTag::__state => {
12022                            if !fields.insert(__FieldTag::__state) {
12023                                return std::result::Result::Err(A::Error::duplicate_field(
12024                                    "multiple values for state",
12025                                ));
12026                            }
12027                            result.state = map
12028                                .next_value::<std::option::Option<crate::model::connector::State>>(
12029                                )?
12030                                .unwrap_or_default();
12031                        }
12032                        __FieldTag::Unknown(key) => {
12033                            let value = map.next_value::<serde_json::Value>()?;
12034                            result._unknown_fields.insert(key, value);
12035                        }
12036                    }
12037                }
12038                std::result::Result::Ok(result)
12039            }
12040        }
12041        deserializer.deserialize_any(Visitor)
12042    }
12043}
12044
12045#[doc(hidden)]
12046impl serde::ser::Serialize for Connector {
12047    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12048    where
12049        S: serde::ser::Serializer,
12050    {
12051        use serde::ser::SerializeMap;
12052        #[allow(unused_imports)]
12053        use std::option::Option::Some;
12054        let mut state = serializer.serialize_map(std::option::Option::None)?;
12055        if let Some(value) = self.task_restart_policy() {
12056            state.serialize_entry("taskRestartPolicy", value)?;
12057        }
12058        if !self.name.is_empty() {
12059            state.serialize_entry("name", &self.name)?;
12060        }
12061        if !self.configs.is_empty() {
12062            state.serialize_entry("configs", &self.configs)?;
12063        }
12064        if !wkt::internal::is_default(&self.state) {
12065            state.serialize_entry("state", &self.state)?;
12066        }
12067        if !self._unknown_fields.is_empty() {
12068            for (key, value) in self._unknown_fields.iter() {
12069                state.serialize_entry(key, &value)?;
12070            }
12071        }
12072        state.end()
12073    }
12074}
12075
12076/// Defines additional types related to [Connector].
12077pub mod connector {
12078    #[allow(unused_imports)]
12079    use super::*;
12080
12081    /// The state of the connector.
12082    ///
12083    /// # Working with unknown values
12084    ///
12085    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12086    /// additional enum variants at any time. Adding new variants is not considered
12087    /// a breaking change. Applications should write their code in anticipation of:
12088    ///
12089    /// - New values appearing in future releases of the client library, **and**
12090    /// - New values received dynamically, without application changes.
12091    ///
12092    /// Please consult the [Working with enums] section in the user guide for some
12093    /// guidelines.
12094    ///
12095    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12096    #[derive(Clone, Debug, PartialEq)]
12097    #[non_exhaustive]
12098    pub enum State {
12099        /// A state was not specified.
12100        Unspecified,
12101        /// The connector is not assigned to any tasks, usually transient.
12102        Unassigned,
12103        /// The connector is running.
12104        Running,
12105        /// The connector has been paused.
12106        Paused,
12107        /// The connector has failed. See logs for why.
12108        Failed,
12109        /// The connector is restarting.
12110        Restarting,
12111        /// The connector has been stopped.
12112        Stopped,
12113        /// If set, the enum was initialized with an unknown value.
12114        ///
12115        /// Applications can examine the value using [State::value] or
12116        /// [State::name].
12117        UnknownValue(state::UnknownValue),
12118    }
12119
12120    #[doc(hidden)]
12121    pub mod state {
12122        #[allow(unused_imports)]
12123        use super::*;
12124        #[derive(Clone, Debug, PartialEq)]
12125        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12126    }
12127
12128    impl State {
12129        /// Gets the enum value.
12130        ///
12131        /// Returns `None` if the enum contains an unknown value deserialized from
12132        /// the string representation of enums.
12133        pub fn value(&self) -> std::option::Option<i32> {
12134            match self {
12135                Self::Unspecified => std::option::Option::Some(0),
12136                Self::Unassigned => std::option::Option::Some(1),
12137                Self::Running => std::option::Option::Some(2),
12138                Self::Paused => std::option::Option::Some(3),
12139                Self::Failed => std::option::Option::Some(4),
12140                Self::Restarting => std::option::Option::Some(5),
12141                Self::Stopped => std::option::Option::Some(6),
12142                Self::UnknownValue(u) => u.0.value(),
12143            }
12144        }
12145
12146        /// Gets the enum value as a string.
12147        ///
12148        /// Returns `None` if the enum contains an unknown value deserialized from
12149        /// the integer representation of enums.
12150        pub fn name(&self) -> std::option::Option<&str> {
12151            match self {
12152                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
12153                Self::Unassigned => std::option::Option::Some("UNASSIGNED"),
12154                Self::Running => std::option::Option::Some("RUNNING"),
12155                Self::Paused => std::option::Option::Some("PAUSED"),
12156                Self::Failed => std::option::Option::Some("FAILED"),
12157                Self::Restarting => std::option::Option::Some("RESTARTING"),
12158                Self::Stopped => std::option::Option::Some("STOPPED"),
12159                Self::UnknownValue(u) => u.0.name(),
12160            }
12161        }
12162    }
12163
12164    impl std::default::Default for State {
12165        fn default() -> Self {
12166            use std::convert::From;
12167            Self::from(0)
12168        }
12169    }
12170
12171    impl std::fmt::Display for State {
12172        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12173            wkt::internal::display_enum(f, self.name(), self.value())
12174        }
12175    }
12176
12177    impl std::convert::From<i32> for State {
12178        fn from(value: i32) -> Self {
12179            match value {
12180                0 => Self::Unspecified,
12181                1 => Self::Unassigned,
12182                2 => Self::Running,
12183                3 => Self::Paused,
12184                4 => Self::Failed,
12185                5 => Self::Restarting,
12186                6 => Self::Stopped,
12187                _ => Self::UnknownValue(state::UnknownValue(
12188                    wkt::internal::UnknownEnumValue::Integer(value),
12189                )),
12190            }
12191        }
12192    }
12193
12194    impl std::convert::From<&str> for State {
12195        fn from(value: &str) -> Self {
12196            use std::string::ToString;
12197            match value {
12198                "STATE_UNSPECIFIED" => Self::Unspecified,
12199                "UNASSIGNED" => Self::Unassigned,
12200                "RUNNING" => Self::Running,
12201                "PAUSED" => Self::Paused,
12202                "FAILED" => Self::Failed,
12203                "RESTARTING" => Self::Restarting,
12204                "STOPPED" => Self::Stopped,
12205                _ => Self::UnknownValue(state::UnknownValue(
12206                    wkt::internal::UnknownEnumValue::String(value.to_string()),
12207                )),
12208            }
12209        }
12210    }
12211
12212    impl serde::ser::Serialize for State {
12213        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12214        where
12215            S: serde::Serializer,
12216        {
12217            match self {
12218                Self::Unspecified => serializer.serialize_i32(0),
12219                Self::Unassigned => serializer.serialize_i32(1),
12220                Self::Running => serializer.serialize_i32(2),
12221                Self::Paused => serializer.serialize_i32(3),
12222                Self::Failed => serializer.serialize_i32(4),
12223                Self::Restarting => serializer.serialize_i32(5),
12224                Self::Stopped => serializer.serialize_i32(6),
12225                Self::UnknownValue(u) => u.0.serialize(serializer),
12226            }
12227        }
12228    }
12229
12230    impl<'de> serde::de::Deserialize<'de> for State {
12231        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12232        where
12233            D: serde::Deserializer<'de>,
12234        {
12235            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
12236                ".google.cloud.managedkafka.v1.Connector.State",
12237            ))
12238        }
12239    }
12240
12241    /// A policy that specifies how to restart the failed connectors/tasks in a
12242    /// Cluster resource. If not set, the failed connectors/tasks won't be
12243    /// restarted.
12244    #[derive(Clone, Debug, PartialEq)]
12245    #[non_exhaustive]
12246    pub enum RestartPolicy {
12247        /// Optional. Restarts the individual tasks of a Connector.
12248        TaskRestartPolicy(std::boxed::Box<crate::model::TaskRetryPolicy>),
12249    }
12250}
12251
12252/// Task Retry Policy is implemented on a best-effort
12253/// basis.
12254/// Retry delay will be exponential based on provided minimum and maximum
12255/// backoffs. <https://en.wikipedia.org/wiki/Exponential_backoff>.
12256/// Note that the delay between consecutive task restarts may not always
12257/// precisely match the configured settings. This can happen when the
12258/// ConnectCluster is in rebalancing state or if the ConnectCluster is
12259/// unresponsive etc. The default values for minimum and maximum backoffs are
12260/// 60 seconds and 30 minutes respectively.
12261#[derive(Clone, Debug, Default, PartialEq)]
12262#[non_exhaustive]
12263pub struct TaskRetryPolicy {
12264    /// Optional. The minimum amount of time to wait before retrying a failed task.
12265    /// This sets a lower bound for the backoff delay.
12266    pub minimum_backoff: std::option::Option<wkt::Duration>,
12267
12268    /// Optional. The maximum amount of time to wait before retrying a failed task.
12269    /// This sets an upper bound for the backoff delay.
12270    pub maximum_backoff: std::option::Option<wkt::Duration>,
12271
12272    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12273}
12274
12275impl TaskRetryPolicy {
12276    pub fn new() -> Self {
12277        std::default::Default::default()
12278    }
12279
12280    /// Sets the value of [minimum_backoff][crate::model::TaskRetryPolicy::minimum_backoff].
12281    pub fn set_minimum_backoff<T>(mut self, v: T) -> Self
12282    where
12283        T: std::convert::Into<wkt::Duration>,
12284    {
12285        self.minimum_backoff = std::option::Option::Some(v.into());
12286        self
12287    }
12288
12289    /// Sets or clears the value of [minimum_backoff][crate::model::TaskRetryPolicy::minimum_backoff].
12290    pub fn set_or_clear_minimum_backoff<T>(mut self, v: std::option::Option<T>) -> Self
12291    where
12292        T: std::convert::Into<wkt::Duration>,
12293    {
12294        self.minimum_backoff = v.map(|x| x.into());
12295        self
12296    }
12297
12298    /// Sets the value of [maximum_backoff][crate::model::TaskRetryPolicy::maximum_backoff].
12299    pub fn set_maximum_backoff<T>(mut self, v: T) -> Self
12300    where
12301        T: std::convert::Into<wkt::Duration>,
12302    {
12303        self.maximum_backoff = std::option::Option::Some(v.into());
12304        self
12305    }
12306
12307    /// Sets or clears the value of [maximum_backoff][crate::model::TaskRetryPolicy::maximum_backoff].
12308    pub fn set_or_clear_maximum_backoff<T>(mut self, v: std::option::Option<T>) -> Self
12309    where
12310        T: std::convert::Into<wkt::Duration>,
12311    {
12312        self.maximum_backoff = v.map(|x| x.into());
12313        self
12314    }
12315}
12316
12317impl wkt::message::Message for TaskRetryPolicy {
12318    fn typename() -> &'static str {
12319        "type.googleapis.com/google.cloud.managedkafka.v1.TaskRetryPolicy"
12320    }
12321}
12322
12323#[doc(hidden)]
12324impl<'de> serde::de::Deserialize<'de> for TaskRetryPolicy {
12325    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12326    where
12327        D: serde::Deserializer<'de>,
12328    {
12329        #[allow(non_camel_case_types)]
12330        #[doc(hidden)]
12331        #[derive(PartialEq, Eq, Hash)]
12332        enum __FieldTag {
12333            __minimum_backoff,
12334            __maximum_backoff,
12335            Unknown(std::string::String),
12336        }
12337        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12338            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12339            where
12340                D: serde::Deserializer<'de>,
12341            {
12342                struct Visitor;
12343                impl<'de> serde::de::Visitor<'de> for Visitor {
12344                    type Value = __FieldTag;
12345                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12346                        formatter.write_str("a field name for TaskRetryPolicy")
12347                    }
12348                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12349                    where
12350                        E: serde::de::Error,
12351                    {
12352                        use std::result::Result::Ok;
12353                        use std::string::ToString;
12354                        match value {
12355                            "minimumBackoff" => Ok(__FieldTag::__minimum_backoff),
12356                            "minimum_backoff" => Ok(__FieldTag::__minimum_backoff),
12357                            "maximumBackoff" => Ok(__FieldTag::__maximum_backoff),
12358                            "maximum_backoff" => Ok(__FieldTag::__maximum_backoff),
12359                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12360                        }
12361                    }
12362                }
12363                deserializer.deserialize_identifier(Visitor)
12364            }
12365        }
12366        struct Visitor;
12367        impl<'de> serde::de::Visitor<'de> for Visitor {
12368            type Value = TaskRetryPolicy;
12369            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12370                formatter.write_str("struct TaskRetryPolicy")
12371            }
12372            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12373            where
12374                A: serde::de::MapAccess<'de>,
12375            {
12376                #[allow(unused_imports)]
12377                use serde::de::Error;
12378                use std::option::Option::Some;
12379                let mut fields = std::collections::HashSet::new();
12380                let mut result = Self::Value::new();
12381                while let Some(tag) = map.next_key::<__FieldTag>()? {
12382                    #[allow(clippy::match_single_binding)]
12383                    match tag {
12384                        __FieldTag::__minimum_backoff => {
12385                            if !fields.insert(__FieldTag::__minimum_backoff) {
12386                                return std::result::Result::Err(A::Error::duplicate_field(
12387                                    "multiple values for minimum_backoff",
12388                                ));
12389                            }
12390                            result.minimum_backoff =
12391                                map.next_value::<std::option::Option<wkt::Duration>>()?;
12392                        }
12393                        __FieldTag::__maximum_backoff => {
12394                            if !fields.insert(__FieldTag::__maximum_backoff) {
12395                                return std::result::Result::Err(A::Error::duplicate_field(
12396                                    "multiple values for maximum_backoff",
12397                                ));
12398                            }
12399                            result.maximum_backoff =
12400                                map.next_value::<std::option::Option<wkt::Duration>>()?;
12401                        }
12402                        __FieldTag::Unknown(key) => {
12403                            let value = map.next_value::<serde_json::Value>()?;
12404                            result._unknown_fields.insert(key, value);
12405                        }
12406                    }
12407                }
12408                std::result::Result::Ok(result)
12409            }
12410        }
12411        deserializer.deserialize_any(Visitor)
12412    }
12413}
12414
12415#[doc(hidden)]
12416impl serde::ser::Serialize for TaskRetryPolicy {
12417    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12418    where
12419        S: serde::ser::Serializer,
12420    {
12421        use serde::ser::SerializeMap;
12422        #[allow(unused_imports)]
12423        use std::option::Option::Some;
12424        let mut state = serializer.serialize_map(std::option::Option::None)?;
12425        if self.minimum_backoff.is_some() {
12426            state.serialize_entry("minimumBackoff", &self.minimum_backoff)?;
12427        }
12428        if self.maximum_backoff.is_some() {
12429            state.serialize_entry("maximumBackoff", &self.maximum_backoff)?;
12430        }
12431        if !self._unknown_fields.is_empty() {
12432            for (key, value) in self._unknown_fields.iter() {
12433                state.serialize_entry(key, &value)?;
12434            }
12435        }
12436        state.end()
12437    }
12438}
12439
12440/// Represents the set of ACLs for a given Kafka Resource Pattern, which consists
12441/// of resource_type, resource_name and pattern_type.
12442#[derive(Clone, Debug, Default, PartialEq)]
12443#[non_exhaustive]
12444pub struct Acl {
12445    /// Identifier. The name for the acl. Represents a single Resource Pattern.
12446    /// Structured like:
12447    /// projects/{project}/locations/{location}/clusters/{cluster}/acls/{acl_id}
12448    ///
12449    /// The structure of `acl_id` defines the Resource Pattern (resource_type,
12450    /// resource_name, pattern_type) of the acl. `acl_id` is structured like one of
12451    /// the following:
12452    ///
12453    /// For acls on the cluster:
12454    /// `cluster`
12455    ///
12456    /// For acls on a single resource within the cluster:
12457    /// `topic/{resource_name}`
12458    /// `consumerGroup/{resource_name}`
12459    /// `transactionalId/{resource_name}`
12460    ///
12461    /// For acls on all resources that match a prefix:
12462    /// `topicPrefixed/{resource_name}`
12463    /// `consumerGroupPrefixed/{resource_name}`
12464    /// `transactionalIdPrefixed/{resource_name}`
12465    ///
12466    /// For acls on all resources of a given type (i.e. the wildcard literal "*"):
12467    /// `allTopics` (represents `topic/*`)
12468    /// `allConsumerGroups` (represents `consumerGroup/*`)
12469    /// `allTransactionalIds` (represents `transactionalId/*`)
12470    pub name: std::string::String,
12471
12472    /// Required. The ACL entries that apply to the resource pattern. The maximum
12473    /// number of allowed entries 100.
12474    pub acl_entries: std::vec::Vec<crate::model::AclEntry>,
12475
12476    /// Optional. `etag` is used for concurrency control. An `etag` is returned in
12477    /// the response to `GetAcl` and `CreateAcl`. Callers are required to put that
12478    /// etag in the request to `UpdateAcl` to ensure that their change will be
12479    /// applied to the same version of the acl that exists in the Kafka Cluster.
12480    ///
12481    /// A terminal 'T' character in the etag indicates that the AclEntries were
12482    /// truncated; more entries for the Acl exist on the Kafka Cluster, but can't
12483    /// be returned in the Acl due to repeated field limits.
12484    pub etag: std::string::String,
12485
12486    /// Output only. The ACL resource type derived from the name. One of: CLUSTER,
12487    /// TOPIC, GROUP, TRANSACTIONAL_ID.
12488    pub resource_type: std::string::String,
12489
12490    /// Output only. The ACL resource name derived from the name. For cluster
12491    /// resource_type, this is always "kafka-cluster". Can be the wildcard literal
12492    /// "*".
12493    pub resource_name: std::string::String,
12494
12495    /// Output only. The ACL pattern type derived from the name. One of: LITERAL,
12496    /// PREFIXED.
12497    pub pattern_type: std::string::String,
12498
12499    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12500}
12501
12502impl Acl {
12503    pub fn new() -> Self {
12504        std::default::Default::default()
12505    }
12506
12507    /// Sets the value of [name][crate::model::Acl::name].
12508    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12509        self.name = v.into();
12510        self
12511    }
12512
12513    /// Sets the value of [acl_entries][crate::model::Acl::acl_entries].
12514    pub fn set_acl_entries<T, V>(mut self, v: T) -> Self
12515    where
12516        T: std::iter::IntoIterator<Item = V>,
12517        V: std::convert::Into<crate::model::AclEntry>,
12518    {
12519        use std::iter::Iterator;
12520        self.acl_entries = v.into_iter().map(|i| i.into()).collect();
12521        self
12522    }
12523
12524    /// Sets the value of [etag][crate::model::Acl::etag].
12525    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12526        self.etag = v.into();
12527        self
12528    }
12529
12530    /// Sets the value of [resource_type][crate::model::Acl::resource_type].
12531    pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12532        self.resource_type = v.into();
12533        self
12534    }
12535
12536    /// Sets the value of [resource_name][crate::model::Acl::resource_name].
12537    pub fn set_resource_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12538        self.resource_name = v.into();
12539        self
12540    }
12541
12542    /// Sets the value of [pattern_type][crate::model::Acl::pattern_type].
12543    pub fn set_pattern_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12544        self.pattern_type = v.into();
12545        self
12546    }
12547}
12548
12549impl wkt::message::Message for Acl {
12550    fn typename() -> &'static str {
12551        "type.googleapis.com/google.cloud.managedkafka.v1.Acl"
12552    }
12553}
12554
12555#[doc(hidden)]
12556impl<'de> serde::de::Deserialize<'de> for Acl {
12557    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12558    where
12559        D: serde::Deserializer<'de>,
12560    {
12561        #[allow(non_camel_case_types)]
12562        #[doc(hidden)]
12563        #[derive(PartialEq, Eq, Hash)]
12564        enum __FieldTag {
12565            __name,
12566            __acl_entries,
12567            __etag,
12568            __resource_type,
12569            __resource_name,
12570            __pattern_type,
12571            Unknown(std::string::String),
12572        }
12573        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12574            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12575            where
12576                D: serde::Deserializer<'de>,
12577            {
12578                struct Visitor;
12579                impl<'de> serde::de::Visitor<'de> for Visitor {
12580                    type Value = __FieldTag;
12581                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12582                        formatter.write_str("a field name for Acl")
12583                    }
12584                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12585                    where
12586                        E: serde::de::Error,
12587                    {
12588                        use std::result::Result::Ok;
12589                        use std::string::ToString;
12590                        match value {
12591                            "name" => Ok(__FieldTag::__name),
12592                            "aclEntries" => Ok(__FieldTag::__acl_entries),
12593                            "acl_entries" => Ok(__FieldTag::__acl_entries),
12594                            "etag" => Ok(__FieldTag::__etag),
12595                            "resourceType" => Ok(__FieldTag::__resource_type),
12596                            "resource_type" => Ok(__FieldTag::__resource_type),
12597                            "resourceName" => Ok(__FieldTag::__resource_name),
12598                            "resource_name" => Ok(__FieldTag::__resource_name),
12599                            "patternType" => Ok(__FieldTag::__pattern_type),
12600                            "pattern_type" => Ok(__FieldTag::__pattern_type),
12601                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12602                        }
12603                    }
12604                }
12605                deserializer.deserialize_identifier(Visitor)
12606            }
12607        }
12608        struct Visitor;
12609        impl<'de> serde::de::Visitor<'de> for Visitor {
12610            type Value = Acl;
12611            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12612                formatter.write_str("struct Acl")
12613            }
12614            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12615            where
12616                A: serde::de::MapAccess<'de>,
12617            {
12618                #[allow(unused_imports)]
12619                use serde::de::Error;
12620                use std::option::Option::Some;
12621                let mut fields = std::collections::HashSet::new();
12622                let mut result = Self::Value::new();
12623                while let Some(tag) = map.next_key::<__FieldTag>()? {
12624                    #[allow(clippy::match_single_binding)]
12625                    match tag {
12626                        __FieldTag::__name => {
12627                            if !fields.insert(__FieldTag::__name) {
12628                                return std::result::Result::Err(A::Error::duplicate_field(
12629                                    "multiple values for name",
12630                                ));
12631                            }
12632                            result.name = map
12633                                .next_value::<std::option::Option<std::string::String>>()?
12634                                .unwrap_or_default();
12635                        }
12636                        __FieldTag::__acl_entries => {
12637                            if !fields.insert(__FieldTag::__acl_entries) {
12638                                return std::result::Result::Err(A::Error::duplicate_field(
12639                                    "multiple values for acl_entries",
12640                                ));
12641                            }
12642                            result.acl_entries = map.next_value::<std::option::Option<std::vec::Vec<crate::model::AclEntry>>>()?.unwrap_or_default();
12643                        }
12644                        __FieldTag::__etag => {
12645                            if !fields.insert(__FieldTag::__etag) {
12646                                return std::result::Result::Err(A::Error::duplicate_field(
12647                                    "multiple values for etag",
12648                                ));
12649                            }
12650                            result.etag = map
12651                                .next_value::<std::option::Option<std::string::String>>()?
12652                                .unwrap_or_default();
12653                        }
12654                        __FieldTag::__resource_type => {
12655                            if !fields.insert(__FieldTag::__resource_type) {
12656                                return std::result::Result::Err(A::Error::duplicate_field(
12657                                    "multiple values for resource_type",
12658                                ));
12659                            }
12660                            result.resource_type = map
12661                                .next_value::<std::option::Option<std::string::String>>()?
12662                                .unwrap_or_default();
12663                        }
12664                        __FieldTag::__resource_name => {
12665                            if !fields.insert(__FieldTag::__resource_name) {
12666                                return std::result::Result::Err(A::Error::duplicate_field(
12667                                    "multiple values for resource_name",
12668                                ));
12669                            }
12670                            result.resource_name = map
12671                                .next_value::<std::option::Option<std::string::String>>()?
12672                                .unwrap_or_default();
12673                        }
12674                        __FieldTag::__pattern_type => {
12675                            if !fields.insert(__FieldTag::__pattern_type) {
12676                                return std::result::Result::Err(A::Error::duplicate_field(
12677                                    "multiple values for pattern_type",
12678                                ));
12679                            }
12680                            result.pattern_type = map
12681                                .next_value::<std::option::Option<std::string::String>>()?
12682                                .unwrap_or_default();
12683                        }
12684                        __FieldTag::Unknown(key) => {
12685                            let value = map.next_value::<serde_json::Value>()?;
12686                            result._unknown_fields.insert(key, value);
12687                        }
12688                    }
12689                }
12690                std::result::Result::Ok(result)
12691            }
12692        }
12693        deserializer.deserialize_any(Visitor)
12694    }
12695}
12696
12697#[doc(hidden)]
12698impl serde::ser::Serialize for Acl {
12699    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12700    where
12701        S: serde::ser::Serializer,
12702    {
12703        use serde::ser::SerializeMap;
12704        #[allow(unused_imports)]
12705        use std::option::Option::Some;
12706        let mut state = serializer.serialize_map(std::option::Option::None)?;
12707        if !self.name.is_empty() {
12708            state.serialize_entry("name", &self.name)?;
12709        }
12710        if !self.acl_entries.is_empty() {
12711            state.serialize_entry("aclEntries", &self.acl_entries)?;
12712        }
12713        if !self.etag.is_empty() {
12714            state.serialize_entry("etag", &self.etag)?;
12715        }
12716        if !self.resource_type.is_empty() {
12717            state.serialize_entry("resourceType", &self.resource_type)?;
12718        }
12719        if !self.resource_name.is_empty() {
12720            state.serialize_entry("resourceName", &self.resource_name)?;
12721        }
12722        if !self.pattern_type.is_empty() {
12723            state.serialize_entry("patternType", &self.pattern_type)?;
12724        }
12725        if !self._unknown_fields.is_empty() {
12726            for (key, value) in self._unknown_fields.iter() {
12727                state.serialize_entry(key, &value)?;
12728            }
12729        }
12730        state.end()
12731    }
12732}
12733
12734/// Represents the access granted for a given Resource Pattern in an ACL.
12735#[derive(Clone, Debug, Default, PartialEq)]
12736#[non_exhaustive]
12737pub struct AclEntry {
12738    /// Required. The principal. Specified as Google Cloud account, with the Kafka
12739    /// StandardAuthorizer prefix "User:". For example:
12740    /// "User:test-kafka-client@test-project.iam.gserviceaccount.com".
12741    /// Can be the wildcard "User:*" to refer to all users.
12742    pub principal: std::string::String,
12743
12744    /// Required. The permission type. Accepted values are (case insensitive):
12745    /// ALLOW, DENY.
12746    pub permission_type: std::string::String,
12747
12748    /// Required. The operation type. Allowed values are (case insensitive): ALL,
12749    /// READ, WRITE, CREATE, DELETE, ALTER, DESCRIBE, CLUSTER_ACTION,
12750    /// DESCRIBE_CONFIGS, ALTER_CONFIGS, and IDEMPOTENT_WRITE. See
12751    /// <https://kafka.apache.org/documentation/#operations_resources_and_protocols>
12752    /// for valid combinations of resource_type and operation for different Kafka
12753    /// API requests.
12754    pub operation: std::string::String,
12755
12756    /// Required. The host. Must be set to "*" for Managed Service for Apache
12757    /// Kafka.
12758    pub host: std::string::String,
12759
12760    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12761}
12762
12763impl AclEntry {
12764    pub fn new() -> Self {
12765        std::default::Default::default()
12766    }
12767
12768    /// Sets the value of [principal][crate::model::AclEntry::principal].
12769    pub fn set_principal<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12770        self.principal = v.into();
12771        self
12772    }
12773
12774    /// Sets the value of [permission_type][crate::model::AclEntry::permission_type].
12775    pub fn set_permission_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12776        self.permission_type = v.into();
12777        self
12778    }
12779
12780    /// Sets the value of [operation][crate::model::AclEntry::operation].
12781    pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12782        self.operation = v.into();
12783        self
12784    }
12785
12786    /// Sets the value of [host][crate::model::AclEntry::host].
12787    pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12788        self.host = v.into();
12789        self
12790    }
12791}
12792
12793impl wkt::message::Message for AclEntry {
12794    fn typename() -> &'static str {
12795        "type.googleapis.com/google.cloud.managedkafka.v1.AclEntry"
12796    }
12797}
12798
12799#[doc(hidden)]
12800impl<'de> serde::de::Deserialize<'de> for AclEntry {
12801    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12802    where
12803        D: serde::Deserializer<'de>,
12804    {
12805        #[allow(non_camel_case_types)]
12806        #[doc(hidden)]
12807        #[derive(PartialEq, Eq, Hash)]
12808        enum __FieldTag {
12809            __principal,
12810            __permission_type,
12811            __operation,
12812            __host,
12813            Unknown(std::string::String),
12814        }
12815        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12816            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12817            where
12818                D: serde::Deserializer<'de>,
12819            {
12820                struct Visitor;
12821                impl<'de> serde::de::Visitor<'de> for Visitor {
12822                    type Value = __FieldTag;
12823                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12824                        formatter.write_str("a field name for AclEntry")
12825                    }
12826                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12827                    where
12828                        E: serde::de::Error,
12829                    {
12830                        use std::result::Result::Ok;
12831                        use std::string::ToString;
12832                        match value {
12833                            "principal" => Ok(__FieldTag::__principal),
12834                            "permissionType" => Ok(__FieldTag::__permission_type),
12835                            "permission_type" => Ok(__FieldTag::__permission_type),
12836                            "operation" => Ok(__FieldTag::__operation),
12837                            "host" => Ok(__FieldTag::__host),
12838                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12839                        }
12840                    }
12841                }
12842                deserializer.deserialize_identifier(Visitor)
12843            }
12844        }
12845        struct Visitor;
12846        impl<'de> serde::de::Visitor<'de> for Visitor {
12847            type Value = AclEntry;
12848            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12849                formatter.write_str("struct AclEntry")
12850            }
12851            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12852            where
12853                A: serde::de::MapAccess<'de>,
12854            {
12855                #[allow(unused_imports)]
12856                use serde::de::Error;
12857                use std::option::Option::Some;
12858                let mut fields = std::collections::HashSet::new();
12859                let mut result = Self::Value::new();
12860                while let Some(tag) = map.next_key::<__FieldTag>()? {
12861                    #[allow(clippy::match_single_binding)]
12862                    match tag {
12863                        __FieldTag::__principal => {
12864                            if !fields.insert(__FieldTag::__principal) {
12865                                return std::result::Result::Err(A::Error::duplicate_field(
12866                                    "multiple values for principal",
12867                                ));
12868                            }
12869                            result.principal = map
12870                                .next_value::<std::option::Option<std::string::String>>()?
12871                                .unwrap_or_default();
12872                        }
12873                        __FieldTag::__permission_type => {
12874                            if !fields.insert(__FieldTag::__permission_type) {
12875                                return std::result::Result::Err(A::Error::duplicate_field(
12876                                    "multiple values for permission_type",
12877                                ));
12878                            }
12879                            result.permission_type = map
12880                                .next_value::<std::option::Option<std::string::String>>()?
12881                                .unwrap_or_default();
12882                        }
12883                        __FieldTag::__operation => {
12884                            if !fields.insert(__FieldTag::__operation) {
12885                                return std::result::Result::Err(A::Error::duplicate_field(
12886                                    "multiple values for operation",
12887                                ));
12888                            }
12889                            result.operation = map
12890                                .next_value::<std::option::Option<std::string::String>>()?
12891                                .unwrap_or_default();
12892                        }
12893                        __FieldTag::__host => {
12894                            if !fields.insert(__FieldTag::__host) {
12895                                return std::result::Result::Err(A::Error::duplicate_field(
12896                                    "multiple values for host",
12897                                ));
12898                            }
12899                            result.host = map
12900                                .next_value::<std::option::Option<std::string::String>>()?
12901                                .unwrap_or_default();
12902                        }
12903                        __FieldTag::Unknown(key) => {
12904                            let value = map.next_value::<serde_json::Value>()?;
12905                            result._unknown_fields.insert(key, value);
12906                        }
12907                    }
12908                }
12909                std::result::Result::Ok(result)
12910            }
12911        }
12912        deserializer.deserialize_any(Visitor)
12913    }
12914}
12915
12916#[doc(hidden)]
12917impl serde::ser::Serialize for AclEntry {
12918    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12919    where
12920        S: serde::ser::Serializer,
12921    {
12922        use serde::ser::SerializeMap;
12923        #[allow(unused_imports)]
12924        use std::option::Option::Some;
12925        let mut state = serializer.serialize_map(std::option::Option::None)?;
12926        if !self.principal.is_empty() {
12927            state.serialize_entry("principal", &self.principal)?;
12928        }
12929        if !self.permission_type.is_empty() {
12930            state.serialize_entry("permissionType", &self.permission_type)?;
12931        }
12932        if !self.operation.is_empty() {
12933            state.serialize_entry("operation", &self.operation)?;
12934        }
12935        if !self.host.is_empty() {
12936            state.serialize_entry("host", &self.host)?;
12937        }
12938        if !self._unknown_fields.is_empty() {
12939            for (key, value) in self._unknown_fields.iter() {
12940                state.serialize_entry(key, &value)?;
12941            }
12942        }
12943        state.end()
12944    }
12945}