google_cloud_networkconnectivity_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 iam_v1;
25extern crate lazy_static;
26extern crate location;
27extern crate longrunning;
28extern crate lro;
29extern crate reqwest;
30extern crate rpc;
31extern crate serde;
32extern crate serde_json;
33extern crate serde_with;
34extern crate std;
35extern crate tracing;
36extern crate wkt;
37
38/// Represents the metadata of the long-running operation.
39#[derive(Clone, Debug, Default, PartialEq)]
40#[non_exhaustive]
41pub struct OperationMetadata {
42    /// Output only. The time the operation was created.
43    pub create_time: std::option::Option<wkt::Timestamp>,
44
45    /// Output only. The time the operation finished running.
46    pub end_time: std::option::Option<wkt::Timestamp>,
47
48    /// Output only. Server-defined resource path for the target of the operation.
49    pub target: std::string::String,
50
51    /// Output only. Name of the verb executed by the operation.
52    pub verb: std::string::String,
53
54    /// Output only. Human-readable status of the operation, if any.
55    pub status_message: std::string::String,
56
57    /// Output only. Identifies whether the user has requested cancellation
58    /// of the operation. Operations that have been cancelled successfully
59    /// have
60    /// [google.longrunning.Operation.error][google.longrunning.Operation.error]
61    /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
62    /// corresponding to `Code.CANCELLED`.
63    ///
64    /// [google.longrunning.Operation.error]: longrunning::model::Operation::result
65    /// [google.rpc.Status.code]: rpc::model::Status::code
66    pub requested_cancellation: bool,
67
68    /// Output only. API version used to start the operation.
69    pub api_version: std::string::String,
70
71    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
72}
73
74impl OperationMetadata {
75    pub fn new() -> Self {
76        std::default::Default::default()
77    }
78
79    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
80    pub fn set_create_time<T>(mut self, v: T) -> Self
81    where
82        T: std::convert::Into<wkt::Timestamp>,
83    {
84        self.create_time = std::option::Option::Some(v.into());
85        self
86    }
87
88    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
89    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
90    where
91        T: std::convert::Into<wkt::Timestamp>,
92    {
93        self.create_time = v.map(|x| x.into());
94        self
95    }
96
97    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
98    pub fn set_end_time<T>(mut self, v: T) -> Self
99    where
100        T: std::convert::Into<wkt::Timestamp>,
101    {
102        self.end_time = std::option::Option::Some(v.into());
103        self
104    }
105
106    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
107    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
108    where
109        T: std::convert::Into<wkt::Timestamp>,
110    {
111        self.end_time = v.map(|x| x.into());
112        self
113    }
114
115    /// Sets the value of [target][crate::model::OperationMetadata::target].
116    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
117        self.target = v.into();
118        self
119    }
120
121    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
122    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
123        self.verb = v.into();
124        self
125    }
126
127    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
128    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
129        self.status_message = v.into();
130        self
131    }
132
133    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
134    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
135        self.requested_cancellation = v.into();
136        self
137    }
138
139    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
140    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
141        self.api_version = v.into();
142        self
143    }
144}
145
146impl wkt::message::Message for OperationMetadata {
147    fn typename() -> &'static str {
148        "type.googleapis.com/google.cloud.networkconnectivity.v1.OperationMetadata"
149    }
150}
151
152#[doc(hidden)]
153impl<'de> serde::de::Deserialize<'de> for OperationMetadata {
154    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
155    where
156        D: serde::Deserializer<'de>,
157    {
158        #[allow(non_camel_case_types)]
159        #[doc(hidden)]
160        #[derive(PartialEq, Eq, Hash)]
161        enum __FieldTag {
162            __create_time,
163            __end_time,
164            __target,
165            __verb,
166            __status_message,
167            __requested_cancellation,
168            __api_version,
169            Unknown(std::string::String),
170        }
171        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
172            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
173            where
174                D: serde::Deserializer<'de>,
175            {
176                struct Visitor;
177                impl<'de> serde::de::Visitor<'de> for Visitor {
178                    type Value = __FieldTag;
179                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
180                        formatter.write_str("a field name for OperationMetadata")
181                    }
182                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
183                    where
184                        E: serde::de::Error,
185                    {
186                        use std::result::Result::Ok;
187                        use std::string::ToString;
188                        match value {
189                            "createTime" => Ok(__FieldTag::__create_time),
190                            "create_time" => Ok(__FieldTag::__create_time),
191                            "endTime" => Ok(__FieldTag::__end_time),
192                            "end_time" => Ok(__FieldTag::__end_time),
193                            "target" => Ok(__FieldTag::__target),
194                            "verb" => Ok(__FieldTag::__verb),
195                            "statusMessage" => Ok(__FieldTag::__status_message),
196                            "status_message" => Ok(__FieldTag::__status_message),
197                            "requestedCancellation" => Ok(__FieldTag::__requested_cancellation),
198                            "requested_cancellation" => Ok(__FieldTag::__requested_cancellation),
199                            "apiVersion" => Ok(__FieldTag::__api_version),
200                            "api_version" => Ok(__FieldTag::__api_version),
201                            _ => Ok(__FieldTag::Unknown(value.to_string())),
202                        }
203                    }
204                }
205                deserializer.deserialize_identifier(Visitor)
206            }
207        }
208        struct Visitor;
209        impl<'de> serde::de::Visitor<'de> for Visitor {
210            type Value = OperationMetadata;
211            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
212                formatter.write_str("struct OperationMetadata")
213            }
214            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
215            where
216                A: serde::de::MapAccess<'de>,
217            {
218                #[allow(unused_imports)]
219                use serde::de::Error;
220                use std::option::Option::Some;
221                let mut fields = std::collections::HashSet::new();
222                let mut result = Self::Value::new();
223                while let Some(tag) = map.next_key::<__FieldTag>()? {
224                    #[allow(clippy::match_single_binding)]
225                    match tag {
226                        __FieldTag::__create_time => {
227                            if !fields.insert(__FieldTag::__create_time) {
228                                return std::result::Result::Err(A::Error::duplicate_field(
229                                    "multiple values for create_time",
230                                ));
231                            }
232                            result.create_time =
233                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
234                        }
235                        __FieldTag::__end_time => {
236                            if !fields.insert(__FieldTag::__end_time) {
237                                return std::result::Result::Err(A::Error::duplicate_field(
238                                    "multiple values for end_time",
239                                ));
240                            }
241                            result.end_time =
242                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
243                        }
244                        __FieldTag::__target => {
245                            if !fields.insert(__FieldTag::__target) {
246                                return std::result::Result::Err(A::Error::duplicate_field(
247                                    "multiple values for target",
248                                ));
249                            }
250                            result.target = map
251                                .next_value::<std::option::Option<std::string::String>>()?
252                                .unwrap_or_default();
253                        }
254                        __FieldTag::__verb => {
255                            if !fields.insert(__FieldTag::__verb) {
256                                return std::result::Result::Err(A::Error::duplicate_field(
257                                    "multiple values for verb",
258                                ));
259                            }
260                            result.verb = map
261                                .next_value::<std::option::Option<std::string::String>>()?
262                                .unwrap_or_default();
263                        }
264                        __FieldTag::__status_message => {
265                            if !fields.insert(__FieldTag::__status_message) {
266                                return std::result::Result::Err(A::Error::duplicate_field(
267                                    "multiple values for status_message",
268                                ));
269                            }
270                            result.status_message = map
271                                .next_value::<std::option::Option<std::string::String>>()?
272                                .unwrap_or_default();
273                        }
274                        __FieldTag::__requested_cancellation => {
275                            if !fields.insert(__FieldTag::__requested_cancellation) {
276                                return std::result::Result::Err(A::Error::duplicate_field(
277                                    "multiple values for requested_cancellation",
278                                ));
279                            }
280                            result.requested_cancellation = map
281                                .next_value::<std::option::Option<bool>>()?
282                                .unwrap_or_default();
283                        }
284                        __FieldTag::__api_version => {
285                            if !fields.insert(__FieldTag::__api_version) {
286                                return std::result::Result::Err(A::Error::duplicate_field(
287                                    "multiple values for api_version",
288                                ));
289                            }
290                            result.api_version = map
291                                .next_value::<std::option::Option<std::string::String>>()?
292                                .unwrap_or_default();
293                        }
294                        __FieldTag::Unknown(key) => {
295                            let value = map.next_value::<serde_json::Value>()?;
296                            result._unknown_fields.insert(key, value);
297                        }
298                    }
299                }
300                std::result::Result::Ok(result)
301            }
302        }
303        deserializer.deserialize_any(Visitor)
304    }
305}
306
307#[doc(hidden)]
308impl serde::ser::Serialize for OperationMetadata {
309    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
310    where
311        S: serde::ser::Serializer,
312    {
313        use serde::ser::SerializeMap;
314        #[allow(unused_imports)]
315        use std::option::Option::Some;
316        let mut state = serializer.serialize_map(std::option::Option::None)?;
317        if self.create_time.is_some() {
318            state.serialize_entry("createTime", &self.create_time)?;
319        }
320        if self.end_time.is_some() {
321            state.serialize_entry("endTime", &self.end_time)?;
322        }
323        if !self.target.is_empty() {
324            state.serialize_entry("target", &self.target)?;
325        }
326        if !self.verb.is_empty() {
327            state.serialize_entry("verb", &self.verb)?;
328        }
329        if !self.status_message.is_empty() {
330            state.serialize_entry("statusMessage", &self.status_message)?;
331        }
332        if !wkt::internal::is_default(&self.requested_cancellation) {
333            state.serialize_entry("requestedCancellation", &self.requested_cancellation)?;
334        }
335        if !self.api_version.is_empty() {
336            state.serialize_entry("apiVersion", &self.api_version)?;
337        }
338        if !self._unknown_fields.is_empty() {
339            for (key, value) in self._unknown_fields.iter() {
340                state.serialize_entry(key, &value)?;
341            }
342        }
343        state.end()
344    }
345}
346
347/// The ServiceConnectionMap resource.
348#[derive(Clone, Debug, Default, PartialEq)]
349#[non_exhaustive]
350pub struct ServiceConnectionMap {
351    /// Immutable. The name of a ServiceConnectionMap.
352    /// Format:
353    /// projects/{project}/locations/{location}/serviceConnectionMaps/{service_connection_map}
354    /// See: <https://google.aip.dev/122#fields-representing-resource-names>
355    pub name: std::string::String,
356
357    /// Output only. Time when the ServiceConnectionMap was created.
358    pub create_time: std::option::Option<wkt::Timestamp>,
359
360    /// Output only. Time when the ServiceConnectionMap was updated.
361    pub update_time: std::option::Option<wkt::Timestamp>,
362
363    /// User-defined labels.
364    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
365
366    /// A description of this resource.
367    pub description: std::string::String,
368
369    /// The service class identifier this ServiceConnectionMap is for.
370    /// The user of ServiceConnectionMap create API needs to have
371    /// networkconnecitivty.serviceclasses.use iam permission for the service
372    /// class.
373    pub service_class: std::string::String,
374
375    /// Output only. The service class uri this ServiceConnectionMap is for.
376    pub service_class_uri: std::string::String,
377
378    /// Output only. The infrastructure used for connections between
379    /// consumers/producers.
380    pub infrastructure: crate::model::Infrastructure,
381
382    /// The PSC configurations on producer side.
383    pub producer_psc_configs:
384        std::vec::Vec<crate::model::service_connection_map::ProducerPscConfig>,
385
386    /// The PSC configurations on consumer side.
387    pub consumer_psc_configs:
388        std::vec::Vec<crate::model::service_connection_map::ConsumerPscConfig>,
389
390    /// Output only. PSC connection details on consumer side.
391    pub consumer_psc_connections:
392        std::vec::Vec<crate::model::service_connection_map::ConsumerPscConnection>,
393
394    /// The token provided by the consumer. This token authenticates that the
395    /// consumer can create a connection within the specified project and network.
396    pub token: std::string::String,
397
398    /// Optional. The etag is computed by the server, and may be sent on update and
399    /// delete requests to ensure the client has an up-to-date value before
400    /// proceeding.
401    pub etag: std::option::Option<std::string::String>,
402
403    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
404}
405
406impl ServiceConnectionMap {
407    pub fn new() -> Self {
408        std::default::Default::default()
409    }
410
411    /// Sets the value of [name][crate::model::ServiceConnectionMap::name].
412    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
413        self.name = v.into();
414        self
415    }
416
417    /// Sets the value of [create_time][crate::model::ServiceConnectionMap::create_time].
418    pub fn set_create_time<T>(mut self, v: T) -> Self
419    where
420        T: std::convert::Into<wkt::Timestamp>,
421    {
422        self.create_time = std::option::Option::Some(v.into());
423        self
424    }
425
426    /// Sets or clears the value of [create_time][crate::model::ServiceConnectionMap::create_time].
427    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
428    where
429        T: std::convert::Into<wkt::Timestamp>,
430    {
431        self.create_time = v.map(|x| x.into());
432        self
433    }
434
435    /// Sets the value of [update_time][crate::model::ServiceConnectionMap::update_time].
436    pub fn set_update_time<T>(mut self, v: T) -> Self
437    where
438        T: std::convert::Into<wkt::Timestamp>,
439    {
440        self.update_time = std::option::Option::Some(v.into());
441        self
442    }
443
444    /// Sets or clears the value of [update_time][crate::model::ServiceConnectionMap::update_time].
445    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
446    where
447        T: std::convert::Into<wkt::Timestamp>,
448    {
449        self.update_time = v.map(|x| x.into());
450        self
451    }
452
453    /// Sets the value of [labels][crate::model::ServiceConnectionMap::labels].
454    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
455    where
456        T: std::iter::IntoIterator<Item = (K, V)>,
457        K: std::convert::Into<std::string::String>,
458        V: std::convert::Into<std::string::String>,
459    {
460        use std::iter::Iterator;
461        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
462        self
463    }
464
465    /// Sets the value of [description][crate::model::ServiceConnectionMap::description].
466    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
467        self.description = v.into();
468        self
469    }
470
471    /// Sets the value of [service_class][crate::model::ServiceConnectionMap::service_class].
472    pub fn set_service_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
473        self.service_class = v.into();
474        self
475    }
476
477    /// Sets the value of [service_class_uri][crate::model::ServiceConnectionMap::service_class_uri].
478    pub fn set_service_class_uri<T: std::convert::Into<std::string::String>>(
479        mut self,
480        v: T,
481    ) -> Self {
482        self.service_class_uri = v.into();
483        self
484    }
485
486    /// Sets the value of [infrastructure][crate::model::ServiceConnectionMap::infrastructure].
487    pub fn set_infrastructure<T: std::convert::Into<crate::model::Infrastructure>>(
488        mut self,
489        v: T,
490    ) -> Self {
491        self.infrastructure = v.into();
492        self
493    }
494
495    /// Sets the value of [producer_psc_configs][crate::model::ServiceConnectionMap::producer_psc_configs].
496    pub fn set_producer_psc_configs<T, V>(mut self, v: T) -> Self
497    where
498        T: std::iter::IntoIterator<Item = V>,
499        V: std::convert::Into<crate::model::service_connection_map::ProducerPscConfig>,
500    {
501        use std::iter::Iterator;
502        self.producer_psc_configs = v.into_iter().map(|i| i.into()).collect();
503        self
504    }
505
506    /// Sets the value of [consumer_psc_configs][crate::model::ServiceConnectionMap::consumer_psc_configs].
507    pub fn set_consumer_psc_configs<T, V>(mut self, v: T) -> Self
508    where
509        T: std::iter::IntoIterator<Item = V>,
510        V: std::convert::Into<crate::model::service_connection_map::ConsumerPscConfig>,
511    {
512        use std::iter::Iterator;
513        self.consumer_psc_configs = v.into_iter().map(|i| i.into()).collect();
514        self
515    }
516
517    /// Sets the value of [consumer_psc_connections][crate::model::ServiceConnectionMap::consumer_psc_connections].
518    pub fn set_consumer_psc_connections<T, V>(mut self, v: T) -> Self
519    where
520        T: std::iter::IntoIterator<Item = V>,
521        V: std::convert::Into<crate::model::service_connection_map::ConsumerPscConnection>,
522    {
523        use std::iter::Iterator;
524        self.consumer_psc_connections = v.into_iter().map(|i| i.into()).collect();
525        self
526    }
527
528    /// Sets the value of [token][crate::model::ServiceConnectionMap::token].
529    pub fn set_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
530        self.token = v.into();
531        self
532    }
533
534    /// Sets the value of [etag][crate::model::ServiceConnectionMap::etag].
535    pub fn set_etag<T>(mut self, v: T) -> Self
536    where
537        T: std::convert::Into<std::string::String>,
538    {
539        self.etag = std::option::Option::Some(v.into());
540        self
541    }
542
543    /// Sets or clears the value of [etag][crate::model::ServiceConnectionMap::etag].
544    pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
545    where
546        T: std::convert::Into<std::string::String>,
547    {
548        self.etag = v.map(|x| x.into());
549        self
550    }
551}
552
553impl wkt::message::Message for ServiceConnectionMap {
554    fn typename() -> &'static str {
555        "type.googleapis.com/google.cloud.networkconnectivity.v1.ServiceConnectionMap"
556    }
557}
558
559#[doc(hidden)]
560impl<'de> serde::de::Deserialize<'de> for ServiceConnectionMap {
561    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
562    where
563        D: serde::Deserializer<'de>,
564    {
565        #[allow(non_camel_case_types)]
566        #[doc(hidden)]
567        #[derive(PartialEq, Eq, Hash)]
568        enum __FieldTag {
569            __name,
570            __create_time,
571            __update_time,
572            __labels,
573            __description,
574            __service_class,
575            __service_class_uri,
576            __infrastructure,
577            __producer_psc_configs,
578            __consumer_psc_configs,
579            __consumer_psc_connections,
580            __token,
581            __etag,
582            Unknown(std::string::String),
583        }
584        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
585            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
586            where
587                D: serde::Deserializer<'de>,
588            {
589                struct Visitor;
590                impl<'de> serde::de::Visitor<'de> for Visitor {
591                    type Value = __FieldTag;
592                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
593                        formatter.write_str("a field name for ServiceConnectionMap")
594                    }
595                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
596                    where
597                        E: serde::de::Error,
598                    {
599                        use std::result::Result::Ok;
600                        use std::string::ToString;
601                        match value {
602                            "name" => Ok(__FieldTag::__name),
603                            "createTime" => Ok(__FieldTag::__create_time),
604                            "create_time" => Ok(__FieldTag::__create_time),
605                            "updateTime" => Ok(__FieldTag::__update_time),
606                            "update_time" => Ok(__FieldTag::__update_time),
607                            "labels" => Ok(__FieldTag::__labels),
608                            "description" => Ok(__FieldTag::__description),
609                            "serviceClass" => Ok(__FieldTag::__service_class),
610                            "service_class" => Ok(__FieldTag::__service_class),
611                            "serviceClassUri" => Ok(__FieldTag::__service_class_uri),
612                            "service_class_uri" => Ok(__FieldTag::__service_class_uri),
613                            "infrastructure" => Ok(__FieldTag::__infrastructure),
614                            "producerPscConfigs" => Ok(__FieldTag::__producer_psc_configs),
615                            "producer_psc_configs" => Ok(__FieldTag::__producer_psc_configs),
616                            "consumerPscConfigs" => Ok(__FieldTag::__consumer_psc_configs),
617                            "consumer_psc_configs" => Ok(__FieldTag::__consumer_psc_configs),
618                            "consumerPscConnections" => Ok(__FieldTag::__consumer_psc_connections),
619                            "consumer_psc_connections" => {
620                                Ok(__FieldTag::__consumer_psc_connections)
621                            }
622                            "token" => Ok(__FieldTag::__token),
623                            "etag" => Ok(__FieldTag::__etag),
624                            _ => Ok(__FieldTag::Unknown(value.to_string())),
625                        }
626                    }
627                }
628                deserializer.deserialize_identifier(Visitor)
629            }
630        }
631        struct Visitor;
632        impl<'de> serde::de::Visitor<'de> for Visitor {
633            type Value = ServiceConnectionMap;
634            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
635                formatter.write_str("struct ServiceConnectionMap")
636            }
637            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
638            where
639                A: serde::de::MapAccess<'de>,
640            {
641                #[allow(unused_imports)]
642                use serde::de::Error;
643                use std::option::Option::Some;
644                let mut fields = std::collections::HashSet::new();
645                let mut result = Self::Value::new();
646                while let Some(tag) = map.next_key::<__FieldTag>()? {
647                    #[allow(clippy::match_single_binding)]
648                    match tag {
649                        __FieldTag::__name => {
650                            if !fields.insert(__FieldTag::__name) {
651                                return std::result::Result::Err(A::Error::duplicate_field(
652                                    "multiple values for name",
653                                ));
654                            }
655                            result.name = map
656                                .next_value::<std::option::Option<std::string::String>>()?
657                                .unwrap_or_default();
658                        }
659                        __FieldTag::__create_time => {
660                            if !fields.insert(__FieldTag::__create_time) {
661                                return std::result::Result::Err(A::Error::duplicate_field(
662                                    "multiple values for create_time",
663                                ));
664                            }
665                            result.create_time =
666                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
667                        }
668                        __FieldTag::__update_time => {
669                            if !fields.insert(__FieldTag::__update_time) {
670                                return std::result::Result::Err(A::Error::duplicate_field(
671                                    "multiple values for update_time",
672                                ));
673                            }
674                            result.update_time =
675                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
676                        }
677                        __FieldTag::__labels => {
678                            if !fields.insert(__FieldTag::__labels) {
679                                return std::result::Result::Err(A::Error::duplicate_field(
680                                    "multiple values for labels",
681                                ));
682                            }
683                            result.labels = map
684                                .next_value::<std::option::Option<
685                                    std::collections::HashMap<
686                                        std::string::String,
687                                        std::string::String,
688                                    >,
689                                >>()?
690                                .unwrap_or_default();
691                        }
692                        __FieldTag::__description => {
693                            if !fields.insert(__FieldTag::__description) {
694                                return std::result::Result::Err(A::Error::duplicate_field(
695                                    "multiple values for description",
696                                ));
697                            }
698                            result.description = map
699                                .next_value::<std::option::Option<std::string::String>>()?
700                                .unwrap_or_default();
701                        }
702                        __FieldTag::__service_class => {
703                            if !fields.insert(__FieldTag::__service_class) {
704                                return std::result::Result::Err(A::Error::duplicate_field(
705                                    "multiple values for service_class",
706                                ));
707                            }
708                            result.service_class = map
709                                .next_value::<std::option::Option<std::string::String>>()?
710                                .unwrap_or_default();
711                        }
712                        __FieldTag::__service_class_uri => {
713                            if !fields.insert(__FieldTag::__service_class_uri) {
714                                return std::result::Result::Err(A::Error::duplicate_field(
715                                    "multiple values for service_class_uri",
716                                ));
717                            }
718                            result.service_class_uri = map
719                                .next_value::<std::option::Option<std::string::String>>()?
720                                .unwrap_or_default();
721                        }
722                        __FieldTag::__infrastructure => {
723                            if !fields.insert(__FieldTag::__infrastructure) {
724                                return std::result::Result::Err(A::Error::duplicate_field(
725                                    "multiple values for infrastructure",
726                                ));
727                            }
728                            result.infrastructure = map
729                                .next_value::<std::option::Option<crate::model::Infrastructure>>()?
730                                .unwrap_or_default();
731                        }
732                        __FieldTag::__producer_psc_configs => {
733                            if !fields.insert(__FieldTag::__producer_psc_configs) {
734                                return std::result::Result::Err(A::Error::duplicate_field(
735                                    "multiple values for producer_psc_configs",
736                                ));
737                            }
738                            result.producer_psc_configs = map
739                                .next_value::<std::option::Option<
740                                    std::vec::Vec<
741                                        crate::model::service_connection_map::ProducerPscConfig,
742                                    >,
743                                >>()?
744                                .unwrap_or_default();
745                        }
746                        __FieldTag::__consumer_psc_configs => {
747                            if !fields.insert(__FieldTag::__consumer_psc_configs) {
748                                return std::result::Result::Err(A::Error::duplicate_field(
749                                    "multiple values for consumer_psc_configs",
750                                ));
751                            }
752                            result.consumer_psc_configs = map
753                                .next_value::<std::option::Option<
754                                    std::vec::Vec<
755                                        crate::model::service_connection_map::ConsumerPscConfig,
756                                    >,
757                                >>()?
758                                .unwrap_or_default();
759                        }
760                        __FieldTag::__consumer_psc_connections => {
761                            if !fields.insert(__FieldTag::__consumer_psc_connections) {
762                                return std::result::Result::Err(A::Error::duplicate_field(
763                                    "multiple values for consumer_psc_connections",
764                                ));
765                            }
766                            result.consumer_psc_connections = map
767                                .next_value::<std::option::Option<
768                                    std::vec::Vec<
769                                        crate::model::service_connection_map::ConsumerPscConnection,
770                                    >,
771                                >>()?
772                                .unwrap_or_default();
773                        }
774                        __FieldTag::__token => {
775                            if !fields.insert(__FieldTag::__token) {
776                                return std::result::Result::Err(A::Error::duplicate_field(
777                                    "multiple values for token",
778                                ));
779                            }
780                            result.token = map
781                                .next_value::<std::option::Option<std::string::String>>()?
782                                .unwrap_or_default();
783                        }
784                        __FieldTag::__etag => {
785                            if !fields.insert(__FieldTag::__etag) {
786                                return std::result::Result::Err(A::Error::duplicate_field(
787                                    "multiple values for etag",
788                                ));
789                            }
790                            result.etag =
791                                map.next_value::<std::option::Option<std::string::String>>()?;
792                        }
793                        __FieldTag::Unknown(key) => {
794                            let value = map.next_value::<serde_json::Value>()?;
795                            result._unknown_fields.insert(key, value);
796                        }
797                    }
798                }
799                std::result::Result::Ok(result)
800            }
801        }
802        deserializer.deserialize_any(Visitor)
803    }
804}
805
806#[doc(hidden)]
807impl serde::ser::Serialize for ServiceConnectionMap {
808    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
809    where
810        S: serde::ser::Serializer,
811    {
812        use serde::ser::SerializeMap;
813        #[allow(unused_imports)]
814        use std::option::Option::Some;
815        let mut state = serializer.serialize_map(std::option::Option::None)?;
816        if !self.name.is_empty() {
817            state.serialize_entry("name", &self.name)?;
818        }
819        if self.create_time.is_some() {
820            state.serialize_entry("createTime", &self.create_time)?;
821        }
822        if self.update_time.is_some() {
823            state.serialize_entry("updateTime", &self.update_time)?;
824        }
825        if !self.labels.is_empty() {
826            state.serialize_entry("labels", &self.labels)?;
827        }
828        if !self.description.is_empty() {
829            state.serialize_entry("description", &self.description)?;
830        }
831        if !self.service_class.is_empty() {
832            state.serialize_entry("serviceClass", &self.service_class)?;
833        }
834        if !self.service_class_uri.is_empty() {
835            state.serialize_entry("serviceClassUri", &self.service_class_uri)?;
836        }
837        if !wkt::internal::is_default(&self.infrastructure) {
838            state.serialize_entry("infrastructure", &self.infrastructure)?;
839        }
840        if !self.producer_psc_configs.is_empty() {
841            state.serialize_entry("producerPscConfigs", &self.producer_psc_configs)?;
842        }
843        if !self.consumer_psc_configs.is_empty() {
844            state.serialize_entry("consumerPscConfigs", &self.consumer_psc_configs)?;
845        }
846        if !self.consumer_psc_connections.is_empty() {
847            state.serialize_entry("consumerPscConnections", &self.consumer_psc_connections)?;
848        }
849        if !self.token.is_empty() {
850            state.serialize_entry("token", &self.token)?;
851        }
852        if self.etag.is_some() {
853            state.serialize_entry("etag", &self.etag)?;
854        }
855        if !self._unknown_fields.is_empty() {
856            for (key, value) in self._unknown_fields.iter() {
857                state.serialize_entry(key, &value)?;
858            }
859        }
860        state.end()
861    }
862}
863
864/// Defines additional types related to [ServiceConnectionMap].
865pub mod service_connection_map {
866    #[allow(unused_imports)]
867    use super::*;
868
869    /// The PSC configurations on producer side.
870    #[derive(Clone, Debug, Default, PartialEq)]
871    #[non_exhaustive]
872    pub struct ProducerPscConfig {
873        /// The resource path of a service attachment.
874        /// Example:
875        /// projects/{projectNumOrId}/regions/{region}/serviceAttachments/{resourceId}.
876        pub service_attachment_uri: std::string::String,
877
878        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
879    }
880
881    impl ProducerPscConfig {
882        pub fn new() -> Self {
883            std::default::Default::default()
884        }
885
886        /// Sets the value of [service_attachment_uri][crate::model::service_connection_map::ProducerPscConfig::service_attachment_uri].
887        pub fn set_service_attachment_uri<T: std::convert::Into<std::string::String>>(
888            mut self,
889            v: T,
890        ) -> Self {
891            self.service_attachment_uri = v.into();
892            self
893        }
894    }
895
896    impl wkt::message::Message for ProducerPscConfig {
897        fn typename() -> &'static str {
898            "type.googleapis.com/google.cloud.networkconnectivity.v1.ServiceConnectionMap.ProducerPscConfig"
899        }
900    }
901
902    #[doc(hidden)]
903    impl<'de> serde::de::Deserialize<'de> for ProducerPscConfig {
904        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
905        where
906            D: serde::Deserializer<'de>,
907        {
908            #[allow(non_camel_case_types)]
909            #[doc(hidden)]
910            #[derive(PartialEq, Eq, Hash)]
911            enum __FieldTag {
912                __service_attachment_uri,
913                Unknown(std::string::String),
914            }
915            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
916                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
917                where
918                    D: serde::Deserializer<'de>,
919                {
920                    struct Visitor;
921                    impl<'de> serde::de::Visitor<'de> for Visitor {
922                        type Value = __FieldTag;
923                        fn expecting(
924                            &self,
925                            formatter: &mut std::fmt::Formatter,
926                        ) -> std::fmt::Result {
927                            formatter.write_str("a field name for ProducerPscConfig")
928                        }
929                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
930                        where
931                            E: serde::de::Error,
932                        {
933                            use std::result::Result::Ok;
934                            use std::string::ToString;
935                            match value {
936                                "serviceAttachmentUri" => Ok(__FieldTag::__service_attachment_uri),
937                                "service_attachment_uri" => {
938                                    Ok(__FieldTag::__service_attachment_uri)
939                                }
940                                _ => Ok(__FieldTag::Unknown(value.to_string())),
941                            }
942                        }
943                    }
944                    deserializer.deserialize_identifier(Visitor)
945                }
946            }
947            struct Visitor;
948            impl<'de> serde::de::Visitor<'de> for Visitor {
949                type Value = ProducerPscConfig;
950                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
951                    formatter.write_str("struct ProducerPscConfig")
952                }
953                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
954                where
955                    A: serde::de::MapAccess<'de>,
956                {
957                    #[allow(unused_imports)]
958                    use serde::de::Error;
959                    use std::option::Option::Some;
960                    let mut fields = std::collections::HashSet::new();
961                    let mut result = Self::Value::new();
962                    while let Some(tag) = map.next_key::<__FieldTag>()? {
963                        #[allow(clippy::match_single_binding)]
964                        match tag {
965                            __FieldTag::__service_attachment_uri => {
966                                if !fields.insert(__FieldTag::__service_attachment_uri) {
967                                    return std::result::Result::Err(A::Error::duplicate_field(
968                                        "multiple values for service_attachment_uri",
969                                    ));
970                                }
971                                result.service_attachment_uri = map
972                                    .next_value::<std::option::Option<std::string::String>>()?
973                                    .unwrap_or_default();
974                            }
975                            __FieldTag::Unknown(key) => {
976                                let value = map.next_value::<serde_json::Value>()?;
977                                result._unknown_fields.insert(key, value);
978                            }
979                        }
980                    }
981                    std::result::Result::Ok(result)
982                }
983            }
984            deserializer.deserialize_any(Visitor)
985        }
986    }
987
988    #[doc(hidden)]
989    impl serde::ser::Serialize for ProducerPscConfig {
990        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
991        where
992            S: serde::ser::Serializer,
993        {
994            use serde::ser::SerializeMap;
995            #[allow(unused_imports)]
996            use std::option::Option::Some;
997            let mut state = serializer.serialize_map(std::option::Option::None)?;
998            if !self.service_attachment_uri.is_empty() {
999                state.serialize_entry("serviceAttachmentUri", &self.service_attachment_uri)?;
1000            }
1001            if !self._unknown_fields.is_empty() {
1002                for (key, value) in self._unknown_fields.iter() {
1003                    state.serialize_entry(key, &value)?;
1004                }
1005            }
1006            state.end()
1007        }
1008    }
1009
1010    /// Allow the producer to specify which consumers can connect to it.
1011    #[derive(Clone, Debug, Default, PartialEq)]
1012    #[non_exhaustive]
1013    pub struct ConsumerPscConfig {
1014        /// The consumer project where PSC connections are allowed to be created in.
1015        pub project: std::string::String,
1016
1017        /// The resource path of the consumer network where PSC connections are
1018        /// allowed to be created in. Note, this network does not need be in the
1019        /// ConsumerPscConfig.project in the case of SharedVPC.
1020        /// Example:
1021        /// projects/{projectNumOrId}/global/networks/{networkId}.
1022        pub network: std::string::String,
1023
1024        /// This is used in PSC consumer ForwardingRule to control whether the PSC
1025        /// endpoint can be accessed from another region.
1026        pub disable_global_access: bool,
1027
1028        /// Output only. Overall state of PSC Connections management for this
1029        /// consumer psc config.
1030        pub state: crate::model::service_connection_map::consumer_psc_config::State,
1031
1032        /// Immutable. Deprecated. Use producer_instance_metadata instead.
1033        /// An immutable identifier for the producer instance.
1034        #[deprecated]
1035        pub producer_instance_id: std::string::String,
1036
1037        /// Output only. A map to store mapping between customer vip and target
1038        /// service attachment. Only service attachment with producer specified ip
1039        /// addresses are stored here.
1040        pub service_attachment_ip_address_map:
1041            std::collections::HashMap<std::string::String, std::string::String>,
1042
1043        /// Required. The project ID or project number of the consumer project. This
1044        /// project is the one that the consumer uses to interact with the producer
1045        /// instance. From the perspective of a consumer who's created a producer
1046        /// instance, this is the project of the producer instance. Format:
1047        /// 'projects/<project_id_or_number>' Eg. 'projects/consumer-project' or
1048        /// 'projects/1234'
1049        pub consumer_instance_project: std::string::String,
1050
1051        /// Immutable. An immutable map for the producer instance metadata.
1052        pub producer_instance_metadata:
1053            std::collections::HashMap<std::string::String, std::string::String>,
1054
1055        /// The requested IP version for the PSC connection.
1056        pub ip_version: std::option::Option<crate::model::IPVersion>,
1057
1058        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1059    }
1060
1061    impl ConsumerPscConfig {
1062        pub fn new() -> Self {
1063            std::default::Default::default()
1064        }
1065
1066        /// Sets the value of [project][crate::model::service_connection_map::ConsumerPscConfig::project].
1067        pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1068            self.project = v.into();
1069            self
1070        }
1071
1072        /// Sets the value of [network][crate::model::service_connection_map::ConsumerPscConfig::network].
1073        pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1074            self.network = v.into();
1075            self
1076        }
1077
1078        /// Sets the value of [disable_global_access][crate::model::service_connection_map::ConsumerPscConfig::disable_global_access].
1079        pub fn set_disable_global_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1080            self.disable_global_access = v.into();
1081            self
1082        }
1083
1084        /// Sets the value of [state][crate::model::service_connection_map::ConsumerPscConfig::state].
1085        pub fn set_state<
1086            T: std::convert::Into<crate::model::service_connection_map::consumer_psc_config::State>,
1087        >(
1088            mut self,
1089            v: T,
1090        ) -> Self {
1091            self.state = v.into();
1092            self
1093        }
1094
1095        /// Sets the value of [producer_instance_id][crate::model::service_connection_map::ConsumerPscConfig::producer_instance_id].
1096        #[deprecated]
1097        pub fn set_producer_instance_id<T: std::convert::Into<std::string::String>>(
1098            mut self,
1099            v: T,
1100        ) -> Self {
1101            self.producer_instance_id = v.into();
1102            self
1103        }
1104
1105        /// Sets the value of [service_attachment_ip_address_map][crate::model::service_connection_map::ConsumerPscConfig::service_attachment_ip_address_map].
1106        pub fn set_service_attachment_ip_address_map<T, K, V>(mut self, v: T) -> Self
1107        where
1108            T: std::iter::IntoIterator<Item = (K, V)>,
1109            K: std::convert::Into<std::string::String>,
1110            V: std::convert::Into<std::string::String>,
1111        {
1112            use std::iter::Iterator;
1113            self.service_attachment_ip_address_map =
1114                v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1115            self
1116        }
1117
1118        /// Sets the value of [consumer_instance_project][crate::model::service_connection_map::ConsumerPscConfig::consumer_instance_project].
1119        pub fn set_consumer_instance_project<T: std::convert::Into<std::string::String>>(
1120            mut self,
1121            v: T,
1122        ) -> Self {
1123            self.consumer_instance_project = v.into();
1124            self
1125        }
1126
1127        /// Sets the value of [producer_instance_metadata][crate::model::service_connection_map::ConsumerPscConfig::producer_instance_metadata].
1128        pub fn set_producer_instance_metadata<T, K, V>(mut self, v: T) -> Self
1129        where
1130            T: std::iter::IntoIterator<Item = (K, V)>,
1131            K: std::convert::Into<std::string::String>,
1132            V: std::convert::Into<std::string::String>,
1133        {
1134            use std::iter::Iterator;
1135            self.producer_instance_metadata =
1136                v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1137            self
1138        }
1139
1140        /// Sets the value of [ip_version][crate::model::service_connection_map::ConsumerPscConfig::ip_version].
1141        pub fn set_ip_version<T>(mut self, v: T) -> Self
1142        where
1143            T: std::convert::Into<crate::model::IPVersion>,
1144        {
1145            self.ip_version = std::option::Option::Some(v.into());
1146            self
1147        }
1148
1149        /// Sets or clears the value of [ip_version][crate::model::service_connection_map::ConsumerPscConfig::ip_version].
1150        pub fn set_or_clear_ip_version<T>(mut self, v: std::option::Option<T>) -> Self
1151        where
1152            T: std::convert::Into<crate::model::IPVersion>,
1153        {
1154            self.ip_version = v.map(|x| x.into());
1155            self
1156        }
1157    }
1158
1159    impl wkt::message::Message for ConsumerPscConfig {
1160        fn typename() -> &'static str {
1161            "type.googleapis.com/google.cloud.networkconnectivity.v1.ServiceConnectionMap.ConsumerPscConfig"
1162        }
1163    }
1164
1165    #[doc(hidden)]
1166    impl<'de> serde::de::Deserialize<'de> for ConsumerPscConfig {
1167        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1168        where
1169            D: serde::Deserializer<'de>,
1170        {
1171            #[allow(non_camel_case_types)]
1172            #[doc(hidden)]
1173            #[derive(PartialEq, Eq, Hash)]
1174            enum __FieldTag {
1175                __project,
1176                __network,
1177                __disable_global_access,
1178                __state,
1179                __producer_instance_id,
1180                __service_attachment_ip_address_map,
1181                __consumer_instance_project,
1182                __producer_instance_metadata,
1183                __ip_version,
1184                Unknown(std::string::String),
1185            }
1186            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1187                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1188                where
1189                    D: serde::Deserializer<'de>,
1190                {
1191                    struct Visitor;
1192                    impl<'de> serde::de::Visitor<'de> for Visitor {
1193                        type Value = __FieldTag;
1194                        fn expecting(
1195                            &self,
1196                            formatter: &mut std::fmt::Formatter,
1197                        ) -> std::fmt::Result {
1198                            formatter.write_str("a field name for ConsumerPscConfig")
1199                        }
1200                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1201                        where
1202                            E: serde::de::Error,
1203                        {
1204                            use std::result::Result::Ok;
1205                            use std::string::ToString;
1206                            match value {
1207                                "project" => Ok(__FieldTag::__project),
1208                                "network" => Ok(__FieldTag::__network),
1209                                "disableGlobalAccess" => Ok(__FieldTag::__disable_global_access),
1210                                "disable_global_access" => Ok(__FieldTag::__disable_global_access),
1211                                "state" => Ok(__FieldTag::__state),
1212                                "producerInstanceId" => Ok(__FieldTag::__producer_instance_id),
1213                                "producer_instance_id" => Ok(__FieldTag::__producer_instance_id),
1214                                "serviceAttachmentIpAddressMap" => {
1215                                    Ok(__FieldTag::__service_attachment_ip_address_map)
1216                                }
1217                                "service_attachment_ip_address_map" => {
1218                                    Ok(__FieldTag::__service_attachment_ip_address_map)
1219                                }
1220                                "consumerInstanceProject" => {
1221                                    Ok(__FieldTag::__consumer_instance_project)
1222                                }
1223                                "consumer_instance_project" => {
1224                                    Ok(__FieldTag::__consumer_instance_project)
1225                                }
1226                                "producerInstanceMetadata" => {
1227                                    Ok(__FieldTag::__producer_instance_metadata)
1228                                }
1229                                "producer_instance_metadata" => {
1230                                    Ok(__FieldTag::__producer_instance_metadata)
1231                                }
1232                                "ipVersion" => Ok(__FieldTag::__ip_version),
1233                                "ip_version" => Ok(__FieldTag::__ip_version),
1234                                _ => Ok(__FieldTag::Unknown(value.to_string())),
1235                            }
1236                        }
1237                    }
1238                    deserializer.deserialize_identifier(Visitor)
1239                }
1240            }
1241            struct Visitor;
1242            impl<'de> serde::de::Visitor<'de> for Visitor {
1243                type Value = ConsumerPscConfig;
1244                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1245                    formatter.write_str("struct ConsumerPscConfig")
1246                }
1247                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1248                where
1249                    A: serde::de::MapAccess<'de>,
1250                {
1251                    #[allow(unused_imports)]
1252                    use serde::de::Error;
1253                    use std::option::Option::Some;
1254                    let mut fields = std::collections::HashSet::new();
1255                    let mut result = Self::Value::new();
1256                    while let Some(tag) = map.next_key::<__FieldTag>()? {
1257                        #[allow(clippy::match_single_binding)]
1258                        match tag {
1259                            __FieldTag::__project => {
1260                                if !fields.insert(__FieldTag::__project) {
1261                                    return std::result::Result::Err(A::Error::duplicate_field(
1262                                        "multiple values for project",
1263                                    ));
1264                                }
1265                                result.project = map
1266                                    .next_value::<std::option::Option<std::string::String>>()?
1267                                    .unwrap_or_default();
1268                            }
1269                            __FieldTag::__network => {
1270                                if !fields.insert(__FieldTag::__network) {
1271                                    return std::result::Result::Err(A::Error::duplicate_field(
1272                                        "multiple values for network",
1273                                    ));
1274                                }
1275                                result.network = map
1276                                    .next_value::<std::option::Option<std::string::String>>()?
1277                                    .unwrap_or_default();
1278                            }
1279                            __FieldTag::__disable_global_access => {
1280                                if !fields.insert(__FieldTag::__disable_global_access) {
1281                                    return std::result::Result::Err(A::Error::duplicate_field(
1282                                        "multiple values for disable_global_access",
1283                                    ));
1284                                }
1285                                result.disable_global_access = map
1286                                    .next_value::<std::option::Option<bool>>()?
1287                                    .unwrap_or_default();
1288                            }
1289                            __FieldTag::__state => {
1290                                if !fields.insert(__FieldTag::__state) {
1291                                    return std::result::Result::Err(A::Error::duplicate_field(
1292                                        "multiple values for state",
1293                                    ));
1294                                }
1295                                result.state = map.next_value::<std::option::Option<crate::model::service_connection_map::consumer_psc_config::State>>()?.unwrap_or_default();
1296                            }
1297                            __FieldTag::__producer_instance_id => {
1298                                if !fields.insert(__FieldTag::__producer_instance_id) {
1299                                    return std::result::Result::Err(A::Error::duplicate_field(
1300                                        "multiple values for producer_instance_id",
1301                                    ));
1302                                }
1303                                result.producer_instance_id = map
1304                                    .next_value::<std::option::Option<std::string::String>>()?
1305                                    .unwrap_or_default();
1306                            }
1307                            __FieldTag::__service_attachment_ip_address_map => {
1308                                if !fields.insert(__FieldTag::__service_attachment_ip_address_map) {
1309                                    return std::result::Result::Err(A::Error::duplicate_field(
1310                                        "multiple values for service_attachment_ip_address_map",
1311                                    ));
1312                                }
1313                                result.service_attachment_ip_address_map = map
1314                                    .next_value::<std::option::Option<
1315                                        std::collections::HashMap<
1316                                            std::string::String,
1317                                            std::string::String,
1318                                        >,
1319                                    >>()?
1320                                    .unwrap_or_default();
1321                            }
1322                            __FieldTag::__consumer_instance_project => {
1323                                if !fields.insert(__FieldTag::__consumer_instance_project) {
1324                                    return std::result::Result::Err(A::Error::duplicate_field(
1325                                        "multiple values for consumer_instance_project",
1326                                    ));
1327                                }
1328                                result.consumer_instance_project = map
1329                                    .next_value::<std::option::Option<std::string::String>>()?
1330                                    .unwrap_or_default();
1331                            }
1332                            __FieldTag::__producer_instance_metadata => {
1333                                if !fields.insert(__FieldTag::__producer_instance_metadata) {
1334                                    return std::result::Result::Err(A::Error::duplicate_field(
1335                                        "multiple values for producer_instance_metadata",
1336                                    ));
1337                                }
1338                                result.producer_instance_metadata = map
1339                                    .next_value::<std::option::Option<
1340                                        std::collections::HashMap<
1341                                            std::string::String,
1342                                            std::string::String,
1343                                        >,
1344                                    >>()?
1345                                    .unwrap_or_default();
1346                            }
1347                            __FieldTag::__ip_version => {
1348                                if !fields.insert(__FieldTag::__ip_version) {
1349                                    return std::result::Result::Err(A::Error::duplicate_field(
1350                                        "multiple values for ip_version",
1351                                    ));
1352                                }
1353                                result.ip_version = map
1354                                    .next_value::<std::option::Option<crate::model::IPVersion>>()?;
1355                            }
1356                            __FieldTag::Unknown(key) => {
1357                                let value = map.next_value::<serde_json::Value>()?;
1358                                result._unknown_fields.insert(key, value);
1359                            }
1360                        }
1361                    }
1362                    std::result::Result::Ok(result)
1363                }
1364            }
1365            deserializer.deserialize_any(Visitor)
1366        }
1367    }
1368
1369    #[doc(hidden)]
1370    impl serde::ser::Serialize for ConsumerPscConfig {
1371        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1372        where
1373            S: serde::ser::Serializer,
1374        {
1375            use serde::ser::SerializeMap;
1376            #[allow(unused_imports)]
1377            use std::option::Option::Some;
1378            let mut state = serializer.serialize_map(std::option::Option::None)?;
1379            if !self.project.is_empty() {
1380                state.serialize_entry("project", &self.project)?;
1381            }
1382            if !self.network.is_empty() {
1383                state.serialize_entry("network", &self.network)?;
1384            }
1385            if !wkt::internal::is_default(&self.disable_global_access) {
1386                state.serialize_entry("disableGlobalAccess", &self.disable_global_access)?;
1387            }
1388            if !wkt::internal::is_default(&self.state) {
1389                state.serialize_entry("state", &self.state)?;
1390            }
1391            if !self.producer_instance_id.is_empty() {
1392                state.serialize_entry("producerInstanceId", &self.producer_instance_id)?;
1393            }
1394            if !self.service_attachment_ip_address_map.is_empty() {
1395                state.serialize_entry(
1396                    "serviceAttachmentIpAddressMap",
1397                    &self.service_attachment_ip_address_map,
1398                )?;
1399            }
1400            if !self.consumer_instance_project.is_empty() {
1401                state
1402                    .serialize_entry("consumerInstanceProject", &self.consumer_instance_project)?;
1403            }
1404            if !self.producer_instance_metadata.is_empty() {
1405                state.serialize_entry(
1406                    "producerInstanceMetadata",
1407                    &self.producer_instance_metadata,
1408                )?;
1409            }
1410            if self.ip_version.is_some() {
1411                state.serialize_entry("ipVersion", &self.ip_version)?;
1412            }
1413            if !self._unknown_fields.is_empty() {
1414                for (key, value) in self._unknown_fields.iter() {
1415                    state.serialize_entry(key, &value)?;
1416                }
1417            }
1418            state.end()
1419        }
1420    }
1421
1422    /// Defines additional types related to [ConsumerPscConfig].
1423    pub mod consumer_psc_config {
1424        #[allow(unused_imports)]
1425        use super::*;
1426
1427        /// PSC Consumer Config State.
1428        ///
1429        /// # Working with unknown values
1430        ///
1431        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1432        /// additional enum variants at any time. Adding new variants is not considered
1433        /// a breaking change. Applications should write their code in anticipation of:
1434        ///
1435        /// - New values appearing in future releases of the client library, **and**
1436        /// - New values received dynamically, without application changes.
1437        ///
1438        /// Please consult the [Working with enums] section in the user guide for some
1439        /// guidelines.
1440        ///
1441        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1442        #[derive(Clone, Debug, PartialEq)]
1443        #[non_exhaustive]
1444        pub enum State {
1445            /// Default state, when Connection Map is created initially.
1446            Unspecified,
1447            /// Set when policy and map configuration is valid,
1448            /// and their matching can lead to allowing creation of PSC Connections
1449            /// subject to other constraints like connections limit.
1450            Valid,
1451            /// No Service Connection Policy found for this network and Service
1452            /// Class
1453            ConnectionPolicyMissing,
1454            /// Service Connection Policy limit reached for this network and Service
1455            /// Class
1456            PolicyLimitReached,
1457            /// The consumer instance project is not in
1458            /// AllowedGoogleProducersResourceHierarchyLevels of the matching
1459            /// ServiceConnectionPolicy.
1460            ConsumerInstanceProjectNotAllowlisted,
1461            /// If set, the enum was initialized with an unknown value.
1462            ///
1463            /// Applications can examine the value using [State::value] or
1464            /// [State::name].
1465            UnknownValue(state::UnknownValue),
1466        }
1467
1468        #[doc(hidden)]
1469        pub mod state {
1470            #[allow(unused_imports)]
1471            use super::*;
1472            #[derive(Clone, Debug, PartialEq)]
1473            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1474        }
1475
1476        impl State {
1477            /// Gets the enum value.
1478            ///
1479            /// Returns `None` if the enum contains an unknown value deserialized from
1480            /// the string representation of enums.
1481            pub fn value(&self) -> std::option::Option<i32> {
1482                match self {
1483                    Self::Unspecified => std::option::Option::Some(0),
1484                    Self::Valid => std::option::Option::Some(1),
1485                    Self::ConnectionPolicyMissing => std::option::Option::Some(2),
1486                    Self::PolicyLimitReached => std::option::Option::Some(3),
1487                    Self::ConsumerInstanceProjectNotAllowlisted => std::option::Option::Some(4),
1488                    Self::UnknownValue(u) => u.0.value(),
1489                }
1490            }
1491
1492            /// Gets the enum value as a string.
1493            ///
1494            /// Returns `None` if the enum contains an unknown value deserialized from
1495            /// the integer representation of enums.
1496            pub fn name(&self) -> std::option::Option<&str> {
1497                match self {
1498                    Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1499                    Self::Valid => std::option::Option::Some("VALID"),
1500                    Self::ConnectionPolicyMissing => {
1501                        std::option::Option::Some("CONNECTION_POLICY_MISSING")
1502                    }
1503                    Self::PolicyLimitReached => std::option::Option::Some("POLICY_LIMIT_REACHED"),
1504                    Self::ConsumerInstanceProjectNotAllowlisted => {
1505                        std::option::Option::Some("CONSUMER_INSTANCE_PROJECT_NOT_ALLOWLISTED")
1506                    }
1507                    Self::UnknownValue(u) => u.0.name(),
1508                }
1509            }
1510        }
1511
1512        impl std::default::Default for State {
1513            fn default() -> Self {
1514                use std::convert::From;
1515                Self::from(0)
1516            }
1517        }
1518
1519        impl std::fmt::Display for State {
1520            fn fmt(
1521                &self,
1522                f: &mut std::fmt::Formatter<'_>,
1523            ) -> std::result::Result<(), std::fmt::Error> {
1524                wkt::internal::display_enum(f, self.name(), self.value())
1525            }
1526        }
1527
1528        impl std::convert::From<i32> for State {
1529            fn from(value: i32) -> Self {
1530                match value {
1531                    0 => Self::Unspecified,
1532                    1 => Self::Valid,
1533                    2 => Self::ConnectionPolicyMissing,
1534                    3 => Self::PolicyLimitReached,
1535                    4 => Self::ConsumerInstanceProjectNotAllowlisted,
1536                    _ => Self::UnknownValue(state::UnknownValue(
1537                        wkt::internal::UnknownEnumValue::Integer(value),
1538                    )),
1539                }
1540            }
1541        }
1542
1543        impl std::convert::From<&str> for State {
1544            fn from(value: &str) -> Self {
1545                use std::string::ToString;
1546                match value {
1547                    "STATE_UNSPECIFIED" => Self::Unspecified,
1548                    "VALID" => Self::Valid,
1549                    "CONNECTION_POLICY_MISSING" => Self::ConnectionPolicyMissing,
1550                    "POLICY_LIMIT_REACHED" => Self::PolicyLimitReached,
1551                    "CONSUMER_INSTANCE_PROJECT_NOT_ALLOWLISTED" => {
1552                        Self::ConsumerInstanceProjectNotAllowlisted
1553                    }
1554                    _ => Self::UnknownValue(state::UnknownValue(
1555                        wkt::internal::UnknownEnumValue::String(value.to_string()),
1556                    )),
1557                }
1558            }
1559        }
1560
1561        impl serde::ser::Serialize for State {
1562            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1563            where
1564                S: serde::Serializer,
1565            {
1566                match self {
1567                    Self::Unspecified => serializer.serialize_i32(0),
1568                    Self::Valid => serializer.serialize_i32(1),
1569                    Self::ConnectionPolicyMissing => serializer.serialize_i32(2),
1570                    Self::PolicyLimitReached => serializer.serialize_i32(3),
1571                    Self::ConsumerInstanceProjectNotAllowlisted => serializer.serialize_i32(4),
1572                    Self::UnknownValue(u) => u.0.serialize(serializer),
1573                }
1574            }
1575        }
1576
1577        impl<'de> serde::de::Deserialize<'de> for State {
1578            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1579            where
1580                D: serde::Deserializer<'de>,
1581            {
1582                deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1583                    ".google.cloud.networkconnectivity.v1.ServiceConnectionMap.ConsumerPscConfig.State"))
1584            }
1585        }
1586    }
1587
1588    /// PSC connection details on consumer side.
1589    #[derive(Clone, Debug, Default, PartialEq)]
1590    #[non_exhaustive]
1591    pub struct ConsumerPscConnection {
1592        /// The URI of a service attachment which is the target of the PSC
1593        /// connection.
1594        pub service_attachment_uri: std::string::String,
1595
1596        /// The state of the PSC connection.
1597        pub state: crate::model::service_connection_map::consumer_psc_connection::State,
1598
1599        /// The consumer project whose PSC forwarding rule is connected to the
1600        /// service attachments in this service connection map.
1601        pub project: std::string::String,
1602
1603        /// The consumer network whose PSC forwarding rule is connected to the
1604        /// service attachments in this service connection map.
1605        /// Note that the network could be on a different project (shared VPC).
1606        pub network: std::string::String,
1607
1608        /// The PSC connection id of the PSC forwarding rule connected
1609        /// to the service attachments in this service connection map.
1610        pub psc_connection_id: std::string::String,
1611
1612        /// The IP literal allocated on the consumer network for the PSC forwarding
1613        /// rule that is created to connect to the producer service attachment in
1614        /// this service connection map.
1615        pub ip: std::string::String,
1616
1617        /// The error type indicates whether the error is consumer facing, producer
1618        /// facing or system internal.
1619        #[deprecated]
1620        pub error_type: crate::model::ConnectionErrorType,
1621
1622        /// The most recent error during operating this connection.
1623        #[deprecated]
1624        pub error: std::option::Option<rpc::model::Status>,
1625
1626        /// The last Compute Engine operation to setup PSC connection.
1627        pub gce_operation: std::string::String,
1628
1629        /// The URI of the consumer forwarding rule created.
1630        /// Example:
1631        /// projects/{projectNumOrId}/regions/us-east1/networks/{resourceId}.
1632        pub forwarding_rule: std::string::String,
1633
1634        /// Output only. The error info for the latest error during operating this
1635        /// connection.
1636        pub error_info: std::option::Option<rpc::model::ErrorInfo>,
1637
1638        /// Output only. The URI of the selected subnetwork selected to allocate IP
1639        /// address for this connection.
1640        pub selected_subnetwork: std::string::String,
1641
1642        /// Immutable. Deprecated. Use producer_instance_metadata instead.
1643        /// An immutable identifier for the producer instance.
1644        #[deprecated]
1645        pub producer_instance_id: std::string::String,
1646
1647        /// Immutable. An immutable map for the producer instance metadata.
1648        pub producer_instance_metadata:
1649            std::collections::HashMap<std::string::String, std::string::String>,
1650
1651        /// The requested IP version for the PSC connection.
1652        pub ip_version: std::option::Option<crate::model::IPVersion>,
1653
1654        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1655    }
1656
1657    impl ConsumerPscConnection {
1658        pub fn new() -> Self {
1659            std::default::Default::default()
1660        }
1661
1662        /// Sets the value of [service_attachment_uri][crate::model::service_connection_map::ConsumerPscConnection::service_attachment_uri].
1663        pub fn set_service_attachment_uri<T: std::convert::Into<std::string::String>>(
1664            mut self,
1665            v: T,
1666        ) -> Self {
1667            self.service_attachment_uri = v.into();
1668            self
1669        }
1670
1671        /// Sets the value of [state][crate::model::service_connection_map::ConsumerPscConnection::state].
1672        pub fn set_state<
1673            T: std::convert::Into<
1674                    crate::model::service_connection_map::consumer_psc_connection::State,
1675                >,
1676        >(
1677            mut self,
1678            v: T,
1679        ) -> Self {
1680            self.state = v.into();
1681            self
1682        }
1683
1684        /// Sets the value of [project][crate::model::service_connection_map::ConsumerPscConnection::project].
1685        pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1686            self.project = v.into();
1687            self
1688        }
1689
1690        /// Sets the value of [network][crate::model::service_connection_map::ConsumerPscConnection::network].
1691        pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1692            self.network = v.into();
1693            self
1694        }
1695
1696        /// Sets the value of [psc_connection_id][crate::model::service_connection_map::ConsumerPscConnection::psc_connection_id].
1697        pub fn set_psc_connection_id<T: std::convert::Into<std::string::String>>(
1698            mut self,
1699            v: T,
1700        ) -> Self {
1701            self.psc_connection_id = v.into();
1702            self
1703        }
1704
1705        /// Sets the value of [ip][crate::model::service_connection_map::ConsumerPscConnection::ip].
1706        pub fn set_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1707            self.ip = v.into();
1708            self
1709        }
1710
1711        /// Sets the value of [error_type][crate::model::service_connection_map::ConsumerPscConnection::error_type].
1712        #[deprecated]
1713        pub fn set_error_type<T: std::convert::Into<crate::model::ConnectionErrorType>>(
1714            mut self,
1715            v: T,
1716        ) -> Self {
1717            self.error_type = v.into();
1718            self
1719        }
1720
1721        /// Sets the value of [error][crate::model::service_connection_map::ConsumerPscConnection::error].
1722        #[deprecated]
1723        pub fn set_error<T>(mut self, v: T) -> Self
1724        where
1725            T: std::convert::Into<rpc::model::Status>,
1726        {
1727            self.error = std::option::Option::Some(v.into());
1728            self
1729        }
1730
1731        /// Sets or clears the value of [error][crate::model::service_connection_map::ConsumerPscConnection::error].
1732        #[deprecated]
1733        pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
1734        where
1735            T: std::convert::Into<rpc::model::Status>,
1736        {
1737            self.error = v.map(|x| x.into());
1738            self
1739        }
1740
1741        /// Sets the value of [gce_operation][crate::model::service_connection_map::ConsumerPscConnection::gce_operation].
1742        pub fn set_gce_operation<T: std::convert::Into<std::string::String>>(
1743            mut self,
1744            v: T,
1745        ) -> Self {
1746            self.gce_operation = v.into();
1747            self
1748        }
1749
1750        /// Sets the value of [forwarding_rule][crate::model::service_connection_map::ConsumerPscConnection::forwarding_rule].
1751        pub fn set_forwarding_rule<T: std::convert::Into<std::string::String>>(
1752            mut self,
1753            v: T,
1754        ) -> Self {
1755            self.forwarding_rule = v.into();
1756            self
1757        }
1758
1759        /// Sets the value of [error_info][crate::model::service_connection_map::ConsumerPscConnection::error_info].
1760        pub fn set_error_info<T>(mut self, v: T) -> Self
1761        where
1762            T: std::convert::Into<rpc::model::ErrorInfo>,
1763        {
1764            self.error_info = std::option::Option::Some(v.into());
1765            self
1766        }
1767
1768        /// Sets or clears the value of [error_info][crate::model::service_connection_map::ConsumerPscConnection::error_info].
1769        pub fn set_or_clear_error_info<T>(mut self, v: std::option::Option<T>) -> Self
1770        where
1771            T: std::convert::Into<rpc::model::ErrorInfo>,
1772        {
1773            self.error_info = v.map(|x| x.into());
1774            self
1775        }
1776
1777        /// Sets the value of [selected_subnetwork][crate::model::service_connection_map::ConsumerPscConnection::selected_subnetwork].
1778        pub fn set_selected_subnetwork<T: std::convert::Into<std::string::String>>(
1779            mut self,
1780            v: T,
1781        ) -> Self {
1782            self.selected_subnetwork = v.into();
1783            self
1784        }
1785
1786        /// Sets the value of [producer_instance_id][crate::model::service_connection_map::ConsumerPscConnection::producer_instance_id].
1787        #[deprecated]
1788        pub fn set_producer_instance_id<T: std::convert::Into<std::string::String>>(
1789            mut self,
1790            v: T,
1791        ) -> Self {
1792            self.producer_instance_id = v.into();
1793            self
1794        }
1795
1796        /// Sets the value of [producer_instance_metadata][crate::model::service_connection_map::ConsumerPscConnection::producer_instance_metadata].
1797        pub fn set_producer_instance_metadata<T, K, V>(mut self, v: T) -> Self
1798        where
1799            T: std::iter::IntoIterator<Item = (K, V)>,
1800            K: std::convert::Into<std::string::String>,
1801            V: std::convert::Into<std::string::String>,
1802        {
1803            use std::iter::Iterator;
1804            self.producer_instance_metadata =
1805                v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1806            self
1807        }
1808
1809        /// Sets the value of [ip_version][crate::model::service_connection_map::ConsumerPscConnection::ip_version].
1810        pub fn set_ip_version<T>(mut self, v: T) -> Self
1811        where
1812            T: std::convert::Into<crate::model::IPVersion>,
1813        {
1814            self.ip_version = std::option::Option::Some(v.into());
1815            self
1816        }
1817
1818        /// Sets or clears the value of [ip_version][crate::model::service_connection_map::ConsumerPscConnection::ip_version].
1819        pub fn set_or_clear_ip_version<T>(mut self, v: std::option::Option<T>) -> Self
1820        where
1821            T: std::convert::Into<crate::model::IPVersion>,
1822        {
1823            self.ip_version = v.map(|x| x.into());
1824            self
1825        }
1826    }
1827
1828    impl wkt::message::Message for ConsumerPscConnection {
1829        fn typename() -> &'static str {
1830            "type.googleapis.com/google.cloud.networkconnectivity.v1.ServiceConnectionMap.ConsumerPscConnection"
1831        }
1832    }
1833
1834    #[doc(hidden)]
1835    impl<'de> serde::de::Deserialize<'de> for ConsumerPscConnection {
1836        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1837        where
1838            D: serde::Deserializer<'de>,
1839        {
1840            #[allow(non_camel_case_types)]
1841            #[doc(hidden)]
1842            #[derive(PartialEq, Eq, Hash)]
1843            enum __FieldTag {
1844                __service_attachment_uri,
1845                __state,
1846                __project,
1847                __network,
1848                __psc_connection_id,
1849                __ip,
1850                __error_type,
1851                __error,
1852                __gce_operation,
1853                __forwarding_rule,
1854                __error_info,
1855                __selected_subnetwork,
1856                __producer_instance_id,
1857                __producer_instance_metadata,
1858                __ip_version,
1859                Unknown(std::string::String),
1860            }
1861            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1862                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1863                where
1864                    D: serde::Deserializer<'de>,
1865                {
1866                    struct Visitor;
1867                    impl<'de> serde::de::Visitor<'de> for Visitor {
1868                        type Value = __FieldTag;
1869                        fn expecting(
1870                            &self,
1871                            formatter: &mut std::fmt::Formatter,
1872                        ) -> std::fmt::Result {
1873                            formatter.write_str("a field name for ConsumerPscConnection")
1874                        }
1875                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1876                        where
1877                            E: serde::de::Error,
1878                        {
1879                            use std::result::Result::Ok;
1880                            use std::string::ToString;
1881                            match value {
1882                                "serviceAttachmentUri" => Ok(__FieldTag::__service_attachment_uri),
1883                                "service_attachment_uri" => {
1884                                    Ok(__FieldTag::__service_attachment_uri)
1885                                }
1886                                "state" => Ok(__FieldTag::__state),
1887                                "project" => Ok(__FieldTag::__project),
1888                                "network" => Ok(__FieldTag::__network),
1889                                "pscConnectionId" => Ok(__FieldTag::__psc_connection_id),
1890                                "psc_connection_id" => Ok(__FieldTag::__psc_connection_id),
1891                                "ip" => Ok(__FieldTag::__ip),
1892                                "errorType" => Ok(__FieldTag::__error_type),
1893                                "error_type" => Ok(__FieldTag::__error_type),
1894                                "error" => Ok(__FieldTag::__error),
1895                                "gceOperation" => Ok(__FieldTag::__gce_operation),
1896                                "gce_operation" => Ok(__FieldTag::__gce_operation),
1897                                "forwardingRule" => Ok(__FieldTag::__forwarding_rule),
1898                                "forwarding_rule" => Ok(__FieldTag::__forwarding_rule),
1899                                "errorInfo" => Ok(__FieldTag::__error_info),
1900                                "error_info" => Ok(__FieldTag::__error_info),
1901                                "selectedSubnetwork" => Ok(__FieldTag::__selected_subnetwork),
1902                                "selected_subnetwork" => Ok(__FieldTag::__selected_subnetwork),
1903                                "producerInstanceId" => Ok(__FieldTag::__producer_instance_id),
1904                                "producer_instance_id" => Ok(__FieldTag::__producer_instance_id),
1905                                "producerInstanceMetadata" => {
1906                                    Ok(__FieldTag::__producer_instance_metadata)
1907                                }
1908                                "producer_instance_metadata" => {
1909                                    Ok(__FieldTag::__producer_instance_metadata)
1910                                }
1911                                "ipVersion" => Ok(__FieldTag::__ip_version),
1912                                "ip_version" => Ok(__FieldTag::__ip_version),
1913                                _ => Ok(__FieldTag::Unknown(value.to_string())),
1914                            }
1915                        }
1916                    }
1917                    deserializer.deserialize_identifier(Visitor)
1918                }
1919            }
1920            struct Visitor;
1921            impl<'de> serde::de::Visitor<'de> for Visitor {
1922                type Value = ConsumerPscConnection;
1923                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1924                    formatter.write_str("struct ConsumerPscConnection")
1925                }
1926                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1927                where
1928                    A: serde::de::MapAccess<'de>,
1929                {
1930                    #[allow(unused_imports)]
1931                    use serde::de::Error;
1932                    use std::option::Option::Some;
1933                    let mut fields = std::collections::HashSet::new();
1934                    let mut result = Self::Value::new();
1935                    while let Some(tag) = map.next_key::<__FieldTag>()? {
1936                        #[allow(clippy::match_single_binding)]
1937                        match tag {
1938                            __FieldTag::__service_attachment_uri => {
1939                                if !fields.insert(__FieldTag::__service_attachment_uri) {
1940                                    return std::result::Result::Err(A::Error::duplicate_field(
1941                                        "multiple values for service_attachment_uri",
1942                                    ));
1943                                }
1944                                result.service_attachment_uri = map
1945                                    .next_value::<std::option::Option<std::string::String>>()?
1946                                    .unwrap_or_default();
1947                            }
1948                            __FieldTag::__state => {
1949                                if !fields.insert(__FieldTag::__state) {
1950                                    return std::result::Result::Err(A::Error::duplicate_field(
1951                                        "multiple values for state",
1952                                    ));
1953                                }
1954                                result.state = map.next_value::<std::option::Option<crate::model::service_connection_map::consumer_psc_connection::State>>()?.unwrap_or_default();
1955                            }
1956                            __FieldTag::__project => {
1957                                if !fields.insert(__FieldTag::__project) {
1958                                    return std::result::Result::Err(A::Error::duplicate_field(
1959                                        "multiple values for project",
1960                                    ));
1961                                }
1962                                result.project = map
1963                                    .next_value::<std::option::Option<std::string::String>>()?
1964                                    .unwrap_or_default();
1965                            }
1966                            __FieldTag::__network => {
1967                                if !fields.insert(__FieldTag::__network) {
1968                                    return std::result::Result::Err(A::Error::duplicate_field(
1969                                        "multiple values for network",
1970                                    ));
1971                                }
1972                                result.network = map
1973                                    .next_value::<std::option::Option<std::string::String>>()?
1974                                    .unwrap_or_default();
1975                            }
1976                            __FieldTag::__psc_connection_id => {
1977                                if !fields.insert(__FieldTag::__psc_connection_id) {
1978                                    return std::result::Result::Err(A::Error::duplicate_field(
1979                                        "multiple values for psc_connection_id",
1980                                    ));
1981                                }
1982                                result.psc_connection_id = map
1983                                    .next_value::<std::option::Option<std::string::String>>()?
1984                                    .unwrap_or_default();
1985                            }
1986                            __FieldTag::__ip => {
1987                                if !fields.insert(__FieldTag::__ip) {
1988                                    return std::result::Result::Err(A::Error::duplicate_field(
1989                                        "multiple values for ip",
1990                                    ));
1991                                }
1992                                result.ip = map
1993                                    .next_value::<std::option::Option<std::string::String>>()?
1994                                    .unwrap_or_default();
1995                            }
1996                            __FieldTag::__error_type => {
1997                                if !fields.insert(__FieldTag::__error_type) {
1998                                    return std::result::Result::Err(A::Error::duplicate_field(
1999                                        "multiple values for error_type",
2000                                    ));
2001                                }
2002                                result.error_type = map.next_value::<std::option::Option<crate::model::ConnectionErrorType>>()?.unwrap_or_default();
2003                            }
2004                            __FieldTag::__error => {
2005                                if !fields.insert(__FieldTag::__error) {
2006                                    return std::result::Result::Err(A::Error::duplicate_field(
2007                                        "multiple values for error",
2008                                    ));
2009                                }
2010                                result.error =
2011                                    map.next_value::<std::option::Option<rpc::model::Status>>()?;
2012                            }
2013                            __FieldTag::__gce_operation => {
2014                                if !fields.insert(__FieldTag::__gce_operation) {
2015                                    return std::result::Result::Err(A::Error::duplicate_field(
2016                                        "multiple values for gce_operation",
2017                                    ));
2018                                }
2019                                result.gce_operation = map
2020                                    .next_value::<std::option::Option<std::string::String>>()?
2021                                    .unwrap_or_default();
2022                            }
2023                            __FieldTag::__forwarding_rule => {
2024                                if !fields.insert(__FieldTag::__forwarding_rule) {
2025                                    return std::result::Result::Err(A::Error::duplicate_field(
2026                                        "multiple values for forwarding_rule",
2027                                    ));
2028                                }
2029                                result.forwarding_rule = map
2030                                    .next_value::<std::option::Option<std::string::String>>()?
2031                                    .unwrap_or_default();
2032                            }
2033                            __FieldTag::__error_info => {
2034                                if !fields.insert(__FieldTag::__error_info) {
2035                                    return std::result::Result::Err(A::Error::duplicate_field(
2036                                        "multiple values for error_info",
2037                                    ));
2038                                }
2039                                result.error_info =
2040                                    map.next_value::<std::option::Option<rpc::model::ErrorInfo>>()?;
2041                            }
2042                            __FieldTag::__selected_subnetwork => {
2043                                if !fields.insert(__FieldTag::__selected_subnetwork) {
2044                                    return std::result::Result::Err(A::Error::duplicate_field(
2045                                        "multiple values for selected_subnetwork",
2046                                    ));
2047                                }
2048                                result.selected_subnetwork = map
2049                                    .next_value::<std::option::Option<std::string::String>>()?
2050                                    .unwrap_or_default();
2051                            }
2052                            __FieldTag::__producer_instance_id => {
2053                                if !fields.insert(__FieldTag::__producer_instance_id) {
2054                                    return std::result::Result::Err(A::Error::duplicate_field(
2055                                        "multiple values for producer_instance_id",
2056                                    ));
2057                                }
2058                                result.producer_instance_id = map
2059                                    .next_value::<std::option::Option<std::string::String>>()?
2060                                    .unwrap_or_default();
2061                            }
2062                            __FieldTag::__producer_instance_metadata => {
2063                                if !fields.insert(__FieldTag::__producer_instance_metadata) {
2064                                    return std::result::Result::Err(A::Error::duplicate_field(
2065                                        "multiple values for producer_instance_metadata",
2066                                    ));
2067                                }
2068                                result.producer_instance_metadata = map
2069                                    .next_value::<std::option::Option<
2070                                        std::collections::HashMap<
2071                                            std::string::String,
2072                                            std::string::String,
2073                                        >,
2074                                    >>()?
2075                                    .unwrap_or_default();
2076                            }
2077                            __FieldTag::__ip_version => {
2078                                if !fields.insert(__FieldTag::__ip_version) {
2079                                    return std::result::Result::Err(A::Error::duplicate_field(
2080                                        "multiple values for ip_version",
2081                                    ));
2082                                }
2083                                result.ip_version = map
2084                                    .next_value::<std::option::Option<crate::model::IPVersion>>()?;
2085                            }
2086                            __FieldTag::Unknown(key) => {
2087                                let value = map.next_value::<serde_json::Value>()?;
2088                                result._unknown_fields.insert(key, value);
2089                            }
2090                        }
2091                    }
2092                    std::result::Result::Ok(result)
2093                }
2094            }
2095            deserializer.deserialize_any(Visitor)
2096        }
2097    }
2098
2099    #[doc(hidden)]
2100    impl serde::ser::Serialize for ConsumerPscConnection {
2101        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2102        where
2103            S: serde::ser::Serializer,
2104        {
2105            use serde::ser::SerializeMap;
2106            #[allow(unused_imports)]
2107            use std::option::Option::Some;
2108            let mut state = serializer.serialize_map(std::option::Option::None)?;
2109            if !self.service_attachment_uri.is_empty() {
2110                state.serialize_entry("serviceAttachmentUri", &self.service_attachment_uri)?;
2111            }
2112            if !wkt::internal::is_default(&self.state) {
2113                state.serialize_entry("state", &self.state)?;
2114            }
2115            if !self.project.is_empty() {
2116                state.serialize_entry("project", &self.project)?;
2117            }
2118            if !self.network.is_empty() {
2119                state.serialize_entry("network", &self.network)?;
2120            }
2121            if !self.psc_connection_id.is_empty() {
2122                state.serialize_entry("pscConnectionId", &self.psc_connection_id)?;
2123            }
2124            if !self.ip.is_empty() {
2125                state.serialize_entry("ip", &self.ip)?;
2126            }
2127            if !wkt::internal::is_default(&self.error_type) {
2128                state.serialize_entry("errorType", &self.error_type)?;
2129            }
2130            if self.error.is_some() {
2131                state.serialize_entry("error", &self.error)?;
2132            }
2133            if !self.gce_operation.is_empty() {
2134                state.serialize_entry("gceOperation", &self.gce_operation)?;
2135            }
2136            if !self.forwarding_rule.is_empty() {
2137                state.serialize_entry("forwardingRule", &self.forwarding_rule)?;
2138            }
2139            if self.error_info.is_some() {
2140                state.serialize_entry("errorInfo", &self.error_info)?;
2141            }
2142            if !self.selected_subnetwork.is_empty() {
2143                state.serialize_entry("selectedSubnetwork", &self.selected_subnetwork)?;
2144            }
2145            if !self.producer_instance_id.is_empty() {
2146                state.serialize_entry("producerInstanceId", &self.producer_instance_id)?;
2147            }
2148            if !self.producer_instance_metadata.is_empty() {
2149                state.serialize_entry(
2150                    "producerInstanceMetadata",
2151                    &self.producer_instance_metadata,
2152                )?;
2153            }
2154            if self.ip_version.is_some() {
2155                state.serialize_entry("ipVersion", &self.ip_version)?;
2156            }
2157            if !self._unknown_fields.is_empty() {
2158                for (key, value) in self._unknown_fields.iter() {
2159                    state.serialize_entry(key, &value)?;
2160                }
2161            }
2162            state.end()
2163        }
2164    }
2165
2166    /// Defines additional types related to [ConsumerPscConnection].
2167    pub mod consumer_psc_connection {
2168        #[allow(unused_imports)]
2169        use super::*;
2170
2171        /// The state of the PSC connection.
2172        /// We reserve the right to add more states without notice in the future.
2173        /// Users should not use exhaustive switch statements on this enum.
2174        /// See <https://google.aip.dev/216>.
2175        ///
2176        /// # Working with unknown values
2177        ///
2178        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2179        /// additional enum variants at any time. Adding new variants is not considered
2180        /// a breaking change. Applications should write their code in anticipation of:
2181        ///
2182        /// - New values appearing in future releases of the client library, **and**
2183        /// - New values received dynamically, without application changes.
2184        ///
2185        /// Please consult the [Working with enums] section in the user guide for some
2186        /// guidelines.
2187        ///
2188        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2189        #[derive(Clone, Debug, PartialEq)]
2190        #[non_exhaustive]
2191        pub enum State {
2192            /// An invalid state as the default case.
2193            Unspecified,
2194            /// The connection has been created successfully. However, for the
2195            /// up-to-date connection status, please use the service attachment's
2196            /// "ConnectedEndpoint.status" as the source of truth.
2197            Active,
2198            /// The connection is not functional since some resources on the connection
2199            /// fail to be created.
2200            Failed,
2201            /// The connection is being created.
2202            Creating,
2203            /// The connection is being deleted.
2204            Deleting,
2205            /// The connection is being repaired to complete creation.
2206            CreateRepairing,
2207            /// The connection is being repaired to complete deletion.
2208            DeleteRepairing,
2209            /// If set, the enum was initialized with an unknown value.
2210            ///
2211            /// Applications can examine the value using [State::value] or
2212            /// [State::name].
2213            UnknownValue(state::UnknownValue),
2214        }
2215
2216        #[doc(hidden)]
2217        pub mod state {
2218            #[allow(unused_imports)]
2219            use super::*;
2220            #[derive(Clone, Debug, PartialEq)]
2221            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2222        }
2223
2224        impl State {
2225            /// Gets the enum value.
2226            ///
2227            /// Returns `None` if the enum contains an unknown value deserialized from
2228            /// the string representation of enums.
2229            pub fn value(&self) -> std::option::Option<i32> {
2230                match self {
2231                    Self::Unspecified => std::option::Option::Some(0),
2232                    Self::Active => std::option::Option::Some(1),
2233                    Self::Failed => std::option::Option::Some(2),
2234                    Self::Creating => std::option::Option::Some(3),
2235                    Self::Deleting => std::option::Option::Some(4),
2236                    Self::CreateRepairing => std::option::Option::Some(5),
2237                    Self::DeleteRepairing => std::option::Option::Some(6),
2238                    Self::UnknownValue(u) => u.0.value(),
2239                }
2240            }
2241
2242            /// Gets the enum value as a string.
2243            ///
2244            /// Returns `None` if the enum contains an unknown value deserialized from
2245            /// the integer representation of enums.
2246            pub fn name(&self) -> std::option::Option<&str> {
2247                match self {
2248                    Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2249                    Self::Active => std::option::Option::Some("ACTIVE"),
2250                    Self::Failed => std::option::Option::Some("FAILED"),
2251                    Self::Creating => std::option::Option::Some("CREATING"),
2252                    Self::Deleting => std::option::Option::Some("DELETING"),
2253                    Self::CreateRepairing => std::option::Option::Some("CREATE_REPAIRING"),
2254                    Self::DeleteRepairing => std::option::Option::Some("DELETE_REPAIRING"),
2255                    Self::UnknownValue(u) => u.0.name(),
2256                }
2257            }
2258        }
2259
2260        impl std::default::Default for State {
2261            fn default() -> Self {
2262                use std::convert::From;
2263                Self::from(0)
2264            }
2265        }
2266
2267        impl std::fmt::Display for State {
2268            fn fmt(
2269                &self,
2270                f: &mut std::fmt::Formatter<'_>,
2271            ) -> std::result::Result<(), std::fmt::Error> {
2272                wkt::internal::display_enum(f, self.name(), self.value())
2273            }
2274        }
2275
2276        impl std::convert::From<i32> for State {
2277            fn from(value: i32) -> Self {
2278                match value {
2279                    0 => Self::Unspecified,
2280                    1 => Self::Active,
2281                    2 => Self::Failed,
2282                    3 => Self::Creating,
2283                    4 => Self::Deleting,
2284                    5 => Self::CreateRepairing,
2285                    6 => Self::DeleteRepairing,
2286                    _ => Self::UnknownValue(state::UnknownValue(
2287                        wkt::internal::UnknownEnumValue::Integer(value),
2288                    )),
2289                }
2290            }
2291        }
2292
2293        impl std::convert::From<&str> for State {
2294            fn from(value: &str) -> Self {
2295                use std::string::ToString;
2296                match value {
2297                    "STATE_UNSPECIFIED" => Self::Unspecified,
2298                    "ACTIVE" => Self::Active,
2299                    "FAILED" => Self::Failed,
2300                    "CREATING" => Self::Creating,
2301                    "DELETING" => Self::Deleting,
2302                    "CREATE_REPAIRING" => Self::CreateRepairing,
2303                    "DELETE_REPAIRING" => Self::DeleteRepairing,
2304                    _ => Self::UnknownValue(state::UnknownValue(
2305                        wkt::internal::UnknownEnumValue::String(value.to_string()),
2306                    )),
2307                }
2308            }
2309        }
2310
2311        impl serde::ser::Serialize for State {
2312            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2313            where
2314                S: serde::Serializer,
2315            {
2316                match self {
2317                    Self::Unspecified => serializer.serialize_i32(0),
2318                    Self::Active => serializer.serialize_i32(1),
2319                    Self::Failed => serializer.serialize_i32(2),
2320                    Self::Creating => serializer.serialize_i32(3),
2321                    Self::Deleting => serializer.serialize_i32(4),
2322                    Self::CreateRepairing => serializer.serialize_i32(5),
2323                    Self::DeleteRepairing => serializer.serialize_i32(6),
2324                    Self::UnknownValue(u) => u.0.serialize(serializer),
2325                }
2326            }
2327        }
2328
2329        impl<'de> serde::de::Deserialize<'de> for State {
2330            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2331            where
2332                D: serde::Deserializer<'de>,
2333            {
2334                deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2335                    ".google.cloud.networkconnectivity.v1.ServiceConnectionMap.ConsumerPscConnection.State"))
2336            }
2337        }
2338    }
2339}
2340
2341/// Request for ListServiceConnectionMaps.
2342#[derive(Clone, Debug, Default, PartialEq)]
2343#[non_exhaustive]
2344pub struct ListServiceConnectionMapsRequest {
2345    /// Required. The parent resource's name. ex. projects/123/locations/us-east1
2346    pub parent: std::string::String,
2347
2348    /// The maximum number of results per page that should be returned.
2349    pub page_size: i32,
2350
2351    /// The page token.
2352    pub page_token: std::string::String,
2353
2354    /// A filter expression that filters the results listed in the response.
2355    pub filter: std::string::String,
2356
2357    /// Sort the results by a certain order.
2358    pub order_by: std::string::String,
2359
2360    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2361}
2362
2363impl ListServiceConnectionMapsRequest {
2364    pub fn new() -> Self {
2365        std::default::Default::default()
2366    }
2367
2368    /// Sets the value of [parent][crate::model::ListServiceConnectionMapsRequest::parent].
2369    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2370        self.parent = v.into();
2371        self
2372    }
2373
2374    /// Sets the value of [page_size][crate::model::ListServiceConnectionMapsRequest::page_size].
2375    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2376        self.page_size = v.into();
2377        self
2378    }
2379
2380    /// Sets the value of [page_token][crate::model::ListServiceConnectionMapsRequest::page_token].
2381    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2382        self.page_token = v.into();
2383        self
2384    }
2385
2386    /// Sets the value of [filter][crate::model::ListServiceConnectionMapsRequest::filter].
2387    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2388        self.filter = v.into();
2389        self
2390    }
2391
2392    /// Sets the value of [order_by][crate::model::ListServiceConnectionMapsRequest::order_by].
2393    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2394        self.order_by = v.into();
2395        self
2396    }
2397}
2398
2399impl wkt::message::Message for ListServiceConnectionMapsRequest {
2400    fn typename() -> &'static str {
2401        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListServiceConnectionMapsRequest"
2402    }
2403}
2404
2405#[doc(hidden)]
2406impl<'de> serde::de::Deserialize<'de> for ListServiceConnectionMapsRequest {
2407    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2408    where
2409        D: serde::Deserializer<'de>,
2410    {
2411        #[allow(non_camel_case_types)]
2412        #[doc(hidden)]
2413        #[derive(PartialEq, Eq, Hash)]
2414        enum __FieldTag {
2415            __parent,
2416            __page_size,
2417            __page_token,
2418            __filter,
2419            __order_by,
2420            Unknown(std::string::String),
2421        }
2422        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2423            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2424            where
2425                D: serde::Deserializer<'de>,
2426            {
2427                struct Visitor;
2428                impl<'de> serde::de::Visitor<'de> for Visitor {
2429                    type Value = __FieldTag;
2430                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2431                        formatter.write_str("a field name for ListServiceConnectionMapsRequest")
2432                    }
2433                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2434                    where
2435                        E: serde::de::Error,
2436                    {
2437                        use std::result::Result::Ok;
2438                        use std::string::ToString;
2439                        match value {
2440                            "parent" => Ok(__FieldTag::__parent),
2441                            "pageSize" => Ok(__FieldTag::__page_size),
2442                            "page_size" => Ok(__FieldTag::__page_size),
2443                            "pageToken" => Ok(__FieldTag::__page_token),
2444                            "page_token" => Ok(__FieldTag::__page_token),
2445                            "filter" => Ok(__FieldTag::__filter),
2446                            "orderBy" => Ok(__FieldTag::__order_by),
2447                            "order_by" => Ok(__FieldTag::__order_by),
2448                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2449                        }
2450                    }
2451                }
2452                deserializer.deserialize_identifier(Visitor)
2453            }
2454        }
2455        struct Visitor;
2456        impl<'de> serde::de::Visitor<'de> for Visitor {
2457            type Value = ListServiceConnectionMapsRequest;
2458            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2459                formatter.write_str("struct ListServiceConnectionMapsRequest")
2460            }
2461            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2462            where
2463                A: serde::de::MapAccess<'de>,
2464            {
2465                #[allow(unused_imports)]
2466                use serde::de::Error;
2467                use std::option::Option::Some;
2468                let mut fields = std::collections::HashSet::new();
2469                let mut result = Self::Value::new();
2470                while let Some(tag) = map.next_key::<__FieldTag>()? {
2471                    #[allow(clippy::match_single_binding)]
2472                    match tag {
2473                        __FieldTag::__parent => {
2474                            if !fields.insert(__FieldTag::__parent) {
2475                                return std::result::Result::Err(A::Error::duplicate_field(
2476                                    "multiple values for parent",
2477                                ));
2478                            }
2479                            result.parent = map
2480                                .next_value::<std::option::Option<std::string::String>>()?
2481                                .unwrap_or_default();
2482                        }
2483                        __FieldTag::__page_size => {
2484                            if !fields.insert(__FieldTag::__page_size) {
2485                                return std::result::Result::Err(A::Error::duplicate_field(
2486                                    "multiple values for page_size",
2487                                ));
2488                            }
2489                            struct __With(std::option::Option<i32>);
2490                            impl<'de> serde::de::Deserialize<'de> for __With {
2491                                fn deserialize<D>(
2492                                    deserializer: D,
2493                                ) -> std::result::Result<Self, D::Error>
2494                                where
2495                                    D: serde::de::Deserializer<'de>,
2496                                {
2497                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2498                                }
2499                            }
2500                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
2501                        }
2502                        __FieldTag::__page_token => {
2503                            if !fields.insert(__FieldTag::__page_token) {
2504                                return std::result::Result::Err(A::Error::duplicate_field(
2505                                    "multiple values for page_token",
2506                                ));
2507                            }
2508                            result.page_token = map
2509                                .next_value::<std::option::Option<std::string::String>>()?
2510                                .unwrap_or_default();
2511                        }
2512                        __FieldTag::__filter => {
2513                            if !fields.insert(__FieldTag::__filter) {
2514                                return std::result::Result::Err(A::Error::duplicate_field(
2515                                    "multiple values for filter",
2516                                ));
2517                            }
2518                            result.filter = map
2519                                .next_value::<std::option::Option<std::string::String>>()?
2520                                .unwrap_or_default();
2521                        }
2522                        __FieldTag::__order_by => {
2523                            if !fields.insert(__FieldTag::__order_by) {
2524                                return std::result::Result::Err(A::Error::duplicate_field(
2525                                    "multiple values for order_by",
2526                                ));
2527                            }
2528                            result.order_by = map
2529                                .next_value::<std::option::Option<std::string::String>>()?
2530                                .unwrap_or_default();
2531                        }
2532                        __FieldTag::Unknown(key) => {
2533                            let value = map.next_value::<serde_json::Value>()?;
2534                            result._unknown_fields.insert(key, value);
2535                        }
2536                    }
2537                }
2538                std::result::Result::Ok(result)
2539            }
2540        }
2541        deserializer.deserialize_any(Visitor)
2542    }
2543}
2544
2545#[doc(hidden)]
2546impl serde::ser::Serialize for ListServiceConnectionMapsRequest {
2547    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2548    where
2549        S: serde::ser::Serializer,
2550    {
2551        use serde::ser::SerializeMap;
2552        #[allow(unused_imports)]
2553        use std::option::Option::Some;
2554        let mut state = serializer.serialize_map(std::option::Option::None)?;
2555        if !self.parent.is_empty() {
2556            state.serialize_entry("parent", &self.parent)?;
2557        }
2558        if !wkt::internal::is_default(&self.page_size) {
2559            struct __With<'a>(&'a i32);
2560            impl<'a> serde::ser::Serialize for __With<'a> {
2561                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2562                where
2563                    S: serde::ser::Serializer,
2564                {
2565                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2566                }
2567            }
2568            state.serialize_entry("pageSize", &__With(&self.page_size))?;
2569        }
2570        if !self.page_token.is_empty() {
2571            state.serialize_entry("pageToken", &self.page_token)?;
2572        }
2573        if !self.filter.is_empty() {
2574            state.serialize_entry("filter", &self.filter)?;
2575        }
2576        if !self.order_by.is_empty() {
2577            state.serialize_entry("orderBy", &self.order_by)?;
2578        }
2579        if !self._unknown_fields.is_empty() {
2580            for (key, value) in self._unknown_fields.iter() {
2581                state.serialize_entry(key, &value)?;
2582            }
2583        }
2584        state.end()
2585    }
2586}
2587
2588/// Response for ListServiceConnectionMaps.
2589#[derive(Clone, Debug, Default, PartialEq)]
2590#[non_exhaustive]
2591pub struct ListServiceConnectionMapsResponse {
2592    /// ServiceConnectionMaps to be returned.
2593    pub service_connection_maps: std::vec::Vec<crate::model::ServiceConnectionMap>,
2594
2595    /// The next pagination token in the List response. It should be used as
2596    /// page_token for the following request. An empty value means no more result.
2597    pub next_page_token: std::string::String,
2598
2599    /// Locations that could not be reached.
2600    pub unreachable: std::vec::Vec<std::string::String>,
2601
2602    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2603}
2604
2605impl ListServiceConnectionMapsResponse {
2606    pub fn new() -> Self {
2607        std::default::Default::default()
2608    }
2609
2610    /// Sets the value of [service_connection_maps][crate::model::ListServiceConnectionMapsResponse::service_connection_maps].
2611    pub fn set_service_connection_maps<T, V>(mut self, v: T) -> Self
2612    where
2613        T: std::iter::IntoIterator<Item = V>,
2614        V: std::convert::Into<crate::model::ServiceConnectionMap>,
2615    {
2616        use std::iter::Iterator;
2617        self.service_connection_maps = v.into_iter().map(|i| i.into()).collect();
2618        self
2619    }
2620
2621    /// Sets the value of [next_page_token][crate::model::ListServiceConnectionMapsResponse::next_page_token].
2622    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2623        self.next_page_token = v.into();
2624        self
2625    }
2626
2627    /// Sets the value of [unreachable][crate::model::ListServiceConnectionMapsResponse::unreachable].
2628    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
2629    where
2630        T: std::iter::IntoIterator<Item = V>,
2631        V: std::convert::Into<std::string::String>,
2632    {
2633        use std::iter::Iterator;
2634        self.unreachable = v.into_iter().map(|i| i.into()).collect();
2635        self
2636    }
2637}
2638
2639impl wkt::message::Message for ListServiceConnectionMapsResponse {
2640    fn typename() -> &'static str {
2641        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListServiceConnectionMapsResponse"
2642    }
2643}
2644
2645#[doc(hidden)]
2646impl gax::paginator::internal::PageableResponse for ListServiceConnectionMapsResponse {
2647    type PageItem = crate::model::ServiceConnectionMap;
2648
2649    fn items(self) -> std::vec::Vec<Self::PageItem> {
2650        self.service_connection_maps
2651    }
2652
2653    fn next_page_token(&self) -> std::string::String {
2654        use std::clone::Clone;
2655        self.next_page_token.clone()
2656    }
2657}
2658
2659#[doc(hidden)]
2660impl<'de> serde::de::Deserialize<'de> for ListServiceConnectionMapsResponse {
2661    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2662    where
2663        D: serde::Deserializer<'de>,
2664    {
2665        #[allow(non_camel_case_types)]
2666        #[doc(hidden)]
2667        #[derive(PartialEq, Eq, Hash)]
2668        enum __FieldTag {
2669            __service_connection_maps,
2670            __next_page_token,
2671            __unreachable,
2672            Unknown(std::string::String),
2673        }
2674        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2675            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2676            where
2677                D: serde::Deserializer<'de>,
2678            {
2679                struct Visitor;
2680                impl<'de> serde::de::Visitor<'de> for Visitor {
2681                    type Value = __FieldTag;
2682                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2683                        formatter.write_str("a field name for ListServiceConnectionMapsResponse")
2684                    }
2685                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2686                    where
2687                        E: serde::de::Error,
2688                    {
2689                        use std::result::Result::Ok;
2690                        use std::string::ToString;
2691                        match value {
2692                            "serviceConnectionMaps" => Ok(__FieldTag::__service_connection_maps),
2693                            "service_connection_maps" => Ok(__FieldTag::__service_connection_maps),
2694                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
2695                            "next_page_token" => Ok(__FieldTag::__next_page_token),
2696                            "unreachable" => Ok(__FieldTag::__unreachable),
2697                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2698                        }
2699                    }
2700                }
2701                deserializer.deserialize_identifier(Visitor)
2702            }
2703        }
2704        struct Visitor;
2705        impl<'de> serde::de::Visitor<'de> for Visitor {
2706            type Value = ListServiceConnectionMapsResponse;
2707            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2708                formatter.write_str("struct ListServiceConnectionMapsResponse")
2709            }
2710            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2711            where
2712                A: serde::de::MapAccess<'de>,
2713            {
2714                #[allow(unused_imports)]
2715                use serde::de::Error;
2716                use std::option::Option::Some;
2717                let mut fields = std::collections::HashSet::new();
2718                let mut result = Self::Value::new();
2719                while let Some(tag) = map.next_key::<__FieldTag>()? {
2720                    #[allow(clippy::match_single_binding)]
2721                    match tag {
2722                        __FieldTag::__service_connection_maps => {
2723                            if !fields.insert(__FieldTag::__service_connection_maps) {
2724                                return std::result::Result::Err(A::Error::duplicate_field(
2725                                    "multiple values for service_connection_maps",
2726                                ));
2727                            }
2728                            result.service_connection_maps = map
2729                                .next_value::<std::option::Option<
2730                                    std::vec::Vec<crate::model::ServiceConnectionMap>,
2731                                >>()?
2732                                .unwrap_or_default();
2733                        }
2734                        __FieldTag::__next_page_token => {
2735                            if !fields.insert(__FieldTag::__next_page_token) {
2736                                return std::result::Result::Err(A::Error::duplicate_field(
2737                                    "multiple values for next_page_token",
2738                                ));
2739                            }
2740                            result.next_page_token = map
2741                                .next_value::<std::option::Option<std::string::String>>()?
2742                                .unwrap_or_default();
2743                        }
2744                        __FieldTag::__unreachable => {
2745                            if !fields.insert(__FieldTag::__unreachable) {
2746                                return std::result::Result::Err(A::Error::duplicate_field(
2747                                    "multiple values for unreachable",
2748                                ));
2749                            }
2750                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
2751                        }
2752                        __FieldTag::Unknown(key) => {
2753                            let value = map.next_value::<serde_json::Value>()?;
2754                            result._unknown_fields.insert(key, value);
2755                        }
2756                    }
2757                }
2758                std::result::Result::Ok(result)
2759            }
2760        }
2761        deserializer.deserialize_any(Visitor)
2762    }
2763}
2764
2765#[doc(hidden)]
2766impl serde::ser::Serialize for ListServiceConnectionMapsResponse {
2767    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2768    where
2769        S: serde::ser::Serializer,
2770    {
2771        use serde::ser::SerializeMap;
2772        #[allow(unused_imports)]
2773        use std::option::Option::Some;
2774        let mut state = serializer.serialize_map(std::option::Option::None)?;
2775        if !self.service_connection_maps.is_empty() {
2776            state.serialize_entry("serviceConnectionMaps", &self.service_connection_maps)?;
2777        }
2778        if !self.next_page_token.is_empty() {
2779            state.serialize_entry("nextPageToken", &self.next_page_token)?;
2780        }
2781        if !self.unreachable.is_empty() {
2782            state.serialize_entry("unreachable", &self.unreachable)?;
2783        }
2784        if !self._unknown_fields.is_empty() {
2785            for (key, value) in self._unknown_fields.iter() {
2786                state.serialize_entry(key, &value)?;
2787            }
2788        }
2789        state.end()
2790    }
2791}
2792
2793/// Request for GetServiceConnectionMap.
2794#[derive(Clone, Debug, Default, PartialEq)]
2795#[non_exhaustive]
2796pub struct GetServiceConnectionMapRequest {
2797    /// Required. Name of the ServiceConnectionMap to get.
2798    pub name: std::string::String,
2799
2800    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2801}
2802
2803impl GetServiceConnectionMapRequest {
2804    pub fn new() -> Self {
2805        std::default::Default::default()
2806    }
2807
2808    /// Sets the value of [name][crate::model::GetServiceConnectionMapRequest::name].
2809    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2810        self.name = v.into();
2811        self
2812    }
2813}
2814
2815impl wkt::message::Message for GetServiceConnectionMapRequest {
2816    fn typename() -> &'static str {
2817        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetServiceConnectionMapRequest"
2818    }
2819}
2820
2821#[doc(hidden)]
2822impl<'de> serde::de::Deserialize<'de> for GetServiceConnectionMapRequest {
2823    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2824    where
2825        D: serde::Deserializer<'de>,
2826    {
2827        #[allow(non_camel_case_types)]
2828        #[doc(hidden)]
2829        #[derive(PartialEq, Eq, Hash)]
2830        enum __FieldTag {
2831            __name,
2832            Unknown(std::string::String),
2833        }
2834        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2835            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2836            where
2837                D: serde::Deserializer<'de>,
2838            {
2839                struct Visitor;
2840                impl<'de> serde::de::Visitor<'de> for Visitor {
2841                    type Value = __FieldTag;
2842                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2843                        formatter.write_str("a field name for GetServiceConnectionMapRequest")
2844                    }
2845                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2846                    where
2847                        E: serde::de::Error,
2848                    {
2849                        use std::result::Result::Ok;
2850                        use std::string::ToString;
2851                        match value {
2852                            "name" => Ok(__FieldTag::__name),
2853                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2854                        }
2855                    }
2856                }
2857                deserializer.deserialize_identifier(Visitor)
2858            }
2859        }
2860        struct Visitor;
2861        impl<'de> serde::de::Visitor<'de> for Visitor {
2862            type Value = GetServiceConnectionMapRequest;
2863            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2864                formatter.write_str("struct GetServiceConnectionMapRequest")
2865            }
2866            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2867            where
2868                A: serde::de::MapAccess<'de>,
2869            {
2870                #[allow(unused_imports)]
2871                use serde::de::Error;
2872                use std::option::Option::Some;
2873                let mut fields = std::collections::HashSet::new();
2874                let mut result = Self::Value::new();
2875                while let Some(tag) = map.next_key::<__FieldTag>()? {
2876                    #[allow(clippy::match_single_binding)]
2877                    match tag {
2878                        __FieldTag::__name => {
2879                            if !fields.insert(__FieldTag::__name) {
2880                                return std::result::Result::Err(A::Error::duplicate_field(
2881                                    "multiple values for name",
2882                                ));
2883                            }
2884                            result.name = map
2885                                .next_value::<std::option::Option<std::string::String>>()?
2886                                .unwrap_or_default();
2887                        }
2888                        __FieldTag::Unknown(key) => {
2889                            let value = map.next_value::<serde_json::Value>()?;
2890                            result._unknown_fields.insert(key, value);
2891                        }
2892                    }
2893                }
2894                std::result::Result::Ok(result)
2895            }
2896        }
2897        deserializer.deserialize_any(Visitor)
2898    }
2899}
2900
2901#[doc(hidden)]
2902impl serde::ser::Serialize for GetServiceConnectionMapRequest {
2903    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2904    where
2905        S: serde::ser::Serializer,
2906    {
2907        use serde::ser::SerializeMap;
2908        #[allow(unused_imports)]
2909        use std::option::Option::Some;
2910        let mut state = serializer.serialize_map(std::option::Option::None)?;
2911        if !self.name.is_empty() {
2912            state.serialize_entry("name", &self.name)?;
2913        }
2914        if !self._unknown_fields.is_empty() {
2915            for (key, value) in self._unknown_fields.iter() {
2916                state.serialize_entry(key, &value)?;
2917            }
2918        }
2919        state.end()
2920    }
2921}
2922
2923/// Request for CreateServiceConnectionMap.
2924#[derive(Clone, Debug, Default, PartialEq)]
2925#[non_exhaustive]
2926pub struct CreateServiceConnectionMapRequest {
2927    /// Required. The parent resource's name of the ServiceConnectionMap. ex.
2928    /// projects/123/locations/us-east1
2929    pub parent: std::string::String,
2930
2931    /// Optional. Resource ID
2932    /// (i.e. 'foo' in '[...]/projects/p/locations/l/serviceConnectionMaps/foo')
2933    /// See <https://google.aip.dev/122#resource-id-segments>
2934    /// Unique per location.
2935    /// If one is not provided, one will be generated.
2936    pub service_connection_map_id: std::string::String,
2937
2938    /// Required. Initial values for a new ServiceConnectionMaps
2939    pub service_connection_map: std::option::Option<crate::model::ServiceConnectionMap>,
2940
2941    /// Optional. An optional request ID to identify requests. Specify a unique
2942    /// request ID so that if you must retry your request, the server will know to
2943    /// ignore the request if it has already been completed. The server will
2944    /// guarantee that for at least 60 minutes since the first request.
2945    ///
2946    /// For example, consider a situation where you make an initial request and
2947    /// the request times out. If you make the request again with the same request
2948    /// ID, the server can check if original operation with the same request ID
2949    /// was received, and if so, will ignore the second request. This prevents
2950    /// clients from accidentally creating duplicate commitments.
2951    ///
2952    /// The request ID must be a valid UUID with the exception that zero UUID is
2953    /// not supported (00000000-0000-0000-0000-000000000000).
2954    pub request_id: std::string::String,
2955
2956    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2957}
2958
2959impl CreateServiceConnectionMapRequest {
2960    pub fn new() -> Self {
2961        std::default::Default::default()
2962    }
2963
2964    /// Sets the value of [parent][crate::model::CreateServiceConnectionMapRequest::parent].
2965    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2966        self.parent = v.into();
2967        self
2968    }
2969
2970    /// Sets the value of [service_connection_map_id][crate::model::CreateServiceConnectionMapRequest::service_connection_map_id].
2971    pub fn set_service_connection_map_id<T: std::convert::Into<std::string::String>>(
2972        mut self,
2973        v: T,
2974    ) -> Self {
2975        self.service_connection_map_id = v.into();
2976        self
2977    }
2978
2979    /// Sets the value of [service_connection_map][crate::model::CreateServiceConnectionMapRequest::service_connection_map].
2980    pub fn set_service_connection_map<T>(mut self, v: T) -> Self
2981    where
2982        T: std::convert::Into<crate::model::ServiceConnectionMap>,
2983    {
2984        self.service_connection_map = std::option::Option::Some(v.into());
2985        self
2986    }
2987
2988    /// Sets or clears the value of [service_connection_map][crate::model::CreateServiceConnectionMapRequest::service_connection_map].
2989    pub fn set_or_clear_service_connection_map<T>(mut self, v: std::option::Option<T>) -> Self
2990    where
2991        T: std::convert::Into<crate::model::ServiceConnectionMap>,
2992    {
2993        self.service_connection_map = v.map(|x| x.into());
2994        self
2995    }
2996
2997    /// Sets the value of [request_id][crate::model::CreateServiceConnectionMapRequest::request_id].
2998    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2999        self.request_id = v.into();
3000        self
3001    }
3002}
3003
3004impl wkt::message::Message for CreateServiceConnectionMapRequest {
3005    fn typename() -> &'static str {
3006        "type.googleapis.com/google.cloud.networkconnectivity.v1.CreateServiceConnectionMapRequest"
3007    }
3008}
3009
3010#[doc(hidden)]
3011impl<'de> serde::de::Deserialize<'de> for CreateServiceConnectionMapRequest {
3012    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3013    where
3014        D: serde::Deserializer<'de>,
3015    {
3016        #[allow(non_camel_case_types)]
3017        #[doc(hidden)]
3018        #[derive(PartialEq, Eq, Hash)]
3019        enum __FieldTag {
3020            __parent,
3021            __service_connection_map_id,
3022            __service_connection_map,
3023            __request_id,
3024            Unknown(std::string::String),
3025        }
3026        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3027            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3028            where
3029                D: serde::Deserializer<'de>,
3030            {
3031                struct Visitor;
3032                impl<'de> serde::de::Visitor<'de> for Visitor {
3033                    type Value = __FieldTag;
3034                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3035                        formatter.write_str("a field name for CreateServiceConnectionMapRequest")
3036                    }
3037                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3038                    where
3039                        E: serde::de::Error,
3040                    {
3041                        use std::result::Result::Ok;
3042                        use std::string::ToString;
3043                        match value {
3044                            "parent" => Ok(__FieldTag::__parent),
3045                            "serviceConnectionMapId" => Ok(__FieldTag::__service_connection_map_id),
3046                            "service_connection_map_id" => {
3047                                Ok(__FieldTag::__service_connection_map_id)
3048                            }
3049                            "serviceConnectionMap" => Ok(__FieldTag::__service_connection_map),
3050                            "service_connection_map" => Ok(__FieldTag::__service_connection_map),
3051                            "requestId" => Ok(__FieldTag::__request_id),
3052                            "request_id" => Ok(__FieldTag::__request_id),
3053                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3054                        }
3055                    }
3056                }
3057                deserializer.deserialize_identifier(Visitor)
3058            }
3059        }
3060        struct Visitor;
3061        impl<'de> serde::de::Visitor<'de> for Visitor {
3062            type Value = CreateServiceConnectionMapRequest;
3063            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3064                formatter.write_str("struct CreateServiceConnectionMapRequest")
3065            }
3066            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3067            where
3068                A: serde::de::MapAccess<'de>,
3069            {
3070                #[allow(unused_imports)]
3071                use serde::de::Error;
3072                use std::option::Option::Some;
3073                let mut fields = std::collections::HashSet::new();
3074                let mut result = Self::Value::new();
3075                while let Some(tag) = map.next_key::<__FieldTag>()? {
3076                    #[allow(clippy::match_single_binding)]
3077                    match tag {
3078                        __FieldTag::__parent => {
3079                            if !fields.insert(__FieldTag::__parent) {
3080                                return std::result::Result::Err(A::Error::duplicate_field(
3081                                    "multiple values for parent",
3082                                ));
3083                            }
3084                            result.parent = map
3085                                .next_value::<std::option::Option<std::string::String>>()?
3086                                .unwrap_or_default();
3087                        }
3088                        __FieldTag::__service_connection_map_id => {
3089                            if !fields.insert(__FieldTag::__service_connection_map_id) {
3090                                return std::result::Result::Err(A::Error::duplicate_field(
3091                                    "multiple values for service_connection_map_id",
3092                                ));
3093                            }
3094                            result.service_connection_map_id = map
3095                                .next_value::<std::option::Option<std::string::String>>()?
3096                                .unwrap_or_default();
3097                        }
3098                        __FieldTag::__service_connection_map => {
3099                            if !fields.insert(__FieldTag::__service_connection_map) {
3100                                return std::result::Result::Err(A::Error::duplicate_field(
3101                                    "multiple values for service_connection_map",
3102                                ));
3103                            }
3104                            result.service_connection_map = map.next_value::<std::option::Option<crate::model::ServiceConnectionMap>>()?
3105                                ;
3106                        }
3107                        __FieldTag::__request_id => {
3108                            if !fields.insert(__FieldTag::__request_id) {
3109                                return std::result::Result::Err(A::Error::duplicate_field(
3110                                    "multiple values for request_id",
3111                                ));
3112                            }
3113                            result.request_id = map
3114                                .next_value::<std::option::Option<std::string::String>>()?
3115                                .unwrap_or_default();
3116                        }
3117                        __FieldTag::Unknown(key) => {
3118                            let value = map.next_value::<serde_json::Value>()?;
3119                            result._unknown_fields.insert(key, value);
3120                        }
3121                    }
3122                }
3123                std::result::Result::Ok(result)
3124            }
3125        }
3126        deserializer.deserialize_any(Visitor)
3127    }
3128}
3129
3130#[doc(hidden)]
3131impl serde::ser::Serialize for CreateServiceConnectionMapRequest {
3132    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3133    where
3134        S: serde::ser::Serializer,
3135    {
3136        use serde::ser::SerializeMap;
3137        #[allow(unused_imports)]
3138        use std::option::Option::Some;
3139        let mut state = serializer.serialize_map(std::option::Option::None)?;
3140        if !self.parent.is_empty() {
3141            state.serialize_entry("parent", &self.parent)?;
3142        }
3143        if !self.service_connection_map_id.is_empty() {
3144            state.serialize_entry("serviceConnectionMapId", &self.service_connection_map_id)?;
3145        }
3146        if self.service_connection_map.is_some() {
3147            state.serialize_entry("serviceConnectionMap", &self.service_connection_map)?;
3148        }
3149        if !self.request_id.is_empty() {
3150            state.serialize_entry("requestId", &self.request_id)?;
3151        }
3152        if !self._unknown_fields.is_empty() {
3153            for (key, value) in self._unknown_fields.iter() {
3154                state.serialize_entry(key, &value)?;
3155            }
3156        }
3157        state.end()
3158    }
3159}
3160
3161/// Request for UpdateServiceConnectionMap.
3162#[derive(Clone, Debug, Default, PartialEq)]
3163#[non_exhaustive]
3164pub struct UpdateServiceConnectionMapRequest {
3165    /// Optional. Field mask is used to specify the fields to be overwritten in the
3166    /// ServiceConnectionMap resource by the update.
3167    /// The fields specified in the update_mask are relative to the resource, not
3168    /// the full request. A field will be overwritten if it is in the mask. If the
3169    /// user does not provide a mask then all fields will be overwritten.
3170    pub update_mask: std::option::Option<wkt::FieldMask>,
3171
3172    /// Required. New values to be patched into the resource.
3173    pub service_connection_map: std::option::Option<crate::model::ServiceConnectionMap>,
3174
3175    /// Optional. An optional request ID to identify requests. Specify a unique
3176    /// request ID so that if you must retry your request, the server will know to
3177    /// ignore the request if it has already been completed. The server will
3178    /// guarantee that for at least 60 minutes since the first request.
3179    ///
3180    /// For example, consider a situation where you make an initial request and
3181    /// the request times out. If you make the request again with the same request
3182    /// ID, the server can check if original operation with the same request ID
3183    /// was received, and if so, will ignore the second request. This prevents
3184    /// clients from accidentally creating duplicate commitments.
3185    ///
3186    /// The request ID must be a valid UUID with the exception that zero UUID is
3187    /// not supported (00000000-0000-0000-0000-000000000000).
3188    pub request_id: std::string::String,
3189
3190    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3191}
3192
3193impl UpdateServiceConnectionMapRequest {
3194    pub fn new() -> Self {
3195        std::default::Default::default()
3196    }
3197
3198    /// Sets the value of [update_mask][crate::model::UpdateServiceConnectionMapRequest::update_mask].
3199    pub fn set_update_mask<T>(mut self, v: T) -> Self
3200    where
3201        T: std::convert::Into<wkt::FieldMask>,
3202    {
3203        self.update_mask = std::option::Option::Some(v.into());
3204        self
3205    }
3206
3207    /// Sets or clears the value of [update_mask][crate::model::UpdateServiceConnectionMapRequest::update_mask].
3208    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3209    where
3210        T: std::convert::Into<wkt::FieldMask>,
3211    {
3212        self.update_mask = v.map(|x| x.into());
3213        self
3214    }
3215
3216    /// Sets the value of [service_connection_map][crate::model::UpdateServiceConnectionMapRequest::service_connection_map].
3217    pub fn set_service_connection_map<T>(mut self, v: T) -> Self
3218    where
3219        T: std::convert::Into<crate::model::ServiceConnectionMap>,
3220    {
3221        self.service_connection_map = std::option::Option::Some(v.into());
3222        self
3223    }
3224
3225    /// Sets or clears the value of [service_connection_map][crate::model::UpdateServiceConnectionMapRequest::service_connection_map].
3226    pub fn set_or_clear_service_connection_map<T>(mut self, v: std::option::Option<T>) -> Self
3227    where
3228        T: std::convert::Into<crate::model::ServiceConnectionMap>,
3229    {
3230        self.service_connection_map = v.map(|x| x.into());
3231        self
3232    }
3233
3234    /// Sets the value of [request_id][crate::model::UpdateServiceConnectionMapRequest::request_id].
3235    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3236        self.request_id = v.into();
3237        self
3238    }
3239}
3240
3241impl wkt::message::Message for UpdateServiceConnectionMapRequest {
3242    fn typename() -> &'static str {
3243        "type.googleapis.com/google.cloud.networkconnectivity.v1.UpdateServiceConnectionMapRequest"
3244    }
3245}
3246
3247#[doc(hidden)]
3248impl<'de> serde::de::Deserialize<'de> for UpdateServiceConnectionMapRequest {
3249    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3250    where
3251        D: serde::Deserializer<'de>,
3252    {
3253        #[allow(non_camel_case_types)]
3254        #[doc(hidden)]
3255        #[derive(PartialEq, Eq, Hash)]
3256        enum __FieldTag {
3257            __update_mask,
3258            __service_connection_map,
3259            __request_id,
3260            Unknown(std::string::String),
3261        }
3262        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3263            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3264            where
3265                D: serde::Deserializer<'de>,
3266            {
3267                struct Visitor;
3268                impl<'de> serde::de::Visitor<'de> for Visitor {
3269                    type Value = __FieldTag;
3270                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3271                        formatter.write_str("a field name for UpdateServiceConnectionMapRequest")
3272                    }
3273                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3274                    where
3275                        E: serde::de::Error,
3276                    {
3277                        use std::result::Result::Ok;
3278                        use std::string::ToString;
3279                        match value {
3280                            "updateMask" => Ok(__FieldTag::__update_mask),
3281                            "update_mask" => Ok(__FieldTag::__update_mask),
3282                            "serviceConnectionMap" => Ok(__FieldTag::__service_connection_map),
3283                            "service_connection_map" => Ok(__FieldTag::__service_connection_map),
3284                            "requestId" => Ok(__FieldTag::__request_id),
3285                            "request_id" => Ok(__FieldTag::__request_id),
3286                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3287                        }
3288                    }
3289                }
3290                deserializer.deserialize_identifier(Visitor)
3291            }
3292        }
3293        struct Visitor;
3294        impl<'de> serde::de::Visitor<'de> for Visitor {
3295            type Value = UpdateServiceConnectionMapRequest;
3296            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3297                formatter.write_str("struct UpdateServiceConnectionMapRequest")
3298            }
3299            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3300            where
3301                A: serde::de::MapAccess<'de>,
3302            {
3303                #[allow(unused_imports)]
3304                use serde::de::Error;
3305                use std::option::Option::Some;
3306                let mut fields = std::collections::HashSet::new();
3307                let mut result = Self::Value::new();
3308                while let Some(tag) = map.next_key::<__FieldTag>()? {
3309                    #[allow(clippy::match_single_binding)]
3310                    match tag {
3311                        __FieldTag::__update_mask => {
3312                            if !fields.insert(__FieldTag::__update_mask) {
3313                                return std::result::Result::Err(A::Error::duplicate_field(
3314                                    "multiple values for update_mask",
3315                                ));
3316                            }
3317                            result.update_mask =
3318                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
3319                        }
3320                        __FieldTag::__service_connection_map => {
3321                            if !fields.insert(__FieldTag::__service_connection_map) {
3322                                return std::result::Result::Err(A::Error::duplicate_field(
3323                                    "multiple values for service_connection_map",
3324                                ));
3325                            }
3326                            result.service_connection_map = map.next_value::<std::option::Option<crate::model::ServiceConnectionMap>>()?
3327                                ;
3328                        }
3329                        __FieldTag::__request_id => {
3330                            if !fields.insert(__FieldTag::__request_id) {
3331                                return std::result::Result::Err(A::Error::duplicate_field(
3332                                    "multiple values for request_id",
3333                                ));
3334                            }
3335                            result.request_id = map
3336                                .next_value::<std::option::Option<std::string::String>>()?
3337                                .unwrap_or_default();
3338                        }
3339                        __FieldTag::Unknown(key) => {
3340                            let value = map.next_value::<serde_json::Value>()?;
3341                            result._unknown_fields.insert(key, value);
3342                        }
3343                    }
3344                }
3345                std::result::Result::Ok(result)
3346            }
3347        }
3348        deserializer.deserialize_any(Visitor)
3349    }
3350}
3351
3352#[doc(hidden)]
3353impl serde::ser::Serialize for UpdateServiceConnectionMapRequest {
3354    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3355    where
3356        S: serde::ser::Serializer,
3357    {
3358        use serde::ser::SerializeMap;
3359        #[allow(unused_imports)]
3360        use std::option::Option::Some;
3361        let mut state = serializer.serialize_map(std::option::Option::None)?;
3362        if self.update_mask.is_some() {
3363            state.serialize_entry("updateMask", &self.update_mask)?;
3364        }
3365        if self.service_connection_map.is_some() {
3366            state.serialize_entry("serviceConnectionMap", &self.service_connection_map)?;
3367        }
3368        if !self.request_id.is_empty() {
3369            state.serialize_entry("requestId", &self.request_id)?;
3370        }
3371        if !self._unknown_fields.is_empty() {
3372            for (key, value) in self._unknown_fields.iter() {
3373                state.serialize_entry(key, &value)?;
3374            }
3375        }
3376        state.end()
3377    }
3378}
3379
3380/// Request for DeleteServiceConnectionMap.
3381#[derive(Clone, Debug, Default, PartialEq)]
3382#[non_exhaustive]
3383pub struct DeleteServiceConnectionMapRequest {
3384    /// Required. The name of the ServiceConnectionMap to delete.
3385    pub name: std::string::String,
3386
3387    /// Optional. An optional request ID to identify requests. Specify a unique
3388    /// request ID so that if you must retry your request, the server will know to
3389    /// ignore the request if it has already been completed. The server will
3390    /// guarantee that for at least 60 minutes after the first request.
3391    ///
3392    /// For example, consider a situation where you make an initial request and
3393    /// the request times out. If you make the request again with the same request
3394    /// ID, the server can check if original operation with the same request ID
3395    /// was received, and if so, will ignore the second request. This prevents
3396    /// clients from accidentally creating duplicate commitments.
3397    ///
3398    /// The request ID must be a valid UUID with the exception that zero UUID is
3399    /// not supported (00000000-0000-0000-0000-000000000000).
3400    pub request_id: std::string::String,
3401
3402    /// Optional. The etag is computed by the server, and may be sent on update and
3403    /// delete requests to ensure the client has an up-to-date value before
3404    /// proceeding.
3405    pub etag: std::option::Option<std::string::String>,
3406
3407    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3408}
3409
3410impl DeleteServiceConnectionMapRequest {
3411    pub fn new() -> Self {
3412        std::default::Default::default()
3413    }
3414
3415    /// Sets the value of [name][crate::model::DeleteServiceConnectionMapRequest::name].
3416    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3417        self.name = v.into();
3418        self
3419    }
3420
3421    /// Sets the value of [request_id][crate::model::DeleteServiceConnectionMapRequest::request_id].
3422    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3423        self.request_id = v.into();
3424        self
3425    }
3426
3427    /// Sets the value of [etag][crate::model::DeleteServiceConnectionMapRequest::etag].
3428    pub fn set_etag<T>(mut self, v: T) -> Self
3429    where
3430        T: std::convert::Into<std::string::String>,
3431    {
3432        self.etag = std::option::Option::Some(v.into());
3433        self
3434    }
3435
3436    /// Sets or clears the value of [etag][crate::model::DeleteServiceConnectionMapRequest::etag].
3437    pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
3438    where
3439        T: std::convert::Into<std::string::String>,
3440    {
3441        self.etag = v.map(|x| x.into());
3442        self
3443    }
3444}
3445
3446impl wkt::message::Message for DeleteServiceConnectionMapRequest {
3447    fn typename() -> &'static str {
3448        "type.googleapis.com/google.cloud.networkconnectivity.v1.DeleteServiceConnectionMapRequest"
3449    }
3450}
3451
3452#[doc(hidden)]
3453impl<'de> serde::de::Deserialize<'de> for DeleteServiceConnectionMapRequest {
3454    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3455    where
3456        D: serde::Deserializer<'de>,
3457    {
3458        #[allow(non_camel_case_types)]
3459        #[doc(hidden)]
3460        #[derive(PartialEq, Eq, Hash)]
3461        enum __FieldTag {
3462            __name,
3463            __request_id,
3464            __etag,
3465            Unknown(std::string::String),
3466        }
3467        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3468            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3469            where
3470                D: serde::Deserializer<'de>,
3471            {
3472                struct Visitor;
3473                impl<'de> serde::de::Visitor<'de> for Visitor {
3474                    type Value = __FieldTag;
3475                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3476                        formatter.write_str("a field name for DeleteServiceConnectionMapRequest")
3477                    }
3478                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3479                    where
3480                        E: serde::de::Error,
3481                    {
3482                        use std::result::Result::Ok;
3483                        use std::string::ToString;
3484                        match value {
3485                            "name" => Ok(__FieldTag::__name),
3486                            "requestId" => Ok(__FieldTag::__request_id),
3487                            "request_id" => Ok(__FieldTag::__request_id),
3488                            "etag" => Ok(__FieldTag::__etag),
3489                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3490                        }
3491                    }
3492                }
3493                deserializer.deserialize_identifier(Visitor)
3494            }
3495        }
3496        struct Visitor;
3497        impl<'de> serde::de::Visitor<'de> for Visitor {
3498            type Value = DeleteServiceConnectionMapRequest;
3499            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3500                formatter.write_str("struct DeleteServiceConnectionMapRequest")
3501            }
3502            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3503            where
3504                A: serde::de::MapAccess<'de>,
3505            {
3506                #[allow(unused_imports)]
3507                use serde::de::Error;
3508                use std::option::Option::Some;
3509                let mut fields = std::collections::HashSet::new();
3510                let mut result = Self::Value::new();
3511                while let Some(tag) = map.next_key::<__FieldTag>()? {
3512                    #[allow(clippy::match_single_binding)]
3513                    match tag {
3514                        __FieldTag::__name => {
3515                            if !fields.insert(__FieldTag::__name) {
3516                                return std::result::Result::Err(A::Error::duplicate_field(
3517                                    "multiple values for name",
3518                                ));
3519                            }
3520                            result.name = map
3521                                .next_value::<std::option::Option<std::string::String>>()?
3522                                .unwrap_or_default();
3523                        }
3524                        __FieldTag::__request_id => {
3525                            if !fields.insert(__FieldTag::__request_id) {
3526                                return std::result::Result::Err(A::Error::duplicate_field(
3527                                    "multiple values for request_id",
3528                                ));
3529                            }
3530                            result.request_id = map
3531                                .next_value::<std::option::Option<std::string::String>>()?
3532                                .unwrap_or_default();
3533                        }
3534                        __FieldTag::__etag => {
3535                            if !fields.insert(__FieldTag::__etag) {
3536                                return std::result::Result::Err(A::Error::duplicate_field(
3537                                    "multiple values for etag",
3538                                ));
3539                            }
3540                            result.etag =
3541                                map.next_value::<std::option::Option<std::string::String>>()?;
3542                        }
3543                        __FieldTag::Unknown(key) => {
3544                            let value = map.next_value::<serde_json::Value>()?;
3545                            result._unknown_fields.insert(key, value);
3546                        }
3547                    }
3548                }
3549                std::result::Result::Ok(result)
3550            }
3551        }
3552        deserializer.deserialize_any(Visitor)
3553    }
3554}
3555
3556#[doc(hidden)]
3557impl serde::ser::Serialize for DeleteServiceConnectionMapRequest {
3558    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3559    where
3560        S: serde::ser::Serializer,
3561    {
3562        use serde::ser::SerializeMap;
3563        #[allow(unused_imports)]
3564        use std::option::Option::Some;
3565        let mut state = serializer.serialize_map(std::option::Option::None)?;
3566        if !self.name.is_empty() {
3567            state.serialize_entry("name", &self.name)?;
3568        }
3569        if !self.request_id.is_empty() {
3570            state.serialize_entry("requestId", &self.request_id)?;
3571        }
3572        if self.etag.is_some() {
3573            state.serialize_entry("etag", &self.etag)?;
3574        }
3575        if !self._unknown_fields.is_empty() {
3576            for (key, value) in self._unknown_fields.iter() {
3577                state.serialize_entry(key, &value)?;
3578            }
3579        }
3580        state.end()
3581    }
3582}
3583
3584/// The ServiceConnectionPolicy resource.
3585#[derive(Clone, Debug, Default, PartialEq)]
3586#[non_exhaustive]
3587pub struct ServiceConnectionPolicy {
3588    /// Immutable. The name of a ServiceConnectionPolicy.
3589    /// Format:
3590    /// projects/{project}/locations/{location}/serviceConnectionPolicies/{service_connection_policy}
3591    /// See: <https://google.aip.dev/122#fields-representing-resource-names>
3592    pub name: std::string::String,
3593
3594    /// Output only. Time when the ServiceConnectionPolicy was created.
3595    pub create_time: std::option::Option<wkt::Timestamp>,
3596
3597    /// Output only. Time when the ServiceConnectionPolicy was updated.
3598    pub update_time: std::option::Option<wkt::Timestamp>,
3599
3600    /// User-defined labels.
3601    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3602
3603    /// A description of this resource.
3604    pub description: std::string::String,
3605
3606    /// The resource path of the consumer network.
3607    /// Example:
3608    ///
3609    /// - projects/{projectNumOrId}/global/networks/{resourceId}.
3610    pub network: std::string::String,
3611
3612    /// The service class identifier for which this ServiceConnectionPolicy is for.
3613    /// The service class identifier is a unique, symbolic representation of a
3614    /// ServiceClass. It is provided by the Service Producer. Google services have
3615    /// a prefix of gcp or google-cloud. For example, gcp-memorystore-redis or
3616    /// google-cloud-sql. 3rd party services do not. For example,
3617    /// test-service-a3dfcx.
3618    pub service_class: std::string::String,
3619
3620    /// Output only. The type of underlying resources used to create the
3621    /// connection.
3622    pub infrastructure: crate::model::Infrastructure,
3623
3624    /// Configuration used for Private Service Connect connections. Used when
3625    /// Infrastructure is PSC.
3626    pub psc_config: std::option::Option<crate::model::service_connection_policy::PscConfig>,
3627
3628    /// Output only. [Output only] Information about each Private Service Connect
3629    /// connection.
3630    pub psc_connections: std::vec::Vec<crate::model::service_connection_policy::PscConnection>,
3631
3632    /// Optional. The etag is computed by the server, and may be sent on update and
3633    /// delete requests to ensure the client has an up-to-date value before
3634    /// proceeding.
3635    pub etag: std::option::Option<std::string::String>,
3636
3637    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3638}
3639
3640impl ServiceConnectionPolicy {
3641    pub fn new() -> Self {
3642        std::default::Default::default()
3643    }
3644
3645    /// Sets the value of [name][crate::model::ServiceConnectionPolicy::name].
3646    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3647        self.name = v.into();
3648        self
3649    }
3650
3651    /// Sets the value of [create_time][crate::model::ServiceConnectionPolicy::create_time].
3652    pub fn set_create_time<T>(mut self, v: T) -> Self
3653    where
3654        T: std::convert::Into<wkt::Timestamp>,
3655    {
3656        self.create_time = std::option::Option::Some(v.into());
3657        self
3658    }
3659
3660    /// Sets or clears the value of [create_time][crate::model::ServiceConnectionPolicy::create_time].
3661    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3662    where
3663        T: std::convert::Into<wkt::Timestamp>,
3664    {
3665        self.create_time = v.map(|x| x.into());
3666        self
3667    }
3668
3669    /// Sets the value of [update_time][crate::model::ServiceConnectionPolicy::update_time].
3670    pub fn set_update_time<T>(mut self, v: T) -> Self
3671    where
3672        T: std::convert::Into<wkt::Timestamp>,
3673    {
3674        self.update_time = std::option::Option::Some(v.into());
3675        self
3676    }
3677
3678    /// Sets or clears the value of [update_time][crate::model::ServiceConnectionPolicy::update_time].
3679    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3680    where
3681        T: std::convert::Into<wkt::Timestamp>,
3682    {
3683        self.update_time = v.map(|x| x.into());
3684        self
3685    }
3686
3687    /// Sets the value of [labels][crate::model::ServiceConnectionPolicy::labels].
3688    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3689    where
3690        T: std::iter::IntoIterator<Item = (K, V)>,
3691        K: std::convert::Into<std::string::String>,
3692        V: std::convert::Into<std::string::String>,
3693    {
3694        use std::iter::Iterator;
3695        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3696        self
3697    }
3698
3699    /// Sets the value of [description][crate::model::ServiceConnectionPolicy::description].
3700    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3701        self.description = v.into();
3702        self
3703    }
3704
3705    /// Sets the value of [network][crate::model::ServiceConnectionPolicy::network].
3706    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3707        self.network = v.into();
3708        self
3709    }
3710
3711    /// Sets the value of [service_class][crate::model::ServiceConnectionPolicy::service_class].
3712    pub fn set_service_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3713        self.service_class = v.into();
3714        self
3715    }
3716
3717    /// Sets the value of [infrastructure][crate::model::ServiceConnectionPolicy::infrastructure].
3718    pub fn set_infrastructure<T: std::convert::Into<crate::model::Infrastructure>>(
3719        mut self,
3720        v: T,
3721    ) -> Self {
3722        self.infrastructure = v.into();
3723        self
3724    }
3725
3726    /// Sets the value of [psc_config][crate::model::ServiceConnectionPolicy::psc_config].
3727    pub fn set_psc_config<T>(mut self, v: T) -> Self
3728    where
3729        T: std::convert::Into<crate::model::service_connection_policy::PscConfig>,
3730    {
3731        self.psc_config = std::option::Option::Some(v.into());
3732        self
3733    }
3734
3735    /// Sets or clears the value of [psc_config][crate::model::ServiceConnectionPolicy::psc_config].
3736    pub fn set_or_clear_psc_config<T>(mut self, v: std::option::Option<T>) -> Self
3737    where
3738        T: std::convert::Into<crate::model::service_connection_policy::PscConfig>,
3739    {
3740        self.psc_config = v.map(|x| x.into());
3741        self
3742    }
3743
3744    /// Sets the value of [psc_connections][crate::model::ServiceConnectionPolicy::psc_connections].
3745    pub fn set_psc_connections<T, V>(mut self, v: T) -> Self
3746    where
3747        T: std::iter::IntoIterator<Item = V>,
3748        V: std::convert::Into<crate::model::service_connection_policy::PscConnection>,
3749    {
3750        use std::iter::Iterator;
3751        self.psc_connections = v.into_iter().map(|i| i.into()).collect();
3752        self
3753    }
3754
3755    /// Sets the value of [etag][crate::model::ServiceConnectionPolicy::etag].
3756    pub fn set_etag<T>(mut self, v: T) -> Self
3757    where
3758        T: std::convert::Into<std::string::String>,
3759    {
3760        self.etag = std::option::Option::Some(v.into());
3761        self
3762    }
3763
3764    /// Sets or clears the value of [etag][crate::model::ServiceConnectionPolicy::etag].
3765    pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
3766    where
3767        T: std::convert::Into<std::string::String>,
3768    {
3769        self.etag = v.map(|x| x.into());
3770        self
3771    }
3772}
3773
3774impl wkt::message::Message for ServiceConnectionPolicy {
3775    fn typename() -> &'static str {
3776        "type.googleapis.com/google.cloud.networkconnectivity.v1.ServiceConnectionPolicy"
3777    }
3778}
3779
3780#[doc(hidden)]
3781impl<'de> serde::de::Deserialize<'de> for ServiceConnectionPolicy {
3782    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3783    where
3784        D: serde::Deserializer<'de>,
3785    {
3786        #[allow(non_camel_case_types)]
3787        #[doc(hidden)]
3788        #[derive(PartialEq, Eq, Hash)]
3789        enum __FieldTag {
3790            __name,
3791            __create_time,
3792            __update_time,
3793            __labels,
3794            __description,
3795            __network,
3796            __service_class,
3797            __infrastructure,
3798            __psc_config,
3799            __psc_connections,
3800            __etag,
3801            Unknown(std::string::String),
3802        }
3803        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3804            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3805            where
3806                D: serde::Deserializer<'de>,
3807            {
3808                struct Visitor;
3809                impl<'de> serde::de::Visitor<'de> for Visitor {
3810                    type Value = __FieldTag;
3811                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3812                        formatter.write_str("a field name for ServiceConnectionPolicy")
3813                    }
3814                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3815                    where
3816                        E: serde::de::Error,
3817                    {
3818                        use std::result::Result::Ok;
3819                        use std::string::ToString;
3820                        match value {
3821                            "name" => Ok(__FieldTag::__name),
3822                            "createTime" => Ok(__FieldTag::__create_time),
3823                            "create_time" => Ok(__FieldTag::__create_time),
3824                            "updateTime" => Ok(__FieldTag::__update_time),
3825                            "update_time" => Ok(__FieldTag::__update_time),
3826                            "labels" => Ok(__FieldTag::__labels),
3827                            "description" => Ok(__FieldTag::__description),
3828                            "network" => Ok(__FieldTag::__network),
3829                            "serviceClass" => Ok(__FieldTag::__service_class),
3830                            "service_class" => Ok(__FieldTag::__service_class),
3831                            "infrastructure" => Ok(__FieldTag::__infrastructure),
3832                            "pscConfig" => Ok(__FieldTag::__psc_config),
3833                            "psc_config" => Ok(__FieldTag::__psc_config),
3834                            "pscConnections" => Ok(__FieldTag::__psc_connections),
3835                            "psc_connections" => Ok(__FieldTag::__psc_connections),
3836                            "etag" => Ok(__FieldTag::__etag),
3837                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3838                        }
3839                    }
3840                }
3841                deserializer.deserialize_identifier(Visitor)
3842            }
3843        }
3844        struct Visitor;
3845        impl<'de> serde::de::Visitor<'de> for Visitor {
3846            type Value = ServiceConnectionPolicy;
3847            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3848                formatter.write_str("struct ServiceConnectionPolicy")
3849            }
3850            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3851            where
3852                A: serde::de::MapAccess<'de>,
3853            {
3854                #[allow(unused_imports)]
3855                use serde::de::Error;
3856                use std::option::Option::Some;
3857                let mut fields = std::collections::HashSet::new();
3858                let mut result = Self::Value::new();
3859                while let Some(tag) = map.next_key::<__FieldTag>()? {
3860                    #[allow(clippy::match_single_binding)]
3861                    match tag {
3862                        __FieldTag::__name => {
3863                            if !fields.insert(__FieldTag::__name) {
3864                                return std::result::Result::Err(A::Error::duplicate_field(
3865                                    "multiple values for name",
3866                                ));
3867                            }
3868                            result.name = map
3869                                .next_value::<std::option::Option<std::string::String>>()?
3870                                .unwrap_or_default();
3871                        }
3872                        __FieldTag::__create_time => {
3873                            if !fields.insert(__FieldTag::__create_time) {
3874                                return std::result::Result::Err(A::Error::duplicate_field(
3875                                    "multiple values for create_time",
3876                                ));
3877                            }
3878                            result.create_time =
3879                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
3880                        }
3881                        __FieldTag::__update_time => {
3882                            if !fields.insert(__FieldTag::__update_time) {
3883                                return std::result::Result::Err(A::Error::duplicate_field(
3884                                    "multiple values for update_time",
3885                                ));
3886                            }
3887                            result.update_time =
3888                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
3889                        }
3890                        __FieldTag::__labels => {
3891                            if !fields.insert(__FieldTag::__labels) {
3892                                return std::result::Result::Err(A::Error::duplicate_field(
3893                                    "multiple values for labels",
3894                                ));
3895                            }
3896                            result.labels = map
3897                                .next_value::<std::option::Option<
3898                                    std::collections::HashMap<
3899                                        std::string::String,
3900                                        std::string::String,
3901                                    >,
3902                                >>()?
3903                                .unwrap_or_default();
3904                        }
3905                        __FieldTag::__description => {
3906                            if !fields.insert(__FieldTag::__description) {
3907                                return std::result::Result::Err(A::Error::duplicate_field(
3908                                    "multiple values for description",
3909                                ));
3910                            }
3911                            result.description = map
3912                                .next_value::<std::option::Option<std::string::String>>()?
3913                                .unwrap_or_default();
3914                        }
3915                        __FieldTag::__network => {
3916                            if !fields.insert(__FieldTag::__network) {
3917                                return std::result::Result::Err(A::Error::duplicate_field(
3918                                    "multiple values for network",
3919                                ));
3920                            }
3921                            result.network = map
3922                                .next_value::<std::option::Option<std::string::String>>()?
3923                                .unwrap_or_default();
3924                        }
3925                        __FieldTag::__service_class => {
3926                            if !fields.insert(__FieldTag::__service_class) {
3927                                return std::result::Result::Err(A::Error::duplicate_field(
3928                                    "multiple values for service_class",
3929                                ));
3930                            }
3931                            result.service_class = map
3932                                .next_value::<std::option::Option<std::string::String>>()?
3933                                .unwrap_or_default();
3934                        }
3935                        __FieldTag::__infrastructure => {
3936                            if !fields.insert(__FieldTag::__infrastructure) {
3937                                return std::result::Result::Err(A::Error::duplicate_field(
3938                                    "multiple values for infrastructure",
3939                                ));
3940                            }
3941                            result.infrastructure = map
3942                                .next_value::<std::option::Option<crate::model::Infrastructure>>()?
3943                                .unwrap_or_default();
3944                        }
3945                        __FieldTag::__psc_config => {
3946                            if !fields.insert(__FieldTag::__psc_config) {
3947                                return std::result::Result::Err(A::Error::duplicate_field(
3948                                    "multiple values for psc_config",
3949                                ));
3950                            }
3951                            result.psc_config = map.next_value::<std::option::Option<
3952                                crate::model::service_connection_policy::PscConfig,
3953                            >>()?;
3954                        }
3955                        __FieldTag::__psc_connections => {
3956                            if !fields.insert(__FieldTag::__psc_connections) {
3957                                return std::result::Result::Err(A::Error::duplicate_field(
3958                                    "multiple values for psc_connections",
3959                                ));
3960                            }
3961                            result.psc_connections = map
3962                                .next_value::<std::option::Option<
3963                                    std::vec::Vec<
3964                                        crate::model::service_connection_policy::PscConnection,
3965                                    >,
3966                                >>()?
3967                                .unwrap_or_default();
3968                        }
3969                        __FieldTag::__etag => {
3970                            if !fields.insert(__FieldTag::__etag) {
3971                                return std::result::Result::Err(A::Error::duplicate_field(
3972                                    "multiple values for etag",
3973                                ));
3974                            }
3975                            result.etag =
3976                                map.next_value::<std::option::Option<std::string::String>>()?;
3977                        }
3978                        __FieldTag::Unknown(key) => {
3979                            let value = map.next_value::<serde_json::Value>()?;
3980                            result._unknown_fields.insert(key, value);
3981                        }
3982                    }
3983                }
3984                std::result::Result::Ok(result)
3985            }
3986        }
3987        deserializer.deserialize_any(Visitor)
3988    }
3989}
3990
3991#[doc(hidden)]
3992impl serde::ser::Serialize for ServiceConnectionPolicy {
3993    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3994    where
3995        S: serde::ser::Serializer,
3996    {
3997        use serde::ser::SerializeMap;
3998        #[allow(unused_imports)]
3999        use std::option::Option::Some;
4000        let mut state = serializer.serialize_map(std::option::Option::None)?;
4001        if !self.name.is_empty() {
4002            state.serialize_entry("name", &self.name)?;
4003        }
4004        if self.create_time.is_some() {
4005            state.serialize_entry("createTime", &self.create_time)?;
4006        }
4007        if self.update_time.is_some() {
4008            state.serialize_entry("updateTime", &self.update_time)?;
4009        }
4010        if !self.labels.is_empty() {
4011            state.serialize_entry("labels", &self.labels)?;
4012        }
4013        if !self.description.is_empty() {
4014            state.serialize_entry("description", &self.description)?;
4015        }
4016        if !self.network.is_empty() {
4017            state.serialize_entry("network", &self.network)?;
4018        }
4019        if !self.service_class.is_empty() {
4020            state.serialize_entry("serviceClass", &self.service_class)?;
4021        }
4022        if !wkt::internal::is_default(&self.infrastructure) {
4023            state.serialize_entry("infrastructure", &self.infrastructure)?;
4024        }
4025        if self.psc_config.is_some() {
4026            state.serialize_entry("pscConfig", &self.psc_config)?;
4027        }
4028        if !self.psc_connections.is_empty() {
4029            state.serialize_entry("pscConnections", &self.psc_connections)?;
4030        }
4031        if self.etag.is_some() {
4032            state.serialize_entry("etag", &self.etag)?;
4033        }
4034        if !self._unknown_fields.is_empty() {
4035            for (key, value) in self._unknown_fields.iter() {
4036                state.serialize_entry(key, &value)?;
4037            }
4038        }
4039        state.end()
4040    }
4041}
4042
4043/// Defines additional types related to [ServiceConnectionPolicy].
4044pub mod service_connection_policy {
4045    #[allow(unused_imports)]
4046    use super::*;
4047
4048    /// Configuration used for Private Service Connect connections. Used when
4049    /// Infrastructure is PSC.
4050    #[derive(Clone, Debug, Default, PartialEq)]
4051    #[non_exhaustive]
4052    pub struct PscConfig {
4053        /// The resource paths of subnetworks to use for IP address management.
4054        /// Example:
4055        /// projects/{projectNumOrId}/regions/{region}/subnetworks/{resourceId}.
4056        pub subnetworks: std::vec::Vec<std::string::String>,
4057
4058        /// Optional. Max number of PSC connections for this policy.
4059        pub limit: std::option::Option<i64>,
4060
4061        /// Required. ProducerInstanceLocation is used to specify which authorization
4062        /// mechanism to use to determine which projects the Producer instance can be
4063        /// within.
4064        pub producer_instance_location:
4065            crate::model::service_connection_policy::psc_config::ProducerInstanceLocation,
4066
4067        /// Optional. List of Projects, Folders, or Organizations from where the
4068        /// Producer instance can be within. For example, a network administrator can
4069        /// provide both 'organizations/foo' and 'projects/bar' as
4070        /// allowed_google_producers_resource_hierarchy_levels. This allowlists this
4071        /// network to connect with any Producer instance within the 'foo'
4072        /// organization or the 'bar' project. By default,
4073        /// allowed_google_producers_resource_hierarchy_level is empty. The format
4074        /// for each allowed_google_producers_resource_hierarchy_level is \<resource
4075        /// type\>/\<id\> where <resource type\> is one of 'projects', 'folders', or
4076        /// 'organizations' and \<id\> is either the ID or the number of the resource
4077        /// type. Format for each allowed_google_producers_resource_hierarchy_level
4078        /// value: 'projects/<project_id_or_number>' or 'folders/<folder_id>' or
4079        /// 'organizations/<organization_id>'
4080        /// Eg. [projects/my-project-id, projects/567, folders/891,
4081        /// organizations/123]
4082        pub allowed_google_producers_resource_hierarchy_level: std::vec::Vec<std::string::String>,
4083
4084        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4085    }
4086
4087    impl PscConfig {
4088        pub fn new() -> Self {
4089            std::default::Default::default()
4090        }
4091
4092        /// Sets the value of [subnetworks][crate::model::service_connection_policy::PscConfig::subnetworks].
4093        pub fn set_subnetworks<T, V>(mut self, v: T) -> Self
4094        where
4095            T: std::iter::IntoIterator<Item = V>,
4096            V: std::convert::Into<std::string::String>,
4097        {
4098            use std::iter::Iterator;
4099            self.subnetworks = v.into_iter().map(|i| i.into()).collect();
4100            self
4101        }
4102
4103        /// Sets the value of [limit][crate::model::service_connection_policy::PscConfig::limit].
4104        pub fn set_limit<T>(mut self, v: T) -> Self
4105        where
4106            T: std::convert::Into<i64>,
4107        {
4108            self.limit = std::option::Option::Some(v.into());
4109            self
4110        }
4111
4112        /// Sets or clears the value of [limit][crate::model::service_connection_policy::PscConfig::limit].
4113        pub fn set_or_clear_limit<T>(mut self, v: std::option::Option<T>) -> Self
4114        where
4115            T: std::convert::Into<i64>,
4116        {
4117            self.limit = v.map(|x| x.into());
4118            self
4119        }
4120
4121        /// Sets the value of [producer_instance_location][crate::model::service_connection_policy::PscConfig::producer_instance_location].
4122        pub fn set_producer_instance_location<
4123            T: std::convert::Into<
4124                    crate::model::service_connection_policy::psc_config::ProducerInstanceLocation,
4125                >,
4126        >(
4127            mut self,
4128            v: T,
4129        ) -> Self {
4130            self.producer_instance_location = v.into();
4131            self
4132        }
4133
4134        /// Sets the value of [allowed_google_producers_resource_hierarchy_level][crate::model::service_connection_policy::PscConfig::allowed_google_producers_resource_hierarchy_level].
4135        pub fn set_allowed_google_producers_resource_hierarchy_level<T, V>(mut self, v: T) -> Self
4136        where
4137            T: std::iter::IntoIterator<Item = V>,
4138            V: std::convert::Into<std::string::String>,
4139        {
4140            use std::iter::Iterator;
4141            self.allowed_google_producers_resource_hierarchy_level =
4142                v.into_iter().map(|i| i.into()).collect();
4143            self
4144        }
4145    }
4146
4147    impl wkt::message::Message for PscConfig {
4148        fn typename() -> &'static str {
4149            "type.googleapis.com/google.cloud.networkconnectivity.v1.ServiceConnectionPolicy.PscConfig"
4150        }
4151    }
4152
4153    #[doc(hidden)]
4154    impl<'de> serde::de::Deserialize<'de> for PscConfig {
4155        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4156        where
4157            D: serde::Deserializer<'de>,
4158        {
4159            #[allow(non_camel_case_types)]
4160            #[doc(hidden)]
4161            #[derive(PartialEq, Eq, Hash)]
4162            enum __FieldTag {
4163                __subnetworks,
4164                __limit,
4165                __producer_instance_location,
4166                __allowed_google_producers_resource_hierarchy_level,
4167                Unknown(std::string::String),
4168            }
4169            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4170                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4171                where
4172                    D: serde::Deserializer<'de>,
4173                {
4174                    struct Visitor;
4175                    impl<'de> serde::de::Visitor<'de> for Visitor {
4176                        type Value = __FieldTag;
4177                        fn expecting(
4178                            &self,
4179                            formatter: &mut std::fmt::Formatter,
4180                        ) -> std::fmt::Result {
4181                            formatter.write_str("a field name for PscConfig")
4182                        }
4183                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4184                        where
4185                            E: serde::de::Error,
4186                        {
4187                            use std::result::Result::Ok;
4188                            use std::string::ToString;
4189                            match value {
4190                                "subnetworks" => Ok(__FieldTag::__subnetworks),
4191                                "limit" => Ok(__FieldTag::__limit),
4192                                "producerInstanceLocation" => {
4193                                    Ok(__FieldTag::__producer_instance_location)
4194                                }
4195                                "producer_instance_location" => {
4196                                    Ok(__FieldTag::__producer_instance_location)
4197                                }
4198                                "allowedGoogleProducersResourceHierarchyLevel" => Ok(
4199                                    __FieldTag::__allowed_google_producers_resource_hierarchy_level,
4200                                ),
4201                                "allowed_google_producers_resource_hierarchy_level" => Ok(
4202                                    __FieldTag::__allowed_google_producers_resource_hierarchy_level,
4203                                ),
4204                                _ => Ok(__FieldTag::Unknown(value.to_string())),
4205                            }
4206                        }
4207                    }
4208                    deserializer.deserialize_identifier(Visitor)
4209                }
4210            }
4211            struct Visitor;
4212            impl<'de> serde::de::Visitor<'de> for Visitor {
4213                type Value = PscConfig;
4214                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4215                    formatter.write_str("struct PscConfig")
4216                }
4217                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4218                where
4219                    A: serde::de::MapAccess<'de>,
4220                {
4221                    #[allow(unused_imports)]
4222                    use serde::de::Error;
4223                    use std::option::Option::Some;
4224                    let mut fields = std::collections::HashSet::new();
4225                    let mut result = Self::Value::new();
4226                    while let Some(tag) = map.next_key::<__FieldTag>()? {
4227                        #[allow(clippy::match_single_binding)]
4228                        match tag {
4229                            __FieldTag::__subnetworks => {
4230                                if !fields.insert(__FieldTag::__subnetworks) {
4231                                    return std::result::Result::Err(A::Error::duplicate_field(
4232                                        "multiple values for subnetworks",
4233                                    ));
4234                                }
4235                                result.subnetworks = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
4236                            }
4237                            __FieldTag::__limit => {
4238                                if !fields.insert(__FieldTag::__limit) {
4239                                    return std::result::Result::Err(A::Error::duplicate_field(
4240                                        "multiple values for limit",
4241                                    ));
4242                                }
4243                                struct __With(std::option::Option<i64>);
4244                                impl<'de> serde::de::Deserialize<'de> for __With {
4245                                    fn deserialize<D>(
4246                                        deserializer: D,
4247                                    ) -> std::result::Result<Self, D::Error>
4248                                    where
4249                                        D: serde::de::Deserializer<'de>,
4250                                    {
4251                                        serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4252                                    }
4253                                }
4254                                result.limit = map.next_value::<__With>()?.0;
4255                            }
4256                            __FieldTag::__producer_instance_location => {
4257                                if !fields.insert(__FieldTag::__producer_instance_location) {
4258                                    return std::result::Result::Err(A::Error::duplicate_field(
4259                                        "multiple values for producer_instance_location",
4260                                    ));
4261                                }
4262                                result.producer_instance_location = map.next_value::<std::option::Option<crate::model::service_connection_policy::psc_config::ProducerInstanceLocation>>()?.unwrap_or_default();
4263                            }
4264                            __FieldTag::__allowed_google_producers_resource_hierarchy_level => {
4265                                if !fields.insert(
4266                                    __FieldTag::__allowed_google_producers_resource_hierarchy_level,
4267                                ) {
4268                                    return std::result::Result::Err(A::Error::duplicate_field(
4269                                        "multiple values for allowed_google_producers_resource_hierarchy_level",
4270                                    ));
4271                                }
4272                                result.allowed_google_producers_resource_hierarchy_level = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
4273                            }
4274                            __FieldTag::Unknown(key) => {
4275                                let value = map.next_value::<serde_json::Value>()?;
4276                                result._unknown_fields.insert(key, value);
4277                            }
4278                        }
4279                    }
4280                    std::result::Result::Ok(result)
4281                }
4282            }
4283            deserializer.deserialize_any(Visitor)
4284        }
4285    }
4286
4287    #[doc(hidden)]
4288    impl serde::ser::Serialize for PscConfig {
4289        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4290        where
4291            S: serde::ser::Serializer,
4292        {
4293            use serde::ser::SerializeMap;
4294            #[allow(unused_imports)]
4295            use std::option::Option::Some;
4296            let mut state = serializer.serialize_map(std::option::Option::None)?;
4297            if !self.subnetworks.is_empty() {
4298                state.serialize_entry("subnetworks", &self.subnetworks)?;
4299            }
4300            if self.limit.is_some() {
4301                struct __With<'a>(&'a std::option::Option<i64>);
4302                impl<'a> serde::ser::Serialize for __With<'a> {
4303                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4304                    where
4305                        S: serde::ser::Serializer,
4306                    {
4307                        serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
4308                            self.0, serializer,
4309                        )
4310                    }
4311                }
4312                state.serialize_entry("limit", &__With(&self.limit))?;
4313            }
4314            if !wkt::internal::is_default(&self.producer_instance_location) {
4315                state.serialize_entry(
4316                    "producerInstanceLocation",
4317                    &self.producer_instance_location,
4318                )?;
4319            }
4320            if !self
4321                .allowed_google_producers_resource_hierarchy_level
4322                .is_empty()
4323            {
4324                state.serialize_entry(
4325                    "allowedGoogleProducersResourceHierarchyLevel",
4326                    &self.allowed_google_producers_resource_hierarchy_level,
4327                )?;
4328            }
4329            if !self._unknown_fields.is_empty() {
4330                for (key, value) in self._unknown_fields.iter() {
4331                    state.serialize_entry(key, &value)?;
4332                }
4333            }
4334            state.end()
4335        }
4336    }
4337
4338    /// Defines additional types related to [PscConfig].
4339    pub mod psc_config {
4340        #[allow(unused_imports)]
4341        use super::*;
4342
4343        /// ProducerInstanceLocation is used to specify which authorization mechanism
4344        /// to use to determine which projects the Producer instance can be within.
4345        ///
4346        /// # Working with unknown values
4347        ///
4348        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4349        /// additional enum variants at any time. Adding new variants is not considered
4350        /// a breaking change. Applications should write their code in anticipation of:
4351        ///
4352        /// - New values appearing in future releases of the client library, **and**
4353        /// - New values received dynamically, without application changes.
4354        ///
4355        /// Please consult the [Working with enums] section in the user guide for some
4356        /// guidelines.
4357        ///
4358        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4359        #[derive(Clone, Debug, PartialEq)]
4360        #[non_exhaustive]
4361        pub enum ProducerInstanceLocation {
4362            /// Producer instance location is not specified. When this option is
4363            /// chosen, then the PSC connections created by this
4364            /// ServiceConnectionPolicy must be within the same project as the Producer
4365            /// instance. This is the default ProducerInstanceLocation value.
4366            /// To allow for PSC connections from this network to other networks, use
4367            /// the CUSTOM_RESOURCE_HIERARCHY_LEVELS option.
4368            Unspecified,
4369            /// Producer instance must be within one of the values provided in
4370            /// allowed_google_producers_resource_hierarchy_level.
4371            CustomResourceHierarchyLevels,
4372            /// If set, the enum was initialized with an unknown value.
4373            ///
4374            /// Applications can examine the value using [ProducerInstanceLocation::value] or
4375            /// [ProducerInstanceLocation::name].
4376            UnknownValue(producer_instance_location::UnknownValue),
4377        }
4378
4379        #[doc(hidden)]
4380        pub mod producer_instance_location {
4381            #[allow(unused_imports)]
4382            use super::*;
4383            #[derive(Clone, Debug, PartialEq)]
4384            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4385        }
4386
4387        impl ProducerInstanceLocation {
4388            /// Gets the enum value.
4389            ///
4390            /// Returns `None` if the enum contains an unknown value deserialized from
4391            /// the string representation of enums.
4392            pub fn value(&self) -> std::option::Option<i32> {
4393                match self {
4394                    Self::Unspecified => std::option::Option::Some(0),
4395                    Self::CustomResourceHierarchyLevels => std::option::Option::Some(1),
4396                    Self::UnknownValue(u) => u.0.value(),
4397                }
4398            }
4399
4400            /// Gets the enum value as a string.
4401            ///
4402            /// Returns `None` if the enum contains an unknown value deserialized from
4403            /// the integer representation of enums.
4404            pub fn name(&self) -> std::option::Option<&str> {
4405                match self {
4406                    Self::Unspecified => {
4407                        std::option::Option::Some("PRODUCER_INSTANCE_LOCATION_UNSPECIFIED")
4408                    }
4409                    Self::CustomResourceHierarchyLevels => {
4410                        std::option::Option::Some("CUSTOM_RESOURCE_HIERARCHY_LEVELS")
4411                    }
4412                    Self::UnknownValue(u) => u.0.name(),
4413                }
4414            }
4415        }
4416
4417        impl std::default::Default for ProducerInstanceLocation {
4418            fn default() -> Self {
4419                use std::convert::From;
4420                Self::from(0)
4421            }
4422        }
4423
4424        impl std::fmt::Display for ProducerInstanceLocation {
4425            fn fmt(
4426                &self,
4427                f: &mut std::fmt::Formatter<'_>,
4428            ) -> std::result::Result<(), std::fmt::Error> {
4429                wkt::internal::display_enum(f, self.name(), self.value())
4430            }
4431        }
4432
4433        impl std::convert::From<i32> for ProducerInstanceLocation {
4434            fn from(value: i32) -> Self {
4435                match value {
4436                    0 => Self::Unspecified,
4437                    1 => Self::CustomResourceHierarchyLevels,
4438                    _ => Self::UnknownValue(producer_instance_location::UnknownValue(
4439                        wkt::internal::UnknownEnumValue::Integer(value),
4440                    )),
4441                }
4442            }
4443        }
4444
4445        impl std::convert::From<&str> for ProducerInstanceLocation {
4446            fn from(value: &str) -> Self {
4447                use std::string::ToString;
4448                match value {
4449                    "PRODUCER_INSTANCE_LOCATION_UNSPECIFIED" => Self::Unspecified,
4450                    "CUSTOM_RESOURCE_HIERARCHY_LEVELS" => Self::CustomResourceHierarchyLevels,
4451                    _ => Self::UnknownValue(producer_instance_location::UnknownValue(
4452                        wkt::internal::UnknownEnumValue::String(value.to_string()),
4453                    )),
4454                }
4455            }
4456        }
4457
4458        impl serde::ser::Serialize for ProducerInstanceLocation {
4459            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4460            where
4461                S: serde::Serializer,
4462            {
4463                match self {
4464                    Self::Unspecified => serializer.serialize_i32(0),
4465                    Self::CustomResourceHierarchyLevels => serializer.serialize_i32(1),
4466                    Self::UnknownValue(u) => u.0.serialize(serializer),
4467                }
4468            }
4469        }
4470
4471        impl<'de> serde::de::Deserialize<'de> for ProducerInstanceLocation {
4472            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4473            where
4474                D: serde::Deserializer<'de>,
4475            {
4476                deserializer.deserialize_any(wkt::internal::EnumVisitor::<ProducerInstanceLocation>::new(
4477                    ".google.cloud.networkconnectivity.v1.ServiceConnectionPolicy.PscConfig.ProducerInstanceLocation"))
4478            }
4479        }
4480    }
4481
4482    /// Information about a specific Private Service Connect connection.
4483    #[derive(Clone, Debug, Default, PartialEq)]
4484    #[non_exhaustive]
4485    pub struct PscConnection {
4486        /// State of the PSC Connection
4487        pub state: crate::model::service_connection_policy::State,
4488
4489        /// The resource reference of the PSC Forwarding Rule within the consumer
4490        /// VPC.
4491        pub consumer_forwarding_rule: std::string::String,
4492
4493        /// The resource reference of the consumer address.
4494        pub consumer_address: std::string::String,
4495
4496        /// The error type indicates whether the error is consumer facing, producer
4497        /// facing or system internal.
4498        #[deprecated]
4499        pub error_type: crate::model::ConnectionErrorType,
4500
4501        /// The most recent error during operating this connection.
4502        /// Deprecated, please use error_info instead.
4503        #[deprecated]
4504        pub error: std::option::Option<rpc::model::Status>,
4505
4506        /// The last Compute Engine operation to setup PSC connection.
4507        pub gce_operation: std::string::String,
4508
4509        /// The project where the PSC connection is created.
4510        pub consumer_target_project: std::string::String,
4511
4512        /// The PSC connection id of the PSC forwarding rule.
4513        pub psc_connection_id: std::string::String,
4514
4515        /// Output only. The error info for the latest error during operating this
4516        /// connection.
4517        pub error_info: std::option::Option<rpc::model::ErrorInfo>,
4518
4519        /// Output only. The URI of the subnetwork selected to allocate IP address
4520        /// for this connection.
4521        pub selected_subnetwork: std::string::String,
4522
4523        /// Immutable. Deprecated. Use producer_instance_metadata instead.
4524        /// An immutable identifier for the producer instance.
4525        #[deprecated]
4526        pub producer_instance_id: std::string::String,
4527
4528        /// Immutable. An immutable map for the producer instance metadata.
4529        pub producer_instance_metadata:
4530            std::collections::HashMap<std::string::String, std::string::String>,
4531
4532        /// Output only. [Output only] The service class associated with this PSC
4533        /// Connection. The value is derived from the SCPolicy and matches the
4534        /// service class name provided by the customer.
4535        pub service_class: std::string::String,
4536
4537        /// The requested IP version for the PSC connection.
4538        pub ip_version: std::option::Option<crate::model::IPVersion>,
4539
4540        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4541    }
4542
4543    impl PscConnection {
4544        pub fn new() -> Self {
4545            std::default::Default::default()
4546        }
4547
4548        /// Sets the value of [state][crate::model::service_connection_policy::PscConnection::state].
4549        pub fn set_state<T: std::convert::Into<crate::model::service_connection_policy::State>>(
4550            mut self,
4551            v: T,
4552        ) -> Self {
4553            self.state = v.into();
4554            self
4555        }
4556
4557        /// Sets the value of [consumer_forwarding_rule][crate::model::service_connection_policy::PscConnection::consumer_forwarding_rule].
4558        pub fn set_consumer_forwarding_rule<T: std::convert::Into<std::string::String>>(
4559            mut self,
4560            v: T,
4561        ) -> Self {
4562            self.consumer_forwarding_rule = v.into();
4563            self
4564        }
4565
4566        /// Sets the value of [consumer_address][crate::model::service_connection_policy::PscConnection::consumer_address].
4567        pub fn set_consumer_address<T: std::convert::Into<std::string::String>>(
4568            mut self,
4569            v: T,
4570        ) -> Self {
4571            self.consumer_address = v.into();
4572            self
4573        }
4574
4575        /// Sets the value of [error_type][crate::model::service_connection_policy::PscConnection::error_type].
4576        #[deprecated]
4577        pub fn set_error_type<T: std::convert::Into<crate::model::ConnectionErrorType>>(
4578            mut self,
4579            v: T,
4580        ) -> Self {
4581            self.error_type = v.into();
4582            self
4583        }
4584
4585        /// Sets the value of [error][crate::model::service_connection_policy::PscConnection::error].
4586        #[deprecated]
4587        pub fn set_error<T>(mut self, v: T) -> Self
4588        where
4589            T: std::convert::Into<rpc::model::Status>,
4590        {
4591            self.error = std::option::Option::Some(v.into());
4592            self
4593        }
4594
4595        /// Sets or clears the value of [error][crate::model::service_connection_policy::PscConnection::error].
4596        #[deprecated]
4597        pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
4598        where
4599            T: std::convert::Into<rpc::model::Status>,
4600        {
4601            self.error = v.map(|x| x.into());
4602            self
4603        }
4604
4605        /// Sets the value of [gce_operation][crate::model::service_connection_policy::PscConnection::gce_operation].
4606        pub fn set_gce_operation<T: std::convert::Into<std::string::String>>(
4607            mut self,
4608            v: T,
4609        ) -> Self {
4610            self.gce_operation = v.into();
4611            self
4612        }
4613
4614        /// Sets the value of [consumer_target_project][crate::model::service_connection_policy::PscConnection::consumer_target_project].
4615        pub fn set_consumer_target_project<T: std::convert::Into<std::string::String>>(
4616            mut self,
4617            v: T,
4618        ) -> Self {
4619            self.consumer_target_project = v.into();
4620            self
4621        }
4622
4623        /// Sets the value of [psc_connection_id][crate::model::service_connection_policy::PscConnection::psc_connection_id].
4624        pub fn set_psc_connection_id<T: std::convert::Into<std::string::String>>(
4625            mut self,
4626            v: T,
4627        ) -> Self {
4628            self.psc_connection_id = v.into();
4629            self
4630        }
4631
4632        /// Sets the value of [error_info][crate::model::service_connection_policy::PscConnection::error_info].
4633        pub fn set_error_info<T>(mut self, v: T) -> Self
4634        where
4635            T: std::convert::Into<rpc::model::ErrorInfo>,
4636        {
4637            self.error_info = std::option::Option::Some(v.into());
4638            self
4639        }
4640
4641        /// Sets or clears the value of [error_info][crate::model::service_connection_policy::PscConnection::error_info].
4642        pub fn set_or_clear_error_info<T>(mut self, v: std::option::Option<T>) -> Self
4643        where
4644            T: std::convert::Into<rpc::model::ErrorInfo>,
4645        {
4646            self.error_info = v.map(|x| x.into());
4647            self
4648        }
4649
4650        /// Sets the value of [selected_subnetwork][crate::model::service_connection_policy::PscConnection::selected_subnetwork].
4651        pub fn set_selected_subnetwork<T: std::convert::Into<std::string::String>>(
4652            mut self,
4653            v: T,
4654        ) -> Self {
4655            self.selected_subnetwork = v.into();
4656            self
4657        }
4658
4659        /// Sets the value of [producer_instance_id][crate::model::service_connection_policy::PscConnection::producer_instance_id].
4660        #[deprecated]
4661        pub fn set_producer_instance_id<T: std::convert::Into<std::string::String>>(
4662            mut self,
4663            v: T,
4664        ) -> Self {
4665            self.producer_instance_id = v.into();
4666            self
4667        }
4668
4669        /// Sets the value of [producer_instance_metadata][crate::model::service_connection_policy::PscConnection::producer_instance_metadata].
4670        pub fn set_producer_instance_metadata<T, K, V>(mut self, v: T) -> Self
4671        where
4672            T: std::iter::IntoIterator<Item = (K, V)>,
4673            K: std::convert::Into<std::string::String>,
4674            V: std::convert::Into<std::string::String>,
4675        {
4676            use std::iter::Iterator;
4677            self.producer_instance_metadata =
4678                v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4679            self
4680        }
4681
4682        /// Sets the value of [service_class][crate::model::service_connection_policy::PscConnection::service_class].
4683        pub fn set_service_class<T: std::convert::Into<std::string::String>>(
4684            mut self,
4685            v: T,
4686        ) -> Self {
4687            self.service_class = v.into();
4688            self
4689        }
4690
4691        /// Sets the value of [ip_version][crate::model::service_connection_policy::PscConnection::ip_version].
4692        pub fn set_ip_version<T>(mut self, v: T) -> Self
4693        where
4694            T: std::convert::Into<crate::model::IPVersion>,
4695        {
4696            self.ip_version = std::option::Option::Some(v.into());
4697            self
4698        }
4699
4700        /// Sets or clears the value of [ip_version][crate::model::service_connection_policy::PscConnection::ip_version].
4701        pub fn set_or_clear_ip_version<T>(mut self, v: std::option::Option<T>) -> Self
4702        where
4703            T: std::convert::Into<crate::model::IPVersion>,
4704        {
4705            self.ip_version = v.map(|x| x.into());
4706            self
4707        }
4708    }
4709
4710    impl wkt::message::Message for PscConnection {
4711        fn typename() -> &'static str {
4712            "type.googleapis.com/google.cloud.networkconnectivity.v1.ServiceConnectionPolicy.PscConnection"
4713        }
4714    }
4715
4716    #[doc(hidden)]
4717    impl<'de> serde::de::Deserialize<'de> for PscConnection {
4718        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4719        where
4720            D: serde::Deserializer<'de>,
4721        {
4722            #[allow(non_camel_case_types)]
4723            #[doc(hidden)]
4724            #[derive(PartialEq, Eq, Hash)]
4725            enum __FieldTag {
4726                __state,
4727                __consumer_forwarding_rule,
4728                __consumer_address,
4729                __error_type,
4730                __error,
4731                __gce_operation,
4732                __consumer_target_project,
4733                __psc_connection_id,
4734                __error_info,
4735                __selected_subnetwork,
4736                __producer_instance_id,
4737                __producer_instance_metadata,
4738                __service_class,
4739                __ip_version,
4740                Unknown(std::string::String),
4741            }
4742            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4743                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4744                where
4745                    D: serde::Deserializer<'de>,
4746                {
4747                    struct Visitor;
4748                    impl<'de> serde::de::Visitor<'de> for Visitor {
4749                        type Value = __FieldTag;
4750                        fn expecting(
4751                            &self,
4752                            formatter: &mut std::fmt::Formatter,
4753                        ) -> std::fmt::Result {
4754                            formatter.write_str("a field name for PscConnection")
4755                        }
4756                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4757                        where
4758                            E: serde::de::Error,
4759                        {
4760                            use std::result::Result::Ok;
4761                            use std::string::ToString;
4762                            match value {
4763                                "state" => Ok(__FieldTag::__state),
4764                                "consumerForwardingRule" => {
4765                                    Ok(__FieldTag::__consumer_forwarding_rule)
4766                                }
4767                                "consumer_forwarding_rule" => {
4768                                    Ok(__FieldTag::__consumer_forwarding_rule)
4769                                }
4770                                "consumerAddress" => Ok(__FieldTag::__consumer_address),
4771                                "consumer_address" => Ok(__FieldTag::__consumer_address),
4772                                "errorType" => Ok(__FieldTag::__error_type),
4773                                "error_type" => Ok(__FieldTag::__error_type),
4774                                "error" => Ok(__FieldTag::__error),
4775                                "gceOperation" => Ok(__FieldTag::__gce_operation),
4776                                "gce_operation" => Ok(__FieldTag::__gce_operation),
4777                                "consumerTargetProject" => {
4778                                    Ok(__FieldTag::__consumer_target_project)
4779                                }
4780                                "consumer_target_project" => {
4781                                    Ok(__FieldTag::__consumer_target_project)
4782                                }
4783                                "pscConnectionId" => Ok(__FieldTag::__psc_connection_id),
4784                                "psc_connection_id" => Ok(__FieldTag::__psc_connection_id),
4785                                "errorInfo" => Ok(__FieldTag::__error_info),
4786                                "error_info" => Ok(__FieldTag::__error_info),
4787                                "selectedSubnetwork" => Ok(__FieldTag::__selected_subnetwork),
4788                                "selected_subnetwork" => Ok(__FieldTag::__selected_subnetwork),
4789                                "producerInstanceId" => Ok(__FieldTag::__producer_instance_id),
4790                                "producer_instance_id" => Ok(__FieldTag::__producer_instance_id),
4791                                "producerInstanceMetadata" => {
4792                                    Ok(__FieldTag::__producer_instance_metadata)
4793                                }
4794                                "producer_instance_metadata" => {
4795                                    Ok(__FieldTag::__producer_instance_metadata)
4796                                }
4797                                "serviceClass" => Ok(__FieldTag::__service_class),
4798                                "service_class" => Ok(__FieldTag::__service_class),
4799                                "ipVersion" => Ok(__FieldTag::__ip_version),
4800                                "ip_version" => Ok(__FieldTag::__ip_version),
4801                                _ => Ok(__FieldTag::Unknown(value.to_string())),
4802                            }
4803                        }
4804                    }
4805                    deserializer.deserialize_identifier(Visitor)
4806                }
4807            }
4808            struct Visitor;
4809            impl<'de> serde::de::Visitor<'de> for Visitor {
4810                type Value = PscConnection;
4811                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4812                    formatter.write_str("struct PscConnection")
4813                }
4814                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4815                where
4816                    A: serde::de::MapAccess<'de>,
4817                {
4818                    #[allow(unused_imports)]
4819                    use serde::de::Error;
4820                    use std::option::Option::Some;
4821                    let mut fields = std::collections::HashSet::new();
4822                    let mut result = Self::Value::new();
4823                    while let Some(tag) = map.next_key::<__FieldTag>()? {
4824                        #[allow(clippy::match_single_binding)]
4825                        match tag {
4826                            __FieldTag::__state => {
4827                                if !fields.insert(__FieldTag::__state) {
4828                                    return std::result::Result::Err(A::Error::duplicate_field(
4829                                        "multiple values for state",
4830                                    ));
4831                                }
4832                                result.state = map
4833                                    .next_value::<std::option::Option<
4834                                        crate::model::service_connection_policy::State,
4835                                    >>()?
4836                                    .unwrap_or_default();
4837                            }
4838                            __FieldTag::__consumer_forwarding_rule => {
4839                                if !fields.insert(__FieldTag::__consumer_forwarding_rule) {
4840                                    return std::result::Result::Err(A::Error::duplicate_field(
4841                                        "multiple values for consumer_forwarding_rule",
4842                                    ));
4843                                }
4844                                result.consumer_forwarding_rule = map
4845                                    .next_value::<std::option::Option<std::string::String>>()?
4846                                    .unwrap_or_default();
4847                            }
4848                            __FieldTag::__consumer_address => {
4849                                if !fields.insert(__FieldTag::__consumer_address) {
4850                                    return std::result::Result::Err(A::Error::duplicate_field(
4851                                        "multiple values for consumer_address",
4852                                    ));
4853                                }
4854                                result.consumer_address = map
4855                                    .next_value::<std::option::Option<std::string::String>>()?
4856                                    .unwrap_or_default();
4857                            }
4858                            __FieldTag::__error_type => {
4859                                if !fields.insert(__FieldTag::__error_type) {
4860                                    return std::result::Result::Err(A::Error::duplicate_field(
4861                                        "multiple values for error_type",
4862                                    ));
4863                                }
4864                                result.error_type = map.next_value::<std::option::Option<crate::model::ConnectionErrorType>>()?.unwrap_or_default();
4865                            }
4866                            __FieldTag::__error => {
4867                                if !fields.insert(__FieldTag::__error) {
4868                                    return std::result::Result::Err(A::Error::duplicate_field(
4869                                        "multiple values for error",
4870                                    ));
4871                                }
4872                                result.error =
4873                                    map.next_value::<std::option::Option<rpc::model::Status>>()?;
4874                            }
4875                            __FieldTag::__gce_operation => {
4876                                if !fields.insert(__FieldTag::__gce_operation) {
4877                                    return std::result::Result::Err(A::Error::duplicate_field(
4878                                        "multiple values for gce_operation",
4879                                    ));
4880                                }
4881                                result.gce_operation = map
4882                                    .next_value::<std::option::Option<std::string::String>>()?
4883                                    .unwrap_or_default();
4884                            }
4885                            __FieldTag::__consumer_target_project => {
4886                                if !fields.insert(__FieldTag::__consumer_target_project) {
4887                                    return std::result::Result::Err(A::Error::duplicate_field(
4888                                        "multiple values for consumer_target_project",
4889                                    ));
4890                                }
4891                                result.consumer_target_project = map
4892                                    .next_value::<std::option::Option<std::string::String>>()?
4893                                    .unwrap_or_default();
4894                            }
4895                            __FieldTag::__psc_connection_id => {
4896                                if !fields.insert(__FieldTag::__psc_connection_id) {
4897                                    return std::result::Result::Err(A::Error::duplicate_field(
4898                                        "multiple values for psc_connection_id",
4899                                    ));
4900                                }
4901                                result.psc_connection_id = map
4902                                    .next_value::<std::option::Option<std::string::String>>()?
4903                                    .unwrap_or_default();
4904                            }
4905                            __FieldTag::__error_info => {
4906                                if !fields.insert(__FieldTag::__error_info) {
4907                                    return std::result::Result::Err(A::Error::duplicate_field(
4908                                        "multiple values for error_info",
4909                                    ));
4910                                }
4911                                result.error_info =
4912                                    map.next_value::<std::option::Option<rpc::model::ErrorInfo>>()?;
4913                            }
4914                            __FieldTag::__selected_subnetwork => {
4915                                if !fields.insert(__FieldTag::__selected_subnetwork) {
4916                                    return std::result::Result::Err(A::Error::duplicate_field(
4917                                        "multiple values for selected_subnetwork",
4918                                    ));
4919                                }
4920                                result.selected_subnetwork = map
4921                                    .next_value::<std::option::Option<std::string::String>>()?
4922                                    .unwrap_or_default();
4923                            }
4924                            __FieldTag::__producer_instance_id => {
4925                                if !fields.insert(__FieldTag::__producer_instance_id) {
4926                                    return std::result::Result::Err(A::Error::duplicate_field(
4927                                        "multiple values for producer_instance_id",
4928                                    ));
4929                                }
4930                                result.producer_instance_id = map
4931                                    .next_value::<std::option::Option<std::string::String>>()?
4932                                    .unwrap_or_default();
4933                            }
4934                            __FieldTag::__producer_instance_metadata => {
4935                                if !fields.insert(__FieldTag::__producer_instance_metadata) {
4936                                    return std::result::Result::Err(A::Error::duplicate_field(
4937                                        "multiple values for producer_instance_metadata",
4938                                    ));
4939                                }
4940                                result.producer_instance_metadata = map
4941                                    .next_value::<std::option::Option<
4942                                        std::collections::HashMap<
4943                                            std::string::String,
4944                                            std::string::String,
4945                                        >,
4946                                    >>()?
4947                                    .unwrap_or_default();
4948                            }
4949                            __FieldTag::__service_class => {
4950                                if !fields.insert(__FieldTag::__service_class) {
4951                                    return std::result::Result::Err(A::Error::duplicate_field(
4952                                        "multiple values for service_class",
4953                                    ));
4954                                }
4955                                result.service_class = map
4956                                    .next_value::<std::option::Option<std::string::String>>()?
4957                                    .unwrap_or_default();
4958                            }
4959                            __FieldTag::__ip_version => {
4960                                if !fields.insert(__FieldTag::__ip_version) {
4961                                    return std::result::Result::Err(A::Error::duplicate_field(
4962                                        "multiple values for ip_version",
4963                                    ));
4964                                }
4965                                result.ip_version = map
4966                                    .next_value::<std::option::Option<crate::model::IPVersion>>()?;
4967                            }
4968                            __FieldTag::Unknown(key) => {
4969                                let value = map.next_value::<serde_json::Value>()?;
4970                                result._unknown_fields.insert(key, value);
4971                            }
4972                        }
4973                    }
4974                    std::result::Result::Ok(result)
4975                }
4976            }
4977            deserializer.deserialize_any(Visitor)
4978        }
4979    }
4980
4981    #[doc(hidden)]
4982    impl serde::ser::Serialize for PscConnection {
4983        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4984        where
4985            S: serde::ser::Serializer,
4986        {
4987            use serde::ser::SerializeMap;
4988            #[allow(unused_imports)]
4989            use std::option::Option::Some;
4990            let mut state = serializer.serialize_map(std::option::Option::None)?;
4991            if !wkt::internal::is_default(&self.state) {
4992                state.serialize_entry("state", &self.state)?;
4993            }
4994            if !self.consumer_forwarding_rule.is_empty() {
4995                state.serialize_entry("consumerForwardingRule", &self.consumer_forwarding_rule)?;
4996            }
4997            if !self.consumer_address.is_empty() {
4998                state.serialize_entry("consumerAddress", &self.consumer_address)?;
4999            }
5000            if !wkt::internal::is_default(&self.error_type) {
5001                state.serialize_entry("errorType", &self.error_type)?;
5002            }
5003            if self.error.is_some() {
5004                state.serialize_entry("error", &self.error)?;
5005            }
5006            if !self.gce_operation.is_empty() {
5007                state.serialize_entry("gceOperation", &self.gce_operation)?;
5008            }
5009            if !self.consumer_target_project.is_empty() {
5010                state.serialize_entry("consumerTargetProject", &self.consumer_target_project)?;
5011            }
5012            if !self.psc_connection_id.is_empty() {
5013                state.serialize_entry("pscConnectionId", &self.psc_connection_id)?;
5014            }
5015            if self.error_info.is_some() {
5016                state.serialize_entry("errorInfo", &self.error_info)?;
5017            }
5018            if !self.selected_subnetwork.is_empty() {
5019                state.serialize_entry("selectedSubnetwork", &self.selected_subnetwork)?;
5020            }
5021            if !self.producer_instance_id.is_empty() {
5022                state.serialize_entry("producerInstanceId", &self.producer_instance_id)?;
5023            }
5024            if !self.producer_instance_metadata.is_empty() {
5025                state.serialize_entry(
5026                    "producerInstanceMetadata",
5027                    &self.producer_instance_metadata,
5028                )?;
5029            }
5030            if !self.service_class.is_empty() {
5031                state.serialize_entry("serviceClass", &self.service_class)?;
5032            }
5033            if self.ip_version.is_some() {
5034                state.serialize_entry("ipVersion", &self.ip_version)?;
5035            }
5036            if !self._unknown_fields.is_empty() {
5037                for (key, value) in self._unknown_fields.iter() {
5038                    state.serialize_entry(key, &value)?;
5039                }
5040            }
5041            state.end()
5042        }
5043    }
5044
5045    /// The state of the PSC connection.
5046    /// We reserve the right to add more states without notice in the future.
5047    /// Users should not use exhaustive switch statements on this enum.
5048    /// See <https://google.aip.dev/216>.
5049    ///
5050    /// # Working with unknown values
5051    ///
5052    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5053    /// additional enum variants at any time. Adding new variants is not considered
5054    /// a breaking change. Applications should write their code in anticipation of:
5055    ///
5056    /// - New values appearing in future releases of the client library, **and**
5057    /// - New values received dynamically, without application changes.
5058    ///
5059    /// Please consult the [Working with enums] section in the user guide for some
5060    /// guidelines.
5061    ///
5062    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5063    #[derive(Clone, Debug, PartialEq)]
5064    #[non_exhaustive]
5065    pub enum State {
5066        /// An invalid state as the default case.
5067        Unspecified,
5068        /// The connection has been created successfully. However, for the
5069        /// up-to-date connection status, please use the created forwarding rule's
5070        /// "PscConnectionStatus" as the source of truth.
5071        Active,
5072        /// The connection is not functional since some resources on the connection
5073        /// fail to be created.
5074        Failed,
5075        /// The connection is being created.
5076        Creating,
5077        /// The connection is being deleted.
5078        Deleting,
5079        /// The connection is being repaired to complete creation.
5080        CreateRepairing,
5081        /// The connection is being repaired to complete deletion.
5082        DeleteRepairing,
5083        /// If set, the enum was initialized with an unknown value.
5084        ///
5085        /// Applications can examine the value using [State::value] or
5086        /// [State::name].
5087        UnknownValue(state::UnknownValue),
5088    }
5089
5090    #[doc(hidden)]
5091    pub mod state {
5092        #[allow(unused_imports)]
5093        use super::*;
5094        #[derive(Clone, Debug, PartialEq)]
5095        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5096    }
5097
5098    impl State {
5099        /// Gets the enum value.
5100        ///
5101        /// Returns `None` if the enum contains an unknown value deserialized from
5102        /// the string representation of enums.
5103        pub fn value(&self) -> std::option::Option<i32> {
5104            match self {
5105                Self::Unspecified => std::option::Option::Some(0),
5106                Self::Active => std::option::Option::Some(1),
5107                Self::Failed => std::option::Option::Some(2),
5108                Self::Creating => std::option::Option::Some(3),
5109                Self::Deleting => std::option::Option::Some(4),
5110                Self::CreateRepairing => std::option::Option::Some(5),
5111                Self::DeleteRepairing => std::option::Option::Some(6),
5112                Self::UnknownValue(u) => u.0.value(),
5113            }
5114        }
5115
5116        /// Gets the enum value as a string.
5117        ///
5118        /// Returns `None` if the enum contains an unknown value deserialized from
5119        /// the integer representation of enums.
5120        pub fn name(&self) -> std::option::Option<&str> {
5121            match self {
5122                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
5123                Self::Active => std::option::Option::Some("ACTIVE"),
5124                Self::Failed => std::option::Option::Some("FAILED"),
5125                Self::Creating => std::option::Option::Some("CREATING"),
5126                Self::Deleting => std::option::Option::Some("DELETING"),
5127                Self::CreateRepairing => std::option::Option::Some("CREATE_REPAIRING"),
5128                Self::DeleteRepairing => std::option::Option::Some("DELETE_REPAIRING"),
5129                Self::UnknownValue(u) => u.0.name(),
5130            }
5131        }
5132    }
5133
5134    impl std::default::Default for State {
5135        fn default() -> Self {
5136            use std::convert::From;
5137            Self::from(0)
5138        }
5139    }
5140
5141    impl std::fmt::Display for State {
5142        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5143            wkt::internal::display_enum(f, self.name(), self.value())
5144        }
5145    }
5146
5147    impl std::convert::From<i32> for State {
5148        fn from(value: i32) -> Self {
5149            match value {
5150                0 => Self::Unspecified,
5151                1 => Self::Active,
5152                2 => Self::Failed,
5153                3 => Self::Creating,
5154                4 => Self::Deleting,
5155                5 => Self::CreateRepairing,
5156                6 => Self::DeleteRepairing,
5157                _ => Self::UnknownValue(state::UnknownValue(
5158                    wkt::internal::UnknownEnumValue::Integer(value),
5159                )),
5160            }
5161        }
5162    }
5163
5164    impl std::convert::From<&str> for State {
5165        fn from(value: &str) -> Self {
5166            use std::string::ToString;
5167            match value {
5168                "STATE_UNSPECIFIED" => Self::Unspecified,
5169                "ACTIVE" => Self::Active,
5170                "FAILED" => Self::Failed,
5171                "CREATING" => Self::Creating,
5172                "DELETING" => Self::Deleting,
5173                "CREATE_REPAIRING" => Self::CreateRepairing,
5174                "DELETE_REPAIRING" => Self::DeleteRepairing,
5175                _ => Self::UnknownValue(state::UnknownValue(
5176                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5177                )),
5178            }
5179        }
5180    }
5181
5182    impl serde::ser::Serialize for State {
5183        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5184        where
5185            S: serde::Serializer,
5186        {
5187            match self {
5188                Self::Unspecified => serializer.serialize_i32(0),
5189                Self::Active => serializer.serialize_i32(1),
5190                Self::Failed => serializer.serialize_i32(2),
5191                Self::Creating => serializer.serialize_i32(3),
5192                Self::Deleting => serializer.serialize_i32(4),
5193                Self::CreateRepairing => serializer.serialize_i32(5),
5194                Self::DeleteRepairing => serializer.serialize_i32(6),
5195                Self::UnknownValue(u) => u.0.serialize(serializer),
5196            }
5197        }
5198    }
5199
5200    impl<'de> serde::de::Deserialize<'de> for State {
5201        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5202        where
5203            D: serde::Deserializer<'de>,
5204        {
5205            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
5206                ".google.cloud.networkconnectivity.v1.ServiceConnectionPolicy.State",
5207            ))
5208        }
5209    }
5210}
5211
5212/// Request for ListServiceConnectionPolicies.
5213#[derive(Clone, Debug, Default, PartialEq)]
5214#[non_exhaustive]
5215pub struct ListServiceConnectionPoliciesRequest {
5216    /// Required. The parent resource's name. ex. projects/123/locations/us-east1
5217    pub parent: std::string::String,
5218
5219    /// The maximum number of results per page that should be returned.
5220    pub page_size: i32,
5221
5222    /// The page token.
5223    pub page_token: std::string::String,
5224
5225    /// A filter expression that filters the results listed in the response.
5226    pub filter: std::string::String,
5227
5228    /// Sort the results by a certain order.
5229    pub order_by: std::string::String,
5230
5231    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5232}
5233
5234impl ListServiceConnectionPoliciesRequest {
5235    pub fn new() -> Self {
5236        std::default::Default::default()
5237    }
5238
5239    /// Sets the value of [parent][crate::model::ListServiceConnectionPoliciesRequest::parent].
5240    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5241        self.parent = v.into();
5242        self
5243    }
5244
5245    /// Sets the value of [page_size][crate::model::ListServiceConnectionPoliciesRequest::page_size].
5246    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5247        self.page_size = v.into();
5248        self
5249    }
5250
5251    /// Sets the value of [page_token][crate::model::ListServiceConnectionPoliciesRequest::page_token].
5252    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5253        self.page_token = v.into();
5254        self
5255    }
5256
5257    /// Sets the value of [filter][crate::model::ListServiceConnectionPoliciesRequest::filter].
5258    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5259        self.filter = v.into();
5260        self
5261    }
5262
5263    /// Sets the value of [order_by][crate::model::ListServiceConnectionPoliciesRequest::order_by].
5264    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5265        self.order_by = v.into();
5266        self
5267    }
5268}
5269
5270impl wkt::message::Message for ListServiceConnectionPoliciesRequest {
5271    fn typename() -> &'static str {
5272        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListServiceConnectionPoliciesRequest"
5273    }
5274}
5275
5276#[doc(hidden)]
5277impl<'de> serde::de::Deserialize<'de> for ListServiceConnectionPoliciesRequest {
5278    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5279    where
5280        D: serde::Deserializer<'de>,
5281    {
5282        #[allow(non_camel_case_types)]
5283        #[doc(hidden)]
5284        #[derive(PartialEq, Eq, Hash)]
5285        enum __FieldTag {
5286            __parent,
5287            __page_size,
5288            __page_token,
5289            __filter,
5290            __order_by,
5291            Unknown(std::string::String),
5292        }
5293        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5294            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5295            where
5296                D: serde::Deserializer<'de>,
5297            {
5298                struct Visitor;
5299                impl<'de> serde::de::Visitor<'de> for Visitor {
5300                    type Value = __FieldTag;
5301                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5302                        formatter.write_str("a field name for ListServiceConnectionPoliciesRequest")
5303                    }
5304                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5305                    where
5306                        E: serde::de::Error,
5307                    {
5308                        use std::result::Result::Ok;
5309                        use std::string::ToString;
5310                        match value {
5311                            "parent" => Ok(__FieldTag::__parent),
5312                            "pageSize" => Ok(__FieldTag::__page_size),
5313                            "page_size" => Ok(__FieldTag::__page_size),
5314                            "pageToken" => Ok(__FieldTag::__page_token),
5315                            "page_token" => Ok(__FieldTag::__page_token),
5316                            "filter" => Ok(__FieldTag::__filter),
5317                            "orderBy" => Ok(__FieldTag::__order_by),
5318                            "order_by" => Ok(__FieldTag::__order_by),
5319                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5320                        }
5321                    }
5322                }
5323                deserializer.deserialize_identifier(Visitor)
5324            }
5325        }
5326        struct Visitor;
5327        impl<'de> serde::de::Visitor<'de> for Visitor {
5328            type Value = ListServiceConnectionPoliciesRequest;
5329            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5330                formatter.write_str("struct ListServiceConnectionPoliciesRequest")
5331            }
5332            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5333            where
5334                A: serde::de::MapAccess<'de>,
5335            {
5336                #[allow(unused_imports)]
5337                use serde::de::Error;
5338                use std::option::Option::Some;
5339                let mut fields = std::collections::HashSet::new();
5340                let mut result = Self::Value::new();
5341                while let Some(tag) = map.next_key::<__FieldTag>()? {
5342                    #[allow(clippy::match_single_binding)]
5343                    match tag {
5344                        __FieldTag::__parent => {
5345                            if !fields.insert(__FieldTag::__parent) {
5346                                return std::result::Result::Err(A::Error::duplicate_field(
5347                                    "multiple values for parent",
5348                                ));
5349                            }
5350                            result.parent = map
5351                                .next_value::<std::option::Option<std::string::String>>()?
5352                                .unwrap_or_default();
5353                        }
5354                        __FieldTag::__page_size => {
5355                            if !fields.insert(__FieldTag::__page_size) {
5356                                return std::result::Result::Err(A::Error::duplicate_field(
5357                                    "multiple values for page_size",
5358                                ));
5359                            }
5360                            struct __With(std::option::Option<i32>);
5361                            impl<'de> serde::de::Deserialize<'de> for __With {
5362                                fn deserialize<D>(
5363                                    deserializer: D,
5364                                ) -> std::result::Result<Self, D::Error>
5365                                where
5366                                    D: serde::de::Deserializer<'de>,
5367                                {
5368                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
5369                                }
5370                            }
5371                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
5372                        }
5373                        __FieldTag::__page_token => {
5374                            if !fields.insert(__FieldTag::__page_token) {
5375                                return std::result::Result::Err(A::Error::duplicate_field(
5376                                    "multiple values for page_token",
5377                                ));
5378                            }
5379                            result.page_token = map
5380                                .next_value::<std::option::Option<std::string::String>>()?
5381                                .unwrap_or_default();
5382                        }
5383                        __FieldTag::__filter => {
5384                            if !fields.insert(__FieldTag::__filter) {
5385                                return std::result::Result::Err(A::Error::duplicate_field(
5386                                    "multiple values for filter",
5387                                ));
5388                            }
5389                            result.filter = map
5390                                .next_value::<std::option::Option<std::string::String>>()?
5391                                .unwrap_or_default();
5392                        }
5393                        __FieldTag::__order_by => {
5394                            if !fields.insert(__FieldTag::__order_by) {
5395                                return std::result::Result::Err(A::Error::duplicate_field(
5396                                    "multiple values for order_by",
5397                                ));
5398                            }
5399                            result.order_by = map
5400                                .next_value::<std::option::Option<std::string::String>>()?
5401                                .unwrap_or_default();
5402                        }
5403                        __FieldTag::Unknown(key) => {
5404                            let value = map.next_value::<serde_json::Value>()?;
5405                            result._unknown_fields.insert(key, value);
5406                        }
5407                    }
5408                }
5409                std::result::Result::Ok(result)
5410            }
5411        }
5412        deserializer.deserialize_any(Visitor)
5413    }
5414}
5415
5416#[doc(hidden)]
5417impl serde::ser::Serialize for ListServiceConnectionPoliciesRequest {
5418    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5419    where
5420        S: serde::ser::Serializer,
5421    {
5422        use serde::ser::SerializeMap;
5423        #[allow(unused_imports)]
5424        use std::option::Option::Some;
5425        let mut state = serializer.serialize_map(std::option::Option::None)?;
5426        if !self.parent.is_empty() {
5427            state.serialize_entry("parent", &self.parent)?;
5428        }
5429        if !wkt::internal::is_default(&self.page_size) {
5430            struct __With<'a>(&'a i32);
5431            impl<'a> serde::ser::Serialize for __With<'a> {
5432                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5433                where
5434                    S: serde::ser::Serializer,
5435                {
5436                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
5437                }
5438            }
5439            state.serialize_entry("pageSize", &__With(&self.page_size))?;
5440        }
5441        if !self.page_token.is_empty() {
5442            state.serialize_entry("pageToken", &self.page_token)?;
5443        }
5444        if !self.filter.is_empty() {
5445            state.serialize_entry("filter", &self.filter)?;
5446        }
5447        if !self.order_by.is_empty() {
5448            state.serialize_entry("orderBy", &self.order_by)?;
5449        }
5450        if !self._unknown_fields.is_empty() {
5451            for (key, value) in self._unknown_fields.iter() {
5452                state.serialize_entry(key, &value)?;
5453            }
5454        }
5455        state.end()
5456    }
5457}
5458
5459/// Response for ListServiceConnectionPolicies.
5460#[derive(Clone, Debug, Default, PartialEq)]
5461#[non_exhaustive]
5462pub struct ListServiceConnectionPoliciesResponse {
5463    /// ServiceConnectionPolicies to be returned.
5464    pub service_connection_policies: std::vec::Vec<crate::model::ServiceConnectionPolicy>,
5465
5466    /// The next pagination token in the List response. It should be used as
5467    /// page_token for the following request. An empty value means no more result.
5468    pub next_page_token: std::string::String,
5469
5470    /// Locations that could not be reached.
5471    pub unreachable: std::vec::Vec<std::string::String>,
5472
5473    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5474}
5475
5476impl ListServiceConnectionPoliciesResponse {
5477    pub fn new() -> Self {
5478        std::default::Default::default()
5479    }
5480
5481    /// Sets the value of [service_connection_policies][crate::model::ListServiceConnectionPoliciesResponse::service_connection_policies].
5482    pub fn set_service_connection_policies<T, V>(mut self, v: T) -> Self
5483    where
5484        T: std::iter::IntoIterator<Item = V>,
5485        V: std::convert::Into<crate::model::ServiceConnectionPolicy>,
5486    {
5487        use std::iter::Iterator;
5488        self.service_connection_policies = v.into_iter().map(|i| i.into()).collect();
5489        self
5490    }
5491
5492    /// Sets the value of [next_page_token][crate::model::ListServiceConnectionPoliciesResponse::next_page_token].
5493    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5494        self.next_page_token = v.into();
5495        self
5496    }
5497
5498    /// Sets the value of [unreachable][crate::model::ListServiceConnectionPoliciesResponse::unreachable].
5499    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
5500    where
5501        T: std::iter::IntoIterator<Item = V>,
5502        V: std::convert::Into<std::string::String>,
5503    {
5504        use std::iter::Iterator;
5505        self.unreachable = v.into_iter().map(|i| i.into()).collect();
5506        self
5507    }
5508}
5509
5510impl wkt::message::Message for ListServiceConnectionPoliciesResponse {
5511    fn typename() -> &'static str {
5512        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListServiceConnectionPoliciesResponse"
5513    }
5514}
5515
5516#[doc(hidden)]
5517impl gax::paginator::internal::PageableResponse for ListServiceConnectionPoliciesResponse {
5518    type PageItem = crate::model::ServiceConnectionPolicy;
5519
5520    fn items(self) -> std::vec::Vec<Self::PageItem> {
5521        self.service_connection_policies
5522    }
5523
5524    fn next_page_token(&self) -> std::string::String {
5525        use std::clone::Clone;
5526        self.next_page_token.clone()
5527    }
5528}
5529
5530#[doc(hidden)]
5531impl<'de> serde::de::Deserialize<'de> for ListServiceConnectionPoliciesResponse {
5532    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5533    where
5534        D: serde::Deserializer<'de>,
5535    {
5536        #[allow(non_camel_case_types)]
5537        #[doc(hidden)]
5538        #[derive(PartialEq, Eq, Hash)]
5539        enum __FieldTag {
5540            __service_connection_policies,
5541            __next_page_token,
5542            __unreachable,
5543            Unknown(std::string::String),
5544        }
5545        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5546            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5547            where
5548                D: serde::Deserializer<'de>,
5549            {
5550                struct Visitor;
5551                impl<'de> serde::de::Visitor<'de> for Visitor {
5552                    type Value = __FieldTag;
5553                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5554                        formatter
5555                            .write_str("a field name for ListServiceConnectionPoliciesResponse")
5556                    }
5557                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5558                    where
5559                        E: serde::de::Error,
5560                    {
5561                        use std::result::Result::Ok;
5562                        use std::string::ToString;
5563                        match value {
5564                            "serviceConnectionPolicies" => {
5565                                Ok(__FieldTag::__service_connection_policies)
5566                            }
5567                            "service_connection_policies" => {
5568                                Ok(__FieldTag::__service_connection_policies)
5569                            }
5570                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
5571                            "next_page_token" => Ok(__FieldTag::__next_page_token),
5572                            "unreachable" => Ok(__FieldTag::__unreachable),
5573                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5574                        }
5575                    }
5576                }
5577                deserializer.deserialize_identifier(Visitor)
5578            }
5579        }
5580        struct Visitor;
5581        impl<'de> serde::de::Visitor<'de> for Visitor {
5582            type Value = ListServiceConnectionPoliciesResponse;
5583            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5584                formatter.write_str("struct ListServiceConnectionPoliciesResponse")
5585            }
5586            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5587            where
5588                A: serde::de::MapAccess<'de>,
5589            {
5590                #[allow(unused_imports)]
5591                use serde::de::Error;
5592                use std::option::Option::Some;
5593                let mut fields = std::collections::HashSet::new();
5594                let mut result = Self::Value::new();
5595                while let Some(tag) = map.next_key::<__FieldTag>()? {
5596                    #[allow(clippy::match_single_binding)]
5597                    match tag {
5598                        __FieldTag::__service_connection_policies => {
5599                            if !fields.insert(__FieldTag::__service_connection_policies) {
5600                                return std::result::Result::Err(A::Error::duplicate_field(
5601                                    "multiple values for service_connection_policies",
5602                                ));
5603                            }
5604                            result.service_connection_policies = map
5605                                .next_value::<std::option::Option<
5606                                    std::vec::Vec<crate::model::ServiceConnectionPolicy>,
5607                                >>()?
5608                                .unwrap_or_default();
5609                        }
5610                        __FieldTag::__next_page_token => {
5611                            if !fields.insert(__FieldTag::__next_page_token) {
5612                                return std::result::Result::Err(A::Error::duplicate_field(
5613                                    "multiple values for next_page_token",
5614                                ));
5615                            }
5616                            result.next_page_token = map
5617                                .next_value::<std::option::Option<std::string::String>>()?
5618                                .unwrap_or_default();
5619                        }
5620                        __FieldTag::__unreachable => {
5621                            if !fields.insert(__FieldTag::__unreachable) {
5622                                return std::result::Result::Err(A::Error::duplicate_field(
5623                                    "multiple values for unreachable",
5624                                ));
5625                            }
5626                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
5627                        }
5628                        __FieldTag::Unknown(key) => {
5629                            let value = map.next_value::<serde_json::Value>()?;
5630                            result._unknown_fields.insert(key, value);
5631                        }
5632                    }
5633                }
5634                std::result::Result::Ok(result)
5635            }
5636        }
5637        deserializer.deserialize_any(Visitor)
5638    }
5639}
5640
5641#[doc(hidden)]
5642impl serde::ser::Serialize for ListServiceConnectionPoliciesResponse {
5643    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5644    where
5645        S: serde::ser::Serializer,
5646    {
5647        use serde::ser::SerializeMap;
5648        #[allow(unused_imports)]
5649        use std::option::Option::Some;
5650        let mut state = serializer.serialize_map(std::option::Option::None)?;
5651        if !self.service_connection_policies.is_empty() {
5652            state.serialize_entry(
5653                "serviceConnectionPolicies",
5654                &self.service_connection_policies,
5655            )?;
5656        }
5657        if !self.next_page_token.is_empty() {
5658            state.serialize_entry("nextPageToken", &self.next_page_token)?;
5659        }
5660        if !self.unreachable.is_empty() {
5661            state.serialize_entry("unreachable", &self.unreachable)?;
5662        }
5663        if !self._unknown_fields.is_empty() {
5664            for (key, value) in self._unknown_fields.iter() {
5665                state.serialize_entry(key, &value)?;
5666            }
5667        }
5668        state.end()
5669    }
5670}
5671
5672/// Request for GetServiceConnectionPolicy.
5673#[derive(Clone, Debug, Default, PartialEq)]
5674#[non_exhaustive]
5675pub struct GetServiceConnectionPolicyRequest {
5676    /// Required. Name of the ServiceConnectionPolicy to get.
5677    pub name: std::string::String,
5678
5679    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5680}
5681
5682impl GetServiceConnectionPolicyRequest {
5683    pub fn new() -> Self {
5684        std::default::Default::default()
5685    }
5686
5687    /// Sets the value of [name][crate::model::GetServiceConnectionPolicyRequest::name].
5688    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5689        self.name = v.into();
5690        self
5691    }
5692}
5693
5694impl wkt::message::Message for GetServiceConnectionPolicyRequest {
5695    fn typename() -> &'static str {
5696        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetServiceConnectionPolicyRequest"
5697    }
5698}
5699
5700#[doc(hidden)]
5701impl<'de> serde::de::Deserialize<'de> for GetServiceConnectionPolicyRequest {
5702    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5703    where
5704        D: serde::Deserializer<'de>,
5705    {
5706        #[allow(non_camel_case_types)]
5707        #[doc(hidden)]
5708        #[derive(PartialEq, Eq, Hash)]
5709        enum __FieldTag {
5710            __name,
5711            Unknown(std::string::String),
5712        }
5713        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5714            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5715            where
5716                D: serde::Deserializer<'de>,
5717            {
5718                struct Visitor;
5719                impl<'de> serde::de::Visitor<'de> for Visitor {
5720                    type Value = __FieldTag;
5721                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5722                        formatter.write_str("a field name for GetServiceConnectionPolicyRequest")
5723                    }
5724                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5725                    where
5726                        E: serde::de::Error,
5727                    {
5728                        use std::result::Result::Ok;
5729                        use std::string::ToString;
5730                        match value {
5731                            "name" => Ok(__FieldTag::__name),
5732                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5733                        }
5734                    }
5735                }
5736                deserializer.deserialize_identifier(Visitor)
5737            }
5738        }
5739        struct Visitor;
5740        impl<'de> serde::de::Visitor<'de> for Visitor {
5741            type Value = GetServiceConnectionPolicyRequest;
5742            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5743                formatter.write_str("struct GetServiceConnectionPolicyRequest")
5744            }
5745            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5746            where
5747                A: serde::de::MapAccess<'de>,
5748            {
5749                #[allow(unused_imports)]
5750                use serde::de::Error;
5751                use std::option::Option::Some;
5752                let mut fields = std::collections::HashSet::new();
5753                let mut result = Self::Value::new();
5754                while let Some(tag) = map.next_key::<__FieldTag>()? {
5755                    #[allow(clippy::match_single_binding)]
5756                    match tag {
5757                        __FieldTag::__name => {
5758                            if !fields.insert(__FieldTag::__name) {
5759                                return std::result::Result::Err(A::Error::duplicate_field(
5760                                    "multiple values for name",
5761                                ));
5762                            }
5763                            result.name = map
5764                                .next_value::<std::option::Option<std::string::String>>()?
5765                                .unwrap_or_default();
5766                        }
5767                        __FieldTag::Unknown(key) => {
5768                            let value = map.next_value::<serde_json::Value>()?;
5769                            result._unknown_fields.insert(key, value);
5770                        }
5771                    }
5772                }
5773                std::result::Result::Ok(result)
5774            }
5775        }
5776        deserializer.deserialize_any(Visitor)
5777    }
5778}
5779
5780#[doc(hidden)]
5781impl serde::ser::Serialize for GetServiceConnectionPolicyRequest {
5782    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5783    where
5784        S: serde::ser::Serializer,
5785    {
5786        use serde::ser::SerializeMap;
5787        #[allow(unused_imports)]
5788        use std::option::Option::Some;
5789        let mut state = serializer.serialize_map(std::option::Option::None)?;
5790        if !self.name.is_empty() {
5791            state.serialize_entry("name", &self.name)?;
5792        }
5793        if !self._unknown_fields.is_empty() {
5794            for (key, value) in self._unknown_fields.iter() {
5795                state.serialize_entry(key, &value)?;
5796            }
5797        }
5798        state.end()
5799    }
5800}
5801
5802/// Request for CreateServiceConnectionPolicy.
5803#[derive(Clone, Debug, Default, PartialEq)]
5804#[non_exhaustive]
5805pub struct CreateServiceConnectionPolicyRequest {
5806    /// Required. The parent resource's name of the ServiceConnectionPolicy. ex.
5807    /// projects/123/locations/us-east1
5808    pub parent: std::string::String,
5809
5810    /// Optional. Resource ID
5811    /// (i.e. 'foo' in
5812    /// '[...]/projects/p/locations/l/serviceConnectionPolicies/foo') See
5813    /// <https://google.aip.dev/122#resource-id-segments> Unique per location.
5814    pub service_connection_policy_id: std::string::String,
5815
5816    /// Required. Initial values for a new ServiceConnectionPolicies
5817    pub service_connection_policy: std::option::Option<crate::model::ServiceConnectionPolicy>,
5818
5819    /// Optional. An optional request ID to identify requests. Specify a unique
5820    /// request ID so that if you must retry your request, the server will know to
5821    /// ignore the request if it has already been completed. The server will
5822    /// guarantee that for at least 60 minutes since the first request.
5823    ///
5824    /// For example, consider a situation where you make an initial request and
5825    /// the request times out. If you make the request again with the same request
5826    /// ID, the server can check if original operation with the same request ID
5827    /// was received, and if so, will ignore the second request. This prevents
5828    /// clients from accidentally creating duplicate commitments.
5829    ///
5830    /// The request ID must be a valid UUID with the exception that zero UUID is
5831    /// not supported (00000000-0000-0000-0000-000000000000).
5832    pub request_id: std::string::String,
5833
5834    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5835}
5836
5837impl CreateServiceConnectionPolicyRequest {
5838    pub fn new() -> Self {
5839        std::default::Default::default()
5840    }
5841
5842    /// Sets the value of [parent][crate::model::CreateServiceConnectionPolicyRequest::parent].
5843    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5844        self.parent = v.into();
5845        self
5846    }
5847
5848    /// Sets the value of [service_connection_policy_id][crate::model::CreateServiceConnectionPolicyRequest::service_connection_policy_id].
5849    pub fn set_service_connection_policy_id<T: std::convert::Into<std::string::String>>(
5850        mut self,
5851        v: T,
5852    ) -> Self {
5853        self.service_connection_policy_id = v.into();
5854        self
5855    }
5856
5857    /// Sets the value of [service_connection_policy][crate::model::CreateServiceConnectionPolicyRequest::service_connection_policy].
5858    pub fn set_service_connection_policy<T>(mut self, v: T) -> Self
5859    where
5860        T: std::convert::Into<crate::model::ServiceConnectionPolicy>,
5861    {
5862        self.service_connection_policy = std::option::Option::Some(v.into());
5863        self
5864    }
5865
5866    /// Sets or clears the value of [service_connection_policy][crate::model::CreateServiceConnectionPolicyRequest::service_connection_policy].
5867    pub fn set_or_clear_service_connection_policy<T>(mut self, v: std::option::Option<T>) -> Self
5868    where
5869        T: std::convert::Into<crate::model::ServiceConnectionPolicy>,
5870    {
5871        self.service_connection_policy = v.map(|x| x.into());
5872        self
5873    }
5874
5875    /// Sets the value of [request_id][crate::model::CreateServiceConnectionPolicyRequest::request_id].
5876    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5877        self.request_id = v.into();
5878        self
5879    }
5880}
5881
5882impl wkt::message::Message for CreateServiceConnectionPolicyRequest {
5883    fn typename() -> &'static str {
5884        "type.googleapis.com/google.cloud.networkconnectivity.v1.CreateServiceConnectionPolicyRequest"
5885    }
5886}
5887
5888#[doc(hidden)]
5889impl<'de> serde::de::Deserialize<'de> for CreateServiceConnectionPolicyRequest {
5890    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5891    where
5892        D: serde::Deserializer<'de>,
5893    {
5894        #[allow(non_camel_case_types)]
5895        #[doc(hidden)]
5896        #[derive(PartialEq, Eq, Hash)]
5897        enum __FieldTag {
5898            __parent,
5899            __service_connection_policy_id,
5900            __service_connection_policy,
5901            __request_id,
5902            Unknown(std::string::String),
5903        }
5904        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5905            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5906            where
5907                D: serde::Deserializer<'de>,
5908            {
5909                struct Visitor;
5910                impl<'de> serde::de::Visitor<'de> for Visitor {
5911                    type Value = __FieldTag;
5912                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5913                        formatter.write_str("a field name for CreateServiceConnectionPolicyRequest")
5914                    }
5915                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5916                    where
5917                        E: serde::de::Error,
5918                    {
5919                        use std::result::Result::Ok;
5920                        use std::string::ToString;
5921                        match value {
5922                            "parent" => Ok(__FieldTag::__parent),
5923                            "serviceConnectionPolicyId" => {
5924                                Ok(__FieldTag::__service_connection_policy_id)
5925                            }
5926                            "service_connection_policy_id" => {
5927                                Ok(__FieldTag::__service_connection_policy_id)
5928                            }
5929                            "serviceConnectionPolicy" => {
5930                                Ok(__FieldTag::__service_connection_policy)
5931                            }
5932                            "service_connection_policy" => {
5933                                Ok(__FieldTag::__service_connection_policy)
5934                            }
5935                            "requestId" => Ok(__FieldTag::__request_id),
5936                            "request_id" => Ok(__FieldTag::__request_id),
5937                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5938                        }
5939                    }
5940                }
5941                deserializer.deserialize_identifier(Visitor)
5942            }
5943        }
5944        struct Visitor;
5945        impl<'de> serde::de::Visitor<'de> for Visitor {
5946            type Value = CreateServiceConnectionPolicyRequest;
5947            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5948                formatter.write_str("struct CreateServiceConnectionPolicyRequest")
5949            }
5950            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5951            where
5952                A: serde::de::MapAccess<'de>,
5953            {
5954                #[allow(unused_imports)]
5955                use serde::de::Error;
5956                use std::option::Option::Some;
5957                let mut fields = std::collections::HashSet::new();
5958                let mut result = Self::Value::new();
5959                while let Some(tag) = map.next_key::<__FieldTag>()? {
5960                    #[allow(clippy::match_single_binding)]
5961                    match tag {
5962                        __FieldTag::__parent => {
5963                            if !fields.insert(__FieldTag::__parent) {
5964                                return std::result::Result::Err(A::Error::duplicate_field(
5965                                    "multiple values for parent",
5966                                ));
5967                            }
5968                            result.parent = map
5969                                .next_value::<std::option::Option<std::string::String>>()?
5970                                .unwrap_or_default();
5971                        }
5972                        __FieldTag::__service_connection_policy_id => {
5973                            if !fields.insert(__FieldTag::__service_connection_policy_id) {
5974                                return std::result::Result::Err(A::Error::duplicate_field(
5975                                    "multiple values for service_connection_policy_id",
5976                                ));
5977                            }
5978                            result.service_connection_policy_id = map
5979                                .next_value::<std::option::Option<std::string::String>>()?
5980                                .unwrap_or_default();
5981                        }
5982                        __FieldTag::__service_connection_policy => {
5983                            if !fields.insert(__FieldTag::__service_connection_policy) {
5984                                return std::result::Result::Err(A::Error::duplicate_field(
5985                                    "multiple values for service_connection_policy",
5986                                ));
5987                            }
5988                            result.service_connection_policy = map.next_value::<std::option::Option<crate::model::ServiceConnectionPolicy>>()?
5989                                ;
5990                        }
5991                        __FieldTag::__request_id => {
5992                            if !fields.insert(__FieldTag::__request_id) {
5993                                return std::result::Result::Err(A::Error::duplicate_field(
5994                                    "multiple values for request_id",
5995                                ));
5996                            }
5997                            result.request_id = map
5998                                .next_value::<std::option::Option<std::string::String>>()?
5999                                .unwrap_or_default();
6000                        }
6001                        __FieldTag::Unknown(key) => {
6002                            let value = map.next_value::<serde_json::Value>()?;
6003                            result._unknown_fields.insert(key, value);
6004                        }
6005                    }
6006                }
6007                std::result::Result::Ok(result)
6008            }
6009        }
6010        deserializer.deserialize_any(Visitor)
6011    }
6012}
6013
6014#[doc(hidden)]
6015impl serde::ser::Serialize for CreateServiceConnectionPolicyRequest {
6016    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6017    where
6018        S: serde::ser::Serializer,
6019    {
6020        use serde::ser::SerializeMap;
6021        #[allow(unused_imports)]
6022        use std::option::Option::Some;
6023        let mut state = serializer.serialize_map(std::option::Option::None)?;
6024        if !self.parent.is_empty() {
6025            state.serialize_entry("parent", &self.parent)?;
6026        }
6027        if !self.service_connection_policy_id.is_empty() {
6028            state.serialize_entry(
6029                "serviceConnectionPolicyId",
6030                &self.service_connection_policy_id,
6031            )?;
6032        }
6033        if self.service_connection_policy.is_some() {
6034            state.serialize_entry("serviceConnectionPolicy", &self.service_connection_policy)?;
6035        }
6036        if !self.request_id.is_empty() {
6037            state.serialize_entry("requestId", &self.request_id)?;
6038        }
6039        if !self._unknown_fields.is_empty() {
6040            for (key, value) in self._unknown_fields.iter() {
6041                state.serialize_entry(key, &value)?;
6042            }
6043        }
6044        state.end()
6045    }
6046}
6047
6048/// Request for UpdateServiceConnectionPolicy.
6049#[derive(Clone, Debug, Default, PartialEq)]
6050#[non_exhaustive]
6051pub struct UpdateServiceConnectionPolicyRequest {
6052    /// Optional. Field mask is used to specify the fields to be overwritten in the
6053    /// ServiceConnectionPolicy resource by the update.
6054    /// The fields specified in the update_mask are relative to the resource, not
6055    /// the full request. A field will be overwritten if it is in the mask. If the
6056    /// user does not provide a mask then all fields will be overwritten.
6057    pub update_mask: std::option::Option<wkt::FieldMask>,
6058
6059    /// Required. New values to be patched into the resource.
6060    pub service_connection_policy: std::option::Option<crate::model::ServiceConnectionPolicy>,
6061
6062    /// Optional. An optional request ID to identify requests. Specify a unique
6063    /// request ID so that if you must retry your request, the server will know to
6064    /// ignore the request if it has already been completed. The server will
6065    /// guarantee that for at least 60 minutes since the first request.
6066    ///
6067    /// For example, consider a situation where you make an initial request and
6068    /// the request times out. If you make the request again with the same request
6069    /// ID, the server can check if original operation with the same request ID
6070    /// was received, and if so, will ignore the second request. This prevents
6071    /// clients from accidentally creating duplicate commitments.
6072    ///
6073    /// The request ID must be a valid UUID with the exception that zero UUID is
6074    /// not supported (00000000-0000-0000-0000-000000000000).
6075    pub request_id: std::string::String,
6076
6077    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6078}
6079
6080impl UpdateServiceConnectionPolicyRequest {
6081    pub fn new() -> Self {
6082        std::default::Default::default()
6083    }
6084
6085    /// Sets the value of [update_mask][crate::model::UpdateServiceConnectionPolicyRequest::update_mask].
6086    pub fn set_update_mask<T>(mut self, v: T) -> Self
6087    where
6088        T: std::convert::Into<wkt::FieldMask>,
6089    {
6090        self.update_mask = std::option::Option::Some(v.into());
6091        self
6092    }
6093
6094    /// Sets or clears the value of [update_mask][crate::model::UpdateServiceConnectionPolicyRequest::update_mask].
6095    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6096    where
6097        T: std::convert::Into<wkt::FieldMask>,
6098    {
6099        self.update_mask = v.map(|x| x.into());
6100        self
6101    }
6102
6103    /// Sets the value of [service_connection_policy][crate::model::UpdateServiceConnectionPolicyRequest::service_connection_policy].
6104    pub fn set_service_connection_policy<T>(mut self, v: T) -> Self
6105    where
6106        T: std::convert::Into<crate::model::ServiceConnectionPolicy>,
6107    {
6108        self.service_connection_policy = std::option::Option::Some(v.into());
6109        self
6110    }
6111
6112    /// Sets or clears the value of [service_connection_policy][crate::model::UpdateServiceConnectionPolicyRequest::service_connection_policy].
6113    pub fn set_or_clear_service_connection_policy<T>(mut self, v: std::option::Option<T>) -> Self
6114    where
6115        T: std::convert::Into<crate::model::ServiceConnectionPolicy>,
6116    {
6117        self.service_connection_policy = v.map(|x| x.into());
6118        self
6119    }
6120
6121    /// Sets the value of [request_id][crate::model::UpdateServiceConnectionPolicyRequest::request_id].
6122    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6123        self.request_id = v.into();
6124        self
6125    }
6126}
6127
6128impl wkt::message::Message for UpdateServiceConnectionPolicyRequest {
6129    fn typename() -> &'static str {
6130        "type.googleapis.com/google.cloud.networkconnectivity.v1.UpdateServiceConnectionPolicyRequest"
6131    }
6132}
6133
6134#[doc(hidden)]
6135impl<'de> serde::de::Deserialize<'de> for UpdateServiceConnectionPolicyRequest {
6136    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6137    where
6138        D: serde::Deserializer<'de>,
6139    {
6140        #[allow(non_camel_case_types)]
6141        #[doc(hidden)]
6142        #[derive(PartialEq, Eq, Hash)]
6143        enum __FieldTag {
6144            __update_mask,
6145            __service_connection_policy,
6146            __request_id,
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 UpdateServiceConnectionPolicyRequest")
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                            "updateMask" => Ok(__FieldTag::__update_mask),
6168                            "update_mask" => Ok(__FieldTag::__update_mask),
6169                            "serviceConnectionPolicy" => {
6170                                Ok(__FieldTag::__service_connection_policy)
6171                            }
6172                            "service_connection_policy" => {
6173                                Ok(__FieldTag::__service_connection_policy)
6174                            }
6175                            "requestId" => Ok(__FieldTag::__request_id),
6176                            "request_id" => Ok(__FieldTag::__request_id),
6177                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6178                        }
6179                    }
6180                }
6181                deserializer.deserialize_identifier(Visitor)
6182            }
6183        }
6184        struct Visitor;
6185        impl<'de> serde::de::Visitor<'de> for Visitor {
6186            type Value = UpdateServiceConnectionPolicyRequest;
6187            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6188                formatter.write_str("struct UpdateServiceConnectionPolicyRequest")
6189            }
6190            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6191            where
6192                A: serde::de::MapAccess<'de>,
6193            {
6194                #[allow(unused_imports)]
6195                use serde::de::Error;
6196                use std::option::Option::Some;
6197                let mut fields = std::collections::HashSet::new();
6198                let mut result = Self::Value::new();
6199                while let Some(tag) = map.next_key::<__FieldTag>()? {
6200                    #[allow(clippy::match_single_binding)]
6201                    match tag {
6202                        __FieldTag::__update_mask => {
6203                            if !fields.insert(__FieldTag::__update_mask) {
6204                                return std::result::Result::Err(A::Error::duplicate_field(
6205                                    "multiple values for update_mask",
6206                                ));
6207                            }
6208                            result.update_mask =
6209                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
6210                        }
6211                        __FieldTag::__service_connection_policy => {
6212                            if !fields.insert(__FieldTag::__service_connection_policy) {
6213                                return std::result::Result::Err(A::Error::duplicate_field(
6214                                    "multiple values for service_connection_policy",
6215                                ));
6216                            }
6217                            result.service_connection_policy = map.next_value::<std::option::Option<crate::model::ServiceConnectionPolicy>>()?
6218                                ;
6219                        }
6220                        __FieldTag::__request_id => {
6221                            if !fields.insert(__FieldTag::__request_id) {
6222                                return std::result::Result::Err(A::Error::duplicate_field(
6223                                    "multiple values for request_id",
6224                                ));
6225                            }
6226                            result.request_id = map
6227                                .next_value::<std::option::Option<std::string::String>>()?
6228                                .unwrap_or_default();
6229                        }
6230                        __FieldTag::Unknown(key) => {
6231                            let value = map.next_value::<serde_json::Value>()?;
6232                            result._unknown_fields.insert(key, value);
6233                        }
6234                    }
6235                }
6236                std::result::Result::Ok(result)
6237            }
6238        }
6239        deserializer.deserialize_any(Visitor)
6240    }
6241}
6242
6243#[doc(hidden)]
6244impl serde::ser::Serialize for UpdateServiceConnectionPolicyRequest {
6245    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6246    where
6247        S: serde::ser::Serializer,
6248    {
6249        use serde::ser::SerializeMap;
6250        #[allow(unused_imports)]
6251        use std::option::Option::Some;
6252        let mut state = serializer.serialize_map(std::option::Option::None)?;
6253        if self.update_mask.is_some() {
6254            state.serialize_entry("updateMask", &self.update_mask)?;
6255        }
6256        if self.service_connection_policy.is_some() {
6257            state.serialize_entry("serviceConnectionPolicy", &self.service_connection_policy)?;
6258        }
6259        if !self.request_id.is_empty() {
6260            state.serialize_entry("requestId", &self.request_id)?;
6261        }
6262        if !self._unknown_fields.is_empty() {
6263            for (key, value) in self._unknown_fields.iter() {
6264                state.serialize_entry(key, &value)?;
6265            }
6266        }
6267        state.end()
6268    }
6269}
6270
6271/// Request for DeleteServiceConnectionPolicy.
6272#[derive(Clone, Debug, Default, PartialEq)]
6273#[non_exhaustive]
6274pub struct DeleteServiceConnectionPolicyRequest {
6275    /// Required. The name of the ServiceConnectionPolicy to delete.
6276    pub name: std::string::String,
6277
6278    /// Optional. An optional request ID to identify requests. Specify a unique
6279    /// request ID so that if you must retry your request, the server will know to
6280    /// ignore the request if it has already been completed. The server will
6281    /// guarantee that for at least 60 minutes after the first request.
6282    ///
6283    /// For example, consider a situation where you make an initial request and
6284    /// the request times out. If you make the request again with the same request
6285    /// ID, the server can check if original operation with the same request ID
6286    /// was received, and if so, will ignore the second request. This prevents
6287    /// clients from accidentally creating duplicate commitments.
6288    ///
6289    /// The request ID must be a valid UUID with the exception that zero UUID is
6290    /// not supported (00000000-0000-0000-0000-000000000000).
6291    pub request_id: std::string::String,
6292
6293    /// Optional. The etag is computed by the server, and may be sent on update and
6294    /// delete requests to ensure the client has an up-to-date value before
6295    /// proceeding.
6296    pub etag: std::option::Option<std::string::String>,
6297
6298    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6299}
6300
6301impl DeleteServiceConnectionPolicyRequest {
6302    pub fn new() -> Self {
6303        std::default::Default::default()
6304    }
6305
6306    /// Sets the value of [name][crate::model::DeleteServiceConnectionPolicyRequest::name].
6307    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6308        self.name = v.into();
6309        self
6310    }
6311
6312    /// Sets the value of [request_id][crate::model::DeleteServiceConnectionPolicyRequest::request_id].
6313    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6314        self.request_id = v.into();
6315        self
6316    }
6317
6318    /// Sets the value of [etag][crate::model::DeleteServiceConnectionPolicyRequest::etag].
6319    pub fn set_etag<T>(mut self, v: T) -> Self
6320    where
6321        T: std::convert::Into<std::string::String>,
6322    {
6323        self.etag = std::option::Option::Some(v.into());
6324        self
6325    }
6326
6327    /// Sets or clears the value of [etag][crate::model::DeleteServiceConnectionPolicyRequest::etag].
6328    pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
6329    where
6330        T: std::convert::Into<std::string::String>,
6331    {
6332        self.etag = v.map(|x| x.into());
6333        self
6334    }
6335}
6336
6337impl wkt::message::Message for DeleteServiceConnectionPolicyRequest {
6338    fn typename() -> &'static str {
6339        "type.googleapis.com/google.cloud.networkconnectivity.v1.DeleteServiceConnectionPolicyRequest"
6340    }
6341}
6342
6343#[doc(hidden)]
6344impl<'de> serde::de::Deserialize<'de> for DeleteServiceConnectionPolicyRequest {
6345    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6346    where
6347        D: serde::Deserializer<'de>,
6348    {
6349        #[allow(non_camel_case_types)]
6350        #[doc(hidden)]
6351        #[derive(PartialEq, Eq, Hash)]
6352        enum __FieldTag {
6353            __name,
6354            __request_id,
6355            __etag,
6356            Unknown(std::string::String),
6357        }
6358        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6359            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6360            where
6361                D: serde::Deserializer<'de>,
6362            {
6363                struct Visitor;
6364                impl<'de> serde::de::Visitor<'de> for Visitor {
6365                    type Value = __FieldTag;
6366                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6367                        formatter.write_str("a field name for DeleteServiceConnectionPolicyRequest")
6368                    }
6369                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6370                    where
6371                        E: serde::de::Error,
6372                    {
6373                        use std::result::Result::Ok;
6374                        use std::string::ToString;
6375                        match value {
6376                            "name" => Ok(__FieldTag::__name),
6377                            "requestId" => Ok(__FieldTag::__request_id),
6378                            "request_id" => Ok(__FieldTag::__request_id),
6379                            "etag" => Ok(__FieldTag::__etag),
6380                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6381                        }
6382                    }
6383                }
6384                deserializer.deserialize_identifier(Visitor)
6385            }
6386        }
6387        struct Visitor;
6388        impl<'de> serde::de::Visitor<'de> for Visitor {
6389            type Value = DeleteServiceConnectionPolicyRequest;
6390            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6391                formatter.write_str("struct DeleteServiceConnectionPolicyRequest")
6392            }
6393            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6394            where
6395                A: serde::de::MapAccess<'de>,
6396            {
6397                #[allow(unused_imports)]
6398                use serde::de::Error;
6399                use std::option::Option::Some;
6400                let mut fields = std::collections::HashSet::new();
6401                let mut result = Self::Value::new();
6402                while let Some(tag) = map.next_key::<__FieldTag>()? {
6403                    #[allow(clippy::match_single_binding)]
6404                    match tag {
6405                        __FieldTag::__name => {
6406                            if !fields.insert(__FieldTag::__name) {
6407                                return std::result::Result::Err(A::Error::duplicate_field(
6408                                    "multiple values for name",
6409                                ));
6410                            }
6411                            result.name = map
6412                                .next_value::<std::option::Option<std::string::String>>()?
6413                                .unwrap_or_default();
6414                        }
6415                        __FieldTag::__request_id => {
6416                            if !fields.insert(__FieldTag::__request_id) {
6417                                return std::result::Result::Err(A::Error::duplicate_field(
6418                                    "multiple values for request_id",
6419                                ));
6420                            }
6421                            result.request_id = map
6422                                .next_value::<std::option::Option<std::string::String>>()?
6423                                .unwrap_or_default();
6424                        }
6425                        __FieldTag::__etag => {
6426                            if !fields.insert(__FieldTag::__etag) {
6427                                return std::result::Result::Err(A::Error::duplicate_field(
6428                                    "multiple values for etag",
6429                                ));
6430                            }
6431                            result.etag =
6432                                map.next_value::<std::option::Option<std::string::String>>()?;
6433                        }
6434                        __FieldTag::Unknown(key) => {
6435                            let value = map.next_value::<serde_json::Value>()?;
6436                            result._unknown_fields.insert(key, value);
6437                        }
6438                    }
6439                }
6440                std::result::Result::Ok(result)
6441            }
6442        }
6443        deserializer.deserialize_any(Visitor)
6444    }
6445}
6446
6447#[doc(hidden)]
6448impl serde::ser::Serialize for DeleteServiceConnectionPolicyRequest {
6449    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6450    where
6451        S: serde::ser::Serializer,
6452    {
6453        use serde::ser::SerializeMap;
6454        #[allow(unused_imports)]
6455        use std::option::Option::Some;
6456        let mut state = serializer.serialize_map(std::option::Option::None)?;
6457        if !self.name.is_empty() {
6458            state.serialize_entry("name", &self.name)?;
6459        }
6460        if !self.request_id.is_empty() {
6461            state.serialize_entry("requestId", &self.request_id)?;
6462        }
6463        if self.etag.is_some() {
6464            state.serialize_entry("etag", &self.etag)?;
6465        }
6466        if !self._unknown_fields.is_empty() {
6467            for (key, value) in self._unknown_fields.iter() {
6468                state.serialize_entry(key, &value)?;
6469            }
6470        }
6471        state.end()
6472    }
6473}
6474
6475/// The ServiceClass resource.
6476#[derive(Clone, Debug, Default, PartialEq)]
6477#[non_exhaustive]
6478pub struct ServiceClass {
6479    /// Immutable. The name of a ServiceClass resource.
6480    /// Format:
6481    /// projects/{project}/locations/{location}/serviceClasses/{service_class}
6482    /// See: <https://google.aip.dev/122#fields-representing-resource-names>
6483    pub name: std::string::String,
6484
6485    /// Output only. The generated service class name. Use this name to refer to
6486    /// the Service class in Service Connection Maps and Service Connection
6487    /// Policies.
6488    pub service_class: std::string::String,
6489
6490    /// Output only. Time when the ServiceClass was created.
6491    pub create_time: std::option::Option<wkt::Timestamp>,
6492
6493    /// Output only. Time when the ServiceClass was updated.
6494    pub update_time: std::option::Option<wkt::Timestamp>,
6495
6496    /// User-defined labels.
6497    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6498
6499    /// A description of this resource.
6500    pub description: std::string::String,
6501
6502    /// Optional. The etag is computed by the server, and may be sent on update and
6503    /// delete requests to ensure the client has an up-to-date value before
6504    /// proceeding.
6505    pub etag: std::option::Option<std::string::String>,
6506
6507    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6508}
6509
6510impl ServiceClass {
6511    pub fn new() -> Self {
6512        std::default::Default::default()
6513    }
6514
6515    /// Sets the value of [name][crate::model::ServiceClass::name].
6516    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6517        self.name = v.into();
6518        self
6519    }
6520
6521    /// Sets the value of [service_class][crate::model::ServiceClass::service_class].
6522    pub fn set_service_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6523        self.service_class = v.into();
6524        self
6525    }
6526
6527    /// Sets the value of [create_time][crate::model::ServiceClass::create_time].
6528    pub fn set_create_time<T>(mut self, v: T) -> Self
6529    where
6530        T: std::convert::Into<wkt::Timestamp>,
6531    {
6532        self.create_time = std::option::Option::Some(v.into());
6533        self
6534    }
6535
6536    /// Sets or clears the value of [create_time][crate::model::ServiceClass::create_time].
6537    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6538    where
6539        T: std::convert::Into<wkt::Timestamp>,
6540    {
6541        self.create_time = v.map(|x| x.into());
6542        self
6543    }
6544
6545    /// Sets the value of [update_time][crate::model::ServiceClass::update_time].
6546    pub fn set_update_time<T>(mut self, v: T) -> Self
6547    where
6548        T: std::convert::Into<wkt::Timestamp>,
6549    {
6550        self.update_time = std::option::Option::Some(v.into());
6551        self
6552    }
6553
6554    /// Sets or clears the value of [update_time][crate::model::ServiceClass::update_time].
6555    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
6556    where
6557        T: std::convert::Into<wkt::Timestamp>,
6558    {
6559        self.update_time = v.map(|x| x.into());
6560        self
6561    }
6562
6563    /// Sets the value of [labels][crate::model::ServiceClass::labels].
6564    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6565    where
6566        T: std::iter::IntoIterator<Item = (K, V)>,
6567        K: std::convert::Into<std::string::String>,
6568        V: std::convert::Into<std::string::String>,
6569    {
6570        use std::iter::Iterator;
6571        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6572        self
6573    }
6574
6575    /// Sets the value of [description][crate::model::ServiceClass::description].
6576    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6577        self.description = v.into();
6578        self
6579    }
6580
6581    /// Sets the value of [etag][crate::model::ServiceClass::etag].
6582    pub fn set_etag<T>(mut self, v: T) -> Self
6583    where
6584        T: std::convert::Into<std::string::String>,
6585    {
6586        self.etag = std::option::Option::Some(v.into());
6587        self
6588    }
6589
6590    /// Sets or clears the value of [etag][crate::model::ServiceClass::etag].
6591    pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
6592    where
6593        T: std::convert::Into<std::string::String>,
6594    {
6595        self.etag = v.map(|x| x.into());
6596        self
6597    }
6598}
6599
6600impl wkt::message::Message for ServiceClass {
6601    fn typename() -> &'static str {
6602        "type.googleapis.com/google.cloud.networkconnectivity.v1.ServiceClass"
6603    }
6604}
6605
6606#[doc(hidden)]
6607impl<'de> serde::de::Deserialize<'de> for ServiceClass {
6608    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6609    where
6610        D: serde::Deserializer<'de>,
6611    {
6612        #[allow(non_camel_case_types)]
6613        #[doc(hidden)]
6614        #[derive(PartialEq, Eq, Hash)]
6615        enum __FieldTag {
6616            __name,
6617            __service_class,
6618            __create_time,
6619            __update_time,
6620            __labels,
6621            __description,
6622            __etag,
6623            Unknown(std::string::String),
6624        }
6625        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6626            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6627            where
6628                D: serde::Deserializer<'de>,
6629            {
6630                struct Visitor;
6631                impl<'de> serde::de::Visitor<'de> for Visitor {
6632                    type Value = __FieldTag;
6633                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6634                        formatter.write_str("a field name for ServiceClass")
6635                    }
6636                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6637                    where
6638                        E: serde::de::Error,
6639                    {
6640                        use std::result::Result::Ok;
6641                        use std::string::ToString;
6642                        match value {
6643                            "name" => Ok(__FieldTag::__name),
6644                            "serviceClass" => Ok(__FieldTag::__service_class),
6645                            "service_class" => Ok(__FieldTag::__service_class),
6646                            "createTime" => Ok(__FieldTag::__create_time),
6647                            "create_time" => Ok(__FieldTag::__create_time),
6648                            "updateTime" => Ok(__FieldTag::__update_time),
6649                            "update_time" => Ok(__FieldTag::__update_time),
6650                            "labels" => Ok(__FieldTag::__labels),
6651                            "description" => Ok(__FieldTag::__description),
6652                            "etag" => Ok(__FieldTag::__etag),
6653                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6654                        }
6655                    }
6656                }
6657                deserializer.deserialize_identifier(Visitor)
6658            }
6659        }
6660        struct Visitor;
6661        impl<'de> serde::de::Visitor<'de> for Visitor {
6662            type Value = ServiceClass;
6663            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6664                formatter.write_str("struct ServiceClass")
6665            }
6666            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6667            where
6668                A: serde::de::MapAccess<'de>,
6669            {
6670                #[allow(unused_imports)]
6671                use serde::de::Error;
6672                use std::option::Option::Some;
6673                let mut fields = std::collections::HashSet::new();
6674                let mut result = Self::Value::new();
6675                while let Some(tag) = map.next_key::<__FieldTag>()? {
6676                    #[allow(clippy::match_single_binding)]
6677                    match tag {
6678                        __FieldTag::__name => {
6679                            if !fields.insert(__FieldTag::__name) {
6680                                return std::result::Result::Err(A::Error::duplicate_field(
6681                                    "multiple values for name",
6682                                ));
6683                            }
6684                            result.name = map
6685                                .next_value::<std::option::Option<std::string::String>>()?
6686                                .unwrap_or_default();
6687                        }
6688                        __FieldTag::__service_class => {
6689                            if !fields.insert(__FieldTag::__service_class) {
6690                                return std::result::Result::Err(A::Error::duplicate_field(
6691                                    "multiple values for service_class",
6692                                ));
6693                            }
6694                            result.service_class = map
6695                                .next_value::<std::option::Option<std::string::String>>()?
6696                                .unwrap_or_default();
6697                        }
6698                        __FieldTag::__create_time => {
6699                            if !fields.insert(__FieldTag::__create_time) {
6700                                return std::result::Result::Err(A::Error::duplicate_field(
6701                                    "multiple values for create_time",
6702                                ));
6703                            }
6704                            result.create_time =
6705                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
6706                        }
6707                        __FieldTag::__update_time => {
6708                            if !fields.insert(__FieldTag::__update_time) {
6709                                return std::result::Result::Err(A::Error::duplicate_field(
6710                                    "multiple values for update_time",
6711                                ));
6712                            }
6713                            result.update_time =
6714                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
6715                        }
6716                        __FieldTag::__labels => {
6717                            if !fields.insert(__FieldTag::__labels) {
6718                                return std::result::Result::Err(A::Error::duplicate_field(
6719                                    "multiple values for labels",
6720                                ));
6721                            }
6722                            result.labels = map
6723                                .next_value::<std::option::Option<
6724                                    std::collections::HashMap<
6725                                        std::string::String,
6726                                        std::string::String,
6727                                    >,
6728                                >>()?
6729                                .unwrap_or_default();
6730                        }
6731                        __FieldTag::__description => {
6732                            if !fields.insert(__FieldTag::__description) {
6733                                return std::result::Result::Err(A::Error::duplicate_field(
6734                                    "multiple values for description",
6735                                ));
6736                            }
6737                            result.description = map
6738                                .next_value::<std::option::Option<std::string::String>>()?
6739                                .unwrap_or_default();
6740                        }
6741                        __FieldTag::__etag => {
6742                            if !fields.insert(__FieldTag::__etag) {
6743                                return std::result::Result::Err(A::Error::duplicate_field(
6744                                    "multiple values for etag",
6745                                ));
6746                            }
6747                            result.etag =
6748                                map.next_value::<std::option::Option<std::string::String>>()?;
6749                        }
6750                        __FieldTag::Unknown(key) => {
6751                            let value = map.next_value::<serde_json::Value>()?;
6752                            result._unknown_fields.insert(key, value);
6753                        }
6754                    }
6755                }
6756                std::result::Result::Ok(result)
6757            }
6758        }
6759        deserializer.deserialize_any(Visitor)
6760    }
6761}
6762
6763#[doc(hidden)]
6764impl serde::ser::Serialize for ServiceClass {
6765    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6766    where
6767        S: serde::ser::Serializer,
6768    {
6769        use serde::ser::SerializeMap;
6770        #[allow(unused_imports)]
6771        use std::option::Option::Some;
6772        let mut state = serializer.serialize_map(std::option::Option::None)?;
6773        if !self.name.is_empty() {
6774            state.serialize_entry("name", &self.name)?;
6775        }
6776        if !self.service_class.is_empty() {
6777            state.serialize_entry("serviceClass", &self.service_class)?;
6778        }
6779        if self.create_time.is_some() {
6780            state.serialize_entry("createTime", &self.create_time)?;
6781        }
6782        if self.update_time.is_some() {
6783            state.serialize_entry("updateTime", &self.update_time)?;
6784        }
6785        if !self.labels.is_empty() {
6786            state.serialize_entry("labels", &self.labels)?;
6787        }
6788        if !self.description.is_empty() {
6789            state.serialize_entry("description", &self.description)?;
6790        }
6791        if self.etag.is_some() {
6792            state.serialize_entry("etag", &self.etag)?;
6793        }
6794        if !self._unknown_fields.is_empty() {
6795            for (key, value) in self._unknown_fields.iter() {
6796                state.serialize_entry(key, &value)?;
6797            }
6798        }
6799        state.end()
6800    }
6801}
6802
6803/// Request for ListServiceClasses.
6804#[derive(Clone, Debug, Default, PartialEq)]
6805#[non_exhaustive]
6806pub struct ListServiceClassesRequest {
6807    /// Required. The parent resource's name. ex. projects/123/locations/us-east1
6808    pub parent: std::string::String,
6809
6810    /// The maximum number of results per page that should be returned.
6811    pub page_size: i32,
6812
6813    /// The page token.
6814    pub page_token: std::string::String,
6815
6816    /// A filter expression that filters the results listed in the response.
6817    pub filter: std::string::String,
6818
6819    /// Sort the results by a certain order.
6820    pub order_by: std::string::String,
6821
6822    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6823}
6824
6825impl ListServiceClassesRequest {
6826    pub fn new() -> Self {
6827        std::default::Default::default()
6828    }
6829
6830    /// Sets the value of [parent][crate::model::ListServiceClassesRequest::parent].
6831    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6832        self.parent = v.into();
6833        self
6834    }
6835
6836    /// Sets the value of [page_size][crate::model::ListServiceClassesRequest::page_size].
6837    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6838        self.page_size = v.into();
6839        self
6840    }
6841
6842    /// Sets the value of [page_token][crate::model::ListServiceClassesRequest::page_token].
6843    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6844        self.page_token = v.into();
6845        self
6846    }
6847
6848    /// Sets the value of [filter][crate::model::ListServiceClassesRequest::filter].
6849    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6850        self.filter = v.into();
6851        self
6852    }
6853
6854    /// Sets the value of [order_by][crate::model::ListServiceClassesRequest::order_by].
6855    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6856        self.order_by = v.into();
6857        self
6858    }
6859}
6860
6861impl wkt::message::Message for ListServiceClassesRequest {
6862    fn typename() -> &'static str {
6863        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListServiceClassesRequest"
6864    }
6865}
6866
6867#[doc(hidden)]
6868impl<'de> serde::de::Deserialize<'de> for ListServiceClassesRequest {
6869    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6870    where
6871        D: serde::Deserializer<'de>,
6872    {
6873        #[allow(non_camel_case_types)]
6874        #[doc(hidden)]
6875        #[derive(PartialEq, Eq, Hash)]
6876        enum __FieldTag {
6877            __parent,
6878            __page_size,
6879            __page_token,
6880            __filter,
6881            __order_by,
6882            Unknown(std::string::String),
6883        }
6884        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6885            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6886            where
6887                D: serde::Deserializer<'de>,
6888            {
6889                struct Visitor;
6890                impl<'de> serde::de::Visitor<'de> for Visitor {
6891                    type Value = __FieldTag;
6892                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6893                        formatter.write_str("a field name for ListServiceClassesRequest")
6894                    }
6895                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6896                    where
6897                        E: serde::de::Error,
6898                    {
6899                        use std::result::Result::Ok;
6900                        use std::string::ToString;
6901                        match value {
6902                            "parent" => Ok(__FieldTag::__parent),
6903                            "pageSize" => Ok(__FieldTag::__page_size),
6904                            "page_size" => Ok(__FieldTag::__page_size),
6905                            "pageToken" => Ok(__FieldTag::__page_token),
6906                            "page_token" => Ok(__FieldTag::__page_token),
6907                            "filter" => Ok(__FieldTag::__filter),
6908                            "orderBy" => Ok(__FieldTag::__order_by),
6909                            "order_by" => Ok(__FieldTag::__order_by),
6910                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6911                        }
6912                    }
6913                }
6914                deserializer.deserialize_identifier(Visitor)
6915            }
6916        }
6917        struct Visitor;
6918        impl<'de> serde::de::Visitor<'de> for Visitor {
6919            type Value = ListServiceClassesRequest;
6920            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6921                formatter.write_str("struct ListServiceClassesRequest")
6922            }
6923            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6924            where
6925                A: serde::de::MapAccess<'de>,
6926            {
6927                #[allow(unused_imports)]
6928                use serde::de::Error;
6929                use std::option::Option::Some;
6930                let mut fields = std::collections::HashSet::new();
6931                let mut result = Self::Value::new();
6932                while let Some(tag) = map.next_key::<__FieldTag>()? {
6933                    #[allow(clippy::match_single_binding)]
6934                    match tag {
6935                        __FieldTag::__parent => {
6936                            if !fields.insert(__FieldTag::__parent) {
6937                                return std::result::Result::Err(A::Error::duplicate_field(
6938                                    "multiple values for parent",
6939                                ));
6940                            }
6941                            result.parent = map
6942                                .next_value::<std::option::Option<std::string::String>>()?
6943                                .unwrap_or_default();
6944                        }
6945                        __FieldTag::__page_size => {
6946                            if !fields.insert(__FieldTag::__page_size) {
6947                                return std::result::Result::Err(A::Error::duplicate_field(
6948                                    "multiple values for page_size",
6949                                ));
6950                            }
6951                            struct __With(std::option::Option<i32>);
6952                            impl<'de> serde::de::Deserialize<'de> for __With {
6953                                fn deserialize<D>(
6954                                    deserializer: D,
6955                                ) -> std::result::Result<Self, D::Error>
6956                                where
6957                                    D: serde::de::Deserializer<'de>,
6958                                {
6959                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
6960                                }
6961                            }
6962                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
6963                        }
6964                        __FieldTag::__page_token => {
6965                            if !fields.insert(__FieldTag::__page_token) {
6966                                return std::result::Result::Err(A::Error::duplicate_field(
6967                                    "multiple values for page_token",
6968                                ));
6969                            }
6970                            result.page_token = map
6971                                .next_value::<std::option::Option<std::string::String>>()?
6972                                .unwrap_or_default();
6973                        }
6974                        __FieldTag::__filter => {
6975                            if !fields.insert(__FieldTag::__filter) {
6976                                return std::result::Result::Err(A::Error::duplicate_field(
6977                                    "multiple values for filter",
6978                                ));
6979                            }
6980                            result.filter = map
6981                                .next_value::<std::option::Option<std::string::String>>()?
6982                                .unwrap_or_default();
6983                        }
6984                        __FieldTag::__order_by => {
6985                            if !fields.insert(__FieldTag::__order_by) {
6986                                return std::result::Result::Err(A::Error::duplicate_field(
6987                                    "multiple values for order_by",
6988                                ));
6989                            }
6990                            result.order_by = map
6991                                .next_value::<std::option::Option<std::string::String>>()?
6992                                .unwrap_or_default();
6993                        }
6994                        __FieldTag::Unknown(key) => {
6995                            let value = map.next_value::<serde_json::Value>()?;
6996                            result._unknown_fields.insert(key, value);
6997                        }
6998                    }
6999                }
7000                std::result::Result::Ok(result)
7001            }
7002        }
7003        deserializer.deserialize_any(Visitor)
7004    }
7005}
7006
7007#[doc(hidden)]
7008impl serde::ser::Serialize for ListServiceClassesRequest {
7009    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7010    where
7011        S: serde::ser::Serializer,
7012    {
7013        use serde::ser::SerializeMap;
7014        #[allow(unused_imports)]
7015        use std::option::Option::Some;
7016        let mut state = serializer.serialize_map(std::option::Option::None)?;
7017        if !self.parent.is_empty() {
7018            state.serialize_entry("parent", &self.parent)?;
7019        }
7020        if !wkt::internal::is_default(&self.page_size) {
7021            struct __With<'a>(&'a i32);
7022            impl<'a> serde::ser::Serialize for __With<'a> {
7023                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7024                where
7025                    S: serde::ser::Serializer,
7026                {
7027                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
7028                }
7029            }
7030            state.serialize_entry("pageSize", &__With(&self.page_size))?;
7031        }
7032        if !self.page_token.is_empty() {
7033            state.serialize_entry("pageToken", &self.page_token)?;
7034        }
7035        if !self.filter.is_empty() {
7036            state.serialize_entry("filter", &self.filter)?;
7037        }
7038        if !self.order_by.is_empty() {
7039            state.serialize_entry("orderBy", &self.order_by)?;
7040        }
7041        if !self._unknown_fields.is_empty() {
7042            for (key, value) in self._unknown_fields.iter() {
7043                state.serialize_entry(key, &value)?;
7044            }
7045        }
7046        state.end()
7047    }
7048}
7049
7050/// Response for ListServiceClasses.
7051#[derive(Clone, Debug, Default, PartialEq)]
7052#[non_exhaustive]
7053pub struct ListServiceClassesResponse {
7054    /// ServiceClasses to be returned.
7055    pub service_classes: std::vec::Vec<crate::model::ServiceClass>,
7056
7057    /// The next pagination token in the List response. It should be used as
7058    /// page_token for the following request. An empty value means no more result.
7059    pub next_page_token: std::string::String,
7060
7061    /// Locations that could not be reached.
7062    pub unreachable: std::vec::Vec<std::string::String>,
7063
7064    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7065}
7066
7067impl ListServiceClassesResponse {
7068    pub fn new() -> Self {
7069        std::default::Default::default()
7070    }
7071
7072    /// Sets the value of [service_classes][crate::model::ListServiceClassesResponse::service_classes].
7073    pub fn set_service_classes<T, V>(mut self, v: T) -> Self
7074    where
7075        T: std::iter::IntoIterator<Item = V>,
7076        V: std::convert::Into<crate::model::ServiceClass>,
7077    {
7078        use std::iter::Iterator;
7079        self.service_classes = v.into_iter().map(|i| i.into()).collect();
7080        self
7081    }
7082
7083    /// Sets the value of [next_page_token][crate::model::ListServiceClassesResponse::next_page_token].
7084    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7085        self.next_page_token = v.into();
7086        self
7087    }
7088
7089    /// Sets the value of [unreachable][crate::model::ListServiceClassesResponse::unreachable].
7090    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
7091    where
7092        T: std::iter::IntoIterator<Item = V>,
7093        V: std::convert::Into<std::string::String>,
7094    {
7095        use std::iter::Iterator;
7096        self.unreachable = v.into_iter().map(|i| i.into()).collect();
7097        self
7098    }
7099}
7100
7101impl wkt::message::Message for ListServiceClassesResponse {
7102    fn typename() -> &'static str {
7103        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListServiceClassesResponse"
7104    }
7105}
7106
7107#[doc(hidden)]
7108impl gax::paginator::internal::PageableResponse for ListServiceClassesResponse {
7109    type PageItem = crate::model::ServiceClass;
7110
7111    fn items(self) -> std::vec::Vec<Self::PageItem> {
7112        self.service_classes
7113    }
7114
7115    fn next_page_token(&self) -> std::string::String {
7116        use std::clone::Clone;
7117        self.next_page_token.clone()
7118    }
7119}
7120
7121#[doc(hidden)]
7122impl<'de> serde::de::Deserialize<'de> for ListServiceClassesResponse {
7123    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7124    where
7125        D: serde::Deserializer<'de>,
7126    {
7127        #[allow(non_camel_case_types)]
7128        #[doc(hidden)]
7129        #[derive(PartialEq, Eq, Hash)]
7130        enum __FieldTag {
7131            __service_classes,
7132            __next_page_token,
7133            __unreachable,
7134            Unknown(std::string::String),
7135        }
7136        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7137            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7138            where
7139                D: serde::Deserializer<'de>,
7140            {
7141                struct Visitor;
7142                impl<'de> serde::de::Visitor<'de> for Visitor {
7143                    type Value = __FieldTag;
7144                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7145                        formatter.write_str("a field name for ListServiceClassesResponse")
7146                    }
7147                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7148                    where
7149                        E: serde::de::Error,
7150                    {
7151                        use std::result::Result::Ok;
7152                        use std::string::ToString;
7153                        match value {
7154                            "serviceClasses" => Ok(__FieldTag::__service_classes),
7155                            "service_classes" => Ok(__FieldTag::__service_classes),
7156                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
7157                            "next_page_token" => Ok(__FieldTag::__next_page_token),
7158                            "unreachable" => Ok(__FieldTag::__unreachable),
7159                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7160                        }
7161                    }
7162                }
7163                deserializer.deserialize_identifier(Visitor)
7164            }
7165        }
7166        struct Visitor;
7167        impl<'de> serde::de::Visitor<'de> for Visitor {
7168            type Value = ListServiceClassesResponse;
7169            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7170                formatter.write_str("struct ListServiceClassesResponse")
7171            }
7172            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7173            where
7174                A: serde::de::MapAccess<'de>,
7175            {
7176                #[allow(unused_imports)]
7177                use serde::de::Error;
7178                use std::option::Option::Some;
7179                let mut fields = std::collections::HashSet::new();
7180                let mut result = Self::Value::new();
7181                while let Some(tag) = map.next_key::<__FieldTag>()? {
7182                    #[allow(clippy::match_single_binding)]
7183                    match tag {
7184                        __FieldTag::__service_classes => {
7185                            if !fields.insert(__FieldTag::__service_classes) {
7186                                return std::result::Result::Err(A::Error::duplicate_field(
7187                                    "multiple values for service_classes",
7188                                ));
7189                            }
7190                            result.service_classes = map.next_value::<std::option::Option<std::vec::Vec<crate::model::ServiceClass>>>()?.unwrap_or_default();
7191                        }
7192                        __FieldTag::__next_page_token => {
7193                            if !fields.insert(__FieldTag::__next_page_token) {
7194                                return std::result::Result::Err(A::Error::duplicate_field(
7195                                    "multiple values for next_page_token",
7196                                ));
7197                            }
7198                            result.next_page_token = map
7199                                .next_value::<std::option::Option<std::string::String>>()?
7200                                .unwrap_or_default();
7201                        }
7202                        __FieldTag::__unreachable => {
7203                            if !fields.insert(__FieldTag::__unreachable) {
7204                                return std::result::Result::Err(A::Error::duplicate_field(
7205                                    "multiple values for unreachable",
7206                                ));
7207                            }
7208                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
7209                        }
7210                        __FieldTag::Unknown(key) => {
7211                            let value = map.next_value::<serde_json::Value>()?;
7212                            result._unknown_fields.insert(key, value);
7213                        }
7214                    }
7215                }
7216                std::result::Result::Ok(result)
7217            }
7218        }
7219        deserializer.deserialize_any(Visitor)
7220    }
7221}
7222
7223#[doc(hidden)]
7224impl serde::ser::Serialize for ListServiceClassesResponse {
7225    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7226    where
7227        S: serde::ser::Serializer,
7228    {
7229        use serde::ser::SerializeMap;
7230        #[allow(unused_imports)]
7231        use std::option::Option::Some;
7232        let mut state = serializer.serialize_map(std::option::Option::None)?;
7233        if !self.service_classes.is_empty() {
7234            state.serialize_entry("serviceClasses", &self.service_classes)?;
7235        }
7236        if !self.next_page_token.is_empty() {
7237            state.serialize_entry("nextPageToken", &self.next_page_token)?;
7238        }
7239        if !self.unreachable.is_empty() {
7240            state.serialize_entry("unreachable", &self.unreachable)?;
7241        }
7242        if !self._unknown_fields.is_empty() {
7243            for (key, value) in self._unknown_fields.iter() {
7244                state.serialize_entry(key, &value)?;
7245            }
7246        }
7247        state.end()
7248    }
7249}
7250
7251/// Request for GetServiceClass.
7252#[derive(Clone, Debug, Default, PartialEq)]
7253#[non_exhaustive]
7254pub struct GetServiceClassRequest {
7255    /// Required. Name of the ServiceClass to get.
7256    pub name: std::string::String,
7257
7258    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7259}
7260
7261impl GetServiceClassRequest {
7262    pub fn new() -> Self {
7263        std::default::Default::default()
7264    }
7265
7266    /// Sets the value of [name][crate::model::GetServiceClassRequest::name].
7267    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7268        self.name = v.into();
7269        self
7270    }
7271}
7272
7273impl wkt::message::Message for GetServiceClassRequest {
7274    fn typename() -> &'static str {
7275        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetServiceClassRequest"
7276    }
7277}
7278
7279#[doc(hidden)]
7280impl<'de> serde::de::Deserialize<'de> for GetServiceClassRequest {
7281    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7282    where
7283        D: serde::Deserializer<'de>,
7284    {
7285        #[allow(non_camel_case_types)]
7286        #[doc(hidden)]
7287        #[derive(PartialEq, Eq, Hash)]
7288        enum __FieldTag {
7289            __name,
7290            Unknown(std::string::String),
7291        }
7292        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7293            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7294            where
7295                D: serde::Deserializer<'de>,
7296            {
7297                struct Visitor;
7298                impl<'de> serde::de::Visitor<'de> for Visitor {
7299                    type Value = __FieldTag;
7300                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7301                        formatter.write_str("a field name for GetServiceClassRequest")
7302                    }
7303                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7304                    where
7305                        E: serde::de::Error,
7306                    {
7307                        use std::result::Result::Ok;
7308                        use std::string::ToString;
7309                        match value {
7310                            "name" => Ok(__FieldTag::__name),
7311                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7312                        }
7313                    }
7314                }
7315                deserializer.deserialize_identifier(Visitor)
7316            }
7317        }
7318        struct Visitor;
7319        impl<'de> serde::de::Visitor<'de> for Visitor {
7320            type Value = GetServiceClassRequest;
7321            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7322                formatter.write_str("struct GetServiceClassRequest")
7323            }
7324            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7325            where
7326                A: serde::de::MapAccess<'de>,
7327            {
7328                #[allow(unused_imports)]
7329                use serde::de::Error;
7330                use std::option::Option::Some;
7331                let mut fields = std::collections::HashSet::new();
7332                let mut result = Self::Value::new();
7333                while let Some(tag) = map.next_key::<__FieldTag>()? {
7334                    #[allow(clippy::match_single_binding)]
7335                    match tag {
7336                        __FieldTag::__name => {
7337                            if !fields.insert(__FieldTag::__name) {
7338                                return std::result::Result::Err(A::Error::duplicate_field(
7339                                    "multiple values for name",
7340                                ));
7341                            }
7342                            result.name = map
7343                                .next_value::<std::option::Option<std::string::String>>()?
7344                                .unwrap_or_default();
7345                        }
7346                        __FieldTag::Unknown(key) => {
7347                            let value = map.next_value::<serde_json::Value>()?;
7348                            result._unknown_fields.insert(key, value);
7349                        }
7350                    }
7351                }
7352                std::result::Result::Ok(result)
7353            }
7354        }
7355        deserializer.deserialize_any(Visitor)
7356    }
7357}
7358
7359#[doc(hidden)]
7360impl serde::ser::Serialize for GetServiceClassRequest {
7361    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7362    where
7363        S: serde::ser::Serializer,
7364    {
7365        use serde::ser::SerializeMap;
7366        #[allow(unused_imports)]
7367        use std::option::Option::Some;
7368        let mut state = serializer.serialize_map(std::option::Option::None)?;
7369        if !self.name.is_empty() {
7370            state.serialize_entry("name", &self.name)?;
7371        }
7372        if !self._unknown_fields.is_empty() {
7373            for (key, value) in self._unknown_fields.iter() {
7374                state.serialize_entry(key, &value)?;
7375            }
7376        }
7377        state.end()
7378    }
7379}
7380
7381/// Request for UpdateServiceClass.
7382#[derive(Clone, Debug, Default, PartialEq)]
7383#[non_exhaustive]
7384pub struct UpdateServiceClassRequest {
7385    /// Optional. Field mask is used to specify the fields to be overwritten in the
7386    /// ServiceClass resource by the update.
7387    /// The fields specified in the update_mask are relative to the resource, not
7388    /// the full request. A field will be overwritten if it is in the mask. If the
7389    /// user does not provide a mask then all fields will be overwritten.
7390    pub update_mask: std::option::Option<wkt::FieldMask>,
7391
7392    /// Required. New values to be patched into the resource.
7393    pub service_class: std::option::Option<crate::model::ServiceClass>,
7394
7395    /// Optional. An optional request ID to identify requests. Specify a unique
7396    /// request ID so that if you must retry your request, the server will know to
7397    /// ignore the request if it has already been completed. The server will
7398    /// guarantee that for at least 60 minutes since the first request.
7399    ///
7400    /// For example, consider a situation where you make an initial request and
7401    /// the request times out. If you make the request again with the same request
7402    /// ID, the server can check if original operation with the same request ID
7403    /// was received, and if so, will ignore the second request. This prevents
7404    /// clients from accidentally creating duplicate commitments.
7405    ///
7406    /// The request ID must be a valid UUID with the exception that zero UUID is
7407    /// not supported (00000000-0000-0000-0000-000000000000).
7408    pub request_id: std::string::String,
7409
7410    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7411}
7412
7413impl UpdateServiceClassRequest {
7414    pub fn new() -> Self {
7415        std::default::Default::default()
7416    }
7417
7418    /// Sets the value of [update_mask][crate::model::UpdateServiceClassRequest::update_mask].
7419    pub fn set_update_mask<T>(mut self, v: T) -> Self
7420    where
7421        T: std::convert::Into<wkt::FieldMask>,
7422    {
7423        self.update_mask = std::option::Option::Some(v.into());
7424        self
7425    }
7426
7427    /// Sets or clears the value of [update_mask][crate::model::UpdateServiceClassRequest::update_mask].
7428    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7429    where
7430        T: std::convert::Into<wkt::FieldMask>,
7431    {
7432        self.update_mask = v.map(|x| x.into());
7433        self
7434    }
7435
7436    /// Sets the value of [service_class][crate::model::UpdateServiceClassRequest::service_class].
7437    pub fn set_service_class<T>(mut self, v: T) -> Self
7438    where
7439        T: std::convert::Into<crate::model::ServiceClass>,
7440    {
7441        self.service_class = std::option::Option::Some(v.into());
7442        self
7443    }
7444
7445    /// Sets or clears the value of [service_class][crate::model::UpdateServiceClassRequest::service_class].
7446    pub fn set_or_clear_service_class<T>(mut self, v: std::option::Option<T>) -> Self
7447    where
7448        T: std::convert::Into<crate::model::ServiceClass>,
7449    {
7450        self.service_class = v.map(|x| x.into());
7451        self
7452    }
7453
7454    /// Sets the value of [request_id][crate::model::UpdateServiceClassRequest::request_id].
7455    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7456        self.request_id = v.into();
7457        self
7458    }
7459}
7460
7461impl wkt::message::Message for UpdateServiceClassRequest {
7462    fn typename() -> &'static str {
7463        "type.googleapis.com/google.cloud.networkconnectivity.v1.UpdateServiceClassRequest"
7464    }
7465}
7466
7467#[doc(hidden)]
7468impl<'de> serde::de::Deserialize<'de> for UpdateServiceClassRequest {
7469    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7470    where
7471        D: serde::Deserializer<'de>,
7472    {
7473        #[allow(non_camel_case_types)]
7474        #[doc(hidden)]
7475        #[derive(PartialEq, Eq, Hash)]
7476        enum __FieldTag {
7477            __update_mask,
7478            __service_class,
7479            __request_id,
7480            Unknown(std::string::String),
7481        }
7482        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7483            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7484            where
7485                D: serde::Deserializer<'de>,
7486            {
7487                struct Visitor;
7488                impl<'de> serde::de::Visitor<'de> for Visitor {
7489                    type Value = __FieldTag;
7490                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7491                        formatter.write_str("a field name for UpdateServiceClassRequest")
7492                    }
7493                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7494                    where
7495                        E: serde::de::Error,
7496                    {
7497                        use std::result::Result::Ok;
7498                        use std::string::ToString;
7499                        match value {
7500                            "updateMask" => Ok(__FieldTag::__update_mask),
7501                            "update_mask" => Ok(__FieldTag::__update_mask),
7502                            "serviceClass" => Ok(__FieldTag::__service_class),
7503                            "service_class" => Ok(__FieldTag::__service_class),
7504                            "requestId" => Ok(__FieldTag::__request_id),
7505                            "request_id" => Ok(__FieldTag::__request_id),
7506                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7507                        }
7508                    }
7509                }
7510                deserializer.deserialize_identifier(Visitor)
7511            }
7512        }
7513        struct Visitor;
7514        impl<'de> serde::de::Visitor<'de> for Visitor {
7515            type Value = UpdateServiceClassRequest;
7516            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7517                formatter.write_str("struct UpdateServiceClassRequest")
7518            }
7519            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7520            where
7521                A: serde::de::MapAccess<'de>,
7522            {
7523                #[allow(unused_imports)]
7524                use serde::de::Error;
7525                use std::option::Option::Some;
7526                let mut fields = std::collections::HashSet::new();
7527                let mut result = Self::Value::new();
7528                while let Some(tag) = map.next_key::<__FieldTag>()? {
7529                    #[allow(clippy::match_single_binding)]
7530                    match tag {
7531                        __FieldTag::__update_mask => {
7532                            if !fields.insert(__FieldTag::__update_mask) {
7533                                return std::result::Result::Err(A::Error::duplicate_field(
7534                                    "multiple values for update_mask",
7535                                ));
7536                            }
7537                            result.update_mask =
7538                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
7539                        }
7540                        __FieldTag::__service_class => {
7541                            if !fields.insert(__FieldTag::__service_class) {
7542                                return std::result::Result::Err(A::Error::duplicate_field(
7543                                    "multiple values for service_class",
7544                                ));
7545                            }
7546                            result.service_class = map
7547                                .next_value::<std::option::Option<crate::model::ServiceClass>>()?;
7548                        }
7549                        __FieldTag::__request_id => {
7550                            if !fields.insert(__FieldTag::__request_id) {
7551                                return std::result::Result::Err(A::Error::duplicate_field(
7552                                    "multiple values for request_id",
7553                                ));
7554                            }
7555                            result.request_id = map
7556                                .next_value::<std::option::Option<std::string::String>>()?
7557                                .unwrap_or_default();
7558                        }
7559                        __FieldTag::Unknown(key) => {
7560                            let value = map.next_value::<serde_json::Value>()?;
7561                            result._unknown_fields.insert(key, value);
7562                        }
7563                    }
7564                }
7565                std::result::Result::Ok(result)
7566            }
7567        }
7568        deserializer.deserialize_any(Visitor)
7569    }
7570}
7571
7572#[doc(hidden)]
7573impl serde::ser::Serialize for UpdateServiceClassRequest {
7574    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7575    where
7576        S: serde::ser::Serializer,
7577    {
7578        use serde::ser::SerializeMap;
7579        #[allow(unused_imports)]
7580        use std::option::Option::Some;
7581        let mut state = serializer.serialize_map(std::option::Option::None)?;
7582        if self.update_mask.is_some() {
7583            state.serialize_entry("updateMask", &self.update_mask)?;
7584        }
7585        if self.service_class.is_some() {
7586            state.serialize_entry("serviceClass", &self.service_class)?;
7587        }
7588        if !self.request_id.is_empty() {
7589            state.serialize_entry("requestId", &self.request_id)?;
7590        }
7591        if !self._unknown_fields.is_empty() {
7592            for (key, value) in self._unknown_fields.iter() {
7593                state.serialize_entry(key, &value)?;
7594            }
7595        }
7596        state.end()
7597    }
7598}
7599
7600/// Request for DeleteServiceClass.
7601#[derive(Clone, Debug, Default, PartialEq)]
7602#[non_exhaustive]
7603pub struct DeleteServiceClassRequest {
7604    /// Required. The name of the ServiceClass to delete.
7605    pub name: std::string::String,
7606
7607    /// Optional. An optional request ID to identify requests. Specify a unique
7608    /// request ID so that if you must retry your request, the server will know to
7609    /// ignore the request if it has already been completed. The server will
7610    /// guarantee that for at least 60 minutes after the first request.
7611    ///
7612    /// For example, consider a situation where you make an initial request and
7613    /// the request times out. If you make the request again with the same request
7614    /// ID, the server can check if original operation with the same request ID
7615    /// was received, and if so, will ignore the second request. This prevents
7616    /// clients from accidentally creating duplicate commitments.
7617    ///
7618    /// The request ID must be a valid UUID with the exception that zero UUID is
7619    /// not supported (00000000-0000-0000-0000-000000000000).
7620    pub request_id: std::string::String,
7621
7622    /// Optional. The etag is computed by the server, and may be sent on update and
7623    /// delete requests to ensure the client has an up-to-date value before
7624    /// proceeding.
7625    pub etag: std::option::Option<std::string::String>,
7626
7627    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7628}
7629
7630impl DeleteServiceClassRequest {
7631    pub fn new() -> Self {
7632        std::default::Default::default()
7633    }
7634
7635    /// Sets the value of [name][crate::model::DeleteServiceClassRequest::name].
7636    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7637        self.name = v.into();
7638        self
7639    }
7640
7641    /// Sets the value of [request_id][crate::model::DeleteServiceClassRequest::request_id].
7642    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7643        self.request_id = v.into();
7644        self
7645    }
7646
7647    /// Sets the value of [etag][crate::model::DeleteServiceClassRequest::etag].
7648    pub fn set_etag<T>(mut self, v: T) -> Self
7649    where
7650        T: std::convert::Into<std::string::String>,
7651    {
7652        self.etag = std::option::Option::Some(v.into());
7653        self
7654    }
7655
7656    /// Sets or clears the value of [etag][crate::model::DeleteServiceClassRequest::etag].
7657    pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
7658    where
7659        T: std::convert::Into<std::string::String>,
7660    {
7661        self.etag = v.map(|x| x.into());
7662        self
7663    }
7664}
7665
7666impl wkt::message::Message for DeleteServiceClassRequest {
7667    fn typename() -> &'static str {
7668        "type.googleapis.com/google.cloud.networkconnectivity.v1.DeleteServiceClassRequest"
7669    }
7670}
7671
7672#[doc(hidden)]
7673impl<'de> serde::de::Deserialize<'de> for DeleteServiceClassRequest {
7674    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7675    where
7676        D: serde::Deserializer<'de>,
7677    {
7678        #[allow(non_camel_case_types)]
7679        #[doc(hidden)]
7680        #[derive(PartialEq, Eq, Hash)]
7681        enum __FieldTag {
7682            __name,
7683            __request_id,
7684            __etag,
7685            Unknown(std::string::String),
7686        }
7687        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7688            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7689            where
7690                D: serde::Deserializer<'de>,
7691            {
7692                struct Visitor;
7693                impl<'de> serde::de::Visitor<'de> for Visitor {
7694                    type Value = __FieldTag;
7695                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7696                        formatter.write_str("a field name for DeleteServiceClassRequest")
7697                    }
7698                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7699                    where
7700                        E: serde::de::Error,
7701                    {
7702                        use std::result::Result::Ok;
7703                        use std::string::ToString;
7704                        match value {
7705                            "name" => Ok(__FieldTag::__name),
7706                            "requestId" => Ok(__FieldTag::__request_id),
7707                            "request_id" => Ok(__FieldTag::__request_id),
7708                            "etag" => Ok(__FieldTag::__etag),
7709                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7710                        }
7711                    }
7712                }
7713                deserializer.deserialize_identifier(Visitor)
7714            }
7715        }
7716        struct Visitor;
7717        impl<'de> serde::de::Visitor<'de> for Visitor {
7718            type Value = DeleteServiceClassRequest;
7719            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7720                formatter.write_str("struct DeleteServiceClassRequest")
7721            }
7722            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7723            where
7724                A: serde::de::MapAccess<'de>,
7725            {
7726                #[allow(unused_imports)]
7727                use serde::de::Error;
7728                use std::option::Option::Some;
7729                let mut fields = std::collections::HashSet::new();
7730                let mut result = Self::Value::new();
7731                while let Some(tag) = map.next_key::<__FieldTag>()? {
7732                    #[allow(clippy::match_single_binding)]
7733                    match tag {
7734                        __FieldTag::__name => {
7735                            if !fields.insert(__FieldTag::__name) {
7736                                return std::result::Result::Err(A::Error::duplicate_field(
7737                                    "multiple values for name",
7738                                ));
7739                            }
7740                            result.name = map
7741                                .next_value::<std::option::Option<std::string::String>>()?
7742                                .unwrap_or_default();
7743                        }
7744                        __FieldTag::__request_id => {
7745                            if !fields.insert(__FieldTag::__request_id) {
7746                                return std::result::Result::Err(A::Error::duplicate_field(
7747                                    "multiple values for request_id",
7748                                ));
7749                            }
7750                            result.request_id = map
7751                                .next_value::<std::option::Option<std::string::String>>()?
7752                                .unwrap_or_default();
7753                        }
7754                        __FieldTag::__etag => {
7755                            if !fields.insert(__FieldTag::__etag) {
7756                                return std::result::Result::Err(A::Error::duplicate_field(
7757                                    "multiple values for etag",
7758                                ));
7759                            }
7760                            result.etag =
7761                                map.next_value::<std::option::Option<std::string::String>>()?;
7762                        }
7763                        __FieldTag::Unknown(key) => {
7764                            let value = map.next_value::<serde_json::Value>()?;
7765                            result._unknown_fields.insert(key, value);
7766                        }
7767                    }
7768                }
7769                std::result::Result::Ok(result)
7770            }
7771        }
7772        deserializer.deserialize_any(Visitor)
7773    }
7774}
7775
7776#[doc(hidden)]
7777impl serde::ser::Serialize for DeleteServiceClassRequest {
7778    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7779    where
7780        S: serde::ser::Serializer,
7781    {
7782        use serde::ser::SerializeMap;
7783        #[allow(unused_imports)]
7784        use std::option::Option::Some;
7785        let mut state = serializer.serialize_map(std::option::Option::None)?;
7786        if !self.name.is_empty() {
7787            state.serialize_entry("name", &self.name)?;
7788        }
7789        if !self.request_id.is_empty() {
7790            state.serialize_entry("requestId", &self.request_id)?;
7791        }
7792        if self.etag.is_some() {
7793            state.serialize_entry("etag", &self.etag)?;
7794        }
7795        if !self._unknown_fields.is_empty() {
7796            for (key, value) in self._unknown_fields.iter() {
7797                state.serialize_entry(key, &value)?;
7798            }
7799        }
7800        state.end()
7801    }
7802}
7803
7804/// The ServiceConnectionToken resource.
7805#[derive(Clone, Debug, Default, PartialEq)]
7806#[non_exhaustive]
7807pub struct ServiceConnectionToken {
7808    /// Immutable. The name of a ServiceConnectionToken.
7809    /// Format:
7810    /// projects/{project}/locations/{location}/ServiceConnectionTokens/{service_connection_token}
7811    /// See: <https://google.aip.dev/122#fields-representing-resource-names>
7812    pub name: std::string::String,
7813
7814    /// Output only. Time when the ServiceConnectionToken was created.
7815    pub create_time: std::option::Option<wkt::Timestamp>,
7816
7817    /// Output only. Time when the ServiceConnectionToken was updated.
7818    pub update_time: std::option::Option<wkt::Timestamp>,
7819
7820    /// User-defined labels.
7821    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
7822
7823    /// A description of this resource.
7824    pub description: std::string::String,
7825
7826    /// The resource path of the network associated with this token.
7827    /// Example:
7828    /// projects/{projectNumOrId}/global/networks/{resourceId}.
7829    pub network: std::string::String,
7830
7831    /// Output only. The token generated by Automation.
7832    pub token: std::string::String,
7833
7834    /// Output only. The time to which this token is valid.
7835    pub expire_time: std::option::Option<wkt::Timestamp>,
7836
7837    /// Optional. The etag is computed by the server, and may be sent on update and
7838    /// delete requests to ensure the client has an up-to-date value before
7839    /// proceeding.
7840    pub etag: std::option::Option<std::string::String>,
7841
7842    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7843}
7844
7845impl ServiceConnectionToken {
7846    pub fn new() -> Self {
7847        std::default::Default::default()
7848    }
7849
7850    /// Sets the value of [name][crate::model::ServiceConnectionToken::name].
7851    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7852        self.name = v.into();
7853        self
7854    }
7855
7856    /// Sets the value of [create_time][crate::model::ServiceConnectionToken::create_time].
7857    pub fn set_create_time<T>(mut self, v: T) -> Self
7858    where
7859        T: std::convert::Into<wkt::Timestamp>,
7860    {
7861        self.create_time = std::option::Option::Some(v.into());
7862        self
7863    }
7864
7865    /// Sets or clears the value of [create_time][crate::model::ServiceConnectionToken::create_time].
7866    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7867    where
7868        T: std::convert::Into<wkt::Timestamp>,
7869    {
7870        self.create_time = v.map(|x| x.into());
7871        self
7872    }
7873
7874    /// Sets the value of [update_time][crate::model::ServiceConnectionToken::update_time].
7875    pub fn set_update_time<T>(mut self, v: T) -> Self
7876    where
7877        T: std::convert::Into<wkt::Timestamp>,
7878    {
7879        self.update_time = std::option::Option::Some(v.into());
7880        self
7881    }
7882
7883    /// Sets or clears the value of [update_time][crate::model::ServiceConnectionToken::update_time].
7884    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
7885    where
7886        T: std::convert::Into<wkt::Timestamp>,
7887    {
7888        self.update_time = v.map(|x| x.into());
7889        self
7890    }
7891
7892    /// Sets the value of [labels][crate::model::ServiceConnectionToken::labels].
7893    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7894    where
7895        T: std::iter::IntoIterator<Item = (K, V)>,
7896        K: std::convert::Into<std::string::String>,
7897        V: std::convert::Into<std::string::String>,
7898    {
7899        use std::iter::Iterator;
7900        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7901        self
7902    }
7903
7904    /// Sets the value of [description][crate::model::ServiceConnectionToken::description].
7905    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7906        self.description = v.into();
7907        self
7908    }
7909
7910    /// Sets the value of [network][crate::model::ServiceConnectionToken::network].
7911    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7912        self.network = v.into();
7913        self
7914    }
7915
7916    /// Sets the value of [token][crate::model::ServiceConnectionToken::token].
7917    pub fn set_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7918        self.token = v.into();
7919        self
7920    }
7921
7922    /// Sets the value of [expire_time][crate::model::ServiceConnectionToken::expire_time].
7923    pub fn set_expire_time<T>(mut self, v: T) -> Self
7924    where
7925        T: std::convert::Into<wkt::Timestamp>,
7926    {
7927        self.expire_time = std::option::Option::Some(v.into());
7928        self
7929    }
7930
7931    /// Sets or clears the value of [expire_time][crate::model::ServiceConnectionToken::expire_time].
7932    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
7933    where
7934        T: std::convert::Into<wkt::Timestamp>,
7935    {
7936        self.expire_time = v.map(|x| x.into());
7937        self
7938    }
7939
7940    /// Sets the value of [etag][crate::model::ServiceConnectionToken::etag].
7941    pub fn set_etag<T>(mut self, v: T) -> Self
7942    where
7943        T: std::convert::Into<std::string::String>,
7944    {
7945        self.etag = std::option::Option::Some(v.into());
7946        self
7947    }
7948
7949    /// Sets or clears the value of [etag][crate::model::ServiceConnectionToken::etag].
7950    pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
7951    where
7952        T: std::convert::Into<std::string::String>,
7953    {
7954        self.etag = v.map(|x| x.into());
7955        self
7956    }
7957}
7958
7959impl wkt::message::Message for ServiceConnectionToken {
7960    fn typename() -> &'static str {
7961        "type.googleapis.com/google.cloud.networkconnectivity.v1.ServiceConnectionToken"
7962    }
7963}
7964
7965#[doc(hidden)]
7966impl<'de> serde::de::Deserialize<'de> for ServiceConnectionToken {
7967    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7968    where
7969        D: serde::Deserializer<'de>,
7970    {
7971        #[allow(non_camel_case_types)]
7972        #[doc(hidden)]
7973        #[derive(PartialEq, Eq, Hash)]
7974        enum __FieldTag {
7975            __name,
7976            __create_time,
7977            __update_time,
7978            __labels,
7979            __description,
7980            __network,
7981            __token,
7982            __expire_time,
7983            __etag,
7984            Unknown(std::string::String),
7985        }
7986        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7987            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7988            where
7989                D: serde::Deserializer<'de>,
7990            {
7991                struct Visitor;
7992                impl<'de> serde::de::Visitor<'de> for Visitor {
7993                    type Value = __FieldTag;
7994                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7995                        formatter.write_str("a field name for ServiceConnectionToken")
7996                    }
7997                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7998                    where
7999                        E: serde::de::Error,
8000                    {
8001                        use std::result::Result::Ok;
8002                        use std::string::ToString;
8003                        match value {
8004                            "name" => Ok(__FieldTag::__name),
8005                            "createTime" => Ok(__FieldTag::__create_time),
8006                            "create_time" => Ok(__FieldTag::__create_time),
8007                            "updateTime" => Ok(__FieldTag::__update_time),
8008                            "update_time" => Ok(__FieldTag::__update_time),
8009                            "labels" => Ok(__FieldTag::__labels),
8010                            "description" => Ok(__FieldTag::__description),
8011                            "network" => Ok(__FieldTag::__network),
8012                            "token" => Ok(__FieldTag::__token),
8013                            "expireTime" => Ok(__FieldTag::__expire_time),
8014                            "expire_time" => Ok(__FieldTag::__expire_time),
8015                            "etag" => Ok(__FieldTag::__etag),
8016                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8017                        }
8018                    }
8019                }
8020                deserializer.deserialize_identifier(Visitor)
8021            }
8022        }
8023        struct Visitor;
8024        impl<'de> serde::de::Visitor<'de> for Visitor {
8025            type Value = ServiceConnectionToken;
8026            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8027                formatter.write_str("struct ServiceConnectionToken")
8028            }
8029            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8030            where
8031                A: serde::de::MapAccess<'de>,
8032            {
8033                #[allow(unused_imports)]
8034                use serde::de::Error;
8035                use std::option::Option::Some;
8036                let mut fields = std::collections::HashSet::new();
8037                let mut result = Self::Value::new();
8038                while let Some(tag) = map.next_key::<__FieldTag>()? {
8039                    #[allow(clippy::match_single_binding)]
8040                    match tag {
8041                        __FieldTag::__name => {
8042                            if !fields.insert(__FieldTag::__name) {
8043                                return std::result::Result::Err(A::Error::duplicate_field(
8044                                    "multiple values for name",
8045                                ));
8046                            }
8047                            result.name = map
8048                                .next_value::<std::option::Option<std::string::String>>()?
8049                                .unwrap_or_default();
8050                        }
8051                        __FieldTag::__create_time => {
8052                            if !fields.insert(__FieldTag::__create_time) {
8053                                return std::result::Result::Err(A::Error::duplicate_field(
8054                                    "multiple values for create_time",
8055                                ));
8056                            }
8057                            result.create_time =
8058                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
8059                        }
8060                        __FieldTag::__update_time => {
8061                            if !fields.insert(__FieldTag::__update_time) {
8062                                return std::result::Result::Err(A::Error::duplicate_field(
8063                                    "multiple values for update_time",
8064                                ));
8065                            }
8066                            result.update_time =
8067                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
8068                        }
8069                        __FieldTag::__labels => {
8070                            if !fields.insert(__FieldTag::__labels) {
8071                                return std::result::Result::Err(A::Error::duplicate_field(
8072                                    "multiple values for labels",
8073                                ));
8074                            }
8075                            result.labels = map
8076                                .next_value::<std::option::Option<
8077                                    std::collections::HashMap<
8078                                        std::string::String,
8079                                        std::string::String,
8080                                    >,
8081                                >>()?
8082                                .unwrap_or_default();
8083                        }
8084                        __FieldTag::__description => {
8085                            if !fields.insert(__FieldTag::__description) {
8086                                return std::result::Result::Err(A::Error::duplicate_field(
8087                                    "multiple values for description",
8088                                ));
8089                            }
8090                            result.description = map
8091                                .next_value::<std::option::Option<std::string::String>>()?
8092                                .unwrap_or_default();
8093                        }
8094                        __FieldTag::__network => {
8095                            if !fields.insert(__FieldTag::__network) {
8096                                return std::result::Result::Err(A::Error::duplicate_field(
8097                                    "multiple values for network",
8098                                ));
8099                            }
8100                            result.network = map
8101                                .next_value::<std::option::Option<std::string::String>>()?
8102                                .unwrap_or_default();
8103                        }
8104                        __FieldTag::__token => {
8105                            if !fields.insert(__FieldTag::__token) {
8106                                return std::result::Result::Err(A::Error::duplicate_field(
8107                                    "multiple values for token",
8108                                ));
8109                            }
8110                            result.token = map
8111                                .next_value::<std::option::Option<std::string::String>>()?
8112                                .unwrap_or_default();
8113                        }
8114                        __FieldTag::__expire_time => {
8115                            if !fields.insert(__FieldTag::__expire_time) {
8116                                return std::result::Result::Err(A::Error::duplicate_field(
8117                                    "multiple values for expire_time",
8118                                ));
8119                            }
8120                            result.expire_time =
8121                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
8122                        }
8123                        __FieldTag::__etag => {
8124                            if !fields.insert(__FieldTag::__etag) {
8125                                return std::result::Result::Err(A::Error::duplicate_field(
8126                                    "multiple values for etag",
8127                                ));
8128                            }
8129                            result.etag =
8130                                map.next_value::<std::option::Option<std::string::String>>()?;
8131                        }
8132                        __FieldTag::Unknown(key) => {
8133                            let value = map.next_value::<serde_json::Value>()?;
8134                            result._unknown_fields.insert(key, value);
8135                        }
8136                    }
8137                }
8138                std::result::Result::Ok(result)
8139            }
8140        }
8141        deserializer.deserialize_any(Visitor)
8142    }
8143}
8144
8145#[doc(hidden)]
8146impl serde::ser::Serialize for ServiceConnectionToken {
8147    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8148    where
8149        S: serde::ser::Serializer,
8150    {
8151        use serde::ser::SerializeMap;
8152        #[allow(unused_imports)]
8153        use std::option::Option::Some;
8154        let mut state = serializer.serialize_map(std::option::Option::None)?;
8155        if !self.name.is_empty() {
8156            state.serialize_entry("name", &self.name)?;
8157        }
8158        if self.create_time.is_some() {
8159            state.serialize_entry("createTime", &self.create_time)?;
8160        }
8161        if self.update_time.is_some() {
8162            state.serialize_entry("updateTime", &self.update_time)?;
8163        }
8164        if !self.labels.is_empty() {
8165            state.serialize_entry("labels", &self.labels)?;
8166        }
8167        if !self.description.is_empty() {
8168            state.serialize_entry("description", &self.description)?;
8169        }
8170        if !self.network.is_empty() {
8171            state.serialize_entry("network", &self.network)?;
8172        }
8173        if !self.token.is_empty() {
8174            state.serialize_entry("token", &self.token)?;
8175        }
8176        if self.expire_time.is_some() {
8177            state.serialize_entry("expireTime", &self.expire_time)?;
8178        }
8179        if self.etag.is_some() {
8180            state.serialize_entry("etag", &self.etag)?;
8181        }
8182        if !self._unknown_fields.is_empty() {
8183            for (key, value) in self._unknown_fields.iter() {
8184                state.serialize_entry(key, &value)?;
8185            }
8186        }
8187        state.end()
8188    }
8189}
8190
8191/// Request for ListServiceConnectionTokens.
8192#[derive(Clone, Debug, Default, PartialEq)]
8193#[non_exhaustive]
8194pub struct ListServiceConnectionTokensRequest {
8195    /// Required. The parent resource's name. ex. projects/123/locations/us-east1
8196    pub parent: std::string::String,
8197
8198    /// The maximum number of results per page that should be returned.
8199    pub page_size: i32,
8200
8201    /// The page token.
8202    pub page_token: std::string::String,
8203
8204    /// A filter expression that filters the results listed in the response.
8205    pub filter: std::string::String,
8206
8207    /// Sort the results by a certain order.
8208    pub order_by: std::string::String,
8209
8210    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8211}
8212
8213impl ListServiceConnectionTokensRequest {
8214    pub fn new() -> Self {
8215        std::default::Default::default()
8216    }
8217
8218    /// Sets the value of [parent][crate::model::ListServiceConnectionTokensRequest::parent].
8219    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8220        self.parent = v.into();
8221        self
8222    }
8223
8224    /// Sets the value of [page_size][crate::model::ListServiceConnectionTokensRequest::page_size].
8225    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8226        self.page_size = v.into();
8227        self
8228    }
8229
8230    /// Sets the value of [page_token][crate::model::ListServiceConnectionTokensRequest::page_token].
8231    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8232        self.page_token = v.into();
8233        self
8234    }
8235
8236    /// Sets the value of [filter][crate::model::ListServiceConnectionTokensRequest::filter].
8237    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8238        self.filter = v.into();
8239        self
8240    }
8241
8242    /// Sets the value of [order_by][crate::model::ListServiceConnectionTokensRequest::order_by].
8243    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8244        self.order_by = v.into();
8245        self
8246    }
8247}
8248
8249impl wkt::message::Message for ListServiceConnectionTokensRequest {
8250    fn typename() -> &'static str {
8251        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListServiceConnectionTokensRequest"
8252    }
8253}
8254
8255#[doc(hidden)]
8256impl<'de> serde::de::Deserialize<'de> for ListServiceConnectionTokensRequest {
8257    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8258    where
8259        D: serde::Deserializer<'de>,
8260    {
8261        #[allow(non_camel_case_types)]
8262        #[doc(hidden)]
8263        #[derive(PartialEq, Eq, Hash)]
8264        enum __FieldTag {
8265            __parent,
8266            __page_size,
8267            __page_token,
8268            __filter,
8269            __order_by,
8270            Unknown(std::string::String),
8271        }
8272        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8273            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8274            where
8275                D: serde::Deserializer<'de>,
8276            {
8277                struct Visitor;
8278                impl<'de> serde::de::Visitor<'de> for Visitor {
8279                    type Value = __FieldTag;
8280                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8281                        formatter.write_str("a field name for ListServiceConnectionTokensRequest")
8282                    }
8283                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8284                    where
8285                        E: serde::de::Error,
8286                    {
8287                        use std::result::Result::Ok;
8288                        use std::string::ToString;
8289                        match value {
8290                            "parent" => Ok(__FieldTag::__parent),
8291                            "pageSize" => Ok(__FieldTag::__page_size),
8292                            "page_size" => Ok(__FieldTag::__page_size),
8293                            "pageToken" => Ok(__FieldTag::__page_token),
8294                            "page_token" => Ok(__FieldTag::__page_token),
8295                            "filter" => Ok(__FieldTag::__filter),
8296                            "orderBy" => Ok(__FieldTag::__order_by),
8297                            "order_by" => Ok(__FieldTag::__order_by),
8298                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8299                        }
8300                    }
8301                }
8302                deserializer.deserialize_identifier(Visitor)
8303            }
8304        }
8305        struct Visitor;
8306        impl<'de> serde::de::Visitor<'de> for Visitor {
8307            type Value = ListServiceConnectionTokensRequest;
8308            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8309                formatter.write_str("struct ListServiceConnectionTokensRequest")
8310            }
8311            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8312            where
8313                A: serde::de::MapAccess<'de>,
8314            {
8315                #[allow(unused_imports)]
8316                use serde::de::Error;
8317                use std::option::Option::Some;
8318                let mut fields = std::collections::HashSet::new();
8319                let mut result = Self::Value::new();
8320                while let Some(tag) = map.next_key::<__FieldTag>()? {
8321                    #[allow(clippy::match_single_binding)]
8322                    match tag {
8323                        __FieldTag::__parent => {
8324                            if !fields.insert(__FieldTag::__parent) {
8325                                return std::result::Result::Err(A::Error::duplicate_field(
8326                                    "multiple values for parent",
8327                                ));
8328                            }
8329                            result.parent = map
8330                                .next_value::<std::option::Option<std::string::String>>()?
8331                                .unwrap_or_default();
8332                        }
8333                        __FieldTag::__page_size => {
8334                            if !fields.insert(__FieldTag::__page_size) {
8335                                return std::result::Result::Err(A::Error::duplicate_field(
8336                                    "multiple values for page_size",
8337                                ));
8338                            }
8339                            struct __With(std::option::Option<i32>);
8340                            impl<'de> serde::de::Deserialize<'de> for __With {
8341                                fn deserialize<D>(
8342                                    deserializer: D,
8343                                ) -> std::result::Result<Self, D::Error>
8344                                where
8345                                    D: serde::de::Deserializer<'de>,
8346                                {
8347                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
8348                                }
8349                            }
8350                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
8351                        }
8352                        __FieldTag::__page_token => {
8353                            if !fields.insert(__FieldTag::__page_token) {
8354                                return std::result::Result::Err(A::Error::duplicate_field(
8355                                    "multiple values for page_token",
8356                                ));
8357                            }
8358                            result.page_token = map
8359                                .next_value::<std::option::Option<std::string::String>>()?
8360                                .unwrap_or_default();
8361                        }
8362                        __FieldTag::__filter => {
8363                            if !fields.insert(__FieldTag::__filter) {
8364                                return std::result::Result::Err(A::Error::duplicate_field(
8365                                    "multiple values for filter",
8366                                ));
8367                            }
8368                            result.filter = map
8369                                .next_value::<std::option::Option<std::string::String>>()?
8370                                .unwrap_or_default();
8371                        }
8372                        __FieldTag::__order_by => {
8373                            if !fields.insert(__FieldTag::__order_by) {
8374                                return std::result::Result::Err(A::Error::duplicate_field(
8375                                    "multiple values for order_by",
8376                                ));
8377                            }
8378                            result.order_by = map
8379                                .next_value::<std::option::Option<std::string::String>>()?
8380                                .unwrap_or_default();
8381                        }
8382                        __FieldTag::Unknown(key) => {
8383                            let value = map.next_value::<serde_json::Value>()?;
8384                            result._unknown_fields.insert(key, value);
8385                        }
8386                    }
8387                }
8388                std::result::Result::Ok(result)
8389            }
8390        }
8391        deserializer.deserialize_any(Visitor)
8392    }
8393}
8394
8395#[doc(hidden)]
8396impl serde::ser::Serialize for ListServiceConnectionTokensRequest {
8397    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8398    where
8399        S: serde::ser::Serializer,
8400    {
8401        use serde::ser::SerializeMap;
8402        #[allow(unused_imports)]
8403        use std::option::Option::Some;
8404        let mut state = serializer.serialize_map(std::option::Option::None)?;
8405        if !self.parent.is_empty() {
8406            state.serialize_entry("parent", &self.parent)?;
8407        }
8408        if !wkt::internal::is_default(&self.page_size) {
8409            struct __With<'a>(&'a i32);
8410            impl<'a> serde::ser::Serialize for __With<'a> {
8411                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8412                where
8413                    S: serde::ser::Serializer,
8414                {
8415                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
8416                }
8417            }
8418            state.serialize_entry("pageSize", &__With(&self.page_size))?;
8419        }
8420        if !self.page_token.is_empty() {
8421            state.serialize_entry("pageToken", &self.page_token)?;
8422        }
8423        if !self.filter.is_empty() {
8424            state.serialize_entry("filter", &self.filter)?;
8425        }
8426        if !self.order_by.is_empty() {
8427            state.serialize_entry("orderBy", &self.order_by)?;
8428        }
8429        if !self._unknown_fields.is_empty() {
8430            for (key, value) in self._unknown_fields.iter() {
8431                state.serialize_entry(key, &value)?;
8432            }
8433        }
8434        state.end()
8435    }
8436}
8437
8438/// Response for ListServiceConnectionTokens.
8439#[derive(Clone, Debug, Default, PartialEq)]
8440#[non_exhaustive]
8441pub struct ListServiceConnectionTokensResponse {
8442    /// ServiceConnectionTokens to be returned.
8443    pub service_connection_tokens: std::vec::Vec<crate::model::ServiceConnectionToken>,
8444
8445    /// The next pagination token in the List response. It should be used as
8446    /// page_token for the following request. An empty value means no more result.
8447    pub next_page_token: std::string::String,
8448
8449    /// Locations that could not be reached.
8450    pub unreachable: std::vec::Vec<std::string::String>,
8451
8452    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8453}
8454
8455impl ListServiceConnectionTokensResponse {
8456    pub fn new() -> Self {
8457        std::default::Default::default()
8458    }
8459
8460    /// Sets the value of [service_connection_tokens][crate::model::ListServiceConnectionTokensResponse::service_connection_tokens].
8461    pub fn set_service_connection_tokens<T, V>(mut self, v: T) -> Self
8462    where
8463        T: std::iter::IntoIterator<Item = V>,
8464        V: std::convert::Into<crate::model::ServiceConnectionToken>,
8465    {
8466        use std::iter::Iterator;
8467        self.service_connection_tokens = v.into_iter().map(|i| i.into()).collect();
8468        self
8469    }
8470
8471    /// Sets the value of [next_page_token][crate::model::ListServiceConnectionTokensResponse::next_page_token].
8472    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8473        self.next_page_token = v.into();
8474        self
8475    }
8476
8477    /// Sets the value of [unreachable][crate::model::ListServiceConnectionTokensResponse::unreachable].
8478    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
8479    where
8480        T: std::iter::IntoIterator<Item = V>,
8481        V: std::convert::Into<std::string::String>,
8482    {
8483        use std::iter::Iterator;
8484        self.unreachable = v.into_iter().map(|i| i.into()).collect();
8485        self
8486    }
8487}
8488
8489impl wkt::message::Message for ListServiceConnectionTokensResponse {
8490    fn typename() -> &'static str {
8491        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListServiceConnectionTokensResponse"
8492    }
8493}
8494
8495#[doc(hidden)]
8496impl gax::paginator::internal::PageableResponse for ListServiceConnectionTokensResponse {
8497    type PageItem = crate::model::ServiceConnectionToken;
8498
8499    fn items(self) -> std::vec::Vec<Self::PageItem> {
8500        self.service_connection_tokens
8501    }
8502
8503    fn next_page_token(&self) -> std::string::String {
8504        use std::clone::Clone;
8505        self.next_page_token.clone()
8506    }
8507}
8508
8509#[doc(hidden)]
8510impl<'de> serde::de::Deserialize<'de> for ListServiceConnectionTokensResponse {
8511    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8512    where
8513        D: serde::Deserializer<'de>,
8514    {
8515        #[allow(non_camel_case_types)]
8516        #[doc(hidden)]
8517        #[derive(PartialEq, Eq, Hash)]
8518        enum __FieldTag {
8519            __service_connection_tokens,
8520            __next_page_token,
8521            __unreachable,
8522            Unknown(std::string::String),
8523        }
8524        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8525            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8526            where
8527                D: serde::Deserializer<'de>,
8528            {
8529                struct Visitor;
8530                impl<'de> serde::de::Visitor<'de> for Visitor {
8531                    type Value = __FieldTag;
8532                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8533                        formatter.write_str("a field name for ListServiceConnectionTokensResponse")
8534                    }
8535                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8536                    where
8537                        E: serde::de::Error,
8538                    {
8539                        use std::result::Result::Ok;
8540                        use std::string::ToString;
8541                        match value {
8542                            "serviceConnectionTokens" => {
8543                                Ok(__FieldTag::__service_connection_tokens)
8544                            }
8545                            "service_connection_tokens" => {
8546                                Ok(__FieldTag::__service_connection_tokens)
8547                            }
8548                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
8549                            "next_page_token" => Ok(__FieldTag::__next_page_token),
8550                            "unreachable" => Ok(__FieldTag::__unreachable),
8551                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8552                        }
8553                    }
8554                }
8555                deserializer.deserialize_identifier(Visitor)
8556            }
8557        }
8558        struct Visitor;
8559        impl<'de> serde::de::Visitor<'de> for Visitor {
8560            type Value = ListServiceConnectionTokensResponse;
8561            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8562                formatter.write_str("struct ListServiceConnectionTokensResponse")
8563            }
8564            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8565            where
8566                A: serde::de::MapAccess<'de>,
8567            {
8568                #[allow(unused_imports)]
8569                use serde::de::Error;
8570                use std::option::Option::Some;
8571                let mut fields = std::collections::HashSet::new();
8572                let mut result = Self::Value::new();
8573                while let Some(tag) = map.next_key::<__FieldTag>()? {
8574                    #[allow(clippy::match_single_binding)]
8575                    match tag {
8576                        __FieldTag::__service_connection_tokens => {
8577                            if !fields.insert(__FieldTag::__service_connection_tokens) {
8578                                return std::result::Result::Err(A::Error::duplicate_field(
8579                                    "multiple values for service_connection_tokens",
8580                                ));
8581                            }
8582                            result.service_connection_tokens = map
8583                                .next_value::<std::option::Option<
8584                                    std::vec::Vec<crate::model::ServiceConnectionToken>,
8585                                >>()?
8586                                .unwrap_or_default();
8587                        }
8588                        __FieldTag::__next_page_token => {
8589                            if !fields.insert(__FieldTag::__next_page_token) {
8590                                return std::result::Result::Err(A::Error::duplicate_field(
8591                                    "multiple values for next_page_token",
8592                                ));
8593                            }
8594                            result.next_page_token = map
8595                                .next_value::<std::option::Option<std::string::String>>()?
8596                                .unwrap_or_default();
8597                        }
8598                        __FieldTag::__unreachable => {
8599                            if !fields.insert(__FieldTag::__unreachable) {
8600                                return std::result::Result::Err(A::Error::duplicate_field(
8601                                    "multiple values for unreachable",
8602                                ));
8603                            }
8604                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
8605                        }
8606                        __FieldTag::Unknown(key) => {
8607                            let value = map.next_value::<serde_json::Value>()?;
8608                            result._unknown_fields.insert(key, value);
8609                        }
8610                    }
8611                }
8612                std::result::Result::Ok(result)
8613            }
8614        }
8615        deserializer.deserialize_any(Visitor)
8616    }
8617}
8618
8619#[doc(hidden)]
8620impl serde::ser::Serialize for ListServiceConnectionTokensResponse {
8621    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8622    where
8623        S: serde::ser::Serializer,
8624    {
8625        use serde::ser::SerializeMap;
8626        #[allow(unused_imports)]
8627        use std::option::Option::Some;
8628        let mut state = serializer.serialize_map(std::option::Option::None)?;
8629        if !self.service_connection_tokens.is_empty() {
8630            state.serialize_entry("serviceConnectionTokens", &self.service_connection_tokens)?;
8631        }
8632        if !self.next_page_token.is_empty() {
8633            state.serialize_entry("nextPageToken", &self.next_page_token)?;
8634        }
8635        if !self.unreachable.is_empty() {
8636            state.serialize_entry("unreachable", &self.unreachable)?;
8637        }
8638        if !self._unknown_fields.is_empty() {
8639            for (key, value) in self._unknown_fields.iter() {
8640                state.serialize_entry(key, &value)?;
8641            }
8642        }
8643        state.end()
8644    }
8645}
8646
8647/// Request for GetServiceConnectionToken.
8648#[derive(Clone, Debug, Default, PartialEq)]
8649#[non_exhaustive]
8650pub struct GetServiceConnectionTokenRequest {
8651    /// Required. Name of the ServiceConnectionToken to get.
8652    pub name: std::string::String,
8653
8654    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8655}
8656
8657impl GetServiceConnectionTokenRequest {
8658    pub fn new() -> Self {
8659        std::default::Default::default()
8660    }
8661
8662    /// Sets the value of [name][crate::model::GetServiceConnectionTokenRequest::name].
8663    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8664        self.name = v.into();
8665        self
8666    }
8667}
8668
8669impl wkt::message::Message for GetServiceConnectionTokenRequest {
8670    fn typename() -> &'static str {
8671        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetServiceConnectionTokenRequest"
8672    }
8673}
8674
8675#[doc(hidden)]
8676impl<'de> serde::de::Deserialize<'de> for GetServiceConnectionTokenRequest {
8677    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8678    where
8679        D: serde::Deserializer<'de>,
8680    {
8681        #[allow(non_camel_case_types)]
8682        #[doc(hidden)]
8683        #[derive(PartialEq, Eq, Hash)]
8684        enum __FieldTag {
8685            __name,
8686            Unknown(std::string::String),
8687        }
8688        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8689            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8690            where
8691                D: serde::Deserializer<'de>,
8692            {
8693                struct Visitor;
8694                impl<'de> serde::de::Visitor<'de> for Visitor {
8695                    type Value = __FieldTag;
8696                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8697                        formatter.write_str("a field name for GetServiceConnectionTokenRequest")
8698                    }
8699                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8700                    where
8701                        E: serde::de::Error,
8702                    {
8703                        use std::result::Result::Ok;
8704                        use std::string::ToString;
8705                        match value {
8706                            "name" => Ok(__FieldTag::__name),
8707                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8708                        }
8709                    }
8710                }
8711                deserializer.deserialize_identifier(Visitor)
8712            }
8713        }
8714        struct Visitor;
8715        impl<'de> serde::de::Visitor<'de> for Visitor {
8716            type Value = GetServiceConnectionTokenRequest;
8717            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8718                formatter.write_str("struct GetServiceConnectionTokenRequest")
8719            }
8720            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8721            where
8722                A: serde::de::MapAccess<'de>,
8723            {
8724                #[allow(unused_imports)]
8725                use serde::de::Error;
8726                use std::option::Option::Some;
8727                let mut fields = std::collections::HashSet::new();
8728                let mut result = Self::Value::new();
8729                while let Some(tag) = map.next_key::<__FieldTag>()? {
8730                    #[allow(clippy::match_single_binding)]
8731                    match tag {
8732                        __FieldTag::__name => {
8733                            if !fields.insert(__FieldTag::__name) {
8734                                return std::result::Result::Err(A::Error::duplicate_field(
8735                                    "multiple values for name",
8736                                ));
8737                            }
8738                            result.name = map
8739                                .next_value::<std::option::Option<std::string::String>>()?
8740                                .unwrap_or_default();
8741                        }
8742                        __FieldTag::Unknown(key) => {
8743                            let value = map.next_value::<serde_json::Value>()?;
8744                            result._unknown_fields.insert(key, value);
8745                        }
8746                    }
8747                }
8748                std::result::Result::Ok(result)
8749            }
8750        }
8751        deserializer.deserialize_any(Visitor)
8752    }
8753}
8754
8755#[doc(hidden)]
8756impl serde::ser::Serialize for GetServiceConnectionTokenRequest {
8757    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8758    where
8759        S: serde::ser::Serializer,
8760    {
8761        use serde::ser::SerializeMap;
8762        #[allow(unused_imports)]
8763        use std::option::Option::Some;
8764        let mut state = serializer.serialize_map(std::option::Option::None)?;
8765        if !self.name.is_empty() {
8766            state.serialize_entry("name", &self.name)?;
8767        }
8768        if !self._unknown_fields.is_empty() {
8769            for (key, value) in self._unknown_fields.iter() {
8770                state.serialize_entry(key, &value)?;
8771            }
8772        }
8773        state.end()
8774    }
8775}
8776
8777/// Request for CreateServiceConnectionToken.
8778#[derive(Clone, Debug, Default, PartialEq)]
8779#[non_exhaustive]
8780pub struct CreateServiceConnectionTokenRequest {
8781    /// Required. The parent resource's name of the ServiceConnectionToken. ex.
8782    /// projects/123/locations/us-east1
8783    pub parent: std::string::String,
8784
8785    /// Optional. Resource ID
8786    /// (i.e. 'foo' in '[...]/projects/p/locations/l/ServiceConnectionTokens/foo')
8787    /// See <https://google.aip.dev/122#resource-id-segments>
8788    /// Unique per location.
8789    /// If one is not provided, one will be generated.
8790    pub service_connection_token_id: std::string::String,
8791
8792    /// Required. Initial values for a new ServiceConnectionTokens
8793    pub service_connection_token: std::option::Option<crate::model::ServiceConnectionToken>,
8794
8795    /// Optional. An optional request ID to identify requests. Specify a unique
8796    /// request ID so that if you must retry your request, the server will know to
8797    /// ignore the request if it has already been completed. The server will
8798    /// guarantee that for at least 60 minutes since the first request.
8799    ///
8800    /// For example, consider a situation where you make an initial request and
8801    /// the request times out. If you make the request again with the same request
8802    /// ID, the server can check if original operation with the same request ID
8803    /// was received, and if so, will ignore the second request. This prevents
8804    /// clients from accidentally creating duplicate commitments.
8805    ///
8806    /// The request ID must be a valid UUID with the exception that zero UUID is
8807    /// not supported (00000000-0000-0000-0000-000000000000).
8808    pub request_id: std::string::String,
8809
8810    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8811}
8812
8813impl CreateServiceConnectionTokenRequest {
8814    pub fn new() -> Self {
8815        std::default::Default::default()
8816    }
8817
8818    /// Sets the value of [parent][crate::model::CreateServiceConnectionTokenRequest::parent].
8819    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8820        self.parent = v.into();
8821        self
8822    }
8823
8824    /// Sets the value of [service_connection_token_id][crate::model::CreateServiceConnectionTokenRequest::service_connection_token_id].
8825    pub fn set_service_connection_token_id<T: std::convert::Into<std::string::String>>(
8826        mut self,
8827        v: T,
8828    ) -> Self {
8829        self.service_connection_token_id = v.into();
8830        self
8831    }
8832
8833    /// Sets the value of [service_connection_token][crate::model::CreateServiceConnectionTokenRequest::service_connection_token].
8834    pub fn set_service_connection_token<T>(mut self, v: T) -> Self
8835    where
8836        T: std::convert::Into<crate::model::ServiceConnectionToken>,
8837    {
8838        self.service_connection_token = std::option::Option::Some(v.into());
8839        self
8840    }
8841
8842    /// Sets or clears the value of [service_connection_token][crate::model::CreateServiceConnectionTokenRequest::service_connection_token].
8843    pub fn set_or_clear_service_connection_token<T>(mut self, v: std::option::Option<T>) -> Self
8844    where
8845        T: std::convert::Into<crate::model::ServiceConnectionToken>,
8846    {
8847        self.service_connection_token = v.map(|x| x.into());
8848        self
8849    }
8850
8851    /// Sets the value of [request_id][crate::model::CreateServiceConnectionTokenRequest::request_id].
8852    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8853        self.request_id = v.into();
8854        self
8855    }
8856}
8857
8858impl wkt::message::Message for CreateServiceConnectionTokenRequest {
8859    fn typename() -> &'static str {
8860        "type.googleapis.com/google.cloud.networkconnectivity.v1.CreateServiceConnectionTokenRequest"
8861    }
8862}
8863
8864#[doc(hidden)]
8865impl<'de> serde::de::Deserialize<'de> for CreateServiceConnectionTokenRequest {
8866    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8867    where
8868        D: serde::Deserializer<'de>,
8869    {
8870        #[allow(non_camel_case_types)]
8871        #[doc(hidden)]
8872        #[derive(PartialEq, Eq, Hash)]
8873        enum __FieldTag {
8874            __parent,
8875            __service_connection_token_id,
8876            __service_connection_token,
8877            __request_id,
8878            Unknown(std::string::String),
8879        }
8880        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8881            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8882            where
8883                D: serde::Deserializer<'de>,
8884            {
8885                struct Visitor;
8886                impl<'de> serde::de::Visitor<'de> for Visitor {
8887                    type Value = __FieldTag;
8888                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8889                        formatter.write_str("a field name for CreateServiceConnectionTokenRequest")
8890                    }
8891                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8892                    where
8893                        E: serde::de::Error,
8894                    {
8895                        use std::result::Result::Ok;
8896                        use std::string::ToString;
8897                        match value {
8898                            "parent" => Ok(__FieldTag::__parent),
8899                            "serviceConnectionTokenId" => {
8900                                Ok(__FieldTag::__service_connection_token_id)
8901                            }
8902                            "service_connection_token_id" => {
8903                                Ok(__FieldTag::__service_connection_token_id)
8904                            }
8905                            "serviceConnectionToken" => Ok(__FieldTag::__service_connection_token),
8906                            "service_connection_token" => {
8907                                Ok(__FieldTag::__service_connection_token)
8908                            }
8909                            "requestId" => Ok(__FieldTag::__request_id),
8910                            "request_id" => Ok(__FieldTag::__request_id),
8911                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8912                        }
8913                    }
8914                }
8915                deserializer.deserialize_identifier(Visitor)
8916            }
8917        }
8918        struct Visitor;
8919        impl<'de> serde::de::Visitor<'de> for Visitor {
8920            type Value = CreateServiceConnectionTokenRequest;
8921            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8922                formatter.write_str("struct CreateServiceConnectionTokenRequest")
8923            }
8924            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8925            where
8926                A: serde::de::MapAccess<'de>,
8927            {
8928                #[allow(unused_imports)]
8929                use serde::de::Error;
8930                use std::option::Option::Some;
8931                let mut fields = std::collections::HashSet::new();
8932                let mut result = Self::Value::new();
8933                while let Some(tag) = map.next_key::<__FieldTag>()? {
8934                    #[allow(clippy::match_single_binding)]
8935                    match tag {
8936                        __FieldTag::__parent => {
8937                            if !fields.insert(__FieldTag::__parent) {
8938                                return std::result::Result::Err(A::Error::duplicate_field(
8939                                    "multiple values for parent",
8940                                ));
8941                            }
8942                            result.parent = map
8943                                .next_value::<std::option::Option<std::string::String>>()?
8944                                .unwrap_or_default();
8945                        }
8946                        __FieldTag::__service_connection_token_id => {
8947                            if !fields.insert(__FieldTag::__service_connection_token_id) {
8948                                return std::result::Result::Err(A::Error::duplicate_field(
8949                                    "multiple values for service_connection_token_id",
8950                                ));
8951                            }
8952                            result.service_connection_token_id = map
8953                                .next_value::<std::option::Option<std::string::String>>()?
8954                                .unwrap_or_default();
8955                        }
8956                        __FieldTag::__service_connection_token => {
8957                            if !fields.insert(__FieldTag::__service_connection_token) {
8958                                return std::result::Result::Err(A::Error::duplicate_field(
8959                                    "multiple values for service_connection_token",
8960                                ));
8961                            }
8962                            result.service_connection_token = map.next_value::<std::option::Option<crate::model::ServiceConnectionToken>>()?
8963                                ;
8964                        }
8965                        __FieldTag::__request_id => {
8966                            if !fields.insert(__FieldTag::__request_id) {
8967                                return std::result::Result::Err(A::Error::duplicate_field(
8968                                    "multiple values for request_id",
8969                                ));
8970                            }
8971                            result.request_id = map
8972                                .next_value::<std::option::Option<std::string::String>>()?
8973                                .unwrap_or_default();
8974                        }
8975                        __FieldTag::Unknown(key) => {
8976                            let value = map.next_value::<serde_json::Value>()?;
8977                            result._unknown_fields.insert(key, value);
8978                        }
8979                    }
8980                }
8981                std::result::Result::Ok(result)
8982            }
8983        }
8984        deserializer.deserialize_any(Visitor)
8985    }
8986}
8987
8988#[doc(hidden)]
8989impl serde::ser::Serialize for CreateServiceConnectionTokenRequest {
8990    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8991    where
8992        S: serde::ser::Serializer,
8993    {
8994        use serde::ser::SerializeMap;
8995        #[allow(unused_imports)]
8996        use std::option::Option::Some;
8997        let mut state = serializer.serialize_map(std::option::Option::None)?;
8998        if !self.parent.is_empty() {
8999            state.serialize_entry("parent", &self.parent)?;
9000        }
9001        if !self.service_connection_token_id.is_empty() {
9002            state.serialize_entry(
9003                "serviceConnectionTokenId",
9004                &self.service_connection_token_id,
9005            )?;
9006        }
9007        if self.service_connection_token.is_some() {
9008            state.serialize_entry("serviceConnectionToken", &self.service_connection_token)?;
9009        }
9010        if !self.request_id.is_empty() {
9011            state.serialize_entry("requestId", &self.request_id)?;
9012        }
9013        if !self._unknown_fields.is_empty() {
9014            for (key, value) in self._unknown_fields.iter() {
9015                state.serialize_entry(key, &value)?;
9016            }
9017        }
9018        state.end()
9019    }
9020}
9021
9022/// Request for DeleteServiceConnectionToken.
9023#[derive(Clone, Debug, Default, PartialEq)]
9024#[non_exhaustive]
9025pub struct DeleteServiceConnectionTokenRequest {
9026    /// Required. The name of the ServiceConnectionToken to delete.
9027    pub name: std::string::String,
9028
9029    /// Optional. An optional request ID to identify requests. Specify a unique
9030    /// request ID so that if you must retry your request, the server will know to
9031    /// ignore the request if it has already been completed. The server will
9032    /// guarantee that for at least 60 minutes after the first request.
9033    ///
9034    /// For example, consider a situation where you make an initial request and
9035    /// the request times out. If you make the request again with the same request
9036    /// ID, the server can check if original operation with the same request ID
9037    /// was received, and if so, will ignore the second request. This prevents
9038    /// clients from accidentally creating duplicate commitments.
9039    ///
9040    /// The request ID must be a valid UUID with the exception that zero UUID is
9041    /// not supported (00000000-0000-0000-0000-000000000000).
9042    pub request_id: std::string::String,
9043
9044    /// Optional. The etag is computed by the server, and may be sent on update and
9045    /// delete requests to ensure the client has an up-to-date value before
9046    /// proceeding.
9047    pub etag: std::option::Option<std::string::String>,
9048
9049    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9050}
9051
9052impl DeleteServiceConnectionTokenRequest {
9053    pub fn new() -> Self {
9054        std::default::Default::default()
9055    }
9056
9057    /// Sets the value of [name][crate::model::DeleteServiceConnectionTokenRequest::name].
9058    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9059        self.name = v.into();
9060        self
9061    }
9062
9063    /// Sets the value of [request_id][crate::model::DeleteServiceConnectionTokenRequest::request_id].
9064    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9065        self.request_id = v.into();
9066        self
9067    }
9068
9069    /// Sets the value of [etag][crate::model::DeleteServiceConnectionTokenRequest::etag].
9070    pub fn set_etag<T>(mut self, v: T) -> Self
9071    where
9072        T: std::convert::Into<std::string::String>,
9073    {
9074        self.etag = std::option::Option::Some(v.into());
9075        self
9076    }
9077
9078    /// Sets or clears the value of [etag][crate::model::DeleteServiceConnectionTokenRequest::etag].
9079    pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
9080    where
9081        T: std::convert::Into<std::string::String>,
9082    {
9083        self.etag = v.map(|x| x.into());
9084        self
9085    }
9086}
9087
9088impl wkt::message::Message for DeleteServiceConnectionTokenRequest {
9089    fn typename() -> &'static str {
9090        "type.googleapis.com/google.cloud.networkconnectivity.v1.DeleteServiceConnectionTokenRequest"
9091    }
9092}
9093
9094#[doc(hidden)]
9095impl<'de> serde::de::Deserialize<'de> for DeleteServiceConnectionTokenRequest {
9096    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9097    where
9098        D: serde::Deserializer<'de>,
9099    {
9100        #[allow(non_camel_case_types)]
9101        #[doc(hidden)]
9102        #[derive(PartialEq, Eq, Hash)]
9103        enum __FieldTag {
9104            __name,
9105            __request_id,
9106            __etag,
9107            Unknown(std::string::String),
9108        }
9109        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9110            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9111            where
9112                D: serde::Deserializer<'de>,
9113            {
9114                struct Visitor;
9115                impl<'de> serde::de::Visitor<'de> for Visitor {
9116                    type Value = __FieldTag;
9117                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9118                        formatter.write_str("a field name for DeleteServiceConnectionTokenRequest")
9119                    }
9120                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9121                    where
9122                        E: serde::de::Error,
9123                    {
9124                        use std::result::Result::Ok;
9125                        use std::string::ToString;
9126                        match value {
9127                            "name" => Ok(__FieldTag::__name),
9128                            "requestId" => Ok(__FieldTag::__request_id),
9129                            "request_id" => Ok(__FieldTag::__request_id),
9130                            "etag" => Ok(__FieldTag::__etag),
9131                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9132                        }
9133                    }
9134                }
9135                deserializer.deserialize_identifier(Visitor)
9136            }
9137        }
9138        struct Visitor;
9139        impl<'de> serde::de::Visitor<'de> for Visitor {
9140            type Value = DeleteServiceConnectionTokenRequest;
9141            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9142                formatter.write_str("struct DeleteServiceConnectionTokenRequest")
9143            }
9144            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9145            where
9146                A: serde::de::MapAccess<'de>,
9147            {
9148                #[allow(unused_imports)]
9149                use serde::de::Error;
9150                use std::option::Option::Some;
9151                let mut fields = std::collections::HashSet::new();
9152                let mut result = Self::Value::new();
9153                while let Some(tag) = map.next_key::<__FieldTag>()? {
9154                    #[allow(clippy::match_single_binding)]
9155                    match tag {
9156                        __FieldTag::__name => {
9157                            if !fields.insert(__FieldTag::__name) {
9158                                return std::result::Result::Err(A::Error::duplicate_field(
9159                                    "multiple values for name",
9160                                ));
9161                            }
9162                            result.name = map
9163                                .next_value::<std::option::Option<std::string::String>>()?
9164                                .unwrap_or_default();
9165                        }
9166                        __FieldTag::__request_id => {
9167                            if !fields.insert(__FieldTag::__request_id) {
9168                                return std::result::Result::Err(A::Error::duplicate_field(
9169                                    "multiple values for request_id",
9170                                ));
9171                            }
9172                            result.request_id = map
9173                                .next_value::<std::option::Option<std::string::String>>()?
9174                                .unwrap_or_default();
9175                        }
9176                        __FieldTag::__etag => {
9177                            if !fields.insert(__FieldTag::__etag) {
9178                                return std::result::Result::Err(A::Error::duplicate_field(
9179                                    "multiple values for etag",
9180                                ));
9181                            }
9182                            result.etag =
9183                                map.next_value::<std::option::Option<std::string::String>>()?;
9184                        }
9185                        __FieldTag::Unknown(key) => {
9186                            let value = map.next_value::<serde_json::Value>()?;
9187                            result._unknown_fields.insert(key, value);
9188                        }
9189                    }
9190                }
9191                std::result::Result::Ok(result)
9192            }
9193        }
9194        deserializer.deserialize_any(Visitor)
9195    }
9196}
9197
9198#[doc(hidden)]
9199impl serde::ser::Serialize for DeleteServiceConnectionTokenRequest {
9200    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9201    where
9202        S: serde::ser::Serializer,
9203    {
9204        use serde::ser::SerializeMap;
9205        #[allow(unused_imports)]
9206        use std::option::Option::Some;
9207        let mut state = serializer.serialize_map(std::option::Option::None)?;
9208        if !self.name.is_empty() {
9209            state.serialize_entry("name", &self.name)?;
9210        }
9211        if !self.request_id.is_empty() {
9212            state.serialize_entry("requestId", &self.request_id)?;
9213        }
9214        if self.etag.is_some() {
9215            state.serialize_entry("etag", &self.etag)?;
9216        }
9217        if !self._unknown_fields.is_empty() {
9218            for (key, value) in self._unknown_fields.iter() {
9219                state.serialize_entry(key, &value)?;
9220            }
9221        }
9222        state.end()
9223    }
9224}
9225
9226/// A Network Connectivity Center hub is a global management resource to which
9227/// you attach spokes. A single hub can contain spokes from multiple regions.
9228/// However, if any of a hub's spokes use the site-to-site data transfer feature,
9229/// the resources associated with those spokes must all be in the same VPC
9230/// network. Spokes that do not use site-to-site data transfer can be associated
9231/// with any VPC network in your project.
9232#[derive(Clone, Debug, Default, PartialEq)]
9233#[non_exhaustive]
9234pub struct Hub {
9235    /// Immutable. The name of the hub. Hub names must be unique. They use the
9236    /// following form:
9237    /// `projects/{project_number}/locations/global/hubs/{hub_id}`
9238    pub name: std::string::String,
9239
9240    /// Output only. The time the hub was created.
9241    pub create_time: std::option::Option<wkt::Timestamp>,
9242
9243    /// Output only. The time the hub was last updated.
9244    pub update_time: std::option::Option<wkt::Timestamp>,
9245
9246    /// Optional labels in key-value pair format. For more information about
9247    /// labels, see [Requirements for
9248    /// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements).
9249    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
9250
9251    /// Optional. An optional description of the hub.
9252    pub description: std::string::String,
9253
9254    /// Output only. The Google-generated UUID for the hub. This value is unique
9255    /// across all hub resources. If a hub is deleted and another with the same
9256    /// name is created, the new hub is assigned a different unique_id.
9257    pub unique_id: std::string::String,
9258
9259    /// Output only. The current lifecycle state of this hub.
9260    pub state: crate::model::State,
9261
9262    /// The VPC networks associated with this hub's spokes.
9263    ///
9264    /// This field is read-only. Network Connectivity Center automatically
9265    /// populates it based on the set of spokes attached to the hub.
9266    pub routing_vpcs: std::vec::Vec<crate::model::RoutingVPC>,
9267
9268    /// Output only. The route tables that belong to this hub. They use the
9269    /// following form:
9270    /// `projects/{project_number}/locations/global/hubs/{hub_id}/routeTables/{route_table_id}`
9271    ///
9272    /// This field is read-only. Network Connectivity Center automatically
9273    /// populates it based on the route tables nested under the hub.
9274    pub route_tables: std::vec::Vec<std::string::String>,
9275
9276    /// Output only. A summary of the spokes associated with a hub. The
9277    /// summary includes a count of spokes according to type
9278    /// and according to state. If any spokes are inactive,
9279    /// the summary also lists the reasons they are inactive,
9280    /// including a count for each reason.
9281    pub spoke_summary: std::option::Option<crate::model::SpokeSummary>,
9282
9283    /// Optional. The policy mode of this hub. This field can be either
9284    /// PRESET or CUSTOM. If unspecified, the
9285    /// policy_mode defaults to PRESET.
9286    pub policy_mode: crate::model::PolicyMode,
9287
9288    /// Optional. The topology implemented in this hub. Currently, this field is
9289    /// only used when policy_mode = PRESET. The available preset topologies are
9290    /// MESH and STAR. If preset_topology is unspecified and policy_mode = PRESET,
9291    /// the preset_topology defaults to MESH. When policy_mode = CUSTOM,
9292    /// the preset_topology is set to PRESET_TOPOLOGY_UNSPECIFIED.
9293    pub preset_topology: crate::model::PresetTopology,
9294
9295    /// Optional. Whether Private Service Connect connection propagation is enabled
9296    /// for the hub. If true, Private Service Connect endpoints in VPC spokes
9297    /// attached to the hub are made accessible to other VPC spokes attached to the
9298    /// hub. The default value is false.
9299    pub export_psc: std::option::Option<bool>,
9300
9301    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9302}
9303
9304impl Hub {
9305    pub fn new() -> Self {
9306        std::default::Default::default()
9307    }
9308
9309    /// Sets the value of [name][crate::model::Hub::name].
9310    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9311        self.name = v.into();
9312        self
9313    }
9314
9315    /// Sets the value of [create_time][crate::model::Hub::create_time].
9316    pub fn set_create_time<T>(mut self, v: T) -> Self
9317    where
9318        T: std::convert::Into<wkt::Timestamp>,
9319    {
9320        self.create_time = std::option::Option::Some(v.into());
9321        self
9322    }
9323
9324    /// Sets or clears the value of [create_time][crate::model::Hub::create_time].
9325    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9326    where
9327        T: std::convert::Into<wkt::Timestamp>,
9328    {
9329        self.create_time = v.map(|x| x.into());
9330        self
9331    }
9332
9333    /// Sets the value of [update_time][crate::model::Hub::update_time].
9334    pub fn set_update_time<T>(mut self, v: T) -> Self
9335    where
9336        T: std::convert::Into<wkt::Timestamp>,
9337    {
9338        self.update_time = std::option::Option::Some(v.into());
9339        self
9340    }
9341
9342    /// Sets or clears the value of [update_time][crate::model::Hub::update_time].
9343    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
9344    where
9345        T: std::convert::Into<wkt::Timestamp>,
9346    {
9347        self.update_time = v.map(|x| x.into());
9348        self
9349    }
9350
9351    /// Sets the value of [labels][crate::model::Hub::labels].
9352    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
9353    where
9354        T: std::iter::IntoIterator<Item = (K, V)>,
9355        K: std::convert::Into<std::string::String>,
9356        V: std::convert::Into<std::string::String>,
9357    {
9358        use std::iter::Iterator;
9359        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9360        self
9361    }
9362
9363    /// Sets the value of [description][crate::model::Hub::description].
9364    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9365        self.description = v.into();
9366        self
9367    }
9368
9369    /// Sets the value of [unique_id][crate::model::Hub::unique_id].
9370    pub fn set_unique_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9371        self.unique_id = v.into();
9372        self
9373    }
9374
9375    /// Sets the value of [state][crate::model::Hub::state].
9376    pub fn set_state<T: std::convert::Into<crate::model::State>>(mut self, v: T) -> Self {
9377        self.state = v.into();
9378        self
9379    }
9380
9381    /// Sets the value of [routing_vpcs][crate::model::Hub::routing_vpcs].
9382    pub fn set_routing_vpcs<T, V>(mut self, v: T) -> Self
9383    where
9384        T: std::iter::IntoIterator<Item = V>,
9385        V: std::convert::Into<crate::model::RoutingVPC>,
9386    {
9387        use std::iter::Iterator;
9388        self.routing_vpcs = v.into_iter().map(|i| i.into()).collect();
9389        self
9390    }
9391
9392    /// Sets the value of [route_tables][crate::model::Hub::route_tables].
9393    pub fn set_route_tables<T, V>(mut self, v: T) -> Self
9394    where
9395        T: std::iter::IntoIterator<Item = V>,
9396        V: std::convert::Into<std::string::String>,
9397    {
9398        use std::iter::Iterator;
9399        self.route_tables = v.into_iter().map(|i| i.into()).collect();
9400        self
9401    }
9402
9403    /// Sets the value of [spoke_summary][crate::model::Hub::spoke_summary].
9404    pub fn set_spoke_summary<T>(mut self, v: T) -> Self
9405    where
9406        T: std::convert::Into<crate::model::SpokeSummary>,
9407    {
9408        self.spoke_summary = std::option::Option::Some(v.into());
9409        self
9410    }
9411
9412    /// Sets or clears the value of [spoke_summary][crate::model::Hub::spoke_summary].
9413    pub fn set_or_clear_spoke_summary<T>(mut self, v: std::option::Option<T>) -> Self
9414    where
9415        T: std::convert::Into<crate::model::SpokeSummary>,
9416    {
9417        self.spoke_summary = v.map(|x| x.into());
9418        self
9419    }
9420
9421    /// Sets the value of [policy_mode][crate::model::Hub::policy_mode].
9422    pub fn set_policy_mode<T: std::convert::Into<crate::model::PolicyMode>>(
9423        mut self,
9424        v: T,
9425    ) -> Self {
9426        self.policy_mode = v.into();
9427        self
9428    }
9429
9430    /// Sets the value of [preset_topology][crate::model::Hub::preset_topology].
9431    pub fn set_preset_topology<T: std::convert::Into<crate::model::PresetTopology>>(
9432        mut self,
9433        v: T,
9434    ) -> Self {
9435        self.preset_topology = v.into();
9436        self
9437    }
9438
9439    /// Sets the value of [export_psc][crate::model::Hub::export_psc].
9440    pub fn set_export_psc<T>(mut self, v: T) -> Self
9441    where
9442        T: std::convert::Into<bool>,
9443    {
9444        self.export_psc = std::option::Option::Some(v.into());
9445        self
9446    }
9447
9448    /// Sets or clears the value of [export_psc][crate::model::Hub::export_psc].
9449    pub fn set_or_clear_export_psc<T>(mut self, v: std::option::Option<T>) -> Self
9450    where
9451        T: std::convert::Into<bool>,
9452    {
9453        self.export_psc = v.map(|x| x.into());
9454        self
9455    }
9456}
9457
9458impl wkt::message::Message for Hub {
9459    fn typename() -> &'static str {
9460        "type.googleapis.com/google.cloud.networkconnectivity.v1.Hub"
9461    }
9462}
9463
9464#[doc(hidden)]
9465impl<'de> serde::de::Deserialize<'de> for Hub {
9466    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9467    where
9468        D: serde::Deserializer<'de>,
9469    {
9470        #[allow(non_camel_case_types)]
9471        #[doc(hidden)]
9472        #[derive(PartialEq, Eq, Hash)]
9473        enum __FieldTag {
9474            __name,
9475            __create_time,
9476            __update_time,
9477            __labels,
9478            __description,
9479            __unique_id,
9480            __state,
9481            __routing_vpcs,
9482            __route_tables,
9483            __spoke_summary,
9484            __policy_mode,
9485            __preset_topology,
9486            __export_psc,
9487            Unknown(std::string::String),
9488        }
9489        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9490            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9491            where
9492                D: serde::Deserializer<'de>,
9493            {
9494                struct Visitor;
9495                impl<'de> serde::de::Visitor<'de> for Visitor {
9496                    type Value = __FieldTag;
9497                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9498                        formatter.write_str("a field name for Hub")
9499                    }
9500                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9501                    where
9502                        E: serde::de::Error,
9503                    {
9504                        use std::result::Result::Ok;
9505                        use std::string::ToString;
9506                        match value {
9507                            "name" => Ok(__FieldTag::__name),
9508                            "createTime" => Ok(__FieldTag::__create_time),
9509                            "create_time" => Ok(__FieldTag::__create_time),
9510                            "updateTime" => Ok(__FieldTag::__update_time),
9511                            "update_time" => Ok(__FieldTag::__update_time),
9512                            "labels" => Ok(__FieldTag::__labels),
9513                            "description" => Ok(__FieldTag::__description),
9514                            "uniqueId" => Ok(__FieldTag::__unique_id),
9515                            "unique_id" => Ok(__FieldTag::__unique_id),
9516                            "state" => Ok(__FieldTag::__state),
9517                            "routingVpcs" => Ok(__FieldTag::__routing_vpcs),
9518                            "routing_vpcs" => Ok(__FieldTag::__routing_vpcs),
9519                            "routeTables" => Ok(__FieldTag::__route_tables),
9520                            "route_tables" => Ok(__FieldTag::__route_tables),
9521                            "spokeSummary" => Ok(__FieldTag::__spoke_summary),
9522                            "spoke_summary" => Ok(__FieldTag::__spoke_summary),
9523                            "policyMode" => Ok(__FieldTag::__policy_mode),
9524                            "policy_mode" => Ok(__FieldTag::__policy_mode),
9525                            "presetTopology" => Ok(__FieldTag::__preset_topology),
9526                            "preset_topology" => Ok(__FieldTag::__preset_topology),
9527                            "exportPsc" => Ok(__FieldTag::__export_psc),
9528                            "export_psc" => Ok(__FieldTag::__export_psc),
9529                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9530                        }
9531                    }
9532                }
9533                deserializer.deserialize_identifier(Visitor)
9534            }
9535        }
9536        struct Visitor;
9537        impl<'de> serde::de::Visitor<'de> for Visitor {
9538            type Value = Hub;
9539            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9540                formatter.write_str("struct Hub")
9541            }
9542            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9543            where
9544                A: serde::de::MapAccess<'de>,
9545            {
9546                #[allow(unused_imports)]
9547                use serde::de::Error;
9548                use std::option::Option::Some;
9549                let mut fields = std::collections::HashSet::new();
9550                let mut result = Self::Value::new();
9551                while let Some(tag) = map.next_key::<__FieldTag>()? {
9552                    #[allow(clippy::match_single_binding)]
9553                    match tag {
9554                        __FieldTag::__name => {
9555                            if !fields.insert(__FieldTag::__name) {
9556                                return std::result::Result::Err(A::Error::duplicate_field(
9557                                    "multiple values for name",
9558                                ));
9559                            }
9560                            result.name = map
9561                                .next_value::<std::option::Option<std::string::String>>()?
9562                                .unwrap_or_default();
9563                        }
9564                        __FieldTag::__create_time => {
9565                            if !fields.insert(__FieldTag::__create_time) {
9566                                return std::result::Result::Err(A::Error::duplicate_field(
9567                                    "multiple values for create_time",
9568                                ));
9569                            }
9570                            result.create_time =
9571                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
9572                        }
9573                        __FieldTag::__update_time => {
9574                            if !fields.insert(__FieldTag::__update_time) {
9575                                return std::result::Result::Err(A::Error::duplicate_field(
9576                                    "multiple values for update_time",
9577                                ));
9578                            }
9579                            result.update_time =
9580                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
9581                        }
9582                        __FieldTag::__labels => {
9583                            if !fields.insert(__FieldTag::__labels) {
9584                                return std::result::Result::Err(A::Error::duplicate_field(
9585                                    "multiple values for labels",
9586                                ));
9587                            }
9588                            result.labels = map
9589                                .next_value::<std::option::Option<
9590                                    std::collections::HashMap<
9591                                        std::string::String,
9592                                        std::string::String,
9593                                    >,
9594                                >>()?
9595                                .unwrap_or_default();
9596                        }
9597                        __FieldTag::__description => {
9598                            if !fields.insert(__FieldTag::__description) {
9599                                return std::result::Result::Err(A::Error::duplicate_field(
9600                                    "multiple values for description",
9601                                ));
9602                            }
9603                            result.description = map
9604                                .next_value::<std::option::Option<std::string::String>>()?
9605                                .unwrap_or_default();
9606                        }
9607                        __FieldTag::__unique_id => {
9608                            if !fields.insert(__FieldTag::__unique_id) {
9609                                return std::result::Result::Err(A::Error::duplicate_field(
9610                                    "multiple values for unique_id",
9611                                ));
9612                            }
9613                            result.unique_id = map
9614                                .next_value::<std::option::Option<std::string::String>>()?
9615                                .unwrap_or_default();
9616                        }
9617                        __FieldTag::__state => {
9618                            if !fields.insert(__FieldTag::__state) {
9619                                return std::result::Result::Err(A::Error::duplicate_field(
9620                                    "multiple values for state",
9621                                ));
9622                            }
9623                            result.state = map
9624                                .next_value::<std::option::Option<crate::model::State>>()?
9625                                .unwrap_or_default();
9626                        }
9627                        __FieldTag::__routing_vpcs => {
9628                            if !fields.insert(__FieldTag::__routing_vpcs) {
9629                                return std::result::Result::Err(A::Error::duplicate_field(
9630                                    "multiple values for routing_vpcs",
9631                                ));
9632                            }
9633                            result.routing_vpcs = map.next_value::<std::option::Option<std::vec::Vec<crate::model::RoutingVPC>>>()?.unwrap_or_default();
9634                        }
9635                        __FieldTag::__route_tables => {
9636                            if !fields.insert(__FieldTag::__route_tables) {
9637                                return std::result::Result::Err(A::Error::duplicate_field(
9638                                    "multiple values for route_tables",
9639                                ));
9640                            }
9641                            result.route_tables = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
9642                        }
9643                        __FieldTag::__spoke_summary => {
9644                            if !fields.insert(__FieldTag::__spoke_summary) {
9645                                return std::result::Result::Err(A::Error::duplicate_field(
9646                                    "multiple values for spoke_summary",
9647                                ));
9648                            }
9649                            result.spoke_summary = map
9650                                .next_value::<std::option::Option<crate::model::SpokeSummary>>()?;
9651                        }
9652                        __FieldTag::__policy_mode => {
9653                            if !fields.insert(__FieldTag::__policy_mode) {
9654                                return std::result::Result::Err(A::Error::duplicate_field(
9655                                    "multiple values for policy_mode",
9656                                ));
9657                            }
9658                            result.policy_mode = map
9659                                .next_value::<std::option::Option<crate::model::PolicyMode>>()?
9660                                .unwrap_or_default();
9661                        }
9662                        __FieldTag::__preset_topology => {
9663                            if !fields.insert(__FieldTag::__preset_topology) {
9664                                return std::result::Result::Err(A::Error::duplicate_field(
9665                                    "multiple values for preset_topology",
9666                                ));
9667                            }
9668                            result.preset_topology = map
9669                                .next_value::<std::option::Option<crate::model::PresetTopology>>()?
9670                                .unwrap_or_default();
9671                        }
9672                        __FieldTag::__export_psc => {
9673                            if !fields.insert(__FieldTag::__export_psc) {
9674                                return std::result::Result::Err(A::Error::duplicate_field(
9675                                    "multiple values for export_psc",
9676                                ));
9677                            }
9678                            result.export_psc = map.next_value::<std::option::Option<bool>>()?;
9679                        }
9680                        __FieldTag::Unknown(key) => {
9681                            let value = map.next_value::<serde_json::Value>()?;
9682                            result._unknown_fields.insert(key, value);
9683                        }
9684                    }
9685                }
9686                std::result::Result::Ok(result)
9687            }
9688        }
9689        deserializer.deserialize_any(Visitor)
9690    }
9691}
9692
9693#[doc(hidden)]
9694impl serde::ser::Serialize for Hub {
9695    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9696    where
9697        S: serde::ser::Serializer,
9698    {
9699        use serde::ser::SerializeMap;
9700        #[allow(unused_imports)]
9701        use std::option::Option::Some;
9702        let mut state = serializer.serialize_map(std::option::Option::None)?;
9703        if !self.name.is_empty() {
9704            state.serialize_entry("name", &self.name)?;
9705        }
9706        if self.create_time.is_some() {
9707            state.serialize_entry("createTime", &self.create_time)?;
9708        }
9709        if self.update_time.is_some() {
9710            state.serialize_entry("updateTime", &self.update_time)?;
9711        }
9712        if !self.labels.is_empty() {
9713            state.serialize_entry("labels", &self.labels)?;
9714        }
9715        if !self.description.is_empty() {
9716            state.serialize_entry("description", &self.description)?;
9717        }
9718        if !self.unique_id.is_empty() {
9719            state.serialize_entry("uniqueId", &self.unique_id)?;
9720        }
9721        if !wkt::internal::is_default(&self.state) {
9722            state.serialize_entry("state", &self.state)?;
9723        }
9724        if !self.routing_vpcs.is_empty() {
9725            state.serialize_entry("routingVpcs", &self.routing_vpcs)?;
9726        }
9727        if !self.route_tables.is_empty() {
9728            state.serialize_entry("routeTables", &self.route_tables)?;
9729        }
9730        if self.spoke_summary.is_some() {
9731            state.serialize_entry("spokeSummary", &self.spoke_summary)?;
9732        }
9733        if !wkt::internal::is_default(&self.policy_mode) {
9734            state.serialize_entry("policyMode", &self.policy_mode)?;
9735        }
9736        if !wkt::internal::is_default(&self.preset_topology) {
9737            state.serialize_entry("presetTopology", &self.preset_topology)?;
9738        }
9739        if self.export_psc.is_some() {
9740            state.serialize_entry("exportPsc", &self.export_psc)?;
9741        }
9742        if !self._unknown_fields.is_empty() {
9743            for (key, value) in self._unknown_fields.iter() {
9744                state.serialize_entry(key, &value)?;
9745            }
9746        }
9747        state.end()
9748    }
9749}
9750
9751/// RoutingVPC contains information about the VPC networks associated
9752/// with the spokes of a Network Connectivity Center hub.
9753#[derive(Clone, Debug, Default, PartialEq)]
9754#[non_exhaustive]
9755pub struct RoutingVPC {
9756    /// The URI of the VPC network.
9757    pub uri: std::string::String,
9758
9759    /// Output only. If true, indicates that this VPC network is currently
9760    /// associated with spokes that use the data transfer feature (spokes where the
9761    /// site_to_site_data_transfer field is set to true). If you create new spokes
9762    /// that use data transfer, they must be associated with this VPC network. At
9763    /// most, one VPC network will have this field set to true.
9764    pub required_for_new_site_to_site_data_transfer_spokes: bool,
9765
9766    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9767}
9768
9769impl RoutingVPC {
9770    pub fn new() -> Self {
9771        std::default::Default::default()
9772    }
9773
9774    /// Sets the value of [uri][crate::model::RoutingVPC::uri].
9775    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9776        self.uri = v.into();
9777        self
9778    }
9779
9780    /// Sets the value of [required_for_new_site_to_site_data_transfer_spokes][crate::model::RoutingVPC::required_for_new_site_to_site_data_transfer_spokes].
9781    pub fn set_required_for_new_site_to_site_data_transfer_spokes<T: std::convert::Into<bool>>(
9782        mut self,
9783        v: T,
9784    ) -> Self {
9785        self.required_for_new_site_to_site_data_transfer_spokes = v.into();
9786        self
9787    }
9788}
9789
9790impl wkt::message::Message for RoutingVPC {
9791    fn typename() -> &'static str {
9792        "type.googleapis.com/google.cloud.networkconnectivity.v1.RoutingVPC"
9793    }
9794}
9795
9796#[doc(hidden)]
9797impl<'de> serde::de::Deserialize<'de> for RoutingVPC {
9798    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9799    where
9800        D: serde::Deserializer<'de>,
9801    {
9802        #[allow(non_camel_case_types)]
9803        #[doc(hidden)]
9804        #[derive(PartialEq, Eq, Hash)]
9805        enum __FieldTag {
9806            __uri,
9807            __required_for_new_site_to_site_data_transfer_spokes,
9808            Unknown(std::string::String),
9809        }
9810        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9811            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9812            where
9813                D: serde::Deserializer<'de>,
9814            {
9815                struct Visitor;
9816                impl<'de> serde::de::Visitor<'de> for Visitor {
9817                    type Value = __FieldTag;
9818                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9819                        formatter.write_str("a field name for RoutingVPC")
9820                    }
9821                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9822                    where
9823                        E: serde::de::Error,
9824                    {
9825                        use std::result::Result::Ok;
9826                        use std::string::ToString;
9827                        match value {
9828                            "uri" => Ok(__FieldTag::__uri),
9829                            "requiredForNewSiteToSiteDataTransferSpokes" => Ok(
9830                                __FieldTag::__required_for_new_site_to_site_data_transfer_spokes,
9831                            ),
9832                            "required_for_new_site_to_site_data_transfer_spokes" => Ok(
9833                                __FieldTag::__required_for_new_site_to_site_data_transfer_spokes,
9834                            ),
9835                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9836                        }
9837                    }
9838                }
9839                deserializer.deserialize_identifier(Visitor)
9840            }
9841        }
9842        struct Visitor;
9843        impl<'de> serde::de::Visitor<'de> for Visitor {
9844            type Value = RoutingVPC;
9845            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9846                formatter.write_str("struct RoutingVPC")
9847            }
9848            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9849            where
9850                A: serde::de::MapAccess<'de>,
9851            {
9852                #[allow(unused_imports)]
9853                use serde::de::Error;
9854                use std::option::Option::Some;
9855                let mut fields = std::collections::HashSet::new();
9856                let mut result = Self::Value::new();
9857                while let Some(tag) = map.next_key::<__FieldTag>()? {
9858                    #[allow(clippy::match_single_binding)]
9859                    match tag {
9860                        __FieldTag::__uri => {
9861                            if !fields.insert(__FieldTag::__uri) {
9862                                return std::result::Result::Err(A::Error::duplicate_field(
9863                                    "multiple values for uri",
9864                                ));
9865                            }
9866                            result.uri = map
9867                                .next_value::<std::option::Option<std::string::String>>()?
9868                                .unwrap_or_default();
9869                        }
9870                        __FieldTag::__required_for_new_site_to_site_data_transfer_spokes => {
9871                            if !fields.insert(
9872                                __FieldTag::__required_for_new_site_to_site_data_transfer_spokes,
9873                            ) {
9874                                return std::result::Result::Err(A::Error::duplicate_field(
9875                                    "multiple values for required_for_new_site_to_site_data_transfer_spokes",
9876                                ));
9877                            }
9878                            result.required_for_new_site_to_site_data_transfer_spokes = map
9879                                .next_value::<std::option::Option<bool>>()?
9880                                .unwrap_or_default();
9881                        }
9882                        __FieldTag::Unknown(key) => {
9883                            let value = map.next_value::<serde_json::Value>()?;
9884                            result._unknown_fields.insert(key, value);
9885                        }
9886                    }
9887                }
9888                std::result::Result::Ok(result)
9889            }
9890        }
9891        deserializer.deserialize_any(Visitor)
9892    }
9893}
9894
9895#[doc(hidden)]
9896impl serde::ser::Serialize for RoutingVPC {
9897    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9898    where
9899        S: serde::ser::Serializer,
9900    {
9901        use serde::ser::SerializeMap;
9902        #[allow(unused_imports)]
9903        use std::option::Option::Some;
9904        let mut state = serializer.serialize_map(std::option::Option::None)?;
9905        if !self.uri.is_empty() {
9906            state.serialize_entry("uri", &self.uri)?;
9907        }
9908        if !wkt::internal::is_default(&self.required_for_new_site_to_site_data_transfer_spokes) {
9909            state.serialize_entry(
9910                "requiredForNewSiteToSiteDataTransferSpokes",
9911                &self.required_for_new_site_to_site_data_transfer_spokes,
9912            )?;
9913        }
9914        if !self._unknown_fields.is_empty() {
9915            for (key, value) in self._unknown_fields.iter() {
9916                state.serialize_entry(key, &value)?;
9917            }
9918        }
9919        state.end()
9920    }
9921}
9922
9923/// A Network Connectivity Center spoke represents one or more network
9924/// connectivity resources.
9925///
9926/// When you create a spoke, you associate it with a hub. You must also
9927/// identify a value for exactly one of the following fields:
9928///
9929/// * linked_vpn_tunnels
9930/// * linked_interconnect_attachments
9931/// * linked_router_appliance_instances
9932/// * linked_vpc_network
9933#[derive(Clone, Debug, Default, PartialEq)]
9934#[non_exhaustive]
9935pub struct Spoke {
9936    /// Immutable. The name of the spoke. Spoke names must be unique. They use the
9937    /// following form:
9938    /// `projects/{project_number}/locations/{region}/spokes/{spoke_id}`
9939    pub name: std::string::String,
9940
9941    /// Output only. The time the spoke was created.
9942    pub create_time: std::option::Option<wkt::Timestamp>,
9943
9944    /// Output only. The time the spoke was last updated.
9945    pub update_time: std::option::Option<wkt::Timestamp>,
9946
9947    /// Optional labels in key-value pair format. For more information about
9948    /// labels, see [Requirements for
9949    /// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements).
9950    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
9951
9952    /// Optional. An optional description of the spoke.
9953    pub description: std::string::String,
9954
9955    /// Immutable. The name of the hub that this spoke is attached to.
9956    pub hub: std::string::String,
9957
9958    /// Optional. The name of the group that this spoke is associated with.
9959    pub group: std::string::String,
9960
9961    /// Optional. VPN tunnels that are associated with the spoke.
9962    pub linked_vpn_tunnels: std::option::Option<crate::model::LinkedVpnTunnels>,
9963
9964    /// Optional. VLAN attachments that are associated with the spoke.
9965    pub linked_interconnect_attachments:
9966        std::option::Option<crate::model::LinkedInterconnectAttachments>,
9967
9968    /// Optional. Router appliance instances that are associated with the spoke.
9969    pub linked_router_appliance_instances:
9970        std::option::Option<crate::model::LinkedRouterApplianceInstances>,
9971
9972    /// Optional. VPC network that is associated with the spoke.
9973    pub linked_vpc_network: std::option::Option<crate::model::LinkedVpcNetwork>,
9974
9975    /// Optional. The linked producer VPC that is associated with the spoke.
9976    pub linked_producer_vpc_network: std::option::Option<crate::model::LinkedProducerVpcNetwork>,
9977
9978    /// Output only. The Google-generated UUID for the spoke. This value is unique
9979    /// across all spoke resources. If a spoke is deleted and another with the same
9980    /// name is created, the new spoke is assigned a different `unique_id`.
9981    pub unique_id: std::string::String,
9982
9983    /// Output only. The current lifecycle state of this spoke.
9984    pub state: crate::model::State,
9985
9986    /// Output only. The reasons for current state of the spoke.
9987    pub reasons: std::vec::Vec<crate::model::spoke::StateReason>,
9988
9989    /// Output only. The type of resource associated with the spoke.
9990    pub spoke_type: crate::model::SpokeType,
9991
9992    /// Optional. This checksum is computed by the server based on the value of
9993    /// other fields, and may be sent on update and delete requests to ensure the
9994    /// client has an up-to-date value before proceeding.
9995    pub etag: std::string::String,
9996
9997    /// Optional. The list of fields waiting for hub administration's approval.
9998    pub field_paths_pending_update: std::vec::Vec<std::string::String>,
9999
10000    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10001}
10002
10003impl Spoke {
10004    pub fn new() -> Self {
10005        std::default::Default::default()
10006    }
10007
10008    /// Sets the value of [name][crate::model::Spoke::name].
10009    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10010        self.name = v.into();
10011        self
10012    }
10013
10014    /// Sets the value of [create_time][crate::model::Spoke::create_time].
10015    pub fn set_create_time<T>(mut self, v: T) -> Self
10016    where
10017        T: std::convert::Into<wkt::Timestamp>,
10018    {
10019        self.create_time = std::option::Option::Some(v.into());
10020        self
10021    }
10022
10023    /// Sets or clears the value of [create_time][crate::model::Spoke::create_time].
10024    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10025    where
10026        T: std::convert::Into<wkt::Timestamp>,
10027    {
10028        self.create_time = v.map(|x| x.into());
10029        self
10030    }
10031
10032    /// Sets the value of [update_time][crate::model::Spoke::update_time].
10033    pub fn set_update_time<T>(mut self, v: T) -> Self
10034    where
10035        T: std::convert::Into<wkt::Timestamp>,
10036    {
10037        self.update_time = std::option::Option::Some(v.into());
10038        self
10039    }
10040
10041    /// Sets or clears the value of [update_time][crate::model::Spoke::update_time].
10042    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
10043    where
10044        T: std::convert::Into<wkt::Timestamp>,
10045    {
10046        self.update_time = v.map(|x| x.into());
10047        self
10048    }
10049
10050    /// Sets the value of [labels][crate::model::Spoke::labels].
10051    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10052    where
10053        T: std::iter::IntoIterator<Item = (K, V)>,
10054        K: std::convert::Into<std::string::String>,
10055        V: std::convert::Into<std::string::String>,
10056    {
10057        use std::iter::Iterator;
10058        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10059        self
10060    }
10061
10062    /// Sets the value of [description][crate::model::Spoke::description].
10063    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10064        self.description = v.into();
10065        self
10066    }
10067
10068    /// Sets the value of [hub][crate::model::Spoke::hub].
10069    pub fn set_hub<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10070        self.hub = v.into();
10071        self
10072    }
10073
10074    /// Sets the value of [group][crate::model::Spoke::group].
10075    pub fn set_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10076        self.group = v.into();
10077        self
10078    }
10079
10080    /// Sets the value of [linked_vpn_tunnels][crate::model::Spoke::linked_vpn_tunnels].
10081    pub fn set_linked_vpn_tunnels<T>(mut self, v: T) -> Self
10082    where
10083        T: std::convert::Into<crate::model::LinkedVpnTunnels>,
10084    {
10085        self.linked_vpn_tunnels = std::option::Option::Some(v.into());
10086        self
10087    }
10088
10089    /// Sets or clears the value of [linked_vpn_tunnels][crate::model::Spoke::linked_vpn_tunnels].
10090    pub fn set_or_clear_linked_vpn_tunnels<T>(mut self, v: std::option::Option<T>) -> Self
10091    where
10092        T: std::convert::Into<crate::model::LinkedVpnTunnels>,
10093    {
10094        self.linked_vpn_tunnels = v.map(|x| x.into());
10095        self
10096    }
10097
10098    /// Sets the value of [linked_interconnect_attachments][crate::model::Spoke::linked_interconnect_attachments].
10099    pub fn set_linked_interconnect_attachments<T>(mut self, v: T) -> Self
10100    where
10101        T: std::convert::Into<crate::model::LinkedInterconnectAttachments>,
10102    {
10103        self.linked_interconnect_attachments = std::option::Option::Some(v.into());
10104        self
10105    }
10106
10107    /// Sets or clears the value of [linked_interconnect_attachments][crate::model::Spoke::linked_interconnect_attachments].
10108    pub fn set_or_clear_linked_interconnect_attachments<T>(
10109        mut self,
10110        v: std::option::Option<T>,
10111    ) -> Self
10112    where
10113        T: std::convert::Into<crate::model::LinkedInterconnectAttachments>,
10114    {
10115        self.linked_interconnect_attachments = v.map(|x| x.into());
10116        self
10117    }
10118
10119    /// Sets the value of [linked_router_appliance_instances][crate::model::Spoke::linked_router_appliance_instances].
10120    pub fn set_linked_router_appliance_instances<T>(mut self, v: T) -> Self
10121    where
10122        T: std::convert::Into<crate::model::LinkedRouterApplianceInstances>,
10123    {
10124        self.linked_router_appliance_instances = std::option::Option::Some(v.into());
10125        self
10126    }
10127
10128    /// Sets or clears the value of [linked_router_appliance_instances][crate::model::Spoke::linked_router_appliance_instances].
10129    pub fn set_or_clear_linked_router_appliance_instances<T>(
10130        mut self,
10131        v: std::option::Option<T>,
10132    ) -> Self
10133    where
10134        T: std::convert::Into<crate::model::LinkedRouterApplianceInstances>,
10135    {
10136        self.linked_router_appliance_instances = v.map(|x| x.into());
10137        self
10138    }
10139
10140    /// Sets the value of [linked_vpc_network][crate::model::Spoke::linked_vpc_network].
10141    pub fn set_linked_vpc_network<T>(mut self, v: T) -> Self
10142    where
10143        T: std::convert::Into<crate::model::LinkedVpcNetwork>,
10144    {
10145        self.linked_vpc_network = std::option::Option::Some(v.into());
10146        self
10147    }
10148
10149    /// Sets or clears the value of [linked_vpc_network][crate::model::Spoke::linked_vpc_network].
10150    pub fn set_or_clear_linked_vpc_network<T>(mut self, v: std::option::Option<T>) -> Self
10151    where
10152        T: std::convert::Into<crate::model::LinkedVpcNetwork>,
10153    {
10154        self.linked_vpc_network = v.map(|x| x.into());
10155        self
10156    }
10157
10158    /// Sets the value of [linked_producer_vpc_network][crate::model::Spoke::linked_producer_vpc_network].
10159    pub fn set_linked_producer_vpc_network<T>(mut self, v: T) -> Self
10160    where
10161        T: std::convert::Into<crate::model::LinkedProducerVpcNetwork>,
10162    {
10163        self.linked_producer_vpc_network = std::option::Option::Some(v.into());
10164        self
10165    }
10166
10167    /// Sets or clears the value of [linked_producer_vpc_network][crate::model::Spoke::linked_producer_vpc_network].
10168    pub fn set_or_clear_linked_producer_vpc_network<T>(mut self, v: std::option::Option<T>) -> Self
10169    where
10170        T: std::convert::Into<crate::model::LinkedProducerVpcNetwork>,
10171    {
10172        self.linked_producer_vpc_network = v.map(|x| x.into());
10173        self
10174    }
10175
10176    /// Sets the value of [unique_id][crate::model::Spoke::unique_id].
10177    pub fn set_unique_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10178        self.unique_id = v.into();
10179        self
10180    }
10181
10182    /// Sets the value of [state][crate::model::Spoke::state].
10183    pub fn set_state<T: std::convert::Into<crate::model::State>>(mut self, v: T) -> Self {
10184        self.state = v.into();
10185        self
10186    }
10187
10188    /// Sets the value of [reasons][crate::model::Spoke::reasons].
10189    pub fn set_reasons<T, V>(mut self, v: T) -> Self
10190    where
10191        T: std::iter::IntoIterator<Item = V>,
10192        V: std::convert::Into<crate::model::spoke::StateReason>,
10193    {
10194        use std::iter::Iterator;
10195        self.reasons = v.into_iter().map(|i| i.into()).collect();
10196        self
10197    }
10198
10199    /// Sets the value of [spoke_type][crate::model::Spoke::spoke_type].
10200    pub fn set_spoke_type<T: std::convert::Into<crate::model::SpokeType>>(mut self, v: T) -> Self {
10201        self.spoke_type = v.into();
10202        self
10203    }
10204
10205    /// Sets the value of [etag][crate::model::Spoke::etag].
10206    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10207        self.etag = v.into();
10208        self
10209    }
10210
10211    /// Sets the value of [field_paths_pending_update][crate::model::Spoke::field_paths_pending_update].
10212    pub fn set_field_paths_pending_update<T, V>(mut self, v: T) -> Self
10213    where
10214        T: std::iter::IntoIterator<Item = V>,
10215        V: std::convert::Into<std::string::String>,
10216    {
10217        use std::iter::Iterator;
10218        self.field_paths_pending_update = v.into_iter().map(|i| i.into()).collect();
10219        self
10220    }
10221}
10222
10223impl wkt::message::Message for Spoke {
10224    fn typename() -> &'static str {
10225        "type.googleapis.com/google.cloud.networkconnectivity.v1.Spoke"
10226    }
10227}
10228
10229#[doc(hidden)]
10230impl<'de> serde::de::Deserialize<'de> for Spoke {
10231    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10232    where
10233        D: serde::Deserializer<'de>,
10234    {
10235        #[allow(non_camel_case_types)]
10236        #[doc(hidden)]
10237        #[derive(PartialEq, Eq, Hash)]
10238        enum __FieldTag {
10239            __name,
10240            __create_time,
10241            __update_time,
10242            __labels,
10243            __description,
10244            __hub,
10245            __group,
10246            __linked_vpn_tunnels,
10247            __linked_interconnect_attachments,
10248            __linked_router_appliance_instances,
10249            __linked_vpc_network,
10250            __linked_producer_vpc_network,
10251            __unique_id,
10252            __state,
10253            __reasons,
10254            __spoke_type,
10255            __etag,
10256            __field_paths_pending_update,
10257            Unknown(std::string::String),
10258        }
10259        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10260            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10261            where
10262                D: serde::Deserializer<'de>,
10263            {
10264                struct Visitor;
10265                impl<'de> serde::de::Visitor<'de> for Visitor {
10266                    type Value = __FieldTag;
10267                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10268                        formatter.write_str("a field name for Spoke")
10269                    }
10270                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10271                    where
10272                        E: serde::de::Error,
10273                    {
10274                        use std::result::Result::Ok;
10275                        use std::string::ToString;
10276                        match value {
10277                            "name" => Ok(__FieldTag::__name),
10278                            "createTime" => Ok(__FieldTag::__create_time),
10279                            "create_time" => Ok(__FieldTag::__create_time),
10280                            "updateTime" => Ok(__FieldTag::__update_time),
10281                            "update_time" => Ok(__FieldTag::__update_time),
10282                            "labels" => Ok(__FieldTag::__labels),
10283                            "description" => Ok(__FieldTag::__description),
10284                            "hub" => Ok(__FieldTag::__hub),
10285                            "group" => Ok(__FieldTag::__group),
10286                            "linkedVpnTunnels" => Ok(__FieldTag::__linked_vpn_tunnels),
10287                            "linked_vpn_tunnels" => Ok(__FieldTag::__linked_vpn_tunnels),
10288                            "linkedInterconnectAttachments" => {
10289                                Ok(__FieldTag::__linked_interconnect_attachments)
10290                            }
10291                            "linked_interconnect_attachments" => {
10292                                Ok(__FieldTag::__linked_interconnect_attachments)
10293                            }
10294                            "linkedRouterApplianceInstances" => {
10295                                Ok(__FieldTag::__linked_router_appliance_instances)
10296                            }
10297                            "linked_router_appliance_instances" => {
10298                                Ok(__FieldTag::__linked_router_appliance_instances)
10299                            }
10300                            "linkedVpcNetwork" => Ok(__FieldTag::__linked_vpc_network),
10301                            "linked_vpc_network" => Ok(__FieldTag::__linked_vpc_network),
10302                            "linkedProducerVpcNetwork" => {
10303                                Ok(__FieldTag::__linked_producer_vpc_network)
10304                            }
10305                            "linked_producer_vpc_network" => {
10306                                Ok(__FieldTag::__linked_producer_vpc_network)
10307                            }
10308                            "uniqueId" => Ok(__FieldTag::__unique_id),
10309                            "unique_id" => Ok(__FieldTag::__unique_id),
10310                            "state" => Ok(__FieldTag::__state),
10311                            "reasons" => Ok(__FieldTag::__reasons),
10312                            "spokeType" => Ok(__FieldTag::__spoke_type),
10313                            "spoke_type" => Ok(__FieldTag::__spoke_type),
10314                            "etag" => Ok(__FieldTag::__etag),
10315                            "fieldPathsPendingUpdate" => {
10316                                Ok(__FieldTag::__field_paths_pending_update)
10317                            }
10318                            "field_paths_pending_update" => {
10319                                Ok(__FieldTag::__field_paths_pending_update)
10320                            }
10321                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10322                        }
10323                    }
10324                }
10325                deserializer.deserialize_identifier(Visitor)
10326            }
10327        }
10328        struct Visitor;
10329        impl<'de> serde::de::Visitor<'de> for Visitor {
10330            type Value = Spoke;
10331            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10332                formatter.write_str("struct Spoke")
10333            }
10334            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10335            where
10336                A: serde::de::MapAccess<'de>,
10337            {
10338                #[allow(unused_imports)]
10339                use serde::de::Error;
10340                use std::option::Option::Some;
10341                let mut fields = std::collections::HashSet::new();
10342                let mut result = Self::Value::new();
10343                while let Some(tag) = map.next_key::<__FieldTag>()? {
10344                    #[allow(clippy::match_single_binding)]
10345                    match tag {
10346                        __FieldTag::__name => {
10347                            if !fields.insert(__FieldTag::__name) {
10348                                return std::result::Result::Err(A::Error::duplicate_field(
10349                                    "multiple values for name",
10350                                ));
10351                            }
10352                            result.name = map
10353                                .next_value::<std::option::Option<std::string::String>>()?
10354                                .unwrap_or_default();
10355                        }
10356                        __FieldTag::__create_time => {
10357                            if !fields.insert(__FieldTag::__create_time) {
10358                                return std::result::Result::Err(A::Error::duplicate_field(
10359                                    "multiple values for create_time",
10360                                ));
10361                            }
10362                            result.create_time =
10363                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
10364                        }
10365                        __FieldTag::__update_time => {
10366                            if !fields.insert(__FieldTag::__update_time) {
10367                                return std::result::Result::Err(A::Error::duplicate_field(
10368                                    "multiple values for update_time",
10369                                ));
10370                            }
10371                            result.update_time =
10372                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
10373                        }
10374                        __FieldTag::__labels => {
10375                            if !fields.insert(__FieldTag::__labels) {
10376                                return std::result::Result::Err(A::Error::duplicate_field(
10377                                    "multiple values for labels",
10378                                ));
10379                            }
10380                            result.labels = map
10381                                .next_value::<std::option::Option<
10382                                    std::collections::HashMap<
10383                                        std::string::String,
10384                                        std::string::String,
10385                                    >,
10386                                >>()?
10387                                .unwrap_or_default();
10388                        }
10389                        __FieldTag::__description => {
10390                            if !fields.insert(__FieldTag::__description) {
10391                                return std::result::Result::Err(A::Error::duplicate_field(
10392                                    "multiple values for description",
10393                                ));
10394                            }
10395                            result.description = map
10396                                .next_value::<std::option::Option<std::string::String>>()?
10397                                .unwrap_or_default();
10398                        }
10399                        __FieldTag::__hub => {
10400                            if !fields.insert(__FieldTag::__hub) {
10401                                return std::result::Result::Err(A::Error::duplicate_field(
10402                                    "multiple values for hub",
10403                                ));
10404                            }
10405                            result.hub = map
10406                                .next_value::<std::option::Option<std::string::String>>()?
10407                                .unwrap_or_default();
10408                        }
10409                        __FieldTag::__group => {
10410                            if !fields.insert(__FieldTag::__group) {
10411                                return std::result::Result::Err(A::Error::duplicate_field(
10412                                    "multiple values for group",
10413                                ));
10414                            }
10415                            result.group = map
10416                                .next_value::<std::option::Option<std::string::String>>()?
10417                                .unwrap_or_default();
10418                        }
10419                        __FieldTag::__linked_vpn_tunnels => {
10420                            if !fields.insert(__FieldTag::__linked_vpn_tunnels) {
10421                                return std::result::Result::Err(A::Error::duplicate_field(
10422                                    "multiple values for linked_vpn_tunnels",
10423                                ));
10424                            }
10425                            result.linked_vpn_tunnels = map
10426                                .next_value::<std::option::Option<crate::model::LinkedVpnTunnels>>(
10427                                )?;
10428                        }
10429                        __FieldTag::__linked_interconnect_attachments => {
10430                            if !fields.insert(__FieldTag::__linked_interconnect_attachments) {
10431                                return std::result::Result::Err(A::Error::duplicate_field(
10432                                    "multiple values for linked_interconnect_attachments",
10433                                ));
10434                            }
10435                            result.linked_interconnect_attachments =
10436                                map.next_value::<std::option::Option<
10437                                    crate::model::LinkedInterconnectAttachments,
10438                                >>()?;
10439                        }
10440                        __FieldTag::__linked_router_appliance_instances => {
10441                            if !fields.insert(__FieldTag::__linked_router_appliance_instances) {
10442                                return std::result::Result::Err(A::Error::duplicate_field(
10443                                    "multiple values for linked_router_appliance_instances",
10444                                ));
10445                            }
10446                            result.linked_router_appliance_instances =
10447                                map.next_value::<std::option::Option<
10448                                    crate::model::LinkedRouterApplianceInstances,
10449                                >>()?;
10450                        }
10451                        __FieldTag::__linked_vpc_network => {
10452                            if !fields.insert(__FieldTag::__linked_vpc_network) {
10453                                return std::result::Result::Err(A::Error::duplicate_field(
10454                                    "multiple values for linked_vpc_network",
10455                                ));
10456                            }
10457                            result.linked_vpc_network = map
10458                                .next_value::<std::option::Option<crate::model::LinkedVpcNetwork>>(
10459                                )?;
10460                        }
10461                        __FieldTag::__linked_producer_vpc_network => {
10462                            if !fields.insert(__FieldTag::__linked_producer_vpc_network) {
10463                                return std::result::Result::Err(A::Error::duplicate_field(
10464                                    "multiple values for linked_producer_vpc_network",
10465                                ));
10466                            }
10467                            result.linked_producer_vpc_network = map.next_value::<std::option::Option<crate::model::LinkedProducerVpcNetwork>>()?
10468                                ;
10469                        }
10470                        __FieldTag::__unique_id => {
10471                            if !fields.insert(__FieldTag::__unique_id) {
10472                                return std::result::Result::Err(A::Error::duplicate_field(
10473                                    "multiple values for unique_id",
10474                                ));
10475                            }
10476                            result.unique_id = map
10477                                .next_value::<std::option::Option<std::string::String>>()?
10478                                .unwrap_or_default();
10479                        }
10480                        __FieldTag::__state => {
10481                            if !fields.insert(__FieldTag::__state) {
10482                                return std::result::Result::Err(A::Error::duplicate_field(
10483                                    "multiple values for state",
10484                                ));
10485                            }
10486                            result.state = map
10487                                .next_value::<std::option::Option<crate::model::State>>()?
10488                                .unwrap_or_default();
10489                        }
10490                        __FieldTag::__reasons => {
10491                            if !fields.insert(__FieldTag::__reasons) {
10492                                return std::result::Result::Err(A::Error::duplicate_field(
10493                                    "multiple values for reasons",
10494                                ));
10495                            }
10496                            result.reasons = map
10497                                .next_value::<std::option::Option<
10498                                    std::vec::Vec<crate::model::spoke::StateReason>,
10499                                >>()?
10500                                .unwrap_or_default();
10501                        }
10502                        __FieldTag::__spoke_type => {
10503                            if !fields.insert(__FieldTag::__spoke_type) {
10504                                return std::result::Result::Err(A::Error::duplicate_field(
10505                                    "multiple values for spoke_type",
10506                                ));
10507                            }
10508                            result.spoke_type = map
10509                                .next_value::<std::option::Option<crate::model::SpokeType>>()?
10510                                .unwrap_or_default();
10511                        }
10512                        __FieldTag::__etag => {
10513                            if !fields.insert(__FieldTag::__etag) {
10514                                return std::result::Result::Err(A::Error::duplicate_field(
10515                                    "multiple values for etag",
10516                                ));
10517                            }
10518                            result.etag = map
10519                                .next_value::<std::option::Option<std::string::String>>()?
10520                                .unwrap_or_default();
10521                        }
10522                        __FieldTag::__field_paths_pending_update => {
10523                            if !fields.insert(__FieldTag::__field_paths_pending_update) {
10524                                return std::result::Result::Err(A::Error::duplicate_field(
10525                                    "multiple values for field_paths_pending_update",
10526                                ));
10527                            }
10528                            result.field_paths_pending_update = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
10529                        }
10530                        __FieldTag::Unknown(key) => {
10531                            let value = map.next_value::<serde_json::Value>()?;
10532                            result._unknown_fields.insert(key, value);
10533                        }
10534                    }
10535                }
10536                std::result::Result::Ok(result)
10537            }
10538        }
10539        deserializer.deserialize_any(Visitor)
10540    }
10541}
10542
10543#[doc(hidden)]
10544impl serde::ser::Serialize for Spoke {
10545    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10546    where
10547        S: serde::ser::Serializer,
10548    {
10549        use serde::ser::SerializeMap;
10550        #[allow(unused_imports)]
10551        use std::option::Option::Some;
10552        let mut state = serializer.serialize_map(std::option::Option::None)?;
10553        if !self.name.is_empty() {
10554            state.serialize_entry("name", &self.name)?;
10555        }
10556        if self.create_time.is_some() {
10557            state.serialize_entry("createTime", &self.create_time)?;
10558        }
10559        if self.update_time.is_some() {
10560            state.serialize_entry("updateTime", &self.update_time)?;
10561        }
10562        if !self.labels.is_empty() {
10563            state.serialize_entry("labels", &self.labels)?;
10564        }
10565        if !self.description.is_empty() {
10566            state.serialize_entry("description", &self.description)?;
10567        }
10568        if !self.hub.is_empty() {
10569            state.serialize_entry("hub", &self.hub)?;
10570        }
10571        if !self.group.is_empty() {
10572            state.serialize_entry("group", &self.group)?;
10573        }
10574        if self.linked_vpn_tunnels.is_some() {
10575            state.serialize_entry("linkedVpnTunnels", &self.linked_vpn_tunnels)?;
10576        }
10577        if self.linked_interconnect_attachments.is_some() {
10578            state.serialize_entry(
10579                "linkedInterconnectAttachments",
10580                &self.linked_interconnect_attachments,
10581            )?;
10582        }
10583        if self.linked_router_appliance_instances.is_some() {
10584            state.serialize_entry(
10585                "linkedRouterApplianceInstances",
10586                &self.linked_router_appliance_instances,
10587            )?;
10588        }
10589        if self.linked_vpc_network.is_some() {
10590            state.serialize_entry("linkedVpcNetwork", &self.linked_vpc_network)?;
10591        }
10592        if self.linked_producer_vpc_network.is_some() {
10593            state.serialize_entry(
10594                "linkedProducerVpcNetwork",
10595                &self.linked_producer_vpc_network,
10596            )?;
10597        }
10598        if !self.unique_id.is_empty() {
10599            state.serialize_entry("uniqueId", &self.unique_id)?;
10600        }
10601        if !wkt::internal::is_default(&self.state) {
10602            state.serialize_entry("state", &self.state)?;
10603        }
10604        if !self.reasons.is_empty() {
10605            state.serialize_entry("reasons", &self.reasons)?;
10606        }
10607        if !wkt::internal::is_default(&self.spoke_type) {
10608            state.serialize_entry("spokeType", &self.spoke_type)?;
10609        }
10610        if !self.etag.is_empty() {
10611            state.serialize_entry("etag", &self.etag)?;
10612        }
10613        if !self.field_paths_pending_update.is_empty() {
10614            state.serialize_entry("fieldPathsPendingUpdate", &self.field_paths_pending_update)?;
10615        }
10616        if !self._unknown_fields.is_empty() {
10617            for (key, value) in self._unknown_fields.iter() {
10618                state.serialize_entry(key, &value)?;
10619            }
10620        }
10621        state.end()
10622    }
10623}
10624
10625/// Defines additional types related to [Spoke].
10626pub mod spoke {
10627    #[allow(unused_imports)]
10628    use super::*;
10629
10630    /// The reason a spoke is inactive.
10631    #[derive(Clone, Debug, Default, PartialEq)]
10632    #[non_exhaustive]
10633    pub struct StateReason {
10634        /// The code associated with this reason.
10635        pub code: crate::model::spoke::state_reason::Code,
10636
10637        /// Human-readable details about this reason.
10638        pub message: std::string::String,
10639
10640        /// Additional information provided by the user in the RejectSpoke call.
10641        pub user_details: std::string::String,
10642
10643        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10644    }
10645
10646    impl StateReason {
10647        pub fn new() -> Self {
10648            std::default::Default::default()
10649        }
10650
10651        /// Sets the value of [code][crate::model::spoke::StateReason::code].
10652        pub fn set_code<T: std::convert::Into<crate::model::spoke::state_reason::Code>>(
10653            mut self,
10654            v: T,
10655        ) -> Self {
10656            self.code = v.into();
10657            self
10658        }
10659
10660        /// Sets the value of [message][crate::model::spoke::StateReason::message].
10661        pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10662            self.message = v.into();
10663            self
10664        }
10665
10666        /// Sets the value of [user_details][crate::model::spoke::StateReason::user_details].
10667        pub fn set_user_details<T: std::convert::Into<std::string::String>>(
10668            mut self,
10669            v: T,
10670        ) -> Self {
10671            self.user_details = v.into();
10672            self
10673        }
10674    }
10675
10676    impl wkt::message::Message for StateReason {
10677        fn typename() -> &'static str {
10678            "type.googleapis.com/google.cloud.networkconnectivity.v1.Spoke.StateReason"
10679        }
10680    }
10681
10682    #[doc(hidden)]
10683    impl<'de> serde::de::Deserialize<'de> for StateReason {
10684        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10685        where
10686            D: serde::Deserializer<'de>,
10687        {
10688            #[allow(non_camel_case_types)]
10689            #[doc(hidden)]
10690            #[derive(PartialEq, Eq, Hash)]
10691            enum __FieldTag {
10692                __code,
10693                __message,
10694                __user_details,
10695                Unknown(std::string::String),
10696            }
10697            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10698                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10699                where
10700                    D: serde::Deserializer<'de>,
10701                {
10702                    struct Visitor;
10703                    impl<'de> serde::de::Visitor<'de> for Visitor {
10704                        type Value = __FieldTag;
10705                        fn expecting(
10706                            &self,
10707                            formatter: &mut std::fmt::Formatter,
10708                        ) -> std::fmt::Result {
10709                            formatter.write_str("a field name for StateReason")
10710                        }
10711                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10712                        where
10713                            E: serde::de::Error,
10714                        {
10715                            use std::result::Result::Ok;
10716                            use std::string::ToString;
10717                            match value {
10718                                "code" => Ok(__FieldTag::__code),
10719                                "message" => Ok(__FieldTag::__message),
10720                                "userDetails" => Ok(__FieldTag::__user_details),
10721                                "user_details" => Ok(__FieldTag::__user_details),
10722                                _ => Ok(__FieldTag::Unknown(value.to_string())),
10723                            }
10724                        }
10725                    }
10726                    deserializer.deserialize_identifier(Visitor)
10727                }
10728            }
10729            struct Visitor;
10730            impl<'de> serde::de::Visitor<'de> for Visitor {
10731                type Value = StateReason;
10732                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10733                    formatter.write_str("struct StateReason")
10734                }
10735                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10736                where
10737                    A: serde::de::MapAccess<'de>,
10738                {
10739                    #[allow(unused_imports)]
10740                    use serde::de::Error;
10741                    use std::option::Option::Some;
10742                    let mut fields = std::collections::HashSet::new();
10743                    let mut result = Self::Value::new();
10744                    while let Some(tag) = map.next_key::<__FieldTag>()? {
10745                        #[allow(clippy::match_single_binding)]
10746                        match tag {
10747                            __FieldTag::__code => {
10748                                if !fields.insert(__FieldTag::__code) {
10749                                    return std::result::Result::Err(A::Error::duplicate_field(
10750                                        "multiple values for code",
10751                                    ));
10752                                }
10753                                result.code =
10754                                    map.next_value::<std::option::Option<
10755                                        crate::model::spoke::state_reason::Code,
10756                                    >>()?
10757                                    .unwrap_or_default();
10758                            }
10759                            __FieldTag::__message => {
10760                                if !fields.insert(__FieldTag::__message) {
10761                                    return std::result::Result::Err(A::Error::duplicate_field(
10762                                        "multiple values for message",
10763                                    ));
10764                                }
10765                                result.message = map
10766                                    .next_value::<std::option::Option<std::string::String>>()?
10767                                    .unwrap_or_default();
10768                            }
10769                            __FieldTag::__user_details => {
10770                                if !fields.insert(__FieldTag::__user_details) {
10771                                    return std::result::Result::Err(A::Error::duplicate_field(
10772                                        "multiple values for user_details",
10773                                    ));
10774                                }
10775                                result.user_details = map
10776                                    .next_value::<std::option::Option<std::string::String>>()?
10777                                    .unwrap_or_default();
10778                            }
10779                            __FieldTag::Unknown(key) => {
10780                                let value = map.next_value::<serde_json::Value>()?;
10781                                result._unknown_fields.insert(key, value);
10782                            }
10783                        }
10784                    }
10785                    std::result::Result::Ok(result)
10786                }
10787            }
10788            deserializer.deserialize_any(Visitor)
10789        }
10790    }
10791
10792    #[doc(hidden)]
10793    impl serde::ser::Serialize for StateReason {
10794        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10795        where
10796            S: serde::ser::Serializer,
10797        {
10798            use serde::ser::SerializeMap;
10799            #[allow(unused_imports)]
10800            use std::option::Option::Some;
10801            let mut state = serializer.serialize_map(std::option::Option::None)?;
10802            if !wkt::internal::is_default(&self.code) {
10803                state.serialize_entry("code", &self.code)?;
10804            }
10805            if !self.message.is_empty() {
10806                state.serialize_entry("message", &self.message)?;
10807            }
10808            if !self.user_details.is_empty() {
10809                state.serialize_entry("userDetails", &self.user_details)?;
10810            }
10811            if !self._unknown_fields.is_empty() {
10812                for (key, value) in self._unknown_fields.iter() {
10813                    state.serialize_entry(key, &value)?;
10814                }
10815            }
10816            state.end()
10817        }
10818    }
10819
10820    /// Defines additional types related to [StateReason].
10821    pub mod state_reason {
10822        #[allow(unused_imports)]
10823        use super::*;
10824
10825        /// The Code enum represents the various reasons a state can be `INACTIVE`.
10826        ///
10827        /// # Working with unknown values
10828        ///
10829        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10830        /// additional enum variants at any time. Adding new variants is not considered
10831        /// a breaking change. Applications should write their code in anticipation of:
10832        ///
10833        /// - New values appearing in future releases of the client library, **and**
10834        /// - New values received dynamically, without application changes.
10835        ///
10836        /// Please consult the [Working with enums] section in the user guide for some
10837        /// guidelines.
10838        ///
10839        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10840        #[derive(Clone, Debug, PartialEq)]
10841        #[non_exhaustive]
10842        pub enum Code {
10843            /// No information available.
10844            Unspecified,
10845            /// The proposed spoke is pending review.
10846            PendingReview,
10847            /// The proposed spoke has been rejected by the hub administrator.
10848            Rejected,
10849            /// The spoke has been deactivated internally.
10850            Paused,
10851            /// Network Connectivity Center encountered errors while accepting
10852            /// the spoke.
10853            Failed,
10854            /// The proposed spoke update is pending review.
10855            UpdatePendingReview,
10856            /// The proposed spoke update has been rejected by the hub administrator.
10857            UpdateRejected,
10858            /// Network Connectivity Center encountered errors while accepting
10859            /// the spoke update.
10860            UpdateFailed,
10861            /// If set, the enum was initialized with an unknown value.
10862            ///
10863            /// Applications can examine the value using [Code::value] or
10864            /// [Code::name].
10865            UnknownValue(code::UnknownValue),
10866        }
10867
10868        #[doc(hidden)]
10869        pub mod code {
10870            #[allow(unused_imports)]
10871            use super::*;
10872            #[derive(Clone, Debug, PartialEq)]
10873            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10874        }
10875
10876        impl Code {
10877            /// Gets the enum value.
10878            ///
10879            /// Returns `None` if the enum contains an unknown value deserialized from
10880            /// the string representation of enums.
10881            pub fn value(&self) -> std::option::Option<i32> {
10882                match self {
10883                    Self::Unspecified => std::option::Option::Some(0),
10884                    Self::PendingReview => std::option::Option::Some(1),
10885                    Self::Rejected => std::option::Option::Some(2),
10886                    Self::Paused => std::option::Option::Some(3),
10887                    Self::Failed => std::option::Option::Some(4),
10888                    Self::UpdatePendingReview => std::option::Option::Some(5),
10889                    Self::UpdateRejected => std::option::Option::Some(6),
10890                    Self::UpdateFailed => std::option::Option::Some(7),
10891                    Self::UnknownValue(u) => u.0.value(),
10892                }
10893            }
10894
10895            /// Gets the enum value as a string.
10896            ///
10897            /// Returns `None` if the enum contains an unknown value deserialized from
10898            /// the integer representation of enums.
10899            pub fn name(&self) -> std::option::Option<&str> {
10900                match self {
10901                    Self::Unspecified => std::option::Option::Some("CODE_UNSPECIFIED"),
10902                    Self::PendingReview => std::option::Option::Some("PENDING_REVIEW"),
10903                    Self::Rejected => std::option::Option::Some("REJECTED"),
10904                    Self::Paused => std::option::Option::Some("PAUSED"),
10905                    Self::Failed => std::option::Option::Some("FAILED"),
10906                    Self::UpdatePendingReview => std::option::Option::Some("UPDATE_PENDING_REVIEW"),
10907                    Self::UpdateRejected => std::option::Option::Some("UPDATE_REJECTED"),
10908                    Self::UpdateFailed => std::option::Option::Some("UPDATE_FAILED"),
10909                    Self::UnknownValue(u) => u.0.name(),
10910                }
10911            }
10912        }
10913
10914        impl std::default::Default for Code {
10915            fn default() -> Self {
10916                use std::convert::From;
10917                Self::from(0)
10918            }
10919        }
10920
10921        impl std::fmt::Display for Code {
10922            fn fmt(
10923                &self,
10924                f: &mut std::fmt::Formatter<'_>,
10925            ) -> std::result::Result<(), std::fmt::Error> {
10926                wkt::internal::display_enum(f, self.name(), self.value())
10927            }
10928        }
10929
10930        impl std::convert::From<i32> for Code {
10931            fn from(value: i32) -> Self {
10932                match value {
10933                    0 => Self::Unspecified,
10934                    1 => Self::PendingReview,
10935                    2 => Self::Rejected,
10936                    3 => Self::Paused,
10937                    4 => Self::Failed,
10938                    5 => Self::UpdatePendingReview,
10939                    6 => Self::UpdateRejected,
10940                    7 => Self::UpdateFailed,
10941                    _ => Self::UnknownValue(code::UnknownValue(
10942                        wkt::internal::UnknownEnumValue::Integer(value),
10943                    )),
10944                }
10945            }
10946        }
10947
10948        impl std::convert::From<&str> for Code {
10949            fn from(value: &str) -> Self {
10950                use std::string::ToString;
10951                match value {
10952                    "CODE_UNSPECIFIED" => Self::Unspecified,
10953                    "PENDING_REVIEW" => Self::PendingReview,
10954                    "REJECTED" => Self::Rejected,
10955                    "PAUSED" => Self::Paused,
10956                    "FAILED" => Self::Failed,
10957                    "UPDATE_PENDING_REVIEW" => Self::UpdatePendingReview,
10958                    "UPDATE_REJECTED" => Self::UpdateRejected,
10959                    "UPDATE_FAILED" => Self::UpdateFailed,
10960                    _ => Self::UnknownValue(code::UnknownValue(
10961                        wkt::internal::UnknownEnumValue::String(value.to_string()),
10962                    )),
10963                }
10964            }
10965        }
10966
10967        impl serde::ser::Serialize for Code {
10968            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10969            where
10970                S: serde::Serializer,
10971            {
10972                match self {
10973                    Self::Unspecified => serializer.serialize_i32(0),
10974                    Self::PendingReview => serializer.serialize_i32(1),
10975                    Self::Rejected => serializer.serialize_i32(2),
10976                    Self::Paused => serializer.serialize_i32(3),
10977                    Self::Failed => serializer.serialize_i32(4),
10978                    Self::UpdatePendingReview => serializer.serialize_i32(5),
10979                    Self::UpdateRejected => serializer.serialize_i32(6),
10980                    Self::UpdateFailed => serializer.serialize_i32(7),
10981                    Self::UnknownValue(u) => u.0.serialize(serializer),
10982                }
10983            }
10984        }
10985
10986        impl<'de> serde::de::Deserialize<'de> for Code {
10987            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10988            where
10989                D: serde::Deserializer<'de>,
10990            {
10991                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Code>::new(
10992                    ".google.cloud.networkconnectivity.v1.Spoke.StateReason.Code",
10993                ))
10994            }
10995        }
10996    }
10997}
10998
10999#[derive(Clone, Debug, Default, PartialEq)]
11000#[non_exhaustive]
11001pub struct RouteTable {
11002    /// Immutable. The name of the route table. Route table names must be unique.
11003    /// They use the following form:
11004    /// `projects/{project_number}/locations/global/hubs/{hub}/routeTables/{route_table_id}`
11005    pub name: std::string::String,
11006
11007    /// Output only. The time the route table was created.
11008    pub create_time: std::option::Option<wkt::Timestamp>,
11009
11010    /// Output only. The time the route table was last updated.
11011    pub update_time: std::option::Option<wkt::Timestamp>,
11012
11013    /// Optional labels in key-value pair format. For more information about
11014    /// labels, see [Requirements for
11015    /// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements).
11016    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
11017
11018    /// An optional description of the route table.
11019    pub description: std::string::String,
11020
11021    /// Output only. The Google-generated UUID for the route table. This value is
11022    /// unique across all route table resources. If a route table is deleted and
11023    /// another with the same name is created, the new route table is assigned
11024    /// a different `uid`.
11025    pub uid: std::string::String,
11026
11027    /// Output only. The current lifecycle state of this route table.
11028    pub state: crate::model::State,
11029
11030    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11031}
11032
11033impl RouteTable {
11034    pub fn new() -> Self {
11035        std::default::Default::default()
11036    }
11037
11038    /// Sets the value of [name][crate::model::RouteTable::name].
11039    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11040        self.name = v.into();
11041        self
11042    }
11043
11044    /// Sets the value of [create_time][crate::model::RouteTable::create_time].
11045    pub fn set_create_time<T>(mut self, v: T) -> Self
11046    where
11047        T: std::convert::Into<wkt::Timestamp>,
11048    {
11049        self.create_time = std::option::Option::Some(v.into());
11050        self
11051    }
11052
11053    /// Sets or clears the value of [create_time][crate::model::RouteTable::create_time].
11054    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11055    where
11056        T: std::convert::Into<wkt::Timestamp>,
11057    {
11058        self.create_time = v.map(|x| x.into());
11059        self
11060    }
11061
11062    /// Sets the value of [update_time][crate::model::RouteTable::update_time].
11063    pub fn set_update_time<T>(mut self, v: T) -> Self
11064    where
11065        T: std::convert::Into<wkt::Timestamp>,
11066    {
11067        self.update_time = std::option::Option::Some(v.into());
11068        self
11069    }
11070
11071    /// Sets or clears the value of [update_time][crate::model::RouteTable::update_time].
11072    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11073    where
11074        T: std::convert::Into<wkt::Timestamp>,
11075    {
11076        self.update_time = v.map(|x| x.into());
11077        self
11078    }
11079
11080    /// Sets the value of [labels][crate::model::RouteTable::labels].
11081    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
11082    where
11083        T: std::iter::IntoIterator<Item = (K, V)>,
11084        K: std::convert::Into<std::string::String>,
11085        V: std::convert::Into<std::string::String>,
11086    {
11087        use std::iter::Iterator;
11088        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11089        self
11090    }
11091
11092    /// Sets the value of [description][crate::model::RouteTable::description].
11093    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11094        self.description = v.into();
11095        self
11096    }
11097
11098    /// Sets the value of [uid][crate::model::RouteTable::uid].
11099    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11100        self.uid = v.into();
11101        self
11102    }
11103
11104    /// Sets the value of [state][crate::model::RouteTable::state].
11105    pub fn set_state<T: std::convert::Into<crate::model::State>>(mut self, v: T) -> Self {
11106        self.state = v.into();
11107        self
11108    }
11109}
11110
11111impl wkt::message::Message for RouteTable {
11112    fn typename() -> &'static str {
11113        "type.googleapis.com/google.cloud.networkconnectivity.v1.RouteTable"
11114    }
11115}
11116
11117#[doc(hidden)]
11118impl<'de> serde::de::Deserialize<'de> for RouteTable {
11119    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11120    where
11121        D: serde::Deserializer<'de>,
11122    {
11123        #[allow(non_camel_case_types)]
11124        #[doc(hidden)]
11125        #[derive(PartialEq, Eq, Hash)]
11126        enum __FieldTag {
11127            __name,
11128            __create_time,
11129            __update_time,
11130            __labels,
11131            __description,
11132            __uid,
11133            __state,
11134            Unknown(std::string::String),
11135        }
11136        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11137            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11138            where
11139                D: serde::Deserializer<'de>,
11140            {
11141                struct Visitor;
11142                impl<'de> serde::de::Visitor<'de> for Visitor {
11143                    type Value = __FieldTag;
11144                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11145                        formatter.write_str("a field name for RouteTable")
11146                    }
11147                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11148                    where
11149                        E: serde::de::Error,
11150                    {
11151                        use std::result::Result::Ok;
11152                        use std::string::ToString;
11153                        match value {
11154                            "name" => Ok(__FieldTag::__name),
11155                            "createTime" => Ok(__FieldTag::__create_time),
11156                            "create_time" => Ok(__FieldTag::__create_time),
11157                            "updateTime" => Ok(__FieldTag::__update_time),
11158                            "update_time" => Ok(__FieldTag::__update_time),
11159                            "labels" => Ok(__FieldTag::__labels),
11160                            "description" => Ok(__FieldTag::__description),
11161                            "uid" => Ok(__FieldTag::__uid),
11162                            "state" => Ok(__FieldTag::__state),
11163                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11164                        }
11165                    }
11166                }
11167                deserializer.deserialize_identifier(Visitor)
11168            }
11169        }
11170        struct Visitor;
11171        impl<'de> serde::de::Visitor<'de> for Visitor {
11172            type Value = RouteTable;
11173            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11174                formatter.write_str("struct RouteTable")
11175            }
11176            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11177            where
11178                A: serde::de::MapAccess<'de>,
11179            {
11180                #[allow(unused_imports)]
11181                use serde::de::Error;
11182                use std::option::Option::Some;
11183                let mut fields = std::collections::HashSet::new();
11184                let mut result = Self::Value::new();
11185                while let Some(tag) = map.next_key::<__FieldTag>()? {
11186                    #[allow(clippy::match_single_binding)]
11187                    match tag {
11188                        __FieldTag::__name => {
11189                            if !fields.insert(__FieldTag::__name) {
11190                                return std::result::Result::Err(A::Error::duplicate_field(
11191                                    "multiple values for name",
11192                                ));
11193                            }
11194                            result.name = map
11195                                .next_value::<std::option::Option<std::string::String>>()?
11196                                .unwrap_or_default();
11197                        }
11198                        __FieldTag::__create_time => {
11199                            if !fields.insert(__FieldTag::__create_time) {
11200                                return std::result::Result::Err(A::Error::duplicate_field(
11201                                    "multiple values for create_time",
11202                                ));
11203                            }
11204                            result.create_time =
11205                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
11206                        }
11207                        __FieldTag::__update_time => {
11208                            if !fields.insert(__FieldTag::__update_time) {
11209                                return std::result::Result::Err(A::Error::duplicate_field(
11210                                    "multiple values for update_time",
11211                                ));
11212                            }
11213                            result.update_time =
11214                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
11215                        }
11216                        __FieldTag::__labels => {
11217                            if !fields.insert(__FieldTag::__labels) {
11218                                return std::result::Result::Err(A::Error::duplicate_field(
11219                                    "multiple values for labels",
11220                                ));
11221                            }
11222                            result.labels = map
11223                                .next_value::<std::option::Option<
11224                                    std::collections::HashMap<
11225                                        std::string::String,
11226                                        std::string::String,
11227                                    >,
11228                                >>()?
11229                                .unwrap_or_default();
11230                        }
11231                        __FieldTag::__description => {
11232                            if !fields.insert(__FieldTag::__description) {
11233                                return std::result::Result::Err(A::Error::duplicate_field(
11234                                    "multiple values for description",
11235                                ));
11236                            }
11237                            result.description = map
11238                                .next_value::<std::option::Option<std::string::String>>()?
11239                                .unwrap_or_default();
11240                        }
11241                        __FieldTag::__uid => {
11242                            if !fields.insert(__FieldTag::__uid) {
11243                                return std::result::Result::Err(A::Error::duplicate_field(
11244                                    "multiple values for uid",
11245                                ));
11246                            }
11247                            result.uid = map
11248                                .next_value::<std::option::Option<std::string::String>>()?
11249                                .unwrap_or_default();
11250                        }
11251                        __FieldTag::__state => {
11252                            if !fields.insert(__FieldTag::__state) {
11253                                return std::result::Result::Err(A::Error::duplicate_field(
11254                                    "multiple values for state",
11255                                ));
11256                            }
11257                            result.state = map
11258                                .next_value::<std::option::Option<crate::model::State>>()?
11259                                .unwrap_or_default();
11260                        }
11261                        __FieldTag::Unknown(key) => {
11262                            let value = map.next_value::<serde_json::Value>()?;
11263                            result._unknown_fields.insert(key, value);
11264                        }
11265                    }
11266                }
11267                std::result::Result::Ok(result)
11268            }
11269        }
11270        deserializer.deserialize_any(Visitor)
11271    }
11272}
11273
11274#[doc(hidden)]
11275impl serde::ser::Serialize for RouteTable {
11276    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11277    where
11278        S: serde::ser::Serializer,
11279    {
11280        use serde::ser::SerializeMap;
11281        #[allow(unused_imports)]
11282        use std::option::Option::Some;
11283        let mut state = serializer.serialize_map(std::option::Option::None)?;
11284        if !self.name.is_empty() {
11285            state.serialize_entry("name", &self.name)?;
11286        }
11287        if self.create_time.is_some() {
11288            state.serialize_entry("createTime", &self.create_time)?;
11289        }
11290        if self.update_time.is_some() {
11291            state.serialize_entry("updateTime", &self.update_time)?;
11292        }
11293        if !self.labels.is_empty() {
11294            state.serialize_entry("labels", &self.labels)?;
11295        }
11296        if !self.description.is_empty() {
11297            state.serialize_entry("description", &self.description)?;
11298        }
11299        if !self.uid.is_empty() {
11300            state.serialize_entry("uid", &self.uid)?;
11301        }
11302        if !wkt::internal::is_default(&self.state) {
11303            state.serialize_entry("state", &self.state)?;
11304        }
11305        if !self._unknown_fields.is_empty() {
11306            for (key, value) in self._unknown_fields.iter() {
11307                state.serialize_entry(key, &value)?;
11308            }
11309        }
11310        state.end()
11311    }
11312}
11313
11314/// A route defines a path from VM instances within a spoke to a specific
11315/// destination resource. Only VPC spokes have routes.
11316#[derive(Clone, Debug, Default, PartialEq)]
11317#[non_exhaustive]
11318pub struct Route {
11319    /// Immutable. The name of the route. Route names must be unique. Route names
11320    /// use the following form:
11321    /// `projects/{project_number}/locations/global/hubs/{hub}/routeTables/{route_table_id}/routes/{route_id}`
11322    pub name: std::string::String,
11323
11324    /// Output only. The time the route was created.
11325    pub create_time: std::option::Option<wkt::Timestamp>,
11326
11327    /// Output only. The time the route was last updated.
11328    pub update_time: std::option::Option<wkt::Timestamp>,
11329
11330    /// The destination IP address range.
11331    pub ip_cidr_range: std::string::String,
11332
11333    /// Output only. The route's type. Its type is determined by the properties of
11334    /// its IP address range.
11335    pub r#type: crate::model::RouteType,
11336
11337    /// Immutable. The destination VPC network for packets on this route.
11338    pub next_hop_vpc_network: std::option::Option<crate::model::NextHopVpcNetwork>,
11339
11340    /// Optional labels in key-value pair format. For more information about
11341    /// labels, see [Requirements for
11342    /// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements).
11343    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
11344
11345    /// An optional description of the route.
11346    pub description: std::string::String,
11347
11348    /// Output only. The Google-generated UUID for the route. This value is unique
11349    /// across all Network Connectivity Center route resources. If a
11350    /// route is deleted and another with the same name is created,
11351    /// the new route is assigned a different `uid`.
11352    pub uid: std::string::String,
11353
11354    /// Output only. The current lifecycle state of the route.
11355    pub state: crate::model::State,
11356
11357    /// Immutable. The spoke that this route leads to.
11358    /// Example: projects/12345/locations/global/spokes/SPOKE
11359    pub spoke: std::string::String,
11360
11361    /// Output only. The origin location of the route.
11362    /// Uses the following form: "projects/{project}/locations/{location}"
11363    /// Example: projects/1234/locations/us-central1
11364    pub location: std::string::String,
11365
11366    /// Output only. The priority of this route. Priority is used to break ties in
11367    /// cases where a destination matches more than one route. In these cases the
11368    /// route with the lowest-numbered priority value wins.
11369    pub priority: i64,
11370
11371    /// Immutable. The next-hop VPN tunnel for packets on this route.
11372    pub next_hop_vpn_tunnel: std::option::Option<crate::model::NextHopVPNTunnel>,
11373
11374    /// Immutable. The next-hop Router appliance instance for packets on this
11375    /// route.
11376    pub next_hop_router_appliance_instance:
11377        std::option::Option<crate::model::NextHopRouterApplianceInstance>,
11378
11379    /// Immutable. The next-hop VLAN attachment for packets on this route.
11380    pub next_hop_interconnect_attachment:
11381        std::option::Option<crate::model::NextHopInterconnectAttachment>,
11382
11383    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11384}
11385
11386impl Route {
11387    pub fn new() -> Self {
11388        std::default::Default::default()
11389    }
11390
11391    /// Sets the value of [name][crate::model::Route::name].
11392    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11393        self.name = v.into();
11394        self
11395    }
11396
11397    /// Sets the value of [create_time][crate::model::Route::create_time].
11398    pub fn set_create_time<T>(mut self, v: T) -> Self
11399    where
11400        T: std::convert::Into<wkt::Timestamp>,
11401    {
11402        self.create_time = std::option::Option::Some(v.into());
11403        self
11404    }
11405
11406    /// Sets or clears the value of [create_time][crate::model::Route::create_time].
11407    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11408    where
11409        T: std::convert::Into<wkt::Timestamp>,
11410    {
11411        self.create_time = v.map(|x| x.into());
11412        self
11413    }
11414
11415    /// Sets the value of [update_time][crate::model::Route::update_time].
11416    pub fn set_update_time<T>(mut self, v: T) -> Self
11417    where
11418        T: std::convert::Into<wkt::Timestamp>,
11419    {
11420        self.update_time = std::option::Option::Some(v.into());
11421        self
11422    }
11423
11424    /// Sets or clears the value of [update_time][crate::model::Route::update_time].
11425    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11426    where
11427        T: std::convert::Into<wkt::Timestamp>,
11428    {
11429        self.update_time = v.map(|x| x.into());
11430        self
11431    }
11432
11433    /// Sets the value of [ip_cidr_range][crate::model::Route::ip_cidr_range].
11434    pub fn set_ip_cidr_range<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11435        self.ip_cidr_range = v.into();
11436        self
11437    }
11438
11439    /// Sets the value of [r#type][crate::model::Route::type].
11440    pub fn set_type<T: std::convert::Into<crate::model::RouteType>>(mut self, v: T) -> Self {
11441        self.r#type = v.into();
11442        self
11443    }
11444
11445    /// Sets the value of [next_hop_vpc_network][crate::model::Route::next_hop_vpc_network].
11446    pub fn set_next_hop_vpc_network<T>(mut self, v: T) -> Self
11447    where
11448        T: std::convert::Into<crate::model::NextHopVpcNetwork>,
11449    {
11450        self.next_hop_vpc_network = std::option::Option::Some(v.into());
11451        self
11452    }
11453
11454    /// Sets or clears the value of [next_hop_vpc_network][crate::model::Route::next_hop_vpc_network].
11455    pub fn set_or_clear_next_hop_vpc_network<T>(mut self, v: std::option::Option<T>) -> Self
11456    where
11457        T: std::convert::Into<crate::model::NextHopVpcNetwork>,
11458    {
11459        self.next_hop_vpc_network = v.map(|x| x.into());
11460        self
11461    }
11462
11463    /// Sets the value of [labels][crate::model::Route::labels].
11464    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
11465    where
11466        T: std::iter::IntoIterator<Item = (K, V)>,
11467        K: std::convert::Into<std::string::String>,
11468        V: std::convert::Into<std::string::String>,
11469    {
11470        use std::iter::Iterator;
11471        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11472        self
11473    }
11474
11475    /// Sets the value of [description][crate::model::Route::description].
11476    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11477        self.description = v.into();
11478        self
11479    }
11480
11481    /// Sets the value of [uid][crate::model::Route::uid].
11482    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11483        self.uid = v.into();
11484        self
11485    }
11486
11487    /// Sets the value of [state][crate::model::Route::state].
11488    pub fn set_state<T: std::convert::Into<crate::model::State>>(mut self, v: T) -> Self {
11489        self.state = v.into();
11490        self
11491    }
11492
11493    /// Sets the value of [spoke][crate::model::Route::spoke].
11494    pub fn set_spoke<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11495        self.spoke = v.into();
11496        self
11497    }
11498
11499    /// Sets the value of [location][crate::model::Route::location].
11500    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11501        self.location = v.into();
11502        self
11503    }
11504
11505    /// Sets the value of [priority][crate::model::Route::priority].
11506    pub fn set_priority<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11507        self.priority = v.into();
11508        self
11509    }
11510
11511    /// Sets the value of [next_hop_vpn_tunnel][crate::model::Route::next_hop_vpn_tunnel].
11512    pub fn set_next_hop_vpn_tunnel<T>(mut self, v: T) -> Self
11513    where
11514        T: std::convert::Into<crate::model::NextHopVPNTunnel>,
11515    {
11516        self.next_hop_vpn_tunnel = std::option::Option::Some(v.into());
11517        self
11518    }
11519
11520    /// Sets or clears the value of [next_hop_vpn_tunnel][crate::model::Route::next_hop_vpn_tunnel].
11521    pub fn set_or_clear_next_hop_vpn_tunnel<T>(mut self, v: std::option::Option<T>) -> Self
11522    where
11523        T: std::convert::Into<crate::model::NextHopVPNTunnel>,
11524    {
11525        self.next_hop_vpn_tunnel = v.map(|x| x.into());
11526        self
11527    }
11528
11529    /// Sets the value of [next_hop_router_appliance_instance][crate::model::Route::next_hop_router_appliance_instance].
11530    pub fn set_next_hop_router_appliance_instance<T>(mut self, v: T) -> Self
11531    where
11532        T: std::convert::Into<crate::model::NextHopRouterApplianceInstance>,
11533    {
11534        self.next_hop_router_appliance_instance = std::option::Option::Some(v.into());
11535        self
11536    }
11537
11538    /// Sets or clears the value of [next_hop_router_appliance_instance][crate::model::Route::next_hop_router_appliance_instance].
11539    pub fn set_or_clear_next_hop_router_appliance_instance<T>(
11540        mut self,
11541        v: std::option::Option<T>,
11542    ) -> Self
11543    where
11544        T: std::convert::Into<crate::model::NextHopRouterApplianceInstance>,
11545    {
11546        self.next_hop_router_appliance_instance = v.map(|x| x.into());
11547        self
11548    }
11549
11550    /// Sets the value of [next_hop_interconnect_attachment][crate::model::Route::next_hop_interconnect_attachment].
11551    pub fn set_next_hop_interconnect_attachment<T>(mut self, v: T) -> Self
11552    where
11553        T: std::convert::Into<crate::model::NextHopInterconnectAttachment>,
11554    {
11555        self.next_hop_interconnect_attachment = std::option::Option::Some(v.into());
11556        self
11557    }
11558
11559    /// Sets or clears the value of [next_hop_interconnect_attachment][crate::model::Route::next_hop_interconnect_attachment].
11560    pub fn set_or_clear_next_hop_interconnect_attachment<T>(
11561        mut self,
11562        v: std::option::Option<T>,
11563    ) -> Self
11564    where
11565        T: std::convert::Into<crate::model::NextHopInterconnectAttachment>,
11566    {
11567        self.next_hop_interconnect_attachment = v.map(|x| x.into());
11568        self
11569    }
11570}
11571
11572impl wkt::message::Message for Route {
11573    fn typename() -> &'static str {
11574        "type.googleapis.com/google.cloud.networkconnectivity.v1.Route"
11575    }
11576}
11577
11578#[doc(hidden)]
11579impl<'de> serde::de::Deserialize<'de> for Route {
11580    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11581    where
11582        D: serde::Deserializer<'de>,
11583    {
11584        #[allow(non_camel_case_types)]
11585        #[doc(hidden)]
11586        #[derive(PartialEq, Eq, Hash)]
11587        enum __FieldTag {
11588            __name,
11589            __create_time,
11590            __update_time,
11591            __ip_cidr_range,
11592            __type,
11593            __next_hop_vpc_network,
11594            __labels,
11595            __description,
11596            __uid,
11597            __state,
11598            __spoke,
11599            __location,
11600            __priority,
11601            __next_hop_vpn_tunnel,
11602            __next_hop_router_appliance_instance,
11603            __next_hop_interconnect_attachment,
11604            Unknown(std::string::String),
11605        }
11606        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11607            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11608            where
11609                D: serde::Deserializer<'de>,
11610            {
11611                struct Visitor;
11612                impl<'de> serde::de::Visitor<'de> for Visitor {
11613                    type Value = __FieldTag;
11614                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11615                        formatter.write_str("a field name for Route")
11616                    }
11617                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11618                    where
11619                        E: serde::de::Error,
11620                    {
11621                        use std::result::Result::Ok;
11622                        use std::string::ToString;
11623                        match value {
11624                            "name" => Ok(__FieldTag::__name),
11625                            "createTime" => Ok(__FieldTag::__create_time),
11626                            "create_time" => Ok(__FieldTag::__create_time),
11627                            "updateTime" => Ok(__FieldTag::__update_time),
11628                            "update_time" => Ok(__FieldTag::__update_time),
11629                            "ipCidrRange" => Ok(__FieldTag::__ip_cidr_range),
11630                            "ip_cidr_range" => Ok(__FieldTag::__ip_cidr_range),
11631                            "type" => Ok(__FieldTag::__type),
11632                            "nextHopVpcNetwork" => Ok(__FieldTag::__next_hop_vpc_network),
11633                            "next_hop_vpc_network" => Ok(__FieldTag::__next_hop_vpc_network),
11634                            "labels" => Ok(__FieldTag::__labels),
11635                            "description" => Ok(__FieldTag::__description),
11636                            "uid" => Ok(__FieldTag::__uid),
11637                            "state" => Ok(__FieldTag::__state),
11638                            "spoke" => Ok(__FieldTag::__spoke),
11639                            "location" => Ok(__FieldTag::__location),
11640                            "priority" => Ok(__FieldTag::__priority),
11641                            "nextHopVpnTunnel" => Ok(__FieldTag::__next_hop_vpn_tunnel),
11642                            "next_hop_vpn_tunnel" => Ok(__FieldTag::__next_hop_vpn_tunnel),
11643                            "nextHopRouterApplianceInstance" => {
11644                                Ok(__FieldTag::__next_hop_router_appliance_instance)
11645                            }
11646                            "next_hop_router_appliance_instance" => {
11647                                Ok(__FieldTag::__next_hop_router_appliance_instance)
11648                            }
11649                            "nextHopInterconnectAttachment" => {
11650                                Ok(__FieldTag::__next_hop_interconnect_attachment)
11651                            }
11652                            "next_hop_interconnect_attachment" => {
11653                                Ok(__FieldTag::__next_hop_interconnect_attachment)
11654                            }
11655                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11656                        }
11657                    }
11658                }
11659                deserializer.deserialize_identifier(Visitor)
11660            }
11661        }
11662        struct Visitor;
11663        impl<'de> serde::de::Visitor<'de> for Visitor {
11664            type Value = Route;
11665            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11666                formatter.write_str("struct Route")
11667            }
11668            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11669            where
11670                A: serde::de::MapAccess<'de>,
11671            {
11672                #[allow(unused_imports)]
11673                use serde::de::Error;
11674                use std::option::Option::Some;
11675                let mut fields = std::collections::HashSet::new();
11676                let mut result = Self::Value::new();
11677                while let Some(tag) = map.next_key::<__FieldTag>()? {
11678                    #[allow(clippy::match_single_binding)]
11679                    match tag {
11680                        __FieldTag::__name => {
11681                            if !fields.insert(__FieldTag::__name) {
11682                                return std::result::Result::Err(A::Error::duplicate_field(
11683                                    "multiple values for name",
11684                                ));
11685                            }
11686                            result.name = map
11687                                .next_value::<std::option::Option<std::string::String>>()?
11688                                .unwrap_or_default();
11689                        }
11690                        __FieldTag::__create_time => {
11691                            if !fields.insert(__FieldTag::__create_time) {
11692                                return std::result::Result::Err(A::Error::duplicate_field(
11693                                    "multiple values for create_time",
11694                                ));
11695                            }
11696                            result.create_time =
11697                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
11698                        }
11699                        __FieldTag::__update_time => {
11700                            if !fields.insert(__FieldTag::__update_time) {
11701                                return std::result::Result::Err(A::Error::duplicate_field(
11702                                    "multiple values for update_time",
11703                                ));
11704                            }
11705                            result.update_time =
11706                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
11707                        }
11708                        __FieldTag::__ip_cidr_range => {
11709                            if !fields.insert(__FieldTag::__ip_cidr_range) {
11710                                return std::result::Result::Err(A::Error::duplicate_field(
11711                                    "multiple values for ip_cidr_range",
11712                                ));
11713                            }
11714                            result.ip_cidr_range = map
11715                                .next_value::<std::option::Option<std::string::String>>()?
11716                                .unwrap_or_default();
11717                        }
11718                        __FieldTag::__type => {
11719                            if !fields.insert(__FieldTag::__type) {
11720                                return std::result::Result::Err(A::Error::duplicate_field(
11721                                    "multiple values for type",
11722                                ));
11723                            }
11724                            result.r#type = map
11725                                .next_value::<std::option::Option<crate::model::RouteType>>()?
11726                                .unwrap_or_default();
11727                        }
11728                        __FieldTag::__next_hop_vpc_network => {
11729                            if !fields.insert(__FieldTag::__next_hop_vpc_network) {
11730                                return std::result::Result::Err(A::Error::duplicate_field(
11731                                    "multiple values for next_hop_vpc_network",
11732                                ));
11733                            }
11734                            result.next_hop_vpc_network = map
11735                                .next_value::<std::option::Option<crate::model::NextHopVpcNetwork>>(
11736                                )?;
11737                        }
11738                        __FieldTag::__labels => {
11739                            if !fields.insert(__FieldTag::__labels) {
11740                                return std::result::Result::Err(A::Error::duplicate_field(
11741                                    "multiple values for labels",
11742                                ));
11743                            }
11744                            result.labels = map
11745                                .next_value::<std::option::Option<
11746                                    std::collections::HashMap<
11747                                        std::string::String,
11748                                        std::string::String,
11749                                    >,
11750                                >>()?
11751                                .unwrap_or_default();
11752                        }
11753                        __FieldTag::__description => {
11754                            if !fields.insert(__FieldTag::__description) {
11755                                return std::result::Result::Err(A::Error::duplicate_field(
11756                                    "multiple values for description",
11757                                ));
11758                            }
11759                            result.description = map
11760                                .next_value::<std::option::Option<std::string::String>>()?
11761                                .unwrap_or_default();
11762                        }
11763                        __FieldTag::__uid => {
11764                            if !fields.insert(__FieldTag::__uid) {
11765                                return std::result::Result::Err(A::Error::duplicate_field(
11766                                    "multiple values for uid",
11767                                ));
11768                            }
11769                            result.uid = map
11770                                .next_value::<std::option::Option<std::string::String>>()?
11771                                .unwrap_or_default();
11772                        }
11773                        __FieldTag::__state => {
11774                            if !fields.insert(__FieldTag::__state) {
11775                                return std::result::Result::Err(A::Error::duplicate_field(
11776                                    "multiple values for state",
11777                                ));
11778                            }
11779                            result.state = map
11780                                .next_value::<std::option::Option<crate::model::State>>()?
11781                                .unwrap_or_default();
11782                        }
11783                        __FieldTag::__spoke => {
11784                            if !fields.insert(__FieldTag::__spoke) {
11785                                return std::result::Result::Err(A::Error::duplicate_field(
11786                                    "multiple values for spoke",
11787                                ));
11788                            }
11789                            result.spoke = map
11790                                .next_value::<std::option::Option<std::string::String>>()?
11791                                .unwrap_or_default();
11792                        }
11793                        __FieldTag::__location => {
11794                            if !fields.insert(__FieldTag::__location) {
11795                                return std::result::Result::Err(A::Error::duplicate_field(
11796                                    "multiple values for location",
11797                                ));
11798                            }
11799                            result.location = map
11800                                .next_value::<std::option::Option<std::string::String>>()?
11801                                .unwrap_or_default();
11802                        }
11803                        __FieldTag::__priority => {
11804                            if !fields.insert(__FieldTag::__priority) {
11805                                return std::result::Result::Err(A::Error::duplicate_field(
11806                                    "multiple values for priority",
11807                                ));
11808                            }
11809                            struct __With(std::option::Option<i64>);
11810                            impl<'de> serde::de::Deserialize<'de> for __With {
11811                                fn deserialize<D>(
11812                                    deserializer: D,
11813                                ) -> std::result::Result<Self, D::Error>
11814                                where
11815                                    D: serde::de::Deserializer<'de>,
11816                                {
11817                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
11818                                }
11819                            }
11820                            result.priority = map.next_value::<__With>()?.0.unwrap_or_default();
11821                        }
11822                        __FieldTag::__next_hop_vpn_tunnel => {
11823                            if !fields.insert(__FieldTag::__next_hop_vpn_tunnel) {
11824                                return std::result::Result::Err(A::Error::duplicate_field(
11825                                    "multiple values for next_hop_vpn_tunnel",
11826                                ));
11827                            }
11828                            result.next_hop_vpn_tunnel = map
11829                                .next_value::<std::option::Option<crate::model::NextHopVPNTunnel>>(
11830                                )?;
11831                        }
11832                        __FieldTag::__next_hop_router_appliance_instance => {
11833                            if !fields.insert(__FieldTag::__next_hop_router_appliance_instance) {
11834                                return std::result::Result::Err(A::Error::duplicate_field(
11835                                    "multiple values for next_hop_router_appliance_instance",
11836                                ));
11837                            }
11838                            result.next_hop_router_appliance_instance =
11839                                map.next_value::<std::option::Option<
11840                                    crate::model::NextHopRouterApplianceInstance,
11841                                >>()?;
11842                        }
11843                        __FieldTag::__next_hop_interconnect_attachment => {
11844                            if !fields.insert(__FieldTag::__next_hop_interconnect_attachment) {
11845                                return std::result::Result::Err(A::Error::duplicate_field(
11846                                    "multiple values for next_hop_interconnect_attachment",
11847                                ));
11848                            }
11849                            result.next_hop_interconnect_attachment =
11850                                map.next_value::<std::option::Option<
11851                                    crate::model::NextHopInterconnectAttachment,
11852                                >>()?;
11853                        }
11854                        __FieldTag::Unknown(key) => {
11855                            let value = map.next_value::<serde_json::Value>()?;
11856                            result._unknown_fields.insert(key, value);
11857                        }
11858                    }
11859                }
11860                std::result::Result::Ok(result)
11861            }
11862        }
11863        deserializer.deserialize_any(Visitor)
11864    }
11865}
11866
11867#[doc(hidden)]
11868impl serde::ser::Serialize for Route {
11869    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11870    where
11871        S: serde::ser::Serializer,
11872    {
11873        use serde::ser::SerializeMap;
11874        #[allow(unused_imports)]
11875        use std::option::Option::Some;
11876        let mut state = serializer.serialize_map(std::option::Option::None)?;
11877        if !self.name.is_empty() {
11878            state.serialize_entry("name", &self.name)?;
11879        }
11880        if self.create_time.is_some() {
11881            state.serialize_entry("createTime", &self.create_time)?;
11882        }
11883        if self.update_time.is_some() {
11884            state.serialize_entry("updateTime", &self.update_time)?;
11885        }
11886        if !self.ip_cidr_range.is_empty() {
11887            state.serialize_entry("ipCidrRange", &self.ip_cidr_range)?;
11888        }
11889        if !wkt::internal::is_default(&self.r#type) {
11890            state.serialize_entry("type", &self.r#type)?;
11891        }
11892        if self.next_hop_vpc_network.is_some() {
11893            state.serialize_entry("nextHopVpcNetwork", &self.next_hop_vpc_network)?;
11894        }
11895        if !self.labels.is_empty() {
11896            state.serialize_entry("labels", &self.labels)?;
11897        }
11898        if !self.description.is_empty() {
11899            state.serialize_entry("description", &self.description)?;
11900        }
11901        if !self.uid.is_empty() {
11902            state.serialize_entry("uid", &self.uid)?;
11903        }
11904        if !wkt::internal::is_default(&self.state) {
11905            state.serialize_entry("state", &self.state)?;
11906        }
11907        if !self.spoke.is_empty() {
11908            state.serialize_entry("spoke", &self.spoke)?;
11909        }
11910        if !self.location.is_empty() {
11911            state.serialize_entry("location", &self.location)?;
11912        }
11913        if !wkt::internal::is_default(&self.priority) {
11914            struct __With<'a>(&'a i64);
11915            impl<'a> serde::ser::Serialize for __With<'a> {
11916                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11917                where
11918                    S: serde::ser::Serializer,
11919                {
11920                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
11921                }
11922            }
11923            state.serialize_entry("priority", &__With(&self.priority))?;
11924        }
11925        if self.next_hop_vpn_tunnel.is_some() {
11926            state.serialize_entry("nextHopVpnTunnel", &self.next_hop_vpn_tunnel)?;
11927        }
11928        if self.next_hop_router_appliance_instance.is_some() {
11929            state.serialize_entry(
11930                "nextHopRouterApplianceInstance",
11931                &self.next_hop_router_appliance_instance,
11932            )?;
11933        }
11934        if self.next_hop_interconnect_attachment.is_some() {
11935            state.serialize_entry(
11936                "nextHopInterconnectAttachment",
11937                &self.next_hop_interconnect_attachment,
11938            )?;
11939        }
11940        if !self._unknown_fields.is_empty() {
11941            for (key, value) in self._unknown_fields.iter() {
11942                state.serialize_entry(key, &value)?;
11943            }
11944        }
11945        state.end()
11946    }
11947}
11948
11949/// A group represents a subset of spokes attached to a hub.
11950#[derive(Clone, Debug, Default, PartialEq)]
11951#[non_exhaustive]
11952pub struct Group {
11953    /// Immutable. The name of the group. Group names must be unique. They
11954    /// use the following form:
11955    /// `projects/{project_number}/locations/global/hubs/{hub}/groups/{group_id}`
11956    pub name: std::string::String,
11957
11958    /// Output only. The time the group was created.
11959    pub create_time: std::option::Option<wkt::Timestamp>,
11960
11961    /// Output only. The time the group was last updated.
11962    pub update_time: std::option::Option<wkt::Timestamp>,
11963
11964    /// Optional. Labels in key-value pair format. For more information about
11965    /// labels, see [Requirements for
11966    /// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements).
11967    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
11968
11969    /// Optional. The description of the group.
11970    pub description: std::string::String,
11971
11972    /// Output only. The Google-generated UUID for the group. This value is unique
11973    /// across all group resources. If a group is deleted and
11974    /// another with the same name is created, the new route table is assigned
11975    /// a different unique_id.
11976    pub uid: std::string::String,
11977
11978    /// Output only. The current lifecycle state of this group.
11979    pub state: crate::model::State,
11980
11981    /// Optional. The auto-accept setting for this group.
11982    pub auto_accept: std::option::Option<crate::model::AutoAccept>,
11983
11984    /// Output only. The name of the route table that corresponds to this group.
11985    /// They use the following form:
11986    /// `projects/{project_number}/locations/global/hubs/{hub_id}/routeTables/{route_table_id}`
11987    pub route_table: std::string::String,
11988
11989    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11990}
11991
11992impl Group {
11993    pub fn new() -> Self {
11994        std::default::Default::default()
11995    }
11996
11997    /// Sets the value of [name][crate::model::Group::name].
11998    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11999        self.name = v.into();
12000        self
12001    }
12002
12003    /// Sets the value of [create_time][crate::model::Group::create_time].
12004    pub fn set_create_time<T>(mut self, v: T) -> Self
12005    where
12006        T: std::convert::Into<wkt::Timestamp>,
12007    {
12008        self.create_time = std::option::Option::Some(v.into());
12009        self
12010    }
12011
12012    /// Sets or clears the value of [create_time][crate::model::Group::create_time].
12013    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12014    where
12015        T: std::convert::Into<wkt::Timestamp>,
12016    {
12017        self.create_time = v.map(|x| x.into());
12018        self
12019    }
12020
12021    /// Sets the value of [update_time][crate::model::Group::update_time].
12022    pub fn set_update_time<T>(mut self, v: T) -> Self
12023    where
12024        T: std::convert::Into<wkt::Timestamp>,
12025    {
12026        self.update_time = std::option::Option::Some(v.into());
12027        self
12028    }
12029
12030    /// Sets or clears the value of [update_time][crate::model::Group::update_time].
12031    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12032    where
12033        T: std::convert::Into<wkt::Timestamp>,
12034    {
12035        self.update_time = v.map(|x| x.into());
12036        self
12037    }
12038
12039    /// Sets the value of [labels][crate::model::Group::labels].
12040    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
12041    where
12042        T: std::iter::IntoIterator<Item = (K, V)>,
12043        K: std::convert::Into<std::string::String>,
12044        V: std::convert::Into<std::string::String>,
12045    {
12046        use std::iter::Iterator;
12047        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12048        self
12049    }
12050
12051    /// Sets the value of [description][crate::model::Group::description].
12052    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12053        self.description = v.into();
12054        self
12055    }
12056
12057    /// Sets the value of [uid][crate::model::Group::uid].
12058    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12059        self.uid = v.into();
12060        self
12061    }
12062
12063    /// Sets the value of [state][crate::model::Group::state].
12064    pub fn set_state<T: std::convert::Into<crate::model::State>>(mut self, v: T) -> Self {
12065        self.state = v.into();
12066        self
12067    }
12068
12069    /// Sets the value of [auto_accept][crate::model::Group::auto_accept].
12070    pub fn set_auto_accept<T>(mut self, v: T) -> Self
12071    where
12072        T: std::convert::Into<crate::model::AutoAccept>,
12073    {
12074        self.auto_accept = std::option::Option::Some(v.into());
12075        self
12076    }
12077
12078    /// Sets or clears the value of [auto_accept][crate::model::Group::auto_accept].
12079    pub fn set_or_clear_auto_accept<T>(mut self, v: std::option::Option<T>) -> Self
12080    where
12081        T: std::convert::Into<crate::model::AutoAccept>,
12082    {
12083        self.auto_accept = v.map(|x| x.into());
12084        self
12085    }
12086
12087    /// Sets the value of [route_table][crate::model::Group::route_table].
12088    pub fn set_route_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12089        self.route_table = v.into();
12090        self
12091    }
12092}
12093
12094impl wkt::message::Message for Group {
12095    fn typename() -> &'static str {
12096        "type.googleapis.com/google.cloud.networkconnectivity.v1.Group"
12097    }
12098}
12099
12100#[doc(hidden)]
12101impl<'de> serde::de::Deserialize<'de> for Group {
12102    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12103    where
12104        D: serde::Deserializer<'de>,
12105    {
12106        #[allow(non_camel_case_types)]
12107        #[doc(hidden)]
12108        #[derive(PartialEq, Eq, Hash)]
12109        enum __FieldTag {
12110            __name,
12111            __create_time,
12112            __update_time,
12113            __labels,
12114            __description,
12115            __uid,
12116            __state,
12117            __auto_accept,
12118            __route_table,
12119            Unknown(std::string::String),
12120        }
12121        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12122            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12123            where
12124                D: serde::Deserializer<'de>,
12125            {
12126                struct Visitor;
12127                impl<'de> serde::de::Visitor<'de> for Visitor {
12128                    type Value = __FieldTag;
12129                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12130                        formatter.write_str("a field name for Group")
12131                    }
12132                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12133                    where
12134                        E: serde::de::Error,
12135                    {
12136                        use std::result::Result::Ok;
12137                        use std::string::ToString;
12138                        match value {
12139                            "name" => Ok(__FieldTag::__name),
12140                            "createTime" => Ok(__FieldTag::__create_time),
12141                            "create_time" => Ok(__FieldTag::__create_time),
12142                            "updateTime" => Ok(__FieldTag::__update_time),
12143                            "update_time" => Ok(__FieldTag::__update_time),
12144                            "labels" => Ok(__FieldTag::__labels),
12145                            "description" => Ok(__FieldTag::__description),
12146                            "uid" => Ok(__FieldTag::__uid),
12147                            "state" => Ok(__FieldTag::__state),
12148                            "autoAccept" => Ok(__FieldTag::__auto_accept),
12149                            "auto_accept" => Ok(__FieldTag::__auto_accept),
12150                            "routeTable" => Ok(__FieldTag::__route_table),
12151                            "route_table" => Ok(__FieldTag::__route_table),
12152                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12153                        }
12154                    }
12155                }
12156                deserializer.deserialize_identifier(Visitor)
12157            }
12158        }
12159        struct Visitor;
12160        impl<'de> serde::de::Visitor<'de> for Visitor {
12161            type Value = Group;
12162            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12163                formatter.write_str("struct Group")
12164            }
12165            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12166            where
12167                A: serde::de::MapAccess<'de>,
12168            {
12169                #[allow(unused_imports)]
12170                use serde::de::Error;
12171                use std::option::Option::Some;
12172                let mut fields = std::collections::HashSet::new();
12173                let mut result = Self::Value::new();
12174                while let Some(tag) = map.next_key::<__FieldTag>()? {
12175                    #[allow(clippy::match_single_binding)]
12176                    match tag {
12177                        __FieldTag::__name => {
12178                            if !fields.insert(__FieldTag::__name) {
12179                                return std::result::Result::Err(A::Error::duplicate_field(
12180                                    "multiple values for name",
12181                                ));
12182                            }
12183                            result.name = map
12184                                .next_value::<std::option::Option<std::string::String>>()?
12185                                .unwrap_or_default();
12186                        }
12187                        __FieldTag::__create_time => {
12188                            if !fields.insert(__FieldTag::__create_time) {
12189                                return std::result::Result::Err(A::Error::duplicate_field(
12190                                    "multiple values for create_time",
12191                                ));
12192                            }
12193                            result.create_time =
12194                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
12195                        }
12196                        __FieldTag::__update_time => {
12197                            if !fields.insert(__FieldTag::__update_time) {
12198                                return std::result::Result::Err(A::Error::duplicate_field(
12199                                    "multiple values for update_time",
12200                                ));
12201                            }
12202                            result.update_time =
12203                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
12204                        }
12205                        __FieldTag::__labels => {
12206                            if !fields.insert(__FieldTag::__labels) {
12207                                return std::result::Result::Err(A::Error::duplicate_field(
12208                                    "multiple values for labels",
12209                                ));
12210                            }
12211                            result.labels = map
12212                                .next_value::<std::option::Option<
12213                                    std::collections::HashMap<
12214                                        std::string::String,
12215                                        std::string::String,
12216                                    >,
12217                                >>()?
12218                                .unwrap_or_default();
12219                        }
12220                        __FieldTag::__description => {
12221                            if !fields.insert(__FieldTag::__description) {
12222                                return std::result::Result::Err(A::Error::duplicate_field(
12223                                    "multiple values for description",
12224                                ));
12225                            }
12226                            result.description = map
12227                                .next_value::<std::option::Option<std::string::String>>()?
12228                                .unwrap_or_default();
12229                        }
12230                        __FieldTag::__uid => {
12231                            if !fields.insert(__FieldTag::__uid) {
12232                                return std::result::Result::Err(A::Error::duplicate_field(
12233                                    "multiple values for uid",
12234                                ));
12235                            }
12236                            result.uid = map
12237                                .next_value::<std::option::Option<std::string::String>>()?
12238                                .unwrap_or_default();
12239                        }
12240                        __FieldTag::__state => {
12241                            if !fields.insert(__FieldTag::__state) {
12242                                return std::result::Result::Err(A::Error::duplicate_field(
12243                                    "multiple values for state",
12244                                ));
12245                            }
12246                            result.state = map
12247                                .next_value::<std::option::Option<crate::model::State>>()?
12248                                .unwrap_or_default();
12249                        }
12250                        __FieldTag::__auto_accept => {
12251                            if !fields.insert(__FieldTag::__auto_accept) {
12252                                return std::result::Result::Err(A::Error::duplicate_field(
12253                                    "multiple values for auto_accept",
12254                                ));
12255                            }
12256                            result.auto_accept =
12257                                map.next_value::<std::option::Option<crate::model::AutoAccept>>()?;
12258                        }
12259                        __FieldTag::__route_table => {
12260                            if !fields.insert(__FieldTag::__route_table) {
12261                                return std::result::Result::Err(A::Error::duplicate_field(
12262                                    "multiple values for route_table",
12263                                ));
12264                            }
12265                            result.route_table = map
12266                                .next_value::<std::option::Option<std::string::String>>()?
12267                                .unwrap_or_default();
12268                        }
12269                        __FieldTag::Unknown(key) => {
12270                            let value = map.next_value::<serde_json::Value>()?;
12271                            result._unknown_fields.insert(key, value);
12272                        }
12273                    }
12274                }
12275                std::result::Result::Ok(result)
12276            }
12277        }
12278        deserializer.deserialize_any(Visitor)
12279    }
12280}
12281
12282#[doc(hidden)]
12283impl serde::ser::Serialize for Group {
12284    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12285    where
12286        S: serde::ser::Serializer,
12287    {
12288        use serde::ser::SerializeMap;
12289        #[allow(unused_imports)]
12290        use std::option::Option::Some;
12291        let mut state = serializer.serialize_map(std::option::Option::None)?;
12292        if !self.name.is_empty() {
12293            state.serialize_entry("name", &self.name)?;
12294        }
12295        if self.create_time.is_some() {
12296            state.serialize_entry("createTime", &self.create_time)?;
12297        }
12298        if self.update_time.is_some() {
12299            state.serialize_entry("updateTime", &self.update_time)?;
12300        }
12301        if !self.labels.is_empty() {
12302            state.serialize_entry("labels", &self.labels)?;
12303        }
12304        if !self.description.is_empty() {
12305            state.serialize_entry("description", &self.description)?;
12306        }
12307        if !self.uid.is_empty() {
12308            state.serialize_entry("uid", &self.uid)?;
12309        }
12310        if !wkt::internal::is_default(&self.state) {
12311            state.serialize_entry("state", &self.state)?;
12312        }
12313        if self.auto_accept.is_some() {
12314            state.serialize_entry("autoAccept", &self.auto_accept)?;
12315        }
12316        if !self.route_table.is_empty() {
12317            state.serialize_entry("routeTable", &self.route_table)?;
12318        }
12319        if !self._unknown_fields.is_empty() {
12320            for (key, value) in self._unknown_fields.iter() {
12321                state.serialize_entry(key, &value)?;
12322            }
12323        }
12324        state.end()
12325    }
12326}
12327
12328/// The auto-accept setting for a group controls whether
12329/// proposed spokes are automatically attached to the hub. If auto-accept is
12330/// enabled, the spoke immediately is attached to the hub and becomes part of the
12331/// group. In this case, the new spoke is in the ACTIVE state.
12332/// If auto-accept is disabled, the spoke goes to the INACTIVE
12333/// state, and it must be reviewed and accepted by a hub
12334/// administrator.
12335#[derive(Clone, Debug, Default, PartialEq)]
12336#[non_exhaustive]
12337pub struct AutoAccept {
12338    /// Optional. A list of project ids or project numbers for which you want
12339    /// to enable auto-accept. The auto-accept setting is applied to
12340    /// spokes being created or updated in these projects.
12341    pub auto_accept_projects: std::vec::Vec<std::string::String>,
12342
12343    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12344}
12345
12346impl AutoAccept {
12347    pub fn new() -> Self {
12348        std::default::Default::default()
12349    }
12350
12351    /// Sets the value of [auto_accept_projects][crate::model::AutoAccept::auto_accept_projects].
12352    pub fn set_auto_accept_projects<T, V>(mut self, v: T) -> Self
12353    where
12354        T: std::iter::IntoIterator<Item = V>,
12355        V: std::convert::Into<std::string::String>,
12356    {
12357        use std::iter::Iterator;
12358        self.auto_accept_projects = v.into_iter().map(|i| i.into()).collect();
12359        self
12360    }
12361}
12362
12363impl wkt::message::Message for AutoAccept {
12364    fn typename() -> &'static str {
12365        "type.googleapis.com/google.cloud.networkconnectivity.v1.AutoAccept"
12366    }
12367}
12368
12369#[doc(hidden)]
12370impl<'de> serde::de::Deserialize<'de> for AutoAccept {
12371    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12372    where
12373        D: serde::Deserializer<'de>,
12374    {
12375        #[allow(non_camel_case_types)]
12376        #[doc(hidden)]
12377        #[derive(PartialEq, Eq, Hash)]
12378        enum __FieldTag {
12379            __auto_accept_projects,
12380            Unknown(std::string::String),
12381        }
12382        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12383            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12384            where
12385                D: serde::Deserializer<'de>,
12386            {
12387                struct Visitor;
12388                impl<'de> serde::de::Visitor<'de> for Visitor {
12389                    type Value = __FieldTag;
12390                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12391                        formatter.write_str("a field name for AutoAccept")
12392                    }
12393                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12394                    where
12395                        E: serde::de::Error,
12396                    {
12397                        use std::result::Result::Ok;
12398                        use std::string::ToString;
12399                        match value {
12400                            "autoAcceptProjects" => Ok(__FieldTag::__auto_accept_projects),
12401                            "auto_accept_projects" => Ok(__FieldTag::__auto_accept_projects),
12402                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12403                        }
12404                    }
12405                }
12406                deserializer.deserialize_identifier(Visitor)
12407            }
12408        }
12409        struct Visitor;
12410        impl<'de> serde::de::Visitor<'de> for Visitor {
12411            type Value = AutoAccept;
12412            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12413                formatter.write_str("struct AutoAccept")
12414            }
12415            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12416            where
12417                A: serde::de::MapAccess<'de>,
12418            {
12419                #[allow(unused_imports)]
12420                use serde::de::Error;
12421                use std::option::Option::Some;
12422                let mut fields = std::collections::HashSet::new();
12423                let mut result = Self::Value::new();
12424                while let Some(tag) = map.next_key::<__FieldTag>()? {
12425                    #[allow(clippy::match_single_binding)]
12426                    match tag {
12427                        __FieldTag::__auto_accept_projects => {
12428                            if !fields.insert(__FieldTag::__auto_accept_projects) {
12429                                return std::result::Result::Err(A::Error::duplicate_field(
12430                                    "multiple values for auto_accept_projects",
12431                                ));
12432                            }
12433                            result.auto_accept_projects = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
12434                        }
12435                        __FieldTag::Unknown(key) => {
12436                            let value = map.next_value::<serde_json::Value>()?;
12437                            result._unknown_fields.insert(key, value);
12438                        }
12439                    }
12440                }
12441                std::result::Result::Ok(result)
12442            }
12443        }
12444        deserializer.deserialize_any(Visitor)
12445    }
12446}
12447
12448#[doc(hidden)]
12449impl serde::ser::Serialize for AutoAccept {
12450    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12451    where
12452        S: serde::ser::Serializer,
12453    {
12454        use serde::ser::SerializeMap;
12455        #[allow(unused_imports)]
12456        use std::option::Option::Some;
12457        let mut state = serializer.serialize_map(std::option::Option::None)?;
12458        if !self.auto_accept_projects.is_empty() {
12459            state.serialize_entry("autoAcceptProjects", &self.auto_accept_projects)?;
12460        }
12461        if !self._unknown_fields.is_empty() {
12462            for (key, value) in self._unknown_fields.iter() {
12463                state.serialize_entry(key, &value)?;
12464            }
12465        }
12466        state.end()
12467    }
12468}
12469
12470/// Request for
12471/// [HubService.ListHubs][google.cloud.networkconnectivity.v1.HubService.ListHubs]
12472/// method.
12473///
12474/// [google.cloud.networkconnectivity.v1.HubService.ListHubs]: crate::client::HubService::list_hubs
12475#[derive(Clone, Debug, Default, PartialEq)]
12476#[non_exhaustive]
12477pub struct ListHubsRequest {
12478    /// Required. The parent resource's name.
12479    pub parent: std::string::String,
12480
12481    /// The maximum number of results per page to return.
12482    pub page_size: i32,
12483
12484    /// The page token.
12485    pub page_token: std::string::String,
12486
12487    /// An expression that filters the list of results.
12488    pub filter: std::string::String,
12489
12490    /// Sort the results by a certain order.
12491    pub order_by: std::string::String,
12492
12493    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12494}
12495
12496impl ListHubsRequest {
12497    pub fn new() -> Self {
12498        std::default::Default::default()
12499    }
12500
12501    /// Sets the value of [parent][crate::model::ListHubsRequest::parent].
12502    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12503        self.parent = v.into();
12504        self
12505    }
12506
12507    /// Sets the value of [page_size][crate::model::ListHubsRequest::page_size].
12508    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12509        self.page_size = v.into();
12510        self
12511    }
12512
12513    /// Sets the value of [page_token][crate::model::ListHubsRequest::page_token].
12514    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12515        self.page_token = v.into();
12516        self
12517    }
12518
12519    /// Sets the value of [filter][crate::model::ListHubsRequest::filter].
12520    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12521        self.filter = v.into();
12522        self
12523    }
12524
12525    /// Sets the value of [order_by][crate::model::ListHubsRequest::order_by].
12526    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12527        self.order_by = v.into();
12528        self
12529    }
12530}
12531
12532impl wkt::message::Message for ListHubsRequest {
12533    fn typename() -> &'static str {
12534        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListHubsRequest"
12535    }
12536}
12537
12538#[doc(hidden)]
12539impl<'de> serde::de::Deserialize<'de> for ListHubsRequest {
12540    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12541    where
12542        D: serde::Deserializer<'de>,
12543    {
12544        #[allow(non_camel_case_types)]
12545        #[doc(hidden)]
12546        #[derive(PartialEq, Eq, Hash)]
12547        enum __FieldTag {
12548            __parent,
12549            __page_size,
12550            __page_token,
12551            __filter,
12552            __order_by,
12553            Unknown(std::string::String),
12554        }
12555        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12556            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12557            where
12558                D: serde::Deserializer<'de>,
12559            {
12560                struct Visitor;
12561                impl<'de> serde::de::Visitor<'de> for Visitor {
12562                    type Value = __FieldTag;
12563                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12564                        formatter.write_str("a field name for ListHubsRequest")
12565                    }
12566                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12567                    where
12568                        E: serde::de::Error,
12569                    {
12570                        use std::result::Result::Ok;
12571                        use std::string::ToString;
12572                        match value {
12573                            "parent" => Ok(__FieldTag::__parent),
12574                            "pageSize" => Ok(__FieldTag::__page_size),
12575                            "page_size" => Ok(__FieldTag::__page_size),
12576                            "pageToken" => Ok(__FieldTag::__page_token),
12577                            "page_token" => Ok(__FieldTag::__page_token),
12578                            "filter" => Ok(__FieldTag::__filter),
12579                            "orderBy" => Ok(__FieldTag::__order_by),
12580                            "order_by" => Ok(__FieldTag::__order_by),
12581                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12582                        }
12583                    }
12584                }
12585                deserializer.deserialize_identifier(Visitor)
12586            }
12587        }
12588        struct Visitor;
12589        impl<'de> serde::de::Visitor<'de> for Visitor {
12590            type Value = ListHubsRequest;
12591            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12592                formatter.write_str("struct ListHubsRequest")
12593            }
12594            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12595            where
12596                A: serde::de::MapAccess<'de>,
12597            {
12598                #[allow(unused_imports)]
12599                use serde::de::Error;
12600                use std::option::Option::Some;
12601                let mut fields = std::collections::HashSet::new();
12602                let mut result = Self::Value::new();
12603                while let Some(tag) = map.next_key::<__FieldTag>()? {
12604                    #[allow(clippy::match_single_binding)]
12605                    match tag {
12606                        __FieldTag::__parent => {
12607                            if !fields.insert(__FieldTag::__parent) {
12608                                return std::result::Result::Err(A::Error::duplicate_field(
12609                                    "multiple values for parent",
12610                                ));
12611                            }
12612                            result.parent = map
12613                                .next_value::<std::option::Option<std::string::String>>()?
12614                                .unwrap_or_default();
12615                        }
12616                        __FieldTag::__page_size => {
12617                            if !fields.insert(__FieldTag::__page_size) {
12618                                return std::result::Result::Err(A::Error::duplicate_field(
12619                                    "multiple values for page_size",
12620                                ));
12621                            }
12622                            struct __With(std::option::Option<i32>);
12623                            impl<'de> serde::de::Deserialize<'de> for __With {
12624                                fn deserialize<D>(
12625                                    deserializer: D,
12626                                ) -> std::result::Result<Self, D::Error>
12627                                where
12628                                    D: serde::de::Deserializer<'de>,
12629                                {
12630                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
12631                                }
12632                            }
12633                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
12634                        }
12635                        __FieldTag::__page_token => {
12636                            if !fields.insert(__FieldTag::__page_token) {
12637                                return std::result::Result::Err(A::Error::duplicate_field(
12638                                    "multiple values for page_token",
12639                                ));
12640                            }
12641                            result.page_token = map
12642                                .next_value::<std::option::Option<std::string::String>>()?
12643                                .unwrap_or_default();
12644                        }
12645                        __FieldTag::__filter => {
12646                            if !fields.insert(__FieldTag::__filter) {
12647                                return std::result::Result::Err(A::Error::duplicate_field(
12648                                    "multiple values for filter",
12649                                ));
12650                            }
12651                            result.filter = map
12652                                .next_value::<std::option::Option<std::string::String>>()?
12653                                .unwrap_or_default();
12654                        }
12655                        __FieldTag::__order_by => {
12656                            if !fields.insert(__FieldTag::__order_by) {
12657                                return std::result::Result::Err(A::Error::duplicate_field(
12658                                    "multiple values for order_by",
12659                                ));
12660                            }
12661                            result.order_by = map
12662                                .next_value::<std::option::Option<std::string::String>>()?
12663                                .unwrap_or_default();
12664                        }
12665                        __FieldTag::Unknown(key) => {
12666                            let value = map.next_value::<serde_json::Value>()?;
12667                            result._unknown_fields.insert(key, value);
12668                        }
12669                    }
12670                }
12671                std::result::Result::Ok(result)
12672            }
12673        }
12674        deserializer.deserialize_any(Visitor)
12675    }
12676}
12677
12678#[doc(hidden)]
12679impl serde::ser::Serialize for ListHubsRequest {
12680    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12681    where
12682        S: serde::ser::Serializer,
12683    {
12684        use serde::ser::SerializeMap;
12685        #[allow(unused_imports)]
12686        use std::option::Option::Some;
12687        let mut state = serializer.serialize_map(std::option::Option::None)?;
12688        if !self.parent.is_empty() {
12689            state.serialize_entry("parent", &self.parent)?;
12690        }
12691        if !wkt::internal::is_default(&self.page_size) {
12692            struct __With<'a>(&'a i32);
12693            impl<'a> serde::ser::Serialize for __With<'a> {
12694                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12695                where
12696                    S: serde::ser::Serializer,
12697                {
12698                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
12699                }
12700            }
12701            state.serialize_entry("pageSize", &__With(&self.page_size))?;
12702        }
12703        if !self.page_token.is_empty() {
12704            state.serialize_entry("pageToken", &self.page_token)?;
12705        }
12706        if !self.filter.is_empty() {
12707            state.serialize_entry("filter", &self.filter)?;
12708        }
12709        if !self.order_by.is_empty() {
12710            state.serialize_entry("orderBy", &self.order_by)?;
12711        }
12712        if !self._unknown_fields.is_empty() {
12713            for (key, value) in self._unknown_fields.iter() {
12714                state.serialize_entry(key, &value)?;
12715            }
12716        }
12717        state.end()
12718    }
12719}
12720
12721/// Response for
12722/// [HubService.ListHubs][google.cloud.networkconnectivity.v1.HubService.ListHubs]
12723/// method.
12724///
12725/// [google.cloud.networkconnectivity.v1.HubService.ListHubs]: crate::client::HubService::list_hubs
12726#[derive(Clone, Debug, Default, PartialEq)]
12727#[non_exhaustive]
12728pub struct ListHubsResponse {
12729    /// The requested hubs.
12730    pub hubs: std::vec::Vec<crate::model::Hub>,
12731
12732    /// The token for the next page of the response. To see more results,
12733    /// use this value as the page_token for your next request. If this value
12734    /// is empty, there are no more results.
12735    pub next_page_token: std::string::String,
12736
12737    /// Locations that could not be reached.
12738    pub unreachable: std::vec::Vec<std::string::String>,
12739
12740    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12741}
12742
12743impl ListHubsResponse {
12744    pub fn new() -> Self {
12745        std::default::Default::default()
12746    }
12747
12748    /// Sets the value of [hubs][crate::model::ListHubsResponse::hubs].
12749    pub fn set_hubs<T, V>(mut self, v: T) -> Self
12750    where
12751        T: std::iter::IntoIterator<Item = V>,
12752        V: std::convert::Into<crate::model::Hub>,
12753    {
12754        use std::iter::Iterator;
12755        self.hubs = v.into_iter().map(|i| i.into()).collect();
12756        self
12757    }
12758
12759    /// Sets the value of [next_page_token][crate::model::ListHubsResponse::next_page_token].
12760    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12761        self.next_page_token = v.into();
12762        self
12763    }
12764
12765    /// Sets the value of [unreachable][crate::model::ListHubsResponse::unreachable].
12766    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
12767    where
12768        T: std::iter::IntoIterator<Item = V>,
12769        V: std::convert::Into<std::string::String>,
12770    {
12771        use std::iter::Iterator;
12772        self.unreachable = v.into_iter().map(|i| i.into()).collect();
12773        self
12774    }
12775}
12776
12777impl wkt::message::Message for ListHubsResponse {
12778    fn typename() -> &'static str {
12779        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListHubsResponse"
12780    }
12781}
12782
12783#[doc(hidden)]
12784impl gax::paginator::internal::PageableResponse for ListHubsResponse {
12785    type PageItem = crate::model::Hub;
12786
12787    fn items(self) -> std::vec::Vec<Self::PageItem> {
12788        self.hubs
12789    }
12790
12791    fn next_page_token(&self) -> std::string::String {
12792        use std::clone::Clone;
12793        self.next_page_token.clone()
12794    }
12795}
12796
12797#[doc(hidden)]
12798impl<'de> serde::de::Deserialize<'de> for ListHubsResponse {
12799    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12800    where
12801        D: serde::Deserializer<'de>,
12802    {
12803        #[allow(non_camel_case_types)]
12804        #[doc(hidden)]
12805        #[derive(PartialEq, Eq, Hash)]
12806        enum __FieldTag {
12807            __hubs,
12808            __next_page_token,
12809            __unreachable,
12810            Unknown(std::string::String),
12811        }
12812        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12813            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12814            where
12815                D: serde::Deserializer<'de>,
12816            {
12817                struct Visitor;
12818                impl<'de> serde::de::Visitor<'de> for Visitor {
12819                    type Value = __FieldTag;
12820                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12821                        formatter.write_str("a field name for ListHubsResponse")
12822                    }
12823                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12824                    where
12825                        E: serde::de::Error,
12826                    {
12827                        use std::result::Result::Ok;
12828                        use std::string::ToString;
12829                        match value {
12830                            "hubs" => Ok(__FieldTag::__hubs),
12831                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
12832                            "next_page_token" => Ok(__FieldTag::__next_page_token),
12833                            "unreachable" => Ok(__FieldTag::__unreachable),
12834                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12835                        }
12836                    }
12837                }
12838                deserializer.deserialize_identifier(Visitor)
12839            }
12840        }
12841        struct Visitor;
12842        impl<'de> serde::de::Visitor<'de> for Visitor {
12843            type Value = ListHubsResponse;
12844            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12845                formatter.write_str("struct ListHubsResponse")
12846            }
12847            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12848            where
12849                A: serde::de::MapAccess<'de>,
12850            {
12851                #[allow(unused_imports)]
12852                use serde::de::Error;
12853                use std::option::Option::Some;
12854                let mut fields = std::collections::HashSet::new();
12855                let mut result = Self::Value::new();
12856                while let Some(tag) = map.next_key::<__FieldTag>()? {
12857                    #[allow(clippy::match_single_binding)]
12858                    match tag {
12859                        __FieldTag::__hubs => {
12860                            if !fields.insert(__FieldTag::__hubs) {
12861                                return std::result::Result::Err(A::Error::duplicate_field(
12862                                    "multiple values for hubs",
12863                                ));
12864                            }
12865                            result.hubs = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Hub>>>()?.unwrap_or_default();
12866                        }
12867                        __FieldTag::__next_page_token => {
12868                            if !fields.insert(__FieldTag::__next_page_token) {
12869                                return std::result::Result::Err(A::Error::duplicate_field(
12870                                    "multiple values for next_page_token",
12871                                ));
12872                            }
12873                            result.next_page_token = map
12874                                .next_value::<std::option::Option<std::string::String>>()?
12875                                .unwrap_or_default();
12876                        }
12877                        __FieldTag::__unreachable => {
12878                            if !fields.insert(__FieldTag::__unreachable) {
12879                                return std::result::Result::Err(A::Error::duplicate_field(
12880                                    "multiple values for unreachable",
12881                                ));
12882                            }
12883                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
12884                        }
12885                        __FieldTag::Unknown(key) => {
12886                            let value = map.next_value::<serde_json::Value>()?;
12887                            result._unknown_fields.insert(key, value);
12888                        }
12889                    }
12890                }
12891                std::result::Result::Ok(result)
12892            }
12893        }
12894        deserializer.deserialize_any(Visitor)
12895    }
12896}
12897
12898#[doc(hidden)]
12899impl serde::ser::Serialize for ListHubsResponse {
12900    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12901    where
12902        S: serde::ser::Serializer,
12903    {
12904        use serde::ser::SerializeMap;
12905        #[allow(unused_imports)]
12906        use std::option::Option::Some;
12907        let mut state = serializer.serialize_map(std::option::Option::None)?;
12908        if !self.hubs.is_empty() {
12909            state.serialize_entry("hubs", &self.hubs)?;
12910        }
12911        if !self.next_page_token.is_empty() {
12912            state.serialize_entry("nextPageToken", &self.next_page_token)?;
12913        }
12914        if !self.unreachable.is_empty() {
12915            state.serialize_entry("unreachable", &self.unreachable)?;
12916        }
12917        if !self._unknown_fields.is_empty() {
12918            for (key, value) in self._unknown_fields.iter() {
12919                state.serialize_entry(key, &value)?;
12920            }
12921        }
12922        state.end()
12923    }
12924}
12925
12926/// Request for
12927/// [HubService.GetHub][google.cloud.networkconnectivity.v1.HubService.GetHub]
12928/// method.
12929///
12930/// [google.cloud.networkconnectivity.v1.HubService.GetHub]: crate::client::HubService::get_hub
12931#[derive(Clone, Debug, Default, PartialEq)]
12932#[non_exhaustive]
12933pub struct GetHubRequest {
12934    /// Required. The name of the hub resource to get.
12935    pub name: std::string::String,
12936
12937    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12938}
12939
12940impl GetHubRequest {
12941    pub fn new() -> Self {
12942        std::default::Default::default()
12943    }
12944
12945    /// Sets the value of [name][crate::model::GetHubRequest::name].
12946    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12947        self.name = v.into();
12948        self
12949    }
12950}
12951
12952impl wkt::message::Message for GetHubRequest {
12953    fn typename() -> &'static str {
12954        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetHubRequest"
12955    }
12956}
12957
12958#[doc(hidden)]
12959impl<'de> serde::de::Deserialize<'de> for GetHubRequest {
12960    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12961    where
12962        D: serde::Deserializer<'de>,
12963    {
12964        #[allow(non_camel_case_types)]
12965        #[doc(hidden)]
12966        #[derive(PartialEq, Eq, Hash)]
12967        enum __FieldTag {
12968            __name,
12969            Unknown(std::string::String),
12970        }
12971        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12972            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12973            where
12974                D: serde::Deserializer<'de>,
12975            {
12976                struct Visitor;
12977                impl<'de> serde::de::Visitor<'de> for Visitor {
12978                    type Value = __FieldTag;
12979                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12980                        formatter.write_str("a field name for GetHubRequest")
12981                    }
12982                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12983                    where
12984                        E: serde::de::Error,
12985                    {
12986                        use std::result::Result::Ok;
12987                        use std::string::ToString;
12988                        match value {
12989                            "name" => Ok(__FieldTag::__name),
12990                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12991                        }
12992                    }
12993                }
12994                deserializer.deserialize_identifier(Visitor)
12995            }
12996        }
12997        struct Visitor;
12998        impl<'de> serde::de::Visitor<'de> for Visitor {
12999            type Value = GetHubRequest;
13000            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13001                formatter.write_str("struct GetHubRequest")
13002            }
13003            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13004            where
13005                A: serde::de::MapAccess<'de>,
13006            {
13007                #[allow(unused_imports)]
13008                use serde::de::Error;
13009                use std::option::Option::Some;
13010                let mut fields = std::collections::HashSet::new();
13011                let mut result = Self::Value::new();
13012                while let Some(tag) = map.next_key::<__FieldTag>()? {
13013                    #[allow(clippy::match_single_binding)]
13014                    match tag {
13015                        __FieldTag::__name => {
13016                            if !fields.insert(__FieldTag::__name) {
13017                                return std::result::Result::Err(A::Error::duplicate_field(
13018                                    "multiple values for name",
13019                                ));
13020                            }
13021                            result.name = map
13022                                .next_value::<std::option::Option<std::string::String>>()?
13023                                .unwrap_or_default();
13024                        }
13025                        __FieldTag::Unknown(key) => {
13026                            let value = map.next_value::<serde_json::Value>()?;
13027                            result._unknown_fields.insert(key, value);
13028                        }
13029                    }
13030                }
13031                std::result::Result::Ok(result)
13032            }
13033        }
13034        deserializer.deserialize_any(Visitor)
13035    }
13036}
13037
13038#[doc(hidden)]
13039impl serde::ser::Serialize for GetHubRequest {
13040    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13041    where
13042        S: serde::ser::Serializer,
13043    {
13044        use serde::ser::SerializeMap;
13045        #[allow(unused_imports)]
13046        use std::option::Option::Some;
13047        let mut state = serializer.serialize_map(std::option::Option::None)?;
13048        if !self.name.is_empty() {
13049            state.serialize_entry("name", &self.name)?;
13050        }
13051        if !self._unknown_fields.is_empty() {
13052            for (key, value) in self._unknown_fields.iter() {
13053                state.serialize_entry(key, &value)?;
13054            }
13055        }
13056        state.end()
13057    }
13058}
13059
13060/// Request for
13061/// [HubService.CreateHub][google.cloud.networkconnectivity.v1.HubService.CreateHub]
13062/// method.
13063///
13064/// [google.cloud.networkconnectivity.v1.HubService.CreateHub]: crate::client::HubService::create_hub
13065#[derive(Clone, Debug, Default, PartialEq)]
13066#[non_exhaustive]
13067pub struct CreateHubRequest {
13068    /// Required. The parent resource.
13069    pub parent: std::string::String,
13070
13071    /// Required. A unique identifier for the hub.
13072    pub hub_id: std::string::String,
13073
13074    /// Required. The initial values for a new hub.
13075    pub hub: std::option::Option<crate::model::Hub>,
13076
13077    /// Optional. A request ID to identify requests. Specify a unique request ID so
13078    /// that if you must retry your request, the server knows to ignore the request
13079    /// if it has already been completed. The server guarantees that a request
13080    /// doesn't result in creation of duplicate commitments for at least 60
13081    /// minutes.
13082    ///
13083    /// For example, consider a situation where you make an initial request and
13084    /// the request times out. If you make the request again with the same request
13085    /// ID, the server can check to see whether the original operation
13086    /// was received. If it was, the server ignores the second request. This
13087    /// behavior prevents clients from mistakenly creating duplicate commitments.
13088    ///
13089    /// The request ID must be a valid UUID, with the exception that zero UUID is
13090    /// not supported (00000000-0000-0000-0000-000000000000).
13091    pub request_id: std::string::String,
13092
13093    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13094}
13095
13096impl CreateHubRequest {
13097    pub fn new() -> Self {
13098        std::default::Default::default()
13099    }
13100
13101    /// Sets the value of [parent][crate::model::CreateHubRequest::parent].
13102    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13103        self.parent = v.into();
13104        self
13105    }
13106
13107    /// Sets the value of [hub_id][crate::model::CreateHubRequest::hub_id].
13108    pub fn set_hub_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13109        self.hub_id = v.into();
13110        self
13111    }
13112
13113    /// Sets the value of [hub][crate::model::CreateHubRequest::hub].
13114    pub fn set_hub<T>(mut self, v: T) -> Self
13115    where
13116        T: std::convert::Into<crate::model::Hub>,
13117    {
13118        self.hub = std::option::Option::Some(v.into());
13119        self
13120    }
13121
13122    /// Sets or clears the value of [hub][crate::model::CreateHubRequest::hub].
13123    pub fn set_or_clear_hub<T>(mut self, v: std::option::Option<T>) -> Self
13124    where
13125        T: std::convert::Into<crate::model::Hub>,
13126    {
13127        self.hub = v.map(|x| x.into());
13128        self
13129    }
13130
13131    /// Sets the value of [request_id][crate::model::CreateHubRequest::request_id].
13132    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13133        self.request_id = v.into();
13134        self
13135    }
13136}
13137
13138impl wkt::message::Message for CreateHubRequest {
13139    fn typename() -> &'static str {
13140        "type.googleapis.com/google.cloud.networkconnectivity.v1.CreateHubRequest"
13141    }
13142}
13143
13144#[doc(hidden)]
13145impl<'de> serde::de::Deserialize<'de> for CreateHubRequest {
13146    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13147    where
13148        D: serde::Deserializer<'de>,
13149    {
13150        #[allow(non_camel_case_types)]
13151        #[doc(hidden)]
13152        #[derive(PartialEq, Eq, Hash)]
13153        enum __FieldTag {
13154            __parent,
13155            __hub_id,
13156            __hub,
13157            __request_id,
13158            Unknown(std::string::String),
13159        }
13160        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13161            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13162            where
13163                D: serde::Deserializer<'de>,
13164            {
13165                struct Visitor;
13166                impl<'de> serde::de::Visitor<'de> for Visitor {
13167                    type Value = __FieldTag;
13168                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13169                        formatter.write_str("a field name for CreateHubRequest")
13170                    }
13171                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13172                    where
13173                        E: serde::de::Error,
13174                    {
13175                        use std::result::Result::Ok;
13176                        use std::string::ToString;
13177                        match value {
13178                            "parent" => Ok(__FieldTag::__parent),
13179                            "hubId" => Ok(__FieldTag::__hub_id),
13180                            "hub_id" => Ok(__FieldTag::__hub_id),
13181                            "hub" => Ok(__FieldTag::__hub),
13182                            "requestId" => Ok(__FieldTag::__request_id),
13183                            "request_id" => Ok(__FieldTag::__request_id),
13184                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13185                        }
13186                    }
13187                }
13188                deserializer.deserialize_identifier(Visitor)
13189            }
13190        }
13191        struct Visitor;
13192        impl<'de> serde::de::Visitor<'de> for Visitor {
13193            type Value = CreateHubRequest;
13194            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13195                formatter.write_str("struct CreateHubRequest")
13196            }
13197            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13198            where
13199                A: serde::de::MapAccess<'de>,
13200            {
13201                #[allow(unused_imports)]
13202                use serde::de::Error;
13203                use std::option::Option::Some;
13204                let mut fields = std::collections::HashSet::new();
13205                let mut result = Self::Value::new();
13206                while let Some(tag) = map.next_key::<__FieldTag>()? {
13207                    #[allow(clippy::match_single_binding)]
13208                    match tag {
13209                        __FieldTag::__parent => {
13210                            if !fields.insert(__FieldTag::__parent) {
13211                                return std::result::Result::Err(A::Error::duplicate_field(
13212                                    "multiple values for parent",
13213                                ));
13214                            }
13215                            result.parent = map
13216                                .next_value::<std::option::Option<std::string::String>>()?
13217                                .unwrap_or_default();
13218                        }
13219                        __FieldTag::__hub_id => {
13220                            if !fields.insert(__FieldTag::__hub_id) {
13221                                return std::result::Result::Err(A::Error::duplicate_field(
13222                                    "multiple values for hub_id",
13223                                ));
13224                            }
13225                            result.hub_id = map
13226                                .next_value::<std::option::Option<std::string::String>>()?
13227                                .unwrap_or_default();
13228                        }
13229                        __FieldTag::__hub => {
13230                            if !fields.insert(__FieldTag::__hub) {
13231                                return std::result::Result::Err(A::Error::duplicate_field(
13232                                    "multiple values for hub",
13233                                ));
13234                            }
13235                            result.hub =
13236                                map.next_value::<std::option::Option<crate::model::Hub>>()?;
13237                        }
13238                        __FieldTag::__request_id => {
13239                            if !fields.insert(__FieldTag::__request_id) {
13240                                return std::result::Result::Err(A::Error::duplicate_field(
13241                                    "multiple values for request_id",
13242                                ));
13243                            }
13244                            result.request_id = map
13245                                .next_value::<std::option::Option<std::string::String>>()?
13246                                .unwrap_or_default();
13247                        }
13248                        __FieldTag::Unknown(key) => {
13249                            let value = map.next_value::<serde_json::Value>()?;
13250                            result._unknown_fields.insert(key, value);
13251                        }
13252                    }
13253                }
13254                std::result::Result::Ok(result)
13255            }
13256        }
13257        deserializer.deserialize_any(Visitor)
13258    }
13259}
13260
13261#[doc(hidden)]
13262impl serde::ser::Serialize for CreateHubRequest {
13263    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13264    where
13265        S: serde::ser::Serializer,
13266    {
13267        use serde::ser::SerializeMap;
13268        #[allow(unused_imports)]
13269        use std::option::Option::Some;
13270        let mut state = serializer.serialize_map(std::option::Option::None)?;
13271        if !self.parent.is_empty() {
13272            state.serialize_entry("parent", &self.parent)?;
13273        }
13274        if !self.hub_id.is_empty() {
13275            state.serialize_entry("hubId", &self.hub_id)?;
13276        }
13277        if self.hub.is_some() {
13278            state.serialize_entry("hub", &self.hub)?;
13279        }
13280        if !self.request_id.is_empty() {
13281            state.serialize_entry("requestId", &self.request_id)?;
13282        }
13283        if !self._unknown_fields.is_empty() {
13284            for (key, value) in self._unknown_fields.iter() {
13285                state.serialize_entry(key, &value)?;
13286            }
13287        }
13288        state.end()
13289    }
13290}
13291
13292/// Request for
13293/// [HubService.UpdateHub][google.cloud.networkconnectivity.v1.HubService.UpdateHub]
13294/// method.
13295///
13296/// [google.cloud.networkconnectivity.v1.HubService.UpdateHub]: crate::client::HubService::update_hub
13297#[derive(Clone, Debug, Default, PartialEq)]
13298#[non_exhaustive]
13299pub struct UpdateHubRequest {
13300    /// Optional. In the case of an update to an existing hub, field mask is used
13301    /// to specify the fields to be overwritten. The fields specified in the
13302    /// update_mask are relative to the resource, not the full request. A field is
13303    /// overwritten if it is in the mask. If the user does not provide a mask, then
13304    /// all fields are overwritten.
13305    pub update_mask: std::option::Option<wkt::FieldMask>,
13306
13307    /// Required. The state that the hub should be in after the update.
13308    pub hub: std::option::Option<crate::model::Hub>,
13309
13310    /// Optional. A request ID to identify requests. Specify a unique request ID so
13311    /// that if you must retry your request, the server knows to ignore the request
13312    /// if it has already been completed. The server guarantees that a request
13313    /// doesn't result in creation of duplicate commitments for at least 60
13314    /// minutes.
13315    ///
13316    /// For example, consider a situation where you make an initial request and
13317    /// the request times out. If you make the request again with the same request
13318    /// ID, the server can check to see whether the original operation
13319    /// was received. If it was, the server ignores the second request. This
13320    /// behavior prevents clients from mistakenly creating duplicate commitments.
13321    ///
13322    /// The request ID must be a valid UUID, with the exception that zero UUID is
13323    /// not supported (00000000-0000-0000-0000-000000000000).
13324    pub request_id: std::string::String,
13325
13326    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13327}
13328
13329impl UpdateHubRequest {
13330    pub fn new() -> Self {
13331        std::default::Default::default()
13332    }
13333
13334    /// Sets the value of [update_mask][crate::model::UpdateHubRequest::update_mask].
13335    pub fn set_update_mask<T>(mut self, v: T) -> Self
13336    where
13337        T: std::convert::Into<wkt::FieldMask>,
13338    {
13339        self.update_mask = std::option::Option::Some(v.into());
13340        self
13341    }
13342
13343    /// Sets or clears the value of [update_mask][crate::model::UpdateHubRequest::update_mask].
13344    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13345    where
13346        T: std::convert::Into<wkt::FieldMask>,
13347    {
13348        self.update_mask = v.map(|x| x.into());
13349        self
13350    }
13351
13352    /// Sets the value of [hub][crate::model::UpdateHubRequest::hub].
13353    pub fn set_hub<T>(mut self, v: T) -> Self
13354    where
13355        T: std::convert::Into<crate::model::Hub>,
13356    {
13357        self.hub = std::option::Option::Some(v.into());
13358        self
13359    }
13360
13361    /// Sets or clears the value of [hub][crate::model::UpdateHubRequest::hub].
13362    pub fn set_or_clear_hub<T>(mut self, v: std::option::Option<T>) -> Self
13363    where
13364        T: std::convert::Into<crate::model::Hub>,
13365    {
13366        self.hub = v.map(|x| x.into());
13367        self
13368    }
13369
13370    /// Sets the value of [request_id][crate::model::UpdateHubRequest::request_id].
13371    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13372        self.request_id = v.into();
13373        self
13374    }
13375}
13376
13377impl wkt::message::Message for UpdateHubRequest {
13378    fn typename() -> &'static str {
13379        "type.googleapis.com/google.cloud.networkconnectivity.v1.UpdateHubRequest"
13380    }
13381}
13382
13383#[doc(hidden)]
13384impl<'de> serde::de::Deserialize<'de> for UpdateHubRequest {
13385    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13386    where
13387        D: serde::Deserializer<'de>,
13388    {
13389        #[allow(non_camel_case_types)]
13390        #[doc(hidden)]
13391        #[derive(PartialEq, Eq, Hash)]
13392        enum __FieldTag {
13393            __update_mask,
13394            __hub,
13395            __request_id,
13396            Unknown(std::string::String),
13397        }
13398        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13399            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13400            where
13401                D: serde::Deserializer<'de>,
13402            {
13403                struct Visitor;
13404                impl<'de> serde::de::Visitor<'de> for Visitor {
13405                    type Value = __FieldTag;
13406                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13407                        formatter.write_str("a field name for UpdateHubRequest")
13408                    }
13409                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13410                    where
13411                        E: serde::de::Error,
13412                    {
13413                        use std::result::Result::Ok;
13414                        use std::string::ToString;
13415                        match value {
13416                            "updateMask" => Ok(__FieldTag::__update_mask),
13417                            "update_mask" => Ok(__FieldTag::__update_mask),
13418                            "hub" => Ok(__FieldTag::__hub),
13419                            "requestId" => Ok(__FieldTag::__request_id),
13420                            "request_id" => Ok(__FieldTag::__request_id),
13421                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13422                        }
13423                    }
13424                }
13425                deserializer.deserialize_identifier(Visitor)
13426            }
13427        }
13428        struct Visitor;
13429        impl<'de> serde::de::Visitor<'de> for Visitor {
13430            type Value = UpdateHubRequest;
13431            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13432                formatter.write_str("struct UpdateHubRequest")
13433            }
13434            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13435            where
13436                A: serde::de::MapAccess<'de>,
13437            {
13438                #[allow(unused_imports)]
13439                use serde::de::Error;
13440                use std::option::Option::Some;
13441                let mut fields = std::collections::HashSet::new();
13442                let mut result = Self::Value::new();
13443                while let Some(tag) = map.next_key::<__FieldTag>()? {
13444                    #[allow(clippy::match_single_binding)]
13445                    match tag {
13446                        __FieldTag::__update_mask => {
13447                            if !fields.insert(__FieldTag::__update_mask) {
13448                                return std::result::Result::Err(A::Error::duplicate_field(
13449                                    "multiple values for update_mask",
13450                                ));
13451                            }
13452                            result.update_mask =
13453                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
13454                        }
13455                        __FieldTag::__hub => {
13456                            if !fields.insert(__FieldTag::__hub) {
13457                                return std::result::Result::Err(A::Error::duplicate_field(
13458                                    "multiple values for hub",
13459                                ));
13460                            }
13461                            result.hub =
13462                                map.next_value::<std::option::Option<crate::model::Hub>>()?;
13463                        }
13464                        __FieldTag::__request_id => {
13465                            if !fields.insert(__FieldTag::__request_id) {
13466                                return std::result::Result::Err(A::Error::duplicate_field(
13467                                    "multiple values for request_id",
13468                                ));
13469                            }
13470                            result.request_id = map
13471                                .next_value::<std::option::Option<std::string::String>>()?
13472                                .unwrap_or_default();
13473                        }
13474                        __FieldTag::Unknown(key) => {
13475                            let value = map.next_value::<serde_json::Value>()?;
13476                            result._unknown_fields.insert(key, value);
13477                        }
13478                    }
13479                }
13480                std::result::Result::Ok(result)
13481            }
13482        }
13483        deserializer.deserialize_any(Visitor)
13484    }
13485}
13486
13487#[doc(hidden)]
13488impl serde::ser::Serialize for UpdateHubRequest {
13489    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13490    where
13491        S: serde::ser::Serializer,
13492    {
13493        use serde::ser::SerializeMap;
13494        #[allow(unused_imports)]
13495        use std::option::Option::Some;
13496        let mut state = serializer.serialize_map(std::option::Option::None)?;
13497        if self.update_mask.is_some() {
13498            state.serialize_entry("updateMask", &self.update_mask)?;
13499        }
13500        if self.hub.is_some() {
13501            state.serialize_entry("hub", &self.hub)?;
13502        }
13503        if !self.request_id.is_empty() {
13504            state.serialize_entry("requestId", &self.request_id)?;
13505        }
13506        if !self._unknown_fields.is_empty() {
13507            for (key, value) in self._unknown_fields.iter() {
13508                state.serialize_entry(key, &value)?;
13509            }
13510        }
13511        state.end()
13512    }
13513}
13514
13515/// The request for
13516/// [HubService.DeleteHub][google.cloud.networkconnectivity.v1.HubService.DeleteHub].
13517///
13518/// [google.cloud.networkconnectivity.v1.HubService.DeleteHub]: crate::client::HubService::delete_hub
13519#[derive(Clone, Debug, Default, PartialEq)]
13520#[non_exhaustive]
13521pub struct DeleteHubRequest {
13522    /// Required. The name of the hub to delete.
13523    pub name: std::string::String,
13524
13525    /// Optional. A request ID to identify requests. Specify a unique request ID so
13526    /// that if you must retry your request, the server knows to ignore the request
13527    /// if it has already been completed. The server guarantees that a request
13528    /// doesn't result in creation of duplicate commitments for at least 60
13529    /// minutes.
13530    ///
13531    /// For example, consider a situation where you make an initial request and
13532    /// the request times out. If you make the request again with the same request
13533    /// ID, the server can check to see whether the original operation
13534    /// was received. If it was, the server ignores the second request. This
13535    /// behavior prevents clients from mistakenly creating duplicate commitments.
13536    ///
13537    /// The request ID must be a valid UUID, with the exception that zero UUID is
13538    /// not supported (00000000-0000-0000-0000-000000000000).
13539    pub request_id: std::string::String,
13540
13541    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13542}
13543
13544impl DeleteHubRequest {
13545    pub fn new() -> Self {
13546        std::default::Default::default()
13547    }
13548
13549    /// Sets the value of [name][crate::model::DeleteHubRequest::name].
13550    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13551        self.name = v.into();
13552        self
13553    }
13554
13555    /// Sets the value of [request_id][crate::model::DeleteHubRequest::request_id].
13556    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13557        self.request_id = v.into();
13558        self
13559    }
13560}
13561
13562impl wkt::message::Message for DeleteHubRequest {
13563    fn typename() -> &'static str {
13564        "type.googleapis.com/google.cloud.networkconnectivity.v1.DeleteHubRequest"
13565    }
13566}
13567
13568#[doc(hidden)]
13569impl<'de> serde::de::Deserialize<'de> for DeleteHubRequest {
13570    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13571    where
13572        D: serde::Deserializer<'de>,
13573    {
13574        #[allow(non_camel_case_types)]
13575        #[doc(hidden)]
13576        #[derive(PartialEq, Eq, Hash)]
13577        enum __FieldTag {
13578            __name,
13579            __request_id,
13580            Unknown(std::string::String),
13581        }
13582        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13583            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13584            where
13585                D: serde::Deserializer<'de>,
13586            {
13587                struct Visitor;
13588                impl<'de> serde::de::Visitor<'de> for Visitor {
13589                    type Value = __FieldTag;
13590                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13591                        formatter.write_str("a field name for DeleteHubRequest")
13592                    }
13593                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13594                    where
13595                        E: serde::de::Error,
13596                    {
13597                        use std::result::Result::Ok;
13598                        use std::string::ToString;
13599                        match value {
13600                            "name" => Ok(__FieldTag::__name),
13601                            "requestId" => Ok(__FieldTag::__request_id),
13602                            "request_id" => Ok(__FieldTag::__request_id),
13603                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13604                        }
13605                    }
13606                }
13607                deserializer.deserialize_identifier(Visitor)
13608            }
13609        }
13610        struct Visitor;
13611        impl<'de> serde::de::Visitor<'de> for Visitor {
13612            type Value = DeleteHubRequest;
13613            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13614                formatter.write_str("struct DeleteHubRequest")
13615            }
13616            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13617            where
13618                A: serde::de::MapAccess<'de>,
13619            {
13620                #[allow(unused_imports)]
13621                use serde::de::Error;
13622                use std::option::Option::Some;
13623                let mut fields = std::collections::HashSet::new();
13624                let mut result = Self::Value::new();
13625                while let Some(tag) = map.next_key::<__FieldTag>()? {
13626                    #[allow(clippy::match_single_binding)]
13627                    match tag {
13628                        __FieldTag::__name => {
13629                            if !fields.insert(__FieldTag::__name) {
13630                                return std::result::Result::Err(A::Error::duplicate_field(
13631                                    "multiple values for name",
13632                                ));
13633                            }
13634                            result.name = map
13635                                .next_value::<std::option::Option<std::string::String>>()?
13636                                .unwrap_or_default();
13637                        }
13638                        __FieldTag::__request_id => {
13639                            if !fields.insert(__FieldTag::__request_id) {
13640                                return std::result::Result::Err(A::Error::duplicate_field(
13641                                    "multiple values for request_id",
13642                                ));
13643                            }
13644                            result.request_id = map
13645                                .next_value::<std::option::Option<std::string::String>>()?
13646                                .unwrap_or_default();
13647                        }
13648                        __FieldTag::Unknown(key) => {
13649                            let value = map.next_value::<serde_json::Value>()?;
13650                            result._unknown_fields.insert(key, value);
13651                        }
13652                    }
13653                }
13654                std::result::Result::Ok(result)
13655            }
13656        }
13657        deserializer.deserialize_any(Visitor)
13658    }
13659}
13660
13661#[doc(hidden)]
13662impl serde::ser::Serialize for DeleteHubRequest {
13663    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13664    where
13665        S: serde::ser::Serializer,
13666    {
13667        use serde::ser::SerializeMap;
13668        #[allow(unused_imports)]
13669        use std::option::Option::Some;
13670        let mut state = serializer.serialize_map(std::option::Option::None)?;
13671        if !self.name.is_empty() {
13672            state.serialize_entry("name", &self.name)?;
13673        }
13674        if !self.request_id.is_empty() {
13675            state.serialize_entry("requestId", &self.request_id)?;
13676        }
13677        if !self._unknown_fields.is_empty() {
13678            for (key, value) in self._unknown_fields.iter() {
13679                state.serialize_entry(key, &value)?;
13680            }
13681        }
13682        state.end()
13683    }
13684}
13685
13686/// The request for
13687/// [HubService.ListHubSpokes][google.cloud.networkconnectivity.v1.HubService.ListHubSpokes].
13688///
13689/// [google.cloud.networkconnectivity.v1.HubService.ListHubSpokes]: crate::client::HubService::list_hub_spokes
13690#[derive(Clone, Debug, Default, PartialEq)]
13691#[non_exhaustive]
13692pub struct ListHubSpokesRequest {
13693    /// Required. The name of the hub.
13694    pub name: std::string::String,
13695
13696    /// A list of locations.
13697    /// Specify one of the following: `[global]`, a single region (for
13698    /// example, `[us-central1]`), or a combination of
13699    /// values (for example, `[global, us-central1, us-west1]`).
13700    /// If the spoke_locations field is populated, the list of results
13701    /// includes only spokes in the specified location.
13702    /// If the spoke_locations field is not populated, the list of results
13703    /// includes spokes in all locations.
13704    pub spoke_locations: std::vec::Vec<std::string::String>,
13705
13706    /// The maximum number of results to return per page.
13707    pub page_size: i32,
13708
13709    /// The page token.
13710    pub page_token: std::string::String,
13711
13712    /// An expression that filters the list of results.
13713    pub filter: std::string::String,
13714
13715    /// Sort the results by name or create_time.
13716    pub order_by: std::string::String,
13717
13718    /// The view of the spoke to return.
13719    /// The view that you use determines which spoke fields are included in the
13720    /// response.
13721    pub view: crate::model::list_hub_spokes_request::SpokeView,
13722
13723    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13724}
13725
13726impl ListHubSpokesRequest {
13727    pub fn new() -> Self {
13728        std::default::Default::default()
13729    }
13730
13731    /// Sets the value of [name][crate::model::ListHubSpokesRequest::name].
13732    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13733        self.name = v.into();
13734        self
13735    }
13736
13737    /// Sets the value of [spoke_locations][crate::model::ListHubSpokesRequest::spoke_locations].
13738    pub fn set_spoke_locations<T, V>(mut self, v: T) -> Self
13739    where
13740        T: std::iter::IntoIterator<Item = V>,
13741        V: std::convert::Into<std::string::String>,
13742    {
13743        use std::iter::Iterator;
13744        self.spoke_locations = v.into_iter().map(|i| i.into()).collect();
13745        self
13746    }
13747
13748    /// Sets the value of [page_size][crate::model::ListHubSpokesRequest::page_size].
13749    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13750        self.page_size = v.into();
13751        self
13752    }
13753
13754    /// Sets the value of [page_token][crate::model::ListHubSpokesRequest::page_token].
13755    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13756        self.page_token = v.into();
13757        self
13758    }
13759
13760    /// Sets the value of [filter][crate::model::ListHubSpokesRequest::filter].
13761    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13762        self.filter = v.into();
13763        self
13764    }
13765
13766    /// Sets the value of [order_by][crate::model::ListHubSpokesRequest::order_by].
13767    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13768        self.order_by = v.into();
13769        self
13770    }
13771
13772    /// Sets the value of [view][crate::model::ListHubSpokesRequest::view].
13773    pub fn set_view<T: std::convert::Into<crate::model::list_hub_spokes_request::SpokeView>>(
13774        mut self,
13775        v: T,
13776    ) -> Self {
13777        self.view = v.into();
13778        self
13779    }
13780}
13781
13782impl wkt::message::Message for ListHubSpokesRequest {
13783    fn typename() -> &'static str {
13784        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListHubSpokesRequest"
13785    }
13786}
13787
13788#[doc(hidden)]
13789impl<'de> serde::de::Deserialize<'de> for ListHubSpokesRequest {
13790    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13791    where
13792        D: serde::Deserializer<'de>,
13793    {
13794        #[allow(non_camel_case_types)]
13795        #[doc(hidden)]
13796        #[derive(PartialEq, Eq, Hash)]
13797        enum __FieldTag {
13798            __name,
13799            __spoke_locations,
13800            __page_size,
13801            __page_token,
13802            __filter,
13803            __order_by,
13804            __view,
13805            Unknown(std::string::String),
13806        }
13807        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13808            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13809            where
13810                D: serde::Deserializer<'de>,
13811            {
13812                struct Visitor;
13813                impl<'de> serde::de::Visitor<'de> for Visitor {
13814                    type Value = __FieldTag;
13815                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13816                        formatter.write_str("a field name for ListHubSpokesRequest")
13817                    }
13818                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13819                    where
13820                        E: serde::de::Error,
13821                    {
13822                        use std::result::Result::Ok;
13823                        use std::string::ToString;
13824                        match value {
13825                            "name" => Ok(__FieldTag::__name),
13826                            "spokeLocations" => Ok(__FieldTag::__spoke_locations),
13827                            "spoke_locations" => Ok(__FieldTag::__spoke_locations),
13828                            "pageSize" => Ok(__FieldTag::__page_size),
13829                            "page_size" => Ok(__FieldTag::__page_size),
13830                            "pageToken" => Ok(__FieldTag::__page_token),
13831                            "page_token" => Ok(__FieldTag::__page_token),
13832                            "filter" => Ok(__FieldTag::__filter),
13833                            "orderBy" => Ok(__FieldTag::__order_by),
13834                            "order_by" => Ok(__FieldTag::__order_by),
13835                            "view" => Ok(__FieldTag::__view),
13836                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13837                        }
13838                    }
13839                }
13840                deserializer.deserialize_identifier(Visitor)
13841            }
13842        }
13843        struct Visitor;
13844        impl<'de> serde::de::Visitor<'de> for Visitor {
13845            type Value = ListHubSpokesRequest;
13846            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13847                formatter.write_str("struct ListHubSpokesRequest")
13848            }
13849            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13850            where
13851                A: serde::de::MapAccess<'de>,
13852            {
13853                #[allow(unused_imports)]
13854                use serde::de::Error;
13855                use std::option::Option::Some;
13856                let mut fields = std::collections::HashSet::new();
13857                let mut result = Self::Value::new();
13858                while let Some(tag) = map.next_key::<__FieldTag>()? {
13859                    #[allow(clippy::match_single_binding)]
13860                    match tag {
13861                        __FieldTag::__name => {
13862                            if !fields.insert(__FieldTag::__name) {
13863                                return std::result::Result::Err(A::Error::duplicate_field(
13864                                    "multiple values for name",
13865                                ));
13866                            }
13867                            result.name = map
13868                                .next_value::<std::option::Option<std::string::String>>()?
13869                                .unwrap_or_default();
13870                        }
13871                        __FieldTag::__spoke_locations => {
13872                            if !fields.insert(__FieldTag::__spoke_locations) {
13873                                return std::result::Result::Err(A::Error::duplicate_field(
13874                                    "multiple values for spoke_locations",
13875                                ));
13876                            }
13877                            result.spoke_locations = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
13878                        }
13879                        __FieldTag::__page_size => {
13880                            if !fields.insert(__FieldTag::__page_size) {
13881                                return std::result::Result::Err(A::Error::duplicate_field(
13882                                    "multiple values for page_size",
13883                                ));
13884                            }
13885                            struct __With(std::option::Option<i32>);
13886                            impl<'de> serde::de::Deserialize<'de> for __With {
13887                                fn deserialize<D>(
13888                                    deserializer: D,
13889                                ) -> std::result::Result<Self, D::Error>
13890                                where
13891                                    D: serde::de::Deserializer<'de>,
13892                                {
13893                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
13894                                }
13895                            }
13896                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
13897                        }
13898                        __FieldTag::__page_token => {
13899                            if !fields.insert(__FieldTag::__page_token) {
13900                                return std::result::Result::Err(A::Error::duplicate_field(
13901                                    "multiple values for page_token",
13902                                ));
13903                            }
13904                            result.page_token = map
13905                                .next_value::<std::option::Option<std::string::String>>()?
13906                                .unwrap_or_default();
13907                        }
13908                        __FieldTag::__filter => {
13909                            if !fields.insert(__FieldTag::__filter) {
13910                                return std::result::Result::Err(A::Error::duplicate_field(
13911                                    "multiple values for filter",
13912                                ));
13913                            }
13914                            result.filter = map
13915                                .next_value::<std::option::Option<std::string::String>>()?
13916                                .unwrap_or_default();
13917                        }
13918                        __FieldTag::__order_by => {
13919                            if !fields.insert(__FieldTag::__order_by) {
13920                                return std::result::Result::Err(A::Error::duplicate_field(
13921                                    "multiple values for order_by",
13922                                ));
13923                            }
13924                            result.order_by = map
13925                                .next_value::<std::option::Option<std::string::String>>()?
13926                                .unwrap_or_default();
13927                        }
13928                        __FieldTag::__view => {
13929                            if !fields.insert(__FieldTag::__view) {
13930                                return std::result::Result::Err(A::Error::duplicate_field(
13931                                    "multiple values for view",
13932                                ));
13933                            }
13934                            result.view = map
13935                                .next_value::<std::option::Option<
13936                                    crate::model::list_hub_spokes_request::SpokeView,
13937                                >>()?
13938                                .unwrap_or_default();
13939                        }
13940                        __FieldTag::Unknown(key) => {
13941                            let value = map.next_value::<serde_json::Value>()?;
13942                            result._unknown_fields.insert(key, value);
13943                        }
13944                    }
13945                }
13946                std::result::Result::Ok(result)
13947            }
13948        }
13949        deserializer.deserialize_any(Visitor)
13950    }
13951}
13952
13953#[doc(hidden)]
13954impl serde::ser::Serialize for ListHubSpokesRequest {
13955    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13956    where
13957        S: serde::ser::Serializer,
13958    {
13959        use serde::ser::SerializeMap;
13960        #[allow(unused_imports)]
13961        use std::option::Option::Some;
13962        let mut state = serializer.serialize_map(std::option::Option::None)?;
13963        if !self.name.is_empty() {
13964            state.serialize_entry("name", &self.name)?;
13965        }
13966        if !self.spoke_locations.is_empty() {
13967            state.serialize_entry("spokeLocations", &self.spoke_locations)?;
13968        }
13969        if !wkt::internal::is_default(&self.page_size) {
13970            struct __With<'a>(&'a i32);
13971            impl<'a> serde::ser::Serialize for __With<'a> {
13972                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13973                where
13974                    S: serde::ser::Serializer,
13975                {
13976                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
13977                }
13978            }
13979            state.serialize_entry("pageSize", &__With(&self.page_size))?;
13980        }
13981        if !self.page_token.is_empty() {
13982            state.serialize_entry("pageToken", &self.page_token)?;
13983        }
13984        if !self.filter.is_empty() {
13985            state.serialize_entry("filter", &self.filter)?;
13986        }
13987        if !self.order_by.is_empty() {
13988            state.serialize_entry("orderBy", &self.order_by)?;
13989        }
13990        if !wkt::internal::is_default(&self.view) {
13991            state.serialize_entry("view", &self.view)?;
13992        }
13993        if !self._unknown_fields.is_empty() {
13994            for (key, value) in self._unknown_fields.iter() {
13995                state.serialize_entry(key, &value)?;
13996            }
13997        }
13998        state.end()
13999    }
14000}
14001
14002/// Defines additional types related to [ListHubSpokesRequest].
14003pub mod list_hub_spokes_request {
14004    #[allow(unused_imports)]
14005    use super::*;
14006
14007    /// Enum that controls which spoke fields are included in the response.
14008    ///
14009    /// # Working with unknown values
14010    ///
14011    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14012    /// additional enum variants at any time. Adding new variants is not considered
14013    /// a breaking change. Applications should write their code in anticipation of:
14014    ///
14015    /// - New values appearing in future releases of the client library, **and**
14016    /// - New values received dynamically, without application changes.
14017    ///
14018    /// Please consult the [Working with enums] section in the user guide for some
14019    /// guidelines.
14020    ///
14021    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14022    #[derive(Clone, Debug, PartialEq)]
14023    #[non_exhaustive]
14024    pub enum SpokeView {
14025        /// The spoke view is unspecified. When the spoke view is unspecified, the
14026        /// API returns the same fields as the `BASIC` view.
14027        Unspecified,
14028        /// Includes `name`, `create_time`, `hub`, `unique_id`, `state`, `reasons`,
14029        /// and `spoke_type`. This is the default value.
14030        Basic,
14031        /// Includes all spoke fields except `labels`.
14032        /// You can use the `DETAILED` view only when you set the `spoke_locations`
14033        /// field to `[global]`.
14034        Detailed,
14035        /// If set, the enum was initialized with an unknown value.
14036        ///
14037        /// Applications can examine the value using [SpokeView::value] or
14038        /// [SpokeView::name].
14039        UnknownValue(spoke_view::UnknownValue),
14040    }
14041
14042    #[doc(hidden)]
14043    pub mod spoke_view {
14044        #[allow(unused_imports)]
14045        use super::*;
14046        #[derive(Clone, Debug, PartialEq)]
14047        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14048    }
14049
14050    impl SpokeView {
14051        /// Gets the enum value.
14052        ///
14053        /// Returns `None` if the enum contains an unknown value deserialized from
14054        /// the string representation of enums.
14055        pub fn value(&self) -> std::option::Option<i32> {
14056            match self {
14057                Self::Unspecified => std::option::Option::Some(0),
14058                Self::Basic => std::option::Option::Some(1),
14059                Self::Detailed => std::option::Option::Some(2),
14060                Self::UnknownValue(u) => u.0.value(),
14061            }
14062        }
14063
14064        /// Gets the enum value as a string.
14065        ///
14066        /// Returns `None` if the enum contains an unknown value deserialized from
14067        /// the integer representation of enums.
14068        pub fn name(&self) -> std::option::Option<&str> {
14069            match self {
14070                Self::Unspecified => std::option::Option::Some("SPOKE_VIEW_UNSPECIFIED"),
14071                Self::Basic => std::option::Option::Some("BASIC"),
14072                Self::Detailed => std::option::Option::Some("DETAILED"),
14073                Self::UnknownValue(u) => u.0.name(),
14074            }
14075        }
14076    }
14077
14078    impl std::default::Default for SpokeView {
14079        fn default() -> Self {
14080            use std::convert::From;
14081            Self::from(0)
14082        }
14083    }
14084
14085    impl std::fmt::Display for SpokeView {
14086        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14087            wkt::internal::display_enum(f, self.name(), self.value())
14088        }
14089    }
14090
14091    impl std::convert::From<i32> for SpokeView {
14092        fn from(value: i32) -> Self {
14093            match value {
14094                0 => Self::Unspecified,
14095                1 => Self::Basic,
14096                2 => Self::Detailed,
14097                _ => Self::UnknownValue(spoke_view::UnknownValue(
14098                    wkt::internal::UnknownEnumValue::Integer(value),
14099                )),
14100            }
14101        }
14102    }
14103
14104    impl std::convert::From<&str> for SpokeView {
14105        fn from(value: &str) -> Self {
14106            use std::string::ToString;
14107            match value {
14108                "SPOKE_VIEW_UNSPECIFIED" => Self::Unspecified,
14109                "BASIC" => Self::Basic,
14110                "DETAILED" => Self::Detailed,
14111                _ => Self::UnknownValue(spoke_view::UnknownValue(
14112                    wkt::internal::UnknownEnumValue::String(value.to_string()),
14113                )),
14114            }
14115        }
14116    }
14117
14118    impl serde::ser::Serialize for SpokeView {
14119        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14120        where
14121            S: serde::Serializer,
14122        {
14123            match self {
14124                Self::Unspecified => serializer.serialize_i32(0),
14125                Self::Basic => serializer.serialize_i32(1),
14126                Self::Detailed => serializer.serialize_i32(2),
14127                Self::UnknownValue(u) => u.0.serialize(serializer),
14128            }
14129        }
14130    }
14131
14132    impl<'de> serde::de::Deserialize<'de> for SpokeView {
14133        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14134        where
14135            D: serde::Deserializer<'de>,
14136        {
14137            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SpokeView>::new(
14138                ".google.cloud.networkconnectivity.v1.ListHubSpokesRequest.SpokeView",
14139            ))
14140        }
14141    }
14142}
14143
14144/// The response for
14145/// [HubService.ListHubSpokes][google.cloud.networkconnectivity.v1.HubService.ListHubSpokes].
14146///
14147/// [google.cloud.networkconnectivity.v1.HubService.ListHubSpokes]: crate::client::HubService::list_hub_spokes
14148#[derive(Clone, Debug, Default, PartialEq)]
14149#[non_exhaustive]
14150pub struct ListHubSpokesResponse {
14151    /// The requested spokes.
14152    /// The spoke fields can be partially populated based on the `view` field in
14153    /// the request message.
14154    pub spokes: std::vec::Vec<crate::model::Spoke>,
14155
14156    /// The token for the next page of the response. To see more results,
14157    /// use this value as the page_token for your next request. If this value
14158    /// is empty, there are no more results.
14159    pub next_page_token: std::string::String,
14160
14161    /// Locations that could not be reached.
14162    pub unreachable: std::vec::Vec<std::string::String>,
14163
14164    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14165}
14166
14167impl ListHubSpokesResponse {
14168    pub fn new() -> Self {
14169        std::default::Default::default()
14170    }
14171
14172    /// Sets the value of [spokes][crate::model::ListHubSpokesResponse::spokes].
14173    pub fn set_spokes<T, V>(mut self, v: T) -> Self
14174    where
14175        T: std::iter::IntoIterator<Item = V>,
14176        V: std::convert::Into<crate::model::Spoke>,
14177    {
14178        use std::iter::Iterator;
14179        self.spokes = v.into_iter().map(|i| i.into()).collect();
14180        self
14181    }
14182
14183    /// Sets the value of [next_page_token][crate::model::ListHubSpokesResponse::next_page_token].
14184    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14185        self.next_page_token = v.into();
14186        self
14187    }
14188
14189    /// Sets the value of [unreachable][crate::model::ListHubSpokesResponse::unreachable].
14190    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
14191    where
14192        T: std::iter::IntoIterator<Item = V>,
14193        V: std::convert::Into<std::string::String>,
14194    {
14195        use std::iter::Iterator;
14196        self.unreachable = v.into_iter().map(|i| i.into()).collect();
14197        self
14198    }
14199}
14200
14201impl wkt::message::Message for ListHubSpokesResponse {
14202    fn typename() -> &'static str {
14203        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListHubSpokesResponse"
14204    }
14205}
14206
14207#[doc(hidden)]
14208impl gax::paginator::internal::PageableResponse for ListHubSpokesResponse {
14209    type PageItem = crate::model::Spoke;
14210
14211    fn items(self) -> std::vec::Vec<Self::PageItem> {
14212        self.spokes
14213    }
14214
14215    fn next_page_token(&self) -> std::string::String {
14216        use std::clone::Clone;
14217        self.next_page_token.clone()
14218    }
14219}
14220
14221#[doc(hidden)]
14222impl<'de> serde::de::Deserialize<'de> for ListHubSpokesResponse {
14223    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14224    where
14225        D: serde::Deserializer<'de>,
14226    {
14227        #[allow(non_camel_case_types)]
14228        #[doc(hidden)]
14229        #[derive(PartialEq, Eq, Hash)]
14230        enum __FieldTag {
14231            __spokes,
14232            __next_page_token,
14233            __unreachable,
14234            Unknown(std::string::String),
14235        }
14236        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14237            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14238            where
14239                D: serde::Deserializer<'de>,
14240            {
14241                struct Visitor;
14242                impl<'de> serde::de::Visitor<'de> for Visitor {
14243                    type Value = __FieldTag;
14244                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14245                        formatter.write_str("a field name for ListHubSpokesResponse")
14246                    }
14247                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14248                    where
14249                        E: serde::de::Error,
14250                    {
14251                        use std::result::Result::Ok;
14252                        use std::string::ToString;
14253                        match value {
14254                            "spokes" => Ok(__FieldTag::__spokes),
14255                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
14256                            "next_page_token" => Ok(__FieldTag::__next_page_token),
14257                            "unreachable" => Ok(__FieldTag::__unreachable),
14258                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14259                        }
14260                    }
14261                }
14262                deserializer.deserialize_identifier(Visitor)
14263            }
14264        }
14265        struct Visitor;
14266        impl<'de> serde::de::Visitor<'de> for Visitor {
14267            type Value = ListHubSpokesResponse;
14268            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14269                formatter.write_str("struct ListHubSpokesResponse")
14270            }
14271            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14272            where
14273                A: serde::de::MapAccess<'de>,
14274            {
14275                #[allow(unused_imports)]
14276                use serde::de::Error;
14277                use std::option::Option::Some;
14278                let mut fields = std::collections::HashSet::new();
14279                let mut result = Self::Value::new();
14280                while let Some(tag) = map.next_key::<__FieldTag>()? {
14281                    #[allow(clippy::match_single_binding)]
14282                    match tag {
14283                        __FieldTag::__spokes => {
14284                            if !fields.insert(__FieldTag::__spokes) {
14285                                return std::result::Result::Err(A::Error::duplicate_field(
14286                                    "multiple values for spokes",
14287                                ));
14288                            }
14289                            result.spokes = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Spoke>>>()?.unwrap_or_default();
14290                        }
14291                        __FieldTag::__next_page_token => {
14292                            if !fields.insert(__FieldTag::__next_page_token) {
14293                                return std::result::Result::Err(A::Error::duplicate_field(
14294                                    "multiple values for next_page_token",
14295                                ));
14296                            }
14297                            result.next_page_token = map
14298                                .next_value::<std::option::Option<std::string::String>>()?
14299                                .unwrap_or_default();
14300                        }
14301                        __FieldTag::__unreachable => {
14302                            if !fields.insert(__FieldTag::__unreachable) {
14303                                return std::result::Result::Err(A::Error::duplicate_field(
14304                                    "multiple values for unreachable",
14305                                ));
14306                            }
14307                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
14308                        }
14309                        __FieldTag::Unknown(key) => {
14310                            let value = map.next_value::<serde_json::Value>()?;
14311                            result._unknown_fields.insert(key, value);
14312                        }
14313                    }
14314                }
14315                std::result::Result::Ok(result)
14316            }
14317        }
14318        deserializer.deserialize_any(Visitor)
14319    }
14320}
14321
14322#[doc(hidden)]
14323impl serde::ser::Serialize for ListHubSpokesResponse {
14324    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14325    where
14326        S: serde::ser::Serializer,
14327    {
14328        use serde::ser::SerializeMap;
14329        #[allow(unused_imports)]
14330        use std::option::Option::Some;
14331        let mut state = serializer.serialize_map(std::option::Option::None)?;
14332        if !self.spokes.is_empty() {
14333            state.serialize_entry("spokes", &self.spokes)?;
14334        }
14335        if !self.next_page_token.is_empty() {
14336            state.serialize_entry("nextPageToken", &self.next_page_token)?;
14337        }
14338        if !self.unreachable.is_empty() {
14339            state.serialize_entry("unreachable", &self.unreachable)?;
14340        }
14341        if !self._unknown_fields.is_empty() {
14342            for (key, value) in self._unknown_fields.iter() {
14343                state.serialize_entry(key, &value)?;
14344            }
14345        }
14346        state.end()
14347    }
14348}
14349
14350/// The request for
14351/// [HubService.QueryHubStatus][google.cloud.networkconnectivity.v1.HubService.QueryHubStatus].
14352///
14353/// [google.cloud.networkconnectivity.v1.HubService.QueryHubStatus]: crate::client::HubService::query_hub_status
14354#[derive(Clone, Debug, Default, PartialEq)]
14355#[non_exhaustive]
14356pub struct QueryHubStatusRequest {
14357    /// Required. The name of the hub.
14358    pub name: std::string::String,
14359
14360    /// Optional. The maximum number of results to return per page.
14361    pub page_size: i32,
14362
14363    /// Optional. The page token.
14364    pub page_token: std::string::String,
14365
14366    /// Optional. An expression that filters the list of results.
14367    /// The filter can be used to filter the results by the following fields:
14368    ///
14369    /// * `psc_propagation_status.source_spoke`
14370    /// * `psc_propagation_status.source_group`
14371    /// * `psc_propagation_status.source_forwarding_rule`
14372    /// * `psc_propagation_status.target_spoke`
14373    /// * `psc_propagation_status.target_group`
14374    /// * `psc_propagation_status.code`
14375    /// * `psc_propagation_status.message`
14376    pub filter: std::string::String,
14377
14378    /// Optional. Sort the results in ascending order by the specified fields.
14379    /// A comma-separated list of any of these fields:
14380    ///
14381    /// * `psc_propagation_status.source_spoke`
14382    /// * `psc_propagation_status.source_group`
14383    /// * `psc_propagation_status.source_forwarding_rule`
14384    /// * `psc_propagation_status.target_spoke`
14385    /// * `psc_propagation_status.target_group`
14386    /// * `psc_propagation_status.code`
14387    ///   If `group_by` is set, the value of the `order_by` field must be the
14388    ///   same as or a subset of the `group_by` field.
14389    pub order_by: std::string::String,
14390
14391    /// Optional. Aggregate the results by the specified fields.
14392    /// A comma-separated list of any of these fields:
14393    ///
14394    /// * `psc_propagation_status.source_spoke`
14395    /// * `psc_propagation_status.source_group`
14396    /// * `psc_propagation_status.source_forwarding_rule`
14397    /// * `psc_propagation_status.target_spoke`
14398    /// * `psc_propagation_status.target_group`
14399    /// * `psc_propagation_status.code`
14400    pub group_by: std::string::String,
14401
14402    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14403}
14404
14405impl QueryHubStatusRequest {
14406    pub fn new() -> Self {
14407        std::default::Default::default()
14408    }
14409
14410    /// Sets the value of [name][crate::model::QueryHubStatusRequest::name].
14411    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14412        self.name = v.into();
14413        self
14414    }
14415
14416    /// Sets the value of [page_size][crate::model::QueryHubStatusRequest::page_size].
14417    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14418        self.page_size = v.into();
14419        self
14420    }
14421
14422    /// Sets the value of [page_token][crate::model::QueryHubStatusRequest::page_token].
14423    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14424        self.page_token = v.into();
14425        self
14426    }
14427
14428    /// Sets the value of [filter][crate::model::QueryHubStatusRequest::filter].
14429    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14430        self.filter = v.into();
14431        self
14432    }
14433
14434    /// Sets the value of [order_by][crate::model::QueryHubStatusRequest::order_by].
14435    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14436        self.order_by = v.into();
14437        self
14438    }
14439
14440    /// Sets the value of [group_by][crate::model::QueryHubStatusRequest::group_by].
14441    pub fn set_group_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14442        self.group_by = v.into();
14443        self
14444    }
14445}
14446
14447impl wkt::message::Message for QueryHubStatusRequest {
14448    fn typename() -> &'static str {
14449        "type.googleapis.com/google.cloud.networkconnectivity.v1.QueryHubStatusRequest"
14450    }
14451}
14452
14453#[doc(hidden)]
14454impl<'de> serde::de::Deserialize<'de> for QueryHubStatusRequest {
14455    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14456    where
14457        D: serde::Deserializer<'de>,
14458    {
14459        #[allow(non_camel_case_types)]
14460        #[doc(hidden)]
14461        #[derive(PartialEq, Eq, Hash)]
14462        enum __FieldTag {
14463            __name,
14464            __page_size,
14465            __page_token,
14466            __filter,
14467            __order_by,
14468            __group_by,
14469            Unknown(std::string::String),
14470        }
14471        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14472            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14473            where
14474                D: serde::Deserializer<'de>,
14475            {
14476                struct Visitor;
14477                impl<'de> serde::de::Visitor<'de> for Visitor {
14478                    type Value = __FieldTag;
14479                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14480                        formatter.write_str("a field name for QueryHubStatusRequest")
14481                    }
14482                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14483                    where
14484                        E: serde::de::Error,
14485                    {
14486                        use std::result::Result::Ok;
14487                        use std::string::ToString;
14488                        match value {
14489                            "name" => Ok(__FieldTag::__name),
14490                            "pageSize" => Ok(__FieldTag::__page_size),
14491                            "page_size" => Ok(__FieldTag::__page_size),
14492                            "pageToken" => Ok(__FieldTag::__page_token),
14493                            "page_token" => Ok(__FieldTag::__page_token),
14494                            "filter" => Ok(__FieldTag::__filter),
14495                            "orderBy" => Ok(__FieldTag::__order_by),
14496                            "order_by" => Ok(__FieldTag::__order_by),
14497                            "groupBy" => Ok(__FieldTag::__group_by),
14498                            "group_by" => Ok(__FieldTag::__group_by),
14499                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14500                        }
14501                    }
14502                }
14503                deserializer.deserialize_identifier(Visitor)
14504            }
14505        }
14506        struct Visitor;
14507        impl<'de> serde::de::Visitor<'de> for Visitor {
14508            type Value = QueryHubStatusRequest;
14509            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14510                formatter.write_str("struct QueryHubStatusRequest")
14511            }
14512            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14513            where
14514                A: serde::de::MapAccess<'de>,
14515            {
14516                #[allow(unused_imports)]
14517                use serde::de::Error;
14518                use std::option::Option::Some;
14519                let mut fields = std::collections::HashSet::new();
14520                let mut result = Self::Value::new();
14521                while let Some(tag) = map.next_key::<__FieldTag>()? {
14522                    #[allow(clippy::match_single_binding)]
14523                    match tag {
14524                        __FieldTag::__name => {
14525                            if !fields.insert(__FieldTag::__name) {
14526                                return std::result::Result::Err(A::Error::duplicate_field(
14527                                    "multiple values for name",
14528                                ));
14529                            }
14530                            result.name = map
14531                                .next_value::<std::option::Option<std::string::String>>()?
14532                                .unwrap_or_default();
14533                        }
14534                        __FieldTag::__page_size => {
14535                            if !fields.insert(__FieldTag::__page_size) {
14536                                return std::result::Result::Err(A::Error::duplicate_field(
14537                                    "multiple values for page_size",
14538                                ));
14539                            }
14540                            struct __With(std::option::Option<i32>);
14541                            impl<'de> serde::de::Deserialize<'de> for __With {
14542                                fn deserialize<D>(
14543                                    deserializer: D,
14544                                ) -> std::result::Result<Self, D::Error>
14545                                where
14546                                    D: serde::de::Deserializer<'de>,
14547                                {
14548                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
14549                                }
14550                            }
14551                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
14552                        }
14553                        __FieldTag::__page_token => {
14554                            if !fields.insert(__FieldTag::__page_token) {
14555                                return std::result::Result::Err(A::Error::duplicate_field(
14556                                    "multiple values for page_token",
14557                                ));
14558                            }
14559                            result.page_token = map
14560                                .next_value::<std::option::Option<std::string::String>>()?
14561                                .unwrap_or_default();
14562                        }
14563                        __FieldTag::__filter => {
14564                            if !fields.insert(__FieldTag::__filter) {
14565                                return std::result::Result::Err(A::Error::duplicate_field(
14566                                    "multiple values for filter",
14567                                ));
14568                            }
14569                            result.filter = map
14570                                .next_value::<std::option::Option<std::string::String>>()?
14571                                .unwrap_or_default();
14572                        }
14573                        __FieldTag::__order_by => {
14574                            if !fields.insert(__FieldTag::__order_by) {
14575                                return std::result::Result::Err(A::Error::duplicate_field(
14576                                    "multiple values for order_by",
14577                                ));
14578                            }
14579                            result.order_by = map
14580                                .next_value::<std::option::Option<std::string::String>>()?
14581                                .unwrap_or_default();
14582                        }
14583                        __FieldTag::__group_by => {
14584                            if !fields.insert(__FieldTag::__group_by) {
14585                                return std::result::Result::Err(A::Error::duplicate_field(
14586                                    "multiple values for group_by",
14587                                ));
14588                            }
14589                            result.group_by = map
14590                                .next_value::<std::option::Option<std::string::String>>()?
14591                                .unwrap_or_default();
14592                        }
14593                        __FieldTag::Unknown(key) => {
14594                            let value = map.next_value::<serde_json::Value>()?;
14595                            result._unknown_fields.insert(key, value);
14596                        }
14597                    }
14598                }
14599                std::result::Result::Ok(result)
14600            }
14601        }
14602        deserializer.deserialize_any(Visitor)
14603    }
14604}
14605
14606#[doc(hidden)]
14607impl serde::ser::Serialize for QueryHubStatusRequest {
14608    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14609    where
14610        S: serde::ser::Serializer,
14611    {
14612        use serde::ser::SerializeMap;
14613        #[allow(unused_imports)]
14614        use std::option::Option::Some;
14615        let mut state = serializer.serialize_map(std::option::Option::None)?;
14616        if !self.name.is_empty() {
14617            state.serialize_entry("name", &self.name)?;
14618        }
14619        if !wkt::internal::is_default(&self.page_size) {
14620            struct __With<'a>(&'a i32);
14621            impl<'a> serde::ser::Serialize for __With<'a> {
14622                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14623                where
14624                    S: serde::ser::Serializer,
14625                {
14626                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
14627                }
14628            }
14629            state.serialize_entry("pageSize", &__With(&self.page_size))?;
14630        }
14631        if !self.page_token.is_empty() {
14632            state.serialize_entry("pageToken", &self.page_token)?;
14633        }
14634        if !self.filter.is_empty() {
14635            state.serialize_entry("filter", &self.filter)?;
14636        }
14637        if !self.order_by.is_empty() {
14638            state.serialize_entry("orderBy", &self.order_by)?;
14639        }
14640        if !self.group_by.is_empty() {
14641            state.serialize_entry("groupBy", &self.group_by)?;
14642        }
14643        if !self._unknown_fields.is_empty() {
14644            for (key, value) in self._unknown_fields.iter() {
14645                state.serialize_entry(key, &value)?;
14646            }
14647        }
14648        state.end()
14649    }
14650}
14651
14652/// The response for
14653/// [HubService.QueryHubStatus][google.cloud.networkconnectivity.v1.HubService.QueryHubStatus].
14654///
14655/// [google.cloud.networkconnectivity.v1.HubService.QueryHubStatus]: crate::client::HubService::query_hub_status
14656#[derive(Clone, Debug, Default, PartialEq)]
14657#[non_exhaustive]
14658pub struct QueryHubStatusResponse {
14659    /// The list of hub status.
14660    pub hub_status_entries: std::vec::Vec<crate::model::HubStatusEntry>,
14661
14662    /// The token for the next page of the response. To see more results,
14663    /// use this value as the page_token for your next request. If this value
14664    /// is empty, there are no more results.
14665    pub next_page_token: std::string::String,
14666
14667    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14668}
14669
14670impl QueryHubStatusResponse {
14671    pub fn new() -> Self {
14672        std::default::Default::default()
14673    }
14674
14675    /// Sets the value of [hub_status_entries][crate::model::QueryHubStatusResponse::hub_status_entries].
14676    pub fn set_hub_status_entries<T, V>(mut self, v: T) -> Self
14677    where
14678        T: std::iter::IntoIterator<Item = V>,
14679        V: std::convert::Into<crate::model::HubStatusEntry>,
14680    {
14681        use std::iter::Iterator;
14682        self.hub_status_entries = v.into_iter().map(|i| i.into()).collect();
14683        self
14684    }
14685
14686    /// Sets the value of [next_page_token][crate::model::QueryHubStatusResponse::next_page_token].
14687    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14688        self.next_page_token = v.into();
14689        self
14690    }
14691}
14692
14693impl wkt::message::Message for QueryHubStatusResponse {
14694    fn typename() -> &'static str {
14695        "type.googleapis.com/google.cloud.networkconnectivity.v1.QueryHubStatusResponse"
14696    }
14697}
14698
14699#[doc(hidden)]
14700impl gax::paginator::internal::PageableResponse for QueryHubStatusResponse {
14701    type PageItem = crate::model::HubStatusEntry;
14702
14703    fn items(self) -> std::vec::Vec<Self::PageItem> {
14704        self.hub_status_entries
14705    }
14706
14707    fn next_page_token(&self) -> std::string::String {
14708        use std::clone::Clone;
14709        self.next_page_token.clone()
14710    }
14711}
14712
14713#[doc(hidden)]
14714impl<'de> serde::de::Deserialize<'de> for QueryHubStatusResponse {
14715    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14716    where
14717        D: serde::Deserializer<'de>,
14718    {
14719        #[allow(non_camel_case_types)]
14720        #[doc(hidden)]
14721        #[derive(PartialEq, Eq, Hash)]
14722        enum __FieldTag {
14723            __hub_status_entries,
14724            __next_page_token,
14725            Unknown(std::string::String),
14726        }
14727        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14728            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14729            where
14730                D: serde::Deserializer<'de>,
14731            {
14732                struct Visitor;
14733                impl<'de> serde::de::Visitor<'de> for Visitor {
14734                    type Value = __FieldTag;
14735                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14736                        formatter.write_str("a field name for QueryHubStatusResponse")
14737                    }
14738                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14739                    where
14740                        E: serde::de::Error,
14741                    {
14742                        use std::result::Result::Ok;
14743                        use std::string::ToString;
14744                        match value {
14745                            "hubStatusEntries" => Ok(__FieldTag::__hub_status_entries),
14746                            "hub_status_entries" => Ok(__FieldTag::__hub_status_entries),
14747                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
14748                            "next_page_token" => Ok(__FieldTag::__next_page_token),
14749                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14750                        }
14751                    }
14752                }
14753                deserializer.deserialize_identifier(Visitor)
14754            }
14755        }
14756        struct Visitor;
14757        impl<'de> serde::de::Visitor<'de> for Visitor {
14758            type Value = QueryHubStatusResponse;
14759            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14760                formatter.write_str("struct QueryHubStatusResponse")
14761            }
14762            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14763            where
14764                A: serde::de::MapAccess<'de>,
14765            {
14766                #[allow(unused_imports)]
14767                use serde::de::Error;
14768                use std::option::Option::Some;
14769                let mut fields = std::collections::HashSet::new();
14770                let mut result = Self::Value::new();
14771                while let Some(tag) = map.next_key::<__FieldTag>()? {
14772                    #[allow(clippy::match_single_binding)]
14773                    match tag {
14774                        __FieldTag::__hub_status_entries => {
14775                            if !fields.insert(__FieldTag::__hub_status_entries) {
14776                                return std::result::Result::Err(A::Error::duplicate_field(
14777                                    "multiple values for hub_status_entries",
14778                                ));
14779                            }
14780                            result.hub_status_entries =
14781                                map.next_value::<std::option::Option<
14782                                    std::vec::Vec<crate::model::HubStatusEntry>,
14783                                >>()?
14784                                .unwrap_or_default();
14785                        }
14786                        __FieldTag::__next_page_token => {
14787                            if !fields.insert(__FieldTag::__next_page_token) {
14788                                return std::result::Result::Err(A::Error::duplicate_field(
14789                                    "multiple values for next_page_token",
14790                                ));
14791                            }
14792                            result.next_page_token = map
14793                                .next_value::<std::option::Option<std::string::String>>()?
14794                                .unwrap_or_default();
14795                        }
14796                        __FieldTag::Unknown(key) => {
14797                            let value = map.next_value::<serde_json::Value>()?;
14798                            result._unknown_fields.insert(key, value);
14799                        }
14800                    }
14801                }
14802                std::result::Result::Ok(result)
14803            }
14804        }
14805        deserializer.deserialize_any(Visitor)
14806    }
14807}
14808
14809#[doc(hidden)]
14810impl serde::ser::Serialize for QueryHubStatusResponse {
14811    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14812    where
14813        S: serde::ser::Serializer,
14814    {
14815        use serde::ser::SerializeMap;
14816        #[allow(unused_imports)]
14817        use std::option::Option::Some;
14818        let mut state = serializer.serialize_map(std::option::Option::None)?;
14819        if !self.hub_status_entries.is_empty() {
14820            state.serialize_entry("hubStatusEntries", &self.hub_status_entries)?;
14821        }
14822        if !self.next_page_token.is_empty() {
14823            state.serialize_entry("nextPageToken", &self.next_page_token)?;
14824        }
14825        if !self._unknown_fields.is_empty() {
14826            for (key, value) in self._unknown_fields.iter() {
14827                state.serialize_entry(key, &value)?;
14828            }
14829        }
14830        state.end()
14831    }
14832}
14833
14834/// A hub status entry represents the status of a set of propagated Private
14835/// Service Connect connections grouped by certain fields.
14836#[derive(Clone, Debug, Default, PartialEq)]
14837#[non_exhaustive]
14838pub struct HubStatusEntry {
14839    /// The number of propagated Private Service Connect connections with this
14840    /// status. If the `group_by` field was not set in the request message, the
14841    /// value of this field is 1.
14842    pub count: i32,
14843
14844    /// The fields that this entry is grouped by. This has the same value as the
14845    /// `group_by` field in the request message.
14846    pub group_by: std::string::String,
14847
14848    /// The Private Service Connect propagation status.
14849    pub psc_propagation_status: std::option::Option<crate::model::PscPropagationStatus>,
14850
14851    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14852}
14853
14854impl HubStatusEntry {
14855    pub fn new() -> Self {
14856        std::default::Default::default()
14857    }
14858
14859    /// Sets the value of [count][crate::model::HubStatusEntry::count].
14860    pub fn set_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14861        self.count = v.into();
14862        self
14863    }
14864
14865    /// Sets the value of [group_by][crate::model::HubStatusEntry::group_by].
14866    pub fn set_group_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14867        self.group_by = v.into();
14868        self
14869    }
14870
14871    /// Sets the value of [psc_propagation_status][crate::model::HubStatusEntry::psc_propagation_status].
14872    pub fn set_psc_propagation_status<T>(mut self, v: T) -> Self
14873    where
14874        T: std::convert::Into<crate::model::PscPropagationStatus>,
14875    {
14876        self.psc_propagation_status = std::option::Option::Some(v.into());
14877        self
14878    }
14879
14880    /// Sets or clears the value of [psc_propagation_status][crate::model::HubStatusEntry::psc_propagation_status].
14881    pub fn set_or_clear_psc_propagation_status<T>(mut self, v: std::option::Option<T>) -> Self
14882    where
14883        T: std::convert::Into<crate::model::PscPropagationStatus>,
14884    {
14885        self.psc_propagation_status = v.map(|x| x.into());
14886        self
14887    }
14888}
14889
14890impl wkt::message::Message for HubStatusEntry {
14891    fn typename() -> &'static str {
14892        "type.googleapis.com/google.cloud.networkconnectivity.v1.HubStatusEntry"
14893    }
14894}
14895
14896#[doc(hidden)]
14897impl<'de> serde::de::Deserialize<'de> for HubStatusEntry {
14898    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14899    where
14900        D: serde::Deserializer<'de>,
14901    {
14902        #[allow(non_camel_case_types)]
14903        #[doc(hidden)]
14904        #[derive(PartialEq, Eq, Hash)]
14905        enum __FieldTag {
14906            __count,
14907            __group_by,
14908            __psc_propagation_status,
14909            Unknown(std::string::String),
14910        }
14911        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14912            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14913            where
14914                D: serde::Deserializer<'de>,
14915            {
14916                struct Visitor;
14917                impl<'de> serde::de::Visitor<'de> for Visitor {
14918                    type Value = __FieldTag;
14919                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14920                        formatter.write_str("a field name for HubStatusEntry")
14921                    }
14922                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14923                    where
14924                        E: serde::de::Error,
14925                    {
14926                        use std::result::Result::Ok;
14927                        use std::string::ToString;
14928                        match value {
14929                            "count" => Ok(__FieldTag::__count),
14930                            "groupBy" => Ok(__FieldTag::__group_by),
14931                            "group_by" => Ok(__FieldTag::__group_by),
14932                            "pscPropagationStatus" => Ok(__FieldTag::__psc_propagation_status),
14933                            "psc_propagation_status" => Ok(__FieldTag::__psc_propagation_status),
14934                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14935                        }
14936                    }
14937                }
14938                deserializer.deserialize_identifier(Visitor)
14939            }
14940        }
14941        struct Visitor;
14942        impl<'de> serde::de::Visitor<'de> for Visitor {
14943            type Value = HubStatusEntry;
14944            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14945                formatter.write_str("struct HubStatusEntry")
14946            }
14947            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14948            where
14949                A: serde::de::MapAccess<'de>,
14950            {
14951                #[allow(unused_imports)]
14952                use serde::de::Error;
14953                use std::option::Option::Some;
14954                let mut fields = std::collections::HashSet::new();
14955                let mut result = Self::Value::new();
14956                while let Some(tag) = map.next_key::<__FieldTag>()? {
14957                    #[allow(clippy::match_single_binding)]
14958                    match tag {
14959                        __FieldTag::__count => {
14960                            if !fields.insert(__FieldTag::__count) {
14961                                return std::result::Result::Err(A::Error::duplicate_field(
14962                                    "multiple values for count",
14963                                ));
14964                            }
14965                            struct __With(std::option::Option<i32>);
14966                            impl<'de> serde::de::Deserialize<'de> for __With {
14967                                fn deserialize<D>(
14968                                    deserializer: D,
14969                                ) -> std::result::Result<Self, D::Error>
14970                                where
14971                                    D: serde::de::Deserializer<'de>,
14972                                {
14973                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
14974                                }
14975                            }
14976                            result.count = map.next_value::<__With>()?.0.unwrap_or_default();
14977                        }
14978                        __FieldTag::__group_by => {
14979                            if !fields.insert(__FieldTag::__group_by) {
14980                                return std::result::Result::Err(A::Error::duplicate_field(
14981                                    "multiple values for group_by",
14982                                ));
14983                            }
14984                            result.group_by = map
14985                                .next_value::<std::option::Option<std::string::String>>()?
14986                                .unwrap_or_default();
14987                        }
14988                        __FieldTag::__psc_propagation_status => {
14989                            if !fields.insert(__FieldTag::__psc_propagation_status) {
14990                                return std::result::Result::Err(A::Error::duplicate_field(
14991                                    "multiple values for psc_propagation_status",
14992                                ));
14993                            }
14994                            result.psc_propagation_status = map.next_value::<std::option::Option<crate::model::PscPropagationStatus>>()?
14995                                ;
14996                        }
14997                        __FieldTag::Unknown(key) => {
14998                            let value = map.next_value::<serde_json::Value>()?;
14999                            result._unknown_fields.insert(key, value);
15000                        }
15001                    }
15002                }
15003                std::result::Result::Ok(result)
15004            }
15005        }
15006        deserializer.deserialize_any(Visitor)
15007    }
15008}
15009
15010#[doc(hidden)]
15011impl serde::ser::Serialize for HubStatusEntry {
15012    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15013    where
15014        S: serde::ser::Serializer,
15015    {
15016        use serde::ser::SerializeMap;
15017        #[allow(unused_imports)]
15018        use std::option::Option::Some;
15019        let mut state = serializer.serialize_map(std::option::Option::None)?;
15020        if !wkt::internal::is_default(&self.count) {
15021            struct __With<'a>(&'a i32);
15022            impl<'a> serde::ser::Serialize for __With<'a> {
15023                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15024                where
15025                    S: serde::ser::Serializer,
15026                {
15027                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
15028                }
15029            }
15030            state.serialize_entry("count", &__With(&self.count))?;
15031        }
15032        if !self.group_by.is_empty() {
15033            state.serialize_entry("groupBy", &self.group_by)?;
15034        }
15035        if self.psc_propagation_status.is_some() {
15036            state.serialize_entry("pscPropagationStatus", &self.psc_propagation_status)?;
15037        }
15038        if !self._unknown_fields.is_empty() {
15039            for (key, value) in self._unknown_fields.iter() {
15040                state.serialize_entry(key, &value)?;
15041            }
15042        }
15043        state.end()
15044    }
15045}
15046
15047/// The status of one or more propagated Private Service Connect connections in a
15048/// hub.
15049#[derive(Clone, Debug, Default, PartialEq)]
15050#[non_exhaustive]
15051pub struct PscPropagationStatus {
15052    /// The name of the spoke that the source forwarding rule belongs to.
15053    pub source_spoke: std::string::String,
15054
15055    /// The name of the group that the source spoke belongs to.
15056    pub source_group: std::string::String,
15057
15058    /// The name of the forwarding rule exported to the hub.
15059    pub source_forwarding_rule: std::string::String,
15060
15061    /// The name of the spoke that the source forwarding rule propagates to.
15062    pub target_spoke: std::string::String,
15063
15064    /// The name of the group that the target spoke belongs to.
15065    pub target_group: std::string::String,
15066
15067    /// The propagation status.
15068    pub code: crate::model::psc_propagation_status::Code,
15069
15070    /// The human-readable summary of the Private Service Connect connection
15071    /// propagation status.
15072    pub message: std::string::String,
15073
15074    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15075}
15076
15077impl PscPropagationStatus {
15078    pub fn new() -> Self {
15079        std::default::Default::default()
15080    }
15081
15082    /// Sets the value of [source_spoke][crate::model::PscPropagationStatus::source_spoke].
15083    pub fn set_source_spoke<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15084        self.source_spoke = v.into();
15085        self
15086    }
15087
15088    /// Sets the value of [source_group][crate::model::PscPropagationStatus::source_group].
15089    pub fn set_source_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15090        self.source_group = v.into();
15091        self
15092    }
15093
15094    /// Sets the value of [source_forwarding_rule][crate::model::PscPropagationStatus::source_forwarding_rule].
15095    pub fn set_source_forwarding_rule<T: std::convert::Into<std::string::String>>(
15096        mut self,
15097        v: T,
15098    ) -> Self {
15099        self.source_forwarding_rule = v.into();
15100        self
15101    }
15102
15103    /// Sets the value of [target_spoke][crate::model::PscPropagationStatus::target_spoke].
15104    pub fn set_target_spoke<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15105        self.target_spoke = v.into();
15106        self
15107    }
15108
15109    /// Sets the value of [target_group][crate::model::PscPropagationStatus::target_group].
15110    pub fn set_target_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15111        self.target_group = v.into();
15112        self
15113    }
15114
15115    /// Sets the value of [code][crate::model::PscPropagationStatus::code].
15116    pub fn set_code<T: std::convert::Into<crate::model::psc_propagation_status::Code>>(
15117        mut self,
15118        v: T,
15119    ) -> Self {
15120        self.code = v.into();
15121        self
15122    }
15123
15124    /// Sets the value of [message][crate::model::PscPropagationStatus::message].
15125    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15126        self.message = v.into();
15127        self
15128    }
15129}
15130
15131impl wkt::message::Message for PscPropagationStatus {
15132    fn typename() -> &'static str {
15133        "type.googleapis.com/google.cloud.networkconnectivity.v1.PscPropagationStatus"
15134    }
15135}
15136
15137#[doc(hidden)]
15138impl<'de> serde::de::Deserialize<'de> for PscPropagationStatus {
15139    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15140    where
15141        D: serde::Deserializer<'de>,
15142    {
15143        #[allow(non_camel_case_types)]
15144        #[doc(hidden)]
15145        #[derive(PartialEq, Eq, Hash)]
15146        enum __FieldTag {
15147            __source_spoke,
15148            __source_group,
15149            __source_forwarding_rule,
15150            __target_spoke,
15151            __target_group,
15152            __code,
15153            __message,
15154            Unknown(std::string::String),
15155        }
15156        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15157            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15158            where
15159                D: serde::Deserializer<'de>,
15160            {
15161                struct Visitor;
15162                impl<'de> serde::de::Visitor<'de> for Visitor {
15163                    type Value = __FieldTag;
15164                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15165                        formatter.write_str("a field name for PscPropagationStatus")
15166                    }
15167                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15168                    where
15169                        E: serde::de::Error,
15170                    {
15171                        use std::result::Result::Ok;
15172                        use std::string::ToString;
15173                        match value {
15174                            "sourceSpoke" => Ok(__FieldTag::__source_spoke),
15175                            "source_spoke" => Ok(__FieldTag::__source_spoke),
15176                            "sourceGroup" => Ok(__FieldTag::__source_group),
15177                            "source_group" => Ok(__FieldTag::__source_group),
15178                            "sourceForwardingRule" => Ok(__FieldTag::__source_forwarding_rule),
15179                            "source_forwarding_rule" => Ok(__FieldTag::__source_forwarding_rule),
15180                            "targetSpoke" => Ok(__FieldTag::__target_spoke),
15181                            "target_spoke" => Ok(__FieldTag::__target_spoke),
15182                            "targetGroup" => Ok(__FieldTag::__target_group),
15183                            "target_group" => Ok(__FieldTag::__target_group),
15184                            "code" => Ok(__FieldTag::__code),
15185                            "message" => Ok(__FieldTag::__message),
15186                            _ => Ok(__FieldTag::Unknown(value.to_string())),
15187                        }
15188                    }
15189                }
15190                deserializer.deserialize_identifier(Visitor)
15191            }
15192        }
15193        struct Visitor;
15194        impl<'de> serde::de::Visitor<'de> for Visitor {
15195            type Value = PscPropagationStatus;
15196            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15197                formatter.write_str("struct PscPropagationStatus")
15198            }
15199            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15200            where
15201                A: serde::de::MapAccess<'de>,
15202            {
15203                #[allow(unused_imports)]
15204                use serde::de::Error;
15205                use std::option::Option::Some;
15206                let mut fields = std::collections::HashSet::new();
15207                let mut result = Self::Value::new();
15208                while let Some(tag) = map.next_key::<__FieldTag>()? {
15209                    #[allow(clippy::match_single_binding)]
15210                    match tag {
15211                        __FieldTag::__source_spoke => {
15212                            if !fields.insert(__FieldTag::__source_spoke) {
15213                                return std::result::Result::Err(A::Error::duplicate_field(
15214                                    "multiple values for source_spoke",
15215                                ));
15216                            }
15217                            result.source_spoke = map
15218                                .next_value::<std::option::Option<std::string::String>>()?
15219                                .unwrap_or_default();
15220                        }
15221                        __FieldTag::__source_group => {
15222                            if !fields.insert(__FieldTag::__source_group) {
15223                                return std::result::Result::Err(A::Error::duplicate_field(
15224                                    "multiple values for source_group",
15225                                ));
15226                            }
15227                            result.source_group = map
15228                                .next_value::<std::option::Option<std::string::String>>()?
15229                                .unwrap_or_default();
15230                        }
15231                        __FieldTag::__source_forwarding_rule => {
15232                            if !fields.insert(__FieldTag::__source_forwarding_rule) {
15233                                return std::result::Result::Err(A::Error::duplicate_field(
15234                                    "multiple values for source_forwarding_rule",
15235                                ));
15236                            }
15237                            result.source_forwarding_rule = map
15238                                .next_value::<std::option::Option<std::string::String>>()?
15239                                .unwrap_or_default();
15240                        }
15241                        __FieldTag::__target_spoke => {
15242                            if !fields.insert(__FieldTag::__target_spoke) {
15243                                return std::result::Result::Err(A::Error::duplicate_field(
15244                                    "multiple values for target_spoke",
15245                                ));
15246                            }
15247                            result.target_spoke = map
15248                                .next_value::<std::option::Option<std::string::String>>()?
15249                                .unwrap_or_default();
15250                        }
15251                        __FieldTag::__target_group => {
15252                            if !fields.insert(__FieldTag::__target_group) {
15253                                return std::result::Result::Err(A::Error::duplicate_field(
15254                                    "multiple values for target_group",
15255                                ));
15256                            }
15257                            result.target_group = map
15258                                .next_value::<std::option::Option<std::string::String>>()?
15259                                .unwrap_or_default();
15260                        }
15261                        __FieldTag::__code => {
15262                            if !fields.insert(__FieldTag::__code) {
15263                                return std::result::Result::Err(A::Error::duplicate_field(
15264                                    "multiple values for code",
15265                                ));
15266                            }
15267                            result.code = map.next_value::<std::option::Option<crate::model::psc_propagation_status::Code>>()?.unwrap_or_default();
15268                        }
15269                        __FieldTag::__message => {
15270                            if !fields.insert(__FieldTag::__message) {
15271                                return std::result::Result::Err(A::Error::duplicate_field(
15272                                    "multiple values for message",
15273                                ));
15274                            }
15275                            result.message = map
15276                                .next_value::<std::option::Option<std::string::String>>()?
15277                                .unwrap_or_default();
15278                        }
15279                        __FieldTag::Unknown(key) => {
15280                            let value = map.next_value::<serde_json::Value>()?;
15281                            result._unknown_fields.insert(key, value);
15282                        }
15283                    }
15284                }
15285                std::result::Result::Ok(result)
15286            }
15287        }
15288        deserializer.deserialize_any(Visitor)
15289    }
15290}
15291
15292#[doc(hidden)]
15293impl serde::ser::Serialize for PscPropagationStatus {
15294    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15295    where
15296        S: serde::ser::Serializer,
15297    {
15298        use serde::ser::SerializeMap;
15299        #[allow(unused_imports)]
15300        use std::option::Option::Some;
15301        let mut state = serializer.serialize_map(std::option::Option::None)?;
15302        if !self.source_spoke.is_empty() {
15303            state.serialize_entry("sourceSpoke", &self.source_spoke)?;
15304        }
15305        if !self.source_group.is_empty() {
15306            state.serialize_entry("sourceGroup", &self.source_group)?;
15307        }
15308        if !self.source_forwarding_rule.is_empty() {
15309            state.serialize_entry("sourceForwardingRule", &self.source_forwarding_rule)?;
15310        }
15311        if !self.target_spoke.is_empty() {
15312            state.serialize_entry("targetSpoke", &self.target_spoke)?;
15313        }
15314        if !self.target_group.is_empty() {
15315            state.serialize_entry("targetGroup", &self.target_group)?;
15316        }
15317        if !wkt::internal::is_default(&self.code) {
15318            state.serialize_entry("code", &self.code)?;
15319        }
15320        if !self.message.is_empty() {
15321            state.serialize_entry("message", &self.message)?;
15322        }
15323        if !self._unknown_fields.is_empty() {
15324            for (key, value) in self._unknown_fields.iter() {
15325                state.serialize_entry(key, &value)?;
15326            }
15327        }
15328        state.end()
15329    }
15330}
15331
15332/// Defines additional types related to [PscPropagationStatus].
15333pub mod psc_propagation_status {
15334    #[allow(unused_imports)]
15335    use super::*;
15336
15337    /// The Code enum represents the state of the Private Service Connect
15338    /// propagation.
15339    ///
15340    /// # Working with unknown values
15341    ///
15342    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15343    /// additional enum variants at any time. Adding new variants is not considered
15344    /// a breaking change. Applications should write their code in anticipation of:
15345    ///
15346    /// - New values appearing in future releases of the client library, **and**
15347    /// - New values received dynamically, without application changes.
15348    ///
15349    /// Please consult the [Working with enums] section in the user guide for some
15350    /// guidelines.
15351    ///
15352    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
15353    #[derive(Clone, Debug, PartialEq)]
15354    #[non_exhaustive]
15355    pub enum Code {
15356        /// The code is unspecified.
15357        Unspecified,
15358        /// The propagated Private Service Connect connection is ready.
15359        Ready,
15360        /// The Private Service Connect connection is propagating. This is a
15361        /// transient state.
15362        Propagating,
15363        /// The Private Service Connect connection propagation failed because the VPC
15364        /// network or the project of the target spoke has exceeded the connection
15365        /// limit set by the producer.
15366        ErrorProducerPropagatedConnectionLimitExceeded,
15367        /// The Private Service Connect connection propagation failed because the NAT
15368        /// IP subnet space has been exhausted. It is equivalent to the `Needs
15369        /// attention` status of the Private Service Connect connection. See
15370        /// <https://cloud.google.com/vpc/docs/about-accessing-vpc-hosted-services-endpoints#connection-statuses>.
15371        ErrorProducerNatIpSpaceExhausted,
15372        /// The Private Service Connect connection propagation failed because the
15373        /// `PSC_ILB_CONSUMER_FORWARDING_RULES_PER_PRODUCER_NETWORK` quota in the
15374        /// producer VPC network has been exceeded.
15375        ErrorProducerQuotaExceeded,
15376        /// The Private Service Connect connection propagation failed because the
15377        /// `PSC_PROPAGATED_CONNECTIONS_PER_VPC_NETWORK` quota in the consumer
15378        /// VPC network has been exceeded.
15379        ErrorConsumerQuotaExceeded,
15380        /// If set, the enum was initialized with an unknown value.
15381        ///
15382        /// Applications can examine the value using [Code::value] or
15383        /// [Code::name].
15384        UnknownValue(code::UnknownValue),
15385    }
15386
15387    #[doc(hidden)]
15388    pub mod code {
15389        #[allow(unused_imports)]
15390        use super::*;
15391        #[derive(Clone, Debug, PartialEq)]
15392        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15393    }
15394
15395    impl Code {
15396        /// Gets the enum value.
15397        ///
15398        /// Returns `None` if the enum contains an unknown value deserialized from
15399        /// the string representation of enums.
15400        pub fn value(&self) -> std::option::Option<i32> {
15401            match self {
15402                Self::Unspecified => std::option::Option::Some(0),
15403                Self::Ready => std::option::Option::Some(1),
15404                Self::Propagating => std::option::Option::Some(2),
15405                Self::ErrorProducerPropagatedConnectionLimitExceeded => {
15406                    std::option::Option::Some(3)
15407                }
15408                Self::ErrorProducerNatIpSpaceExhausted => std::option::Option::Some(4),
15409                Self::ErrorProducerQuotaExceeded => std::option::Option::Some(5),
15410                Self::ErrorConsumerQuotaExceeded => std::option::Option::Some(6),
15411                Self::UnknownValue(u) => u.0.value(),
15412            }
15413        }
15414
15415        /// Gets the enum value as a string.
15416        ///
15417        /// Returns `None` if the enum contains an unknown value deserialized from
15418        /// the integer representation of enums.
15419        pub fn name(&self) -> std::option::Option<&str> {
15420            match self {
15421                Self::Unspecified => std::option::Option::Some("CODE_UNSPECIFIED"),
15422                Self::Ready => std::option::Option::Some("READY"),
15423                Self::Propagating => std::option::Option::Some("PROPAGATING"),
15424                Self::ErrorProducerPropagatedConnectionLimitExceeded => {
15425                    std::option::Option::Some("ERROR_PRODUCER_PROPAGATED_CONNECTION_LIMIT_EXCEEDED")
15426                }
15427                Self::ErrorProducerNatIpSpaceExhausted => {
15428                    std::option::Option::Some("ERROR_PRODUCER_NAT_IP_SPACE_EXHAUSTED")
15429                }
15430                Self::ErrorProducerQuotaExceeded => {
15431                    std::option::Option::Some("ERROR_PRODUCER_QUOTA_EXCEEDED")
15432                }
15433                Self::ErrorConsumerQuotaExceeded => {
15434                    std::option::Option::Some("ERROR_CONSUMER_QUOTA_EXCEEDED")
15435                }
15436                Self::UnknownValue(u) => u.0.name(),
15437            }
15438        }
15439    }
15440
15441    impl std::default::Default for Code {
15442        fn default() -> Self {
15443            use std::convert::From;
15444            Self::from(0)
15445        }
15446    }
15447
15448    impl std::fmt::Display for Code {
15449        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15450            wkt::internal::display_enum(f, self.name(), self.value())
15451        }
15452    }
15453
15454    impl std::convert::From<i32> for Code {
15455        fn from(value: i32) -> Self {
15456            match value {
15457                0 => Self::Unspecified,
15458                1 => Self::Ready,
15459                2 => Self::Propagating,
15460                3 => Self::ErrorProducerPropagatedConnectionLimitExceeded,
15461                4 => Self::ErrorProducerNatIpSpaceExhausted,
15462                5 => Self::ErrorProducerQuotaExceeded,
15463                6 => Self::ErrorConsumerQuotaExceeded,
15464                _ => Self::UnknownValue(code::UnknownValue(
15465                    wkt::internal::UnknownEnumValue::Integer(value),
15466                )),
15467            }
15468        }
15469    }
15470
15471    impl std::convert::From<&str> for Code {
15472        fn from(value: &str) -> Self {
15473            use std::string::ToString;
15474            match value {
15475                "CODE_UNSPECIFIED" => Self::Unspecified,
15476                "READY" => Self::Ready,
15477                "PROPAGATING" => Self::Propagating,
15478                "ERROR_PRODUCER_PROPAGATED_CONNECTION_LIMIT_EXCEEDED" => {
15479                    Self::ErrorProducerPropagatedConnectionLimitExceeded
15480                }
15481                "ERROR_PRODUCER_NAT_IP_SPACE_EXHAUSTED" => Self::ErrorProducerNatIpSpaceExhausted,
15482                "ERROR_PRODUCER_QUOTA_EXCEEDED" => Self::ErrorProducerQuotaExceeded,
15483                "ERROR_CONSUMER_QUOTA_EXCEEDED" => Self::ErrorConsumerQuotaExceeded,
15484                _ => Self::UnknownValue(code::UnknownValue(
15485                    wkt::internal::UnknownEnumValue::String(value.to_string()),
15486                )),
15487            }
15488        }
15489    }
15490
15491    impl serde::ser::Serialize for Code {
15492        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15493        where
15494            S: serde::Serializer,
15495        {
15496            match self {
15497                Self::Unspecified => serializer.serialize_i32(0),
15498                Self::Ready => serializer.serialize_i32(1),
15499                Self::Propagating => serializer.serialize_i32(2),
15500                Self::ErrorProducerPropagatedConnectionLimitExceeded => serializer.serialize_i32(3),
15501                Self::ErrorProducerNatIpSpaceExhausted => serializer.serialize_i32(4),
15502                Self::ErrorProducerQuotaExceeded => serializer.serialize_i32(5),
15503                Self::ErrorConsumerQuotaExceeded => serializer.serialize_i32(6),
15504                Self::UnknownValue(u) => u.0.serialize(serializer),
15505            }
15506        }
15507    }
15508
15509    impl<'de> serde::de::Deserialize<'de> for Code {
15510        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15511        where
15512            D: serde::Deserializer<'de>,
15513        {
15514            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Code>::new(
15515                ".google.cloud.networkconnectivity.v1.PscPropagationStatus.Code",
15516            ))
15517        }
15518    }
15519}
15520
15521/// The request for
15522/// [HubService.ListSpokes][google.cloud.networkconnectivity.v1.HubService.ListSpokes].
15523///
15524/// [google.cloud.networkconnectivity.v1.HubService.ListSpokes]: crate::client::HubService::list_spokes
15525#[derive(Clone, Debug, Default, PartialEq)]
15526#[non_exhaustive]
15527pub struct ListSpokesRequest {
15528    /// Required. The parent resource.
15529    pub parent: std::string::String,
15530
15531    /// The maximum number of results to return per page.
15532    pub page_size: i32,
15533
15534    /// The page token.
15535    pub page_token: std::string::String,
15536
15537    /// An expression that filters the list of results.
15538    pub filter: std::string::String,
15539
15540    /// Sort the results by a certain order.
15541    pub order_by: std::string::String,
15542
15543    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15544}
15545
15546impl ListSpokesRequest {
15547    pub fn new() -> Self {
15548        std::default::Default::default()
15549    }
15550
15551    /// Sets the value of [parent][crate::model::ListSpokesRequest::parent].
15552    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15553        self.parent = v.into();
15554        self
15555    }
15556
15557    /// Sets the value of [page_size][crate::model::ListSpokesRequest::page_size].
15558    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15559        self.page_size = v.into();
15560        self
15561    }
15562
15563    /// Sets the value of [page_token][crate::model::ListSpokesRequest::page_token].
15564    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15565        self.page_token = v.into();
15566        self
15567    }
15568
15569    /// Sets the value of [filter][crate::model::ListSpokesRequest::filter].
15570    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15571        self.filter = v.into();
15572        self
15573    }
15574
15575    /// Sets the value of [order_by][crate::model::ListSpokesRequest::order_by].
15576    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15577        self.order_by = v.into();
15578        self
15579    }
15580}
15581
15582impl wkt::message::Message for ListSpokesRequest {
15583    fn typename() -> &'static str {
15584        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListSpokesRequest"
15585    }
15586}
15587
15588#[doc(hidden)]
15589impl<'de> serde::de::Deserialize<'de> for ListSpokesRequest {
15590    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15591    where
15592        D: serde::Deserializer<'de>,
15593    {
15594        #[allow(non_camel_case_types)]
15595        #[doc(hidden)]
15596        #[derive(PartialEq, Eq, Hash)]
15597        enum __FieldTag {
15598            __parent,
15599            __page_size,
15600            __page_token,
15601            __filter,
15602            __order_by,
15603            Unknown(std::string::String),
15604        }
15605        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15606            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15607            where
15608                D: serde::Deserializer<'de>,
15609            {
15610                struct Visitor;
15611                impl<'de> serde::de::Visitor<'de> for Visitor {
15612                    type Value = __FieldTag;
15613                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15614                        formatter.write_str("a field name for ListSpokesRequest")
15615                    }
15616                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15617                    where
15618                        E: serde::de::Error,
15619                    {
15620                        use std::result::Result::Ok;
15621                        use std::string::ToString;
15622                        match value {
15623                            "parent" => Ok(__FieldTag::__parent),
15624                            "pageSize" => Ok(__FieldTag::__page_size),
15625                            "page_size" => Ok(__FieldTag::__page_size),
15626                            "pageToken" => Ok(__FieldTag::__page_token),
15627                            "page_token" => Ok(__FieldTag::__page_token),
15628                            "filter" => Ok(__FieldTag::__filter),
15629                            "orderBy" => Ok(__FieldTag::__order_by),
15630                            "order_by" => Ok(__FieldTag::__order_by),
15631                            _ => Ok(__FieldTag::Unknown(value.to_string())),
15632                        }
15633                    }
15634                }
15635                deserializer.deserialize_identifier(Visitor)
15636            }
15637        }
15638        struct Visitor;
15639        impl<'de> serde::de::Visitor<'de> for Visitor {
15640            type Value = ListSpokesRequest;
15641            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15642                formatter.write_str("struct ListSpokesRequest")
15643            }
15644            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15645            where
15646                A: serde::de::MapAccess<'de>,
15647            {
15648                #[allow(unused_imports)]
15649                use serde::de::Error;
15650                use std::option::Option::Some;
15651                let mut fields = std::collections::HashSet::new();
15652                let mut result = Self::Value::new();
15653                while let Some(tag) = map.next_key::<__FieldTag>()? {
15654                    #[allow(clippy::match_single_binding)]
15655                    match tag {
15656                        __FieldTag::__parent => {
15657                            if !fields.insert(__FieldTag::__parent) {
15658                                return std::result::Result::Err(A::Error::duplicate_field(
15659                                    "multiple values for parent",
15660                                ));
15661                            }
15662                            result.parent = map
15663                                .next_value::<std::option::Option<std::string::String>>()?
15664                                .unwrap_or_default();
15665                        }
15666                        __FieldTag::__page_size => {
15667                            if !fields.insert(__FieldTag::__page_size) {
15668                                return std::result::Result::Err(A::Error::duplicate_field(
15669                                    "multiple values for page_size",
15670                                ));
15671                            }
15672                            struct __With(std::option::Option<i32>);
15673                            impl<'de> serde::de::Deserialize<'de> for __With {
15674                                fn deserialize<D>(
15675                                    deserializer: D,
15676                                ) -> std::result::Result<Self, D::Error>
15677                                where
15678                                    D: serde::de::Deserializer<'de>,
15679                                {
15680                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
15681                                }
15682                            }
15683                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
15684                        }
15685                        __FieldTag::__page_token => {
15686                            if !fields.insert(__FieldTag::__page_token) {
15687                                return std::result::Result::Err(A::Error::duplicate_field(
15688                                    "multiple values for page_token",
15689                                ));
15690                            }
15691                            result.page_token = map
15692                                .next_value::<std::option::Option<std::string::String>>()?
15693                                .unwrap_or_default();
15694                        }
15695                        __FieldTag::__filter => {
15696                            if !fields.insert(__FieldTag::__filter) {
15697                                return std::result::Result::Err(A::Error::duplicate_field(
15698                                    "multiple values for filter",
15699                                ));
15700                            }
15701                            result.filter = map
15702                                .next_value::<std::option::Option<std::string::String>>()?
15703                                .unwrap_or_default();
15704                        }
15705                        __FieldTag::__order_by => {
15706                            if !fields.insert(__FieldTag::__order_by) {
15707                                return std::result::Result::Err(A::Error::duplicate_field(
15708                                    "multiple values for order_by",
15709                                ));
15710                            }
15711                            result.order_by = map
15712                                .next_value::<std::option::Option<std::string::String>>()?
15713                                .unwrap_or_default();
15714                        }
15715                        __FieldTag::Unknown(key) => {
15716                            let value = map.next_value::<serde_json::Value>()?;
15717                            result._unknown_fields.insert(key, value);
15718                        }
15719                    }
15720                }
15721                std::result::Result::Ok(result)
15722            }
15723        }
15724        deserializer.deserialize_any(Visitor)
15725    }
15726}
15727
15728#[doc(hidden)]
15729impl serde::ser::Serialize for ListSpokesRequest {
15730    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15731    where
15732        S: serde::ser::Serializer,
15733    {
15734        use serde::ser::SerializeMap;
15735        #[allow(unused_imports)]
15736        use std::option::Option::Some;
15737        let mut state = serializer.serialize_map(std::option::Option::None)?;
15738        if !self.parent.is_empty() {
15739            state.serialize_entry("parent", &self.parent)?;
15740        }
15741        if !wkt::internal::is_default(&self.page_size) {
15742            struct __With<'a>(&'a i32);
15743            impl<'a> serde::ser::Serialize for __With<'a> {
15744                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15745                where
15746                    S: serde::ser::Serializer,
15747                {
15748                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
15749                }
15750            }
15751            state.serialize_entry("pageSize", &__With(&self.page_size))?;
15752        }
15753        if !self.page_token.is_empty() {
15754            state.serialize_entry("pageToken", &self.page_token)?;
15755        }
15756        if !self.filter.is_empty() {
15757            state.serialize_entry("filter", &self.filter)?;
15758        }
15759        if !self.order_by.is_empty() {
15760            state.serialize_entry("orderBy", &self.order_by)?;
15761        }
15762        if !self._unknown_fields.is_empty() {
15763            for (key, value) in self._unknown_fields.iter() {
15764                state.serialize_entry(key, &value)?;
15765            }
15766        }
15767        state.end()
15768    }
15769}
15770
15771/// The response for
15772/// [HubService.ListSpokes][google.cloud.networkconnectivity.v1.HubService.ListSpokes].
15773///
15774/// [google.cloud.networkconnectivity.v1.HubService.ListSpokes]: crate::client::HubService::list_spokes
15775#[derive(Clone, Debug, Default, PartialEq)]
15776#[non_exhaustive]
15777pub struct ListSpokesResponse {
15778    /// The requested spokes.
15779    pub spokes: std::vec::Vec<crate::model::Spoke>,
15780
15781    /// The token for the next page of the response. To see more results,
15782    /// use this value as the page_token for your next request. If this value
15783    /// is empty, there are no more results.
15784    pub next_page_token: std::string::String,
15785
15786    /// Locations that could not be reached.
15787    pub unreachable: std::vec::Vec<std::string::String>,
15788
15789    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15790}
15791
15792impl ListSpokesResponse {
15793    pub fn new() -> Self {
15794        std::default::Default::default()
15795    }
15796
15797    /// Sets the value of [spokes][crate::model::ListSpokesResponse::spokes].
15798    pub fn set_spokes<T, V>(mut self, v: T) -> Self
15799    where
15800        T: std::iter::IntoIterator<Item = V>,
15801        V: std::convert::Into<crate::model::Spoke>,
15802    {
15803        use std::iter::Iterator;
15804        self.spokes = v.into_iter().map(|i| i.into()).collect();
15805        self
15806    }
15807
15808    /// Sets the value of [next_page_token][crate::model::ListSpokesResponse::next_page_token].
15809    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15810        self.next_page_token = v.into();
15811        self
15812    }
15813
15814    /// Sets the value of [unreachable][crate::model::ListSpokesResponse::unreachable].
15815    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
15816    where
15817        T: std::iter::IntoIterator<Item = V>,
15818        V: std::convert::Into<std::string::String>,
15819    {
15820        use std::iter::Iterator;
15821        self.unreachable = v.into_iter().map(|i| i.into()).collect();
15822        self
15823    }
15824}
15825
15826impl wkt::message::Message for ListSpokesResponse {
15827    fn typename() -> &'static str {
15828        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListSpokesResponse"
15829    }
15830}
15831
15832#[doc(hidden)]
15833impl gax::paginator::internal::PageableResponse for ListSpokesResponse {
15834    type PageItem = crate::model::Spoke;
15835
15836    fn items(self) -> std::vec::Vec<Self::PageItem> {
15837        self.spokes
15838    }
15839
15840    fn next_page_token(&self) -> std::string::String {
15841        use std::clone::Clone;
15842        self.next_page_token.clone()
15843    }
15844}
15845
15846#[doc(hidden)]
15847impl<'de> serde::de::Deserialize<'de> for ListSpokesResponse {
15848    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15849    where
15850        D: serde::Deserializer<'de>,
15851    {
15852        #[allow(non_camel_case_types)]
15853        #[doc(hidden)]
15854        #[derive(PartialEq, Eq, Hash)]
15855        enum __FieldTag {
15856            __spokes,
15857            __next_page_token,
15858            __unreachable,
15859            Unknown(std::string::String),
15860        }
15861        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15862            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15863            where
15864                D: serde::Deserializer<'de>,
15865            {
15866                struct Visitor;
15867                impl<'de> serde::de::Visitor<'de> for Visitor {
15868                    type Value = __FieldTag;
15869                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15870                        formatter.write_str("a field name for ListSpokesResponse")
15871                    }
15872                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15873                    where
15874                        E: serde::de::Error,
15875                    {
15876                        use std::result::Result::Ok;
15877                        use std::string::ToString;
15878                        match value {
15879                            "spokes" => Ok(__FieldTag::__spokes),
15880                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
15881                            "next_page_token" => Ok(__FieldTag::__next_page_token),
15882                            "unreachable" => Ok(__FieldTag::__unreachable),
15883                            _ => Ok(__FieldTag::Unknown(value.to_string())),
15884                        }
15885                    }
15886                }
15887                deserializer.deserialize_identifier(Visitor)
15888            }
15889        }
15890        struct Visitor;
15891        impl<'de> serde::de::Visitor<'de> for Visitor {
15892            type Value = ListSpokesResponse;
15893            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15894                formatter.write_str("struct ListSpokesResponse")
15895            }
15896            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15897            where
15898                A: serde::de::MapAccess<'de>,
15899            {
15900                #[allow(unused_imports)]
15901                use serde::de::Error;
15902                use std::option::Option::Some;
15903                let mut fields = std::collections::HashSet::new();
15904                let mut result = Self::Value::new();
15905                while let Some(tag) = map.next_key::<__FieldTag>()? {
15906                    #[allow(clippy::match_single_binding)]
15907                    match tag {
15908                        __FieldTag::__spokes => {
15909                            if !fields.insert(__FieldTag::__spokes) {
15910                                return std::result::Result::Err(A::Error::duplicate_field(
15911                                    "multiple values for spokes",
15912                                ));
15913                            }
15914                            result.spokes = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Spoke>>>()?.unwrap_or_default();
15915                        }
15916                        __FieldTag::__next_page_token => {
15917                            if !fields.insert(__FieldTag::__next_page_token) {
15918                                return std::result::Result::Err(A::Error::duplicate_field(
15919                                    "multiple values for next_page_token",
15920                                ));
15921                            }
15922                            result.next_page_token = map
15923                                .next_value::<std::option::Option<std::string::String>>()?
15924                                .unwrap_or_default();
15925                        }
15926                        __FieldTag::__unreachable => {
15927                            if !fields.insert(__FieldTag::__unreachable) {
15928                                return std::result::Result::Err(A::Error::duplicate_field(
15929                                    "multiple values for unreachable",
15930                                ));
15931                            }
15932                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
15933                        }
15934                        __FieldTag::Unknown(key) => {
15935                            let value = map.next_value::<serde_json::Value>()?;
15936                            result._unknown_fields.insert(key, value);
15937                        }
15938                    }
15939                }
15940                std::result::Result::Ok(result)
15941            }
15942        }
15943        deserializer.deserialize_any(Visitor)
15944    }
15945}
15946
15947#[doc(hidden)]
15948impl serde::ser::Serialize for ListSpokesResponse {
15949    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15950    where
15951        S: serde::ser::Serializer,
15952    {
15953        use serde::ser::SerializeMap;
15954        #[allow(unused_imports)]
15955        use std::option::Option::Some;
15956        let mut state = serializer.serialize_map(std::option::Option::None)?;
15957        if !self.spokes.is_empty() {
15958            state.serialize_entry("spokes", &self.spokes)?;
15959        }
15960        if !self.next_page_token.is_empty() {
15961            state.serialize_entry("nextPageToken", &self.next_page_token)?;
15962        }
15963        if !self.unreachable.is_empty() {
15964            state.serialize_entry("unreachable", &self.unreachable)?;
15965        }
15966        if !self._unknown_fields.is_empty() {
15967            for (key, value) in self._unknown_fields.iter() {
15968                state.serialize_entry(key, &value)?;
15969            }
15970        }
15971        state.end()
15972    }
15973}
15974
15975/// The request for
15976/// [HubService.GetSpoke][google.cloud.networkconnectivity.v1.HubService.GetSpoke].
15977///
15978/// [google.cloud.networkconnectivity.v1.HubService.GetSpoke]: crate::client::HubService::get_spoke
15979#[derive(Clone, Debug, Default, PartialEq)]
15980#[non_exhaustive]
15981pub struct GetSpokeRequest {
15982    /// Required. The name of the spoke resource.
15983    pub name: std::string::String,
15984
15985    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15986}
15987
15988impl GetSpokeRequest {
15989    pub fn new() -> Self {
15990        std::default::Default::default()
15991    }
15992
15993    /// Sets the value of [name][crate::model::GetSpokeRequest::name].
15994    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15995        self.name = v.into();
15996        self
15997    }
15998}
15999
16000impl wkt::message::Message for GetSpokeRequest {
16001    fn typename() -> &'static str {
16002        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetSpokeRequest"
16003    }
16004}
16005
16006#[doc(hidden)]
16007impl<'de> serde::de::Deserialize<'de> for GetSpokeRequest {
16008    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16009    where
16010        D: serde::Deserializer<'de>,
16011    {
16012        #[allow(non_camel_case_types)]
16013        #[doc(hidden)]
16014        #[derive(PartialEq, Eq, Hash)]
16015        enum __FieldTag {
16016            __name,
16017            Unknown(std::string::String),
16018        }
16019        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16020            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16021            where
16022                D: serde::Deserializer<'de>,
16023            {
16024                struct Visitor;
16025                impl<'de> serde::de::Visitor<'de> for Visitor {
16026                    type Value = __FieldTag;
16027                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16028                        formatter.write_str("a field name for GetSpokeRequest")
16029                    }
16030                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16031                    where
16032                        E: serde::de::Error,
16033                    {
16034                        use std::result::Result::Ok;
16035                        use std::string::ToString;
16036                        match value {
16037                            "name" => Ok(__FieldTag::__name),
16038                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16039                        }
16040                    }
16041                }
16042                deserializer.deserialize_identifier(Visitor)
16043            }
16044        }
16045        struct Visitor;
16046        impl<'de> serde::de::Visitor<'de> for Visitor {
16047            type Value = GetSpokeRequest;
16048            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16049                formatter.write_str("struct GetSpokeRequest")
16050            }
16051            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16052            where
16053                A: serde::de::MapAccess<'de>,
16054            {
16055                #[allow(unused_imports)]
16056                use serde::de::Error;
16057                use std::option::Option::Some;
16058                let mut fields = std::collections::HashSet::new();
16059                let mut result = Self::Value::new();
16060                while let Some(tag) = map.next_key::<__FieldTag>()? {
16061                    #[allow(clippy::match_single_binding)]
16062                    match tag {
16063                        __FieldTag::__name => {
16064                            if !fields.insert(__FieldTag::__name) {
16065                                return std::result::Result::Err(A::Error::duplicate_field(
16066                                    "multiple values for name",
16067                                ));
16068                            }
16069                            result.name = map
16070                                .next_value::<std::option::Option<std::string::String>>()?
16071                                .unwrap_or_default();
16072                        }
16073                        __FieldTag::Unknown(key) => {
16074                            let value = map.next_value::<serde_json::Value>()?;
16075                            result._unknown_fields.insert(key, value);
16076                        }
16077                    }
16078                }
16079                std::result::Result::Ok(result)
16080            }
16081        }
16082        deserializer.deserialize_any(Visitor)
16083    }
16084}
16085
16086#[doc(hidden)]
16087impl serde::ser::Serialize for GetSpokeRequest {
16088    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16089    where
16090        S: serde::ser::Serializer,
16091    {
16092        use serde::ser::SerializeMap;
16093        #[allow(unused_imports)]
16094        use std::option::Option::Some;
16095        let mut state = serializer.serialize_map(std::option::Option::None)?;
16096        if !self.name.is_empty() {
16097            state.serialize_entry("name", &self.name)?;
16098        }
16099        if !self._unknown_fields.is_empty() {
16100            for (key, value) in self._unknown_fields.iter() {
16101                state.serialize_entry(key, &value)?;
16102            }
16103        }
16104        state.end()
16105    }
16106}
16107
16108/// The request for
16109/// [HubService.CreateSpoke][google.cloud.networkconnectivity.v1.HubService.CreateSpoke].
16110///
16111/// [google.cloud.networkconnectivity.v1.HubService.CreateSpoke]: crate::client::HubService::create_spoke
16112#[derive(Clone, Debug, Default, PartialEq)]
16113#[non_exhaustive]
16114pub struct CreateSpokeRequest {
16115    /// Required. The parent resource.
16116    pub parent: std::string::String,
16117
16118    /// Required. Unique id for the spoke to create.
16119    pub spoke_id: std::string::String,
16120
16121    /// Required. The initial values for a new spoke.
16122    pub spoke: std::option::Option<crate::model::Spoke>,
16123
16124    /// Optional. A request ID to identify requests. Specify a unique request ID so
16125    /// that if you must retry your request, the server knows to ignore the request
16126    /// if it has already been completed. The server guarantees that a request
16127    /// doesn't result in creation of duplicate commitments for at least 60
16128    /// minutes.
16129    ///
16130    /// For example, consider a situation where you make an initial request and
16131    /// the request times out. If you make the request again with the same request
16132    /// ID, the server can check to see whether the original operation
16133    /// was received. If it was, the server ignores the second request. This
16134    /// behavior prevents clients from mistakenly creating duplicate commitments.
16135    ///
16136    /// The request ID must be a valid UUID, with the exception that zero UUID is
16137    /// not supported (00000000-0000-0000-0000-000000000000).
16138    pub request_id: std::string::String,
16139
16140    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16141}
16142
16143impl CreateSpokeRequest {
16144    pub fn new() -> Self {
16145        std::default::Default::default()
16146    }
16147
16148    /// Sets the value of [parent][crate::model::CreateSpokeRequest::parent].
16149    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16150        self.parent = v.into();
16151        self
16152    }
16153
16154    /// Sets the value of [spoke_id][crate::model::CreateSpokeRequest::spoke_id].
16155    pub fn set_spoke_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16156        self.spoke_id = v.into();
16157        self
16158    }
16159
16160    /// Sets the value of [spoke][crate::model::CreateSpokeRequest::spoke].
16161    pub fn set_spoke<T>(mut self, v: T) -> Self
16162    where
16163        T: std::convert::Into<crate::model::Spoke>,
16164    {
16165        self.spoke = std::option::Option::Some(v.into());
16166        self
16167    }
16168
16169    /// Sets or clears the value of [spoke][crate::model::CreateSpokeRequest::spoke].
16170    pub fn set_or_clear_spoke<T>(mut self, v: std::option::Option<T>) -> Self
16171    where
16172        T: std::convert::Into<crate::model::Spoke>,
16173    {
16174        self.spoke = v.map(|x| x.into());
16175        self
16176    }
16177
16178    /// Sets the value of [request_id][crate::model::CreateSpokeRequest::request_id].
16179    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16180        self.request_id = v.into();
16181        self
16182    }
16183}
16184
16185impl wkt::message::Message for CreateSpokeRequest {
16186    fn typename() -> &'static str {
16187        "type.googleapis.com/google.cloud.networkconnectivity.v1.CreateSpokeRequest"
16188    }
16189}
16190
16191#[doc(hidden)]
16192impl<'de> serde::de::Deserialize<'de> for CreateSpokeRequest {
16193    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16194    where
16195        D: serde::Deserializer<'de>,
16196    {
16197        #[allow(non_camel_case_types)]
16198        #[doc(hidden)]
16199        #[derive(PartialEq, Eq, Hash)]
16200        enum __FieldTag {
16201            __parent,
16202            __spoke_id,
16203            __spoke,
16204            __request_id,
16205            Unknown(std::string::String),
16206        }
16207        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16208            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16209            where
16210                D: serde::Deserializer<'de>,
16211            {
16212                struct Visitor;
16213                impl<'de> serde::de::Visitor<'de> for Visitor {
16214                    type Value = __FieldTag;
16215                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16216                        formatter.write_str("a field name for CreateSpokeRequest")
16217                    }
16218                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16219                    where
16220                        E: serde::de::Error,
16221                    {
16222                        use std::result::Result::Ok;
16223                        use std::string::ToString;
16224                        match value {
16225                            "parent" => Ok(__FieldTag::__parent),
16226                            "spokeId" => Ok(__FieldTag::__spoke_id),
16227                            "spoke_id" => Ok(__FieldTag::__spoke_id),
16228                            "spoke" => Ok(__FieldTag::__spoke),
16229                            "requestId" => Ok(__FieldTag::__request_id),
16230                            "request_id" => Ok(__FieldTag::__request_id),
16231                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16232                        }
16233                    }
16234                }
16235                deserializer.deserialize_identifier(Visitor)
16236            }
16237        }
16238        struct Visitor;
16239        impl<'de> serde::de::Visitor<'de> for Visitor {
16240            type Value = CreateSpokeRequest;
16241            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16242                formatter.write_str("struct CreateSpokeRequest")
16243            }
16244            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16245            where
16246                A: serde::de::MapAccess<'de>,
16247            {
16248                #[allow(unused_imports)]
16249                use serde::de::Error;
16250                use std::option::Option::Some;
16251                let mut fields = std::collections::HashSet::new();
16252                let mut result = Self::Value::new();
16253                while let Some(tag) = map.next_key::<__FieldTag>()? {
16254                    #[allow(clippy::match_single_binding)]
16255                    match tag {
16256                        __FieldTag::__parent => {
16257                            if !fields.insert(__FieldTag::__parent) {
16258                                return std::result::Result::Err(A::Error::duplicate_field(
16259                                    "multiple values for parent",
16260                                ));
16261                            }
16262                            result.parent = map
16263                                .next_value::<std::option::Option<std::string::String>>()?
16264                                .unwrap_or_default();
16265                        }
16266                        __FieldTag::__spoke_id => {
16267                            if !fields.insert(__FieldTag::__spoke_id) {
16268                                return std::result::Result::Err(A::Error::duplicate_field(
16269                                    "multiple values for spoke_id",
16270                                ));
16271                            }
16272                            result.spoke_id = map
16273                                .next_value::<std::option::Option<std::string::String>>()?
16274                                .unwrap_or_default();
16275                        }
16276                        __FieldTag::__spoke => {
16277                            if !fields.insert(__FieldTag::__spoke) {
16278                                return std::result::Result::Err(A::Error::duplicate_field(
16279                                    "multiple values for spoke",
16280                                ));
16281                            }
16282                            result.spoke =
16283                                map.next_value::<std::option::Option<crate::model::Spoke>>()?;
16284                        }
16285                        __FieldTag::__request_id => {
16286                            if !fields.insert(__FieldTag::__request_id) {
16287                                return std::result::Result::Err(A::Error::duplicate_field(
16288                                    "multiple values for request_id",
16289                                ));
16290                            }
16291                            result.request_id = map
16292                                .next_value::<std::option::Option<std::string::String>>()?
16293                                .unwrap_or_default();
16294                        }
16295                        __FieldTag::Unknown(key) => {
16296                            let value = map.next_value::<serde_json::Value>()?;
16297                            result._unknown_fields.insert(key, value);
16298                        }
16299                    }
16300                }
16301                std::result::Result::Ok(result)
16302            }
16303        }
16304        deserializer.deserialize_any(Visitor)
16305    }
16306}
16307
16308#[doc(hidden)]
16309impl serde::ser::Serialize for CreateSpokeRequest {
16310    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16311    where
16312        S: serde::ser::Serializer,
16313    {
16314        use serde::ser::SerializeMap;
16315        #[allow(unused_imports)]
16316        use std::option::Option::Some;
16317        let mut state = serializer.serialize_map(std::option::Option::None)?;
16318        if !self.parent.is_empty() {
16319            state.serialize_entry("parent", &self.parent)?;
16320        }
16321        if !self.spoke_id.is_empty() {
16322            state.serialize_entry("spokeId", &self.spoke_id)?;
16323        }
16324        if self.spoke.is_some() {
16325            state.serialize_entry("spoke", &self.spoke)?;
16326        }
16327        if !self.request_id.is_empty() {
16328            state.serialize_entry("requestId", &self.request_id)?;
16329        }
16330        if !self._unknown_fields.is_empty() {
16331            for (key, value) in self._unknown_fields.iter() {
16332                state.serialize_entry(key, &value)?;
16333            }
16334        }
16335        state.end()
16336    }
16337}
16338
16339/// Request for
16340/// [HubService.UpdateSpoke][google.cloud.networkconnectivity.v1.HubService.UpdateSpoke]
16341/// method.
16342///
16343/// [google.cloud.networkconnectivity.v1.HubService.UpdateSpoke]: crate::client::HubService::update_spoke
16344#[derive(Clone, Debug, Default, PartialEq)]
16345#[non_exhaustive]
16346pub struct UpdateSpokeRequest {
16347    /// Optional. In the case of an update to an existing spoke, field mask is used
16348    /// to specify the fields to be overwritten. The fields specified in the
16349    /// update_mask are relative to the resource, not the full request. A field is
16350    /// overwritten if it is in the mask. If the user does not provide a mask, then
16351    /// all fields are overwritten.
16352    pub update_mask: std::option::Option<wkt::FieldMask>,
16353
16354    /// Required. The state that the spoke should be in after the update.
16355    pub spoke: std::option::Option<crate::model::Spoke>,
16356
16357    /// Optional. A request ID to identify requests. Specify a unique request ID so
16358    /// that if you must retry your request, the server knows to ignore the request
16359    /// if it has already been completed. The server guarantees that a request
16360    /// doesn't result in creation of duplicate commitments for at least 60
16361    /// minutes.
16362    ///
16363    /// For example, consider a situation where you make an initial request and
16364    /// the request times out. If you make the request again with the same request
16365    /// ID, the server can check to see whether the original operation
16366    /// was received. If it was, the server ignores the second request. This
16367    /// behavior prevents clients from mistakenly creating duplicate commitments.
16368    ///
16369    /// The request ID must be a valid UUID, with the exception that zero UUID is
16370    /// not supported (00000000-0000-0000-0000-000000000000).
16371    pub request_id: std::string::String,
16372
16373    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16374}
16375
16376impl UpdateSpokeRequest {
16377    pub fn new() -> Self {
16378        std::default::Default::default()
16379    }
16380
16381    /// Sets the value of [update_mask][crate::model::UpdateSpokeRequest::update_mask].
16382    pub fn set_update_mask<T>(mut self, v: T) -> Self
16383    where
16384        T: std::convert::Into<wkt::FieldMask>,
16385    {
16386        self.update_mask = std::option::Option::Some(v.into());
16387        self
16388    }
16389
16390    /// Sets or clears the value of [update_mask][crate::model::UpdateSpokeRequest::update_mask].
16391    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
16392    where
16393        T: std::convert::Into<wkt::FieldMask>,
16394    {
16395        self.update_mask = v.map(|x| x.into());
16396        self
16397    }
16398
16399    /// Sets the value of [spoke][crate::model::UpdateSpokeRequest::spoke].
16400    pub fn set_spoke<T>(mut self, v: T) -> Self
16401    where
16402        T: std::convert::Into<crate::model::Spoke>,
16403    {
16404        self.spoke = std::option::Option::Some(v.into());
16405        self
16406    }
16407
16408    /// Sets or clears the value of [spoke][crate::model::UpdateSpokeRequest::spoke].
16409    pub fn set_or_clear_spoke<T>(mut self, v: std::option::Option<T>) -> Self
16410    where
16411        T: std::convert::Into<crate::model::Spoke>,
16412    {
16413        self.spoke = v.map(|x| x.into());
16414        self
16415    }
16416
16417    /// Sets the value of [request_id][crate::model::UpdateSpokeRequest::request_id].
16418    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16419        self.request_id = v.into();
16420        self
16421    }
16422}
16423
16424impl wkt::message::Message for UpdateSpokeRequest {
16425    fn typename() -> &'static str {
16426        "type.googleapis.com/google.cloud.networkconnectivity.v1.UpdateSpokeRequest"
16427    }
16428}
16429
16430#[doc(hidden)]
16431impl<'de> serde::de::Deserialize<'de> for UpdateSpokeRequest {
16432    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16433    where
16434        D: serde::Deserializer<'de>,
16435    {
16436        #[allow(non_camel_case_types)]
16437        #[doc(hidden)]
16438        #[derive(PartialEq, Eq, Hash)]
16439        enum __FieldTag {
16440            __update_mask,
16441            __spoke,
16442            __request_id,
16443            Unknown(std::string::String),
16444        }
16445        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16446            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16447            where
16448                D: serde::Deserializer<'de>,
16449            {
16450                struct Visitor;
16451                impl<'de> serde::de::Visitor<'de> for Visitor {
16452                    type Value = __FieldTag;
16453                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16454                        formatter.write_str("a field name for UpdateSpokeRequest")
16455                    }
16456                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16457                    where
16458                        E: serde::de::Error,
16459                    {
16460                        use std::result::Result::Ok;
16461                        use std::string::ToString;
16462                        match value {
16463                            "updateMask" => Ok(__FieldTag::__update_mask),
16464                            "update_mask" => Ok(__FieldTag::__update_mask),
16465                            "spoke" => Ok(__FieldTag::__spoke),
16466                            "requestId" => Ok(__FieldTag::__request_id),
16467                            "request_id" => Ok(__FieldTag::__request_id),
16468                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16469                        }
16470                    }
16471                }
16472                deserializer.deserialize_identifier(Visitor)
16473            }
16474        }
16475        struct Visitor;
16476        impl<'de> serde::de::Visitor<'de> for Visitor {
16477            type Value = UpdateSpokeRequest;
16478            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16479                formatter.write_str("struct UpdateSpokeRequest")
16480            }
16481            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16482            where
16483                A: serde::de::MapAccess<'de>,
16484            {
16485                #[allow(unused_imports)]
16486                use serde::de::Error;
16487                use std::option::Option::Some;
16488                let mut fields = std::collections::HashSet::new();
16489                let mut result = Self::Value::new();
16490                while let Some(tag) = map.next_key::<__FieldTag>()? {
16491                    #[allow(clippy::match_single_binding)]
16492                    match tag {
16493                        __FieldTag::__update_mask => {
16494                            if !fields.insert(__FieldTag::__update_mask) {
16495                                return std::result::Result::Err(A::Error::duplicate_field(
16496                                    "multiple values for update_mask",
16497                                ));
16498                            }
16499                            result.update_mask =
16500                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
16501                        }
16502                        __FieldTag::__spoke => {
16503                            if !fields.insert(__FieldTag::__spoke) {
16504                                return std::result::Result::Err(A::Error::duplicate_field(
16505                                    "multiple values for spoke",
16506                                ));
16507                            }
16508                            result.spoke =
16509                                map.next_value::<std::option::Option<crate::model::Spoke>>()?;
16510                        }
16511                        __FieldTag::__request_id => {
16512                            if !fields.insert(__FieldTag::__request_id) {
16513                                return std::result::Result::Err(A::Error::duplicate_field(
16514                                    "multiple values for request_id",
16515                                ));
16516                            }
16517                            result.request_id = map
16518                                .next_value::<std::option::Option<std::string::String>>()?
16519                                .unwrap_or_default();
16520                        }
16521                        __FieldTag::Unknown(key) => {
16522                            let value = map.next_value::<serde_json::Value>()?;
16523                            result._unknown_fields.insert(key, value);
16524                        }
16525                    }
16526                }
16527                std::result::Result::Ok(result)
16528            }
16529        }
16530        deserializer.deserialize_any(Visitor)
16531    }
16532}
16533
16534#[doc(hidden)]
16535impl serde::ser::Serialize for UpdateSpokeRequest {
16536    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16537    where
16538        S: serde::ser::Serializer,
16539    {
16540        use serde::ser::SerializeMap;
16541        #[allow(unused_imports)]
16542        use std::option::Option::Some;
16543        let mut state = serializer.serialize_map(std::option::Option::None)?;
16544        if self.update_mask.is_some() {
16545            state.serialize_entry("updateMask", &self.update_mask)?;
16546        }
16547        if self.spoke.is_some() {
16548            state.serialize_entry("spoke", &self.spoke)?;
16549        }
16550        if !self.request_id.is_empty() {
16551            state.serialize_entry("requestId", &self.request_id)?;
16552        }
16553        if !self._unknown_fields.is_empty() {
16554            for (key, value) in self._unknown_fields.iter() {
16555                state.serialize_entry(key, &value)?;
16556            }
16557        }
16558        state.end()
16559    }
16560}
16561
16562/// The request for
16563/// [HubService.DeleteSpoke][google.cloud.networkconnectivity.v1.HubService.DeleteSpoke].
16564///
16565/// [google.cloud.networkconnectivity.v1.HubService.DeleteSpoke]: crate::client::HubService::delete_spoke
16566#[derive(Clone, Debug, Default, PartialEq)]
16567#[non_exhaustive]
16568pub struct DeleteSpokeRequest {
16569    /// Required. The name of the spoke to delete.
16570    pub name: std::string::String,
16571
16572    /// Optional. A request ID to identify requests. Specify a unique request ID so
16573    /// that if you must retry your request, the server knows to ignore the request
16574    /// if it has already been completed. The server guarantees that a request
16575    /// doesn't result in creation of duplicate commitments for at least 60
16576    /// minutes.
16577    ///
16578    /// For example, consider a situation where you make an initial request and
16579    /// the request times out. If you make the request again with the same request
16580    /// ID, the server can check to see whether the original operation
16581    /// was received. If it was, the server ignores the second request. This
16582    /// behavior prevents clients from mistakenly creating duplicate commitments.
16583    ///
16584    /// The request ID must be a valid UUID, with the exception that zero UUID is
16585    /// not supported (00000000-0000-0000-0000-000000000000).
16586    pub request_id: std::string::String,
16587
16588    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16589}
16590
16591impl DeleteSpokeRequest {
16592    pub fn new() -> Self {
16593        std::default::Default::default()
16594    }
16595
16596    /// Sets the value of [name][crate::model::DeleteSpokeRequest::name].
16597    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16598        self.name = v.into();
16599        self
16600    }
16601
16602    /// Sets the value of [request_id][crate::model::DeleteSpokeRequest::request_id].
16603    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16604        self.request_id = v.into();
16605        self
16606    }
16607}
16608
16609impl wkt::message::Message for DeleteSpokeRequest {
16610    fn typename() -> &'static str {
16611        "type.googleapis.com/google.cloud.networkconnectivity.v1.DeleteSpokeRequest"
16612    }
16613}
16614
16615#[doc(hidden)]
16616impl<'de> serde::de::Deserialize<'de> for DeleteSpokeRequest {
16617    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16618    where
16619        D: serde::Deserializer<'de>,
16620    {
16621        #[allow(non_camel_case_types)]
16622        #[doc(hidden)]
16623        #[derive(PartialEq, Eq, Hash)]
16624        enum __FieldTag {
16625            __name,
16626            __request_id,
16627            Unknown(std::string::String),
16628        }
16629        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16630            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16631            where
16632                D: serde::Deserializer<'de>,
16633            {
16634                struct Visitor;
16635                impl<'de> serde::de::Visitor<'de> for Visitor {
16636                    type Value = __FieldTag;
16637                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16638                        formatter.write_str("a field name for DeleteSpokeRequest")
16639                    }
16640                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16641                    where
16642                        E: serde::de::Error,
16643                    {
16644                        use std::result::Result::Ok;
16645                        use std::string::ToString;
16646                        match value {
16647                            "name" => Ok(__FieldTag::__name),
16648                            "requestId" => Ok(__FieldTag::__request_id),
16649                            "request_id" => Ok(__FieldTag::__request_id),
16650                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16651                        }
16652                    }
16653                }
16654                deserializer.deserialize_identifier(Visitor)
16655            }
16656        }
16657        struct Visitor;
16658        impl<'de> serde::de::Visitor<'de> for Visitor {
16659            type Value = DeleteSpokeRequest;
16660            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16661                formatter.write_str("struct DeleteSpokeRequest")
16662            }
16663            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16664            where
16665                A: serde::de::MapAccess<'de>,
16666            {
16667                #[allow(unused_imports)]
16668                use serde::de::Error;
16669                use std::option::Option::Some;
16670                let mut fields = std::collections::HashSet::new();
16671                let mut result = Self::Value::new();
16672                while let Some(tag) = map.next_key::<__FieldTag>()? {
16673                    #[allow(clippy::match_single_binding)]
16674                    match tag {
16675                        __FieldTag::__name => {
16676                            if !fields.insert(__FieldTag::__name) {
16677                                return std::result::Result::Err(A::Error::duplicate_field(
16678                                    "multiple values for name",
16679                                ));
16680                            }
16681                            result.name = map
16682                                .next_value::<std::option::Option<std::string::String>>()?
16683                                .unwrap_or_default();
16684                        }
16685                        __FieldTag::__request_id => {
16686                            if !fields.insert(__FieldTag::__request_id) {
16687                                return std::result::Result::Err(A::Error::duplicate_field(
16688                                    "multiple values for request_id",
16689                                ));
16690                            }
16691                            result.request_id = map
16692                                .next_value::<std::option::Option<std::string::String>>()?
16693                                .unwrap_or_default();
16694                        }
16695                        __FieldTag::Unknown(key) => {
16696                            let value = map.next_value::<serde_json::Value>()?;
16697                            result._unknown_fields.insert(key, value);
16698                        }
16699                    }
16700                }
16701                std::result::Result::Ok(result)
16702            }
16703        }
16704        deserializer.deserialize_any(Visitor)
16705    }
16706}
16707
16708#[doc(hidden)]
16709impl serde::ser::Serialize for DeleteSpokeRequest {
16710    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16711    where
16712        S: serde::ser::Serializer,
16713    {
16714        use serde::ser::SerializeMap;
16715        #[allow(unused_imports)]
16716        use std::option::Option::Some;
16717        let mut state = serializer.serialize_map(std::option::Option::None)?;
16718        if !self.name.is_empty() {
16719            state.serialize_entry("name", &self.name)?;
16720        }
16721        if !self.request_id.is_empty() {
16722            state.serialize_entry("requestId", &self.request_id)?;
16723        }
16724        if !self._unknown_fields.is_empty() {
16725            for (key, value) in self._unknown_fields.iter() {
16726                state.serialize_entry(key, &value)?;
16727            }
16728        }
16729        state.end()
16730    }
16731}
16732
16733/// The request for
16734/// [HubService.AcceptHubSpoke][google.cloud.networkconnectivity.v1.HubService.AcceptHubSpoke].
16735///
16736/// [google.cloud.networkconnectivity.v1.HubService.AcceptHubSpoke]: crate::client::HubService::accept_hub_spoke
16737#[derive(Clone, Debug, Default, PartialEq)]
16738#[non_exhaustive]
16739pub struct AcceptHubSpokeRequest {
16740    /// Required. The name of the hub into which to accept the spoke.
16741    pub name: std::string::String,
16742
16743    /// Required. The URI of the spoke to accept into the hub.
16744    pub spoke_uri: std::string::String,
16745
16746    /// Optional. A request ID to identify requests. Specify a unique request ID so
16747    /// that if you must retry your request, the server knows to ignore the request
16748    /// if it has already been completed. The server guarantees that a request
16749    /// doesn't result in creation of duplicate commitments for at least 60
16750    /// minutes.
16751    ///
16752    /// For example, consider a situation where you make an initial request and
16753    /// the request times out. If you make the request again with the same request
16754    /// ID, the server can check to see whether the original operation
16755    /// was received. If it was, the server ignores the second request. This
16756    /// behavior prevents clients from mistakenly creating duplicate commitments.
16757    ///
16758    /// The request ID must be a valid UUID, with the exception that zero UUID is
16759    /// not supported (00000000-0000-0000-0000-000000000000).
16760    pub request_id: std::string::String,
16761
16762    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16763}
16764
16765impl AcceptHubSpokeRequest {
16766    pub fn new() -> Self {
16767        std::default::Default::default()
16768    }
16769
16770    /// Sets the value of [name][crate::model::AcceptHubSpokeRequest::name].
16771    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16772        self.name = v.into();
16773        self
16774    }
16775
16776    /// Sets the value of [spoke_uri][crate::model::AcceptHubSpokeRequest::spoke_uri].
16777    pub fn set_spoke_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16778        self.spoke_uri = v.into();
16779        self
16780    }
16781
16782    /// Sets the value of [request_id][crate::model::AcceptHubSpokeRequest::request_id].
16783    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16784        self.request_id = v.into();
16785        self
16786    }
16787}
16788
16789impl wkt::message::Message for AcceptHubSpokeRequest {
16790    fn typename() -> &'static str {
16791        "type.googleapis.com/google.cloud.networkconnectivity.v1.AcceptHubSpokeRequest"
16792    }
16793}
16794
16795#[doc(hidden)]
16796impl<'de> serde::de::Deserialize<'de> for AcceptHubSpokeRequest {
16797    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16798    where
16799        D: serde::Deserializer<'de>,
16800    {
16801        #[allow(non_camel_case_types)]
16802        #[doc(hidden)]
16803        #[derive(PartialEq, Eq, Hash)]
16804        enum __FieldTag {
16805            __name,
16806            __spoke_uri,
16807            __request_id,
16808            Unknown(std::string::String),
16809        }
16810        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16811            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16812            where
16813                D: serde::Deserializer<'de>,
16814            {
16815                struct Visitor;
16816                impl<'de> serde::de::Visitor<'de> for Visitor {
16817                    type Value = __FieldTag;
16818                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16819                        formatter.write_str("a field name for AcceptHubSpokeRequest")
16820                    }
16821                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16822                    where
16823                        E: serde::de::Error,
16824                    {
16825                        use std::result::Result::Ok;
16826                        use std::string::ToString;
16827                        match value {
16828                            "name" => Ok(__FieldTag::__name),
16829                            "spokeUri" => Ok(__FieldTag::__spoke_uri),
16830                            "spoke_uri" => Ok(__FieldTag::__spoke_uri),
16831                            "requestId" => Ok(__FieldTag::__request_id),
16832                            "request_id" => Ok(__FieldTag::__request_id),
16833                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16834                        }
16835                    }
16836                }
16837                deserializer.deserialize_identifier(Visitor)
16838            }
16839        }
16840        struct Visitor;
16841        impl<'de> serde::de::Visitor<'de> for Visitor {
16842            type Value = AcceptHubSpokeRequest;
16843            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16844                formatter.write_str("struct AcceptHubSpokeRequest")
16845            }
16846            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16847            where
16848                A: serde::de::MapAccess<'de>,
16849            {
16850                #[allow(unused_imports)]
16851                use serde::de::Error;
16852                use std::option::Option::Some;
16853                let mut fields = std::collections::HashSet::new();
16854                let mut result = Self::Value::new();
16855                while let Some(tag) = map.next_key::<__FieldTag>()? {
16856                    #[allow(clippy::match_single_binding)]
16857                    match tag {
16858                        __FieldTag::__name => {
16859                            if !fields.insert(__FieldTag::__name) {
16860                                return std::result::Result::Err(A::Error::duplicate_field(
16861                                    "multiple values for name",
16862                                ));
16863                            }
16864                            result.name = map
16865                                .next_value::<std::option::Option<std::string::String>>()?
16866                                .unwrap_or_default();
16867                        }
16868                        __FieldTag::__spoke_uri => {
16869                            if !fields.insert(__FieldTag::__spoke_uri) {
16870                                return std::result::Result::Err(A::Error::duplicate_field(
16871                                    "multiple values for spoke_uri",
16872                                ));
16873                            }
16874                            result.spoke_uri = map
16875                                .next_value::<std::option::Option<std::string::String>>()?
16876                                .unwrap_or_default();
16877                        }
16878                        __FieldTag::__request_id => {
16879                            if !fields.insert(__FieldTag::__request_id) {
16880                                return std::result::Result::Err(A::Error::duplicate_field(
16881                                    "multiple values for request_id",
16882                                ));
16883                            }
16884                            result.request_id = map
16885                                .next_value::<std::option::Option<std::string::String>>()?
16886                                .unwrap_or_default();
16887                        }
16888                        __FieldTag::Unknown(key) => {
16889                            let value = map.next_value::<serde_json::Value>()?;
16890                            result._unknown_fields.insert(key, value);
16891                        }
16892                    }
16893                }
16894                std::result::Result::Ok(result)
16895            }
16896        }
16897        deserializer.deserialize_any(Visitor)
16898    }
16899}
16900
16901#[doc(hidden)]
16902impl serde::ser::Serialize for AcceptHubSpokeRequest {
16903    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16904    where
16905        S: serde::ser::Serializer,
16906    {
16907        use serde::ser::SerializeMap;
16908        #[allow(unused_imports)]
16909        use std::option::Option::Some;
16910        let mut state = serializer.serialize_map(std::option::Option::None)?;
16911        if !self.name.is_empty() {
16912            state.serialize_entry("name", &self.name)?;
16913        }
16914        if !self.spoke_uri.is_empty() {
16915            state.serialize_entry("spokeUri", &self.spoke_uri)?;
16916        }
16917        if !self.request_id.is_empty() {
16918            state.serialize_entry("requestId", &self.request_id)?;
16919        }
16920        if !self._unknown_fields.is_empty() {
16921            for (key, value) in self._unknown_fields.iter() {
16922                state.serialize_entry(key, &value)?;
16923            }
16924        }
16925        state.end()
16926    }
16927}
16928
16929/// The response for
16930/// [HubService.AcceptHubSpoke][google.cloud.networkconnectivity.v1.HubService.AcceptHubSpoke].
16931///
16932/// [google.cloud.networkconnectivity.v1.HubService.AcceptHubSpoke]: crate::client::HubService::accept_hub_spoke
16933#[derive(Clone, Debug, Default, PartialEq)]
16934#[non_exhaustive]
16935pub struct AcceptHubSpokeResponse {
16936    /// The spoke that was operated on.
16937    pub spoke: std::option::Option<crate::model::Spoke>,
16938
16939    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16940}
16941
16942impl AcceptHubSpokeResponse {
16943    pub fn new() -> Self {
16944        std::default::Default::default()
16945    }
16946
16947    /// Sets the value of [spoke][crate::model::AcceptHubSpokeResponse::spoke].
16948    pub fn set_spoke<T>(mut self, v: T) -> Self
16949    where
16950        T: std::convert::Into<crate::model::Spoke>,
16951    {
16952        self.spoke = std::option::Option::Some(v.into());
16953        self
16954    }
16955
16956    /// Sets or clears the value of [spoke][crate::model::AcceptHubSpokeResponse::spoke].
16957    pub fn set_or_clear_spoke<T>(mut self, v: std::option::Option<T>) -> Self
16958    where
16959        T: std::convert::Into<crate::model::Spoke>,
16960    {
16961        self.spoke = v.map(|x| x.into());
16962        self
16963    }
16964}
16965
16966impl wkt::message::Message for AcceptHubSpokeResponse {
16967    fn typename() -> &'static str {
16968        "type.googleapis.com/google.cloud.networkconnectivity.v1.AcceptHubSpokeResponse"
16969    }
16970}
16971
16972#[doc(hidden)]
16973impl<'de> serde::de::Deserialize<'de> for AcceptHubSpokeResponse {
16974    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16975    where
16976        D: serde::Deserializer<'de>,
16977    {
16978        #[allow(non_camel_case_types)]
16979        #[doc(hidden)]
16980        #[derive(PartialEq, Eq, Hash)]
16981        enum __FieldTag {
16982            __spoke,
16983            Unknown(std::string::String),
16984        }
16985        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16986            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16987            where
16988                D: serde::Deserializer<'de>,
16989            {
16990                struct Visitor;
16991                impl<'de> serde::de::Visitor<'de> for Visitor {
16992                    type Value = __FieldTag;
16993                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16994                        formatter.write_str("a field name for AcceptHubSpokeResponse")
16995                    }
16996                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16997                    where
16998                        E: serde::de::Error,
16999                    {
17000                        use std::result::Result::Ok;
17001                        use std::string::ToString;
17002                        match value {
17003                            "spoke" => Ok(__FieldTag::__spoke),
17004                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17005                        }
17006                    }
17007                }
17008                deserializer.deserialize_identifier(Visitor)
17009            }
17010        }
17011        struct Visitor;
17012        impl<'de> serde::de::Visitor<'de> for Visitor {
17013            type Value = AcceptHubSpokeResponse;
17014            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17015                formatter.write_str("struct AcceptHubSpokeResponse")
17016            }
17017            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17018            where
17019                A: serde::de::MapAccess<'de>,
17020            {
17021                #[allow(unused_imports)]
17022                use serde::de::Error;
17023                use std::option::Option::Some;
17024                let mut fields = std::collections::HashSet::new();
17025                let mut result = Self::Value::new();
17026                while let Some(tag) = map.next_key::<__FieldTag>()? {
17027                    #[allow(clippy::match_single_binding)]
17028                    match tag {
17029                        __FieldTag::__spoke => {
17030                            if !fields.insert(__FieldTag::__spoke) {
17031                                return std::result::Result::Err(A::Error::duplicate_field(
17032                                    "multiple values for spoke",
17033                                ));
17034                            }
17035                            result.spoke =
17036                                map.next_value::<std::option::Option<crate::model::Spoke>>()?;
17037                        }
17038                        __FieldTag::Unknown(key) => {
17039                            let value = map.next_value::<serde_json::Value>()?;
17040                            result._unknown_fields.insert(key, value);
17041                        }
17042                    }
17043                }
17044                std::result::Result::Ok(result)
17045            }
17046        }
17047        deserializer.deserialize_any(Visitor)
17048    }
17049}
17050
17051#[doc(hidden)]
17052impl serde::ser::Serialize for AcceptHubSpokeResponse {
17053    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17054    where
17055        S: serde::ser::Serializer,
17056    {
17057        use serde::ser::SerializeMap;
17058        #[allow(unused_imports)]
17059        use std::option::Option::Some;
17060        let mut state = serializer.serialize_map(std::option::Option::None)?;
17061        if self.spoke.is_some() {
17062            state.serialize_entry("spoke", &self.spoke)?;
17063        }
17064        if !self._unknown_fields.is_empty() {
17065            for (key, value) in self._unknown_fields.iter() {
17066                state.serialize_entry(key, &value)?;
17067            }
17068        }
17069        state.end()
17070    }
17071}
17072
17073/// The request for
17074/// [HubService.RejectHubSpoke][google.cloud.networkconnectivity.v1.HubService.RejectHubSpoke].
17075///
17076/// [google.cloud.networkconnectivity.v1.HubService.RejectHubSpoke]: crate::client::HubService::reject_hub_spoke
17077#[derive(Clone, Debug, Default, PartialEq)]
17078#[non_exhaustive]
17079pub struct RejectHubSpokeRequest {
17080    /// Required. The name of the hub from which to reject the spoke.
17081    pub name: std::string::String,
17082
17083    /// Required. The URI of the spoke to reject from the hub.
17084    pub spoke_uri: std::string::String,
17085
17086    /// Optional. A request ID to identify requests. Specify a unique request ID so
17087    /// that if you must retry your request, the server knows to ignore the request
17088    /// if it has already been completed. The server guarantees that a request
17089    /// doesn't result in creation of duplicate commitments for at least 60
17090    /// minutes.
17091    ///
17092    /// For example, consider a situation where you make an initial request and
17093    /// the request times out. If you make the request again with the same request
17094    /// ID, the server can check to see whether the original operation
17095    /// was received. If it was, the server ignores the second request. This
17096    /// behavior prevents clients from mistakenly creating duplicate commitments.
17097    ///
17098    /// The request ID must be a valid UUID, with the exception that zero UUID is
17099    /// not supported (00000000-0000-0000-0000-000000000000).
17100    pub request_id: std::string::String,
17101
17102    /// Optional. Additional information provided by the hub administrator.
17103    pub details: std::string::String,
17104
17105    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17106}
17107
17108impl RejectHubSpokeRequest {
17109    pub fn new() -> Self {
17110        std::default::Default::default()
17111    }
17112
17113    /// Sets the value of [name][crate::model::RejectHubSpokeRequest::name].
17114    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17115        self.name = v.into();
17116        self
17117    }
17118
17119    /// Sets the value of [spoke_uri][crate::model::RejectHubSpokeRequest::spoke_uri].
17120    pub fn set_spoke_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17121        self.spoke_uri = v.into();
17122        self
17123    }
17124
17125    /// Sets the value of [request_id][crate::model::RejectHubSpokeRequest::request_id].
17126    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17127        self.request_id = v.into();
17128        self
17129    }
17130
17131    /// Sets the value of [details][crate::model::RejectHubSpokeRequest::details].
17132    pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17133        self.details = v.into();
17134        self
17135    }
17136}
17137
17138impl wkt::message::Message for RejectHubSpokeRequest {
17139    fn typename() -> &'static str {
17140        "type.googleapis.com/google.cloud.networkconnectivity.v1.RejectHubSpokeRequest"
17141    }
17142}
17143
17144#[doc(hidden)]
17145impl<'de> serde::de::Deserialize<'de> for RejectHubSpokeRequest {
17146    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17147    where
17148        D: serde::Deserializer<'de>,
17149    {
17150        #[allow(non_camel_case_types)]
17151        #[doc(hidden)]
17152        #[derive(PartialEq, Eq, Hash)]
17153        enum __FieldTag {
17154            __name,
17155            __spoke_uri,
17156            __request_id,
17157            __details,
17158            Unknown(std::string::String),
17159        }
17160        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17161            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17162            where
17163                D: serde::Deserializer<'de>,
17164            {
17165                struct Visitor;
17166                impl<'de> serde::de::Visitor<'de> for Visitor {
17167                    type Value = __FieldTag;
17168                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17169                        formatter.write_str("a field name for RejectHubSpokeRequest")
17170                    }
17171                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17172                    where
17173                        E: serde::de::Error,
17174                    {
17175                        use std::result::Result::Ok;
17176                        use std::string::ToString;
17177                        match value {
17178                            "name" => Ok(__FieldTag::__name),
17179                            "spokeUri" => Ok(__FieldTag::__spoke_uri),
17180                            "spoke_uri" => Ok(__FieldTag::__spoke_uri),
17181                            "requestId" => Ok(__FieldTag::__request_id),
17182                            "request_id" => Ok(__FieldTag::__request_id),
17183                            "details" => Ok(__FieldTag::__details),
17184                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17185                        }
17186                    }
17187                }
17188                deserializer.deserialize_identifier(Visitor)
17189            }
17190        }
17191        struct Visitor;
17192        impl<'de> serde::de::Visitor<'de> for Visitor {
17193            type Value = RejectHubSpokeRequest;
17194            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17195                formatter.write_str("struct RejectHubSpokeRequest")
17196            }
17197            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17198            where
17199                A: serde::de::MapAccess<'de>,
17200            {
17201                #[allow(unused_imports)]
17202                use serde::de::Error;
17203                use std::option::Option::Some;
17204                let mut fields = std::collections::HashSet::new();
17205                let mut result = Self::Value::new();
17206                while let Some(tag) = map.next_key::<__FieldTag>()? {
17207                    #[allow(clippy::match_single_binding)]
17208                    match tag {
17209                        __FieldTag::__name => {
17210                            if !fields.insert(__FieldTag::__name) {
17211                                return std::result::Result::Err(A::Error::duplicate_field(
17212                                    "multiple values for name",
17213                                ));
17214                            }
17215                            result.name = map
17216                                .next_value::<std::option::Option<std::string::String>>()?
17217                                .unwrap_or_default();
17218                        }
17219                        __FieldTag::__spoke_uri => {
17220                            if !fields.insert(__FieldTag::__spoke_uri) {
17221                                return std::result::Result::Err(A::Error::duplicate_field(
17222                                    "multiple values for spoke_uri",
17223                                ));
17224                            }
17225                            result.spoke_uri = map
17226                                .next_value::<std::option::Option<std::string::String>>()?
17227                                .unwrap_or_default();
17228                        }
17229                        __FieldTag::__request_id => {
17230                            if !fields.insert(__FieldTag::__request_id) {
17231                                return std::result::Result::Err(A::Error::duplicate_field(
17232                                    "multiple values for request_id",
17233                                ));
17234                            }
17235                            result.request_id = map
17236                                .next_value::<std::option::Option<std::string::String>>()?
17237                                .unwrap_or_default();
17238                        }
17239                        __FieldTag::__details => {
17240                            if !fields.insert(__FieldTag::__details) {
17241                                return std::result::Result::Err(A::Error::duplicate_field(
17242                                    "multiple values for details",
17243                                ));
17244                            }
17245                            result.details = map
17246                                .next_value::<std::option::Option<std::string::String>>()?
17247                                .unwrap_or_default();
17248                        }
17249                        __FieldTag::Unknown(key) => {
17250                            let value = map.next_value::<serde_json::Value>()?;
17251                            result._unknown_fields.insert(key, value);
17252                        }
17253                    }
17254                }
17255                std::result::Result::Ok(result)
17256            }
17257        }
17258        deserializer.deserialize_any(Visitor)
17259    }
17260}
17261
17262#[doc(hidden)]
17263impl serde::ser::Serialize for RejectHubSpokeRequest {
17264    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17265    where
17266        S: serde::ser::Serializer,
17267    {
17268        use serde::ser::SerializeMap;
17269        #[allow(unused_imports)]
17270        use std::option::Option::Some;
17271        let mut state = serializer.serialize_map(std::option::Option::None)?;
17272        if !self.name.is_empty() {
17273            state.serialize_entry("name", &self.name)?;
17274        }
17275        if !self.spoke_uri.is_empty() {
17276            state.serialize_entry("spokeUri", &self.spoke_uri)?;
17277        }
17278        if !self.request_id.is_empty() {
17279            state.serialize_entry("requestId", &self.request_id)?;
17280        }
17281        if !self.details.is_empty() {
17282            state.serialize_entry("details", &self.details)?;
17283        }
17284        if !self._unknown_fields.is_empty() {
17285            for (key, value) in self._unknown_fields.iter() {
17286                state.serialize_entry(key, &value)?;
17287            }
17288        }
17289        state.end()
17290    }
17291}
17292
17293/// The response for
17294/// [HubService.RejectHubSpoke][google.cloud.networkconnectivity.v1.HubService.RejectHubSpoke].
17295///
17296/// [google.cloud.networkconnectivity.v1.HubService.RejectHubSpoke]: crate::client::HubService::reject_hub_spoke
17297#[derive(Clone, Debug, Default, PartialEq)]
17298#[non_exhaustive]
17299pub struct RejectHubSpokeResponse {
17300    /// The spoke that was operated on.
17301    pub spoke: std::option::Option<crate::model::Spoke>,
17302
17303    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17304}
17305
17306impl RejectHubSpokeResponse {
17307    pub fn new() -> Self {
17308        std::default::Default::default()
17309    }
17310
17311    /// Sets the value of [spoke][crate::model::RejectHubSpokeResponse::spoke].
17312    pub fn set_spoke<T>(mut self, v: T) -> Self
17313    where
17314        T: std::convert::Into<crate::model::Spoke>,
17315    {
17316        self.spoke = std::option::Option::Some(v.into());
17317        self
17318    }
17319
17320    /// Sets or clears the value of [spoke][crate::model::RejectHubSpokeResponse::spoke].
17321    pub fn set_or_clear_spoke<T>(mut self, v: std::option::Option<T>) -> Self
17322    where
17323        T: std::convert::Into<crate::model::Spoke>,
17324    {
17325        self.spoke = v.map(|x| x.into());
17326        self
17327    }
17328}
17329
17330impl wkt::message::Message for RejectHubSpokeResponse {
17331    fn typename() -> &'static str {
17332        "type.googleapis.com/google.cloud.networkconnectivity.v1.RejectHubSpokeResponse"
17333    }
17334}
17335
17336#[doc(hidden)]
17337impl<'de> serde::de::Deserialize<'de> for RejectHubSpokeResponse {
17338    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17339    where
17340        D: serde::Deserializer<'de>,
17341    {
17342        #[allow(non_camel_case_types)]
17343        #[doc(hidden)]
17344        #[derive(PartialEq, Eq, Hash)]
17345        enum __FieldTag {
17346            __spoke,
17347            Unknown(std::string::String),
17348        }
17349        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17350            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17351            where
17352                D: serde::Deserializer<'de>,
17353            {
17354                struct Visitor;
17355                impl<'de> serde::de::Visitor<'de> for Visitor {
17356                    type Value = __FieldTag;
17357                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17358                        formatter.write_str("a field name for RejectHubSpokeResponse")
17359                    }
17360                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17361                    where
17362                        E: serde::de::Error,
17363                    {
17364                        use std::result::Result::Ok;
17365                        use std::string::ToString;
17366                        match value {
17367                            "spoke" => Ok(__FieldTag::__spoke),
17368                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17369                        }
17370                    }
17371                }
17372                deserializer.deserialize_identifier(Visitor)
17373            }
17374        }
17375        struct Visitor;
17376        impl<'de> serde::de::Visitor<'de> for Visitor {
17377            type Value = RejectHubSpokeResponse;
17378            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17379                formatter.write_str("struct RejectHubSpokeResponse")
17380            }
17381            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17382            where
17383                A: serde::de::MapAccess<'de>,
17384            {
17385                #[allow(unused_imports)]
17386                use serde::de::Error;
17387                use std::option::Option::Some;
17388                let mut fields = std::collections::HashSet::new();
17389                let mut result = Self::Value::new();
17390                while let Some(tag) = map.next_key::<__FieldTag>()? {
17391                    #[allow(clippy::match_single_binding)]
17392                    match tag {
17393                        __FieldTag::__spoke => {
17394                            if !fields.insert(__FieldTag::__spoke) {
17395                                return std::result::Result::Err(A::Error::duplicate_field(
17396                                    "multiple values for spoke",
17397                                ));
17398                            }
17399                            result.spoke =
17400                                map.next_value::<std::option::Option<crate::model::Spoke>>()?;
17401                        }
17402                        __FieldTag::Unknown(key) => {
17403                            let value = map.next_value::<serde_json::Value>()?;
17404                            result._unknown_fields.insert(key, value);
17405                        }
17406                    }
17407                }
17408                std::result::Result::Ok(result)
17409            }
17410        }
17411        deserializer.deserialize_any(Visitor)
17412    }
17413}
17414
17415#[doc(hidden)]
17416impl serde::ser::Serialize for RejectHubSpokeResponse {
17417    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17418    where
17419        S: serde::ser::Serializer,
17420    {
17421        use serde::ser::SerializeMap;
17422        #[allow(unused_imports)]
17423        use std::option::Option::Some;
17424        let mut state = serializer.serialize_map(std::option::Option::None)?;
17425        if self.spoke.is_some() {
17426            state.serialize_entry("spoke", &self.spoke)?;
17427        }
17428        if !self._unknown_fields.is_empty() {
17429            for (key, value) in self._unknown_fields.iter() {
17430                state.serialize_entry(key, &value)?;
17431            }
17432        }
17433        state.end()
17434    }
17435}
17436
17437/// The request for
17438/// [HubService.AcceptSpokeUpdate][google.cloud.networkconnectivity.v1.HubService.AcceptSpokeUpdate].
17439///
17440/// [google.cloud.networkconnectivity.v1.HubService.AcceptSpokeUpdate]: crate::client::HubService::accept_spoke_update
17441#[derive(Clone, Debug, Default, PartialEq)]
17442#[non_exhaustive]
17443pub struct AcceptSpokeUpdateRequest {
17444    /// Required. The name of the hub to accept spoke update.
17445    pub name: std::string::String,
17446
17447    /// Required. The URI of the spoke to accept update.
17448    pub spoke_uri: std::string::String,
17449
17450    /// Required. The etag of the spoke to accept update.
17451    pub spoke_etag: std::string::String,
17452
17453    /// Optional. A request ID to identify requests. Specify a unique request ID so
17454    /// that if you must retry your request, the server knows to ignore the request
17455    /// if it has already been completed. The server guarantees that a request
17456    /// doesn't result in creation of duplicate commitments for at least 60
17457    /// minutes.
17458    ///
17459    /// For example, consider a situation where you make an initial request and
17460    /// the request times out. If you make the request again with the same request
17461    /// ID, the server can check to see whether the original operation
17462    /// was received. If it was, the server ignores the second request. This
17463    /// behavior prevents clients from mistakenly creating duplicate commitments.
17464    ///
17465    /// The request ID must be a valid UUID, with the exception that zero UUID is
17466    /// not supported (00000000-0000-0000-0000-000000000000).
17467    pub request_id: std::string::String,
17468
17469    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17470}
17471
17472impl AcceptSpokeUpdateRequest {
17473    pub fn new() -> Self {
17474        std::default::Default::default()
17475    }
17476
17477    /// Sets the value of [name][crate::model::AcceptSpokeUpdateRequest::name].
17478    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17479        self.name = v.into();
17480        self
17481    }
17482
17483    /// Sets the value of [spoke_uri][crate::model::AcceptSpokeUpdateRequest::spoke_uri].
17484    pub fn set_spoke_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17485        self.spoke_uri = v.into();
17486        self
17487    }
17488
17489    /// Sets the value of [spoke_etag][crate::model::AcceptSpokeUpdateRequest::spoke_etag].
17490    pub fn set_spoke_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17491        self.spoke_etag = v.into();
17492        self
17493    }
17494
17495    /// Sets the value of [request_id][crate::model::AcceptSpokeUpdateRequest::request_id].
17496    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17497        self.request_id = v.into();
17498        self
17499    }
17500}
17501
17502impl wkt::message::Message for AcceptSpokeUpdateRequest {
17503    fn typename() -> &'static str {
17504        "type.googleapis.com/google.cloud.networkconnectivity.v1.AcceptSpokeUpdateRequest"
17505    }
17506}
17507
17508#[doc(hidden)]
17509impl<'de> serde::de::Deserialize<'de> for AcceptSpokeUpdateRequest {
17510    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17511    where
17512        D: serde::Deserializer<'de>,
17513    {
17514        #[allow(non_camel_case_types)]
17515        #[doc(hidden)]
17516        #[derive(PartialEq, Eq, Hash)]
17517        enum __FieldTag {
17518            __name,
17519            __spoke_uri,
17520            __spoke_etag,
17521            __request_id,
17522            Unknown(std::string::String),
17523        }
17524        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17525            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17526            where
17527                D: serde::Deserializer<'de>,
17528            {
17529                struct Visitor;
17530                impl<'de> serde::de::Visitor<'de> for Visitor {
17531                    type Value = __FieldTag;
17532                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17533                        formatter.write_str("a field name for AcceptSpokeUpdateRequest")
17534                    }
17535                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17536                    where
17537                        E: serde::de::Error,
17538                    {
17539                        use std::result::Result::Ok;
17540                        use std::string::ToString;
17541                        match value {
17542                            "name" => Ok(__FieldTag::__name),
17543                            "spokeUri" => Ok(__FieldTag::__spoke_uri),
17544                            "spoke_uri" => Ok(__FieldTag::__spoke_uri),
17545                            "spokeEtag" => Ok(__FieldTag::__spoke_etag),
17546                            "spoke_etag" => Ok(__FieldTag::__spoke_etag),
17547                            "requestId" => Ok(__FieldTag::__request_id),
17548                            "request_id" => Ok(__FieldTag::__request_id),
17549                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17550                        }
17551                    }
17552                }
17553                deserializer.deserialize_identifier(Visitor)
17554            }
17555        }
17556        struct Visitor;
17557        impl<'de> serde::de::Visitor<'de> for Visitor {
17558            type Value = AcceptSpokeUpdateRequest;
17559            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17560                formatter.write_str("struct AcceptSpokeUpdateRequest")
17561            }
17562            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17563            where
17564                A: serde::de::MapAccess<'de>,
17565            {
17566                #[allow(unused_imports)]
17567                use serde::de::Error;
17568                use std::option::Option::Some;
17569                let mut fields = std::collections::HashSet::new();
17570                let mut result = Self::Value::new();
17571                while let Some(tag) = map.next_key::<__FieldTag>()? {
17572                    #[allow(clippy::match_single_binding)]
17573                    match tag {
17574                        __FieldTag::__name => {
17575                            if !fields.insert(__FieldTag::__name) {
17576                                return std::result::Result::Err(A::Error::duplicate_field(
17577                                    "multiple values for name",
17578                                ));
17579                            }
17580                            result.name = map
17581                                .next_value::<std::option::Option<std::string::String>>()?
17582                                .unwrap_or_default();
17583                        }
17584                        __FieldTag::__spoke_uri => {
17585                            if !fields.insert(__FieldTag::__spoke_uri) {
17586                                return std::result::Result::Err(A::Error::duplicate_field(
17587                                    "multiple values for spoke_uri",
17588                                ));
17589                            }
17590                            result.spoke_uri = map
17591                                .next_value::<std::option::Option<std::string::String>>()?
17592                                .unwrap_or_default();
17593                        }
17594                        __FieldTag::__spoke_etag => {
17595                            if !fields.insert(__FieldTag::__spoke_etag) {
17596                                return std::result::Result::Err(A::Error::duplicate_field(
17597                                    "multiple values for spoke_etag",
17598                                ));
17599                            }
17600                            result.spoke_etag = map
17601                                .next_value::<std::option::Option<std::string::String>>()?
17602                                .unwrap_or_default();
17603                        }
17604                        __FieldTag::__request_id => {
17605                            if !fields.insert(__FieldTag::__request_id) {
17606                                return std::result::Result::Err(A::Error::duplicate_field(
17607                                    "multiple values for request_id",
17608                                ));
17609                            }
17610                            result.request_id = map
17611                                .next_value::<std::option::Option<std::string::String>>()?
17612                                .unwrap_or_default();
17613                        }
17614                        __FieldTag::Unknown(key) => {
17615                            let value = map.next_value::<serde_json::Value>()?;
17616                            result._unknown_fields.insert(key, value);
17617                        }
17618                    }
17619                }
17620                std::result::Result::Ok(result)
17621            }
17622        }
17623        deserializer.deserialize_any(Visitor)
17624    }
17625}
17626
17627#[doc(hidden)]
17628impl serde::ser::Serialize for AcceptSpokeUpdateRequest {
17629    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17630    where
17631        S: serde::ser::Serializer,
17632    {
17633        use serde::ser::SerializeMap;
17634        #[allow(unused_imports)]
17635        use std::option::Option::Some;
17636        let mut state = serializer.serialize_map(std::option::Option::None)?;
17637        if !self.name.is_empty() {
17638            state.serialize_entry("name", &self.name)?;
17639        }
17640        if !self.spoke_uri.is_empty() {
17641            state.serialize_entry("spokeUri", &self.spoke_uri)?;
17642        }
17643        if !self.spoke_etag.is_empty() {
17644            state.serialize_entry("spokeEtag", &self.spoke_etag)?;
17645        }
17646        if !self.request_id.is_empty() {
17647            state.serialize_entry("requestId", &self.request_id)?;
17648        }
17649        if !self._unknown_fields.is_empty() {
17650            for (key, value) in self._unknown_fields.iter() {
17651                state.serialize_entry(key, &value)?;
17652            }
17653        }
17654        state.end()
17655    }
17656}
17657
17658/// The response for
17659/// [HubService.AcceptSpokeUpdate][google.cloud.networkconnectivity.v1.HubService.AcceptSpokeUpdate].
17660///
17661/// [google.cloud.networkconnectivity.v1.HubService.AcceptSpokeUpdate]: crate::client::HubService::accept_spoke_update
17662#[derive(Clone, Debug, Default, PartialEq)]
17663#[non_exhaustive]
17664pub struct AcceptSpokeUpdateResponse {
17665    /// The spoke that was operated on.
17666    pub spoke: std::option::Option<crate::model::Spoke>,
17667
17668    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17669}
17670
17671impl AcceptSpokeUpdateResponse {
17672    pub fn new() -> Self {
17673        std::default::Default::default()
17674    }
17675
17676    /// Sets the value of [spoke][crate::model::AcceptSpokeUpdateResponse::spoke].
17677    pub fn set_spoke<T>(mut self, v: T) -> Self
17678    where
17679        T: std::convert::Into<crate::model::Spoke>,
17680    {
17681        self.spoke = std::option::Option::Some(v.into());
17682        self
17683    }
17684
17685    /// Sets or clears the value of [spoke][crate::model::AcceptSpokeUpdateResponse::spoke].
17686    pub fn set_or_clear_spoke<T>(mut self, v: std::option::Option<T>) -> Self
17687    where
17688        T: std::convert::Into<crate::model::Spoke>,
17689    {
17690        self.spoke = v.map(|x| x.into());
17691        self
17692    }
17693}
17694
17695impl wkt::message::Message for AcceptSpokeUpdateResponse {
17696    fn typename() -> &'static str {
17697        "type.googleapis.com/google.cloud.networkconnectivity.v1.AcceptSpokeUpdateResponse"
17698    }
17699}
17700
17701#[doc(hidden)]
17702impl<'de> serde::de::Deserialize<'de> for AcceptSpokeUpdateResponse {
17703    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17704    where
17705        D: serde::Deserializer<'de>,
17706    {
17707        #[allow(non_camel_case_types)]
17708        #[doc(hidden)]
17709        #[derive(PartialEq, Eq, Hash)]
17710        enum __FieldTag {
17711            __spoke,
17712            Unknown(std::string::String),
17713        }
17714        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17715            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17716            where
17717                D: serde::Deserializer<'de>,
17718            {
17719                struct Visitor;
17720                impl<'de> serde::de::Visitor<'de> for Visitor {
17721                    type Value = __FieldTag;
17722                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17723                        formatter.write_str("a field name for AcceptSpokeUpdateResponse")
17724                    }
17725                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17726                    where
17727                        E: serde::de::Error,
17728                    {
17729                        use std::result::Result::Ok;
17730                        use std::string::ToString;
17731                        match value {
17732                            "spoke" => Ok(__FieldTag::__spoke),
17733                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17734                        }
17735                    }
17736                }
17737                deserializer.deserialize_identifier(Visitor)
17738            }
17739        }
17740        struct Visitor;
17741        impl<'de> serde::de::Visitor<'de> for Visitor {
17742            type Value = AcceptSpokeUpdateResponse;
17743            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17744                formatter.write_str("struct AcceptSpokeUpdateResponse")
17745            }
17746            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17747            where
17748                A: serde::de::MapAccess<'de>,
17749            {
17750                #[allow(unused_imports)]
17751                use serde::de::Error;
17752                use std::option::Option::Some;
17753                let mut fields = std::collections::HashSet::new();
17754                let mut result = Self::Value::new();
17755                while let Some(tag) = map.next_key::<__FieldTag>()? {
17756                    #[allow(clippy::match_single_binding)]
17757                    match tag {
17758                        __FieldTag::__spoke => {
17759                            if !fields.insert(__FieldTag::__spoke) {
17760                                return std::result::Result::Err(A::Error::duplicate_field(
17761                                    "multiple values for spoke",
17762                                ));
17763                            }
17764                            result.spoke =
17765                                map.next_value::<std::option::Option<crate::model::Spoke>>()?;
17766                        }
17767                        __FieldTag::Unknown(key) => {
17768                            let value = map.next_value::<serde_json::Value>()?;
17769                            result._unknown_fields.insert(key, value);
17770                        }
17771                    }
17772                }
17773                std::result::Result::Ok(result)
17774            }
17775        }
17776        deserializer.deserialize_any(Visitor)
17777    }
17778}
17779
17780#[doc(hidden)]
17781impl serde::ser::Serialize for AcceptSpokeUpdateResponse {
17782    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17783    where
17784        S: serde::ser::Serializer,
17785    {
17786        use serde::ser::SerializeMap;
17787        #[allow(unused_imports)]
17788        use std::option::Option::Some;
17789        let mut state = serializer.serialize_map(std::option::Option::None)?;
17790        if self.spoke.is_some() {
17791            state.serialize_entry("spoke", &self.spoke)?;
17792        }
17793        if !self._unknown_fields.is_empty() {
17794            for (key, value) in self._unknown_fields.iter() {
17795                state.serialize_entry(key, &value)?;
17796            }
17797        }
17798        state.end()
17799    }
17800}
17801
17802/// The request for
17803/// [HubService.RejectSpokeUpdate][google.cloud.networkconnectivity.v1.HubService.RejectSpokeUpdate].
17804///
17805/// [google.cloud.networkconnectivity.v1.HubService.RejectSpokeUpdate]: crate::client::HubService::reject_spoke_update
17806#[derive(Clone, Debug, Default, PartialEq)]
17807#[non_exhaustive]
17808pub struct RejectSpokeUpdateRequest {
17809    /// Required. The name of the hub to reject spoke update.
17810    pub name: std::string::String,
17811
17812    /// Required. The URI of the spoke to reject update.
17813    pub spoke_uri: std::string::String,
17814
17815    /// Required. The etag of the spoke to reject update.
17816    pub spoke_etag: std::string::String,
17817
17818    /// Optional. Additional information provided by the hub administrator.
17819    pub details: std::string::String,
17820
17821    /// Optional. A request ID to identify requests. Specify a unique request ID so
17822    /// that if you must retry your request, the server knows to ignore the request
17823    /// if it has already been completed. The server guarantees that a request
17824    /// doesn't result in creation of duplicate commitments for at least 60
17825    /// minutes.
17826    ///
17827    /// For example, consider a situation where you make an initial request and
17828    /// the request times out. If you make the request again with the same request
17829    /// ID, the server can check to see whether the original operation
17830    /// was received. If it was, the server ignores the second request. This
17831    /// behavior prevents clients from mistakenly creating duplicate commitments.
17832    ///
17833    /// The request ID must be a valid UUID, with the exception that zero UUID is
17834    /// not supported (00000000-0000-0000-0000-000000000000).
17835    pub request_id: std::string::String,
17836
17837    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17838}
17839
17840impl RejectSpokeUpdateRequest {
17841    pub fn new() -> Self {
17842        std::default::Default::default()
17843    }
17844
17845    /// Sets the value of [name][crate::model::RejectSpokeUpdateRequest::name].
17846    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17847        self.name = v.into();
17848        self
17849    }
17850
17851    /// Sets the value of [spoke_uri][crate::model::RejectSpokeUpdateRequest::spoke_uri].
17852    pub fn set_spoke_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17853        self.spoke_uri = v.into();
17854        self
17855    }
17856
17857    /// Sets the value of [spoke_etag][crate::model::RejectSpokeUpdateRequest::spoke_etag].
17858    pub fn set_spoke_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17859        self.spoke_etag = v.into();
17860        self
17861    }
17862
17863    /// Sets the value of [details][crate::model::RejectSpokeUpdateRequest::details].
17864    pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17865        self.details = v.into();
17866        self
17867    }
17868
17869    /// Sets the value of [request_id][crate::model::RejectSpokeUpdateRequest::request_id].
17870    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17871        self.request_id = v.into();
17872        self
17873    }
17874}
17875
17876impl wkt::message::Message for RejectSpokeUpdateRequest {
17877    fn typename() -> &'static str {
17878        "type.googleapis.com/google.cloud.networkconnectivity.v1.RejectSpokeUpdateRequest"
17879    }
17880}
17881
17882#[doc(hidden)]
17883impl<'de> serde::de::Deserialize<'de> for RejectSpokeUpdateRequest {
17884    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17885    where
17886        D: serde::Deserializer<'de>,
17887    {
17888        #[allow(non_camel_case_types)]
17889        #[doc(hidden)]
17890        #[derive(PartialEq, Eq, Hash)]
17891        enum __FieldTag {
17892            __name,
17893            __spoke_uri,
17894            __spoke_etag,
17895            __details,
17896            __request_id,
17897            Unknown(std::string::String),
17898        }
17899        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17900            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17901            where
17902                D: serde::Deserializer<'de>,
17903            {
17904                struct Visitor;
17905                impl<'de> serde::de::Visitor<'de> for Visitor {
17906                    type Value = __FieldTag;
17907                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17908                        formatter.write_str("a field name for RejectSpokeUpdateRequest")
17909                    }
17910                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17911                    where
17912                        E: serde::de::Error,
17913                    {
17914                        use std::result::Result::Ok;
17915                        use std::string::ToString;
17916                        match value {
17917                            "name" => Ok(__FieldTag::__name),
17918                            "spokeUri" => Ok(__FieldTag::__spoke_uri),
17919                            "spoke_uri" => Ok(__FieldTag::__spoke_uri),
17920                            "spokeEtag" => Ok(__FieldTag::__spoke_etag),
17921                            "spoke_etag" => Ok(__FieldTag::__spoke_etag),
17922                            "details" => Ok(__FieldTag::__details),
17923                            "requestId" => Ok(__FieldTag::__request_id),
17924                            "request_id" => Ok(__FieldTag::__request_id),
17925                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17926                        }
17927                    }
17928                }
17929                deserializer.deserialize_identifier(Visitor)
17930            }
17931        }
17932        struct Visitor;
17933        impl<'de> serde::de::Visitor<'de> for Visitor {
17934            type Value = RejectSpokeUpdateRequest;
17935            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17936                formatter.write_str("struct RejectSpokeUpdateRequest")
17937            }
17938            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17939            where
17940                A: serde::de::MapAccess<'de>,
17941            {
17942                #[allow(unused_imports)]
17943                use serde::de::Error;
17944                use std::option::Option::Some;
17945                let mut fields = std::collections::HashSet::new();
17946                let mut result = Self::Value::new();
17947                while let Some(tag) = map.next_key::<__FieldTag>()? {
17948                    #[allow(clippy::match_single_binding)]
17949                    match tag {
17950                        __FieldTag::__name => {
17951                            if !fields.insert(__FieldTag::__name) {
17952                                return std::result::Result::Err(A::Error::duplicate_field(
17953                                    "multiple values for name",
17954                                ));
17955                            }
17956                            result.name = map
17957                                .next_value::<std::option::Option<std::string::String>>()?
17958                                .unwrap_or_default();
17959                        }
17960                        __FieldTag::__spoke_uri => {
17961                            if !fields.insert(__FieldTag::__spoke_uri) {
17962                                return std::result::Result::Err(A::Error::duplicate_field(
17963                                    "multiple values for spoke_uri",
17964                                ));
17965                            }
17966                            result.spoke_uri = map
17967                                .next_value::<std::option::Option<std::string::String>>()?
17968                                .unwrap_or_default();
17969                        }
17970                        __FieldTag::__spoke_etag => {
17971                            if !fields.insert(__FieldTag::__spoke_etag) {
17972                                return std::result::Result::Err(A::Error::duplicate_field(
17973                                    "multiple values for spoke_etag",
17974                                ));
17975                            }
17976                            result.spoke_etag = map
17977                                .next_value::<std::option::Option<std::string::String>>()?
17978                                .unwrap_or_default();
17979                        }
17980                        __FieldTag::__details => {
17981                            if !fields.insert(__FieldTag::__details) {
17982                                return std::result::Result::Err(A::Error::duplicate_field(
17983                                    "multiple values for details",
17984                                ));
17985                            }
17986                            result.details = map
17987                                .next_value::<std::option::Option<std::string::String>>()?
17988                                .unwrap_or_default();
17989                        }
17990                        __FieldTag::__request_id => {
17991                            if !fields.insert(__FieldTag::__request_id) {
17992                                return std::result::Result::Err(A::Error::duplicate_field(
17993                                    "multiple values for request_id",
17994                                ));
17995                            }
17996                            result.request_id = map
17997                                .next_value::<std::option::Option<std::string::String>>()?
17998                                .unwrap_or_default();
17999                        }
18000                        __FieldTag::Unknown(key) => {
18001                            let value = map.next_value::<serde_json::Value>()?;
18002                            result._unknown_fields.insert(key, value);
18003                        }
18004                    }
18005                }
18006                std::result::Result::Ok(result)
18007            }
18008        }
18009        deserializer.deserialize_any(Visitor)
18010    }
18011}
18012
18013#[doc(hidden)]
18014impl serde::ser::Serialize for RejectSpokeUpdateRequest {
18015    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18016    where
18017        S: serde::ser::Serializer,
18018    {
18019        use serde::ser::SerializeMap;
18020        #[allow(unused_imports)]
18021        use std::option::Option::Some;
18022        let mut state = serializer.serialize_map(std::option::Option::None)?;
18023        if !self.name.is_empty() {
18024            state.serialize_entry("name", &self.name)?;
18025        }
18026        if !self.spoke_uri.is_empty() {
18027            state.serialize_entry("spokeUri", &self.spoke_uri)?;
18028        }
18029        if !self.spoke_etag.is_empty() {
18030            state.serialize_entry("spokeEtag", &self.spoke_etag)?;
18031        }
18032        if !self.details.is_empty() {
18033            state.serialize_entry("details", &self.details)?;
18034        }
18035        if !self.request_id.is_empty() {
18036            state.serialize_entry("requestId", &self.request_id)?;
18037        }
18038        if !self._unknown_fields.is_empty() {
18039            for (key, value) in self._unknown_fields.iter() {
18040                state.serialize_entry(key, &value)?;
18041            }
18042        }
18043        state.end()
18044    }
18045}
18046
18047/// The response for
18048/// [HubService.RejectSpokeUpdate][google.cloud.networkconnectivity.v1.HubService.RejectSpokeUpdate].
18049///
18050/// [google.cloud.networkconnectivity.v1.HubService.RejectSpokeUpdate]: crate::client::HubService::reject_spoke_update
18051#[derive(Clone, Debug, Default, PartialEq)]
18052#[non_exhaustive]
18053pub struct RejectSpokeUpdateResponse {
18054    /// The spoke that was operated on.
18055    pub spoke: std::option::Option<crate::model::Spoke>,
18056
18057    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18058}
18059
18060impl RejectSpokeUpdateResponse {
18061    pub fn new() -> Self {
18062        std::default::Default::default()
18063    }
18064
18065    /// Sets the value of [spoke][crate::model::RejectSpokeUpdateResponse::spoke].
18066    pub fn set_spoke<T>(mut self, v: T) -> Self
18067    where
18068        T: std::convert::Into<crate::model::Spoke>,
18069    {
18070        self.spoke = std::option::Option::Some(v.into());
18071        self
18072    }
18073
18074    /// Sets or clears the value of [spoke][crate::model::RejectSpokeUpdateResponse::spoke].
18075    pub fn set_or_clear_spoke<T>(mut self, v: std::option::Option<T>) -> Self
18076    where
18077        T: std::convert::Into<crate::model::Spoke>,
18078    {
18079        self.spoke = v.map(|x| x.into());
18080        self
18081    }
18082}
18083
18084impl wkt::message::Message for RejectSpokeUpdateResponse {
18085    fn typename() -> &'static str {
18086        "type.googleapis.com/google.cloud.networkconnectivity.v1.RejectSpokeUpdateResponse"
18087    }
18088}
18089
18090#[doc(hidden)]
18091impl<'de> serde::de::Deserialize<'de> for RejectSpokeUpdateResponse {
18092    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18093    where
18094        D: serde::Deserializer<'de>,
18095    {
18096        #[allow(non_camel_case_types)]
18097        #[doc(hidden)]
18098        #[derive(PartialEq, Eq, Hash)]
18099        enum __FieldTag {
18100            __spoke,
18101            Unknown(std::string::String),
18102        }
18103        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18104            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18105            where
18106                D: serde::Deserializer<'de>,
18107            {
18108                struct Visitor;
18109                impl<'de> serde::de::Visitor<'de> for Visitor {
18110                    type Value = __FieldTag;
18111                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18112                        formatter.write_str("a field name for RejectSpokeUpdateResponse")
18113                    }
18114                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18115                    where
18116                        E: serde::de::Error,
18117                    {
18118                        use std::result::Result::Ok;
18119                        use std::string::ToString;
18120                        match value {
18121                            "spoke" => Ok(__FieldTag::__spoke),
18122                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18123                        }
18124                    }
18125                }
18126                deserializer.deserialize_identifier(Visitor)
18127            }
18128        }
18129        struct Visitor;
18130        impl<'de> serde::de::Visitor<'de> for Visitor {
18131            type Value = RejectSpokeUpdateResponse;
18132            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18133                formatter.write_str("struct RejectSpokeUpdateResponse")
18134            }
18135            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18136            where
18137                A: serde::de::MapAccess<'de>,
18138            {
18139                #[allow(unused_imports)]
18140                use serde::de::Error;
18141                use std::option::Option::Some;
18142                let mut fields = std::collections::HashSet::new();
18143                let mut result = Self::Value::new();
18144                while let Some(tag) = map.next_key::<__FieldTag>()? {
18145                    #[allow(clippy::match_single_binding)]
18146                    match tag {
18147                        __FieldTag::__spoke => {
18148                            if !fields.insert(__FieldTag::__spoke) {
18149                                return std::result::Result::Err(A::Error::duplicate_field(
18150                                    "multiple values for spoke",
18151                                ));
18152                            }
18153                            result.spoke =
18154                                map.next_value::<std::option::Option<crate::model::Spoke>>()?;
18155                        }
18156                        __FieldTag::Unknown(key) => {
18157                            let value = map.next_value::<serde_json::Value>()?;
18158                            result._unknown_fields.insert(key, value);
18159                        }
18160                    }
18161                }
18162                std::result::Result::Ok(result)
18163            }
18164        }
18165        deserializer.deserialize_any(Visitor)
18166    }
18167}
18168
18169#[doc(hidden)]
18170impl serde::ser::Serialize for RejectSpokeUpdateResponse {
18171    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18172    where
18173        S: serde::ser::Serializer,
18174    {
18175        use serde::ser::SerializeMap;
18176        #[allow(unused_imports)]
18177        use std::option::Option::Some;
18178        let mut state = serializer.serialize_map(std::option::Option::None)?;
18179        if self.spoke.is_some() {
18180            state.serialize_entry("spoke", &self.spoke)?;
18181        }
18182        if !self._unknown_fields.is_empty() {
18183            for (key, value) in self._unknown_fields.iter() {
18184                state.serialize_entry(key, &value)?;
18185            }
18186        }
18187        state.end()
18188    }
18189}
18190
18191/// The request for
18192/// [HubService.GetRouteTable][google.cloud.networkconnectivity.v1.HubService.GetRouteTable].
18193///
18194/// [google.cloud.networkconnectivity.v1.HubService.GetRouteTable]: crate::client::HubService::get_route_table
18195#[derive(Clone, Debug, Default, PartialEq)]
18196#[non_exhaustive]
18197pub struct GetRouteTableRequest {
18198    /// Required. The name of the route table resource.
18199    pub name: std::string::String,
18200
18201    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18202}
18203
18204impl GetRouteTableRequest {
18205    pub fn new() -> Self {
18206        std::default::Default::default()
18207    }
18208
18209    /// Sets the value of [name][crate::model::GetRouteTableRequest::name].
18210    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18211        self.name = v.into();
18212        self
18213    }
18214}
18215
18216impl wkt::message::Message for GetRouteTableRequest {
18217    fn typename() -> &'static str {
18218        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetRouteTableRequest"
18219    }
18220}
18221
18222#[doc(hidden)]
18223impl<'de> serde::de::Deserialize<'de> for GetRouteTableRequest {
18224    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18225    where
18226        D: serde::Deserializer<'de>,
18227    {
18228        #[allow(non_camel_case_types)]
18229        #[doc(hidden)]
18230        #[derive(PartialEq, Eq, Hash)]
18231        enum __FieldTag {
18232            __name,
18233            Unknown(std::string::String),
18234        }
18235        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18236            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18237            where
18238                D: serde::Deserializer<'de>,
18239            {
18240                struct Visitor;
18241                impl<'de> serde::de::Visitor<'de> for Visitor {
18242                    type Value = __FieldTag;
18243                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18244                        formatter.write_str("a field name for GetRouteTableRequest")
18245                    }
18246                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18247                    where
18248                        E: serde::de::Error,
18249                    {
18250                        use std::result::Result::Ok;
18251                        use std::string::ToString;
18252                        match value {
18253                            "name" => Ok(__FieldTag::__name),
18254                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18255                        }
18256                    }
18257                }
18258                deserializer.deserialize_identifier(Visitor)
18259            }
18260        }
18261        struct Visitor;
18262        impl<'de> serde::de::Visitor<'de> for Visitor {
18263            type Value = GetRouteTableRequest;
18264            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18265                formatter.write_str("struct GetRouteTableRequest")
18266            }
18267            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18268            where
18269                A: serde::de::MapAccess<'de>,
18270            {
18271                #[allow(unused_imports)]
18272                use serde::de::Error;
18273                use std::option::Option::Some;
18274                let mut fields = std::collections::HashSet::new();
18275                let mut result = Self::Value::new();
18276                while let Some(tag) = map.next_key::<__FieldTag>()? {
18277                    #[allow(clippy::match_single_binding)]
18278                    match tag {
18279                        __FieldTag::__name => {
18280                            if !fields.insert(__FieldTag::__name) {
18281                                return std::result::Result::Err(A::Error::duplicate_field(
18282                                    "multiple values for name",
18283                                ));
18284                            }
18285                            result.name = map
18286                                .next_value::<std::option::Option<std::string::String>>()?
18287                                .unwrap_or_default();
18288                        }
18289                        __FieldTag::Unknown(key) => {
18290                            let value = map.next_value::<serde_json::Value>()?;
18291                            result._unknown_fields.insert(key, value);
18292                        }
18293                    }
18294                }
18295                std::result::Result::Ok(result)
18296            }
18297        }
18298        deserializer.deserialize_any(Visitor)
18299    }
18300}
18301
18302#[doc(hidden)]
18303impl serde::ser::Serialize for GetRouteTableRequest {
18304    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18305    where
18306        S: serde::ser::Serializer,
18307    {
18308        use serde::ser::SerializeMap;
18309        #[allow(unused_imports)]
18310        use std::option::Option::Some;
18311        let mut state = serializer.serialize_map(std::option::Option::None)?;
18312        if !self.name.is_empty() {
18313            state.serialize_entry("name", &self.name)?;
18314        }
18315        if !self._unknown_fields.is_empty() {
18316            for (key, value) in self._unknown_fields.iter() {
18317                state.serialize_entry(key, &value)?;
18318            }
18319        }
18320        state.end()
18321    }
18322}
18323
18324/// The request for
18325/// [HubService.GetRoute][google.cloud.networkconnectivity.v1.HubService.GetRoute].
18326///
18327/// [google.cloud.networkconnectivity.v1.HubService.GetRoute]: crate::client::HubService::get_route
18328#[derive(Clone, Debug, Default, PartialEq)]
18329#[non_exhaustive]
18330pub struct GetRouteRequest {
18331    /// Required. The name of the route resource.
18332    pub name: std::string::String,
18333
18334    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18335}
18336
18337impl GetRouteRequest {
18338    pub fn new() -> Self {
18339        std::default::Default::default()
18340    }
18341
18342    /// Sets the value of [name][crate::model::GetRouteRequest::name].
18343    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18344        self.name = v.into();
18345        self
18346    }
18347}
18348
18349impl wkt::message::Message for GetRouteRequest {
18350    fn typename() -> &'static str {
18351        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetRouteRequest"
18352    }
18353}
18354
18355#[doc(hidden)]
18356impl<'de> serde::de::Deserialize<'de> for GetRouteRequest {
18357    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18358    where
18359        D: serde::Deserializer<'de>,
18360    {
18361        #[allow(non_camel_case_types)]
18362        #[doc(hidden)]
18363        #[derive(PartialEq, Eq, Hash)]
18364        enum __FieldTag {
18365            __name,
18366            Unknown(std::string::String),
18367        }
18368        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18369            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18370            where
18371                D: serde::Deserializer<'de>,
18372            {
18373                struct Visitor;
18374                impl<'de> serde::de::Visitor<'de> for Visitor {
18375                    type Value = __FieldTag;
18376                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18377                        formatter.write_str("a field name for GetRouteRequest")
18378                    }
18379                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18380                    where
18381                        E: serde::de::Error,
18382                    {
18383                        use std::result::Result::Ok;
18384                        use std::string::ToString;
18385                        match value {
18386                            "name" => Ok(__FieldTag::__name),
18387                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18388                        }
18389                    }
18390                }
18391                deserializer.deserialize_identifier(Visitor)
18392            }
18393        }
18394        struct Visitor;
18395        impl<'de> serde::de::Visitor<'de> for Visitor {
18396            type Value = GetRouteRequest;
18397            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18398                formatter.write_str("struct GetRouteRequest")
18399            }
18400            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18401            where
18402                A: serde::de::MapAccess<'de>,
18403            {
18404                #[allow(unused_imports)]
18405                use serde::de::Error;
18406                use std::option::Option::Some;
18407                let mut fields = std::collections::HashSet::new();
18408                let mut result = Self::Value::new();
18409                while let Some(tag) = map.next_key::<__FieldTag>()? {
18410                    #[allow(clippy::match_single_binding)]
18411                    match tag {
18412                        __FieldTag::__name => {
18413                            if !fields.insert(__FieldTag::__name) {
18414                                return std::result::Result::Err(A::Error::duplicate_field(
18415                                    "multiple values for name",
18416                                ));
18417                            }
18418                            result.name = map
18419                                .next_value::<std::option::Option<std::string::String>>()?
18420                                .unwrap_or_default();
18421                        }
18422                        __FieldTag::Unknown(key) => {
18423                            let value = map.next_value::<serde_json::Value>()?;
18424                            result._unknown_fields.insert(key, value);
18425                        }
18426                    }
18427                }
18428                std::result::Result::Ok(result)
18429            }
18430        }
18431        deserializer.deserialize_any(Visitor)
18432    }
18433}
18434
18435#[doc(hidden)]
18436impl serde::ser::Serialize for GetRouteRequest {
18437    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18438    where
18439        S: serde::ser::Serializer,
18440    {
18441        use serde::ser::SerializeMap;
18442        #[allow(unused_imports)]
18443        use std::option::Option::Some;
18444        let mut state = serializer.serialize_map(std::option::Option::None)?;
18445        if !self.name.is_empty() {
18446            state.serialize_entry("name", &self.name)?;
18447        }
18448        if !self._unknown_fields.is_empty() {
18449            for (key, value) in self._unknown_fields.iter() {
18450                state.serialize_entry(key, &value)?;
18451            }
18452        }
18453        state.end()
18454    }
18455}
18456
18457/// Request for
18458/// [HubService.ListRoutes][google.cloud.networkconnectivity.v1.HubService.ListRoutes]
18459/// method.
18460///
18461/// [google.cloud.networkconnectivity.v1.HubService.ListRoutes]: crate::client::HubService::list_routes
18462#[derive(Clone, Debug, Default, PartialEq)]
18463#[non_exhaustive]
18464pub struct ListRoutesRequest {
18465    /// Required. The parent resource's name.
18466    pub parent: std::string::String,
18467
18468    /// The maximum number of results to return per page.
18469    pub page_size: i32,
18470
18471    /// The page token.
18472    pub page_token: std::string::String,
18473
18474    /// An expression that filters the list of results.
18475    pub filter: std::string::String,
18476
18477    /// Sort the results by a certain order.
18478    pub order_by: std::string::String,
18479
18480    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18481}
18482
18483impl ListRoutesRequest {
18484    pub fn new() -> Self {
18485        std::default::Default::default()
18486    }
18487
18488    /// Sets the value of [parent][crate::model::ListRoutesRequest::parent].
18489    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18490        self.parent = v.into();
18491        self
18492    }
18493
18494    /// Sets the value of [page_size][crate::model::ListRoutesRequest::page_size].
18495    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
18496        self.page_size = v.into();
18497        self
18498    }
18499
18500    /// Sets the value of [page_token][crate::model::ListRoutesRequest::page_token].
18501    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18502        self.page_token = v.into();
18503        self
18504    }
18505
18506    /// Sets the value of [filter][crate::model::ListRoutesRequest::filter].
18507    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18508        self.filter = v.into();
18509        self
18510    }
18511
18512    /// Sets the value of [order_by][crate::model::ListRoutesRequest::order_by].
18513    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18514        self.order_by = v.into();
18515        self
18516    }
18517}
18518
18519impl wkt::message::Message for ListRoutesRequest {
18520    fn typename() -> &'static str {
18521        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListRoutesRequest"
18522    }
18523}
18524
18525#[doc(hidden)]
18526impl<'de> serde::de::Deserialize<'de> for ListRoutesRequest {
18527    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18528    where
18529        D: serde::Deserializer<'de>,
18530    {
18531        #[allow(non_camel_case_types)]
18532        #[doc(hidden)]
18533        #[derive(PartialEq, Eq, Hash)]
18534        enum __FieldTag {
18535            __parent,
18536            __page_size,
18537            __page_token,
18538            __filter,
18539            __order_by,
18540            Unknown(std::string::String),
18541        }
18542        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18543            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18544            where
18545                D: serde::Deserializer<'de>,
18546            {
18547                struct Visitor;
18548                impl<'de> serde::de::Visitor<'de> for Visitor {
18549                    type Value = __FieldTag;
18550                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18551                        formatter.write_str("a field name for ListRoutesRequest")
18552                    }
18553                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18554                    where
18555                        E: serde::de::Error,
18556                    {
18557                        use std::result::Result::Ok;
18558                        use std::string::ToString;
18559                        match value {
18560                            "parent" => Ok(__FieldTag::__parent),
18561                            "pageSize" => Ok(__FieldTag::__page_size),
18562                            "page_size" => Ok(__FieldTag::__page_size),
18563                            "pageToken" => Ok(__FieldTag::__page_token),
18564                            "page_token" => Ok(__FieldTag::__page_token),
18565                            "filter" => Ok(__FieldTag::__filter),
18566                            "orderBy" => Ok(__FieldTag::__order_by),
18567                            "order_by" => Ok(__FieldTag::__order_by),
18568                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18569                        }
18570                    }
18571                }
18572                deserializer.deserialize_identifier(Visitor)
18573            }
18574        }
18575        struct Visitor;
18576        impl<'de> serde::de::Visitor<'de> for Visitor {
18577            type Value = ListRoutesRequest;
18578            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18579                formatter.write_str("struct ListRoutesRequest")
18580            }
18581            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18582            where
18583                A: serde::de::MapAccess<'de>,
18584            {
18585                #[allow(unused_imports)]
18586                use serde::de::Error;
18587                use std::option::Option::Some;
18588                let mut fields = std::collections::HashSet::new();
18589                let mut result = Self::Value::new();
18590                while let Some(tag) = map.next_key::<__FieldTag>()? {
18591                    #[allow(clippy::match_single_binding)]
18592                    match tag {
18593                        __FieldTag::__parent => {
18594                            if !fields.insert(__FieldTag::__parent) {
18595                                return std::result::Result::Err(A::Error::duplicate_field(
18596                                    "multiple values for parent",
18597                                ));
18598                            }
18599                            result.parent = map
18600                                .next_value::<std::option::Option<std::string::String>>()?
18601                                .unwrap_or_default();
18602                        }
18603                        __FieldTag::__page_size => {
18604                            if !fields.insert(__FieldTag::__page_size) {
18605                                return std::result::Result::Err(A::Error::duplicate_field(
18606                                    "multiple values for page_size",
18607                                ));
18608                            }
18609                            struct __With(std::option::Option<i32>);
18610                            impl<'de> serde::de::Deserialize<'de> for __With {
18611                                fn deserialize<D>(
18612                                    deserializer: D,
18613                                ) -> std::result::Result<Self, D::Error>
18614                                where
18615                                    D: serde::de::Deserializer<'de>,
18616                                {
18617                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
18618                                }
18619                            }
18620                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
18621                        }
18622                        __FieldTag::__page_token => {
18623                            if !fields.insert(__FieldTag::__page_token) {
18624                                return std::result::Result::Err(A::Error::duplicate_field(
18625                                    "multiple values for page_token",
18626                                ));
18627                            }
18628                            result.page_token = map
18629                                .next_value::<std::option::Option<std::string::String>>()?
18630                                .unwrap_or_default();
18631                        }
18632                        __FieldTag::__filter => {
18633                            if !fields.insert(__FieldTag::__filter) {
18634                                return std::result::Result::Err(A::Error::duplicate_field(
18635                                    "multiple values for filter",
18636                                ));
18637                            }
18638                            result.filter = map
18639                                .next_value::<std::option::Option<std::string::String>>()?
18640                                .unwrap_or_default();
18641                        }
18642                        __FieldTag::__order_by => {
18643                            if !fields.insert(__FieldTag::__order_by) {
18644                                return std::result::Result::Err(A::Error::duplicate_field(
18645                                    "multiple values for order_by",
18646                                ));
18647                            }
18648                            result.order_by = map
18649                                .next_value::<std::option::Option<std::string::String>>()?
18650                                .unwrap_or_default();
18651                        }
18652                        __FieldTag::Unknown(key) => {
18653                            let value = map.next_value::<serde_json::Value>()?;
18654                            result._unknown_fields.insert(key, value);
18655                        }
18656                    }
18657                }
18658                std::result::Result::Ok(result)
18659            }
18660        }
18661        deserializer.deserialize_any(Visitor)
18662    }
18663}
18664
18665#[doc(hidden)]
18666impl serde::ser::Serialize for ListRoutesRequest {
18667    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18668    where
18669        S: serde::ser::Serializer,
18670    {
18671        use serde::ser::SerializeMap;
18672        #[allow(unused_imports)]
18673        use std::option::Option::Some;
18674        let mut state = serializer.serialize_map(std::option::Option::None)?;
18675        if !self.parent.is_empty() {
18676            state.serialize_entry("parent", &self.parent)?;
18677        }
18678        if !wkt::internal::is_default(&self.page_size) {
18679            struct __With<'a>(&'a i32);
18680            impl<'a> serde::ser::Serialize for __With<'a> {
18681                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18682                where
18683                    S: serde::ser::Serializer,
18684                {
18685                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
18686                }
18687            }
18688            state.serialize_entry("pageSize", &__With(&self.page_size))?;
18689        }
18690        if !self.page_token.is_empty() {
18691            state.serialize_entry("pageToken", &self.page_token)?;
18692        }
18693        if !self.filter.is_empty() {
18694            state.serialize_entry("filter", &self.filter)?;
18695        }
18696        if !self.order_by.is_empty() {
18697            state.serialize_entry("orderBy", &self.order_by)?;
18698        }
18699        if !self._unknown_fields.is_empty() {
18700            for (key, value) in self._unknown_fields.iter() {
18701                state.serialize_entry(key, &value)?;
18702            }
18703        }
18704        state.end()
18705    }
18706}
18707
18708/// Response for
18709/// [HubService.ListRoutes][google.cloud.networkconnectivity.v1.HubService.ListRoutes]
18710/// method.
18711///
18712/// [google.cloud.networkconnectivity.v1.HubService.ListRoutes]: crate::client::HubService::list_routes
18713#[derive(Clone, Debug, Default, PartialEq)]
18714#[non_exhaustive]
18715pub struct ListRoutesResponse {
18716    /// The requested routes.
18717    pub routes: std::vec::Vec<crate::model::Route>,
18718
18719    /// The token for the next page of the response. To see more results,
18720    /// use this value as the page_token for your next request. If this value
18721    /// is empty, there are no more results.
18722    pub next_page_token: std::string::String,
18723
18724    /// RouteTables that could not be reached.
18725    pub unreachable: std::vec::Vec<std::string::String>,
18726
18727    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18728}
18729
18730impl ListRoutesResponse {
18731    pub fn new() -> Self {
18732        std::default::Default::default()
18733    }
18734
18735    /// Sets the value of [routes][crate::model::ListRoutesResponse::routes].
18736    pub fn set_routes<T, V>(mut self, v: T) -> Self
18737    where
18738        T: std::iter::IntoIterator<Item = V>,
18739        V: std::convert::Into<crate::model::Route>,
18740    {
18741        use std::iter::Iterator;
18742        self.routes = v.into_iter().map(|i| i.into()).collect();
18743        self
18744    }
18745
18746    /// Sets the value of [next_page_token][crate::model::ListRoutesResponse::next_page_token].
18747    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18748        self.next_page_token = v.into();
18749        self
18750    }
18751
18752    /// Sets the value of [unreachable][crate::model::ListRoutesResponse::unreachable].
18753    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
18754    where
18755        T: std::iter::IntoIterator<Item = V>,
18756        V: std::convert::Into<std::string::String>,
18757    {
18758        use std::iter::Iterator;
18759        self.unreachable = v.into_iter().map(|i| i.into()).collect();
18760        self
18761    }
18762}
18763
18764impl wkt::message::Message for ListRoutesResponse {
18765    fn typename() -> &'static str {
18766        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListRoutesResponse"
18767    }
18768}
18769
18770#[doc(hidden)]
18771impl gax::paginator::internal::PageableResponse for ListRoutesResponse {
18772    type PageItem = crate::model::Route;
18773
18774    fn items(self) -> std::vec::Vec<Self::PageItem> {
18775        self.routes
18776    }
18777
18778    fn next_page_token(&self) -> std::string::String {
18779        use std::clone::Clone;
18780        self.next_page_token.clone()
18781    }
18782}
18783
18784#[doc(hidden)]
18785impl<'de> serde::de::Deserialize<'de> for ListRoutesResponse {
18786    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18787    where
18788        D: serde::Deserializer<'de>,
18789    {
18790        #[allow(non_camel_case_types)]
18791        #[doc(hidden)]
18792        #[derive(PartialEq, Eq, Hash)]
18793        enum __FieldTag {
18794            __routes,
18795            __next_page_token,
18796            __unreachable,
18797            Unknown(std::string::String),
18798        }
18799        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18800            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18801            where
18802                D: serde::Deserializer<'de>,
18803            {
18804                struct Visitor;
18805                impl<'de> serde::de::Visitor<'de> for Visitor {
18806                    type Value = __FieldTag;
18807                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18808                        formatter.write_str("a field name for ListRoutesResponse")
18809                    }
18810                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18811                    where
18812                        E: serde::de::Error,
18813                    {
18814                        use std::result::Result::Ok;
18815                        use std::string::ToString;
18816                        match value {
18817                            "routes" => Ok(__FieldTag::__routes),
18818                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
18819                            "next_page_token" => Ok(__FieldTag::__next_page_token),
18820                            "unreachable" => Ok(__FieldTag::__unreachable),
18821                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18822                        }
18823                    }
18824                }
18825                deserializer.deserialize_identifier(Visitor)
18826            }
18827        }
18828        struct Visitor;
18829        impl<'de> serde::de::Visitor<'de> for Visitor {
18830            type Value = ListRoutesResponse;
18831            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18832                formatter.write_str("struct ListRoutesResponse")
18833            }
18834            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18835            where
18836                A: serde::de::MapAccess<'de>,
18837            {
18838                #[allow(unused_imports)]
18839                use serde::de::Error;
18840                use std::option::Option::Some;
18841                let mut fields = std::collections::HashSet::new();
18842                let mut result = Self::Value::new();
18843                while let Some(tag) = map.next_key::<__FieldTag>()? {
18844                    #[allow(clippy::match_single_binding)]
18845                    match tag {
18846                        __FieldTag::__routes => {
18847                            if !fields.insert(__FieldTag::__routes) {
18848                                return std::result::Result::Err(A::Error::duplicate_field(
18849                                    "multiple values for routes",
18850                                ));
18851                            }
18852                            result.routes = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Route>>>()?.unwrap_or_default();
18853                        }
18854                        __FieldTag::__next_page_token => {
18855                            if !fields.insert(__FieldTag::__next_page_token) {
18856                                return std::result::Result::Err(A::Error::duplicate_field(
18857                                    "multiple values for next_page_token",
18858                                ));
18859                            }
18860                            result.next_page_token = map
18861                                .next_value::<std::option::Option<std::string::String>>()?
18862                                .unwrap_or_default();
18863                        }
18864                        __FieldTag::__unreachable => {
18865                            if !fields.insert(__FieldTag::__unreachable) {
18866                                return std::result::Result::Err(A::Error::duplicate_field(
18867                                    "multiple values for unreachable",
18868                                ));
18869                            }
18870                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
18871                        }
18872                        __FieldTag::Unknown(key) => {
18873                            let value = map.next_value::<serde_json::Value>()?;
18874                            result._unknown_fields.insert(key, value);
18875                        }
18876                    }
18877                }
18878                std::result::Result::Ok(result)
18879            }
18880        }
18881        deserializer.deserialize_any(Visitor)
18882    }
18883}
18884
18885#[doc(hidden)]
18886impl serde::ser::Serialize for ListRoutesResponse {
18887    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18888    where
18889        S: serde::ser::Serializer,
18890    {
18891        use serde::ser::SerializeMap;
18892        #[allow(unused_imports)]
18893        use std::option::Option::Some;
18894        let mut state = serializer.serialize_map(std::option::Option::None)?;
18895        if !self.routes.is_empty() {
18896            state.serialize_entry("routes", &self.routes)?;
18897        }
18898        if !self.next_page_token.is_empty() {
18899            state.serialize_entry("nextPageToken", &self.next_page_token)?;
18900        }
18901        if !self.unreachable.is_empty() {
18902            state.serialize_entry("unreachable", &self.unreachable)?;
18903        }
18904        if !self._unknown_fields.is_empty() {
18905            for (key, value) in self._unknown_fields.iter() {
18906                state.serialize_entry(key, &value)?;
18907            }
18908        }
18909        state.end()
18910    }
18911}
18912
18913/// Request for
18914/// [HubService.ListRouteTables][google.cloud.networkconnectivity.v1.HubService.ListRouteTables]
18915/// method.
18916///
18917/// [google.cloud.networkconnectivity.v1.HubService.ListRouteTables]: crate::client::HubService::list_route_tables
18918#[derive(Clone, Debug, Default, PartialEq)]
18919#[non_exhaustive]
18920pub struct ListRouteTablesRequest {
18921    /// Required. The parent resource's name.
18922    pub parent: std::string::String,
18923
18924    /// The maximum number of results to return per page.
18925    pub page_size: i32,
18926
18927    /// The page token.
18928    pub page_token: std::string::String,
18929
18930    /// An expression that filters the list of results.
18931    pub filter: std::string::String,
18932
18933    /// Sort the results by a certain order.
18934    pub order_by: std::string::String,
18935
18936    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18937}
18938
18939impl ListRouteTablesRequest {
18940    pub fn new() -> Self {
18941        std::default::Default::default()
18942    }
18943
18944    /// Sets the value of [parent][crate::model::ListRouteTablesRequest::parent].
18945    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18946        self.parent = v.into();
18947        self
18948    }
18949
18950    /// Sets the value of [page_size][crate::model::ListRouteTablesRequest::page_size].
18951    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
18952        self.page_size = v.into();
18953        self
18954    }
18955
18956    /// Sets the value of [page_token][crate::model::ListRouteTablesRequest::page_token].
18957    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18958        self.page_token = v.into();
18959        self
18960    }
18961
18962    /// Sets the value of [filter][crate::model::ListRouteTablesRequest::filter].
18963    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18964        self.filter = v.into();
18965        self
18966    }
18967
18968    /// Sets the value of [order_by][crate::model::ListRouteTablesRequest::order_by].
18969    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18970        self.order_by = v.into();
18971        self
18972    }
18973}
18974
18975impl wkt::message::Message for ListRouteTablesRequest {
18976    fn typename() -> &'static str {
18977        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListRouteTablesRequest"
18978    }
18979}
18980
18981#[doc(hidden)]
18982impl<'de> serde::de::Deserialize<'de> for ListRouteTablesRequest {
18983    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18984    where
18985        D: serde::Deserializer<'de>,
18986    {
18987        #[allow(non_camel_case_types)]
18988        #[doc(hidden)]
18989        #[derive(PartialEq, Eq, Hash)]
18990        enum __FieldTag {
18991            __parent,
18992            __page_size,
18993            __page_token,
18994            __filter,
18995            __order_by,
18996            Unknown(std::string::String),
18997        }
18998        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18999            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19000            where
19001                D: serde::Deserializer<'de>,
19002            {
19003                struct Visitor;
19004                impl<'de> serde::de::Visitor<'de> for Visitor {
19005                    type Value = __FieldTag;
19006                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19007                        formatter.write_str("a field name for ListRouteTablesRequest")
19008                    }
19009                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19010                    where
19011                        E: serde::de::Error,
19012                    {
19013                        use std::result::Result::Ok;
19014                        use std::string::ToString;
19015                        match value {
19016                            "parent" => Ok(__FieldTag::__parent),
19017                            "pageSize" => Ok(__FieldTag::__page_size),
19018                            "page_size" => Ok(__FieldTag::__page_size),
19019                            "pageToken" => Ok(__FieldTag::__page_token),
19020                            "page_token" => Ok(__FieldTag::__page_token),
19021                            "filter" => Ok(__FieldTag::__filter),
19022                            "orderBy" => Ok(__FieldTag::__order_by),
19023                            "order_by" => Ok(__FieldTag::__order_by),
19024                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19025                        }
19026                    }
19027                }
19028                deserializer.deserialize_identifier(Visitor)
19029            }
19030        }
19031        struct Visitor;
19032        impl<'de> serde::de::Visitor<'de> for Visitor {
19033            type Value = ListRouteTablesRequest;
19034            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19035                formatter.write_str("struct ListRouteTablesRequest")
19036            }
19037            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19038            where
19039                A: serde::de::MapAccess<'de>,
19040            {
19041                #[allow(unused_imports)]
19042                use serde::de::Error;
19043                use std::option::Option::Some;
19044                let mut fields = std::collections::HashSet::new();
19045                let mut result = Self::Value::new();
19046                while let Some(tag) = map.next_key::<__FieldTag>()? {
19047                    #[allow(clippy::match_single_binding)]
19048                    match tag {
19049                        __FieldTag::__parent => {
19050                            if !fields.insert(__FieldTag::__parent) {
19051                                return std::result::Result::Err(A::Error::duplicate_field(
19052                                    "multiple values for parent",
19053                                ));
19054                            }
19055                            result.parent = map
19056                                .next_value::<std::option::Option<std::string::String>>()?
19057                                .unwrap_or_default();
19058                        }
19059                        __FieldTag::__page_size => {
19060                            if !fields.insert(__FieldTag::__page_size) {
19061                                return std::result::Result::Err(A::Error::duplicate_field(
19062                                    "multiple values for page_size",
19063                                ));
19064                            }
19065                            struct __With(std::option::Option<i32>);
19066                            impl<'de> serde::de::Deserialize<'de> for __With {
19067                                fn deserialize<D>(
19068                                    deserializer: D,
19069                                ) -> std::result::Result<Self, D::Error>
19070                                where
19071                                    D: serde::de::Deserializer<'de>,
19072                                {
19073                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
19074                                }
19075                            }
19076                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
19077                        }
19078                        __FieldTag::__page_token => {
19079                            if !fields.insert(__FieldTag::__page_token) {
19080                                return std::result::Result::Err(A::Error::duplicate_field(
19081                                    "multiple values for page_token",
19082                                ));
19083                            }
19084                            result.page_token = map
19085                                .next_value::<std::option::Option<std::string::String>>()?
19086                                .unwrap_or_default();
19087                        }
19088                        __FieldTag::__filter => {
19089                            if !fields.insert(__FieldTag::__filter) {
19090                                return std::result::Result::Err(A::Error::duplicate_field(
19091                                    "multiple values for filter",
19092                                ));
19093                            }
19094                            result.filter = map
19095                                .next_value::<std::option::Option<std::string::String>>()?
19096                                .unwrap_or_default();
19097                        }
19098                        __FieldTag::__order_by => {
19099                            if !fields.insert(__FieldTag::__order_by) {
19100                                return std::result::Result::Err(A::Error::duplicate_field(
19101                                    "multiple values for order_by",
19102                                ));
19103                            }
19104                            result.order_by = map
19105                                .next_value::<std::option::Option<std::string::String>>()?
19106                                .unwrap_or_default();
19107                        }
19108                        __FieldTag::Unknown(key) => {
19109                            let value = map.next_value::<serde_json::Value>()?;
19110                            result._unknown_fields.insert(key, value);
19111                        }
19112                    }
19113                }
19114                std::result::Result::Ok(result)
19115            }
19116        }
19117        deserializer.deserialize_any(Visitor)
19118    }
19119}
19120
19121#[doc(hidden)]
19122impl serde::ser::Serialize for ListRouteTablesRequest {
19123    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19124    where
19125        S: serde::ser::Serializer,
19126    {
19127        use serde::ser::SerializeMap;
19128        #[allow(unused_imports)]
19129        use std::option::Option::Some;
19130        let mut state = serializer.serialize_map(std::option::Option::None)?;
19131        if !self.parent.is_empty() {
19132            state.serialize_entry("parent", &self.parent)?;
19133        }
19134        if !wkt::internal::is_default(&self.page_size) {
19135            struct __With<'a>(&'a i32);
19136            impl<'a> serde::ser::Serialize for __With<'a> {
19137                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19138                where
19139                    S: serde::ser::Serializer,
19140                {
19141                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
19142                }
19143            }
19144            state.serialize_entry("pageSize", &__With(&self.page_size))?;
19145        }
19146        if !self.page_token.is_empty() {
19147            state.serialize_entry("pageToken", &self.page_token)?;
19148        }
19149        if !self.filter.is_empty() {
19150            state.serialize_entry("filter", &self.filter)?;
19151        }
19152        if !self.order_by.is_empty() {
19153            state.serialize_entry("orderBy", &self.order_by)?;
19154        }
19155        if !self._unknown_fields.is_empty() {
19156            for (key, value) in self._unknown_fields.iter() {
19157                state.serialize_entry(key, &value)?;
19158            }
19159        }
19160        state.end()
19161    }
19162}
19163
19164/// Response for
19165/// [HubService.ListRouteTables][google.cloud.networkconnectivity.v1.HubService.ListRouteTables]
19166/// method.
19167///
19168/// [google.cloud.networkconnectivity.v1.HubService.ListRouteTables]: crate::client::HubService::list_route_tables
19169#[derive(Clone, Debug, Default, PartialEq)]
19170#[non_exhaustive]
19171pub struct ListRouteTablesResponse {
19172    /// The requested route tables.
19173    pub route_tables: std::vec::Vec<crate::model::RouteTable>,
19174
19175    /// The token for the next page of the response. To see more results,
19176    /// use this value as the page_token for your next request. If this value
19177    /// is empty, there are no more results.
19178    pub next_page_token: std::string::String,
19179
19180    /// Hubs that could not be reached.
19181    pub unreachable: std::vec::Vec<std::string::String>,
19182
19183    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19184}
19185
19186impl ListRouteTablesResponse {
19187    pub fn new() -> Self {
19188        std::default::Default::default()
19189    }
19190
19191    /// Sets the value of [route_tables][crate::model::ListRouteTablesResponse::route_tables].
19192    pub fn set_route_tables<T, V>(mut self, v: T) -> Self
19193    where
19194        T: std::iter::IntoIterator<Item = V>,
19195        V: std::convert::Into<crate::model::RouteTable>,
19196    {
19197        use std::iter::Iterator;
19198        self.route_tables = v.into_iter().map(|i| i.into()).collect();
19199        self
19200    }
19201
19202    /// Sets the value of [next_page_token][crate::model::ListRouteTablesResponse::next_page_token].
19203    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19204        self.next_page_token = v.into();
19205        self
19206    }
19207
19208    /// Sets the value of [unreachable][crate::model::ListRouteTablesResponse::unreachable].
19209    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
19210    where
19211        T: std::iter::IntoIterator<Item = V>,
19212        V: std::convert::Into<std::string::String>,
19213    {
19214        use std::iter::Iterator;
19215        self.unreachable = v.into_iter().map(|i| i.into()).collect();
19216        self
19217    }
19218}
19219
19220impl wkt::message::Message for ListRouteTablesResponse {
19221    fn typename() -> &'static str {
19222        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListRouteTablesResponse"
19223    }
19224}
19225
19226#[doc(hidden)]
19227impl gax::paginator::internal::PageableResponse for ListRouteTablesResponse {
19228    type PageItem = crate::model::RouteTable;
19229
19230    fn items(self) -> std::vec::Vec<Self::PageItem> {
19231        self.route_tables
19232    }
19233
19234    fn next_page_token(&self) -> std::string::String {
19235        use std::clone::Clone;
19236        self.next_page_token.clone()
19237    }
19238}
19239
19240#[doc(hidden)]
19241impl<'de> serde::de::Deserialize<'de> for ListRouteTablesResponse {
19242    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19243    where
19244        D: serde::Deserializer<'de>,
19245    {
19246        #[allow(non_camel_case_types)]
19247        #[doc(hidden)]
19248        #[derive(PartialEq, Eq, Hash)]
19249        enum __FieldTag {
19250            __route_tables,
19251            __next_page_token,
19252            __unreachable,
19253            Unknown(std::string::String),
19254        }
19255        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19256            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19257            where
19258                D: serde::Deserializer<'de>,
19259            {
19260                struct Visitor;
19261                impl<'de> serde::de::Visitor<'de> for Visitor {
19262                    type Value = __FieldTag;
19263                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19264                        formatter.write_str("a field name for ListRouteTablesResponse")
19265                    }
19266                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19267                    where
19268                        E: serde::de::Error,
19269                    {
19270                        use std::result::Result::Ok;
19271                        use std::string::ToString;
19272                        match value {
19273                            "routeTables" => Ok(__FieldTag::__route_tables),
19274                            "route_tables" => Ok(__FieldTag::__route_tables),
19275                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
19276                            "next_page_token" => Ok(__FieldTag::__next_page_token),
19277                            "unreachable" => Ok(__FieldTag::__unreachable),
19278                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19279                        }
19280                    }
19281                }
19282                deserializer.deserialize_identifier(Visitor)
19283            }
19284        }
19285        struct Visitor;
19286        impl<'de> serde::de::Visitor<'de> for Visitor {
19287            type Value = ListRouteTablesResponse;
19288            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19289                formatter.write_str("struct ListRouteTablesResponse")
19290            }
19291            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19292            where
19293                A: serde::de::MapAccess<'de>,
19294            {
19295                #[allow(unused_imports)]
19296                use serde::de::Error;
19297                use std::option::Option::Some;
19298                let mut fields = std::collections::HashSet::new();
19299                let mut result = Self::Value::new();
19300                while let Some(tag) = map.next_key::<__FieldTag>()? {
19301                    #[allow(clippy::match_single_binding)]
19302                    match tag {
19303                        __FieldTag::__route_tables => {
19304                            if !fields.insert(__FieldTag::__route_tables) {
19305                                return std::result::Result::Err(A::Error::duplicate_field(
19306                                    "multiple values for route_tables",
19307                                ));
19308                            }
19309                            result.route_tables = map.next_value::<std::option::Option<std::vec::Vec<crate::model::RouteTable>>>()?.unwrap_or_default();
19310                        }
19311                        __FieldTag::__next_page_token => {
19312                            if !fields.insert(__FieldTag::__next_page_token) {
19313                                return std::result::Result::Err(A::Error::duplicate_field(
19314                                    "multiple values for next_page_token",
19315                                ));
19316                            }
19317                            result.next_page_token = map
19318                                .next_value::<std::option::Option<std::string::String>>()?
19319                                .unwrap_or_default();
19320                        }
19321                        __FieldTag::__unreachable => {
19322                            if !fields.insert(__FieldTag::__unreachable) {
19323                                return std::result::Result::Err(A::Error::duplicate_field(
19324                                    "multiple values for unreachable",
19325                                ));
19326                            }
19327                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
19328                        }
19329                        __FieldTag::Unknown(key) => {
19330                            let value = map.next_value::<serde_json::Value>()?;
19331                            result._unknown_fields.insert(key, value);
19332                        }
19333                    }
19334                }
19335                std::result::Result::Ok(result)
19336            }
19337        }
19338        deserializer.deserialize_any(Visitor)
19339    }
19340}
19341
19342#[doc(hidden)]
19343impl serde::ser::Serialize for ListRouteTablesResponse {
19344    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19345    where
19346        S: serde::ser::Serializer,
19347    {
19348        use serde::ser::SerializeMap;
19349        #[allow(unused_imports)]
19350        use std::option::Option::Some;
19351        let mut state = serializer.serialize_map(std::option::Option::None)?;
19352        if !self.route_tables.is_empty() {
19353            state.serialize_entry("routeTables", &self.route_tables)?;
19354        }
19355        if !self.next_page_token.is_empty() {
19356            state.serialize_entry("nextPageToken", &self.next_page_token)?;
19357        }
19358        if !self.unreachable.is_empty() {
19359            state.serialize_entry("unreachable", &self.unreachable)?;
19360        }
19361        if !self._unknown_fields.is_empty() {
19362            for (key, value) in self._unknown_fields.iter() {
19363                state.serialize_entry(key, &value)?;
19364            }
19365        }
19366        state.end()
19367    }
19368}
19369
19370/// Request for
19371/// [HubService.ListGroups][google.cloud.networkconnectivity.v1.HubService.ListGroups]
19372/// method.
19373///
19374/// [google.cloud.networkconnectivity.v1.HubService.ListGroups]: crate::client::HubService::list_groups
19375#[derive(Clone, Debug, Default, PartialEq)]
19376#[non_exhaustive]
19377pub struct ListGroupsRequest {
19378    /// Required. The parent resource's name.
19379    pub parent: std::string::String,
19380
19381    /// The maximum number of results to return per page.
19382    pub page_size: i32,
19383
19384    /// The page token.
19385    pub page_token: std::string::String,
19386
19387    /// An expression that filters the list of results.
19388    pub filter: std::string::String,
19389
19390    /// Sort the results by a certain order.
19391    pub order_by: std::string::String,
19392
19393    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19394}
19395
19396impl ListGroupsRequest {
19397    pub fn new() -> Self {
19398        std::default::Default::default()
19399    }
19400
19401    /// Sets the value of [parent][crate::model::ListGroupsRequest::parent].
19402    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19403        self.parent = v.into();
19404        self
19405    }
19406
19407    /// Sets the value of [page_size][crate::model::ListGroupsRequest::page_size].
19408    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
19409        self.page_size = v.into();
19410        self
19411    }
19412
19413    /// Sets the value of [page_token][crate::model::ListGroupsRequest::page_token].
19414    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19415        self.page_token = v.into();
19416        self
19417    }
19418
19419    /// Sets the value of [filter][crate::model::ListGroupsRequest::filter].
19420    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19421        self.filter = v.into();
19422        self
19423    }
19424
19425    /// Sets the value of [order_by][crate::model::ListGroupsRequest::order_by].
19426    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19427        self.order_by = v.into();
19428        self
19429    }
19430}
19431
19432impl wkt::message::Message for ListGroupsRequest {
19433    fn typename() -> &'static str {
19434        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListGroupsRequest"
19435    }
19436}
19437
19438#[doc(hidden)]
19439impl<'de> serde::de::Deserialize<'de> for ListGroupsRequest {
19440    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19441    where
19442        D: serde::Deserializer<'de>,
19443    {
19444        #[allow(non_camel_case_types)]
19445        #[doc(hidden)]
19446        #[derive(PartialEq, Eq, Hash)]
19447        enum __FieldTag {
19448            __parent,
19449            __page_size,
19450            __page_token,
19451            __filter,
19452            __order_by,
19453            Unknown(std::string::String),
19454        }
19455        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19456            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19457            where
19458                D: serde::Deserializer<'de>,
19459            {
19460                struct Visitor;
19461                impl<'de> serde::de::Visitor<'de> for Visitor {
19462                    type Value = __FieldTag;
19463                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19464                        formatter.write_str("a field name for ListGroupsRequest")
19465                    }
19466                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19467                    where
19468                        E: serde::de::Error,
19469                    {
19470                        use std::result::Result::Ok;
19471                        use std::string::ToString;
19472                        match value {
19473                            "parent" => Ok(__FieldTag::__parent),
19474                            "pageSize" => Ok(__FieldTag::__page_size),
19475                            "page_size" => Ok(__FieldTag::__page_size),
19476                            "pageToken" => Ok(__FieldTag::__page_token),
19477                            "page_token" => Ok(__FieldTag::__page_token),
19478                            "filter" => Ok(__FieldTag::__filter),
19479                            "orderBy" => Ok(__FieldTag::__order_by),
19480                            "order_by" => Ok(__FieldTag::__order_by),
19481                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19482                        }
19483                    }
19484                }
19485                deserializer.deserialize_identifier(Visitor)
19486            }
19487        }
19488        struct Visitor;
19489        impl<'de> serde::de::Visitor<'de> for Visitor {
19490            type Value = ListGroupsRequest;
19491            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19492                formatter.write_str("struct ListGroupsRequest")
19493            }
19494            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19495            where
19496                A: serde::de::MapAccess<'de>,
19497            {
19498                #[allow(unused_imports)]
19499                use serde::de::Error;
19500                use std::option::Option::Some;
19501                let mut fields = std::collections::HashSet::new();
19502                let mut result = Self::Value::new();
19503                while let Some(tag) = map.next_key::<__FieldTag>()? {
19504                    #[allow(clippy::match_single_binding)]
19505                    match tag {
19506                        __FieldTag::__parent => {
19507                            if !fields.insert(__FieldTag::__parent) {
19508                                return std::result::Result::Err(A::Error::duplicate_field(
19509                                    "multiple values for parent",
19510                                ));
19511                            }
19512                            result.parent = map
19513                                .next_value::<std::option::Option<std::string::String>>()?
19514                                .unwrap_or_default();
19515                        }
19516                        __FieldTag::__page_size => {
19517                            if !fields.insert(__FieldTag::__page_size) {
19518                                return std::result::Result::Err(A::Error::duplicate_field(
19519                                    "multiple values for page_size",
19520                                ));
19521                            }
19522                            struct __With(std::option::Option<i32>);
19523                            impl<'de> serde::de::Deserialize<'de> for __With {
19524                                fn deserialize<D>(
19525                                    deserializer: D,
19526                                ) -> std::result::Result<Self, D::Error>
19527                                where
19528                                    D: serde::de::Deserializer<'de>,
19529                                {
19530                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
19531                                }
19532                            }
19533                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
19534                        }
19535                        __FieldTag::__page_token => {
19536                            if !fields.insert(__FieldTag::__page_token) {
19537                                return std::result::Result::Err(A::Error::duplicate_field(
19538                                    "multiple values for page_token",
19539                                ));
19540                            }
19541                            result.page_token = map
19542                                .next_value::<std::option::Option<std::string::String>>()?
19543                                .unwrap_or_default();
19544                        }
19545                        __FieldTag::__filter => {
19546                            if !fields.insert(__FieldTag::__filter) {
19547                                return std::result::Result::Err(A::Error::duplicate_field(
19548                                    "multiple values for filter",
19549                                ));
19550                            }
19551                            result.filter = map
19552                                .next_value::<std::option::Option<std::string::String>>()?
19553                                .unwrap_or_default();
19554                        }
19555                        __FieldTag::__order_by => {
19556                            if !fields.insert(__FieldTag::__order_by) {
19557                                return std::result::Result::Err(A::Error::duplicate_field(
19558                                    "multiple values for order_by",
19559                                ));
19560                            }
19561                            result.order_by = map
19562                                .next_value::<std::option::Option<std::string::String>>()?
19563                                .unwrap_or_default();
19564                        }
19565                        __FieldTag::Unknown(key) => {
19566                            let value = map.next_value::<serde_json::Value>()?;
19567                            result._unknown_fields.insert(key, value);
19568                        }
19569                    }
19570                }
19571                std::result::Result::Ok(result)
19572            }
19573        }
19574        deserializer.deserialize_any(Visitor)
19575    }
19576}
19577
19578#[doc(hidden)]
19579impl serde::ser::Serialize for ListGroupsRequest {
19580    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19581    where
19582        S: serde::ser::Serializer,
19583    {
19584        use serde::ser::SerializeMap;
19585        #[allow(unused_imports)]
19586        use std::option::Option::Some;
19587        let mut state = serializer.serialize_map(std::option::Option::None)?;
19588        if !self.parent.is_empty() {
19589            state.serialize_entry("parent", &self.parent)?;
19590        }
19591        if !wkt::internal::is_default(&self.page_size) {
19592            struct __With<'a>(&'a i32);
19593            impl<'a> serde::ser::Serialize for __With<'a> {
19594                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19595                where
19596                    S: serde::ser::Serializer,
19597                {
19598                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
19599                }
19600            }
19601            state.serialize_entry("pageSize", &__With(&self.page_size))?;
19602        }
19603        if !self.page_token.is_empty() {
19604            state.serialize_entry("pageToken", &self.page_token)?;
19605        }
19606        if !self.filter.is_empty() {
19607            state.serialize_entry("filter", &self.filter)?;
19608        }
19609        if !self.order_by.is_empty() {
19610            state.serialize_entry("orderBy", &self.order_by)?;
19611        }
19612        if !self._unknown_fields.is_empty() {
19613            for (key, value) in self._unknown_fields.iter() {
19614                state.serialize_entry(key, &value)?;
19615            }
19616        }
19617        state.end()
19618    }
19619}
19620
19621/// Response for
19622/// [HubService.ListGroups][google.cloud.networkconnectivity.v1.HubService.ListGroups]
19623/// method.
19624///
19625/// [google.cloud.networkconnectivity.v1.HubService.ListGroups]: crate::client::HubService::list_groups
19626#[derive(Clone, Debug, Default, PartialEq)]
19627#[non_exhaustive]
19628pub struct ListGroupsResponse {
19629    /// The requested groups.
19630    pub groups: std::vec::Vec<crate::model::Group>,
19631
19632    /// The token for the next page of the response. To see more results,
19633    /// use this value as the page_token for your next request. If this value
19634    /// is empty, there are no more results.
19635    pub next_page_token: std::string::String,
19636
19637    /// Hubs that could not be reached.
19638    pub unreachable: std::vec::Vec<std::string::String>,
19639
19640    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19641}
19642
19643impl ListGroupsResponse {
19644    pub fn new() -> Self {
19645        std::default::Default::default()
19646    }
19647
19648    /// Sets the value of [groups][crate::model::ListGroupsResponse::groups].
19649    pub fn set_groups<T, V>(mut self, v: T) -> Self
19650    where
19651        T: std::iter::IntoIterator<Item = V>,
19652        V: std::convert::Into<crate::model::Group>,
19653    {
19654        use std::iter::Iterator;
19655        self.groups = v.into_iter().map(|i| i.into()).collect();
19656        self
19657    }
19658
19659    /// Sets the value of [next_page_token][crate::model::ListGroupsResponse::next_page_token].
19660    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19661        self.next_page_token = v.into();
19662        self
19663    }
19664
19665    /// Sets the value of [unreachable][crate::model::ListGroupsResponse::unreachable].
19666    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
19667    where
19668        T: std::iter::IntoIterator<Item = V>,
19669        V: std::convert::Into<std::string::String>,
19670    {
19671        use std::iter::Iterator;
19672        self.unreachable = v.into_iter().map(|i| i.into()).collect();
19673        self
19674    }
19675}
19676
19677impl wkt::message::Message for ListGroupsResponse {
19678    fn typename() -> &'static str {
19679        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListGroupsResponse"
19680    }
19681}
19682
19683#[doc(hidden)]
19684impl gax::paginator::internal::PageableResponse for ListGroupsResponse {
19685    type PageItem = crate::model::Group;
19686
19687    fn items(self) -> std::vec::Vec<Self::PageItem> {
19688        self.groups
19689    }
19690
19691    fn next_page_token(&self) -> std::string::String {
19692        use std::clone::Clone;
19693        self.next_page_token.clone()
19694    }
19695}
19696
19697#[doc(hidden)]
19698impl<'de> serde::de::Deserialize<'de> for ListGroupsResponse {
19699    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19700    where
19701        D: serde::Deserializer<'de>,
19702    {
19703        #[allow(non_camel_case_types)]
19704        #[doc(hidden)]
19705        #[derive(PartialEq, Eq, Hash)]
19706        enum __FieldTag {
19707            __groups,
19708            __next_page_token,
19709            __unreachable,
19710            Unknown(std::string::String),
19711        }
19712        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19713            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19714            where
19715                D: serde::Deserializer<'de>,
19716            {
19717                struct Visitor;
19718                impl<'de> serde::de::Visitor<'de> for Visitor {
19719                    type Value = __FieldTag;
19720                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19721                        formatter.write_str("a field name for ListGroupsResponse")
19722                    }
19723                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19724                    where
19725                        E: serde::de::Error,
19726                    {
19727                        use std::result::Result::Ok;
19728                        use std::string::ToString;
19729                        match value {
19730                            "groups" => Ok(__FieldTag::__groups),
19731                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
19732                            "next_page_token" => Ok(__FieldTag::__next_page_token),
19733                            "unreachable" => Ok(__FieldTag::__unreachable),
19734                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19735                        }
19736                    }
19737                }
19738                deserializer.deserialize_identifier(Visitor)
19739            }
19740        }
19741        struct Visitor;
19742        impl<'de> serde::de::Visitor<'de> for Visitor {
19743            type Value = ListGroupsResponse;
19744            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19745                formatter.write_str("struct ListGroupsResponse")
19746            }
19747            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19748            where
19749                A: serde::de::MapAccess<'de>,
19750            {
19751                #[allow(unused_imports)]
19752                use serde::de::Error;
19753                use std::option::Option::Some;
19754                let mut fields = std::collections::HashSet::new();
19755                let mut result = Self::Value::new();
19756                while let Some(tag) = map.next_key::<__FieldTag>()? {
19757                    #[allow(clippy::match_single_binding)]
19758                    match tag {
19759                        __FieldTag::__groups => {
19760                            if !fields.insert(__FieldTag::__groups) {
19761                                return std::result::Result::Err(A::Error::duplicate_field(
19762                                    "multiple values for groups",
19763                                ));
19764                            }
19765                            result.groups = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Group>>>()?.unwrap_or_default();
19766                        }
19767                        __FieldTag::__next_page_token => {
19768                            if !fields.insert(__FieldTag::__next_page_token) {
19769                                return std::result::Result::Err(A::Error::duplicate_field(
19770                                    "multiple values for next_page_token",
19771                                ));
19772                            }
19773                            result.next_page_token = map
19774                                .next_value::<std::option::Option<std::string::String>>()?
19775                                .unwrap_or_default();
19776                        }
19777                        __FieldTag::__unreachable => {
19778                            if !fields.insert(__FieldTag::__unreachable) {
19779                                return std::result::Result::Err(A::Error::duplicate_field(
19780                                    "multiple values for unreachable",
19781                                ));
19782                            }
19783                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
19784                        }
19785                        __FieldTag::Unknown(key) => {
19786                            let value = map.next_value::<serde_json::Value>()?;
19787                            result._unknown_fields.insert(key, value);
19788                        }
19789                    }
19790                }
19791                std::result::Result::Ok(result)
19792            }
19793        }
19794        deserializer.deserialize_any(Visitor)
19795    }
19796}
19797
19798#[doc(hidden)]
19799impl serde::ser::Serialize for ListGroupsResponse {
19800    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19801    where
19802        S: serde::ser::Serializer,
19803    {
19804        use serde::ser::SerializeMap;
19805        #[allow(unused_imports)]
19806        use std::option::Option::Some;
19807        let mut state = serializer.serialize_map(std::option::Option::None)?;
19808        if !self.groups.is_empty() {
19809            state.serialize_entry("groups", &self.groups)?;
19810        }
19811        if !self.next_page_token.is_empty() {
19812            state.serialize_entry("nextPageToken", &self.next_page_token)?;
19813        }
19814        if !self.unreachable.is_empty() {
19815            state.serialize_entry("unreachable", &self.unreachable)?;
19816        }
19817        if !self._unknown_fields.is_empty() {
19818            for (key, value) in self._unknown_fields.iter() {
19819                state.serialize_entry(key, &value)?;
19820            }
19821        }
19822        state.end()
19823    }
19824}
19825
19826/// A collection of Cloud VPN tunnel resources. These resources should be
19827/// redundant HA VPN tunnels that all advertise the same prefixes to Google
19828/// Cloud. Alternatively, in a passive/active configuration, all tunnels
19829/// should be capable of advertising the same prefixes.
19830#[derive(Clone, Debug, Default, PartialEq)]
19831#[non_exhaustive]
19832pub struct LinkedVpnTunnels {
19833    /// The URIs of linked VPN tunnel resources.
19834    pub uris: std::vec::Vec<std::string::String>,
19835
19836    /// A value that controls whether site-to-site data transfer is enabled for
19837    /// these resources. Data transfer is available only in [supported
19838    /// locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations).
19839    pub site_to_site_data_transfer: bool,
19840
19841    /// Output only. The VPC network where these VPN tunnels are located.
19842    pub vpc_network: std::string::String,
19843
19844    /// Optional. IP ranges allowed to be included during import from hub (does not
19845    /// control transit connectivity). The only allowed value for now is
19846    /// "ALL_IPV4_RANGES".
19847    pub include_import_ranges: std::vec::Vec<std::string::String>,
19848
19849    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19850}
19851
19852impl LinkedVpnTunnels {
19853    pub fn new() -> Self {
19854        std::default::Default::default()
19855    }
19856
19857    /// Sets the value of [uris][crate::model::LinkedVpnTunnels::uris].
19858    pub fn set_uris<T, V>(mut self, v: T) -> Self
19859    where
19860        T: std::iter::IntoIterator<Item = V>,
19861        V: std::convert::Into<std::string::String>,
19862    {
19863        use std::iter::Iterator;
19864        self.uris = v.into_iter().map(|i| i.into()).collect();
19865        self
19866    }
19867
19868    /// Sets the value of [site_to_site_data_transfer][crate::model::LinkedVpnTunnels::site_to_site_data_transfer].
19869    pub fn set_site_to_site_data_transfer<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19870        self.site_to_site_data_transfer = v.into();
19871        self
19872    }
19873
19874    /// Sets the value of [vpc_network][crate::model::LinkedVpnTunnels::vpc_network].
19875    pub fn set_vpc_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19876        self.vpc_network = v.into();
19877        self
19878    }
19879
19880    /// Sets the value of [include_import_ranges][crate::model::LinkedVpnTunnels::include_import_ranges].
19881    pub fn set_include_import_ranges<T, V>(mut self, v: T) -> Self
19882    where
19883        T: std::iter::IntoIterator<Item = V>,
19884        V: std::convert::Into<std::string::String>,
19885    {
19886        use std::iter::Iterator;
19887        self.include_import_ranges = v.into_iter().map(|i| i.into()).collect();
19888        self
19889    }
19890}
19891
19892impl wkt::message::Message for LinkedVpnTunnels {
19893    fn typename() -> &'static str {
19894        "type.googleapis.com/google.cloud.networkconnectivity.v1.LinkedVpnTunnels"
19895    }
19896}
19897
19898#[doc(hidden)]
19899impl<'de> serde::de::Deserialize<'de> for LinkedVpnTunnels {
19900    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19901    where
19902        D: serde::Deserializer<'de>,
19903    {
19904        #[allow(non_camel_case_types)]
19905        #[doc(hidden)]
19906        #[derive(PartialEq, Eq, Hash)]
19907        enum __FieldTag {
19908            __uris,
19909            __site_to_site_data_transfer,
19910            __vpc_network,
19911            __include_import_ranges,
19912            Unknown(std::string::String),
19913        }
19914        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19915            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19916            where
19917                D: serde::Deserializer<'de>,
19918            {
19919                struct Visitor;
19920                impl<'de> serde::de::Visitor<'de> for Visitor {
19921                    type Value = __FieldTag;
19922                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19923                        formatter.write_str("a field name for LinkedVpnTunnels")
19924                    }
19925                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19926                    where
19927                        E: serde::de::Error,
19928                    {
19929                        use std::result::Result::Ok;
19930                        use std::string::ToString;
19931                        match value {
19932                            "uris" => Ok(__FieldTag::__uris),
19933                            "siteToSiteDataTransfer" => {
19934                                Ok(__FieldTag::__site_to_site_data_transfer)
19935                            }
19936                            "site_to_site_data_transfer" => {
19937                                Ok(__FieldTag::__site_to_site_data_transfer)
19938                            }
19939                            "vpcNetwork" => Ok(__FieldTag::__vpc_network),
19940                            "vpc_network" => Ok(__FieldTag::__vpc_network),
19941                            "includeImportRanges" => Ok(__FieldTag::__include_import_ranges),
19942                            "include_import_ranges" => Ok(__FieldTag::__include_import_ranges),
19943                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19944                        }
19945                    }
19946                }
19947                deserializer.deserialize_identifier(Visitor)
19948            }
19949        }
19950        struct Visitor;
19951        impl<'de> serde::de::Visitor<'de> for Visitor {
19952            type Value = LinkedVpnTunnels;
19953            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19954                formatter.write_str("struct LinkedVpnTunnels")
19955            }
19956            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19957            where
19958                A: serde::de::MapAccess<'de>,
19959            {
19960                #[allow(unused_imports)]
19961                use serde::de::Error;
19962                use std::option::Option::Some;
19963                let mut fields = std::collections::HashSet::new();
19964                let mut result = Self::Value::new();
19965                while let Some(tag) = map.next_key::<__FieldTag>()? {
19966                    #[allow(clippy::match_single_binding)]
19967                    match tag {
19968                        __FieldTag::__uris => {
19969                            if !fields.insert(__FieldTag::__uris) {
19970                                return std::result::Result::Err(A::Error::duplicate_field(
19971                                    "multiple values for uris",
19972                                ));
19973                            }
19974                            result.uris = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
19975                        }
19976                        __FieldTag::__site_to_site_data_transfer => {
19977                            if !fields.insert(__FieldTag::__site_to_site_data_transfer) {
19978                                return std::result::Result::Err(A::Error::duplicate_field(
19979                                    "multiple values for site_to_site_data_transfer",
19980                                ));
19981                            }
19982                            result.site_to_site_data_transfer = map
19983                                .next_value::<std::option::Option<bool>>()?
19984                                .unwrap_or_default();
19985                        }
19986                        __FieldTag::__vpc_network => {
19987                            if !fields.insert(__FieldTag::__vpc_network) {
19988                                return std::result::Result::Err(A::Error::duplicate_field(
19989                                    "multiple values for vpc_network",
19990                                ));
19991                            }
19992                            result.vpc_network = map
19993                                .next_value::<std::option::Option<std::string::String>>()?
19994                                .unwrap_or_default();
19995                        }
19996                        __FieldTag::__include_import_ranges => {
19997                            if !fields.insert(__FieldTag::__include_import_ranges) {
19998                                return std::result::Result::Err(A::Error::duplicate_field(
19999                                    "multiple values for include_import_ranges",
20000                                ));
20001                            }
20002                            result.include_import_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
20003                        }
20004                        __FieldTag::Unknown(key) => {
20005                            let value = map.next_value::<serde_json::Value>()?;
20006                            result._unknown_fields.insert(key, value);
20007                        }
20008                    }
20009                }
20010                std::result::Result::Ok(result)
20011            }
20012        }
20013        deserializer.deserialize_any(Visitor)
20014    }
20015}
20016
20017#[doc(hidden)]
20018impl serde::ser::Serialize for LinkedVpnTunnels {
20019    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20020    where
20021        S: serde::ser::Serializer,
20022    {
20023        use serde::ser::SerializeMap;
20024        #[allow(unused_imports)]
20025        use std::option::Option::Some;
20026        let mut state = serializer.serialize_map(std::option::Option::None)?;
20027        if !self.uris.is_empty() {
20028            state.serialize_entry("uris", &self.uris)?;
20029        }
20030        if !wkt::internal::is_default(&self.site_to_site_data_transfer) {
20031            state.serialize_entry("siteToSiteDataTransfer", &self.site_to_site_data_transfer)?;
20032        }
20033        if !self.vpc_network.is_empty() {
20034            state.serialize_entry("vpcNetwork", &self.vpc_network)?;
20035        }
20036        if !self.include_import_ranges.is_empty() {
20037            state.serialize_entry("includeImportRanges", &self.include_import_ranges)?;
20038        }
20039        if !self._unknown_fields.is_empty() {
20040            for (key, value) in self._unknown_fields.iter() {
20041                state.serialize_entry(key, &value)?;
20042            }
20043        }
20044        state.end()
20045    }
20046}
20047
20048/// A collection of VLAN attachment resources. These resources should
20049/// be redundant attachments that all advertise the same prefixes to Google
20050/// Cloud. Alternatively, in active/passive configurations, all attachments
20051/// should be capable of advertising the same prefixes.
20052#[derive(Clone, Debug, Default, PartialEq)]
20053#[non_exhaustive]
20054pub struct LinkedInterconnectAttachments {
20055    /// The URIs of linked interconnect attachment resources
20056    pub uris: std::vec::Vec<std::string::String>,
20057
20058    /// A value that controls whether site-to-site data transfer is enabled for
20059    /// these resources. Data transfer is available only in [supported
20060    /// locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations).
20061    pub site_to_site_data_transfer: bool,
20062
20063    /// Output only. The VPC network where these VLAN attachments are located.
20064    pub vpc_network: std::string::String,
20065
20066    /// Optional. IP ranges allowed to be included during import from hub (does not
20067    /// control transit connectivity). The only allowed value for now is
20068    /// "ALL_IPV4_RANGES".
20069    pub include_import_ranges: std::vec::Vec<std::string::String>,
20070
20071    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20072}
20073
20074impl LinkedInterconnectAttachments {
20075    pub fn new() -> Self {
20076        std::default::Default::default()
20077    }
20078
20079    /// Sets the value of [uris][crate::model::LinkedInterconnectAttachments::uris].
20080    pub fn set_uris<T, V>(mut self, v: T) -> Self
20081    where
20082        T: std::iter::IntoIterator<Item = V>,
20083        V: std::convert::Into<std::string::String>,
20084    {
20085        use std::iter::Iterator;
20086        self.uris = v.into_iter().map(|i| i.into()).collect();
20087        self
20088    }
20089
20090    /// Sets the value of [site_to_site_data_transfer][crate::model::LinkedInterconnectAttachments::site_to_site_data_transfer].
20091    pub fn set_site_to_site_data_transfer<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
20092        self.site_to_site_data_transfer = v.into();
20093        self
20094    }
20095
20096    /// Sets the value of [vpc_network][crate::model::LinkedInterconnectAttachments::vpc_network].
20097    pub fn set_vpc_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20098        self.vpc_network = v.into();
20099        self
20100    }
20101
20102    /// Sets the value of [include_import_ranges][crate::model::LinkedInterconnectAttachments::include_import_ranges].
20103    pub fn set_include_import_ranges<T, V>(mut self, v: T) -> Self
20104    where
20105        T: std::iter::IntoIterator<Item = V>,
20106        V: std::convert::Into<std::string::String>,
20107    {
20108        use std::iter::Iterator;
20109        self.include_import_ranges = v.into_iter().map(|i| i.into()).collect();
20110        self
20111    }
20112}
20113
20114impl wkt::message::Message for LinkedInterconnectAttachments {
20115    fn typename() -> &'static str {
20116        "type.googleapis.com/google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments"
20117    }
20118}
20119
20120#[doc(hidden)]
20121impl<'de> serde::de::Deserialize<'de> for LinkedInterconnectAttachments {
20122    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20123    where
20124        D: serde::Deserializer<'de>,
20125    {
20126        #[allow(non_camel_case_types)]
20127        #[doc(hidden)]
20128        #[derive(PartialEq, Eq, Hash)]
20129        enum __FieldTag {
20130            __uris,
20131            __site_to_site_data_transfer,
20132            __vpc_network,
20133            __include_import_ranges,
20134            Unknown(std::string::String),
20135        }
20136        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
20137            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20138            where
20139                D: serde::Deserializer<'de>,
20140            {
20141                struct Visitor;
20142                impl<'de> serde::de::Visitor<'de> for Visitor {
20143                    type Value = __FieldTag;
20144                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20145                        formatter.write_str("a field name for LinkedInterconnectAttachments")
20146                    }
20147                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
20148                    where
20149                        E: serde::de::Error,
20150                    {
20151                        use std::result::Result::Ok;
20152                        use std::string::ToString;
20153                        match value {
20154                            "uris" => Ok(__FieldTag::__uris),
20155                            "siteToSiteDataTransfer" => {
20156                                Ok(__FieldTag::__site_to_site_data_transfer)
20157                            }
20158                            "site_to_site_data_transfer" => {
20159                                Ok(__FieldTag::__site_to_site_data_transfer)
20160                            }
20161                            "vpcNetwork" => Ok(__FieldTag::__vpc_network),
20162                            "vpc_network" => Ok(__FieldTag::__vpc_network),
20163                            "includeImportRanges" => Ok(__FieldTag::__include_import_ranges),
20164                            "include_import_ranges" => Ok(__FieldTag::__include_import_ranges),
20165                            _ => Ok(__FieldTag::Unknown(value.to_string())),
20166                        }
20167                    }
20168                }
20169                deserializer.deserialize_identifier(Visitor)
20170            }
20171        }
20172        struct Visitor;
20173        impl<'de> serde::de::Visitor<'de> for Visitor {
20174            type Value = LinkedInterconnectAttachments;
20175            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20176                formatter.write_str("struct LinkedInterconnectAttachments")
20177            }
20178            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
20179            where
20180                A: serde::de::MapAccess<'de>,
20181            {
20182                #[allow(unused_imports)]
20183                use serde::de::Error;
20184                use std::option::Option::Some;
20185                let mut fields = std::collections::HashSet::new();
20186                let mut result = Self::Value::new();
20187                while let Some(tag) = map.next_key::<__FieldTag>()? {
20188                    #[allow(clippy::match_single_binding)]
20189                    match tag {
20190                        __FieldTag::__uris => {
20191                            if !fields.insert(__FieldTag::__uris) {
20192                                return std::result::Result::Err(A::Error::duplicate_field(
20193                                    "multiple values for uris",
20194                                ));
20195                            }
20196                            result.uris = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
20197                        }
20198                        __FieldTag::__site_to_site_data_transfer => {
20199                            if !fields.insert(__FieldTag::__site_to_site_data_transfer) {
20200                                return std::result::Result::Err(A::Error::duplicate_field(
20201                                    "multiple values for site_to_site_data_transfer",
20202                                ));
20203                            }
20204                            result.site_to_site_data_transfer = map
20205                                .next_value::<std::option::Option<bool>>()?
20206                                .unwrap_or_default();
20207                        }
20208                        __FieldTag::__vpc_network => {
20209                            if !fields.insert(__FieldTag::__vpc_network) {
20210                                return std::result::Result::Err(A::Error::duplicate_field(
20211                                    "multiple values for vpc_network",
20212                                ));
20213                            }
20214                            result.vpc_network = map
20215                                .next_value::<std::option::Option<std::string::String>>()?
20216                                .unwrap_or_default();
20217                        }
20218                        __FieldTag::__include_import_ranges => {
20219                            if !fields.insert(__FieldTag::__include_import_ranges) {
20220                                return std::result::Result::Err(A::Error::duplicate_field(
20221                                    "multiple values for include_import_ranges",
20222                                ));
20223                            }
20224                            result.include_import_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
20225                        }
20226                        __FieldTag::Unknown(key) => {
20227                            let value = map.next_value::<serde_json::Value>()?;
20228                            result._unknown_fields.insert(key, value);
20229                        }
20230                    }
20231                }
20232                std::result::Result::Ok(result)
20233            }
20234        }
20235        deserializer.deserialize_any(Visitor)
20236    }
20237}
20238
20239#[doc(hidden)]
20240impl serde::ser::Serialize for LinkedInterconnectAttachments {
20241    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20242    where
20243        S: serde::ser::Serializer,
20244    {
20245        use serde::ser::SerializeMap;
20246        #[allow(unused_imports)]
20247        use std::option::Option::Some;
20248        let mut state = serializer.serialize_map(std::option::Option::None)?;
20249        if !self.uris.is_empty() {
20250            state.serialize_entry("uris", &self.uris)?;
20251        }
20252        if !wkt::internal::is_default(&self.site_to_site_data_transfer) {
20253            state.serialize_entry("siteToSiteDataTransfer", &self.site_to_site_data_transfer)?;
20254        }
20255        if !self.vpc_network.is_empty() {
20256            state.serialize_entry("vpcNetwork", &self.vpc_network)?;
20257        }
20258        if !self.include_import_ranges.is_empty() {
20259            state.serialize_entry("includeImportRanges", &self.include_import_ranges)?;
20260        }
20261        if !self._unknown_fields.is_empty() {
20262            for (key, value) in self._unknown_fields.iter() {
20263                state.serialize_entry(key, &value)?;
20264            }
20265        }
20266        state.end()
20267    }
20268}
20269
20270/// A collection of router appliance instances. If you configure multiple router
20271/// appliance instances to receive data from the same set of sites outside of
20272/// Google Cloud, we recommend that you associate those instances with the same
20273/// spoke.
20274#[derive(Clone, Debug, Default, PartialEq)]
20275#[non_exhaustive]
20276pub struct LinkedRouterApplianceInstances {
20277    /// The list of router appliance instances.
20278    pub instances: std::vec::Vec<crate::model::RouterApplianceInstance>,
20279
20280    /// A value that controls whether site-to-site data transfer is enabled for
20281    /// these resources. Data transfer is available only in [supported
20282    /// locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations).
20283    pub site_to_site_data_transfer: bool,
20284
20285    /// Output only. The VPC network where these router appliance instances are
20286    /// located.
20287    pub vpc_network: std::string::String,
20288
20289    /// Optional. IP ranges allowed to be included during import from hub (does not
20290    /// control transit connectivity). The only allowed value for now is
20291    /// "ALL_IPV4_RANGES".
20292    pub include_import_ranges: std::vec::Vec<std::string::String>,
20293
20294    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20295}
20296
20297impl LinkedRouterApplianceInstances {
20298    pub fn new() -> Self {
20299        std::default::Default::default()
20300    }
20301
20302    /// Sets the value of [instances][crate::model::LinkedRouterApplianceInstances::instances].
20303    pub fn set_instances<T, V>(mut self, v: T) -> Self
20304    where
20305        T: std::iter::IntoIterator<Item = V>,
20306        V: std::convert::Into<crate::model::RouterApplianceInstance>,
20307    {
20308        use std::iter::Iterator;
20309        self.instances = v.into_iter().map(|i| i.into()).collect();
20310        self
20311    }
20312
20313    /// Sets the value of [site_to_site_data_transfer][crate::model::LinkedRouterApplianceInstances::site_to_site_data_transfer].
20314    pub fn set_site_to_site_data_transfer<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
20315        self.site_to_site_data_transfer = v.into();
20316        self
20317    }
20318
20319    /// Sets the value of [vpc_network][crate::model::LinkedRouterApplianceInstances::vpc_network].
20320    pub fn set_vpc_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20321        self.vpc_network = v.into();
20322        self
20323    }
20324
20325    /// Sets the value of [include_import_ranges][crate::model::LinkedRouterApplianceInstances::include_import_ranges].
20326    pub fn set_include_import_ranges<T, V>(mut self, v: T) -> Self
20327    where
20328        T: std::iter::IntoIterator<Item = V>,
20329        V: std::convert::Into<std::string::String>,
20330    {
20331        use std::iter::Iterator;
20332        self.include_import_ranges = v.into_iter().map(|i| i.into()).collect();
20333        self
20334    }
20335}
20336
20337impl wkt::message::Message for LinkedRouterApplianceInstances {
20338    fn typename() -> &'static str {
20339        "type.googleapis.com/google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances"
20340    }
20341}
20342
20343#[doc(hidden)]
20344impl<'de> serde::de::Deserialize<'de> for LinkedRouterApplianceInstances {
20345    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20346    where
20347        D: serde::Deserializer<'de>,
20348    {
20349        #[allow(non_camel_case_types)]
20350        #[doc(hidden)]
20351        #[derive(PartialEq, Eq, Hash)]
20352        enum __FieldTag {
20353            __instances,
20354            __site_to_site_data_transfer,
20355            __vpc_network,
20356            __include_import_ranges,
20357            Unknown(std::string::String),
20358        }
20359        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
20360            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20361            where
20362                D: serde::Deserializer<'de>,
20363            {
20364                struct Visitor;
20365                impl<'de> serde::de::Visitor<'de> for Visitor {
20366                    type Value = __FieldTag;
20367                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20368                        formatter.write_str("a field name for LinkedRouterApplianceInstances")
20369                    }
20370                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
20371                    where
20372                        E: serde::de::Error,
20373                    {
20374                        use std::result::Result::Ok;
20375                        use std::string::ToString;
20376                        match value {
20377                            "instances" => Ok(__FieldTag::__instances),
20378                            "siteToSiteDataTransfer" => {
20379                                Ok(__FieldTag::__site_to_site_data_transfer)
20380                            }
20381                            "site_to_site_data_transfer" => {
20382                                Ok(__FieldTag::__site_to_site_data_transfer)
20383                            }
20384                            "vpcNetwork" => Ok(__FieldTag::__vpc_network),
20385                            "vpc_network" => Ok(__FieldTag::__vpc_network),
20386                            "includeImportRanges" => Ok(__FieldTag::__include_import_ranges),
20387                            "include_import_ranges" => Ok(__FieldTag::__include_import_ranges),
20388                            _ => Ok(__FieldTag::Unknown(value.to_string())),
20389                        }
20390                    }
20391                }
20392                deserializer.deserialize_identifier(Visitor)
20393            }
20394        }
20395        struct Visitor;
20396        impl<'de> serde::de::Visitor<'de> for Visitor {
20397            type Value = LinkedRouterApplianceInstances;
20398            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20399                formatter.write_str("struct LinkedRouterApplianceInstances")
20400            }
20401            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
20402            where
20403                A: serde::de::MapAccess<'de>,
20404            {
20405                #[allow(unused_imports)]
20406                use serde::de::Error;
20407                use std::option::Option::Some;
20408                let mut fields = std::collections::HashSet::new();
20409                let mut result = Self::Value::new();
20410                while let Some(tag) = map.next_key::<__FieldTag>()? {
20411                    #[allow(clippy::match_single_binding)]
20412                    match tag {
20413                        __FieldTag::__instances => {
20414                            if !fields.insert(__FieldTag::__instances) {
20415                                return std::result::Result::Err(A::Error::duplicate_field(
20416                                    "multiple values for instances",
20417                                ));
20418                            }
20419                            result.instances = map
20420                                .next_value::<std::option::Option<
20421                                    std::vec::Vec<crate::model::RouterApplianceInstance>,
20422                                >>()?
20423                                .unwrap_or_default();
20424                        }
20425                        __FieldTag::__site_to_site_data_transfer => {
20426                            if !fields.insert(__FieldTag::__site_to_site_data_transfer) {
20427                                return std::result::Result::Err(A::Error::duplicate_field(
20428                                    "multiple values for site_to_site_data_transfer",
20429                                ));
20430                            }
20431                            result.site_to_site_data_transfer = map
20432                                .next_value::<std::option::Option<bool>>()?
20433                                .unwrap_or_default();
20434                        }
20435                        __FieldTag::__vpc_network => {
20436                            if !fields.insert(__FieldTag::__vpc_network) {
20437                                return std::result::Result::Err(A::Error::duplicate_field(
20438                                    "multiple values for vpc_network",
20439                                ));
20440                            }
20441                            result.vpc_network = map
20442                                .next_value::<std::option::Option<std::string::String>>()?
20443                                .unwrap_or_default();
20444                        }
20445                        __FieldTag::__include_import_ranges => {
20446                            if !fields.insert(__FieldTag::__include_import_ranges) {
20447                                return std::result::Result::Err(A::Error::duplicate_field(
20448                                    "multiple values for include_import_ranges",
20449                                ));
20450                            }
20451                            result.include_import_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
20452                        }
20453                        __FieldTag::Unknown(key) => {
20454                            let value = map.next_value::<serde_json::Value>()?;
20455                            result._unknown_fields.insert(key, value);
20456                        }
20457                    }
20458                }
20459                std::result::Result::Ok(result)
20460            }
20461        }
20462        deserializer.deserialize_any(Visitor)
20463    }
20464}
20465
20466#[doc(hidden)]
20467impl serde::ser::Serialize for LinkedRouterApplianceInstances {
20468    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20469    where
20470        S: serde::ser::Serializer,
20471    {
20472        use serde::ser::SerializeMap;
20473        #[allow(unused_imports)]
20474        use std::option::Option::Some;
20475        let mut state = serializer.serialize_map(std::option::Option::None)?;
20476        if !self.instances.is_empty() {
20477            state.serialize_entry("instances", &self.instances)?;
20478        }
20479        if !wkt::internal::is_default(&self.site_to_site_data_transfer) {
20480            state.serialize_entry("siteToSiteDataTransfer", &self.site_to_site_data_transfer)?;
20481        }
20482        if !self.vpc_network.is_empty() {
20483            state.serialize_entry("vpcNetwork", &self.vpc_network)?;
20484        }
20485        if !self.include_import_ranges.is_empty() {
20486            state.serialize_entry("includeImportRanges", &self.include_import_ranges)?;
20487        }
20488        if !self._unknown_fields.is_empty() {
20489            for (key, value) in self._unknown_fields.iter() {
20490                state.serialize_entry(key, &value)?;
20491            }
20492        }
20493        state.end()
20494    }
20495}
20496
20497/// An existing VPC network.
20498#[derive(Clone, Debug, Default, PartialEq)]
20499#[non_exhaustive]
20500pub struct LinkedVpcNetwork {
20501    /// Required. The URI of the VPC network resource.
20502    pub uri: std::string::String,
20503
20504    /// Optional. IP ranges encompassing the subnets to be excluded from peering.
20505    pub exclude_export_ranges: std::vec::Vec<std::string::String>,
20506
20507    /// Optional. IP ranges allowed to be included from peering.
20508    pub include_export_ranges: std::vec::Vec<std::string::String>,
20509
20510    /// Optional. The proposed include export IP ranges waiting for hub
20511    /// administration's approval.
20512    pub proposed_include_export_ranges: std::vec::Vec<std::string::String>,
20513
20514    /// Output only. The proposed exclude export IP ranges waiting for hub
20515    /// administration's approval.
20516    pub proposed_exclude_export_ranges: std::vec::Vec<std::string::String>,
20517
20518    /// Output only. The list of Producer VPC spokes that this VPC spoke is a
20519    /// service consumer VPC spoke for. These producer VPCs are connected through
20520    /// VPC peering to this spoke's backing VPC network. Because they are directly
20521    /// connected throuh VPC peering, NCC export filters do not apply between the
20522    /// service consumer VPC spoke and any of its producer VPC spokes. This VPC
20523    /// spoke cannot be deleted as long as any of these producer VPC spokes are
20524    /// connected to the NCC Hub.
20525    pub producer_vpc_spokes: std::vec::Vec<std::string::String>,
20526
20527    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20528}
20529
20530impl LinkedVpcNetwork {
20531    pub fn new() -> Self {
20532        std::default::Default::default()
20533    }
20534
20535    /// Sets the value of [uri][crate::model::LinkedVpcNetwork::uri].
20536    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20537        self.uri = v.into();
20538        self
20539    }
20540
20541    /// Sets the value of [exclude_export_ranges][crate::model::LinkedVpcNetwork::exclude_export_ranges].
20542    pub fn set_exclude_export_ranges<T, V>(mut self, v: T) -> Self
20543    where
20544        T: std::iter::IntoIterator<Item = V>,
20545        V: std::convert::Into<std::string::String>,
20546    {
20547        use std::iter::Iterator;
20548        self.exclude_export_ranges = v.into_iter().map(|i| i.into()).collect();
20549        self
20550    }
20551
20552    /// Sets the value of [include_export_ranges][crate::model::LinkedVpcNetwork::include_export_ranges].
20553    pub fn set_include_export_ranges<T, V>(mut self, v: T) -> Self
20554    where
20555        T: std::iter::IntoIterator<Item = V>,
20556        V: std::convert::Into<std::string::String>,
20557    {
20558        use std::iter::Iterator;
20559        self.include_export_ranges = v.into_iter().map(|i| i.into()).collect();
20560        self
20561    }
20562
20563    /// Sets the value of [proposed_include_export_ranges][crate::model::LinkedVpcNetwork::proposed_include_export_ranges].
20564    pub fn set_proposed_include_export_ranges<T, V>(mut self, v: T) -> Self
20565    where
20566        T: std::iter::IntoIterator<Item = V>,
20567        V: std::convert::Into<std::string::String>,
20568    {
20569        use std::iter::Iterator;
20570        self.proposed_include_export_ranges = v.into_iter().map(|i| i.into()).collect();
20571        self
20572    }
20573
20574    /// Sets the value of [proposed_exclude_export_ranges][crate::model::LinkedVpcNetwork::proposed_exclude_export_ranges].
20575    pub fn set_proposed_exclude_export_ranges<T, V>(mut self, v: T) -> Self
20576    where
20577        T: std::iter::IntoIterator<Item = V>,
20578        V: std::convert::Into<std::string::String>,
20579    {
20580        use std::iter::Iterator;
20581        self.proposed_exclude_export_ranges = v.into_iter().map(|i| i.into()).collect();
20582        self
20583    }
20584
20585    /// Sets the value of [producer_vpc_spokes][crate::model::LinkedVpcNetwork::producer_vpc_spokes].
20586    pub fn set_producer_vpc_spokes<T, V>(mut self, v: T) -> Self
20587    where
20588        T: std::iter::IntoIterator<Item = V>,
20589        V: std::convert::Into<std::string::String>,
20590    {
20591        use std::iter::Iterator;
20592        self.producer_vpc_spokes = v.into_iter().map(|i| i.into()).collect();
20593        self
20594    }
20595}
20596
20597impl wkt::message::Message for LinkedVpcNetwork {
20598    fn typename() -> &'static str {
20599        "type.googleapis.com/google.cloud.networkconnectivity.v1.LinkedVpcNetwork"
20600    }
20601}
20602
20603#[doc(hidden)]
20604impl<'de> serde::de::Deserialize<'de> for LinkedVpcNetwork {
20605    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20606    where
20607        D: serde::Deserializer<'de>,
20608    {
20609        #[allow(non_camel_case_types)]
20610        #[doc(hidden)]
20611        #[derive(PartialEq, Eq, Hash)]
20612        enum __FieldTag {
20613            __uri,
20614            __exclude_export_ranges,
20615            __include_export_ranges,
20616            __proposed_include_export_ranges,
20617            __proposed_exclude_export_ranges,
20618            __producer_vpc_spokes,
20619            Unknown(std::string::String),
20620        }
20621        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
20622            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20623            where
20624                D: serde::Deserializer<'de>,
20625            {
20626                struct Visitor;
20627                impl<'de> serde::de::Visitor<'de> for Visitor {
20628                    type Value = __FieldTag;
20629                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20630                        formatter.write_str("a field name for LinkedVpcNetwork")
20631                    }
20632                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
20633                    where
20634                        E: serde::de::Error,
20635                    {
20636                        use std::result::Result::Ok;
20637                        use std::string::ToString;
20638                        match value {
20639                            "uri" => Ok(__FieldTag::__uri),
20640                            "excludeExportRanges" => Ok(__FieldTag::__exclude_export_ranges),
20641                            "exclude_export_ranges" => Ok(__FieldTag::__exclude_export_ranges),
20642                            "includeExportRanges" => Ok(__FieldTag::__include_export_ranges),
20643                            "include_export_ranges" => Ok(__FieldTag::__include_export_ranges),
20644                            "proposedIncludeExportRanges" => {
20645                                Ok(__FieldTag::__proposed_include_export_ranges)
20646                            }
20647                            "proposed_include_export_ranges" => {
20648                                Ok(__FieldTag::__proposed_include_export_ranges)
20649                            }
20650                            "proposedExcludeExportRanges" => {
20651                                Ok(__FieldTag::__proposed_exclude_export_ranges)
20652                            }
20653                            "proposed_exclude_export_ranges" => {
20654                                Ok(__FieldTag::__proposed_exclude_export_ranges)
20655                            }
20656                            "producerVpcSpokes" => Ok(__FieldTag::__producer_vpc_spokes),
20657                            "producer_vpc_spokes" => Ok(__FieldTag::__producer_vpc_spokes),
20658                            _ => Ok(__FieldTag::Unknown(value.to_string())),
20659                        }
20660                    }
20661                }
20662                deserializer.deserialize_identifier(Visitor)
20663            }
20664        }
20665        struct Visitor;
20666        impl<'de> serde::de::Visitor<'de> for Visitor {
20667            type Value = LinkedVpcNetwork;
20668            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20669                formatter.write_str("struct LinkedVpcNetwork")
20670            }
20671            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
20672            where
20673                A: serde::de::MapAccess<'de>,
20674            {
20675                #[allow(unused_imports)]
20676                use serde::de::Error;
20677                use std::option::Option::Some;
20678                let mut fields = std::collections::HashSet::new();
20679                let mut result = Self::Value::new();
20680                while let Some(tag) = map.next_key::<__FieldTag>()? {
20681                    #[allow(clippy::match_single_binding)]
20682                    match tag {
20683                        __FieldTag::__uri => {
20684                            if !fields.insert(__FieldTag::__uri) {
20685                                return std::result::Result::Err(A::Error::duplicate_field(
20686                                    "multiple values for uri",
20687                                ));
20688                            }
20689                            result.uri = map
20690                                .next_value::<std::option::Option<std::string::String>>()?
20691                                .unwrap_or_default();
20692                        }
20693                        __FieldTag::__exclude_export_ranges => {
20694                            if !fields.insert(__FieldTag::__exclude_export_ranges) {
20695                                return std::result::Result::Err(A::Error::duplicate_field(
20696                                    "multiple values for exclude_export_ranges",
20697                                ));
20698                            }
20699                            result.exclude_export_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
20700                        }
20701                        __FieldTag::__include_export_ranges => {
20702                            if !fields.insert(__FieldTag::__include_export_ranges) {
20703                                return std::result::Result::Err(A::Error::duplicate_field(
20704                                    "multiple values for include_export_ranges",
20705                                ));
20706                            }
20707                            result.include_export_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
20708                        }
20709                        __FieldTag::__proposed_include_export_ranges => {
20710                            if !fields.insert(__FieldTag::__proposed_include_export_ranges) {
20711                                return std::result::Result::Err(A::Error::duplicate_field(
20712                                    "multiple values for proposed_include_export_ranges",
20713                                ));
20714                            }
20715                            result.proposed_include_export_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
20716                        }
20717                        __FieldTag::__proposed_exclude_export_ranges => {
20718                            if !fields.insert(__FieldTag::__proposed_exclude_export_ranges) {
20719                                return std::result::Result::Err(A::Error::duplicate_field(
20720                                    "multiple values for proposed_exclude_export_ranges",
20721                                ));
20722                            }
20723                            result.proposed_exclude_export_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
20724                        }
20725                        __FieldTag::__producer_vpc_spokes => {
20726                            if !fields.insert(__FieldTag::__producer_vpc_spokes) {
20727                                return std::result::Result::Err(A::Error::duplicate_field(
20728                                    "multiple values for producer_vpc_spokes",
20729                                ));
20730                            }
20731                            result.producer_vpc_spokes = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
20732                        }
20733                        __FieldTag::Unknown(key) => {
20734                            let value = map.next_value::<serde_json::Value>()?;
20735                            result._unknown_fields.insert(key, value);
20736                        }
20737                    }
20738                }
20739                std::result::Result::Ok(result)
20740            }
20741        }
20742        deserializer.deserialize_any(Visitor)
20743    }
20744}
20745
20746#[doc(hidden)]
20747impl serde::ser::Serialize for LinkedVpcNetwork {
20748    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20749    where
20750        S: serde::ser::Serializer,
20751    {
20752        use serde::ser::SerializeMap;
20753        #[allow(unused_imports)]
20754        use std::option::Option::Some;
20755        let mut state = serializer.serialize_map(std::option::Option::None)?;
20756        if !self.uri.is_empty() {
20757            state.serialize_entry("uri", &self.uri)?;
20758        }
20759        if !self.exclude_export_ranges.is_empty() {
20760            state.serialize_entry("excludeExportRanges", &self.exclude_export_ranges)?;
20761        }
20762        if !self.include_export_ranges.is_empty() {
20763            state.serialize_entry("includeExportRanges", &self.include_export_ranges)?;
20764        }
20765        if !self.proposed_include_export_ranges.is_empty() {
20766            state.serialize_entry(
20767                "proposedIncludeExportRanges",
20768                &self.proposed_include_export_ranges,
20769            )?;
20770        }
20771        if !self.proposed_exclude_export_ranges.is_empty() {
20772            state.serialize_entry(
20773                "proposedExcludeExportRanges",
20774                &self.proposed_exclude_export_ranges,
20775            )?;
20776        }
20777        if !self.producer_vpc_spokes.is_empty() {
20778            state.serialize_entry("producerVpcSpokes", &self.producer_vpc_spokes)?;
20779        }
20780        if !self._unknown_fields.is_empty() {
20781            for (key, value) in self._unknown_fields.iter() {
20782                state.serialize_entry(key, &value)?;
20783            }
20784        }
20785        state.end()
20786    }
20787}
20788
20789#[derive(Clone, Debug, Default, PartialEq)]
20790#[non_exhaustive]
20791pub struct LinkedProducerVpcNetwork {
20792    /// Immutable. The URI of the Service Consumer VPC that the Producer VPC is
20793    /// peered with.
20794    pub network: std::string::String,
20795
20796    /// Output only. The Service Consumer Network spoke.
20797    pub service_consumer_vpc_spoke: std::string::String,
20798
20799    /// Immutable. The name of the VPC peering between the Service Consumer VPC and
20800    /// the Producer VPC (defined in the Tenant project) which is added to the NCC
20801    /// hub. This peering must be in ACTIVE state.
20802    pub peering: std::string::String,
20803
20804    /// Output only. The URI of the Producer VPC.
20805    pub producer_network: std::string::String,
20806
20807    /// Optional. IP ranges encompassing the subnets to be excluded from peering.
20808    pub exclude_export_ranges: std::vec::Vec<std::string::String>,
20809
20810    /// Optional. IP ranges allowed to be included from peering.
20811    pub include_export_ranges: std::vec::Vec<std::string::String>,
20812
20813    /// Optional. The proposed include export IP ranges waiting for hub
20814    /// administration's approval.
20815    pub proposed_include_export_ranges: std::vec::Vec<std::string::String>,
20816
20817    /// Output only. The proposed exclude export IP ranges waiting for hub
20818    /// administration's approval.
20819    pub proposed_exclude_export_ranges: std::vec::Vec<std::string::String>,
20820
20821    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20822}
20823
20824impl LinkedProducerVpcNetwork {
20825    pub fn new() -> Self {
20826        std::default::Default::default()
20827    }
20828
20829    /// Sets the value of [network][crate::model::LinkedProducerVpcNetwork::network].
20830    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20831        self.network = v.into();
20832        self
20833    }
20834
20835    /// Sets the value of [service_consumer_vpc_spoke][crate::model::LinkedProducerVpcNetwork::service_consumer_vpc_spoke].
20836    pub fn set_service_consumer_vpc_spoke<T: std::convert::Into<std::string::String>>(
20837        mut self,
20838        v: T,
20839    ) -> Self {
20840        self.service_consumer_vpc_spoke = v.into();
20841        self
20842    }
20843
20844    /// Sets the value of [peering][crate::model::LinkedProducerVpcNetwork::peering].
20845    pub fn set_peering<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20846        self.peering = v.into();
20847        self
20848    }
20849
20850    /// Sets the value of [producer_network][crate::model::LinkedProducerVpcNetwork::producer_network].
20851    pub fn set_producer_network<T: std::convert::Into<std::string::String>>(
20852        mut self,
20853        v: T,
20854    ) -> Self {
20855        self.producer_network = v.into();
20856        self
20857    }
20858
20859    /// Sets the value of [exclude_export_ranges][crate::model::LinkedProducerVpcNetwork::exclude_export_ranges].
20860    pub fn set_exclude_export_ranges<T, V>(mut self, v: T) -> Self
20861    where
20862        T: std::iter::IntoIterator<Item = V>,
20863        V: std::convert::Into<std::string::String>,
20864    {
20865        use std::iter::Iterator;
20866        self.exclude_export_ranges = v.into_iter().map(|i| i.into()).collect();
20867        self
20868    }
20869
20870    /// Sets the value of [include_export_ranges][crate::model::LinkedProducerVpcNetwork::include_export_ranges].
20871    pub fn set_include_export_ranges<T, V>(mut self, v: T) -> Self
20872    where
20873        T: std::iter::IntoIterator<Item = V>,
20874        V: std::convert::Into<std::string::String>,
20875    {
20876        use std::iter::Iterator;
20877        self.include_export_ranges = v.into_iter().map(|i| i.into()).collect();
20878        self
20879    }
20880
20881    /// Sets the value of [proposed_include_export_ranges][crate::model::LinkedProducerVpcNetwork::proposed_include_export_ranges].
20882    pub fn set_proposed_include_export_ranges<T, V>(mut self, v: T) -> Self
20883    where
20884        T: std::iter::IntoIterator<Item = V>,
20885        V: std::convert::Into<std::string::String>,
20886    {
20887        use std::iter::Iterator;
20888        self.proposed_include_export_ranges = v.into_iter().map(|i| i.into()).collect();
20889        self
20890    }
20891
20892    /// Sets the value of [proposed_exclude_export_ranges][crate::model::LinkedProducerVpcNetwork::proposed_exclude_export_ranges].
20893    pub fn set_proposed_exclude_export_ranges<T, V>(mut self, v: T) -> Self
20894    where
20895        T: std::iter::IntoIterator<Item = V>,
20896        V: std::convert::Into<std::string::String>,
20897    {
20898        use std::iter::Iterator;
20899        self.proposed_exclude_export_ranges = v.into_iter().map(|i| i.into()).collect();
20900        self
20901    }
20902}
20903
20904impl wkt::message::Message for LinkedProducerVpcNetwork {
20905    fn typename() -> &'static str {
20906        "type.googleapis.com/google.cloud.networkconnectivity.v1.LinkedProducerVpcNetwork"
20907    }
20908}
20909
20910#[doc(hidden)]
20911impl<'de> serde::de::Deserialize<'de> for LinkedProducerVpcNetwork {
20912    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20913    where
20914        D: serde::Deserializer<'de>,
20915    {
20916        #[allow(non_camel_case_types)]
20917        #[doc(hidden)]
20918        #[derive(PartialEq, Eq, Hash)]
20919        enum __FieldTag {
20920            __network,
20921            __service_consumer_vpc_spoke,
20922            __peering,
20923            __producer_network,
20924            __exclude_export_ranges,
20925            __include_export_ranges,
20926            __proposed_include_export_ranges,
20927            __proposed_exclude_export_ranges,
20928            Unknown(std::string::String),
20929        }
20930        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
20931            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20932            where
20933                D: serde::Deserializer<'de>,
20934            {
20935                struct Visitor;
20936                impl<'de> serde::de::Visitor<'de> for Visitor {
20937                    type Value = __FieldTag;
20938                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20939                        formatter.write_str("a field name for LinkedProducerVpcNetwork")
20940                    }
20941                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
20942                    where
20943                        E: serde::de::Error,
20944                    {
20945                        use std::result::Result::Ok;
20946                        use std::string::ToString;
20947                        match value {
20948                            "network" => Ok(__FieldTag::__network),
20949                            "serviceConsumerVpcSpoke" => {
20950                                Ok(__FieldTag::__service_consumer_vpc_spoke)
20951                            }
20952                            "service_consumer_vpc_spoke" => {
20953                                Ok(__FieldTag::__service_consumer_vpc_spoke)
20954                            }
20955                            "peering" => Ok(__FieldTag::__peering),
20956                            "producerNetwork" => Ok(__FieldTag::__producer_network),
20957                            "producer_network" => Ok(__FieldTag::__producer_network),
20958                            "excludeExportRanges" => Ok(__FieldTag::__exclude_export_ranges),
20959                            "exclude_export_ranges" => Ok(__FieldTag::__exclude_export_ranges),
20960                            "includeExportRanges" => Ok(__FieldTag::__include_export_ranges),
20961                            "include_export_ranges" => Ok(__FieldTag::__include_export_ranges),
20962                            "proposedIncludeExportRanges" => {
20963                                Ok(__FieldTag::__proposed_include_export_ranges)
20964                            }
20965                            "proposed_include_export_ranges" => {
20966                                Ok(__FieldTag::__proposed_include_export_ranges)
20967                            }
20968                            "proposedExcludeExportRanges" => {
20969                                Ok(__FieldTag::__proposed_exclude_export_ranges)
20970                            }
20971                            "proposed_exclude_export_ranges" => {
20972                                Ok(__FieldTag::__proposed_exclude_export_ranges)
20973                            }
20974                            _ => Ok(__FieldTag::Unknown(value.to_string())),
20975                        }
20976                    }
20977                }
20978                deserializer.deserialize_identifier(Visitor)
20979            }
20980        }
20981        struct Visitor;
20982        impl<'de> serde::de::Visitor<'de> for Visitor {
20983            type Value = LinkedProducerVpcNetwork;
20984            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20985                formatter.write_str("struct LinkedProducerVpcNetwork")
20986            }
20987            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
20988            where
20989                A: serde::de::MapAccess<'de>,
20990            {
20991                #[allow(unused_imports)]
20992                use serde::de::Error;
20993                use std::option::Option::Some;
20994                let mut fields = std::collections::HashSet::new();
20995                let mut result = Self::Value::new();
20996                while let Some(tag) = map.next_key::<__FieldTag>()? {
20997                    #[allow(clippy::match_single_binding)]
20998                    match tag {
20999                        __FieldTag::__network => {
21000                            if !fields.insert(__FieldTag::__network) {
21001                                return std::result::Result::Err(A::Error::duplicate_field(
21002                                    "multiple values for network",
21003                                ));
21004                            }
21005                            result.network = map
21006                                .next_value::<std::option::Option<std::string::String>>()?
21007                                .unwrap_or_default();
21008                        }
21009                        __FieldTag::__service_consumer_vpc_spoke => {
21010                            if !fields.insert(__FieldTag::__service_consumer_vpc_spoke) {
21011                                return std::result::Result::Err(A::Error::duplicate_field(
21012                                    "multiple values for service_consumer_vpc_spoke",
21013                                ));
21014                            }
21015                            result.service_consumer_vpc_spoke = map
21016                                .next_value::<std::option::Option<std::string::String>>()?
21017                                .unwrap_or_default();
21018                        }
21019                        __FieldTag::__peering => {
21020                            if !fields.insert(__FieldTag::__peering) {
21021                                return std::result::Result::Err(A::Error::duplicate_field(
21022                                    "multiple values for peering",
21023                                ));
21024                            }
21025                            result.peering = map
21026                                .next_value::<std::option::Option<std::string::String>>()?
21027                                .unwrap_or_default();
21028                        }
21029                        __FieldTag::__producer_network => {
21030                            if !fields.insert(__FieldTag::__producer_network) {
21031                                return std::result::Result::Err(A::Error::duplicate_field(
21032                                    "multiple values for producer_network",
21033                                ));
21034                            }
21035                            result.producer_network = map
21036                                .next_value::<std::option::Option<std::string::String>>()?
21037                                .unwrap_or_default();
21038                        }
21039                        __FieldTag::__exclude_export_ranges => {
21040                            if !fields.insert(__FieldTag::__exclude_export_ranges) {
21041                                return std::result::Result::Err(A::Error::duplicate_field(
21042                                    "multiple values for exclude_export_ranges",
21043                                ));
21044                            }
21045                            result.exclude_export_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
21046                        }
21047                        __FieldTag::__include_export_ranges => {
21048                            if !fields.insert(__FieldTag::__include_export_ranges) {
21049                                return std::result::Result::Err(A::Error::duplicate_field(
21050                                    "multiple values for include_export_ranges",
21051                                ));
21052                            }
21053                            result.include_export_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
21054                        }
21055                        __FieldTag::__proposed_include_export_ranges => {
21056                            if !fields.insert(__FieldTag::__proposed_include_export_ranges) {
21057                                return std::result::Result::Err(A::Error::duplicate_field(
21058                                    "multiple values for proposed_include_export_ranges",
21059                                ));
21060                            }
21061                            result.proposed_include_export_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
21062                        }
21063                        __FieldTag::__proposed_exclude_export_ranges => {
21064                            if !fields.insert(__FieldTag::__proposed_exclude_export_ranges) {
21065                                return std::result::Result::Err(A::Error::duplicate_field(
21066                                    "multiple values for proposed_exclude_export_ranges",
21067                                ));
21068                            }
21069                            result.proposed_exclude_export_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
21070                        }
21071                        __FieldTag::Unknown(key) => {
21072                            let value = map.next_value::<serde_json::Value>()?;
21073                            result._unknown_fields.insert(key, value);
21074                        }
21075                    }
21076                }
21077                std::result::Result::Ok(result)
21078            }
21079        }
21080        deserializer.deserialize_any(Visitor)
21081    }
21082}
21083
21084#[doc(hidden)]
21085impl serde::ser::Serialize for LinkedProducerVpcNetwork {
21086    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21087    where
21088        S: serde::ser::Serializer,
21089    {
21090        use serde::ser::SerializeMap;
21091        #[allow(unused_imports)]
21092        use std::option::Option::Some;
21093        let mut state = serializer.serialize_map(std::option::Option::None)?;
21094        if !self.network.is_empty() {
21095            state.serialize_entry("network", &self.network)?;
21096        }
21097        if !self.service_consumer_vpc_spoke.is_empty() {
21098            state.serialize_entry("serviceConsumerVpcSpoke", &self.service_consumer_vpc_spoke)?;
21099        }
21100        if !self.peering.is_empty() {
21101            state.serialize_entry("peering", &self.peering)?;
21102        }
21103        if !self.producer_network.is_empty() {
21104            state.serialize_entry("producerNetwork", &self.producer_network)?;
21105        }
21106        if !self.exclude_export_ranges.is_empty() {
21107            state.serialize_entry("excludeExportRanges", &self.exclude_export_ranges)?;
21108        }
21109        if !self.include_export_ranges.is_empty() {
21110            state.serialize_entry("includeExportRanges", &self.include_export_ranges)?;
21111        }
21112        if !self.proposed_include_export_ranges.is_empty() {
21113            state.serialize_entry(
21114                "proposedIncludeExportRanges",
21115                &self.proposed_include_export_ranges,
21116            )?;
21117        }
21118        if !self.proposed_exclude_export_ranges.is_empty() {
21119            state.serialize_entry(
21120                "proposedExcludeExportRanges",
21121                &self.proposed_exclude_export_ranges,
21122            )?;
21123        }
21124        if !self._unknown_fields.is_empty() {
21125            for (key, value) in self._unknown_fields.iter() {
21126                state.serialize_entry(key, &value)?;
21127            }
21128        }
21129        state.end()
21130    }
21131}
21132
21133/// A router appliance instance is a Compute Engine virtual machine (VM) instance
21134/// that acts as a BGP speaker. A router appliance instance is specified by the
21135/// URI of the VM and the internal IP address of one of the VM's network
21136/// interfaces.
21137#[derive(Clone, Debug, Default, PartialEq)]
21138#[non_exhaustive]
21139pub struct RouterApplianceInstance {
21140    /// The URI of the VM.
21141    pub virtual_machine: std::string::String,
21142
21143    /// The IP address on the VM to use for peering.
21144    pub ip_address: std::string::String,
21145
21146    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21147}
21148
21149impl RouterApplianceInstance {
21150    pub fn new() -> Self {
21151        std::default::Default::default()
21152    }
21153
21154    /// Sets the value of [virtual_machine][crate::model::RouterApplianceInstance::virtual_machine].
21155    pub fn set_virtual_machine<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21156        self.virtual_machine = v.into();
21157        self
21158    }
21159
21160    /// Sets the value of [ip_address][crate::model::RouterApplianceInstance::ip_address].
21161    pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21162        self.ip_address = v.into();
21163        self
21164    }
21165}
21166
21167impl wkt::message::Message for RouterApplianceInstance {
21168    fn typename() -> &'static str {
21169        "type.googleapis.com/google.cloud.networkconnectivity.v1.RouterApplianceInstance"
21170    }
21171}
21172
21173#[doc(hidden)]
21174impl<'de> serde::de::Deserialize<'de> for RouterApplianceInstance {
21175    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21176    where
21177        D: serde::Deserializer<'de>,
21178    {
21179        #[allow(non_camel_case_types)]
21180        #[doc(hidden)]
21181        #[derive(PartialEq, Eq, Hash)]
21182        enum __FieldTag {
21183            __virtual_machine,
21184            __ip_address,
21185            Unknown(std::string::String),
21186        }
21187        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21188            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21189            where
21190                D: serde::Deserializer<'de>,
21191            {
21192                struct Visitor;
21193                impl<'de> serde::de::Visitor<'de> for Visitor {
21194                    type Value = __FieldTag;
21195                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21196                        formatter.write_str("a field name for RouterApplianceInstance")
21197                    }
21198                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21199                    where
21200                        E: serde::de::Error,
21201                    {
21202                        use std::result::Result::Ok;
21203                        use std::string::ToString;
21204                        match value {
21205                            "virtualMachine" => Ok(__FieldTag::__virtual_machine),
21206                            "virtual_machine" => Ok(__FieldTag::__virtual_machine),
21207                            "ipAddress" => Ok(__FieldTag::__ip_address),
21208                            "ip_address" => Ok(__FieldTag::__ip_address),
21209                            _ => Ok(__FieldTag::Unknown(value.to_string())),
21210                        }
21211                    }
21212                }
21213                deserializer.deserialize_identifier(Visitor)
21214            }
21215        }
21216        struct Visitor;
21217        impl<'de> serde::de::Visitor<'de> for Visitor {
21218            type Value = RouterApplianceInstance;
21219            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21220                formatter.write_str("struct RouterApplianceInstance")
21221            }
21222            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21223            where
21224                A: serde::de::MapAccess<'de>,
21225            {
21226                #[allow(unused_imports)]
21227                use serde::de::Error;
21228                use std::option::Option::Some;
21229                let mut fields = std::collections::HashSet::new();
21230                let mut result = Self::Value::new();
21231                while let Some(tag) = map.next_key::<__FieldTag>()? {
21232                    #[allow(clippy::match_single_binding)]
21233                    match tag {
21234                        __FieldTag::__virtual_machine => {
21235                            if !fields.insert(__FieldTag::__virtual_machine) {
21236                                return std::result::Result::Err(A::Error::duplicate_field(
21237                                    "multiple values for virtual_machine",
21238                                ));
21239                            }
21240                            result.virtual_machine = map
21241                                .next_value::<std::option::Option<std::string::String>>()?
21242                                .unwrap_or_default();
21243                        }
21244                        __FieldTag::__ip_address => {
21245                            if !fields.insert(__FieldTag::__ip_address) {
21246                                return std::result::Result::Err(A::Error::duplicate_field(
21247                                    "multiple values for ip_address",
21248                                ));
21249                            }
21250                            result.ip_address = map
21251                                .next_value::<std::option::Option<std::string::String>>()?
21252                                .unwrap_or_default();
21253                        }
21254                        __FieldTag::Unknown(key) => {
21255                            let value = map.next_value::<serde_json::Value>()?;
21256                            result._unknown_fields.insert(key, value);
21257                        }
21258                    }
21259                }
21260                std::result::Result::Ok(result)
21261            }
21262        }
21263        deserializer.deserialize_any(Visitor)
21264    }
21265}
21266
21267#[doc(hidden)]
21268impl serde::ser::Serialize for RouterApplianceInstance {
21269    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21270    where
21271        S: serde::ser::Serializer,
21272    {
21273        use serde::ser::SerializeMap;
21274        #[allow(unused_imports)]
21275        use std::option::Option::Some;
21276        let mut state = serializer.serialize_map(std::option::Option::None)?;
21277        if !self.virtual_machine.is_empty() {
21278            state.serialize_entry("virtualMachine", &self.virtual_machine)?;
21279        }
21280        if !self.ip_address.is_empty() {
21281            state.serialize_entry("ipAddress", &self.ip_address)?;
21282        }
21283        if !self._unknown_fields.is_empty() {
21284            for (key, value) in self._unknown_fields.iter() {
21285                state.serialize_entry(key, &value)?;
21286            }
21287        }
21288        state.end()
21289    }
21290}
21291
21292/// Metadata about locations
21293#[derive(Clone, Debug, Default, PartialEq)]
21294#[non_exhaustive]
21295pub struct LocationMetadata {
21296    /// List of supported features
21297    pub location_features: std::vec::Vec<crate::model::LocationFeature>,
21298
21299    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21300}
21301
21302impl LocationMetadata {
21303    pub fn new() -> Self {
21304        std::default::Default::default()
21305    }
21306
21307    /// Sets the value of [location_features][crate::model::LocationMetadata::location_features].
21308    pub fn set_location_features<T, V>(mut self, v: T) -> Self
21309    where
21310        T: std::iter::IntoIterator<Item = V>,
21311        V: std::convert::Into<crate::model::LocationFeature>,
21312    {
21313        use std::iter::Iterator;
21314        self.location_features = v.into_iter().map(|i| i.into()).collect();
21315        self
21316    }
21317}
21318
21319impl wkt::message::Message for LocationMetadata {
21320    fn typename() -> &'static str {
21321        "type.googleapis.com/google.cloud.networkconnectivity.v1.LocationMetadata"
21322    }
21323}
21324
21325#[doc(hidden)]
21326impl<'de> serde::de::Deserialize<'de> for LocationMetadata {
21327    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21328    where
21329        D: serde::Deserializer<'de>,
21330    {
21331        #[allow(non_camel_case_types)]
21332        #[doc(hidden)]
21333        #[derive(PartialEq, Eq, Hash)]
21334        enum __FieldTag {
21335            __location_features,
21336            Unknown(std::string::String),
21337        }
21338        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21339            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21340            where
21341                D: serde::Deserializer<'de>,
21342            {
21343                struct Visitor;
21344                impl<'de> serde::de::Visitor<'de> for Visitor {
21345                    type Value = __FieldTag;
21346                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21347                        formatter.write_str("a field name for LocationMetadata")
21348                    }
21349                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21350                    where
21351                        E: serde::de::Error,
21352                    {
21353                        use std::result::Result::Ok;
21354                        use std::string::ToString;
21355                        match value {
21356                            "locationFeatures" => Ok(__FieldTag::__location_features),
21357                            "location_features" => Ok(__FieldTag::__location_features),
21358                            _ => Ok(__FieldTag::Unknown(value.to_string())),
21359                        }
21360                    }
21361                }
21362                deserializer.deserialize_identifier(Visitor)
21363            }
21364        }
21365        struct Visitor;
21366        impl<'de> serde::de::Visitor<'de> for Visitor {
21367            type Value = LocationMetadata;
21368            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21369                formatter.write_str("struct LocationMetadata")
21370            }
21371            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21372            where
21373                A: serde::de::MapAccess<'de>,
21374            {
21375                #[allow(unused_imports)]
21376                use serde::de::Error;
21377                use std::option::Option::Some;
21378                let mut fields = std::collections::HashSet::new();
21379                let mut result = Self::Value::new();
21380                while let Some(tag) = map.next_key::<__FieldTag>()? {
21381                    #[allow(clippy::match_single_binding)]
21382                    match tag {
21383                        __FieldTag::__location_features => {
21384                            if !fields.insert(__FieldTag::__location_features) {
21385                                return std::result::Result::Err(A::Error::duplicate_field(
21386                                    "multiple values for location_features",
21387                                ));
21388                            }
21389                            result.location_features =
21390                                map.next_value::<std::option::Option<
21391                                    std::vec::Vec<crate::model::LocationFeature>,
21392                                >>()?
21393                                .unwrap_or_default();
21394                        }
21395                        __FieldTag::Unknown(key) => {
21396                            let value = map.next_value::<serde_json::Value>()?;
21397                            result._unknown_fields.insert(key, value);
21398                        }
21399                    }
21400                }
21401                std::result::Result::Ok(result)
21402            }
21403        }
21404        deserializer.deserialize_any(Visitor)
21405    }
21406}
21407
21408#[doc(hidden)]
21409impl serde::ser::Serialize for LocationMetadata {
21410    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21411    where
21412        S: serde::ser::Serializer,
21413    {
21414        use serde::ser::SerializeMap;
21415        #[allow(unused_imports)]
21416        use std::option::Option::Some;
21417        let mut state = serializer.serialize_map(std::option::Option::None)?;
21418        if !self.location_features.is_empty() {
21419            state.serialize_entry("locationFeatures", &self.location_features)?;
21420        }
21421        if !self._unknown_fields.is_empty() {
21422            for (key, value) in self._unknown_fields.iter() {
21423                state.serialize_entry(key, &value)?;
21424            }
21425        }
21426        state.end()
21427    }
21428}
21429
21430#[derive(Clone, Debug, Default, PartialEq)]
21431#[non_exhaustive]
21432pub struct NextHopVpcNetwork {
21433    /// The URI of the VPC network resource
21434    pub uri: std::string::String,
21435
21436    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21437}
21438
21439impl NextHopVpcNetwork {
21440    pub fn new() -> Self {
21441        std::default::Default::default()
21442    }
21443
21444    /// Sets the value of [uri][crate::model::NextHopVpcNetwork::uri].
21445    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21446        self.uri = v.into();
21447        self
21448    }
21449}
21450
21451impl wkt::message::Message for NextHopVpcNetwork {
21452    fn typename() -> &'static str {
21453        "type.googleapis.com/google.cloud.networkconnectivity.v1.NextHopVpcNetwork"
21454    }
21455}
21456
21457#[doc(hidden)]
21458impl<'de> serde::de::Deserialize<'de> for NextHopVpcNetwork {
21459    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21460    where
21461        D: serde::Deserializer<'de>,
21462    {
21463        #[allow(non_camel_case_types)]
21464        #[doc(hidden)]
21465        #[derive(PartialEq, Eq, Hash)]
21466        enum __FieldTag {
21467            __uri,
21468            Unknown(std::string::String),
21469        }
21470        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21471            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21472            where
21473                D: serde::Deserializer<'de>,
21474            {
21475                struct Visitor;
21476                impl<'de> serde::de::Visitor<'de> for Visitor {
21477                    type Value = __FieldTag;
21478                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21479                        formatter.write_str("a field name for NextHopVpcNetwork")
21480                    }
21481                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21482                    where
21483                        E: serde::de::Error,
21484                    {
21485                        use std::result::Result::Ok;
21486                        use std::string::ToString;
21487                        match value {
21488                            "uri" => Ok(__FieldTag::__uri),
21489                            _ => Ok(__FieldTag::Unknown(value.to_string())),
21490                        }
21491                    }
21492                }
21493                deserializer.deserialize_identifier(Visitor)
21494            }
21495        }
21496        struct Visitor;
21497        impl<'de> serde::de::Visitor<'de> for Visitor {
21498            type Value = NextHopVpcNetwork;
21499            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21500                formatter.write_str("struct NextHopVpcNetwork")
21501            }
21502            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21503            where
21504                A: serde::de::MapAccess<'de>,
21505            {
21506                #[allow(unused_imports)]
21507                use serde::de::Error;
21508                use std::option::Option::Some;
21509                let mut fields = std::collections::HashSet::new();
21510                let mut result = Self::Value::new();
21511                while let Some(tag) = map.next_key::<__FieldTag>()? {
21512                    #[allow(clippy::match_single_binding)]
21513                    match tag {
21514                        __FieldTag::__uri => {
21515                            if !fields.insert(__FieldTag::__uri) {
21516                                return std::result::Result::Err(A::Error::duplicate_field(
21517                                    "multiple values for uri",
21518                                ));
21519                            }
21520                            result.uri = map
21521                                .next_value::<std::option::Option<std::string::String>>()?
21522                                .unwrap_or_default();
21523                        }
21524                        __FieldTag::Unknown(key) => {
21525                            let value = map.next_value::<serde_json::Value>()?;
21526                            result._unknown_fields.insert(key, value);
21527                        }
21528                    }
21529                }
21530                std::result::Result::Ok(result)
21531            }
21532        }
21533        deserializer.deserialize_any(Visitor)
21534    }
21535}
21536
21537#[doc(hidden)]
21538impl serde::ser::Serialize for NextHopVpcNetwork {
21539    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21540    where
21541        S: serde::ser::Serializer,
21542    {
21543        use serde::ser::SerializeMap;
21544        #[allow(unused_imports)]
21545        use std::option::Option::Some;
21546        let mut state = serializer.serialize_map(std::option::Option::None)?;
21547        if !self.uri.is_empty() {
21548            state.serialize_entry("uri", &self.uri)?;
21549        }
21550        if !self._unknown_fields.is_empty() {
21551            for (key, value) in self._unknown_fields.iter() {
21552                state.serialize_entry(key, &value)?;
21553            }
21554        }
21555        state.end()
21556    }
21557}
21558
21559/// A route next hop that leads to a VPN tunnel resource.
21560#[derive(Clone, Debug, Default, PartialEq)]
21561#[non_exhaustive]
21562pub struct NextHopVPNTunnel {
21563    /// The URI of the VPN tunnel resource.
21564    pub uri: std::string::String,
21565
21566    /// The VPC network where this VPN tunnel is located.
21567    pub vpc_network: std::string::String,
21568
21569    /// Indicates whether site-to-site data transfer is allowed for this VPN tunnel
21570    /// resource. Data transfer is available only in [supported
21571    /// locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations).
21572    pub site_to_site_data_transfer: bool,
21573
21574    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21575}
21576
21577impl NextHopVPNTunnel {
21578    pub fn new() -> Self {
21579        std::default::Default::default()
21580    }
21581
21582    /// Sets the value of [uri][crate::model::NextHopVPNTunnel::uri].
21583    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21584        self.uri = v.into();
21585        self
21586    }
21587
21588    /// Sets the value of [vpc_network][crate::model::NextHopVPNTunnel::vpc_network].
21589    pub fn set_vpc_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21590        self.vpc_network = v.into();
21591        self
21592    }
21593
21594    /// Sets the value of [site_to_site_data_transfer][crate::model::NextHopVPNTunnel::site_to_site_data_transfer].
21595    pub fn set_site_to_site_data_transfer<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21596        self.site_to_site_data_transfer = v.into();
21597        self
21598    }
21599}
21600
21601impl wkt::message::Message for NextHopVPNTunnel {
21602    fn typename() -> &'static str {
21603        "type.googleapis.com/google.cloud.networkconnectivity.v1.NextHopVPNTunnel"
21604    }
21605}
21606
21607#[doc(hidden)]
21608impl<'de> serde::de::Deserialize<'de> for NextHopVPNTunnel {
21609    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21610    where
21611        D: serde::Deserializer<'de>,
21612    {
21613        #[allow(non_camel_case_types)]
21614        #[doc(hidden)]
21615        #[derive(PartialEq, Eq, Hash)]
21616        enum __FieldTag {
21617            __uri,
21618            __vpc_network,
21619            __site_to_site_data_transfer,
21620            Unknown(std::string::String),
21621        }
21622        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21623            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21624            where
21625                D: serde::Deserializer<'de>,
21626            {
21627                struct Visitor;
21628                impl<'de> serde::de::Visitor<'de> for Visitor {
21629                    type Value = __FieldTag;
21630                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21631                        formatter.write_str("a field name for NextHopVPNTunnel")
21632                    }
21633                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21634                    where
21635                        E: serde::de::Error,
21636                    {
21637                        use std::result::Result::Ok;
21638                        use std::string::ToString;
21639                        match value {
21640                            "uri" => Ok(__FieldTag::__uri),
21641                            "vpcNetwork" => Ok(__FieldTag::__vpc_network),
21642                            "vpc_network" => Ok(__FieldTag::__vpc_network),
21643                            "siteToSiteDataTransfer" => {
21644                                Ok(__FieldTag::__site_to_site_data_transfer)
21645                            }
21646                            "site_to_site_data_transfer" => {
21647                                Ok(__FieldTag::__site_to_site_data_transfer)
21648                            }
21649                            _ => Ok(__FieldTag::Unknown(value.to_string())),
21650                        }
21651                    }
21652                }
21653                deserializer.deserialize_identifier(Visitor)
21654            }
21655        }
21656        struct Visitor;
21657        impl<'de> serde::de::Visitor<'de> for Visitor {
21658            type Value = NextHopVPNTunnel;
21659            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21660                formatter.write_str("struct NextHopVPNTunnel")
21661            }
21662            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21663            where
21664                A: serde::de::MapAccess<'de>,
21665            {
21666                #[allow(unused_imports)]
21667                use serde::de::Error;
21668                use std::option::Option::Some;
21669                let mut fields = std::collections::HashSet::new();
21670                let mut result = Self::Value::new();
21671                while let Some(tag) = map.next_key::<__FieldTag>()? {
21672                    #[allow(clippy::match_single_binding)]
21673                    match tag {
21674                        __FieldTag::__uri => {
21675                            if !fields.insert(__FieldTag::__uri) {
21676                                return std::result::Result::Err(A::Error::duplicate_field(
21677                                    "multiple values for uri",
21678                                ));
21679                            }
21680                            result.uri = map
21681                                .next_value::<std::option::Option<std::string::String>>()?
21682                                .unwrap_or_default();
21683                        }
21684                        __FieldTag::__vpc_network => {
21685                            if !fields.insert(__FieldTag::__vpc_network) {
21686                                return std::result::Result::Err(A::Error::duplicate_field(
21687                                    "multiple values for vpc_network",
21688                                ));
21689                            }
21690                            result.vpc_network = map
21691                                .next_value::<std::option::Option<std::string::String>>()?
21692                                .unwrap_or_default();
21693                        }
21694                        __FieldTag::__site_to_site_data_transfer => {
21695                            if !fields.insert(__FieldTag::__site_to_site_data_transfer) {
21696                                return std::result::Result::Err(A::Error::duplicate_field(
21697                                    "multiple values for site_to_site_data_transfer",
21698                                ));
21699                            }
21700                            result.site_to_site_data_transfer = map
21701                                .next_value::<std::option::Option<bool>>()?
21702                                .unwrap_or_default();
21703                        }
21704                        __FieldTag::Unknown(key) => {
21705                            let value = map.next_value::<serde_json::Value>()?;
21706                            result._unknown_fields.insert(key, value);
21707                        }
21708                    }
21709                }
21710                std::result::Result::Ok(result)
21711            }
21712        }
21713        deserializer.deserialize_any(Visitor)
21714    }
21715}
21716
21717#[doc(hidden)]
21718impl serde::ser::Serialize for NextHopVPNTunnel {
21719    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21720    where
21721        S: serde::ser::Serializer,
21722    {
21723        use serde::ser::SerializeMap;
21724        #[allow(unused_imports)]
21725        use std::option::Option::Some;
21726        let mut state = serializer.serialize_map(std::option::Option::None)?;
21727        if !self.uri.is_empty() {
21728            state.serialize_entry("uri", &self.uri)?;
21729        }
21730        if !self.vpc_network.is_empty() {
21731            state.serialize_entry("vpcNetwork", &self.vpc_network)?;
21732        }
21733        if !wkt::internal::is_default(&self.site_to_site_data_transfer) {
21734            state.serialize_entry("siteToSiteDataTransfer", &self.site_to_site_data_transfer)?;
21735        }
21736        if !self._unknown_fields.is_empty() {
21737            for (key, value) in self._unknown_fields.iter() {
21738                state.serialize_entry(key, &value)?;
21739            }
21740        }
21741        state.end()
21742    }
21743}
21744
21745/// A route next hop that leads to a Router appliance instance.
21746#[derive(Clone, Debug, Default, PartialEq)]
21747#[non_exhaustive]
21748pub struct NextHopRouterApplianceInstance {
21749    /// The URI of the Router appliance instance.
21750    pub uri: std::string::String,
21751
21752    /// The VPC network where this VM is located.
21753    pub vpc_network: std::string::String,
21754
21755    /// Indicates whether site-to-site data transfer is allowed for this Router
21756    /// appliance instance resource. Data transfer is available only in [supported
21757    /// locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations).
21758    pub site_to_site_data_transfer: bool,
21759
21760    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21761}
21762
21763impl NextHopRouterApplianceInstance {
21764    pub fn new() -> Self {
21765        std::default::Default::default()
21766    }
21767
21768    /// Sets the value of [uri][crate::model::NextHopRouterApplianceInstance::uri].
21769    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21770        self.uri = v.into();
21771        self
21772    }
21773
21774    /// Sets the value of [vpc_network][crate::model::NextHopRouterApplianceInstance::vpc_network].
21775    pub fn set_vpc_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21776        self.vpc_network = v.into();
21777        self
21778    }
21779
21780    /// Sets the value of [site_to_site_data_transfer][crate::model::NextHopRouterApplianceInstance::site_to_site_data_transfer].
21781    pub fn set_site_to_site_data_transfer<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21782        self.site_to_site_data_transfer = v.into();
21783        self
21784    }
21785}
21786
21787impl wkt::message::Message for NextHopRouterApplianceInstance {
21788    fn typename() -> &'static str {
21789        "type.googleapis.com/google.cloud.networkconnectivity.v1.NextHopRouterApplianceInstance"
21790    }
21791}
21792
21793#[doc(hidden)]
21794impl<'de> serde::de::Deserialize<'de> for NextHopRouterApplianceInstance {
21795    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21796    where
21797        D: serde::Deserializer<'de>,
21798    {
21799        #[allow(non_camel_case_types)]
21800        #[doc(hidden)]
21801        #[derive(PartialEq, Eq, Hash)]
21802        enum __FieldTag {
21803            __uri,
21804            __vpc_network,
21805            __site_to_site_data_transfer,
21806            Unknown(std::string::String),
21807        }
21808        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21809            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21810            where
21811                D: serde::Deserializer<'de>,
21812            {
21813                struct Visitor;
21814                impl<'de> serde::de::Visitor<'de> for Visitor {
21815                    type Value = __FieldTag;
21816                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21817                        formatter.write_str("a field name for NextHopRouterApplianceInstance")
21818                    }
21819                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21820                    where
21821                        E: serde::de::Error,
21822                    {
21823                        use std::result::Result::Ok;
21824                        use std::string::ToString;
21825                        match value {
21826                            "uri" => Ok(__FieldTag::__uri),
21827                            "vpcNetwork" => Ok(__FieldTag::__vpc_network),
21828                            "vpc_network" => Ok(__FieldTag::__vpc_network),
21829                            "siteToSiteDataTransfer" => {
21830                                Ok(__FieldTag::__site_to_site_data_transfer)
21831                            }
21832                            "site_to_site_data_transfer" => {
21833                                Ok(__FieldTag::__site_to_site_data_transfer)
21834                            }
21835                            _ => Ok(__FieldTag::Unknown(value.to_string())),
21836                        }
21837                    }
21838                }
21839                deserializer.deserialize_identifier(Visitor)
21840            }
21841        }
21842        struct Visitor;
21843        impl<'de> serde::de::Visitor<'de> for Visitor {
21844            type Value = NextHopRouterApplianceInstance;
21845            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21846                formatter.write_str("struct NextHopRouterApplianceInstance")
21847            }
21848            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21849            where
21850                A: serde::de::MapAccess<'de>,
21851            {
21852                #[allow(unused_imports)]
21853                use serde::de::Error;
21854                use std::option::Option::Some;
21855                let mut fields = std::collections::HashSet::new();
21856                let mut result = Self::Value::new();
21857                while let Some(tag) = map.next_key::<__FieldTag>()? {
21858                    #[allow(clippy::match_single_binding)]
21859                    match tag {
21860                        __FieldTag::__uri => {
21861                            if !fields.insert(__FieldTag::__uri) {
21862                                return std::result::Result::Err(A::Error::duplicate_field(
21863                                    "multiple values for uri",
21864                                ));
21865                            }
21866                            result.uri = map
21867                                .next_value::<std::option::Option<std::string::String>>()?
21868                                .unwrap_or_default();
21869                        }
21870                        __FieldTag::__vpc_network => {
21871                            if !fields.insert(__FieldTag::__vpc_network) {
21872                                return std::result::Result::Err(A::Error::duplicate_field(
21873                                    "multiple values for vpc_network",
21874                                ));
21875                            }
21876                            result.vpc_network = map
21877                                .next_value::<std::option::Option<std::string::String>>()?
21878                                .unwrap_or_default();
21879                        }
21880                        __FieldTag::__site_to_site_data_transfer => {
21881                            if !fields.insert(__FieldTag::__site_to_site_data_transfer) {
21882                                return std::result::Result::Err(A::Error::duplicate_field(
21883                                    "multiple values for site_to_site_data_transfer",
21884                                ));
21885                            }
21886                            result.site_to_site_data_transfer = map
21887                                .next_value::<std::option::Option<bool>>()?
21888                                .unwrap_or_default();
21889                        }
21890                        __FieldTag::Unknown(key) => {
21891                            let value = map.next_value::<serde_json::Value>()?;
21892                            result._unknown_fields.insert(key, value);
21893                        }
21894                    }
21895                }
21896                std::result::Result::Ok(result)
21897            }
21898        }
21899        deserializer.deserialize_any(Visitor)
21900    }
21901}
21902
21903#[doc(hidden)]
21904impl serde::ser::Serialize for NextHopRouterApplianceInstance {
21905    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21906    where
21907        S: serde::ser::Serializer,
21908    {
21909        use serde::ser::SerializeMap;
21910        #[allow(unused_imports)]
21911        use std::option::Option::Some;
21912        let mut state = serializer.serialize_map(std::option::Option::None)?;
21913        if !self.uri.is_empty() {
21914            state.serialize_entry("uri", &self.uri)?;
21915        }
21916        if !self.vpc_network.is_empty() {
21917            state.serialize_entry("vpcNetwork", &self.vpc_network)?;
21918        }
21919        if !wkt::internal::is_default(&self.site_to_site_data_transfer) {
21920            state.serialize_entry("siteToSiteDataTransfer", &self.site_to_site_data_transfer)?;
21921        }
21922        if !self._unknown_fields.is_empty() {
21923            for (key, value) in self._unknown_fields.iter() {
21924                state.serialize_entry(key, &value)?;
21925            }
21926        }
21927        state.end()
21928    }
21929}
21930
21931/// A route next hop that leads to an interconnect attachment resource.
21932#[derive(Clone, Debug, Default, PartialEq)]
21933#[non_exhaustive]
21934pub struct NextHopInterconnectAttachment {
21935    /// The URI of the interconnect attachment resource.
21936    pub uri: std::string::String,
21937
21938    /// The VPC network where this interconnect attachment is located.
21939    pub vpc_network: std::string::String,
21940
21941    /// Indicates whether site-to-site data transfer is allowed for this
21942    /// interconnect attachment resource. Data transfer is available only in
21943    /// [supported
21944    /// locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations).
21945    pub site_to_site_data_transfer: bool,
21946
21947    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21948}
21949
21950impl NextHopInterconnectAttachment {
21951    pub fn new() -> Self {
21952        std::default::Default::default()
21953    }
21954
21955    /// Sets the value of [uri][crate::model::NextHopInterconnectAttachment::uri].
21956    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21957        self.uri = v.into();
21958        self
21959    }
21960
21961    /// Sets the value of [vpc_network][crate::model::NextHopInterconnectAttachment::vpc_network].
21962    pub fn set_vpc_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21963        self.vpc_network = v.into();
21964        self
21965    }
21966
21967    /// Sets the value of [site_to_site_data_transfer][crate::model::NextHopInterconnectAttachment::site_to_site_data_transfer].
21968    pub fn set_site_to_site_data_transfer<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21969        self.site_to_site_data_transfer = v.into();
21970        self
21971    }
21972}
21973
21974impl wkt::message::Message for NextHopInterconnectAttachment {
21975    fn typename() -> &'static str {
21976        "type.googleapis.com/google.cloud.networkconnectivity.v1.NextHopInterconnectAttachment"
21977    }
21978}
21979
21980#[doc(hidden)]
21981impl<'de> serde::de::Deserialize<'de> for NextHopInterconnectAttachment {
21982    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21983    where
21984        D: serde::Deserializer<'de>,
21985    {
21986        #[allow(non_camel_case_types)]
21987        #[doc(hidden)]
21988        #[derive(PartialEq, Eq, Hash)]
21989        enum __FieldTag {
21990            __uri,
21991            __vpc_network,
21992            __site_to_site_data_transfer,
21993            Unknown(std::string::String),
21994        }
21995        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21996            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21997            where
21998                D: serde::Deserializer<'de>,
21999            {
22000                struct Visitor;
22001                impl<'de> serde::de::Visitor<'de> for Visitor {
22002                    type Value = __FieldTag;
22003                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22004                        formatter.write_str("a field name for NextHopInterconnectAttachment")
22005                    }
22006                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22007                    where
22008                        E: serde::de::Error,
22009                    {
22010                        use std::result::Result::Ok;
22011                        use std::string::ToString;
22012                        match value {
22013                            "uri" => Ok(__FieldTag::__uri),
22014                            "vpcNetwork" => Ok(__FieldTag::__vpc_network),
22015                            "vpc_network" => Ok(__FieldTag::__vpc_network),
22016                            "siteToSiteDataTransfer" => {
22017                                Ok(__FieldTag::__site_to_site_data_transfer)
22018                            }
22019                            "site_to_site_data_transfer" => {
22020                                Ok(__FieldTag::__site_to_site_data_transfer)
22021                            }
22022                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22023                        }
22024                    }
22025                }
22026                deserializer.deserialize_identifier(Visitor)
22027            }
22028        }
22029        struct Visitor;
22030        impl<'de> serde::de::Visitor<'de> for Visitor {
22031            type Value = NextHopInterconnectAttachment;
22032            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22033                formatter.write_str("struct NextHopInterconnectAttachment")
22034            }
22035            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22036            where
22037                A: serde::de::MapAccess<'de>,
22038            {
22039                #[allow(unused_imports)]
22040                use serde::de::Error;
22041                use std::option::Option::Some;
22042                let mut fields = std::collections::HashSet::new();
22043                let mut result = Self::Value::new();
22044                while let Some(tag) = map.next_key::<__FieldTag>()? {
22045                    #[allow(clippy::match_single_binding)]
22046                    match tag {
22047                        __FieldTag::__uri => {
22048                            if !fields.insert(__FieldTag::__uri) {
22049                                return std::result::Result::Err(A::Error::duplicate_field(
22050                                    "multiple values for uri",
22051                                ));
22052                            }
22053                            result.uri = map
22054                                .next_value::<std::option::Option<std::string::String>>()?
22055                                .unwrap_or_default();
22056                        }
22057                        __FieldTag::__vpc_network => {
22058                            if !fields.insert(__FieldTag::__vpc_network) {
22059                                return std::result::Result::Err(A::Error::duplicate_field(
22060                                    "multiple values for vpc_network",
22061                                ));
22062                            }
22063                            result.vpc_network = map
22064                                .next_value::<std::option::Option<std::string::String>>()?
22065                                .unwrap_or_default();
22066                        }
22067                        __FieldTag::__site_to_site_data_transfer => {
22068                            if !fields.insert(__FieldTag::__site_to_site_data_transfer) {
22069                                return std::result::Result::Err(A::Error::duplicate_field(
22070                                    "multiple values for site_to_site_data_transfer",
22071                                ));
22072                            }
22073                            result.site_to_site_data_transfer = map
22074                                .next_value::<std::option::Option<bool>>()?
22075                                .unwrap_or_default();
22076                        }
22077                        __FieldTag::Unknown(key) => {
22078                            let value = map.next_value::<serde_json::Value>()?;
22079                            result._unknown_fields.insert(key, value);
22080                        }
22081                    }
22082                }
22083                std::result::Result::Ok(result)
22084            }
22085        }
22086        deserializer.deserialize_any(Visitor)
22087    }
22088}
22089
22090#[doc(hidden)]
22091impl serde::ser::Serialize for NextHopInterconnectAttachment {
22092    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22093    where
22094        S: serde::ser::Serializer,
22095    {
22096        use serde::ser::SerializeMap;
22097        #[allow(unused_imports)]
22098        use std::option::Option::Some;
22099        let mut state = serializer.serialize_map(std::option::Option::None)?;
22100        if !self.uri.is_empty() {
22101            state.serialize_entry("uri", &self.uri)?;
22102        }
22103        if !self.vpc_network.is_empty() {
22104            state.serialize_entry("vpcNetwork", &self.vpc_network)?;
22105        }
22106        if !wkt::internal::is_default(&self.site_to_site_data_transfer) {
22107            state.serialize_entry("siteToSiteDataTransfer", &self.site_to_site_data_transfer)?;
22108        }
22109        if !self._unknown_fields.is_empty() {
22110            for (key, value) in self._unknown_fields.iter() {
22111                state.serialize_entry(key, &value)?;
22112            }
22113        }
22114        state.end()
22115    }
22116}
22117
22118/// Summarizes information about the spokes associated with a hub.
22119/// The summary includes a count of spokes according to type
22120/// and according to state. If any spokes are inactive,
22121/// the summary also lists the reasons they are inactive,
22122/// including a count for each reason.
22123#[derive(Clone, Debug, Default, PartialEq)]
22124#[non_exhaustive]
22125pub struct SpokeSummary {
22126    /// Output only. Counts the number of spokes of each type that are
22127    /// associated with a specific hub.
22128    pub spoke_type_counts: std::vec::Vec<crate::model::spoke_summary::SpokeTypeCount>,
22129
22130    /// Output only. Counts the number of spokes that are in each state
22131    /// and associated with a given hub.
22132    pub spoke_state_counts: std::vec::Vec<crate::model::spoke_summary::SpokeStateCount>,
22133
22134    /// Output only. Counts the number of spokes that are inactive for each
22135    /// possible reason and associated with a given hub.
22136    pub spoke_state_reason_counts:
22137        std::vec::Vec<crate::model::spoke_summary::SpokeStateReasonCount>,
22138
22139    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22140}
22141
22142impl SpokeSummary {
22143    pub fn new() -> Self {
22144        std::default::Default::default()
22145    }
22146
22147    /// Sets the value of [spoke_type_counts][crate::model::SpokeSummary::spoke_type_counts].
22148    pub fn set_spoke_type_counts<T, V>(mut self, v: T) -> Self
22149    where
22150        T: std::iter::IntoIterator<Item = V>,
22151        V: std::convert::Into<crate::model::spoke_summary::SpokeTypeCount>,
22152    {
22153        use std::iter::Iterator;
22154        self.spoke_type_counts = v.into_iter().map(|i| i.into()).collect();
22155        self
22156    }
22157
22158    /// Sets the value of [spoke_state_counts][crate::model::SpokeSummary::spoke_state_counts].
22159    pub fn set_spoke_state_counts<T, V>(mut self, v: T) -> Self
22160    where
22161        T: std::iter::IntoIterator<Item = V>,
22162        V: std::convert::Into<crate::model::spoke_summary::SpokeStateCount>,
22163    {
22164        use std::iter::Iterator;
22165        self.spoke_state_counts = v.into_iter().map(|i| i.into()).collect();
22166        self
22167    }
22168
22169    /// Sets the value of [spoke_state_reason_counts][crate::model::SpokeSummary::spoke_state_reason_counts].
22170    pub fn set_spoke_state_reason_counts<T, V>(mut self, v: T) -> Self
22171    where
22172        T: std::iter::IntoIterator<Item = V>,
22173        V: std::convert::Into<crate::model::spoke_summary::SpokeStateReasonCount>,
22174    {
22175        use std::iter::Iterator;
22176        self.spoke_state_reason_counts = v.into_iter().map(|i| i.into()).collect();
22177        self
22178    }
22179}
22180
22181impl wkt::message::Message for SpokeSummary {
22182    fn typename() -> &'static str {
22183        "type.googleapis.com/google.cloud.networkconnectivity.v1.SpokeSummary"
22184    }
22185}
22186
22187#[doc(hidden)]
22188impl<'de> serde::de::Deserialize<'de> for SpokeSummary {
22189    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22190    where
22191        D: serde::Deserializer<'de>,
22192    {
22193        #[allow(non_camel_case_types)]
22194        #[doc(hidden)]
22195        #[derive(PartialEq, Eq, Hash)]
22196        enum __FieldTag {
22197            __spoke_type_counts,
22198            __spoke_state_counts,
22199            __spoke_state_reason_counts,
22200            Unknown(std::string::String),
22201        }
22202        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22203            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22204            where
22205                D: serde::Deserializer<'de>,
22206            {
22207                struct Visitor;
22208                impl<'de> serde::de::Visitor<'de> for Visitor {
22209                    type Value = __FieldTag;
22210                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22211                        formatter.write_str("a field name for SpokeSummary")
22212                    }
22213                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22214                    where
22215                        E: serde::de::Error,
22216                    {
22217                        use std::result::Result::Ok;
22218                        use std::string::ToString;
22219                        match value {
22220                            "spokeTypeCounts" => Ok(__FieldTag::__spoke_type_counts),
22221                            "spoke_type_counts" => Ok(__FieldTag::__spoke_type_counts),
22222                            "spokeStateCounts" => Ok(__FieldTag::__spoke_state_counts),
22223                            "spoke_state_counts" => Ok(__FieldTag::__spoke_state_counts),
22224                            "spokeStateReasonCounts" => Ok(__FieldTag::__spoke_state_reason_counts),
22225                            "spoke_state_reason_counts" => {
22226                                Ok(__FieldTag::__spoke_state_reason_counts)
22227                            }
22228                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22229                        }
22230                    }
22231                }
22232                deserializer.deserialize_identifier(Visitor)
22233            }
22234        }
22235        struct Visitor;
22236        impl<'de> serde::de::Visitor<'de> for Visitor {
22237            type Value = SpokeSummary;
22238            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22239                formatter.write_str("struct SpokeSummary")
22240            }
22241            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22242            where
22243                A: serde::de::MapAccess<'de>,
22244            {
22245                #[allow(unused_imports)]
22246                use serde::de::Error;
22247                use std::option::Option::Some;
22248                let mut fields = std::collections::HashSet::new();
22249                let mut result = Self::Value::new();
22250                while let Some(tag) = map.next_key::<__FieldTag>()? {
22251                    #[allow(clippy::match_single_binding)]
22252                    match tag {
22253                        __FieldTag::__spoke_type_counts => {
22254                            if !fields.insert(__FieldTag::__spoke_type_counts) {
22255                                return std::result::Result::Err(A::Error::duplicate_field(
22256                                    "multiple values for spoke_type_counts",
22257                                ));
22258                            }
22259                            result.spoke_type_counts = map
22260                                .next_value::<std::option::Option<
22261                                    std::vec::Vec<crate::model::spoke_summary::SpokeTypeCount>,
22262                                >>()?
22263                                .unwrap_or_default();
22264                        }
22265                        __FieldTag::__spoke_state_counts => {
22266                            if !fields.insert(__FieldTag::__spoke_state_counts) {
22267                                return std::result::Result::Err(A::Error::duplicate_field(
22268                                    "multiple values for spoke_state_counts",
22269                                ));
22270                            }
22271                            result.spoke_state_counts = map
22272                                .next_value::<std::option::Option<
22273                                    std::vec::Vec<crate::model::spoke_summary::SpokeStateCount>,
22274                                >>()?
22275                                .unwrap_or_default();
22276                        }
22277                        __FieldTag::__spoke_state_reason_counts => {
22278                            if !fields.insert(__FieldTag::__spoke_state_reason_counts) {
22279                                return std::result::Result::Err(A::Error::duplicate_field(
22280                                    "multiple values for spoke_state_reason_counts",
22281                                ));
22282                            }
22283                            result.spoke_state_reason_counts = map
22284                                .next_value::<std::option::Option<
22285                                    std::vec::Vec<
22286                                        crate::model::spoke_summary::SpokeStateReasonCount,
22287                                    >,
22288                                >>()?
22289                                .unwrap_or_default();
22290                        }
22291                        __FieldTag::Unknown(key) => {
22292                            let value = map.next_value::<serde_json::Value>()?;
22293                            result._unknown_fields.insert(key, value);
22294                        }
22295                    }
22296                }
22297                std::result::Result::Ok(result)
22298            }
22299        }
22300        deserializer.deserialize_any(Visitor)
22301    }
22302}
22303
22304#[doc(hidden)]
22305impl serde::ser::Serialize for SpokeSummary {
22306    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22307    where
22308        S: serde::ser::Serializer,
22309    {
22310        use serde::ser::SerializeMap;
22311        #[allow(unused_imports)]
22312        use std::option::Option::Some;
22313        let mut state = serializer.serialize_map(std::option::Option::None)?;
22314        if !self.spoke_type_counts.is_empty() {
22315            state.serialize_entry("spokeTypeCounts", &self.spoke_type_counts)?;
22316        }
22317        if !self.spoke_state_counts.is_empty() {
22318            state.serialize_entry("spokeStateCounts", &self.spoke_state_counts)?;
22319        }
22320        if !self.spoke_state_reason_counts.is_empty() {
22321            state.serialize_entry("spokeStateReasonCounts", &self.spoke_state_reason_counts)?;
22322        }
22323        if !self._unknown_fields.is_empty() {
22324            for (key, value) in self._unknown_fields.iter() {
22325                state.serialize_entry(key, &value)?;
22326            }
22327        }
22328        state.end()
22329    }
22330}
22331
22332/// Defines additional types related to [SpokeSummary].
22333pub mod spoke_summary {
22334    #[allow(unused_imports)]
22335    use super::*;
22336
22337    /// The number of spokes of a given type that are associated
22338    /// with a specific hub. The type indicates what kind of
22339    /// resource is associated with the spoke.
22340    #[derive(Clone, Debug, Default, PartialEq)]
22341    #[non_exhaustive]
22342    pub struct SpokeTypeCount {
22343        /// Output only. The type of the spokes.
22344        pub spoke_type: crate::model::SpokeType,
22345
22346        /// Output only. The total number of spokes of this type that are
22347        /// associated with the hub.
22348        pub count: i64,
22349
22350        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22351    }
22352
22353    impl SpokeTypeCount {
22354        pub fn new() -> Self {
22355            std::default::Default::default()
22356        }
22357
22358        /// Sets the value of [spoke_type][crate::model::spoke_summary::SpokeTypeCount::spoke_type].
22359        pub fn set_spoke_type<T: std::convert::Into<crate::model::SpokeType>>(
22360            mut self,
22361            v: T,
22362        ) -> Self {
22363            self.spoke_type = v.into();
22364            self
22365        }
22366
22367        /// Sets the value of [count][crate::model::spoke_summary::SpokeTypeCount::count].
22368        pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
22369            self.count = v.into();
22370            self
22371        }
22372    }
22373
22374    impl wkt::message::Message for SpokeTypeCount {
22375        fn typename() -> &'static str {
22376            "type.googleapis.com/google.cloud.networkconnectivity.v1.SpokeSummary.SpokeTypeCount"
22377        }
22378    }
22379
22380    #[doc(hidden)]
22381    impl<'de> serde::de::Deserialize<'de> for SpokeTypeCount {
22382        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22383        where
22384            D: serde::Deserializer<'de>,
22385        {
22386            #[allow(non_camel_case_types)]
22387            #[doc(hidden)]
22388            #[derive(PartialEq, Eq, Hash)]
22389            enum __FieldTag {
22390                __spoke_type,
22391                __count,
22392                Unknown(std::string::String),
22393            }
22394            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22395                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22396                where
22397                    D: serde::Deserializer<'de>,
22398                {
22399                    struct Visitor;
22400                    impl<'de> serde::de::Visitor<'de> for Visitor {
22401                        type Value = __FieldTag;
22402                        fn expecting(
22403                            &self,
22404                            formatter: &mut std::fmt::Formatter,
22405                        ) -> std::fmt::Result {
22406                            formatter.write_str("a field name for SpokeTypeCount")
22407                        }
22408                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22409                        where
22410                            E: serde::de::Error,
22411                        {
22412                            use std::result::Result::Ok;
22413                            use std::string::ToString;
22414                            match value {
22415                                "spokeType" => Ok(__FieldTag::__spoke_type),
22416                                "spoke_type" => Ok(__FieldTag::__spoke_type),
22417                                "count" => Ok(__FieldTag::__count),
22418                                _ => Ok(__FieldTag::Unknown(value.to_string())),
22419                            }
22420                        }
22421                    }
22422                    deserializer.deserialize_identifier(Visitor)
22423                }
22424            }
22425            struct Visitor;
22426            impl<'de> serde::de::Visitor<'de> for Visitor {
22427                type Value = SpokeTypeCount;
22428                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22429                    formatter.write_str("struct SpokeTypeCount")
22430                }
22431                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22432                where
22433                    A: serde::de::MapAccess<'de>,
22434                {
22435                    #[allow(unused_imports)]
22436                    use serde::de::Error;
22437                    use std::option::Option::Some;
22438                    let mut fields = std::collections::HashSet::new();
22439                    let mut result = Self::Value::new();
22440                    while let Some(tag) = map.next_key::<__FieldTag>()? {
22441                        #[allow(clippy::match_single_binding)]
22442                        match tag {
22443                            __FieldTag::__spoke_type => {
22444                                if !fields.insert(__FieldTag::__spoke_type) {
22445                                    return std::result::Result::Err(A::Error::duplicate_field(
22446                                        "multiple values for spoke_type",
22447                                    ));
22448                                }
22449                                result.spoke_type = map
22450                                    .next_value::<std::option::Option<crate::model::SpokeType>>()?
22451                                    .unwrap_or_default();
22452                            }
22453                            __FieldTag::__count => {
22454                                if !fields.insert(__FieldTag::__count) {
22455                                    return std::result::Result::Err(A::Error::duplicate_field(
22456                                        "multiple values for count",
22457                                    ));
22458                                }
22459                                struct __With(std::option::Option<i64>);
22460                                impl<'de> serde::de::Deserialize<'de> for __With {
22461                                    fn deserialize<D>(
22462                                        deserializer: D,
22463                                    ) -> std::result::Result<Self, D::Error>
22464                                    where
22465                                        D: serde::de::Deserializer<'de>,
22466                                    {
22467                                        serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
22468                                    }
22469                                }
22470                                result.count = map.next_value::<__With>()?.0.unwrap_or_default();
22471                            }
22472                            __FieldTag::Unknown(key) => {
22473                                let value = map.next_value::<serde_json::Value>()?;
22474                                result._unknown_fields.insert(key, value);
22475                            }
22476                        }
22477                    }
22478                    std::result::Result::Ok(result)
22479                }
22480            }
22481            deserializer.deserialize_any(Visitor)
22482        }
22483    }
22484
22485    #[doc(hidden)]
22486    impl serde::ser::Serialize for SpokeTypeCount {
22487        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22488        where
22489            S: serde::ser::Serializer,
22490        {
22491            use serde::ser::SerializeMap;
22492            #[allow(unused_imports)]
22493            use std::option::Option::Some;
22494            let mut state = serializer.serialize_map(std::option::Option::None)?;
22495            if !wkt::internal::is_default(&self.spoke_type) {
22496                state.serialize_entry("spokeType", &self.spoke_type)?;
22497            }
22498            if !wkt::internal::is_default(&self.count) {
22499                struct __With<'a>(&'a i64);
22500                impl<'a> serde::ser::Serialize for __With<'a> {
22501                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22502                    where
22503                        S: serde::ser::Serializer,
22504                    {
22505                        serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
22506                    }
22507                }
22508                state.serialize_entry("count", &__With(&self.count))?;
22509            }
22510            if !self._unknown_fields.is_empty() {
22511                for (key, value) in self._unknown_fields.iter() {
22512                    state.serialize_entry(key, &value)?;
22513                }
22514            }
22515            state.end()
22516        }
22517    }
22518
22519    /// The number of spokes that are in a particular state
22520    /// and associated with a given hub.
22521    #[derive(Clone, Debug, Default, PartialEq)]
22522    #[non_exhaustive]
22523    pub struct SpokeStateCount {
22524        /// Output only. The state of the spokes.
22525        pub state: crate::model::State,
22526
22527        /// Output only. The total number of spokes that are in this state
22528        /// and associated with a given hub.
22529        pub count: i64,
22530
22531        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22532    }
22533
22534    impl SpokeStateCount {
22535        pub fn new() -> Self {
22536            std::default::Default::default()
22537        }
22538
22539        /// Sets the value of [state][crate::model::spoke_summary::SpokeStateCount::state].
22540        pub fn set_state<T: std::convert::Into<crate::model::State>>(mut self, v: T) -> Self {
22541            self.state = v.into();
22542            self
22543        }
22544
22545        /// Sets the value of [count][crate::model::spoke_summary::SpokeStateCount::count].
22546        pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
22547            self.count = v.into();
22548            self
22549        }
22550    }
22551
22552    impl wkt::message::Message for SpokeStateCount {
22553        fn typename() -> &'static str {
22554            "type.googleapis.com/google.cloud.networkconnectivity.v1.SpokeSummary.SpokeStateCount"
22555        }
22556    }
22557
22558    #[doc(hidden)]
22559    impl<'de> serde::de::Deserialize<'de> for SpokeStateCount {
22560        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22561        where
22562            D: serde::Deserializer<'de>,
22563        {
22564            #[allow(non_camel_case_types)]
22565            #[doc(hidden)]
22566            #[derive(PartialEq, Eq, Hash)]
22567            enum __FieldTag {
22568                __state,
22569                __count,
22570                Unknown(std::string::String),
22571            }
22572            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22573                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22574                where
22575                    D: serde::Deserializer<'de>,
22576                {
22577                    struct Visitor;
22578                    impl<'de> serde::de::Visitor<'de> for Visitor {
22579                        type Value = __FieldTag;
22580                        fn expecting(
22581                            &self,
22582                            formatter: &mut std::fmt::Formatter,
22583                        ) -> std::fmt::Result {
22584                            formatter.write_str("a field name for SpokeStateCount")
22585                        }
22586                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22587                        where
22588                            E: serde::de::Error,
22589                        {
22590                            use std::result::Result::Ok;
22591                            use std::string::ToString;
22592                            match value {
22593                                "state" => Ok(__FieldTag::__state),
22594                                "count" => Ok(__FieldTag::__count),
22595                                _ => Ok(__FieldTag::Unknown(value.to_string())),
22596                            }
22597                        }
22598                    }
22599                    deserializer.deserialize_identifier(Visitor)
22600                }
22601            }
22602            struct Visitor;
22603            impl<'de> serde::de::Visitor<'de> for Visitor {
22604                type Value = SpokeStateCount;
22605                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22606                    formatter.write_str("struct SpokeStateCount")
22607                }
22608                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22609                where
22610                    A: serde::de::MapAccess<'de>,
22611                {
22612                    #[allow(unused_imports)]
22613                    use serde::de::Error;
22614                    use std::option::Option::Some;
22615                    let mut fields = std::collections::HashSet::new();
22616                    let mut result = Self::Value::new();
22617                    while let Some(tag) = map.next_key::<__FieldTag>()? {
22618                        #[allow(clippy::match_single_binding)]
22619                        match tag {
22620                            __FieldTag::__state => {
22621                                if !fields.insert(__FieldTag::__state) {
22622                                    return std::result::Result::Err(A::Error::duplicate_field(
22623                                        "multiple values for state",
22624                                    ));
22625                                }
22626                                result.state = map
22627                                    .next_value::<std::option::Option<crate::model::State>>()?
22628                                    .unwrap_or_default();
22629                            }
22630                            __FieldTag::__count => {
22631                                if !fields.insert(__FieldTag::__count) {
22632                                    return std::result::Result::Err(A::Error::duplicate_field(
22633                                        "multiple values for count",
22634                                    ));
22635                                }
22636                                struct __With(std::option::Option<i64>);
22637                                impl<'de> serde::de::Deserialize<'de> for __With {
22638                                    fn deserialize<D>(
22639                                        deserializer: D,
22640                                    ) -> std::result::Result<Self, D::Error>
22641                                    where
22642                                        D: serde::de::Deserializer<'de>,
22643                                    {
22644                                        serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
22645                                    }
22646                                }
22647                                result.count = map.next_value::<__With>()?.0.unwrap_or_default();
22648                            }
22649                            __FieldTag::Unknown(key) => {
22650                                let value = map.next_value::<serde_json::Value>()?;
22651                                result._unknown_fields.insert(key, value);
22652                            }
22653                        }
22654                    }
22655                    std::result::Result::Ok(result)
22656                }
22657            }
22658            deserializer.deserialize_any(Visitor)
22659        }
22660    }
22661
22662    #[doc(hidden)]
22663    impl serde::ser::Serialize for SpokeStateCount {
22664        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22665        where
22666            S: serde::ser::Serializer,
22667        {
22668            use serde::ser::SerializeMap;
22669            #[allow(unused_imports)]
22670            use std::option::Option::Some;
22671            let mut state = serializer.serialize_map(std::option::Option::None)?;
22672            if !wkt::internal::is_default(&self.state) {
22673                state.serialize_entry("state", &self.state)?;
22674            }
22675            if !wkt::internal::is_default(&self.count) {
22676                struct __With<'a>(&'a i64);
22677                impl<'a> serde::ser::Serialize for __With<'a> {
22678                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22679                    where
22680                        S: serde::ser::Serializer,
22681                    {
22682                        serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
22683                    }
22684                }
22685                state.serialize_entry("count", &__With(&self.count))?;
22686            }
22687            if !self._unknown_fields.is_empty() {
22688                for (key, value) in self._unknown_fields.iter() {
22689                    state.serialize_entry(key, &value)?;
22690                }
22691            }
22692            state.end()
22693        }
22694    }
22695
22696    /// The number of spokes in the hub that are inactive for this reason.
22697    #[derive(Clone, Debug, Default, PartialEq)]
22698    #[non_exhaustive]
22699    pub struct SpokeStateReasonCount {
22700        /// Output only. The reason that a spoke is inactive.
22701        pub state_reason_code: crate::model::spoke::state_reason::Code,
22702
22703        /// Output only. The total number of spokes that are inactive for a
22704        /// particular reason and associated with a given hub.
22705        pub count: i64,
22706
22707        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22708    }
22709
22710    impl SpokeStateReasonCount {
22711        pub fn new() -> Self {
22712            std::default::Default::default()
22713        }
22714
22715        /// Sets the value of [state_reason_code][crate::model::spoke_summary::SpokeStateReasonCount::state_reason_code].
22716        pub fn set_state_reason_code<
22717            T: std::convert::Into<crate::model::spoke::state_reason::Code>,
22718        >(
22719            mut self,
22720            v: T,
22721        ) -> Self {
22722            self.state_reason_code = v.into();
22723            self
22724        }
22725
22726        /// Sets the value of [count][crate::model::spoke_summary::SpokeStateReasonCount::count].
22727        pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
22728            self.count = v.into();
22729            self
22730        }
22731    }
22732
22733    impl wkt::message::Message for SpokeStateReasonCount {
22734        fn typename() -> &'static str {
22735            "type.googleapis.com/google.cloud.networkconnectivity.v1.SpokeSummary.SpokeStateReasonCount"
22736        }
22737    }
22738
22739    #[doc(hidden)]
22740    impl<'de> serde::de::Deserialize<'de> for SpokeStateReasonCount {
22741        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22742        where
22743            D: serde::Deserializer<'de>,
22744        {
22745            #[allow(non_camel_case_types)]
22746            #[doc(hidden)]
22747            #[derive(PartialEq, Eq, Hash)]
22748            enum __FieldTag {
22749                __state_reason_code,
22750                __count,
22751                Unknown(std::string::String),
22752            }
22753            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22754                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22755                where
22756                    D: serde::Deserializer<'de>,
22757                {
22758                    struct Visitor;
22759                    impl<'de> serde::de::Visitor<'de> for Visitor {
22760                        type Value = __FieldTag;
22761                        fn expecting(
22762                            &self,
22763                            formatter: &mut std::fmt::Formatter,
22764                        ) -> std::fmt::Result {
22765                            formatter.write_str("a field name for SpokeStateReasonCount")
22766                        }
22767                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22768                        where
22769                            E: serde::de::Error,
22770                        {
22771                            use std::result::Result::Ok;
22772                            use std::string::ToString;
22773                            match value {
22774                                "stateReasonCode" => Ok(__FieldTag::__state_reason_code),
22775                                "state_reason_code" => Ok(__FieldTag::__state_reason_code),
22776                                "count" => Ok(__FieldTag::__count),
22777                                _ => Ok(__FieldTag::Unknown(value.to_string())),
22778                            }
22779                        }
22780                    }
22781                    deserializer.deserialize_identifier(Visitor)
22782                }
22783            }
22784            struct Visitor;
22785            impl<'de> serde::de::Visitor<'de> for Visitor {
22786                type Value = SpokeStateReasonCount;
22787                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22788                    formatter.write_str("struct SpokeStateReasonCount")
22789                }
22790                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22791                where
22792                    A: serde::de::MapAccess<'de>,
22793                {
22794                    #[allow(unused_imports)]
22795                    use serde::de::Error;
22796                    use std::option::Option::Some;
22797                    let mut fields = std::collections::HashSet::new();
22798                    let mut result = Self::Value::new();
22799                    while let Some(tag) = map.next_key::<__FieldTag>()? {
22800                        #[allow(clippy::match_single_binding)]
22801                        match tag {
22802                            __FieldTag::__state_reason_code => {
22803                                if !fields.insert(__FieldTag::__state_reason_code) {
22804                                    return std::result::Result::Err(A::Error::duplicate_field(
22805                                        "multiple values for state_reason_code",
22806                                    ));
22807                                }
22808                                result.state_reason_code =
22809                                    map.next_value::<std::option::Option<
22810                                        crate::model::spoke::state_reason::Code,
22811                                    >>()?
22812                                    .unwrap_or_default();
22813                            }
22814                            __FieldTag::__count => {
22815                                if !fields.insert(__FieldTag::__count) {
22816                                    return std::result::Result::Err(A::Error::duplicate_field(
22817                                        "multiple values for count",
22818                                    ));
22819                                }
22820                                struct __With(std::option::Option<i64>);
22821                                impl<'de> serde::de::Deserialize<'de> for __With {
22822                                    fn deserialize<D>(
22823                                        deserializer: D,
22824                                    ) -> std::result::Result<Self, D::Error>
22825                                    where
22826                                        D: serde::de::Deserializer<'de>,
22827                                    {
22828                                        serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
22829                                    }
22830                                }
22831                                result.count = map.next_value::<__With>()?.0.unwrap_or_default();
22832                            }
22833                            __FieldTag::Unknown(key) => {
22834                                let value = map.next_value::<serde_json::Value>()?;
22835                                result._unknown_fields.insert(key, value);
22836                            }
22837                        }
22838                    }
22839                    std::result::Result::Ok(result)
22840                }
22841            }
22842            deserializer.deserialize_any(Visitor)
22843        }
22844    }
22845
22846    #[doc(hidden)]
22847    impl serde::ser::Serialize for SpokeStateReasonCount {
22848        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22849        where
22850            S: serde::ser::Serializer,
22851        {
22852            use serde::ser::SerializeMap;
22853            #[allow(unused_imports)]
22854            use std::option::Option::Some;
22855            let mut state = serializer.serialize_map(std::option::Option::None)?;
22856            if !wkt::internal::is_default(&self.state_reason_code) {
22857                state.serialize_entry("stateReasonCode", &self.state_reason_code)?;
22858            }
22859            if !wkt::internal::is_default(&self.count) {
22860                struct __With<'a>(&'a i64);
22861                impl<'a> serde::ser::Serialize for __With<'a> {
22862                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22863                    where
22864                        S: serde::ser::Serializer,
22865                    {
22866                        serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
22867                    }
22868                }
22869                state.serialize_entry("count", &__With(&self.count))?;
22870            }
22871            if !self._unknown_fields.is_empty() {
22872                for (key, value) in self._unknown_fields.iter() {
22873                    state.serialize_entry(key, &value)?;
22874                }
22875            }
22876            state.end()
22877        }
22878    }
22879}
22880
22881/// The request for
22882/// [HubService.GetGroup][google.cloud.networkconnectivity.v1.HubService.GetGroup].
22883///
22884/// [google.cloud.networkconnectivity.v1.HubService.GetGroup]: crate::client::HubService::get_group
22885#[derive(Clone, Debug, Default, PartialEq)]
22886#[non_exhaustive]
22887pub struct GetGroupRequest {
22888    /// Required. The name of the route table resource.
22889    pub name: std::string::String,
22890
22891    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22892}
22893
22894impl GetGroupRequest {
22895    pub fn new() -> Self {
22896        std::default::Default::default()
22897    }
22898
22899    /// Sets the value of [name][crate::model::GetGroupRequest::name].
22900    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22901        self.name = v.into();
22902        self
22903    }
22904}
22905
22906impl wkt::message::Message for GetGroupRequest {
22907    fn typename() -> &'static str {
22908        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetGroupRequest"
22909    }
22910}
22911
22912#[doc(hidden)]
22913impl<'de> serde::de::Deserialize<'de> for GetGroupRequest {
22914    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22915    where
22916        D: serde::Deserializer<'de>,
22917    {
22918        #[allow(non_camel_case_types)]
22919        #[doc(hidden)]
22920        #[derive(PartialEq, Eq, Hash)]
22921        enum __FieldTag {
22922            __name,
22923            Unknown(std::string::String),
22924        }
22925        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22926            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22927            where
22928                D: serde::Deserializer<'de>,
22929            {
22930                struct Visitor;
22931                impl<'de> serde::de::Visitor<'de> for Visitor {
22932                    type Value = __FieldTag;
22933                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22934                        formatter.write_str("a field name for GetGroupRequest")
22935                    }
22936                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22937                    where
22938                        E: serde::de::Error,
22939                    {
22940                        use std::result::Result::Ok;
22941                        use std::string::ToString;
22942                        match value {
22943                            "name" => Ok(__FieldTag::__name),
22944                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22945                        }
22946                    }
22947                }
22948                deserializer.deserialize_identifier(Visitor)
22949            }
22950        }
22951        struct Visitor;
22952        impl<'de> serde::de::Visitor<'de> for Visitor {
22953            type Value = GetGroupRequest;
22954            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22955                formatter.write_str("struct GetGroupRequest")
22956            }
22957            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22958            where
22959                A: serde::de::MapAccess<'de>,
22960            {
22961                #[allow(unused_imports)]
22962                use serde::de::Error;
22963                use std::option::Option::Some;
22964                let mut fields = std::collections::HashSet::new();
22965                let mut result = Self::Value::new();
22966                while let Some(tag) = map.next_key::<__FieldTag>()? {
22967                    #[allow(clippy::match_single_binding)]
22968                    match tag {
22969                        __FieldTag::__name => {
22970                            if !fields.insert(__FieldTag::__name) {
22971                                return std::result::Result::Err(A::Error::duplicate_field(
22972                                    "multiple values for name",
22973                                ));
22974                            }
22975                            result.name = map
22976                                .next_value::<std::option::Option<std::string::String>>()?
22977                                .unwrap_or_default();
22978                        }
22979                        __FieldTag::Unknown(key) => {
22980                            let value = map.next_value::<serde_json::Value>()?;
22981                            result._unknown_fields.insert(key, value);
22982                        }
22983                    }
22984                }
22985                std::result::Result::Ok(result)
22986            }
22987        }
22988        deserializer.deserialize_any(Visitor)
22989    }
22990}
22991
22992#[doc(hidden)]
22993impl serde::ser::Serialize for GetGroupRequest {
22994    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22995    where
22996        S: serde::ser::Serializer,
22997    {
22998        use serde::ser::SerializeMap;
22999        #[allow(unused_imports)]
23000        use std::option::Option::Some;
23001        let mut state = serializer.serialize_map(std::option::Option::None)?;
23002        if !self.name.is_empty() {
23003            state.serialize_entry("name", &self.name)?;
23004        }
23005        if !self._unknown_fields.is_empty() {
23006            for (key, value) in self._unknown_fields.iter() {
23007                state.serialize_entry(key, &value)?;
23008            }
23009        }
23010        state.end()
23011    }
23012}
23013
23014/// Request for
23015/// [HubService.UpdateGroup][google.cloud.networkconnectivity.v1.HubService.UpdateGroup]
23016/// method.
23017///
23018/// [google.cloud.networkconnectivity.v1.HubService.UpdateGroup]: crate::client::HubService::update_group
23019#[derive(Clone, Debug, Default, PartialEq)]
23020#[non_exhaustive]
23021pub struct UpdateGroupRequest {
23022    /// Optional. In the case of an update to an existing group, field mask is used
23023    /// to specify the fields to be overwritten. The fields specified in the
23024    /// update_mask are relative to the resource, not the full request. A field is
23025    /// overwritten if it is in the mask. If the user does not provide a mask, then
23026    /// all fields are overwritten.
23027    pub update_mask: std::option::Option<wkt::FieldMask>,
23028
23029    /// Required. The state that the group should be in after the update.
23030    pub group: std::option::Option<crate::model::Group>,
23031
23032    /// Optional. A request ID to identify requests. Specify a unique request ID so
23033    /// that if you must retry your request, the server knows to ignore the request
23034    /// if it has already been completed. The server guarantees that a request
23035    /// doesn't result in creation of duplicate commitments for at least 60
23036    /// minutes.
23037    ///
23038    /// For example, consider a situation where you make an initial request and
23039    /// the request times out. If you make the request again with the same request
23040    /// ID, the server can check to see whether the original operation
23041    /// was received. If it was, the server ignores the second request. This
23042    /// behavior prevents clients from mistakenly creating duplicate commitments.
23043    ///
23044    /// The request ID must be a valid UUID, with the exception that zero UUID is
23045    /// not supported (00000000-0000-0000-0000-000000000000).
23046    pub request_id: std::string::String,
23047
23048    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23049}
23050
23051impl UpdateGroupRequest {
23052    pub fn new() -> Self {
23053        std::default::Default::default()
23054    }
23055
23056    /// Sets the value of [update_mask][crate::model::UpdateGroupRequest::update_mask].
23057    pub fn set_update_mask<T>(mut self, v: T) -> Self
23058    where
23059        T: std::convert::Into<wkt::FieldMask>,
23060    {
23061        self.update_mask = std::option::Option::Some(v.into());
23062        self
23063    }
23064
23065    /// Sets or clears the value of [update_mask][crate::model::UpdateGroupRequest::update_mask].
23066    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
23067    where
23068        T: std::convert::Into<wkt::FieldMask>,
23069    {
23070        self.update_mask = v.map(|x| x.into());
23071        self
23072    }
23073
23074    /// Sets the value of [group][crate::model::UpdateGroupRequest::group].
23075    pub fn set_group<T>(mut self, v: T) -> Self
23076    where
23077        T: std::convert::Into<crate::model::Group>,
23078    {
23079        self.group = std::option::Option::Some(v.into());
23080        self
23081    }
23082
23083    /// Sets or clears the value of [group][crate::model::UpdateGroupRequest::group].
23084    pub fn set_or_clear_group<T>(mut self, v: std::option::Option<T>) -> Self
23085    where
23086        T: std::convert::Into<crate::model::Group>,
23087    {
23088        self.group = v.map(|x| x.into());
23089        self
23090    }
23091
23092    /// Sets the value of [request_id][crate::model::UpdateGroupRequest::request_id].
23093    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23094        self.request_id = v.into();
23095        self
23096    }
23097}
23098
23099impl wkt::message::Message for UpdateGroupRequest {
23100    fn typename() -> &'static str {
23101        "type.googleapis.com/google.cloud.networkconnectivity.v1.UpdateGroupRequest"
23102    }
23103}
23104
23105#[doc(hidden)]
23106impl<'de> serde::de::Deserialize<'de> for UpdateGroupRequest {
23107    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23108    where
23109        D: serde::Deserializer<'de>,
23110    {
23111        #[allow(non_camel_case_types)]
23112        #[doc(hidden)]
23113        #[derive(PartialEq, Eq, Hash)]
23114        enum __FieldTag {
23115            __update_mask,
23116            __group,
23117            __request_id,
23118            Unknown(std::string::String),
23119        }
23120        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
23121            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23122            where
23123                D: serde::Deserializer<'de>,
23124            {
23125                struct Visitor;
23126                impl<'de> serde::de::Visitor<'de> for Visitor {
23127                    type Value = __FieldTag;
23128                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23129                        formatter.write_str("a field name for UpdateGroupRequest")
23130                    }
23131                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
23132                    where
23133                        E: serde::de::Error,
23134                    {
23135                        use std::result::Result::Ok;
23136                        use std::string::ToString;
23137                        match value {
23138                            "updateMask" => Ok(__FieldTag::__update_mask),
23139                            "update_mask" => Ok(__FieldTag::__update_mask),
23140                            "group" => Ok(__FieldTag::__group),
23141                            "requestId" => Ok(__FieldTag::__request_id),
23142                            "request_id" => Ok(__FieldTag::__request_id),
23143                            _ => Ok(__FieldTag::Unknown(value.to_string())),
23144                        }
23145                    }
23146                }
23147                deserializer.deserialize_identifier(Visitor)
23148            }
23149        }
23150        struct Visitor;
23151        impl<'de> serde::de::Visitor<'de> for Visitor {
23152            type Value = UpdateGroupRequest;
23153            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23154                formatter.write_str("struct UpdateGroupRequest")
23155            }
23156            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
23157            where
23158                A: serde::de::MapAccess<'de>,
23159            {
23160                #[allow(unused_imports)]
23161                use serde::de::Error;
23162                use std::option::Option::Some;
23163                let mut fields = std::collections::HashSet::new();
23164                let mut result = Self::Value::new();
23165                while let Some(tag) = map.next_key::<__FieldTag>()? {
23166                    #[allow(clippy::match_single_binding)]
23167                    match tag {
23168                        __FieldTag::__update_mask => {
23169                            if !fields.insert(__FieldTag::__update_mask) {
23170                                return std::result::Result::Err(A::Error::duplicate_field(
23171                                    "multiple values for update_mask",
23172                                ));
23173                            }
23174                            result.update_mask =
23175                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
23176                        }
23177                        __FieldTag::__group => {
23178                            if !fields.insert(__FieldTag::__group) {
23179                                return std::result::Result::Err(A::Error::duplicate_field(
23180                                    "multiple values for group",
23181                                ));
23182                            }
23183                            result.group =
23184                                map.next_value::<std::option::Option<crate::model::Group>>()?;
23185                        }
23186                        __FieldTag::__request_id => {
23187                            if !fields.insert(__FieldTag::__request_id) {
23188                                return std::result::Result::Err(A::Error::duplicate_field(
23189                                    "multiple values for request_id",
23190                                ));
23191                            }
23192                            result.request_id = map
23193                                .next_value::<std::option::Option<std::string::String>>()?
23194                                .unwrap_or_default();
23195                        }
23196                        __FieldTag::Unknown(key) => {
23197                            let value = map.next_value::<serde_json::Value>()?;
23198                            result._unknown_fields.insert(key, value);
23199                        }
23200                    }
23201                }
23202                std::result::Result::Ok(result)
23203            }
23204        }
23205        deserializer.deserialize_any(Visitor)
23206    }
23207}
23208
23209#[doc(hidden)]
23210impl serde::ser::Serialize for UpdateGroupRequest {
23211    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23212    where
23213        S: serde::ser::Serializer,
23214    {
23215        use serde::ser::SerializeMap;
23216        #[allow(unused_imports)]
23217        use std::option::Option::Some;
23218        let mut state = serializer.serialize_map(std::option::Option::None)?;
23219        if self.update_mask.is_some() {
23220            state.serialize_entry("updateMask", &self.update_mask)?;
23221        }
23222        if self.group.is_some() {
23223            state.serialize_entry("group", &self.group)?;
23224        }
23225        if !self.request_id.is_empty() {
23226            state.serialize_entry("requestId", &self.request_id)?;
23227        }
23228        if !self._unknown_fields.is_empty() {
23229            for (key, value) in self._unknown_fields.iter() {
23230                state.serialize_entry(key, &value)?;
23231            }
23232        }
23233        state.end()
23234    }
23235}
23236
23237/// Policy-based routes route L4 network traffic based on not just destination IP
23238/// address, but also source IP address, protocol, and more. If a policy-based
23239/// route conflicts with other types of routes, the policy-based route always
23240/// takes precedence.
23241#[derive(Clone, Debug, Default, PartialEq)]
23242#[non_exhaustive]
23243pub struct PolicyBasedRoute {
23244    /// Immutable. A unique name of the resource in the form of
23245    /// `projects/{project_number}/locations/global/PolicyBasedRoutes/{policy_based_route_id}`
23246    pub name: std::string::String,
23247
23248    /// Output only. Time when the policy-based route was created.
23249    pub create_time: std::option::Option<wkt::Timestamp>,
23250
23251    /// Output only. Time when the policy-based route was updated.
23252    pub update_time: std::option::Option<wkt::Timestamp>,
23253
23254    /// User-defined labels.
23255    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
23256
23257    /// Optional. An optional description of this resource. Provide this field when
23258    /// you create the resource.
23259    pub description: std::string::String,
23260
23261    /// Required. Fully-qualified URL of the network that this route applies to,
23262    /// for example: projects/my-project/global/networks/my-network.
23263    pub network: std::string::String,
23264
23265    /// Required. The filter to match L4 traffic.
23266    pub filter: std::option::Option<crate::model::policy_based_route::Filter>,
23267
23268    /// Optional. The priority of this policy-based route. Priority is used to
23269    /// break ties in cases where there are more than one matching policy-based
23270    /// routes found. In cases where multiple policy-based routes are matched, the
23271    /// one with the lowest-numbered priority value wins. The default value is
23272    /// 1000. The priority value must be from 1 to 65535, inclusive.
23273    pub priority: i32,
23274
23275    /// Output only. If potential misconfigurations are detected for this route,
23276    /// this field will be populated with warning messages.
23277    pub warnings: std::vec::Vec<crate::model::policy_based_route::Warnings>,
23278
23279    /// Output only. Server-defined fully-qualified URL for this resource.
23280    pub self_link: std::string::String,
23281
23282    /// Output only. Type of this resource. Always
23283    /// networkconnectivity#policyBasedRoute for policy-based Route resources.
23284    pub kind: std::string::String,
23285
23286    /// Target specifies network endpoints that this policy-based route applies to.
23287    /// If no target is specified, the PBR will be installed on all network
23288    /// endpoints (e.g. VMs, VPNs, and Interconnects) in the VPC.
23289    pub target: std::option::Option<crate::model::policy_based_route::Target>,
23290
23291    pub next_hop: std::option::Option<crate::model::policy_based_route::NextHop>,
23292
23293    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23294}
23295
23296impl PolicyBasedRoute {
23297    pub fn new() -> Self {
23298        std::default::Default::default()
23299    }
23300
23301    /// Sets the value of [name][crate::model::PolicyBasedRoute::name].
23302    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23303        self.name = v.into();
23304        self
23305    }
23306
23307    /// Sets the value of [create_time][crate::model::PolicyBasedRoute::create_time].
23308    pub fn set_create_time<T>(mut self, v: T) -> Self
23309    where
23310        T: std::convert::Into<wkt::Timestamp>,
23311    {
23312        self.create_time = std::option::Option::Some(v.into());
23313        self
23314    }
23315
23316    /// Sets or clears the value of [create_time][crate::model::PolicyBasedRoute::create_time].
23317    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
23318    where
23319        T: std::convert::Into<wkt::Timestamp>,
23320    {
23321        self.create_time = v.map(|x| x.into());
23322        self
23323    }
23324
23325    /// Sets the value of [update_time][crate::model::PolicyBasedRoute::update_time].
23326    pub fn set_update_time<T>(mut self, v: T) -> Self
23327    where
23328        T: std::convert::Into<wkt::Timestamp>,
23329    {
23330        self.update_time = std::option::Option::Some(v.into());
23331        self
23332    }
23333
23334    /// Sets or clears the value of [update_time][crate::model::PolicyBasedRoute::update_time].
23335    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
23336    where
23337        T: std::convert::Into<wkt::Timestamp>,
23338    {
23339        self.update_time = v.map(|x| x.into());
23340        self
23341    }
23342
23343    /// Sets the value of [labels][crate::model::PolicyBasedRoute::labels].
23344    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
23345    where
23346        T: std::iter::IntoIterator<Item = (K, V)>,
23347        K: std::convert::Into<std::string::String>,
23348        V: std::convert::Into<std::string::String>,
23349    {
23350        use std::iter::Iterator;
23351        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23352        self
23353    }
23354
23355    /// Sets the value of [description][crate::model::PolicyBasedRoute::description].
23356    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23357        self.description = v.into();
23358        self
23359    }
23360
23361    /// Sets the value of [network][crate::model::PolicyBasedRoute::network].
23362    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23363        self.network = v.into();
23364        self
23365    }
23366
23367    /// Sets the value of [filter][crate::model::PolicyBasedRoute::filter].
23368    pub fn set_filter<T>(mut self, v: T) -> Self
23369    where
23370        T: std::convert::Into<crate::model::policy_based_route::Filter>,
23371    {
23372        self.filter = std::option::Option::Some(v.into());
23373        self
23374    }
23375
23376    /// Sets or clears the value of [filter][crate::model::PolicyBasedRoute::filter].
23377    pub fn set_or_clear_filter<T>(mut self, v: std::option::Option<T>) -> Self
23378    where
23379        T: std::convert::Into<crate::model::policy_based_route::Filter>,
23380    {
23381        self.filter = v.map(|x| x.into());
23382        self
23383    }
23384
23385    /// Sets the value of [priority][crate::model::PolicyBasedRoute::priority].
23386    pub fn set_priority<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23387        self.priority = v.into();
23388        self
23389    }
23390
23391    /// Sets the value of [warnings][crate::model::PolicyBasedRoute::warnings].
23392    pub fn set_warnings<T, V>(mut self, v: T) -> Self
23393    where
23394        T: std::iter::IntoIterator<Item = V>,
23395        V: std::convert::Into<crate::model::policy_based_route::Warnings>,
23396    {
23397        use std::iter::Iterator;
23398        self.warnings = v.into_iter().map(|i| i.into()).collect();
23399        self
23400    }
23401
23402    /// Sets the value of [self_link][crate::model::PolicyBasedRoute::self_link].
23403    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23404        self.self_link = v.into();
23405        self
23406    }
23407
23408    /// Sets the value of [kind][crate::model::PolicyBasedRoute::kind].
23409    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23410        self.kind = v.into();
23411        self
23412    }
23413
23414    /// Sets the value of [target][crate::model::PolicyBasedRoute::target].
23415    ///
23416    /// Note that all the setters affecting `target` are mutually
23417    /// exclusive.
23418    pub fn set_target<
23419        T: std::convert::Into<std::option::Option<crate::model::policy_based_route::Target>>,
23420    >(
23421        mut self,
23422        v: T,
23423    ) -> Self {
23424        self.target = v.into();
23425        self
23426    }
23427
23428    /// The value of [target][crate::model::PolicyBasedRoute::target]
23429    /// if it holds a `VirtualMachine`, `None` if the field is not set or
23430    /// holds a different branch.
23431    pub fn virtual_machine(
23432        &self,
23433    ) -> std::option::Option<&std::boxed::Box<crate::model::policy_based_route::VirtualMachine>>
23434    {
23435        #[allow(unreachable_patterns)]
23436        self.target.as_ref().and_then(|v| match v {
23437            crate::model::policy_based_route::Target::VirtualMachine(v) => {
23438                std::option::Option::Some(v)
23439            }
23440            _ => std::option::Option::None,
23441        })
23442    }
23443
23444    /// Sets the value of [target][crate::model::PolicyBasedRoute::target]
23445    /// to hold a `VirtualMachine`.
23446    ///
23447    /// Note that all the setters affecting `target` are
23448    /// mutually exclusive.
23449    pub fn set_virtual_machine<
23450        T: std::convert::Into<std::boxed::Box<crate::model::policy_based_route::VirtualMachine>>,
23451    >(
23452        mut self,
23453        v: T,
23454    ) -> Self {
23455        self.target = std::option::Option::Some(
23456            crate::model::policy_based_route::Target::VirtualMachine(v.into()),
23457        );
23458        self
23459    }
23460
23461    /// The value of [target][crate::model::PolicyBasedRoute::target]
23462    /// if it holds a `InterconnectAttachment`, `None` if the field is not set or
23463    /// holds a different branch.
23464    pub fn interconnect_attachment(
23465        &self,
23466    ) -> std::option::Option<
23467        &std::boxed::Box<crate::model::policy_based_route::InterconnectAttachment>,
23468    > {
23469        #[allow(unreachable_patterns)]
23470        self.target.as_ref().and_then(|v| match v {
23471            crate::model::policy_based_route::Target::InterconnectAttachment(v) => {
23472                std::option::Option::Some(v)
23473            }
23474            _ => std::option::Option::None,
23475        })
23476    }
23477
23478    /// Sets the value of [target][crate::model::PolicyBasedRoute::target]
23479    /// to hold a `InterconnectAttachment`.
23480    ///
23481    /// Note that all the setters affecting `target` are
23482    /// mutually exclusive.
23483    pub fn set_interconnect_attachment<
23484        T: std::convert::Into<
23485                std::boxed::Box<crate::model::policy_based_route::InterconnectAttachment>,
23486            >,
23487    >(
23488        mut self,
23489        v: T,
23490    ) -> Self {
23491        self.target = std::option::Option::Some(
23492            crate::model::policy_based_route::Target::InterconnectAttachment(v.into()),
23493        );
23494        self
23495    }
23496
23497    /// Sets the value of [next_hop][crate::model::PolicyBasedRoute::next_hop].
23498    ///
23499    /// Note that all the setters affecting `next_hop` are mutually
23500    /// exclusive.
23501    pub fn set_next_hop<
23502        T: std::convert::Into<std::option::Option<crate::model::policy_based_route::NextHop>>,
23503    >(
23504        mut self,
23505        v: T,
23506    ) -> Self {
23507        self.next_hop = v.into();
23508        self
23509    }
23510
23511    /// The value of [next_hop][crate::model::PolicyBasedRoute::next_hop]
23512    /// if it holds a `NextHopIlbIp`, `None` if the field is not set or
23513    /// holds a different branch.
23514    pub fn next_hop_ilb_ip(&self) -> std::option::Option<&std::string::String> {
23515        #[allow(unreachable_patterns)]
23516        self.next_hop.as_ref().and_then(|v| match v {
23517            crate::model::policy_based_route::NextHop::NextHopIlbIp(v) => {
23518                std::option::Option::Some(v)
23519            }
23520            _ => std::option::Option::None,
23521        })
23522    }
23523
23524    /// Sets the value of [next_hop][crate::model::PolicyBasedRoute::next_hop]
23525    /// to hold a `NextHopIlbIp`.
23526    ///
23527    /// Note that all the setters affecting `next_hop` are
23528    /// mutually exclusive.
23529    pub fn set_next_hop_ilb_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23530        self.next_hop = std::option::Option::Some(
23531            crate::model::policy_based_route::NextHop::NextHopIlbIp(v.into()),
23532        );
23533        self
23534    }
23535
23536    /// The value of [next_hop][crate::model::PolicyBasedRoute::next_hop]
23537    /// if it holds a `NextHopOtherRoutes`, `None` if the field is not set or
23538    /// holds a different branch.
23539    pub fn next_hop_other_routes(
23540        &self,
23541    ) -> std::option::Option<&crate::model::policy_based_route::OtherRoutes> {
23542        #[allow(unreachable_patterns)]
23543        self.next_hop.as_ref().and_then(|v| match v {
23544            crate::model::policy_based_route::NextHop::NextHopOtherRoutes(v) => {
23545                std::option::Option::Some(v)
23546            }
23547            _ => std::option::Option::None,
23548        })
23549    }
23550
23551    /// Sets the value of [next_hop][crate::model::PolicyBasedRoute::next_hop]
23552    /// to hold a `NextHopOtherRoutes`.
23553    ///
23554    /// Note that all the setters affecting `next_hop` are
23555    /// mutually exclusive.
23556    pub fn set_next_hop_other_routes<
23557        T: std::convert::Into<crate::model::policy_based_route::OtherRoutes>,
23558    >(
23559        mut self,
23560        v: T,
23561    ) -> Self {
23562        self.next_hop = std::option::Option::Some(
23563            crate::model::policy_based_route::NextHop::NextHopOtherRoutes(v.into()),
23564        );
23565        self
23566    }
23567}
23568
23569impl wkt::message::Message for PolicyBasedRoute {
23570    fn typename() -> &'static str {
23571        "type.googleapis.com/google.cloud.networkconnectivity.v1.PolicyBasedRoute"
23572    }
23573}
23574
23575#[doc(hidden)]
23576impl<'de> serde::de::Deserialize<'de> for PolicyBasedRoute {
23577    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23578    where
23579        D: serde::Deserializer<'de>,
23580    {
23581        #[allow(non_camel_case_types)]
23582        #[doc(hidden)]
23583        #[derive(PartialEq, Eq, Hash)]
23584        enum __FieldTag {
23585            __virtual_machine,
23586            __interconnect_attachment,
23587            __next_hop_ilb_ip,
23588            __next_hop_other_routes,
23589            __name,
23590            __create_time,
23591            __update_time,
23592            __labels,
23593            __description,
23594            __network,
23595            __filter,
23596            __priority,
23597            __warnings,
23598            __self_link,
23599            __kind,
23600            Unknown(std::string::String),
23601        }
23602        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
23603            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23604            where
23605                D: serde::Deserializer<'de>,
23606            {
23607                struct Visitor;
23608                impl<'de> serde::de::Visitor<'de> for Visitor {
23609                    type Value = __FieldTag;
23610                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23611                        formatter.write_str("a field name for PolicyBasedRoute")
23612                    }
23613                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
23614                    where
23615                        E: serde::de::Error,
23616                    {
23617                        use std::result::Result::Ok;
23618                        use std::string::ToString;
23619                        match value {
23620                            "virtualMachine" => Ok(__FieldTag::__virtual_machine),
23621                            "virtual_machine" => Ok(__FieldTag::__virtual_machine),
23622                            "interconnectAttachment" => Ok(__FieldTag::__interconnect_attachment),
23623                            "interconnect_attachment" => Ok(__FieldTag::__interconnect_attachment),
23624                            "nextHopIlbIp" => Ok(__FieldTag::__next_hop_ilb_ip),
23625                            "next_hop_ilb_ip" => Ok(__FieldTag::__next_hop_ilb_ip),
23626                            "nextHopOtherRoutes" => Ok(__FieldTag::__next_hop_other_routes),
23627                            "next_hop_other_routes" => Ok(__FieldTag::__next_hop_other_routes),
23628                            "name" => Ok(__FieldTag::__name),
23629                            "createTime" => Ok(__FieldTag::__create_time),
23630                            "create_time" => Ok(__FieldTag::__create_time),
23631                            "updateTime" => Ok(__FieldTag::__update_time),
23632                            "update_time" => Ok(__FieldTag::__update_time),
23633                            "labels" => Ok(__FieldTag::__labels),
23634                            "description" => Ok(__FieldTag::__description),
23635                            "network" => Ok(__FieldTag::__network),
23636                            "filter" => Ok(__FieldTag::__filter),
23637                            "priority" => Ok(__FieldTag::__priority),
23638                            "warnings" => Ok(__FieldTag::__warnings),
23639                            "selfLink" => Ok(__FieldTag::__self_link),
23640                            "self_link" => Ok(__FieldTag::__self_link),
23641                            "kind" => Ok(__FieldTag::__kind),
23642                            _ => Ok(__FieldTag::Unknown(value.to_string())),
23643                        }
23644                    }
23645                }
23646                deserializer.deserialize_identifier(Visitor)
23647            }
23648        }
23649        struct Visitor;
23650        impl<'de> serde::de::Visitor<'de> for Visitor {
23651            type Value = PolicyBasedRoute;
23652            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23653                formatter.write_str("struct PolicyBasedRoute")
23654            }
23655            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
23656            where
23657                A: serde::de::MapAccess<'de>,
23658            {
23659                #[allow(unused_imports)]
23660                use serde::de::Error;
23661                use std::option::Option::Some;
23662                let mut fields = std::collections::HashSet::new();
23663                let mut result = Self::Value::new();
23664                while let Some(tag) = map.next_key::<__FieldTag>()? {
23665                    #[allow(clippy::match_single_binding)]
23666                    match tag {
23667                        __FieldTag::__virtual_machine => {
23668                            if !fields.insert(__FieldTag::__virtual_machine) {
23669                                return std::result::Result::Err(A::Error::duplicate_field(
23670                                    "multiple values for virtual_machine",
23671                                ));
23672                            }
23673                            if result.target.is_some() {
23674                                return std::result::Result::Err(A::Error::duplicate_field(
23675                                    "multiple values for `target`, a oneof with full ID .google.cloud.networkconnectivity.v1.PolicyBasedRoute.virtual_machine, latest field was virtualMachine",
23676                                ));
23677                            }
23678                            result.target = std::option::Option::Some(
23679                                crate::model::policy_based_route::Target::VirtualMachine(
23680                                    map.next_value::<std::option::Option<
23681                                        std::boxed::Box<
23682                                            crate::model::policy_based_route::VirtualMachine,
23683                                        >,
23684                                    >>()?
23685                                    .unwrap_or_default(),
23686                                ),
23687                            );
23688                        }
23689                        __FieldTag::__interconnect_attachment => {
23690                            if !fields.insert(__FieldTag::__interconnect_attachment) {
23691                                return std::result::Result::Err(A::Error::duplicate_field(
23692                                    "multiple values for interconnect_attachment",
23693                                ));
23694                            }
23695                            if result.target.is_some() {
23696                                return std::result::Result::Err(A::Error::duplicate_field(
23697                                    "multiple values for `target`, a oneof with full ID .google.cloud.networkconnectivity.v1.PolicyBasedRoute.interconnect_attachment, latest field was interconnectAttachment",
23698                                ));
23699                            }
23700                            result.target = std::option::Option::Some(
23701                                crate::model::policy_based_route::Target::InterconnectAttachment(
23702                                    map.next_value::<std::option::Option<std::boxed::Box<crate::model::policy_based_route::InterconnectAttachment>>>()?.unwrap_or_default()
23703                                ),
23704                            );
23705                        }
23706                        __FieldTag::__next_hop_ilb_ip => {
23707                            if !fields.insert(__FieldTag::__next_hop_ilb_ip) {
23708                                return std::result::Result::Err(A::Error::duplicate_field(
23709                                    "multiple values for next_hop_ilb_ip",
23710                                ));
23711                            }
23712                            if result.next_hop.is_some() {
23713                                return std::result::Result::Err(A::Error::duplicate_field(
23714                                    "multiple values for `next_hop`, a oneof with full ID .google.cloud.networkconnectivity.v1.PolicyBasedRoute.next_hop_ilb_ip, latest field was nextHopIlbIp",
23715                                ));
23716                            }
23717                            result.next_hop = std::option::Option::Some(
23718                                crate::model::policy_based_route::NextHop::NextHopIlbIp(
23719                                    map.next_value::<std::option::Option<std::string::String>>()?
23720                                        .unwrap_or_default(),
23721                                ),
23722                            );
23723                        }
23724                        __FieldTag::__next_hop_other_routes => {
23725                            if !fields.insert(__FieldTag::__next_hop_other_routes) {
23726                                return std::result::Result::Err(A::Error::duplicate_field(
23727                                    "multiple values for next_hop_other_routes",
23728                                ));
23729                            }
23730                            if result.next_hop.is_some() {
23731                                return std::result::Result::Err(A::Error::duplicate_field(
23732                                    "multiple values for `next_hop`, a oneof with full ID .google.cloud.networkconnectivity.v1.PolicyBasedRoute.next_hop_other_routes, latest field was nextHopOtherRoutes",
23733                                ));
23734                            }
23735                            result.next_hop = std::option::Option::Some(
23736                                crate::model::policy_based_route::NextHop::NextHopOtherRoutes(
23737                                    map.next_value::<std::option::Option<
23738                                        crate::model::policy_based_route::OtherRoutes,
23739                                    >>()?
23740                                    .unwrap_or_default(),
23741                                ),
23742                            );
23743                        }
23744                        __FieldTag::__name => {
23745                            if !fields.insert(__FieldTag::__name) {
23746                                return std::result::Result::Err(A::Error::duplicate_field(
23747                                    "multiple values for name",
23748                                ));
23749                            }
23750                            result.name = map
23751                                .next_value::<std::option::Option<std::string::String>>()?
23752                                .unwrap_or_default();
23753                        }
23754                        __FieldTag::__create_time => {
23755                            if !fields.insert(__FieldTag::__create_time) {
23756                                return std::result::Result::Err(A::Error::duplicate_field(
23757                                    "multiple values for create_time",
23758                                ));
23759                            }
23760                            result.create_time =
23761                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
23762                        }
23763                        __FieldTag::__update_time => {
23764                            if !fields.insert(__FieldTag::__update_time) {
23765                                return std::result::Result::Err(A::Error::duplicate_field(
23766                                    "multiple values for update_time",
23767                                ));
23768                            }
23769                            result.update_time =
23770                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
23771                        }
23772                        __FieldTag::__labels => {
23773                            if !fields.insert(__FieldTag::__labels) {
23774                                return std::result::Result::Err(A::Error::duplicate_field(
23775                                    "multiple values for labels",
23776                                ));
23777                            }
23778                            result.labels = map
23779                                .next_value::<std::option::Option<
23780                                    std::collections::HashMap<
23781                                        std::string::String,
23782                                        std::string::String,
23783                                    >,
23784                                >>()?
23785                                .unwrap_or_default();
23786                        }
23787                        __FieldTag::__description => {
23788                            if !fields.insert(__FieldTag::__description) {
23789                                return std::result::Result::Err(A::Error::duplicate_field(
23790                                    "multiple values for description",
23791                                ));
23792                            }
23793                            result.description = map
23794                                .next_value::<std::option::Option<std::string::String>>()?
23795                                .unwrap_or_default();
23796                        }
23797                        __FieldTag::__network => {
23798                            if !fields.insert(__FieldTag::__network) {
23799                                return std::result::Result::Err(A::Error::duplicate_field(
23800                                    "multiple values for network",
23801                                ));
23802                            }
23803                            result.network = map
23804                                .next_value::<std::option::Option<std::string::String>>()?
23805                                .unwrap_or_default();
23806                        }
23807                        __FieldTag::__filter => {
23808                            if !fields.insert(__FieldTag::__filter) {
23809                                return std::result::Result::Err(A::Error::duplicate_field(
23810                                    "multiple values for filter",
23811                                ));
23812                            }
23813                            result.filter = map.next_value::<std::option::Option<crate::model::policy_based_route::Filter>>()?
23814                                ;
23815                        }
23816                        __FieldTag::__priority => {
23817                            if !fields.insert(__FieldTag::__priority) {
23818                                return std::result::Result::Err(A::Error::duplicate_field(
23819                                    "multiple values for priority",
23820                                ));
23821                            }
23822                            struct __With(std::option::Option<i32>);
23823                            impl<'de> serde::de::Deserialize<'de> for __With {
23824                                fn deserialize<D>(
23825                                    deserializer: D,
23826                                ) -> std::result::Result<Self, D::Error>
23827                                where
23828                                    D: serde::de::Deserializer<'de>,
23829                                {
23830                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
23831                                }
23832                            }
23833                            result.priority = map.next_value::<__With>()?.0.unwrap_or_default();
23834                        }
23835                        __FieldTag::__warnings => {
23836                            if !fields.insert(__FieldTag::__warnings) {
23837                                return std::result::Result::Err(A::Error::duplicate_field(
23838                                    "multiple values for warnings",
23839                                ));
23840                            }
23841                            result.warnings = map
23842                                .next_value::<std::option::Option<
23843                                    std::vec::Vec<crate::model::policy_based_route::Warnings>,
23844                                >>()?
23845                                .unwrap_or_default();
23846                        }
23847                        __FieldTag::__self_link => {
23848                            if !fields.insert(__FieldTag::__self_link) {
23849                                return std::result::Result::Err(A::Error::duplicate_field(
23850                                    "multiple values for self_link",
23851                                ));
23852                            }
23853                            result.self_link = map
23854                                .next_value::<std::option::Option<std::string::String>>()?
23855                                .unwrap_or_default();
23856                        }
23857                        __FieldTag::__kind => {
23858                            if !fields.insert(__FieldTag::__kind) {
23859                                return std::result::Result::Err(A::Error::duplicate_field(
23860                                    "multiple values for kind",
23861                                ));
23862                            }
23863                            result.kind = map
23864                                .next_value::<std::option::Option<std::string::String>>()?
23865                                .unwrap_or_default();
23866                        }
23867                        __FieldTag::Unknown(key) => {
23868                            let value = map.next_value::<serde_json::Value>()?;
23869                            result._unknown_fields.insert(key, value);
23870                        }
23871                    }
23872                }
23873                std::result::Result::Ok(result)
23874            }
23875        }
23876        deserializer.deserialize_any(Visitor)
23877    }
23878}
23879
23880#[doc(hidden)]
23881impl serde::ser::Serialize for PolicyBasedRoute {
23882    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23883    where
23884        S: serde::ser::Serializer,
23885    {
23886        use serde::ser::SerializeMap;
23887        #[allow(unused_imports)]
23888        use std::option::Option::Some;
23889        let mut state = serializer.serialize_map(std::option::Option::None)?;
23890        if let Some(value) = self.virtual_machine() {
23891            state.serialize_entry("virtualMachine", value)?;
23892        }
23893        if let Some(value) = self.interconnect_attachment() {
23894            state.serialize_entry("interconnectAttachment", value)?;
23895        }
23896        if let Some(value) = self.next_hop_ilb_ip() {
23897            state.serialize_entry("nextHopIlbIp", value)?;
23898        }
23899        if let Some(value) = self.next_hop_other_routes() {
23900            state.serialize_entry("nextHopOtherRoutes", value)?;
23901        }
23902        if !self.name.is_empty() {
23903            state.serialize_entry("name", &self.name)?;
23904        }
23905        if self.create_time.is_some() {
23906            state.serialize_entry("createTime", &self.create_time)?;
23907        }
23908        if self.update_time.is_some() {
23909            state.serialize_entry("updateTime", &self.update_time)?;
23910        }
23911        if !self.labels.is_empty() {
23912            state.serialize_entry("labels", &self.labels)?;
23913        }
23914        if !self.description.is_empty() {
23915            state.serialize_entry("description", &self.description)?;
23916        }
23917        if !self.network.is_empty() {
23918            state.serialize_entry("network", &self.network)?;
23919        }
23920        if self.filter.is_some() {
23921            state.serialize_entry("filter", &self.filter)?;
23922        }
23923        if !wkt::internal::is_default(&self.priority) {
23924            struct __With<'a>(&'a i32);
23925            impl<'a> serde::ser::Serialize for __With<'a> {
23926                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23927                where
23928                    S: serde::ser::Serializer,
23929                {
23930                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
23931                }
23932            }
23933            state.serialize_entry("priority", &__With(&self.priority))?;
23934        }
23935        if !self.warnings.is_empty() {
23936            state.serialize_entry("warnings", &self.warnings)?;
23937        }
23938        if !self.self_link.is_empty() {
23939            state.serialize_entry("selfLink", &self.self_link)?;
23940        }
23941        if !self.kind.is_empty() {
23942            state.serialize_entry("kind", &self.kind)?;
23943        }
23944        if !self._unknown_fields.is_empty() {
23945            for (key, value) in self._unknown_fields.iter() {
23946                state.serialize_entry(key, &value)?;
23947            }
23948        }
23949        state.end()
23950    }
23951}
23952
23953/// Defines additional types related to [PolicyBasedRoute].
23954pub mod policy_based_route {
23955    #[allow(unused_imports)]
23956    use super::*;
23957
23958    /// VM instances that this policy-based route applies to.
23959    #[derive(Clone, Debug, Default, PartialEq)]
23960    #[non_exhaustive]
23961    pub struct VirtualMachine {
23962        /// Optional. A list of VM instance tags that this policy-based route applies
23963        /// to. VM instances that have ANY of tags specified here installs this PBR.
23964        pub tags: std::vec::Vec<std::string::String>,
23965
23966        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23967    }
23968
23969    impl VirtualMachine {
23970        pub fn new() -> Self {
23971            std::default::Default::default()
23972        }
23973
23974        /// Sets the value of [tags][crate::model::policy_based_route::VirtualMachine::tags].
23975        pub fn set_tags<T, V>(mut self, v: T) -> Self
23976        where
23977            T: std::iter::IntoIterator<Item = V>,
23978            V: std::convert::Into<std::string::String>,
23979        {
23980            use std::iter::Iterator;
23981            self.tags = v.into_iter().map(|i| i.into()).collect();
23982            self
23983        }
23984    }
23985
23986    impl wkt::message::Message for VirtualMachine {
23987        fn typename() -> &'static str {
23988            "type.googleapis.com/google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine"
23989        }
23990    }
23991
23992    #[doc(hidden)]
23993    impl<'de> serde::de::Deserialize<'de> for VirtualMachine {
23994        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23995        where
23996            D: serde::Deserializer<'de>,
23997        {
23998            #[allow(non_camel_case_types)]
23999            #[doc(hidden)]
24000            #[derive(PartialEq, Eq, Hash)]
24001            enum __FieldTag {
24002                __tags,
24003                Unknown(std::string::String),
24004            }
24005            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
24006                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24007                where
24008                    D: serde::Deserializer<'de>,
24009                {
24010                    struct Visitor;
24011                    impl<'de> serde::de::Visitor<'de> for Visitor {
24012                        type Value = __FieldTag;
24013                        fn expecting(
24014                            &self,
24015                            formatter: &mut std::fmt::Formatter,
24016                        ) -> std::fmt::Result {
24017                            formatter.write_str("a field name for VirtualMachine")
24018                        }
24019                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
24020                        where
24021                            E: serde::de::Error,
24022                        {
24023                            use std::result::Result::Ok;
24024                            use std::string::ToString;
24025                            match value {
24026                                "tags" => Ok(__FieldTag::__tags),
24027                                _ => Ok(__FieldTag::Unknown(value.to_string())),
24028                            }
24029                        }
24030                    }
24031                    deserializer.deserialize_identifier(Visitor)
24032                }
24033            }
24034            struct Visitor;
24035            impl<'de> serde::de::Visitor<'de> for Visitor {
24036                type Value = VirtualMachine;
24037                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24038                    formatter.write_str("struct VirtualMachine")
24039                }
24040                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
24041                where
24042                    A: serde::de::MapAccess<'de>,
24043                {
24044                    #[allow(unused_imports)]
24045                    use serde::de::Error;
24046                    use std::option::Option::Some;
24047                    let mut fields = std::collections::HashSet::new();
24048                    let mut result = Self::Value::new();
24049                    while let Some(tag) = map.next_key::<__FieldTag>()? {
24050                        #[allow(clippy::match_single_binding)]
24051                        match tag {
24052                            __FieldTag::__tags => {
24053                                if !fields.insert(__FieldTag::__tags) {
24054                                    return std::result::Result::Err(A::Error::duplicate_field(
24055                                        "multiple values for tags",
24056                                    ));
24057                                }
24058                                result.tags = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
24059                            }
24060                            __FieldTag::Unknown(key) => {
24061                                let value = map.next_value::<serde_json::Value>()?;
24062                                result._unknown_fields.insert(key, value);
24063                            }
24064                        }
24065                    }
24066                    std::result::Result::Ok(result)
24067                }
24068            }
24069            deserializer.deserialize_any(Visitor)
24070        }
24071    }
24072
24073    #[doc(hidden)]
24074    impl serde::ser::Serialize for VirtualMachine {
24075        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24076        where
24077            S: serde::ser::Serializer,
24078        {
24079            use serde::ser::SerializeMap;
24080            #[allow(unused_imports)]
24081            use std::option::Option::Some;
24082            let mut state = serializer.serialize_map(std::option::Option::None)?;
24083            if !self.tags.is_empty() {
24084                state.serialize_entry("tags", &self.tags)?;
24085            }
24086            if !self._unknown_fields.is_empty() {
24087                for (key, value) in self._unknown_fields.iter() {
24088                    state.serialize_entry(key, &value)?;
24089                }
24090            }
24091            state.end()
24092        }
24093    }
24094
24095    /// InterconnectAttachment that this route applies to.
24096    #[derive(Clone, Debug, Default, PartialEq)]
24097    #[non_exhaustive]
24098    pub struct InterconnectAttachment {
24099        /// Optional. Cloud region to install this policy-based route on interconnect
24100        /// attachment. Use `all` to install it on all interconnect attachments.
24101        pub region: std::string::String,
24102
24103        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24104    }
24105
24106    impl InterconnectAttachment {
24107        pub fn new() -> Self {
24108            std::default::Default::default()
24109        }
24110
24111        /// Sets the value of [region][crate::model::policy_based_route::InterconnectAttachment::region].
24112        pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24113            self.region = v.into();
24114            self
24115        }
24116    }
24117
24118    impl wkt::message::Message for InterconnectAttachment {
24119        fn typename() -> &'static str {
24120            "type.googleapis.com/google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment"
24121        }
24122    }
24123
24124    #[doc(hidden)]
24125    impl<'de> serde::de::Deserialize<'de> for InterconnectAttachment {
24126        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24127        where
24128            D: serde::Deserializer<'de>,
24129        {
24130            #[allow(non_camel_case_types)]
24131            #[doc(hidden)]
24132            #[derive(PartialEq, Eq, Hash)]
24133            enum __FieldTag {
24134                __region,
24135                Unknown(std::string::String),
24136            }
24137            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
24138                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24139                where
24140                    D: serde::Deserializer<'de>,
24141                {
24142                    struct Visitor;
24143                    impl<'de> serde::de::Visitor<'de> for Visitor {
24144                        type Value = __FieldTag;
24145                        fn expecting(
24146                            &self,
24147                            formatter: &mut std::fmt::Formatter,
24148                        ) -> std::fmt::Result {
24149                            formatter.write_str("a field name for InterconnectAttachment")
24150                        }
24151                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
24152                        where
24153                            E: serde::de::Error,
24154                        {
24155                            use std::result::Result::Ok;
24156                            use std::string::ToString;
24157                            match value {
24158                                "region" => Ok(__FieldTag::__region),
24159                                _ => Ok(__FieldTag::Unknown(value.to_string())),
24160                            }
24161                        }
24162                    }
24163                    deserializer.deserialize_identifier(Visitor)
24164                }
24165            }
24166            struct Visitor;
24167            impl<'de> serde::de::Visitor<'de> for Visitor {
24168                type Value = InterconnectAttachment;
24169                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24170                    formatter.write_str("struct InterconnectAttachment")
24171                }
24172                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
24173                where
24174                    A: serde::de::MapAccess<'de>,
24175                {
24176                    #[allow(unused_imports)]
24177                    use serde::de::Error;
24178                    use std::option::Option::Some;
24179                    let mut fields = std::collections::HashSet::new();
24180                    let mut result = Self::Value::new();
24181                    while let Some(tag) = map.next_key::<__FieldTag>()? {
24182                        #[allow(clippy::match_single_binding)]
24183                        match tag {
24184                            __FieldTag::__region => {
24185                                if !fields.insert(__FieldTag::__region) {
24186                                    return std::result::Result::Err(A::Error::duplicate_field(
24187                                        "multiple values for region",
24188                                    ));
24189                                }
24190                                result.region = map
24191                                    .next_value::<std::option::Option<std::string::String>>()?
24192                                    .unwrap_or_default();
24193                            }
24194                            __FieldTag::Unknown(key) => {
24195                                let value = map.next_value::<serde_json::Value>()?;
24196                                result._unknown_fields.insert(key, value);
24197                            }
24198                        }
24199                    }
24200                    std::result::Result::Ok(result)
24201                }
24202            }
24203            deserializer.deserialize_any(Visitor)
24204        }
24205    }
24206
24207    #[doc(hidden)]
24208    impl serde::ser::Serialize for InterconnectAttachment {
24209        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24210        where
24211            S: serde::ser::Serializer,
24212        {
24213            use serde::ser::SerializeMap;
24214            #[allow(unused_imports)]
24215            use std::option::Option::Some;
24216            let mut state = serializer.serialize_map(std::option::Option::None)?;
24217            if !self.region.is_empty() {
24218                state.serialize_entry("region", &self.region)?;
24219            }
24220            if !self._unknown_fields.is_empty() {
24221                for (key, value) in self._unknown_fields.iter() {
24222                    state.serialize_entry(key, &value)?;
24223                }
24224            }
24225            state.end()
24226        }
24227    }
24228
24229    /// Filter matches L4 traffic.
24230    #[derive(Clone, Debug, Default, PartialEq)]
24231    #[non_exhaustive]
24232    pub struct Filter {
24233        /// Optional. The IP protocol that this policy-based route applies to. Valid
24234        /// values are 'TCP', 'UDP', and 'ALL'. Default is 'ALL'.
24235        pub ip_protocol: std::string::String,
24236
24237        /// Optional. The source IP range of outgoing packets that this policy-based
24238        /// route applies to. Default is "0.0.0.0/0" if protocol version is IPv4.
24239        pub src_range: std::string::String,
24240
24241        /// Optional. The destination IP range of outgoing packets that this
24242        /// policy-based route applies to. Default is "0.0.0.0/0" if protocol version
24243        /// is IPv4.
24244        pub dest_range: std::string::String,
24245
24246        /// Required. Internet protocol versions this policy-based route applies to.
24247        /// For this version, only IPV4 is supported. IPV6 is supported in preview.
24248        pub protocol_version: crate::model::policy_based_route::filter::ProtocolVersion,
24249
24250        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24251    }
24252
24253    impl Filter {
24254        pub fn new() -> Self {
24255            std::default::Default::default()
24256        }
24257
24258        /// Sets the value of [ip_protocol][crate::model::policy_based_route::Filter::ip_protocol].
24259        pub fn set_ip_protocol<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24260            self.ip_protocol = v.into();
24261            self
24262        }
24263
24264        /// Sets the value of [src_range][crate::model::policy_based_route::Filter::src_range].
24265        pub fn set_src_range<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24266            self.src_range = v.into();
24267            self
24268        }
24269
24270        /// Sets the value of [dest_range][crate::model::policy_based_route::Filter::dest_range].
24271        pub fn set_dest_range<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24272            self.dest_range = v.into();
24273            self
24274        }
24275
24276        /// Sets the value of [protocol_version][crate::model::policy_based_route::Filter::protocol_version].
24277        pub fn set_protocol_version<
24278            T: std::convert::Into<crate::model::policy_based_route::filter::ProtocolVersion>,
24279        >(
24280            mut self,
24281            v: T,
24282        ) -> Self {
24283            self.protocol_version = v.into();
24284            self
24285        }
24286    }
24287
24288    impl wkt::message::Message for Filter {
24289        fn typename() -> &'static str {
24290            "type.googleapis.com/google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter"
24291        }
24292    }
24293
24294    #[doc(hidden)]
24295    impl<'de> serde::de::Deserialize<'de> for Filter {
24296        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24297        where
24298            D: serde::Deserializer<'de>,
24299        {
24300            #[allow(non_camel_case_types)]
24301            #[doc(hidden)]
24302            #[derive(PartialEq, Eq, Hash)]
24303            enum __FieldTag {
24304                __ip_protocol,
24305                __src_range,
24306                __dest_range,
24307                __protocol_version,
24308                Unknown(std::string::String),
24309            }
24310            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
24311                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24312                where
24313                    D: serde::Deserializer<'de>,
24314                {
24315                    struct Visitor;
24316                    impl<'de> serde::de::Visitor<'de> for Visitor {
24317                        type Value = __FieldTag;
24318                        fn expecting(
24319                            &self,
24320                            formatter: &mut std::fmt::Formatter,
24321                        ) -> std::fmt::Result {
24322                            formatter.write_str("a field name for Filter")
24323                        }
24324                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
24325                        where
24326                            E: serde::de::Error,
24327                        {
24328                            use std::result::Result::Ok;
24329                            use std::string::ToString;
24330                            match value {
24331                                "ipProtocol" => Ok(__FieldTag::__ip_protocol),
24332                                "ip_protocol" => Ok(__FieldTag::__ip_protocol),
24333                                "srcRange" => Ok(__FieldTag::__src_range),
24334                                "src_range" => Ok(__FieldTag::__src_range),
24335                                "destRange" => Ok(__FieldTag::__dest_range),
24336                                "dest_range" => Ok(__FieldTag::__dest_range),
24337                                "protocolVersion" => Ok(__FieldTag::__protocol_version),
24338                                "protocol_version" => Ok(__FieldTag::__protocol_version),
24339                                _ => Ok(__FieldTag::Unknown(value.to_string())),
24340                            }
24341                        }
24342                    }
24343                    deserializer.deserialize_identifier(Visitor)
24344                }
24345            }
24346            struct Visitor;
24347            impl<'de> serde::de::Visitor<'de> for Visitor {
24348                type Value = Filter;
24349                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24350                    formatter.write_str("struct Filter")
24351                }
24352                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
24353                where
24354                    A: serde::de::MapAccess<'de>,
24355                {
24356                    #[allow(unused_imports)]
24357                    use serde::de::Error;
24358                    use std::option::Option::Some;
24359                    let mut fields = std::collections::HashSet::new();
24360                    let mut result = Self::Value::new();
24361                    while let Some(tag) = map.next_key::<__FieldTag>()? {
24362                        #[allow(clippy::match_single_binding)]
24363                        match tag {
24364                            __FieldTag::__ip_protocol => {
24365                                if !fields.insert(__FieldTag::__ip_protocol) {
24366                                    return std::result::Result::Err(A::Error::duplicate_field(
24367                                        "multiple values for ip_protocol",
24368                                    ));
24369                                }
24370                                result.ip_protocol = map
24371                                    .next_value::<std::option::Option<std::string::String>>()?
24372                                    .unwrap_or_default();
24373                            }
24374                            __FieldTag::__src_range => {
24375                                if !fields.insert(__FieldTag::__src_range) {
24376                                    return std::result::Result::Err(A::Error::duplicate_field(
24377                                        "multiple values for src_range",
24378                                    ));
24379                                }
24380                                result.src_range = map
24381                                    .next_value::<std::option::Option<std::string::String>>()?
24382                                    .unwrap_or_default();
24383                            }
24384                            __FieldTag::__dest_range => {
24385                                if !fields.insert(__FieldTag::__dest_range) {
24386                                    return std::result::Result::Err(A::Error::duplicate_field(
24387                                        "multiple values for dest_range",
24388                                    ));
24389                                }
24390                                result.dest_range = map
24391                                    .next_value::<std::option::Option<std::string::String>>()?
24392                                    .unwrap_or_default();
24393                            }
24394                            __FieldTag::__protocol_version => {
24395                                if !fields.insert(__FieldTag::__protocol_version) {
24396                                    return std::result::Result::Err(A::Error::duplicate_field(
24397                                        "multiple values for protocol_version",
24398                                    ));
24399                                }
24400                                result.protocol_version = map
24401                                    .next_value::<std::option::Option<
24402                                        crate::model::policy_based_route::filter::ProtocolVersion,
24403                                    >>()?
24404                                    .unwrap_or_default();
24405                            }
24406                            __FieldTag::Unknown(key) => {
24407                                let value = map.next_value::<serde_json::Value>()?;
24408                                result._unknown_fields.insert(key, value);
24409                            }
24410                        }
24411                    }
24412                    std::result::Result::Ok(result)
24413                }
24414            }
24415            deserializer.deserialize_any(Visitor)
24416        }
24417    }
24418
24419    #[doc(hidden)]
24420    impl serde::ser::Serialize for Filter {
24421        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24422        where
24423            S: serde::ser::Serializer,
24424        {
24425            use serde::ser::SerializeMap;
24426            #[allow(unused_imports)]
24427            use std::option::Option::Some;
24428            let mut state = serializer.serialize_map(std::option::Option::None)?;
24429            if !self.ip_protocol.is_empty() {
24430                state.serialize_entry("ipProtocol", &self.ip_protocol)?;
24431            }
24432            if !self.src_range.is_empty() {
24433                state.serialize_entry("srcRange", &self.src_range)?;
24434            }
24435            if !self.dest_range.is_empty() {
24436                state.serialize_entry("destRange", &self.dest_range)?;
24437            }
24438            if !wkt::internal::is_default(&self.protocol_version) {
24439                state.serialize_entry("protocolVersion", &self.protocol_version)?;
24440            }
24441            if !self._unknown_fields.is_empty() {
24442                for (key, value) in self._unknown_fields.iter() {
24443                    state.serialize_entry(key, &value)?;
24444                }
24445            }
24446            state.end()
24447        }
24448    }
24449
24450    /// Defines additional types related to [Filter].
24451    pub mod filter {
24452        #[allow(unused_imports)]
24453        use super::*;
24454
24455        /// The internet protocol version.
24456        ///
24457        /// # Working with unknown values
24458        ///
24459        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
24460        /// additional enum variants at any time. Adding new variants is not considered
24461        /// a breaking change. Applications should write their code in anticipation of:
24462        ///
24463        /// - New values appearing in future releases of the client library, **and**
24464        /// - New values received dynamically, without application changes.
24465        ///
24466        /// Please consult the [Working with enums] section in the user guide for some
24467        /// guidelines.
24468        ///
24469        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
24470        #[derive(Clone, Debug, PartialEq)]
24471        #[non_exhaustive]
24472        pub enum ProtocolVersion {
24473            /// Default value.
24474            Unspecified,
24475            /// The PBR is for IPv4 internet protocol traffic.
24476            Ipv4,
24477            /// If set, the enum was initialized with an unknown value.
24478            ///
24479            /// Applications can examine the value using [ProtocolVersion::value] or
24480            /// [ProtocolVersion::name].
24481            UnknownValue(protocol_version::UnknownValue),
24482        }
24483
24484        #[doc(hidden)]
24485        pub mod protocol_version {
24486            #[allow(unused_imports)]
24487            use super::*;
24488            #[derive(Clone, Debug, PartialEq)]
24489            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
24490        }
24491
24492        impl ProtocolVersion {
24493            /// Gets the enum value.
24494            ///
24495            /// Returns `None` if the enum contains an unknown value deserialized from
24496            /// the string representation of enums.
24497            pub fn value(&self) -> std::option::Option<i32> {
24498                match self {
24499                    Self::Unspecified => std::option::Option::Some(0),
24500                    Self::Ipv4 => std::option::Option::Some(1),
24501                    Self::UnknownValue(u) => u.0.value(),
24502                }
24503            }
24504
24505            /// Gets the enum value as a string.
24506            ///
24507            /// Returns `None` if the enum contains an unknown value deserialized from
24508            /// the integer representation of enums.
24509            pub fn name(&self) -> std::option::Option<&str> {
24510                match self {
24511                    Self::Unspecified => std::option::Option::Some("PROTOCOL_VERSION_UNSPECIFIED"),
24512                    Self::Ipv4 => std::option::Option::Some("IPV4"),
24513                    Self::UnknownValue(u) => u.0.name(),
24514                }
24515            }
24516        }
24517
24518        impl std::default::Default for ProtocolVersion {
24519            fn default() -> Self {
24520                use std::convert::From;
24521                Self::from(0)
24522            }
24523        }
24524
24525        impl std::fmt::Display for ProtocolVersion {
24526            fn fmt(
24527                &self,
24528                f: &mut std::fmt::Formatter<'_>,
24529            ) -> std::result::Result<(), std::fmt::Error> {
24530                wkt::internal::display_enum(f, self.name(), self.value())
24531            }
24532        }
24533
24534        impl std::convert::From<i32> for ProtocolVersion {
24535            fn from(value: i32) -> Self {
24536                match value {
24537                    0 => Self::Unspecified,
24538                    1 => Self::Ipv4,
24539                    _ => Self::UnknownValue(protocol_version::UnknownValue(
24540                        wkt::internal::UnknownEnumValue::Integer(value),
24541                    )),
24542                }
24543            }
24544        }
24545
24546        impl std::convert::From<&str> for ProtocolVersion {
24547            fn from(value: &str) -> Self {
24548                use std::string::ToString;
24549                match value {
24550                    "PROTOCOL_VERSION_UNSPECIFIED" => Self::Unspecified,
24551                    "IPV4" => Self::Ipv4,
24552                    _ => Self::UnknownValue(protocol_version::UnknownValue(
24553                        wkt::internal::UnknownEnumValue::String(value.to_string()),
24554                    )),
24555                }
24556            }
24557        }
24558
24559        impl serde::ser::Serialize for ProtocolVersion {
24560            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24561            where
24562                S: serde::Serializer,
24563            {
24564                match self {
24565                    Self::Unspecified => serializer.serialize_i32(0),
24566                    Self::Ipv4 => serializer.serialize_i32(1),
24567                    Self::UnknownValue(u) => u.0.serialize(serializer),
24568                }
24569            }
24570        }
24571
24572        impl<'de> serde::de::Deserialize<'de> for ProtocolVersion {
24573            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24574            where
24575                D: serde::Deserializer<'de>,
24576            {
24577                deserializer.deserialize_any(wkt::internal::EnumVisitor::<ProtocolVersion>::new(
24578                    ".google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.ProtocolVersion",
24579                ))
24580            }
24581        }
24582    }
24583
24584    /// Informational warning message.
24585    #[derive(Clone, Debug, Default, PartialEq)]
24586    #[non_exhaustive]
24587    pub struct Warnings {
24588        /// Output only. A warning code, if applicable.
24589        pub code: crate::model::policy_based_route::warnings::Code,
24590
24591        /// Output only. Metadata about this warning in key: value format. The key
24592        /// should provides more detail on the warning being returned. For example,
24593        /// for warnings where there are no results in a list request for a
24594        /// particular zone, this key might be scope and the key value might be the
24595        /// zone name. Other examples might be a key indicating a deprecated resource
24596        /// and a suggested replacement.
24597        pub data: std::collections::HashMap<std::string::String, std::string::String>,
24598
24599        /// Output only. A human-readable description of the warning code.
24600        pub warning_message: std::string::String,
24601
24602        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24603    }
24604
24605    impl Warnings {
24606        pub fn new() -> Self {
24607            std::default::Default::default()
24608        }
24609
24610        /// Sets the value of [code][crate::model::policy_based_route::Warnings::code].
24611        pub fn set_code<T: std::convert::Into<crate::model::policy_based_route::warnings::Code>>(
24612            mut self,
24613            v: T,
24614        ) -> Self {
24615            self.code = v.into();
24616            self
24617        }
24618
24619        /// Sets the value of [data][crate::model::policy_based_route::Warnings::data].
24620        pub fn set_data<T, K, V>(mut self, v: T) -> Self
24621        where
24622            T: std::iter::IntoIterator<Item = (K, V)>,
24623            K: std::convert::Into<std::string::String>,
24624            V: std::convert::Into<std::string::String>,
24625        {
24626            use std::iter::Iterator;
24627            self.data = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
24628            self
24629        }
24630
24631        /// Sets the value of [warning_message][crate::model::policy_based_route::Warnings::warning_message].
24632        pub fn set_warning_message<T: std::convert::Into<std::string::String>>(
24633            mut self,
24634            v: T,
24635        ) -> Self {
24636            self.warning_message = v.into();
24637            self
24638        }
24639    }
24640
24641    impl wkt::message::Message for Warnings {
24642        fn typename() -> &'static str {
24643            "type.googleapis.com/google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings"
24644        }
24645    }
24646
24647    #[doc(hidden)]
24648    impl<'de> serde::de::Deserialize<'de> for Warnings {
24649        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24650        where
24651            D: serde::Deserializer<'de>,
24652        {
24653            #[allow(non_camel_case_types)]
24654            #[doc(hidden)]
24655            #[derive(PartialEq, Eq, Hash)]
24656            enum __FieldTag {
24657                __code,
24658                __data,
24659                __warning_message,
24660                Unknown(std::string::String),
24661            }
24662            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
24663                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24664                where
24665                    D: serde::Deserializer<'de>,
24666                {
24667                    struct Visitor;
24668                    impl<'de> serde::de::Visitor<'de> for Visitor {
24669                        type Value = __FieldTag;
24670                        fn expecting(
24671                            &self,
24672                            formatter: &mut std::fmt::Formatter,
24673                        ) -> std::fmt::Result {
24674                            formatter.write_str("a field name for Warnings")
24675                        }
24676                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
24677                        where
24678                            E: serde::de::Error,
24679                        {
24680                            use std::result::Result::Ok;
24681                            use std::string::ToString;
24682                            match value {
24683                                "code" => Ok(__FieldTag::__code),
24684                                "data" => Ok(__FieldTag::__data),
24685                                "warningMessage" => Ok(__FieldTag::__warning_message),
24686                                "warning_message" => Ok(__FieldTag::__warning_message),
24687                                _ => Ok(__FieldTag::Unknown(value.to_string())),
24688                            }
24689                        }
24690                    }
24691                    deserializer.deserialize_identifier(Visitor)
24692                }
24693            }
24694            struct Visitor;
24695            impl<'de> serde::de::Visitor<'de> for Visitor {
24696                type Value = Warnings;
24697                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24698                    formatter.write_str("struct Warnings")
24699                }
24700                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
24701                where
24702                    A: serde::de::MapAccess<'de>,
24703                {
24704                    #[allow(unused_imports)]
24705                    use serde::de::Error;
24706                    use std::option::Option::Some;
24707                    let mut fields = std::collections::HashSet::new();
24708                    let mut result = Self::Value::new();
24709                    while let Some(tag) = map.next_key::<__FieldTag>()? {
24710                        #[allow(clippy::match_single_binding)]
24711                        match tag {
24712                            __FieldTag::__code => {
24713                                if !fields.insert(__FieldTag::__code) {
24714                                    return std::result::Result::Err(A::Error::duplicate_field(
24715                                        "multiple values for code",
24716                                    ));
24717                                }
24718                                result.code = map
24719                                    .next_value::<std::option::Option<
24720                                        crate::model::policy_based_route::warnings::Code,
24721                                    >>()?
24722                                    .unwrap_or_default();
24723                            }
24724                            __FieldTag::__data => {
24725                                if !fields.insert(__FieldTag::__data) {
24726                                    return std::result::Result::Err(A::Error::duplicate_field(
24727                                        "multiple values for data",
24728                                    ));
24729                                }
24730                                result.data = map
24731                                    .next_value::<std::option::Option<
24732                                        std::collections::HashMap<
24733                                            std::string::String,
24734                                            std::string::String,
24735                                        >,
24736                                    >>()?
24737                                    .unwrap_or_default();
24738                            }
24739                            __FieldTag::__warning_message => {
24740                                if !fields.insert(__FieldTag::__warning_message) {
24741                                    return std::result::Result::Err(A::Error::duplicate_field(
24742                                        "multiple values for warning_message",
24743                                    ));
24744                                }
24745                                result.warning_message = map
24746                                    .next_value::<std::option::Option<std::string::String>>()?
24747                                    .unwrap_or_default();
24748                            }
24749                            __FieldTag::Unknown(key) => {
24750                                let value = map.next_value::<serde_json::Value>()?;
24751                                result._unknown_fields.insert(key, value);
24752                            }
24753                        }
24754                    }
24755                    std::result::Result::Ok(result)
24756                }
24757            }
24758            deserializer.deserialize_any(Visitor)
24759        }
24760    }
24761
24762    #[doc(hidden)]
24763    impl serde::ser::Serialize for Warnings {
24764        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24765        where
24766            S: serde::ser::Serializer,
24767        {
24768            use serde::ser::SerializeMap;
24769            #[allow(unused_imports)]
24770            use std::option::Option::Some;
24771            let mut state = serializer.serialize_map(std::option::Option::None)?;
24772            if !wkt::internal::is_default(&self.code) {
24773                state.serialize_entry("code", &self.code)?;
24774            }
24775            if !self.data.is_empty() {
24776                state.serialize_entry("data", &self.data)?;
24777            }
24778            if !self.warning_message.is_empty() {
24779                state.serialize_entry("warningMessage", &self.warning_message)?;
24780            }
24781            if !self._unknown_fields.is_empty() {
24782                for (key, value) in self._unknown_fields.iter() {
24783                    state.serialize_entry(key, &value)?;
24784                }
24785            }
24786            state.end()
24787        }
24788    }
24789
24790    /// Defines additional types related to [Warnings].
24791    pub mod warnings {
24792        #[allow(unused_imports)]
24793        use super::*;
24794
24795        /// Warning code for policy-based routing. Expect to add values in the
24796        /// future.
24797        ///
24798        /// # Working with unknown values
24799        ///
24800        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
24801        /// additional enum variants at any time. Adding new variants is not considered
24802        /// a breaking change. Applications should write their code in anticipation of:
24803        ///
24804        /// - New values appearing in future releases of the client library, **and**
24805        /// - New values received dynamically, without application changes.
24806        ///
24807        /// Please consult the [Working with enums] section in the user guide for some
24808        /// guidelines.
24809        ///
24810        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
24811        #[derive(Clone, Debug, PartialEq)]
24812        #[non_exhaustive]
24813        pub enum Code {
24814            /// Default value.
24815            WarningUnspecified,
24816            /// The policy-based route is not active and functioning. Common causes are
24817            /// that the dependent network was deleted or the resource project was
24818            /// turned off.
24819            ResourceNotActive,
24820            /// The policy-based route is being modified (e.g. created/deleted) at this
24821            /// time.
24822            ResourceBeingModified,
24823            /// If set, the enum was initialized with an unknown value.
24824            ///
24825            /// Applications can examine the value using [Code::value] or
24826            /// [Code::name].
24827            UnknownValue(code::UnknownValue),
24828        }
24829
24830        #[doc(hidden)]
24831        pub mod code {
24832            #[allow(unused_imports)]
24833            use super::*;
24834            #[derive(Clone, Debug, PartialEq)]
24835            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
24836        }
24837
24838        impl Code {
24839            /// Gets the enum value.
24840            ///
24841            /// Returns `None` if the enum contains an unknown value deserialized from
24842            /// the string representation of enums.
24843            pub fn value(&self) -> std::option::Option<i32> {
24844                match self {
24845                    Self::WarningUnspecified => std::option::Option::Some(0),
24846                    Self::ResourceNotActive => std::option::Option::Some(1),
24847                    Self::ResourceBeingModified => std::option::Option::Some(2),
24848                    Self::UnknownValue(u) => u.0.value(),
24849                }
24850            }
24851
24852            /// Gets the enum value as a string.
24853            ///
24854            /// Returns `None` if the enum contains an unknown value deserialized from
24855            /// the integer representation of enums.
24856            pub fn name(&self) -> std::option::Option<&str> {
24857                match self {
24858                    Self::WarningUnspecified => std::option::Option::Some("WARNING_UNSPECIFIED"),
24859                    Self::ResourceNotActive => std::option::Option::Some("RESOURCE_NOT_ACTIVE"),
24860                    Self::ResourceBeingModified => {
24861                        std::option::Option::Some("RESOURCE_BEING_MODIFIED")
24862                    }
24863                    Self::UnknownValue(u) => u.0.name(),
24864                }
24865            }
24866        }
24867
24868        impl std::default::Default for Code {
24869            fn default() -> Self {
24870                use std::convert::From;
24871                Self::from(0)
24872            }
24873        }
24874
24875        impl std::fmt::Display for Code {
24876            fn fmt(
24877                &self,
24878                f: &mut std::fmt::Formatter<'_>,
24879            ) -> std::result::Result<(), std::fmt::Error> {
24880                wkt::internal::display_enum(f, self.name(), self.value())
24881            }
24882        }
24883
24884        impl std::convert::From<i32> for Code {
24885            fn from(value: i32) -> Self {
24886                match value {
24887                    0 => Self::WarningUnspecified,
24888                    1 => Self::ResourceNotActive,
24889                    2 => Self::ResourceBeingModified,
24890                    _ => Self::UnknownValue(code::UnknownValue(
24891                        wkt::internal::UnknownEnumValue::Integer(value),
24892                    )),
24893                }
24894            }
24895        }
24896
24897        impl std::convert::From<&str> for Code {
24898            fn from(value: &str) -> Self {
24899                use std::string::ToString;
24900                match value {
24901                    "WARNING_UNSPECIFIED" => Self::WarningUnspecified,
24902                    "RESOURCE_NOT_ACTIVE" => Self::ResourceNotActive,
24903                    "RESOURCE_BEING_MODIFIED" => Self::ResourceBeingModified,
24904                    _ => Self::UnknownValue(code::UnknownValue(
24905                        wkt::internal::UnknownEnumValue::String(value.to_string()),
24906                    )),
24907                }
24908            }
24909        }
24910
24911        impl serde::ser::Serialize for Code {
24912            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24913            where
24914                S: serde::Serializer,
24915            {
24916                match self {
24917                    Self::WarningUnspecified => serializer.serialize_i32(0),
24918                    Self::ResourceNotActive => serializer.serialize_i32(1),
24919                    Self::ResourceBeingModified => serializer.serialize_i32(2),
24920                    Self::UnknownValue(u) => u.0.serialize(serializer),
24921                }
24922            }
24923        }
24924
24925        impl<'de> serde::de::Deserialize<'de> for Code {
24926            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24927            where
24928                D: serde::Deserializer<'de>,
24929            {
24930                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Code>::new(
24931                    ".google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.Code",
24932                ))
24933            }
24934        }
24935    }
24936
24937    /// The other routing cases.
24938    ///
24939    /// # Working with unknown values
24940    ///
24941    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
24942    /// additional enum variants at any time. Adding new variants is not considered
24943    /// a breaking change. Applications should write their code in anticipation of:
24944    ///
24945    /// - New values appearing in future releases of the client library, **and**
24946    /// - New values received dynamically, without application changes.
24947    ///
24948    /// Please consult the [Working with enums] section in the user guide for some
24949    /// guidelines.
24950    ///
24951    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
24952    #[derive(Clone, Debug, PartialEq)]
24953    #[non_exhaustive]
24954    pub enum OtherRoutes {
24955        /// Default value.
24956        Unspecified,
24957        /// Use the routes from the default routing tables (system-generated routes,
24958        /// custom routes, peering route) to determine the next hop. This effectively
24959        /// excludes matching packets being applied on other PBRs with a lower
24960        /// priority.
24961        DefaultRouting,
24962        /// If set, the enum was initialized with an unknown value.
24963        ///
24964        /// Applications can examine the value using [OtherRoutes::value] or
24965        /// [OtherRoutes::name].
24966        UnknownValue(other_routes::UnknownValue),
24967    }
24968
24969    #[doc(hidden)]
24970    pub mod other_routes {
24971        #[allow(unused_imports)]
24972        use super::*;
24973        #[derive(Clone, Debug, PartialEq)]
24974        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
24975    }
24976
24977    impl OtherRoutes {
24978        /// Gets the enum value.
24979        ///
24980        /// Returns `None` if the enum contains an unknown value deserialized from
24981        /// the string representation of enums.
24982        pub fn value(&self) -> std::option::Option<i32> {
24983            match self {
24984                Self::Unspecified => std::option::Option::Some(0),
24985                Self::DefaultRouting => std::option::Option::Some(1),
24986                Self::UnknownValue(u) => u.0.value(),
24987            }
24988        }
24989
24990        /// Gets the enum value as a string.
24991        ///
24992        /// Returns `None` if the enum contains an unknown value deserialized from
24993        /// the integer representation of enums.
24994        pub fn name(&self) -> std::option::Option<&str> {
24995            match self {
24996                Self::Unspecified => std::option::Option::Some("OTHER_ROUTES_UNSPECIFIED"),
24997                Self::DefaultRouting => std::option::Option::Some("DEFAULT_ROUTING"),
24998                Self::UnknownValue(u) => u.0.name(),
24999            }
25000        }
25001    }
25002
25003    impl std::default::Default for OtherRoutes {
25004        fn default() -> Self {
25005            use std::convert::From;
25006            Self::from(0)
25007        }
25008    }
25009
25010    impl std::fmt::Display for OtherRoutes {
25011        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25012            wkt::internal::display_enum(f, self.name(), self.value())
25013        }
25014    }
25015
25016    impl std::convert::From<i32> for OtherRoutes {
25017        fn from(value: i32) -> Self {
25018            match value {
25019                0 => Self::Unspecified,
25020                1 => Self::DefaultRouting,
25021                _ => Self::UnknownValue(other_routes::UnknownValue(
25022                    wkt::internal::UnknownEnumValue::Integer(value),
25023                )),
25024            }
25025        }
25026    }
25027
25028    impl std::convert::From<&str> for OtherRoutes {
25029        fn from(value: &str) -> Self {
25030            use std::string::ToString;
25031            match value {
25032                "OTHER_ROUTES_UNSPECIFIED" => Self::Unspecified,
25033                "DEFAULT_ROUTING" => Self::DefaultRouting,
25034                _ => Self::UnknownValue(other_routes::UnknownValue(
25035                    wkt::internal::UnknownEnumValue::String(value.to_string()),
25036                )),
25037            }
25038        }
25039    }
25040
25041    impl serde::ser::Serialize for OtherRoutes {
25042        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25043        where
25044            S: serde::Serializer,
25045        {
25046            match self {
25047                Self::Unspecified => serializer.serialize_i32(0),
25048                Self::DefaultRouting => serializer.serialize_i32(1),
25049                Self::UnknownValue(u) => u.0.serialize(serializer),
25050            }
25051        }
25052    }
25053
25054    impl<'de> serde::de::Deserialize<'de> for OtherRoutes {
25055        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25056        where
25057            D: serde::Deserializer<'de>,
25058        {
25059            deserializer.deserialize_any(wkt::internal::EnumVisitor::<OtherRoutes>::new(
25060                ".google.cloud.networkconnectivity.v1.PolicyBasedRoute.OtherRoutes",
25061            ))
25062        }
25063    }
25064
25065    /// Target specifies network endpoints that this policy-based route applies to.
25066    /// If no target is specified, the PBR will be installed on all network
25067    /// endpoints (e.g. VMs, VPNs, and Interconnects) in the VPC.
25068    #[derive(Clone, Debug, PartialEq)]
25069    #[non_exhaustive]
25070    pub enum Target {
25071        /// Optional. VM instances that this policy-based route applies to.
25072        VirtualMachine(std::boxed::Box<crate::model::policy_based_route::VirtualMachine>),
25073        /// Optional. The interconnect attachments that this policy-based route
25074        /// applies to.
25075        InterconnectAttachment(
25076            std::boxed::Box<crate::model::policy_based_route::InterconnectAttachment>,
25077        ),
25078    }
25079
25080    #[derive(Clone, Debug, PartialEq)]
25081    #[non_exhaustive]
25082    pub enum NextHop {
25083        /// Optional. The IP address of a global-access-enabled L4 ILB that is the
25084        /// next hop for matching packets. For this version, only nextHopIlbIp is
25085        /// supported.
25086        NextHopIlbIp(std::string::String),
25087        /// Optional. Other routes that will be referenced to determine the next hop
25088        /// of the packet.
25089        NextHopOtherRoutes(crate::model::policy_based_route::OtherRoutes),
25090    }
25091}
25092
25093/// Request for
25094/// [PolicyBasedRoutingService.ListPolicyBasedRoutes][google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.ListPolicyBasedRoutes]
25095/// method.
25096///
25097/// [google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.ListPolicyBasedRoutes]: crate::client::PolicyBasedRoutingService::list_policy_based_routes
25098#[derive(Clone, Debug, Default, PartialEq)]
25099#[non_exhaustive]
25100pub struct ListPolicyBasedRoutesRequest {
25101    /// Required. The parent resource's name.
25102    pub parent: std::string::String,
25103
25104    /// The maximum number of results per page that should be returned.
25105    pub page_size: i32,
25106
25107    /// The page token.
25108    pub page_token: std::string::String,
25109
25110    /// A filter expression that filters the results listed in the response.
25111    pub filter: std::string::String,
25112
25113    /// Sort the results by a certain order.
25114    pub order_by: std::string::String,
25115
25116    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25117}
25118
25119impl ListPolicyBasedRoutesRequest {
25120    pub fn new() -> Self {
25121        std::default::Default::default()
25122    }
25123
25124    /// Sets the value of [parent][crate::model::ListPolicyBasedRoutesRequest::parent].
25125    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25126        self.parent = v.into();
25127        self
25128    }
25129
25130    /// Sets the value of [page_size][crate::model::ListPolicyBasedRoutesRequest::page_size].
25131    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25132        self.page_size = v.into();
25133        self
25134    }
25135
25136    /// Sets the value of [page_token][crate::model::ListPolicyBasedRoutesRequest::page_token].
25137    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25138        self.page_token = v.into();
25139        self
25140    }
25141
25142    /// Sets the value of [filter][crate::model::ListPolicyBasedRoutesRequest::filter].
25143    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25144        self.filter = v.into();
25145        self
25146    }
25147
25148    /// Sets the value of [order_by][crate::model::ListPolicyBasedRoutesRequest::order_by].
25149    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25150        self.order_by = v.into();
25151        self
25152    }
25153}
25154
25155impl wkt::message::Message for ListPolicyBasedRoutesRequest {
25156    fn typename() -> &'static str {
25157        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest"
25158    }
25159}
25160
25161#[doc(hidden)]
25162impl<'de> serde::de::Deserialize<'de> for ListPolicyBasedRoutesRequest {
25163    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25164    where
25165        D: serde::Deserializer<'de>,
25166    {
25167        #[allow(non_camel_case_types)]
25168        #[doc(hidden)]
25169        #[derive(PartialEq, Eq, Hash)]
25170        enum __FieldTag {
25171            __parent,
25172            __page_size,
25173            __page_token,
25174            __filter,
25175            __order_by,
25176            Unknown(std::string::String),
25177        }
25178        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
25179            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25180            where
25181                D: serde::Deserializer<'de>,
25182            {
25183                struct Visitor;
25184                impl<'de> serde::de::Visitor<'de> for Visitor {
25185                    type Value = __FieldTag;
25186                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25187                        formatter.write_str("a field name for ListPolicyBasedRoutesRequest")
25188                    }
25189                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
25190                    where
25191                        E: serde::de::Error,
25192                    {
25193                        use std::result::Result::Ok;
25194                        use std::string::ToString;
25195                        match value {
25196                            "parent" => Ok(__FieldTag::__parent),
25197                            "pageSize" => Ok(__FieldTag::__page_size),
25198                            "page_size" => Ok(__FieldTag::__page_size),
25199                            "pageToken" => Ok(__FieldTag::__page_token),
25200                            "page_token" => Ok(__FieldTag::__page_token),
25201                            "filter" => Ok(__FieldTag::__filter),
25202                            "orderBy" => Ok(__FieldTag::__order_by),
25203                            "order_by" => Ok(__FieldTag::__order_by),
25204                            _ => Ok(__FieldTag::Unknown(value.to_string())),
25205                        }
25206                    }
25207                }
25208                deserializer.deserialize_identifier(Visitor)
25209            }
25210        }
25211        struct Visitor;
25212        impl<'de> serde::de::Visitor<'de> for Visitor {
25213            type Value = ListPolicyBasedRoutesRequest;
25214            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25215                formatter.write_str("struct ListPolicyBasedRoutesRequest")
25216            }
25217            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
25218            where
25219                A: serde::de::MapAccess<'de>,
25220            {
25221                #[allow(unused_imports)]
25222                use serde::de::Error;
25223                use std::option::Option::Some;
25224                let mut fields = std::collections::HashSet::new();
25225                let mut result = Self::Value::new();
25226                while let Some(tag) = map.next_key::<__FieldTag>()? {
25227                    #[allow(clippy::match_single_binding)]
25228                    match tag {
25229                        __FieldTag::__parent => {
25230                            if !fields.insert(__FieldTag::__parent) {
25231                                return std::result::Result::Err(A::Error::duplicate_field(
25232                                    "multiple values for parent",
25233                                ));
25234                            }
25235                            result.parent = map
25236                                .next_value::<std::option::Option<std::string::String>>()?
25237                                .unwrap_or_default();
25238                        }
25239                        __FieldTag::__page_size => {
25240                            if !fields.insert(__FieldTag::__page_size) {
25241                                return std::result::Result::Err(A::Error::duplicate_field(
25242                                    "multiple values for page_size",
25243                                ));
25244                            }
25245                            struct __With(std::option::Option<i32>);
25246                            impl<'de> serde::de::Deserialize<'de> for __With {
25247                                fn deserialize<D>(
25248                                    deserializer: D,
25249                                ) -> std::result::Result<Self, D::Error>
25250                                where
25251                                    D: serde::de::Deserializer<'de>,
25252                                {
25253                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
25254                                }
25255                            }
25256                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
25257                        }
25258                        __FieldTag::__page_token => {
25259                            if !fields.insert(__FieldTag::__page_token) {
25260                                return std::result::Result::Err(A::Error::duplicate_field(
25261                                    "multiple values for page_token",
25262                                ));
25263                            }
25264                            result.page_token = map
25265                                .next_value::<std::option::Option<std::string::String>>()?
25266                                .unwrap_or_default();
25267                        }
25268                        __FieldTag::__filter => {
25269                            if !fields.insert(__FieldTag::__filter) {
25270                                return std::result::Result::Err(A::Error::duplicate_field(
25271                                    "multiple values for filter",
25272                                ));
25273                            }
25274                            result.filter = map
25275                                .next_value::<std::option::Option<std::string::String>>()?
25276                                .unwrap_or_default();
25277                        }
25278                        __FieldTag::__order_by => {
25279                            if !fields.insert(__FieldTag::__order_by) {
25280                                return std::result::Result::Err(A::Error::duplicate_field(
25281                                    "multiple values for order_by",
25282                                ));
25283                            }
25284                            result.order_by = map
25285                                .next_value::<std::option::Option<std::string::String>>()?
25286                                .unwrap_or_default();
25287                        }
25288                        __FieldTag::Unknown(key) => {
25289                            let value = map.next_value::<serde_json::Value>()?;
25290                            result._unknown_fields.insert(key, value);
25291                        }
25292                    }
25293                }
25294                std::result::Result::Ok(result)
25295            }
25296        }
25297        deserializer.deserialize_any(Visitor)
25298    }
25299}
25300
25301#[doc(hidden)]
25302impl serde::ser::Serialize for ListPolicyBasedRoutesRequest {
25303    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25304    where
25305        S: serde::ser::Serializer,
25306    {
25307        use serde::ser::SerializeMap;
25308        #[allow(unused_imports)]
25309        use std::option::Option::Some;
25310        let mut state = serializer.serialize_map(std::option::Option::None)?;
25311        if !self.parent.is_empty() {
25312            state.serialize_entry("parent", &self.parent)?;
25313        }
25314        if !wkt::internal::is_default(&self.page_size) {
25315            struct __With<'a>(&'a i32);
25316            impl<'a> serde::ser::Serialize for __With<'a> {
25317                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25318                where
25319                    S: serde::ser::Serializer,
25320                {
25321                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
25322                }
25323            }
25324            state.serialize_entry("pageSize", &__With(&self.page_size))?;
25325        }
25326        if !self.page_token.is_empty() {
25327            state.serialize_entry("pageToken", &self.page_token)?;
25328        }
25329        if !self.filter.is_empty() {
25330            state.serialize_entry("filter", &self.filter)?;
25331        }
25332        if !self.order_by.is_empty() {
25333            state.serialize_entry("orderBy", &self.order_by)?;
25334        }
25335        if !self._unknown_fields.is_empty() {
25336            for (key, value) in self._unknown_fields.iter() {
25337                state.serialize_entry(key, &value)?;
25338            }
25339        }
25340        state.end()
25341    }
25342}
25343
25344/// Response for
25345/// [PolicyBasedRoutingService.ListPolicyBasedRoutes][google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.ListPolicyBasedRoutes]
25346/// method.
25347///
25348/// [google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.ListPolicyBasedRoutes]: crate::client::PolicyBasedRoutingService::list_policy_based_routes
25349#[derive(Clone, Debug, Default, PartialEq)]
25350#[non_exhaustive]
25351pub struct ListPolicyBasedRoutesResponse {
25352    /// Policy-based routes to be returned.
25353    pub policy_based_routes: std::vec::Vec<crate::model::PolicyBasedRoute>,
25354
25355    /// The next pagination token in the List response. It should be used as
25356    /// page_token for the following request. An empty value means no more result.
25357    pub next_page_token: std::string::String,
25358
25359    /// Locations that could not be reached.
25360    pub unreachable: std::vec::Vec<std::string::String>,
25361
25362    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25363}
25364
25365impl ListPolicyBasedRoutesResponse {
25366    pub fn new() -> Self {
25367        std::default::Default::default()
25368    }
25369
25370    /// Sets the value of [policy_based_routes][crate::model::ListPolicyBasedRoutesResponse::policy_based_routes].
25371    pub fn set_policy_based_routes<T, V>(mut self, v: T) -> Self
25372    where
25373        T: std::iter::IntoIterator<Item = V>,
25374        V: std::convert::Into<crate::model::PolicyBasedRoute>,
25375    {
25376        use std::iter::Iterator;
25377        self.policy_based_routes = v.into_iter().map(|i| i.into()).collect();
25378        self
25379    }
25380
25381    /// Sets the value of [next_page_token][crate::model::ListPolicyBasedRoutesResponse::next_page_token].
25382    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25383        self.next_page_token = v.into();
25384        self
25385    }
25386
25387    /// Sets the value of [unreachable][crate::model::ListPolicyBasedRoutesResponse::unreachable].
25388    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
25389    where
25390        T: std::iter::IntoIterator<Item = V>,
25391        V: std::convert::Into<std::string::String>,
25392    {
25393        use std::iter::Iterator;
25394        self.unreachable = v.into_iter().map(|i| i.into()).collect();
25395        self
25396    }
25397}
25398
25399impl wkt::message::Message for ListPolicyBasedRoutesResponse {
25400    fn typename() -> &'static str {
25401        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse"
25402    }
25403}
25404
25405#[doc(hidden)]
25406impl gax::paginator::internal::PageableResponse for ListPolicyBasedRoutesResponse {
25407    type PageItem = crate::model::PolicyBasedRoute;
25408
25409    fn items(self) -> std::vec::Vec<Self::PageItem> {
25410        self.policy_based_routes
25411    }
25412
25413    fn next_page_token(&self) -> std::string::String {
25414        use std::clone::Clone;
25415        self.next_page_token.clone()
25416    }
25417}
25418
25419#[doc(hidden)]
25420impl<'de> serde::de::Deserialize<'de> for ListPolicyBasedRoutesResponse {
25421    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25422    where
25423        D: serde::Deserializer<'de>,
25424    {
25425        #[allow(non_camel_case_types)]
25426        #[doc(hidden)]
25427        #[derive(PartialEq, Eq, Hash)]
25428        enum __FieldTag {
25429            __policy_based_routes,
25430            __next_page_token,
25431            __unreachable,
25432            Unknown(std::string::String),
25433        }
25434        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
25435            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25436            where
25437                D: serde::Deserializer<'de>,
25438            {
25439                struct Visitor;
25440                impl<'de> serde::de::Visitor<'de> for Visitor {
25441                    type Value = __FieldTag;
25442                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25443                        formatter.write_str("a field name for ListPolicyBasedRoutesResponse")
25444                    }
25445                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
25446                    where
25447                        E: serde::de::Error,
25448                    {
25449                        use std::result::Result::Ok;
25450                        use std::string::ToString;
25451                        match value {
25452                            "policyBasedRoutes" => Ok(__FieldTag::__policy_based_routes),
25453                            "policy_based_routes" => Ok(__FieldTag::__policy_based_routes),
25454                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
25455                            "next_page_token" => Ok(__FieldTag::__next_page_token),
25456                            "unreachable" => Ok(__FieldTag::__unreachable),
25457                            _ => Ok(__FieldTag::Unknown(value.to_string())),
25458                        }
25459                    }
25460                }
25461                deserializer.deserialize_identifier(Visitor)
25462            }
25463        }
25464        struct Visitor;
25465        impl<'de> serde::de::Visitor<'de> for Visitor {
25466            type Value = ListPolicyBasedRoutesResponse;
25467            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25468                formatter.write_str("struct ListPolicyBasedRoutesResponse")
25469            }
25470            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
25471            where
25472                A: serde::de::MapAccess<'de>,
25473            {
25474                #[allow(unused_imports)]
25475                use serde::de::Error;
25476                use std::option::Option::Some;
25477                let mut fields = std::collections::HashSet::new();
25478                let mut result = Self::Value::new();
25479                while let Some(tag) = map.next_key::<__FieldTag>()? {
25480                    #[allow(clippy::match_single_binding)]
25481                    match tag {
25482                        __FieldTag::__policy_based_routes => {
25483                            if !fields.insert(__FieldTag::__policy_based_routes) {
25484                                return std::result::Result::Err(A::Error::duplicate_field(
25485                                    "multiple values for policy_based_routes",
25486                                ));
25487                            }
25488                            result.policy_based_routes =
25489                                map.next_value::<std::option::Option<
25490                                    std::vec::Vec<crate::model::PolicyBasedRoute>,
25491                                >>()?
25492                                .unwrap_or_default();
25493                        }
25494                        __FieldTag::__next_page_token => {
25495                            if !fields.insert(__FieldTag::__next_page_token) {
25496                                return std::result::Result::Err(A::Error::duplicate_field(
25497                                    "multiple values for next_page_token",
25498                                ));
25499                            }
25500                            result.next_page_token = map
25501                                .next_value::<std::option::Option<std::string::String>>()?
25502                                .unwrap_or_default();
25503                        }
25504                        __FieldTag::__unreachable => {
25505                            if !fields.insert(__FieldTag::__unreachable) {
25506                                return std::result::Result::Err(A::Error::duplicate_field(
25507                                    "multiple values for unreachable",
25508                                ));
25509                            }
25510                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
25511                        }
25512                        __FieldTag::Unknown(key) => {
25513                            let value = map.next_value::<serde_json::Value>()?;
25514                            result._unknown_fields.insert(key, value);
25515                        }
25516                    }
25517                }
25518                std::result::Result::Ok(result)
25519            }
25520        }
25521        deserializer.deserialize_any(Visitor)
25522    }
25523}
25524
25525#[doc(hidden)]
25526impl serde::ser::Serialize for ListPolicyBasedRoutesResponse {
25527    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25528    where
25529        S: serde::ser::Serializer,
25530    {
25531        use serde::ser::SerializeMap;
25532        #[allow(unused_imports)]
25533        use std::option::Option::Some;
25534        let mut state = serializer.serialize_map(std::option::Option::None)?;
25535        if !self.policy_based_routes.is_empty() {
25536            state.serialize_entry("policyBasedRoutes", &self.policy_based_routes)?;
25537        }
25538        if !self.next_page_token.is_empty() {
25539            state.serialize_entry("nextPageToken", &self.next_page_token)?;
25540        }
25541        if !self.unreachable.is_empty() {
25542            state.serialize_entry("unreachable", &self.unreachable)?;
25543        }
25544        if !self._unknown_fields.is_empty() {
25545            for (key, value) in self._unknown_fields.iter() {
25546                state.serialize_entry(key, &value)?;
25547            }
25548        }
25549        state.end()
25550    }
25551}
25552
25553/// Request for
25554/// [PolicyBasedRoutingService.GetPolicyBasedRoute][google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.GetPolicyBasedRoute]
25555/// method.
25556///
25557/// [google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.GetPolicyBasedRoute]: crate::client::PolicyBasedRoutingService::get_policy_based_route
25558#[derive(Clone, Debug, Default, PartialEq)]
25559#[non_exhaustive]
25560pub struct GetPolicyBasedRouteRequest {
25561    /// Required. Name of the PolicyBasedRoute resource to get.
25562    pub name: std::string::String,
25563
25564    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25565}
25566
25567impl GetPolicyBasedRouteRequest {
25568    pub fn new() -> Self {
25569        std::default::Default::default()
25570    }
25571
25572    /// Sets the value of [name][crate::model::GetPolicyBasedRouteRequest::name].
25573    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25574        self.name = v.into();
25575        self
25576    }
25577}
25578
25579impl wkt::message::Message for GetPolicyBasedRouteRequest {
25580    fn typename() -> &'static str {
25581        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest"
25582    }
25583}
25584
25585#[doc(hidden)]
25586impl<'de> serde::de::Deserialize<'de> for GetPolicyBasedRouteRequest {
25587    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25588    where
25589        D: serde::Deserializer<'de>,
25590    {
25591        #[allow(non_camel_case_types)]
25592        #[doc(hidden)]
25593        #[derive(PartialEq, Eq, Hash)]
25594        enum __FieldTag {
25595            __name,
25596            Unknown(std::string::String),
25597        }
25598        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
25599            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25600            where
25601                D: serde::Deserializer<'de>,
25602            {
25603                struct Visitor;
25604                impl<'de> serde::de::Visitor<'de> for Visitor {
25605                    type Value = __FieldTag;
25606                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25607                        formatter.write_str("a field name for GetPolicyBasedRouteRequest")
25608                    }
25609                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
25610                    where
25611                        E: serde::de::Error,
25612                    {
25613                        use std::result::Result::Ok;
25614                        use std::string::ToString;
25615                        match value {
25616                            "name" => Ok(__FieldTag::__name),
25617                            _ => Ok(__FieldTag::Unknown(value.to_string())),
25618                        }
25619                    }
25620                }
25621                deserializer.deserialize_identifier(Visitor)
25622            }
25623        }
25624        struct Visitor;
25625        impl<'de> serde::de::Visitor<'de> for Visitor {
25626            type Value = GetPolicyBasedRouteRequest;
25627            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25628                formatter.write_str("struct GetPolicyBasedRouteRequest")
25629            }
25630            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
25631            where
25632                A: serde::de::MapAccess<'de>,
25633            {
25634                #[allow(unused_imports)]
25635                use serde::de::Error;
25636                use std::option::Option::Some;
25637                let mut fields = std::collections::HashSet::new();
25638                let mut result = Self::Value::new();
25639                while let Some(tag) = map.next_key::<__FieldTag>()? {
25640                    #[allow(clippy::match_single_binding)]
25641                    match tag {
25642                        __FieldTag::__name => {
25643                            if !fields.insert(__FieldTag::__name) {
25644                                return std::result::Result::Err(A::Error::duplicate_field(
25645                                    "multiple values for name",
25646                                ));
25647                            }
25648                            result.name = map
25649                                .next_value::<std::option::Option<std::string::String>>()?
25650                                .unwrap_or_default();
25651                        }
25652                        __FieldTag::Unknown(key) => {
25653                            let value = map.next_value::<serde_json::Value>()?;
25654                            result._unknown_fields.insert(key, value);
25655                        }
25656                    }
25657                }
25658                std::result::Result::Ok(result)
25659            }
25660        }
25661        deserializer.deserialize_any(Visitor)
25662    }
25663}
25664
25665#[doc(hidden)]
25666impl serde::ser::Serialize for GetPolicyBasedRouteRequest {
25667    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25668    where
25669        S: serde::ser::Serializer,
25670    {
25671        use serde::ser::SerializeMap;
25672        #[allow(unused_imports)]
25673        use std::option::Option::Some;
25674        let mut state = serializer.serialize_map(std::option::Option::None)?;
25675        if !self.name.is_empty() {
25676            state.serialize_entry("name", &self.name)?;
25677        }
25678        if !self._unknown_fields.is_empty() {
25679            for (key, value) in self._unknown_fields.iter() {
25680                state.serialize_entry(key, &value)?;
25681            }
25682        }
25683        state.end()
25684    }
25685}
25686
25687/// Request for
25688/// [PolicyBasedRoutingService.CreatePolicyBasedRoute][google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.CreatePolicyBasedRoute]
25689/// method.
25690///
25691/// [google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.CreatePolicyBasedRoute]: crate::client::PolicyBasedRoutingService::create_policy_based_route
25692#[derive(Clone, Debug, Default, PartialEq)]
25693#[non_exhaustive]
25694pub struct CreatePolicyBasedRouteRequest {
25695    /// Required. The parent resource's name of the PolicyBasedRoute.
25696    pub parent: std::string::String,
25697
25698    /// Required. Unique id for the policy-based route to create. Provided by the
25699    /// client when the resource is created. The name must comply with
25700    /// <https://google.aip.dev/122#resource-id-segments>. Specifically, the name
25701    /// must be 1-63 characters long and match the regular expression
25702    /// [a-z]([a-z0-9-]*[a-z0-9])?. The first character must be a lowercase letter,
25703    /// and all following characters (except for the last character) must be a
25704    /// dash, lowercase letter, or digit. The last character must be a lowercase
25705    /// letter or digit.
25706    pub policy_based_route_id: std::string::String,
25707
25708    /// Required. Initial values for a new policy-based route.
25709    pub policy_based_route: std::option::Option<crate::model::PolicyBasedRoute>,
25710
25711    /// Optional. An optional request ID to identify requests. Specify a unique
25712    /// request ID so that if you must retry your request, the server knows to
25713    /// ignore the request if it has already been completed. The server guarantees
25714    /// that for at least 60 minutes since the first request.
25715    ///
25716    /// For example, consider a situation where you make an initial request and
25717    /// the request times out. If you make the request again with the same request
25718    /// ID, the server can check if original operation with the same request ID
25719    /// was received, and if so, ignores the second request. This prevents clients
25720    /// from accidentally creating duplicate commitments.
25721    ///
25722    /// The request ID must be a valid UUID with the exception that zero UUID is
25723    /// not supported (00000000-0000-0000-0000-000000000000).
25724    pub request_id: std::string::String,
25725
25726    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25727}
25728
25729impl CreatePolicyBasedRouteRequest {
25730    pub fn new() -> Self {
25731        std::default::Default::default()
25732    }
25733
25734    /// Sets the value of [parent][crate::model::CreatePolicyBasedRouteRequest::parent].
25735    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25736        self.parent = v.into();
25737        self
25738    }
25739
25740    /// Sets the value of [policy_based_route_id][crate::model::CreatePolicyBasedRouteRequest::policy_based_route_id].
25741    pub fn set_policy_based_route_id<T: std::convert::Into<std::string::String>>(
25742        mut self,
25743        v: T,
25744    ) -> Self {
25745        self.policy_based_route_id = v.into();
25746        self
25747    }
25748
25749    /// Sets the value of [policy_based_route][crate::model::CreatePolicyBasedRouteRequest::policy_based_route].
25750    pub fn set_policy_based_route<T>(mut self, v: T) -> Self
25751    where
25752        T: std::convert::Into<crate::model::PolicyBasedRoute>,
25753    {
25754        self.policy_based_route = std::option::Option::Some(v.into());
25755        self
25756    }
25757
25758    /// Sets or clears the value of [policy_based_route][crate::model::CreatePolicyBasedRouteRequest::policy_based_route].
25759    pub fn set_or_clear_policy_based_route<T>(mut self, v: std::option::Option<T>) -> Self
25760    where
25761        T: std::convert::Into<crate::model::PolicyBasedRoute>,
25762    {
25763        self.policy_based_route = v.map(|x| x.into());
25764        self
25765    }
25766
25767    /// Sets the value of [request_id][crate::model::CreatePolicyBasedRouteRequest::request_id].
25768    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25769        self.request_id = v.into();
25770        self
25771    }
25772}
25773
25774impl wkt::message::Message for CreatePolicyBasedRouteRequest {
25775    fn typename() -> &'static str {
25776        "type.googleapis.com/google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest"
25777    }
25778}
25779
25780#[doc(hidden)]
25781impl<'de> serde::de::Deserialize<'de> for CreatePolicyBasedRouteRequest {
25782    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25783    where
25784        D: serde::Deserializer<'de>,
25785    {
25786        #[allow(non_camel_case_types)]
25787        #[doc(hidden)]
25788        #[derive(PartialEq, Eq, Hash)]
25789        enum __FieldTag {
25790            __parent,
25791            __policy_based_route_id,
25792            __policy_based_route,
25793            __request_id,
25794            Unknown(std::string::String),
25795        }
25796        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
25797            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25798            where
25799                D: serde::Deserializer<'de>,
25800            {
25801                struct Visitor;
25802                impl<'de> serde::de::Visitor<'de> for Visitor {
25803                    type Value = __FieldTag;
25804                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25805                        formatter.write_str("a field name for CreatePolicyBasedRouteRequest")
25806                    }
25807                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
25808                    where
25809                        E: serde::de::Error,
25810                    {
25811                        use std::result::Result::Ok;
25812                        use std::string::ToString;
25813                        match value {
25814                            "parent" => Ok(__FieldTag::__parent),
25815                            "policyBasedRouteId" => Ok(__FieldTag::__policy_based_route_id),
25816                            "policy_based_route_id" => Ok(__FieldTag::__policy_based_route_id),
25817                            "policyBasedRoute" => Ok(__FieldTag::__policy_based_route),
25818                            "policy_based_route" => Ok(__FieldTag::__policy_based_route),
25819                            "requestId" => Ok(__FieldTag::__request_id),
25820                            "request_id" => Ok(__FieldTag::__request_id),
25821                            _ => Ok(__FieldTag::Unknown(value.to_string())),
25822                        }
25823                    }
25824                }
25825                deserializer.deserialize_identifier(Visitor)
25826            }
25827        }
25828        struct Visitor;
25829        impl<'de> serde::de::Visitor<'de> for Visitor {
25830            type Value = CreatePolicyBasedRouteRequest;
25831            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25832                formatter.write_str("struct CreatePolicyBasedRouteRequest")
25833            }
25834            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
25835            where
25836                A: serde::de::MapAccess<'de>,
25837            {
25838                #[allow(unused_imports)]
25839                use serde::de::Error;
25840                use std::option::Option::Some;
25841                let mut fields = std::collections::HashSet::new();
25842                let mut result = Self::Value::new();
25843                while let Some(tag) = map.next_key::<__FieldTag>()? {
25844                    #[allow(clippy::match_single_binding)]
25845                    match tag {
25846                        __FieldTag::__parent => {
25847                            if !fields.insert(__FieldTag::__parent) {
25848                                return std::result::Result::Err(A::Error::duplicate_field(
25849                                    "multiple values for parent",
25850                                ));
25851                            }
25852                            result.parent = map
25853                                .next_value::<std::option::Option<std::string::String>>()?
25854                                .unwrap_or_default();
25855                        }
25856                        __FieldTag::__policy_based_route_id => {
25857                            if !fields.insert(__FieldTag::__policy_based_route_id) {
25858                                return std::result::Result::Err(A::Error::duplicate_field(
25859                                    "multiple values for policy_based_route_id",
25860                                ));
25861                            }
25862                            result.policy_based_route_id = map
25863                                .next_value::<std::option::Option<std::string::String>>()?
25864                                .unwrap_or_default();
25865                        }
25866                        __FieldTag::__policy_based_route => {
25867                            if !fields.insert(__FieldTag::__policy_based_route) {
25868                                return std::result::Result::Err(A::Error::duplicate_field(
25869                                    "multiple values for policy_based_route",
25870                                ));
25871                            }
25872                            result.policy_based_route = map
25873                                .next_value::<std::option::Option<crate::model::PolicyBasedRoute>>(
25874                                )?;
25875                        }
25876                        __FieldTag::__request_id => {
25877                            if !fields.insert(__FieldTag::__request_id) {
25878                                return std::result::Result::Err(A::Error::duplicate_field(
25879                                    "multiple values for request_id",
25880                                ));
25881                            }
25882                            result.request_id = map
25883                                .next_value::<std::option::Option<std::string::String>>()?
25884                                .unwrap_or_default();
25885                        }
25886                        __FieldTag::Unknown(key) => {
25887                            let value = map.next_value::<serde_json::Value>()?;
25888                            result._unknown_fields.insert(key, value);
25889                        }
25890                    }
25891                }
25892                std::result::Result::Ok(result)
25893            }
25894        }
25895        deserializer.deserialize_any(Visitor)
25896    }
25897}
25898
25899#[doc(hidden)]
25900impl serde::ser::Serialize for CreatePolicyBasedRouteRequest {
25901    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25902    where
25903        S: serde::ser::Serializer,
25904    {
25905        use serde::ser::SerializeMap;
25906        #[allow(unused_imports)]
25907        use std::option::Option::Some;
25908        let mut state = serializer.serialize_map(std::option::Option::None)?;
25909        if !self.parent.is_empty() {
25910            state.serialize_entry("parent", &self.parent)?;
25911        }
25912        if !self.policy_based_route_id.is_empty() {
25913            state.serialize_entry("policyBasedRouteId", &self.policy_based_route_id)?;
25914        }
25915        if self.policy_based_route.is_some() {
25916            state.serialize_entry("policyBasedRoute", &self.policy_based_route)?;
25917        }
25918        if !self.request_id.is_empty() {
25919            state.serialize_entry("requestId", &self.request_id)?;
25920        }
25921        if !self._unknown_fields.is_empty() {
25922            for (key, value) in self._unknown_fields.iter() {
25923                state.serialize_entry(key, &value)?;
25924            }
25925        }
25926        state.end()
25927    }
25928}
25929
25930/// Request for
25931/// [PolicyBasedRoutingService.DeletePolicyBasedRoute][google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.DeletePolicyBasedRoute]
25932/// method.
25933///
25934/// [google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.DeletePolicyBasedRoute]: crate::client::PolicyBasedRoutingService::delete_policy_based_route
25935#[derive(Clone, Debug, Default, PartialEq)]
25936#[non_exhaustive]
25937pub struct DeletePolicyBasedRouteRequest {
25938    /// Required. Name of the policy-based route resource to delete.
25939    pub name: std::string::String,
25940
25941    /// Optional. An optional request ID to identify requests. Specify a unique
25942    /// request ID so that if you must retry your request, the server knows to
25943    /// ignore the request if it has already been completed. The server guarantees
25944    /// that for at least 60 minutes after the first request.
25945    ///
25946    /// For example, consider a situation where you make an initial request and
25947    /// the request times out. If you make the request again with the same request
25948    /// ID, the server can check if original operation with the same request ID
25949    /// was received, and if so, ignores the second request. This prevents clients
25950    /// from accidentally creating duplicate commitments.
25951    ///
25952    /// The request ID must be a valid UUID with the exception that zero UUID is
25953    /// not supported (00000000-0000-0000-0000-000000000000).
25954    pub request_id: std::string::String,
25955
25956    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25957}
25958
25959impl DeletePolicyBasedRouteRequest {
25960    pub fn new() -> Self {
25961        std::default::Default::default()
25962    }
25963
25964    /// Sets the value of [name][crate::model::DeletePolicyBasedRouteRequest::name].
25965    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25966        self.name = v.into();
25967        self
25968    }
25969
25970    /// Sets the value of [request_id][crate::model::DeletePolicyBasedRouteRequest::request_id].
25971    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25972        self.request_id = v.into();
25973        self
25974    }
25975}
25976
25977impl wkt::message::Message for DeletePolicyBasedRouteRequest {
25978    fn typename() -> &'static str {
25979        "type.googleapis.com/google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest"
25980    }
25981}
25982
25983#[doc(hidden)]
25984impl<'de> serde::de::Deserialize<'de> for DeletePolicyBasedRouteRequest {
25985    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25986    where
25987        D: serde::Deserializer<'de>,
25988    {
25989        #[allow(non_camel_case_types)]
25990        #[doc(hidden)]
25991        #[derive(PartialEq, Eq, Hash)]
25992        enum __FieldTag {
25993            __name,
25994            __request_id,
25995            Unknown(std::string::String),
25996        }
25997        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
25998            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25999            where
26000                D: serde::Deserializer<'de>,
26001            {
26002                struct Visitor;
26003                impl<'de> serde::de::Visitor<'de> for Visitor {
26004                    type Value = __FieldTag;
26005                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26006                        formatter.write_str("a field name for DeletePolicyBasedRouteRequest")
26007                    }
26008                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
26009                    where
26010                        E: serde::de::Error,
26011                    {
26012                        use std::result::Result::Ok;
26013                        use std::string::ToString;
26014                        match value {
26015                            "name" => Ok(__FieldTag::__name),
26016                            "requestId" => Ok(__FieldTag::__request_id),
26017                            "request_id" => Ok(__FieldTag::__request_id),
26018                            _ => Ok(__FieldTag::Unknown(value.to_string())),
26019                        }
26020                    }
26021                }
26022                deserializer.deserialize_identifier(Visitor)
26023            }
26024        }
26025        struct Visitor;
26026        impl<'de> serde::de::Visitor<'de> for Visitor {
26027            type Value = DeletePolicyBasedRouteRequest;
26028            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26029                formatter.write_str("struct DeletePolicyBasedRouteRequest")
26030            }
26031            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
26032            where
26033                A: serde::de::MapAccess<'de>,
26034            {
26035                #[allow(unused_imports)]
26036                use serde::de::Error;
26037                use std::option::Option::Some;
26038                let mut fields = std::collections::HashSet::new();
26039                let mut result = Self::Value::new();
26040                while let Some(tag) = map.next_key::<__FieldTag>()? {
26041                    #[allow(clippy::match_single_binding)]
26042                    match tag {
26043                        __FieldTag::__name => {
26044                            if !fields.insert(__FieldTag::__name) {
26045                                return std::result::Result::Err(A::Error::duplicate_field(
26046                                    "multiple values for name",
26047                                ));
26048                            }
26049                            result.name = map
26050                                .next_value::<std::option::Option<std::string::String>>()?
26051                                .unwrap_or_default();
26052                        }
26053                        __FieldTag::__request_id => {
26054                            if !fields.insert(__FieldTag::__request_id) {
26055                                return std::result::Result::Err(A::Error::duplicate_field(
26056                                    "multiple values for request_id",
26057                                ));
26058                            }
26059                            result.request_id = map
26060                                .next_value::<std::option::Option<std::string::String>>()?
26061                                .unwrap_or_default();
26062                        }
26063                        __FieldTag::Unknown(key) => {
26064                            let value = map.next_value::<serde_json::Value>()?;
26065                            result._unknown_fields.insert(key, value);
26066                        }
26067                    }
26068                }
26069                std::result::Result::Ok(result)
26070            }
26071        }
26072        deserializer.deserialize_any(Visitor)
26073    }
26074}
26075
26076#[doc(hidden)]
26077impl serde::ser::Serialize for DeletePolicyBasedRouteRequest {
26078    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26079    where
26080        S: serde::ser::Serializer,
26081    {
26082        use serde::ser::SerializeMap;
26083        #[allow(unused_imports)]
26084        use std::option::Option::Some;
26085        let mut state = serializer.serialize_map(std::option::Option::None)?;
26086        if !self.name.is_empty() {
26087            state.serialize_entry("name", &self.name)?;
26088        }
26089        if !self.request_id.is_empty() {
26090            state.serialize_entry("requestId", &self.request_id)?;
26091        }
26092        if !self._unknown_fields.is_empty() {
26093            for (key, value) in self._unknown_fields.iter() {
26094                state.serialize_entry(key, &value)?;
26095            }
26096        }
26097        state.end()
26098    }
26099}
26100
26101/// The infrastructure used for connections between consumers/producers.
26102///
26103/// # Working with unknown values
26104///
26105/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
26106/// additional enum variants at any time. Adding new variants is not considered
26107/// a breaking change. Applications should write their code in anticipation of:
26108///
26109/// - New values appearing in future releases of the client library, **and**
26110/// - New values received dynamically, without application changes.
26111///
26112/// Please consult the [Working with enums] section in the user guide for some
26113/// guidelines.
26114///
26115/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
26116#[derive(Clone, Debug, PartialEq)]
26117#[non_exhaustive]
26118pub enum Infrastructure {
26119    /// An invalid infrastructure as the default case.
26120    Unspecified,
26121    /// Private Service Connect is used for connections.
26122    Psc,
26123    /// If set, the enum was initialized with an unknown value.
26124    ///
26125    /// Applications can examine the value using [Infrastructure::value] or
26126    /// [Infrastructure::name].
26127    UnknownValue(infrastructure::UnknownValue),
26128}
26129
26130#[doc(hidden)]
26131pub mod infrastructure {
26132    #[allow(unused_imports)]
26133    use super::*;
26134    #[derive(Clone, Debug, PartialEq)]
26135    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
26136}
26137
26138impl Infrastructure {
26139    /// Gets the enum value.
26140    ///
26141    /// Returns `None` if the enum contains an unknown value deserialized from
26142    /// the string representation of enums.
26143    pub fn value(&self) -> std::option::Option<i32> {
26144        match self {
26145            Self::Unspecified => std::option::Option::Some(0),
26146            Self::Psc => std::option::Option::Some(1),
26147            Self::UnknownValue(u) => u.0.value(),
26148        }
26149    }
26150
26151    /// Gets the enum value as a string.
26152    ///
26153    /// Returns `None` if the enum contains an unknown value deserialized from
26154    /// the integer representation of enums.
26155    pub fn name(&self) -> std::option::Option<&str> {
26156        match self {
26157            Self::Unspecified => std::option::Option::Some("INFRASTRUCTURE_UNSPECIFIED"),
26158            Self::Psc => std::option::Option::Some("PSC"),
26159            Self::UnknownValue(u) => u.0.name(),
26160        }
26161    }
26162}
26163
26164impl std::default::Default for Infrastructure {
26165    fn default() -> Self {
26166        use std::convert::From;
26167        Self::from(0)
26168    }
26169}
26170
26171impl std::fmt::Display for Infrastructure {
26172    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
26173        wkt::internal::display_enum(f, self.name(), self.value())
26174    }
26175}
26176
26177impl std::convert::From<i32> for Infrastructure {
26178    fn from(value: i32) -> Self {
26179        match value {
26180            0 => Self::Unspecified,
26181            1 => Self::Psc,
26182            _ => Self::UnknownValue(infrastructure::UnknownValue(
26183                wkt::internal::UnknownEnumValue::Integer(value),
26184            )),
26185        }
26186    }
26187}
26188
26189impl std::convert::From<&str> for Infrastructure {
26190    fn from(value: &str) -> Self {
26191        use std::string::ToString;
26192        match value {
26193            "INFRASTRUCTURE_UNSPECIFIED" => Self::Unspecified,
26194            "PSC" => Self::Psc,
26195            _ => Self::UnknownValue(infrastructure::UnknownValue(
26196                wkt::internal::UnknownEnumValue::String(value.to_string()),
26197            )),
26198        }
26199    }
26200}
26201
26202impl serde::ser::Serialize for Infrastructure {
26203    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26204    where
26205        S: serde::Serializer,
26206    {
26207        match self {
26208            Self::Unspecified => serializer.serialize_i32(0),
26209            Self::Psc => serializer.serialize_i32(1),
26210            Self::UnknownValue(u) => u.0.serialize(serializer),
26211        }
26212    }
26213}
26214
26215impl<'de> serde::de::Deserialize<'de> for Infrastructure {
26216    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26217    where
26218        D: serde::Deserializer<'de>,
26219    {
26220        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Infrastructure>::new(
26221            ".google.cloud.networkconnectivity.v1.Infrastructure",
26222        ))
26223    }
26224}
26225
26226/// The error type indicates whether a connection error is consumer facing,
26227/// producer facing or system internal.
26228///
26229/// # Working with unknown values
26230///
26231/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
26232/// additional enum variants at any time. Adding new variants is not considered
26233/// a breaking change. Applications should write their code in anticipation of:
26234///
26235/// - New values appearing in future releases of the client library, **and**
26236/// - New values received dynamically, without application changes.
26237///
26238/// Please consult the [Working with enums] section in the user guide for some
26239/// guidelines.
26240///
26241/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
26242#[derive(Clone, Debug, PartialEq)]
26243#[non_exhaustive]
26244pub enum ConnectionErrorType {
26245    /// An invalid error type as the default case.
26246    Unspecified,
26247    /// The error is due to Service Automation system internal.
26248    ErrorInternal,
26249    /// The error is due to the setup on consumer side.
26250    ErrorConsumerSide,
26251    /// The error is due to the setup on producer side.
26252    ErrorProducerSide,
26253    /// If set, the enum was initialized with an unknown value.
26254    ///
26255    /// Applications can examine the value using [ConnectionErrorType::value] or
26256    /// [ConnectionErrorType::name].
26257    UnknownValue(connection_error_type::UnknownValue),
26258}
26259
26260#[doc(hidden)]
26261pub mod connection_error_type {
26262    #[allow(unused_imports)]
26263    use super::*;
26264    #[derive(Clone, Debug, PartialEq)]
26265    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
26266}
26267
26268impl ConnectionErrorType {
26269    /// Gets the enum value.
26270    ///
26271    /// Returns `None` if the enum contains an unknown value deserialized from
26272    /// the string representation of enums.
26273    pub fn value(&self) -> std::option::Option<i32> {
26274        match self {
26275            Self::Unspecified => std::option::Option::Some(0),
26276            Self::ErrorInternal => std::option::Option::Some(1),
26277            Self::ErrorConsumerSide => std::option::Option::Some(2),
26278            Self::ErrorProducerSide => std::option::Option::Some(3),
26279            Self::UnknownValue(u) => u.0.value(),
26280        }
26281    }
26282
26283    /// Gets the enum value as a string.
26284    ///
26285    /// Returns `None` if the enum contains an unknown value deserialized from
26286    /// the integer representation of enums.
26287    pub fn name(&self) -> std::option::Option<&str> {
26288        match self {
26289            Self::Unspecified => std::option::Option::Some("CONNECTION_ERROR_TYPE_UNSPECIFIED"),
26290            Self::ErrorInternal => std::option::Option::Some("ERROR_INTERNAL"),
26291            Self::ErrorConsumerSide => std::option::Option::Some("ERROR_CONSUMER_SIDE"),
26292            Self::ErrorProducerSide => std::option::Option::Some("ERROR_PRODUCER_SIDE"),
26293            Self::UnknownValue(u) => u.0.name(),
26294        }
26295    }
26296}
26297
26298impl std::default::Default for ConnectionErrorType {
26299    fn default() -> Self {
26300        use std::convert::From;
26301        Self::from(0)
26302    }
26303}
26304
26305impl std::fmt::Display for ConnectionErrorType {
26306    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
26307        wkt::internal::display_enum(f, self.name(), self.value())
26308    }
26309}
26310
26311impl std::convert::From<i32> for ConnectionErrorType {
26312    fn from(value: i32) -> Self {
26313        match value {
26314            0 => Self::Unspecified,
26315            1 => Self::ErrorInternal,
26316            2 => Self::ErrorConsumerSide,
26317            3 => Self::ErrorProducerSide,
26318            _ => Self::UnknownValue(connection_error_type::UnknownValue(
26319                wkt::internal::UnknownEnumValue::Integer(value),
26320            )),
26321        }
26322    }
26323}
26324
26325impl std::convert::From<&str> for ConnectionErrorType {
26326    fn from(value: &str) -> Self {
26327        use std::string::ToString;
26328        match value {
26329            "CONNECTION_ERROR_TYPE_UNSPECIFIED" => Self::Unspecified,
26330            "ERROR_INTERNAL" => Self::ErrorInternal,
26331            "ERROR_CONSUMER_SIDE" => Self::ErrorConsumerSide,
26332            "ERROR_PRODUCER_SIDE" => Self::ErrorProducerSide,
26333            _ => Self::UnknownValue(connection_error_type::UnknownValue(
26334                wkt::internal::UnknownEnumValue::String(value.to_string()),
26335            )),
26336        }
26337    }
26338}
26339
26340impl serde::ser::Serialize for ConnectionErrorType {
26341    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26342    where
26343        S: serde::Serializer,
26344    {
26345        match self {
26346            Self::Unspecified => serializer.serialize_i32(0),
26347            Self::ErrorInternal => serializer.serialize_i32(1),
26348            Self::ErrorConsumerSide => serializer.serialize_i32(2),
26349            Self::ErrorProducerSide => serializer.serialize_i32(3),
26350            Self::UnknownValue(u) => u.0.serialize(serializer),
26351        }
26352    }
26353}
26354
26355impl<'de> serde::de::Deserialize<'de> for ConnectionErrorType {
26356    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26357    where
26358        D: serde::Deserializer<'de>,
26359    {
26360        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConnectionErrorType>::new(
26361            ".google.cloud.networkconnectivity.v1.ConnectionErrorType",
26362        ))
26363    }
26364}
26365
26366/// The requested IP version for the PSC connection.
26367///
26368/// # Working with unknown values
26369///
26370/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
26371/// additional enum variants at any time. Adding new variants is not considered
26372/// a breaking change. Applications should write their code in anticipation of:
26373///
26374/// - New values appearing in future releases of the client library, **and**
26375/// - New values received dynamically, without application changes.
26376///
26377/// Please consult the [Working with enums] section in the user guide for some
26378/// guidelines.
26379///
26380/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
26381#[derive(Clone, Debug, PartialEq)]
26382#[non_exhaustive]
26383pub enum IPVersion {
26384    /// Default value. We will use IPv4 or IPv6 depending on the IP version of
26385    /// first available subnetwork.
26386    Unspecified,
26387    /// Will use IPv4 only.
26388    Ipv4,
26389    /// Will use IPv6 only.
26390    Ipv6,
26391    /// If set, the enum was initialized with an unknown value.
26392    ///
26393    /// Applications can examine the value using [IPVersion::value] or
26394    /// [IPVersion::name].
26395    UnknownValue(ip_version::UnknownValue),
26396}
26397
26398#[doc(hidden)]
26399pub mod ip_version {
26400    #[allow(unused_imports)]
26401    use super::*;
26402    #[derive(Clone, Debug, PartialEq)]
26403    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
26404}
26405
26406impl IPVersion {
26407    /// Gets the enum value.
26408    ///
26409    /// Returns `None` if the enum contains an unknown value deserialized from
26410    /// the string representation of enums.
26411    pub fn value(&self) -> std::option::Option<i32> {
26412        match self {
26413            Self::Unspecified => std::option::Option::Some(0),
26414            Self::Ipv4 => std::option::Option::Some(1),
26415            Self::Ipv6 => std::option::Option::Some(2),
26416            Self::UnknownValue(u) => u.0.value(),
26417        }
26418    }
26419
26420    /// Gets the enum value as a string.
26421    ///
26422    /// Returns `None` if the enum contains an unknown value deserialized from
26423    /// the integer representation of enums.
26424    pub fn name(&self) -> std::option::Option<&str> {
26425        match self {
26426            Self::Unspecified => std::option::Option::Some("IP_VERSION_UNSPECIFIED"),
26427            Self::Ipv4 => std::option::Option::Some("IPV4"),
26428            Self::Ipv6 => std::option::Option::Some("IPV6"),
26429            Self::UnknownValue(u) => u.0.name(),
26430        }
26431    }
26432}
26433
26434impl std::default::Default for IPVersion {
26435    fn default() -> Self {
26436        use std::convert::From;
26437        Self::from(0)
26438    }
26439}
26440
26441impl std::fmt::Display for IPVersion {
26442    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
26443        wkt::internal::display_enum(f, self.name(), self.value())
26444    }
26445}
26446
26447impl std::convert::From<i32> for IPVersion {
26448    fn from(value: i32) -> Self {
26449        match value {
26450            0 => Self::Unspecified,
26451            1 => Self::Ipv4,
26452            2 => Self::Ipv6,
26453            _ => Self::UnknownValue(ip_version::UnknownValue(
26454                wkt::internal::UnknownEnumValue::Integer(value),
26455            )),
26456        }
26457    }
26458}
26459
26460impl std::convert::From<&str> for IPVersion {
26461    fn from(value: &str) -> Self {
26462        use std::string::ToString;
26463        match value {
26464            "IP_VERSION_UNSPECIFIED" => Self::Unspecified,
26465            "IPV4" => Self::Ipv4,
26466            "IPV6" => Self::Ipv6,
26467            _ => Self::UnknownValue(ip_version::UnknownValue(
26468                wkt::internal::UnknownEnumValue::String(value.to_string()),
26469            )),
26470        }
26471    }
26472}
26473
26474impl serde::ser::Serialize for IPVersion {
26475    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26476    where
26477        S: serde::Serializer,
26478    {
26479        match self {
26480            Self::Unspecified => serializer.serialize_i32(0),
26481            Self::Ipv4 => serializer.serialize_i32(1),
26482            Self::Ipv6 => serializer.serialize_i32(2),
26483            Self::UnknownValue(u) => u.0.serialize(serializer),
26484        }
26485    }
26486}
26487
26488impl<'de> serde::de::Deserialize<'de> for IPVersion {
26489    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26490    where
26491        D: serde::Deserializer<'de>,
26492    {
26493        deserializer.deserialize_any(wkt::internal::EnumVisitor::<IPVersion>::new(
26494            ".google.cloud.networkconnectivity.v1.IPVersion",
26495        ))
26496    }
26497}
26498
26499/// Supported features for a location
26500///
26501/// # Working with unknown values
26502///
26503/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
26504/// additional enum variants at any time. Adding new variants is not considered
26505/// a breaking change. Applications should write their code in anticipation of:
26506///
26507/// - New values appearing in future releases of the client library, **and**
26508/// - New values received dynamically, without application changes.
26509///
26510/// Please consult the [Working with enums] section in the user guide for some
26511/// guidelines.
26512///
26513/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
26514#[derive(Clone, Debug, PartialEq)]
26515#[non_exhaustive]
26516pub enum LocationFeature {
26517    /// No publicly supported feature in this location
26518    Unspecified,
26519    /// Site-to-cloud spokes are supported in this location
26520    SiteToCloudSpokes,
26521    /// Site-to-site spokes are supported in this location
26522    SiteToSiteSpokes,
26523    /// If set, the enum was initialized with an unknown value.
26524    ///
26525    /// Applications can examine the value using [LocationFeature::value] or
26526    /// [LocationFeature::name].
26527    UnknownValue(location_feature::UnknownValue),
26528}
26529
26530#[doc(hidden)]
26531pub mod location_feature {
26532    #[allow(unused_imports)]
26533    use super::*;
26534    #[derive(Clone, Debug, PartialEq)]
26535    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
26536}
26537
26538impl LocationFeature {
26539    /// Gets the enum value.
26540    ///
26541    /// Returns `None` if the enum contains an unknown value deserialized from
26542    /// the string representation of enums.
26543    pub fn value(&self) -> std::option::Option<i32> {
26544        match self {
26545            Self::Unspecified => std::option::Option::Some(0),
26546            Self::SiteToCloudSpokes => std::option::Option::Some(1),
26547            Self::SiteToSiteSpokes => std::option::Option::Some(2),
26548            Self::UnknownValue(u) => u.0.value(),
26549        }
26550    }
26551
26552    /// Gets the enum value as a string.
26553    ///
26554    /// Returns `None` if the enum contains an unknown value deserialized from
26555    /// the integer representation of enums.
26556    pub fn name(&self) -> std::option::Option<&str> {
26557        match self {
26558            Self::Unspecified => std::option::Option::Some("LOCATION_FEATURE_UNSPECIFIED"),
26559            Self::SiteToCloudSpokes => std::option::Option::Some("SITE_TO_CLOUD_SPOKES"),
26560            Self::SiteToSiteSpokes => std::option::Option::Some("SITE_TO_SITE_SPOKES"),
26561            Self::UnknownValue(u) => u.0.name(),
26562        }
26563    }
26564}
26565
26566impl std::default::Default for LocationFeature {
26567    fn default() -> Self {
26568        use std::convert::From;
26569        Self::from(0)
26570    }
26571}
26572
26573impl std::fmt::Display for LocationFeature {
26574    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
26575        wkt::internal::display_enum(f, self.name(), self.value())
26576    }
26577}
26578
26579impl std::convert::From<i32> for LocationFeature {
26580    fn from(value: i32) -> Self {
26581        match value {
26582            0 => Self::Unspecified,
26583            1 => Self::SiteToCloudSpokes,
26584            2 => Self::SiteToSiteSpokes,
26585            _ => Self::UnknownValue(location_feature::UnknownValue(
26586                wkt::internal::UnknownEnumValue::Integer(value),
26587            )),
26588        }
26589    }
26590}
26591
26592impl std::convert::From<&str> for LocationFeature {
26593    fn from(value: &str) -> Self {
26594        use std::string::ToString;
26595        match value {
26596            "LOCATION_FEATURE_UNSPECIFIED" => Self::Unspecified,
26597            "SITE_TO_CLOUD_SPOKES" => Self::SiteToCloudSpokes,
26598            "SITE_TO_SITE_SPOKES" => Self::SiteToSiteSpokes,
26599            _ => Self::UnknownValue(location_feature::UnknownValue(
26600                wkt::internal::UnknownEnumValue::String(value.to_string()),
26601            )),
26602        }
26603    }
26604}
26605
26606impl serde::ser::Serialize for LocationFeature {
26607    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26608    where
26609        S: serde::Serializer,
26610    {
26611        match self {
26612            Self::Unspecified => serializer.serialize_i32(0),
26613            Self::SiteToCloudSpokes => serializer.serialize_i32(1),
26614            Self::SiteToSiteSpokes => serializer.serialize_i32(2),
26615            Self::UnknownValue(u) => u.0.serialize(serializer),
26616        }
26617    }
26618}
26619
26620impl<'de> serde::de::Deserialize<'de> for LocationFeature {
26621    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26622    where
26623        D: serde::Deserializer<'de>,
26624    {
26625        deserializer.deserialize_any(wkt::internal::EnumVisitor::<LocationFeature>::new(
26626            ".google.cloud.networkconnectivity.v1.LocationFeature",
26627        ))
26628    }
26629}
26630
26631/// The route's type
26632///
26633/// # Working with unknown values
26634///
26635/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
26636/// additional enum variants at any time. Adding new variants is not considered
26637/// a breaking change. Applications should write their code in anticipation of:
26638///
26639/// - New values appearing in future releases of the client library, **and**
26640/// - New values received dynamically, without application changes.
26641///
26642/// Please consult the [Working with enums] section in the user guide for some
26643/// guidelines.
26644///
26645/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
26646#[derive(Clone, Debug, PartialEq)]
26647#[non_exhaustive]
26648pub enum RouteType {
26649    /// No route type information specified
26650    Unspecified,
26651    /// The route leads to a destination within the primary address range of the
26652    /// VPC network's subnet.
26653    VpcPrimarySubnet,
26654    /// The route leads to a destination within the secondary address range of the
26655    /// VPC network's subnet.
26656    VpcSecondarySubnet,
26657    /// The route leads to a destination in a dynamic route. Dynamic routes are
26658    /// derived from Border Gateway Protocol (BGP) advertisements received from an
26659    /// NCC hybrid spoke.
26660    DynamicRoute,
26661    /// If set, the enum was initialized with an unknown value.
26662    ///
26663    /// Applications can examine the value using [RouteType::value] or
26664    /// [RouteType::name].
26665    UnknownValue(route_type::UnknownValue),
26666}
26667
26668#[doc(hidden)]
26669pub mod route_type {
26670    #[allow(unused_imports)]
26671    use super::*;
26672    #[derive(Clone, Debug, PartialEq)]
26673    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
26674}
26675
26676impl RouteType {
26677    /// Gets the enum value.
26678    ///
26679    /// Returns `None` if the enum contains an unknown value deserialized from
26680    /// the string representation of enums.
26681    pub fn value(&self) -> std::option::Option<i32> {
26682        match self {
26683            Self::Unspecified => std::option::Option::Some(0),
26684            Self::VpcPrimarySubnet => std::option::Option::Some(1),
26685            Self::VpcSecondarySubnet => std::option::Option::Some(2),
26686            Self::DynamicRoute => std::option::Option::Some(3),
26687            Self::UnknownValue(u) => u.0.value(),
26688        }
26689    }
26690
26691    /// Gets the enum value as a string.
26692    ///
26693    /// Returns `None` if the enum contains an unknown value deserialized from
26694    /// the integer representation of enums.
26695    pub fn name(&self) -> std::option::Option<&str> {
26696        match self {
26697            Self::Unspecified => std::option::Option::Some("ROUTE_TYPE_UNSPECIFIED"),
26698            Self::VpcPrimarySubnet => std::option::Option::Some("VPC_PRIMARY_SUBNET"),
26699            Self::VpcSecondarySubnet => std::option::Option::Some("VPC_SECONDARY_SUBNET"),
26700            Self::DynamicRoute => std::option::Option::Some("DYNAMIC_ROUTE"),
26701            Self::UnknownValue(u) => u.0.name(),
26702        }
26703    }
26704}
26705
26706impl std::default::Default for RouteType {
26707    fn default() -> Self {
26708        use std::convert::From;
26709        Self::from(0)
26710    }
26711}
26712
26713impl std::fmt::Display for RouteType {
26714    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
26715        wkt::internal::display_enum(f, self.name(), self.value())
26716    }
26717}
26718
26719impl std::convert::From<i32> for RouteType {
26720    fn from(value: i32) -> Self {
26721        match value {
26722            0 => Self::Unspecified,
26723            1 => Self::VpcPrimarySubnet,
26724            2 => Self::VpcSecondarySubnet,
26725            3 => Self::DynamicRoute,
26726            _ => Self::UnknownValue(route_type::UnknownValue(
26727                wkt::internal::UnknownEnumValue::Integer(value),
26728            )),
26729        }
26730    }
26731}
26732
26733impl std::convert::From<&str> for RouteType {
26734    fn from(value: &str) -> Self {
26735        use std::string::ToString;
26736        match value {
26737            "ROUTE_TYPE_UNSPECIFIED" => Self::Unspecified,
26738            "VPC_PRIMARY_SUBNET" => Self::VpcPrimarySubnet,
26739            "VPC_SECONDARY_SUBNET" => Self::VpcSecondarySubnet,
26740            "DYNAMIC_ROUTE" => Self::DynamicRoute,
26741            _ => Self::UnknownValue(route_type::UnknownValue(
26742                wkt::internal::UnknownEnumValue::String(value.to_string()),
26743            )),
26744        }
26745    }
26746}
26747
26748impl serde::ser::Serialize for RouteType {
26749    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26750    where
26751        S: serde::Serializer,
26752    {
26753        match self {
26754            Self::Unspecified => serializer.serialize_i32(0),
26755            Self::VpcPrimarySubnet => serializer.serialize_i32(1),
26756            Self::VpcSecondarySubnet => serializer.serialize_i32(2),
26757            Self::DynamicRoute => serializer.serialize_i32(3),
26758            Self::UnknownValue(u) => u.0.serialize(serializer),
26759        }
26760    }
26761}
26762
26763impl<'de> serde::de::Deserialize<'de> for RouteType {
26764    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26765    where
26766        D: serde::Deserializer<'de>,
26767    {
26768        deserializer.deserialize_any(wkt::internal::EnumVisitor::<RouteType>::new(
26769            ".google.cloud.networkconnectivity.v1.RouteType",
26770        ))
26771    }
26772}
26773
26774/// The State enum represents the lifecycle stage of a Network Connectivity
26775/// Center resource.
26776///
26777/// # Working with unknown values
26778///
26779/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
26780/// additional enum variants at any time. Adding new variants is not considered
26781/// a breaking change. Applications should write their code in anticipation of:
26782///
26783/// - New values appearing in future releases of the client library, **and**
26784/// - New values received dynamically, without application changes.
26785///
26786/// Please consult the [Working with enums] section in the user guide for some
26787/// guidelines.
26788///
26789/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
26790#[derive(Clone, Debug, PartialEq)]
26791#[non_exhaustive]
26792pub enum State {
26793    /// No state information available
26794    Unspecified,
26795    /// The resource's create operation is in progress.
26796    Creating,
26797    /// The resource is active
26798    Active,
26799    /// The resource's delete operation is in progress.
26800    Deleting,
26801    /// The resource's accept operation is in progress.
26802    Accepting,
26803    /// The resource's reject operation is in progress.
26804    Rejecting,
26805    /// The resource's update operation is in progress.
26806    Updating,
26807    /// The resource is inactive.
26808    Inactive,
26809    /// The hub associated with this spoke resource has been deleted.
26810    /// This state applies to spoke resources only.
26811    Obsolete,
26812    /// The resource is in an undefined state due to resource creation or deletion
26813    /// failure. You can try to delete the resource later or contact support for
26814    /// help.
26815    Failed,
26816    /// If set, the enum was initialized with an unknown value.
26817    ///
26818    /// Applications can examine the value using [State::value] or
26819    /// [State::name].
26820    UnknownValue(state::UnknownValue),
26821}
26822
26823#[doc(hidden)]
26824pub mod state {
26825    #[allow(unused_imports)]
26826    use super::*;
26827    #[derive(Clone, Debug, PartialEq)]
26828    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
26829}
26830
26831impl State {
26832    /// Gets the enum value.
26833    ///
26834    /// Returns `None` if the enum contains an unknown value deserialized from
26835    /// the string representation of enums.
26836    pub fn value(&self) -> std::option::Option<i32> {
26837        match self {
26838            Self::Unspecified => std::option::Option::Some(0),
26839            Self::Creating => std::option::Option::Some(1),
26840            Self::Active => std::option::Option::Some(2),
26841            Self::Deleting => std::option::Option::Some(3),
26842            Self::Accepting => std::option::Option::Some(8),
26843            Self::Rejecting => std::option::Option::Some(9),
26844            Self::Updating => std::option::Option::Some(6),
26845            Self::Inactive => std::option::Option::Some(7),
26846            Self::Obsolete => std::option::Option::Some(10),
26847            Self::Failed => std::option::Option::Some(11),
26848            Self::UnknownValue(u) => u.0.value(),
26849        }
26850    }
26851
26852    /// Gets the enum value as a string.
26853    ///
26854    /// Returns `None` if the enum contains an unknown value deserialized from
26855    /// the integer representation of enums.
26856    pub fn name(&self) -> std::option::Option<&str> {
26857        match self {
26858            Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
26859            Self::Creating => std::option::Option::Some("CREATING"),
26860            Self::Active => std::option::Option::Some("ACTIVE"),
26861            Self::Deleting => std::option::Option::Some("DELETING"),
26862            Self::Accepting => std::option::Option::Some("ACCEPTING"),
26863            Self::Rejecting => std::option::Option::Some("REJECTING"),
26864            Self::Updating => std::option::Option::Some("UPDATING"),
26865            Self::Inactive => std::option::Option::Some("INACTIVE"),
26866            Self::Obsolete => std::option::Option::Some("OBSOLETE"),
26867            Self::Failed => std::option::Option::Some("FAILED"),
26868            Self::UnknownValue(u) => u.0.name(),
26869        }
26870    }
26871}
26872
26873impl std::default::Default for State {
26874    fn default() -> Self {
26875        use std::convert::From;
26876        Self::from(0)
26877    }
26878}
26879
26880impl std::fmt::Display for State {
26881    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
26882        wkt::internal::display_enum(f, self.name(), self.value())
26883    }
26884}
26885
26886impl std::convert::From<i32> for State {
26887    fn from(value: i32) -> Self {
26888        match value {
26889            0 => Self::Unspecified,
26890            1 => Self::Creating,
26891            2 => Self::Active,
26892            3 => Self::Deleting,
26893            6 => Self::Updating,
26894            7 => Self::Inactive,
26895            8 => Self::Accepting,
26896            9 => Self::Rejecting,
26897            10 => Self::Obsolete,
26898            11 => Self::Failed,
26899            _ => Self::UnknownValue(state::UnknownValue(
26900                wkt::internal::UnknownEnumValue::Integer(value),
26901            )),
26902        }
26903    }
26904}
26905
26906impl std::convert::From<&str> for State {
26907    fn from(value: &str) -> Self {
26908        use std::string::ToString;
26909        match value {
26910            "STATE_UNSPECIFIED" => Self::Unspecified,
26911            "CREATING" => Self::Creating,
26912            "ACTIVE" => Self::Active,
26913            "DELETING" => Self::Deleting,
26914            "ACCEPTING" => Self::Accepting,
26915            "REJECTING" => Self::Rejecting,
26916            "UPDATING" => Self::Updating,
26917            "INACTIVE" => Self::Inactive,
26918            "OBSOLETE" => Self::Obsolete,
26919            "FAILED" => Self::Failed,
26920            _ => Self::UnknownValue(state::UnknownValue(
26921                wkt::internal::UnknownEnumValue::String(value.to_string()),
26922            )),
26923        }
26924    }
26925}
26926
26927impl serde::ser::Serialize for State {
26928    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26929    where
26930        S: serde::Serializer,
26931    {
26932        match self {
26933            Self::Unspecified => serializer.serialize_i32(0),
26934            Self::Creating => serializer.serialize_i32(1),
26935            Self::Active => serializer.serialize_i32(2),
26936            Self::Deleting => serializer.serialize_i32(3),
26937            Self::Accepting => serializer.serialize_i32(8),
26938            Self::Rejecting => serializer.serialize_i32(9),
26939            Self::Updating => serializer.serialize_i32(6),
26940            Self::Inactive => serializer.serialize_i32(7),
26941            Self::Obsolete => serializer.serialize_i32(10),
26942            Self::Failed => serializer.serialize_i32(11),
26943            Self::UnknownValue(u) => u.0.serialize(serializer),
26944        }
26945    }
26946}
26947
26948impl<'de> serde::de::Deserialize<'de> for State {
26949    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26950    where
26951        D: serde::Deserializer<'de>,
26952    {
26953        deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
26954            ".google.cloud.networkconnectivity.v1.State",
26955        ))
26956    }
26957}
26958
26959/// The SpokeType enum represents the type of spoke. The type
26960/// reflects the kind of resource that a spoke is associated with.
26961///
26962/// # Working with unknown values
26963///
26964/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
26965/// additional enum variants at any time. Adding new variants is not considered
26966/// a breaking change. Applications should write their code in anticipation of:
26967///
26968/// - New values appearing in future releases of the client library, **and**
26969/// - New values received dynamically, without application changes.
26970///
26971/// Please consult the [Working with enums] section in the user guide for some
26972/// guidelines.
26973///
26974/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
26975#[derive(Clone, Debug, PartialEq)]
26976#[non_exhaustive]
26977pub enum SpokeType {
26978    /// Unspecified spoke type.
26979    Unspecified,
26980    /// Spokes associated with VPN tunnels.
26981    VpnTunnel,
26982    /// Spokes associated with VLAN attachments.
26983    InterconnectAttachment,
26984    /// Spokes associated with router appliance instances.
26985    RouterAppliance,
26986    /// Spokes associated with VPC networks.
26987    VpcNetwork,
26988    /// Spokes that are backed by a producer VPC network.
26989    ProducerVpcNetwork,
26990    /// If set, the enum was initialized with an unknown value.
26991    ///
26992    /// Applications can examine the value using [SpokeType::value] or
26993    /// [SpokeType::name].
26994    UnknownValue(spoke_type::UnknownValue),
26995}
26996
26997#[doc(hidden)]
26998pub mod spoke_type {
26999    #[allow(unused_imports)]
27000    use super::*;
27001    #[derive(Clone, Debug, PartialEq)]
27002    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27003}
27004
27005impl SpokeType {
27006    /// Gets the enum value.
27007    ///
27008    /// Returns `None` if the enum contains an unknown value deserialized from
27009    /// the string representation of enums.
27010    pub fn value(&self) -> std::option::Option<i32> {
27011        match self {
27012            Self::Unspecified => std::option::Option::Some(0),
27013            Self::VpnTunnel => std::option::Option::Some(1),
27014            Self::InterconnectAttachment => std::option::Option::Some(2),
27015            Self::RouterAppliance => std::option::Option::Some(3),
27016            Self::VpcNetwork => std::option::Option::Some(4),
27017            Self::ProducerVpcNetwork => std::option::Option::Some(7),
27018            Self::UnknownValue(u) => u.0.value(),
27019        }
27020    }
27021
27022    /// Gets the enum value as a string.
27023    ///
27024    /// Returns `None` if the enum contains an unknown value deserialized from
27025    /// the integer representation of enums.
27026    pub fn name(&self) -> std::option::Option<&str> {
27027        match self {
27028            Self::Unspecified => std::option::Option::Some("SPOKE_TYPE_UNSPECIFIED"),
27029            Self::VpnTunnel => std::option::Option::Some("VPN_TUNNEL"),
27030            Self::InterconnectAttachment => std::option::Option::Some("INTERCONNECT_ATTACHMENT"),
27031            Self::RouterAppliance => std::option::Option::Some("ROUTER_APPLIANCE"),
27032            Self::VpcNetwork => std::option::Option::Some("VPC_NETWORK"),
27033            Self::ProducerVpcNetwork => std::option::Option::Some("PRODUCER_VPC_NETWORK"),
27034            Self::UnknownValue(u) => u.0.name(),
27035        }
27036    }
27037}
27038
27039impl std::default::Default for SpokeType {
27040    fn default() -> Self {
27041        use std::convert::From;
27042        Self::from(0)
27043    }
27044}
27045
27046impl std::fmt::Display for SpokeType {
27047    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27048        wkt::internal::display_enum(f, self.name(), self.value())
27049    }
27050}
27051
27052impl std::convert::From<i32> for SpokeType {
27053    fn from(value: i32) -> Self {
27054        match value {
27055            0 => Self::Unspecified,
27056            1 => Self::VpnTunnel,
27057            2 => Self::InterconnectAttachment,
27058            3 => Self::RouterAppliance,
27059            4 => Self::VpcNetwork,
27060            7 => Self::ProducerVpcNetwork,
27061            _ => Self::UnknownValue(spoke_type::UnknownValue(
27062                wkt::internal::UnknownEnumValue::Integer(value),
27063            )),
27064        }
27065    }
27066}
27067
27068impl std::convert::From<&str> for SpokeType {
27069    fn from(value: &str) -> Self {
27070        use std::string::ToString;
27071        match value {
27072            "SPOKE_TYPE_UNSPECIFIED" => Self::Unspecified,
27073            "VPN_TUNNEL" => Self::VpnTunnel,
27074            "INTERCONNECT_ATTACHMENT" => Self::InterconnectAttachment,
27075            "ROUTER_APPLIANCE" => Self::RouterAppliance,
27076            "VPC_NETWORK" => Self::VpcNetwork,
27077            "PRODUCER_VPC_NETWORK" => Self::ProducerVpcNetwork,
27078            _ => Self::UnknownValue(spoke_type::UnknownValue(
27079                wkt::internal::UnknownEnumValue::String(value.to_string()),
27080            )),
27081        }
27082    }
27083}
27084
27085impl serde::ser::Serialize for SpokeType {
27086    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27087    where
27088        S: serde::Serializer,
27089    {
27090        match self {
27091            Self::Unspecified => serializer.serialize_i32(0),
27092            Self::VpnTunnel => serializer.serialize_i32(1),
27093            Self::InterconnectAttachment => serializer.serialize_i32(2),
27094            Self::RouterAppliance => serializer.serialize_i32(3),
27095            Self::VpcNetwork => serializer.serialize_i32(4),
27096            Self::ProducerVpcNetwork => serializer.serialize_i32(7),
27097            Self::UnknownValue(u) => u.0.serialize(serializer),
27098        }
27099    }
27100}
27101
27102impl<'de> serde::de::Deserialize<'de> for SpokeType {
27103    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27104    where
27105        D: serde::Deserializer<'de>,
27106    {
27107        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SpokeType>::new(
27108            ".google.cloud.networkconnectivity.v1.SpokeType",
27109        ))
27110    }
27111}
27112
27113/// This enum controls the policy mode used in a hub.
27114///
27115/// # Working with unknown values
27116///
27117/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27118/// additional enum variants at any time. Adding new variants is not considered
27119/// a breaking change. Applications should write their code in anticipation of:
27120///
27121/// - New values appearing in future releases of the client library, **and**
27122/// - New values received dynamically, without application changes.
27123///
27124/// Please consult the [Working with enums] section in the user guide for some
27125/// guidelines.
27126///
27127/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
27128#[derive(Clone, Debug, PartialEq)]
27129#[non_exhaustive]
27130pub enum PolicyMode {
27131    /// Policy mode is unspecified. It defaults to PRESET
27132    /// with preset_topology = MESH.
27133    Unspecified,
27134    /// Hub uses one of the preset topologies.
27135    Preset,
27136    /// If set, the enum was initialized with an unknown value.
27137    ///
27138    /// Applications can examine the value using [PolicyMode::value] or
27139    /// [PolicyMode::name].
27140    UnknownValue(policy_mode::UnknownValue),
27141}
27142
27143#[doc(hidden)]
27144pub mod policy_mode {
27145    #[allow(unused_imports)]
27146    use super::*;
27147    #[derive(Clone, Debug, PartialEq)]
27148    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27149}
27150
27151impl PolicyMode {
27152    /// Gets the enum value.
27153    ///
27154    /// Returns `None` if the enum contains an unknown value deserialized from
27155    /// the string representation of enums.
27156    pub fn value(&self) -> std::option::Option<i32> {
27157        match self {
27158            Self::Unspecified => std::option::Option::Some(0),
27159            Self::Preset => std::option::Option::Some(1),
27160            Self::UnknownValue(u) => u.0.value(),
27161        }
27162    }
27163
27164    /// Gets the enum value as a string.
27165    ///
27166    /// Returns `None` if the enum contains an unknown value deserialized from
27167    /// the integer representation of enums.
27168    pub fn name(&self) -> std::option::Option<&str> {
27169        match self {
27170            Self::Unspecified => std::option::Option::Some("POLICY_MODE_UNSPECIFIED"),
27171            Self::Preset => std::option::Option::Some("PRESET"),
27172            Self::UnknownValue(u) => u.0.name(),
27173        }
27174    }
27175}
27176
27177impl std::default::Default for PolicyMode {
27178    fn default() -> Self {
27179        use std::convert::From;
27180        Self::from(0)
27181    }
27182}
27183
27184impl std::fmt::Display for PolicyMode {
27185    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27186        wkt::internal::display_enum(f, self.name(), self.value())
27187    }
27188}
27189
27190impl std::convert::From<i32> for PolicyMode {
27191    fn from(value: i32) -> Self {
27192        match value {
27193            0 => Self::Unspecified,
27194            1 => Self::Preset,
27195            _ => Self::UnknownValue(policy_mode::UnknownValue(
27196                wkt::internal::UnknownEnumValue::Integer(value),
27197            )),
27198        }
27199    }
27200}
27201
27202impl std::convert::From<&str> for PolicyMode {
27203    fn from(value: &str) -> Self {
27204        use std::string::ToString;
27205        match value {
27206            "POLICY_MODE_UNSPECIFIED" => Self::Unspecified,
27207            "PRESET" => Self::Preset,
27208            _ => Self::UnknownValue(policy_mode::UnknownValue(
27209                wkt::internal::UnknownEnumValue::String(value.to_string()),
27210            )),
27211        }
27212    }
27213}
27214
27215impl serde::ser::Serialize for PolicyMode {
27216    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27217    where
27218        S: serde::Serializer,
27219    {
27220        match self {
27221            Self::Unspecified => serializer.serialize_i32(0),
27222            Self::Preset => serializer.serialize_i32(1),
27223            Self::UnknownValue(u) => u.0.serialize(serializer),
27224        }
27225    }
27226}
27227
27228impl<'de> serde::de::Deserialize<'de> for PolicyMode {
27229    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27230    where
27231        D: serde::Deserializer<'de>,
27232    {
27233        deserializer.deserialize_any(wkt::internal::EnumVisitor::<PolicyMode>::new(
27234            ".google.cloud.networkconnectivity.v1.PolicyMode",
27235        ))
27236    }
27237}
27238
27239/// The list of available preset topologies.
27240///
27241/// # Working with unknown values
27242///
27243/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27244/// additional enum variants at any time. Adding new variants is not considered
27245/// a breaking change. Applications should write their code in anticipation of:
27246///
27247/// - New values appearing in future releases of the client library, **and**
27248/// - New values received dynamically, without application changes.
27249///
27250/// Please consult the [Working with enums] section in the user guide for some
27251/// guidelines.
27252///
27253/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
27254#[derive(Clone, Debug, PartialEq)]
27255#[non_exhaustive]
27256pub enum PresetTopology {
27257    /// Preset topology is unspecified. When policy_mode = PRESET,
27258    /// it defaults to MESH.
27259    Unspecified,
27260    /// Mesh topology is implemented. Group `default` is automatically created.
27261    /// All spokes in the hub are added to group `default`.
27262    Mesh,
27263    /// Star topology is implemented. Two groups, `center` and `edge`, are
27264    /// automatically created along with hub creation. Spokes have to join one of
27265    /// the groups during creation.
27266    Star,
27267    /// If set, the enum was initialized with an unknown value.
27268    ///
27269    /// Applications can examine the value using [PresetTopology::value] or
27270    /// [PresetTopology::name].
27271    UnknownValue(preset_topology::UnknownValue),
27272}
27273
27274#[doc(hidden)]
27275pub mod preset_topology {
27276    #[allow(unused_imports)]
27277    use super::*;
27278    #[derive(Clone, Debug, PartialEq)]
27279    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27280}
27281
27282impl PresetTopology {
27283    /// Gets the enum value.
27284    ///
27285    /// Returns `None` if the enum contains an unknown value deserialized from
27286    /// the string representation of enums.
27287    pub fn value(&self) -> std::option::Option<i32> {
27288        match self {
27289            Self::Unspecified => std::option::Option::Some(0),
27290            Self::Mesh => std::option::Option::Some(2),
27291            Self::Star => std::option::Option::Some(3),
27292            Self::UnknownValue(u) => u.0.value(),
27293        }
27294    }
27295
27296    /// Gets the enum value as a string.
27297    ///
27298    /// Returns `None` if the enum contains an unknown value deserialized from
27299    /// the integer representation of enums.
27300    pub fn name(&self) -> std::option::Option<&str> {
27301        match self {
27302            Self::Unspecified => std::option::Option::Some("PRESET_TOPOLOGY_UNSPECIFIED"),
27303            Self::Mesh => std::option::Option::Some("MESH"),
27304            Self::Star => std::option::Option::Some("STAR"),
27305            Self::UnknownValue(u) => u.0.name(),
27306        }
27307    }
27308}
27309
27310impl std::default::Default for PresetTopology {
27311    fn default() -> Self {
27312        use std::convert::From;
27313        Self::from(0)
27314    }
27315}
27316
27317impl std::fmt::Display for PresetTopology {
27318    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27319        wkt::internal::display_enum(f, self.name(), self.value())
27320    }
27321}
27322
27323impl std::convert::From<i32> for PresetTopology {
27324    fn from(value: i32) -> Self {
27325        match value {
27326            0 => Self::Unspecified,
27327            2 => Self::Mesh,
27328            3 => Self::Star,
27329            _ => Self::UnknownValue(preset_topology::UnknownValue(
27330                wkt::internal::UnknownEnumValue::Integer(value),
27331            )),
27332        }
27333    }
27334}
27335
27336impl std::convert::From<&str> for PresetTopology {
27337    fn from(value: &str) -> Self {
27338        use std::string::ToString;
27339        match value {
27340            "PRESET_TOPOLOGY_UNSPECIFIED" => Self::Unspecified,
27341            "MESH" => Self::Mesh,
27342            "STAR" => Self::Star,
27343            _ => Self::UnknownValue(preset_topology::UnknownValue(
27344                wkt::internal::UnknownEnumValue::String(value.to_string()),
27345            )),
27346        }
27347    }
27348}
27349
27350impl serde::ser::Serialize for PresetTopology {
27351    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27352    where
27353        S: serde::Serializer,
27354    {
27355        match self {
27356            Self::Unspecified => serializer.serialize_i32(0),
27357            Self::Mesh => serializer.serialize_i32(2),
27358            Self::Star => serializer.serialize_i32(3),
27359            Self::UnknownValue(u) => u.0.serialize(serializer),
27360        }
27361    }
27362}
27363
27364impl<'de> serde::de::Deserialize<'de> for PresetTopology {
27365    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27366    where
27367        D: serde::Deserializer<'de>,
27368    {
27369        deserializer.deserialize_any(wkt::internal::EnumVisitor::<PresetTopology>::new(
27370            ".google.cloud.networkconnectivity.v1.PresetTopology",
27371        ))
27372    }
27373}