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, 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
347impl std::fmt::Debug for OperationMetadata {
348    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
349        let mut debug_struct = f.debug_struct("OperationMetadata");
350        debug_struct.field("create_time", &self.create_time);
351        debug_struct.field("end_time", &self.end_time);
352        debug_struct.field("target", &self.target);
353        debug_struct.field("verb", &self.verb);
354        debug_struct.field("status_message", &self.status_message);
355        debug_struct.field("requested_cancellation", &self.requested_cancellation);
356        debug_struct.field("api_version", &self.api_version);
357        if !self._unknown_fields.is_empty() {
358            debug_struct.field("_unknown_fields", &self._unknown_fields);
359        }
360        debug_struct.finish()
361    }
362}
363
364/// The ServiceConnectionMap resource.
365#[derive(Clone, Default, PartialEq)]
366#[non_exhaustive]
367pub struct ServiceConnectionMap {
368    /// Immutable. The name of a ServiceConnectionMap.
369    /// Format:
370    /// projects/{project}/locations/{location}/serviceConnectionMaps/{service_connection_map}
371    /// See: <https://google.aip.dev/122#fields-representing-resource-names>
372    pub name: std::string::String,
373
374    /// Output only. Time when the ServiceConnectionMap was created.
375    pub create_time: std::option::Option<wkt::Timestamp>,
376
377    /// Output only. Time when the ServiceConnectionMap was updated.
378    pub update_time: std::option::Option<wkt::Timestamp>,
379
380    /// User-defined labels.
381    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
382
383    /// A description of this resource.
384    pub description: std::string::String,
385
386    /// The service class identifier this ServiceConnectionMap is for.
387    /// The user of ServiceConnectionMap create API needs to have
388    /// networkconnecitivty.serviceclasses.use iam permission for the service
389    /// class.
390    pub service_class: std::string::String,
391
392    /// Output only. The service class uri this ServiceConnectionMap is for.
393    pub service_class_uri: std::string::String,
394
395    /// Output only. The infrastructure used for connections between
396    /// consumers/producers.
397    pub infrastructure: crate::model::Infrastructure,
398
399    /// The PSC configurations on producer side.
400    pub producer_psc_configs:
401        std::vec::Vec<crate::model::service_connection_map::ProducerPscConfig>,
402
403    /// The PSC configurations on consumer side.
404    pub consumer_psc_configs:
405        std::vec::Vec<crate::model::service_connection_map::ConsumerPscConfig>,
406
407    /// Output only. PSC connection details on consumer side.
408    pub consumer_psc_connections:
409        std::vec::Vec<crate::model::service_connection_map::ConsumerPscConnection>,
410
411    /// The token provided by the consumer. This token authenticates that the
412    /// consumer can create a connection within the specified project and network.
413    pub token: std::string::String,
414
415    /// Optional. The etag is computed by the server, and may be sent on update and
416    /// delete requests to ensure the client has an up-to-date value before
417    /// proceeding.
418    pub etag: std::option::Option<std::string::String>,
419
420    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
421}
422
423impl ServiceConnectionMap {
424    pub fn new() -> Self {
425        std::default::Default::default()
426    }
427
428    /// Sets the value of [name][crate::model::ServiceConnectionMap::name].
429    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
430        self.name = v.into();
431        self
432    }
433
434    /// Sets the value of [create_time][crate::model::ServiceConnectionMap::create_time].
435    pub fn set_create_time<T>(mut self, v: T) -> Self
436    where
437        T: std::convert::Into<wkt::Timestamp>,
438    {
439        self.create_time = std::option::Option::Some(v.into());
440        self
441    }
442
443    /// Sets or clears the value of [create_time][crate::model::ServiceConnectionMap::create_time].
444    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
445    where
446        T: std::convert::Into<wkt::Timestamp>,
447    {
448        self.create_time = v.map(|x| x.into());
449        self
450    }
451
452    /// Sets the value of [update_time][crate::model::ServiceConnectionMap::update_time].
453    pub fn set_update_time<T>(mut self, v: T) -> Self
454    where
455        T: std::convert::Into<wkt::Timestamp>,
456    {
457        self.update_time = std::option::Option::Some(v.into());
458        self
459    }
460
461    /// Sets or clears the value of [update_time][crate::model::ServiceConnectionMap::update_time].
462    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
463    where
464        T: std::convert::Into<wkt::Timestamp>,
465    {
466        self.update_time = v.map(|x| x.into());
467        self
468    }
469
470    /// Sets the value of [labels][crate::model::ServiceConnectionMap::labels].
471    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
472    where
473        T: std::iter::IntoIterator<Item = (K, V)>,
474        K: std::convert::Into<std::string::String>,
475        V: std::convert::Into<std::string::String>,
476    {
477        use std::iter::Iterator;
478        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
479        self
480    }
481
482    /// Sets the value of [description][crate::model::ServiceConnectionMap::description].
483    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
484        self.description = v.into();
485        self
486    }
487
488    /// Sets the value of [service_class][crate::model::ServiceConnectionMap::service_class].
489    pub fn set_service_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
490        self.service_class = v.into();
491        self
492    }
493
494    /// Sets the value of [service_class_uri][crate::model::ServiceConnectionMap::service_class_uri].
495    pub fn set_service_class_uri<T: std::convert::Into<std::string::String>>(
496        mut self,
497        v: T,
498    ) -> Self {
499        self.service_class_uri = v.into();
500        self
501    }
502
503    /// Sets the value of [infrastructure][crate::model::ServiceConnectionMap::infrastructure].
504    pub fn set_infrastructure<T: std::convert::Into<crate::model::Infrastructure>>(
505        mut self,
506        v: T,
507    ) -> Self {
508        self.infrastructure = v.into();
509        self
510    }
511
512    /// Sets the value of [producer_psc_configs][crate::model::ServiceConnectionMap::producer_psc_configs].
513    pub fn set_producer_psc_configs<T, V>(mut self, v: T) -> Self
514    where
515        T: std::iter::IntoIterator<Item = V>,
516        V: std::convert::Into<crate::model::service_connection_map::ProducerPscConfig>,
517    {
518        use std::iter::Iterator;
519        self.producer_psc_configs = v.into_iter().map(|i| i.into()).collect();
520        self
521    }
522
523    /// Sets the value of [consumer_psc_configs][crate::model::ServiceConnectionMap::consumer_psc_configs].
524    pub fn set_consumer_psc_configs<T, V>(mut self, v: T) -> Self
525    where
526        T: std::iter::IntoIterator<Item = V>,
527        V: std::convert::Into<crate::model::service_connection_map::ConsumerPscConfig>,
528    {
529        use std::iter::Iterator;
530        self.consumer_psc_configs = v.into_iter().map(|i| i.into()).collect();
531        self
532    }
533
534    /// Sets the value of [consumer_psc_connections][crate::model::ServiceConnectionMap::consumer_psc_connections].
535    pub fn set_consumer_psc_connections<T, V>(mut self, v: T) -> Self
536    where
537        T: std::iter::IntoIterator<Item = V>,
538        V: std::convert::Into<crate::model::service_connection_map::ConsumerPscConnection>,
539    {
540        use std::iter::Iterator;
541        self.consumer_psc_connections = v.into_iter().map(|i| i.into()).collect();
542        self
543    }
544
545    /// Sets the value of [token][crate::model::ServiceConnectionMap::token].
546    pub fn set_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
547        self.token = v.into();
548        self
549    }
550
551    /// Sets the value of [etag][crate::model::ServiceConnectionMap::etag].
552    pub fn set_etag<T>(mut self, v: T) -> Self
553    where
554        T: std::convert::Into<std::string::String>,
555    {
556        self.etag = std::option::Option::Some(v.into());
557        self
558    }
559
560    /// Sets or clears the value of [etag][crate::model::ServiceConnectionMap::etag].
561    pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
562    where
563        T: std::convert::Into<std::string::String>,
564    {
565        self.etag = v.map(|x| x.into());
566        self
567    }
568}
569
570impl wkt::message::Message for ServiceConnectionMap {
571    fn typename() -> &'static str {
572        "type.googleapis.com/google.cloud.networkconnectivity.v1.ServiceConnectionMap"
573    }
574}
575
576#[doc(hidden)]
577impl<'de> serde::de::Deserialize<'de> for ServiceConnectionMap {
578    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
579    where
580        D: serde::Deserializer<'de>,
581    {
582        #[allow(non_camel_case_types)]
583        #[doc(hidden)]
584        #[derive(PartialEq, Eq, Hash)]
585        enum __FieldTag {
586            __name,
587            __create_time,
588            __update_time,
589            __labels,
590            __description,
591            __service_class,
592            __service_class_uri,
593            __infrastructure,
594            __producer_psc_configs,
595            __consumer_psc_configs,
596            __consumer_psc_connections,
597            __token,
598            __etag,
599            Unknown(std::string::String),
600        }
601        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
602            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
603            where
604                D: serde::Deserializer<'de>,
605            {
606                struct Visitor;
607                impl<'de> serde::de::Visitor<'de> for Visitor {
608                    type Value = __FieldTag;
609                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
610                        formatter.write_str("a field name for ServiceConnectionMap")
611                    }
612                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
613                    where
614                        E: serde::de::Error,
615                    {
616                        use std::result::Result::Ok;
617                        use std::string::ToString;
618                        match value {
619                            "name" => Ok(__FieldTag::__name),
620                            "createTime" => Ok(__FieldTag::__create_time),
621                            "create_time" => Ok(__FieldTag::__create_time),
622                            "updateTime" => Ok(__FieldTag::__update_time),
623                            "update_time" => Ok(__FieldTag::__update_time),
624                            "labels" => Ok(__FieldTag::__labels),
625                            "description" => Ok(__FieldTag::__description),
626                            "serviceClass" => Ok(__FieldTag::__service_class),
627                            "service_class" => Ok(__FieldTag::__service_class),
628                            "serviceClassUri" => Ok(__FieldTag::__service_class_uri),
629                            "service_class_uri" => Ok(__FieldTag::__service_class_uri),
630                            "infrastructure" => Ok(__FieldTag::__infrastructure),
631                            "producerPscConfigs" => Ok(__FieldTag::__producer_psc_configs),
632                            "producer_psc_configs" => Ok(__FieldTag::__producer_psc_configs),
633                            "consumerPscConfigs" => Ok(__FieldTag::__consumer_psc_configs),
634                            "consumer_psc_configs" => Ok(__FieldTag::__consumer_psc_configs),
635                            "consumerPscConnections" => Ok(__FieldTag::__consumer_psc_connections),
636                            "consumer_psc_connections" => {
637                                Ok(__FieldTag::__consumer_psc_connections)
638                            }
639                            "token" => Ok(__FieldTag::__token),
640                            "etag" => Ok(__FieldTag::__etag),
641                            _ => Ok(__FieldTag::Unknown(value.to_string())),
642                        }
643                    }
644                }
645                deserializer.deserialize_identifier(Visitor)
646            }
647        }
648        struct Visitor;
649        impl<'de> serde::de::Visitor<'de> for Visitor {
650            type Value = ServiceConnectionMap;
651            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
652                formatter.write_str("struct ServiceConnectionMap")
653            }
654            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
655            where
656                A: serde::de::MapAccess<'de>,
657            {
658                #[allow(unused_imports)]
659                use serde::de::Error;
660                use std::option::Option::Some;
661                let mut fields = std::collections::HashSet::new();
662                let mut result = Self::Value::new();
663                while let Some(tag) = map.next_key::<__FieldTag>()? {
664                    #[allow(clippy::match_single_binding)]
665                    match tag {
666                        __FieldTag::__name => {
667                            if !fields.insert(__FieldTag::__name) {
668                                return std::result::Result::Err(A::Error::duplicate_field(
669                                    "multiple values for name",
670                                ));
671                            }
672                            result.name = map
673                                .next_value::<std::option::Option<std::string::String>>()?
674                                .unwrap_or_default();
675                        }
676                        __FieldTag::__create_time => {
677                            if !fields.insert(__FieldTag::__create_time) {
678                                return std::result::Result::Err(A::Error::duplicate_field(
679                                    "multiple values for create_time",
680                                ));
681                            }
682                            result.create_time =
683                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
684                        }
685                        __FieldTag::__update_time => {
686                            if !fields.insert(__FieldTag::__update_time) {
687                                return std::result::Result::Err(A::Error::duplicate_field(
688                                    "multiple values for update_time",
689                                ));
690                            }
691                            result.update_time =
692                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
693                        }
694                        __FieldTag::__labels => {
695                            if !fields.insert(__FieldTag::__labels) {
696                                return std::result::Result::Err(A::Error::duplicate_field(
697                                    "multiple values for labels",
698                                ));
699                            }
700                            result.labels = map
701                                .next_value::<std::option::Option<
702                                    std::collections::HashMap<
703                                        std::string::String,
704                                        std::string::String,
705                                    >,
706                                >>()?
707                                .unwrap_or_default();
708                        }
709                        __FieldTag::__description => {
710                            if !fields.insert(__FieldTag::__description) {
711                                return std::result::Result::Err(A::Error::duplicate_field(
712                                    "multiple values for description",
713                                ));
714                            }
715                            result.description = map
716                                .next_value::<std::option::Option<std::string::String>>()?
717                                .unwrap_or_default();
718                        }
719                        __FieldTag::__service_class => {
720                            if !fields.insert(__FieldTag::__service_class) {
721                                return std::result::Result::Err(A::Error::duplicate_field(
722                                    "multiple values for service_class",
723                                ));
724                            }
725                            result.service_class = map
726                                .next_value::<std::option::Option<std::string::String>>()?
727                                .unwrap_or_default();
728                        }
729                        __FieldTag::__service_class_uri => {
730                            if !fields.insert(__FieldTag::__service_class_uri) {
731                                return std::result::Result::Err(A::Error::duplicate_field(
732                                    "multiple values for service_class_uri",
733                                ));
734                            }
735                            result.service_class_uri = map
736                                .next_value::<std::option::Option<std::string::String>>()?
737                                .unwrap_or_default();
738                        }
739                        __FieldTag::__infrastructure => {
740                            if !fields.insert(__FieldTag::__infrastructure) {
741                                return std::result::Result::Err(A::Error::duplicate_field(
742                                    "multiple values for infrastructure",
743                                ));
744                            }
745                            result.infrastructure = map
746                                .next_value::<std::option::Option<crate::model::Infrastructure>>()?
747                                .unwrap_or_default();
748                        }
749                        __FieldTag::__producer_psc_configs => {
750                            if !fields.insert(__FieldTag::__producer_psc_configs) {
751                                return std::result::Result::Err(A::Error::duplicate_field(
752                                    "multiple values for producer_psc_configs",
753                                ));
754                            }
755                            result.producer_psc_configs = map
756                                .next_value::<std::option::Option<
757                                    std::vec::Vec<
758                                        crate::model::service_connection_map::ProducerPscConfig,
759                                    >,
760                                >>()?
761                                .unwrap_or_default();
762                        }
763                        __FieldTag::__consumer_psc_configs => {
764                            if !fields.insert(__FieldTag::__consumer_psc_configs) {
765                                return std::result::Result::Err(A::Error::duplicate_field(
766                                    "multiple values for consumer_psc_configs",
767                                ));
768                            }
769                            result.consumer_psc_configs = map
770                                .next_value::<std::option::Option<
771                                    std::vec::Vec<
772                                        crate::model::service_connection_map::ConsumerPscConfig,
773                                    >,
774                                >>()?
775                                .unwrap_or_default();
776                        }
777                        __FieldTag::__consumer_psc_connections => {
778                            if !fields.insert(__FieldTag::__consumer_psc_connections) {
779                                return std::result::Result::Err(A::Error::duplicate_field(
780                                    "multiple values for consumer_psc_connections",
781                                ));
782                            }
783                            result.consumer_psc_connections = map
784                                .next_value::<std::option::Option<
785                                    std::vec::Vec<
786                                        crate::model::service_connection_map::ConsumerPscConnection,
787                                    >,
788                                >>()?
789                                .unwrap_or_default();
790                        }
791                        __FieldTag::__token => {
792                            if !fields.insert(__FieldTag::__token) {
793                                return std::result::Result::Err(A::Error::duplicate_field(
794                                    "multiple values for token",
795                                ));
796                            }
797                            result.token = map
798                                .next_value::<std::option::Option<std::string::String>>()?
799                                .unwrap_or_default();
800                        }
801                        __FieldTag::__etag => {
802                            if !fields.insert(__FieldTag::__etag) {
803                                return std::result::Result::Err(A::Error::duplicate_field(
804                                    "multiple values for etag",
805                                ));
806                            }
807                            result.etag =
808                                map.next_value::<std::option::Option<std::string::String>>()?;
809                        }
810                        __FieldTag::Unknown(key) => {
811                            let value = map.next_value::<serde_json::Value>()?;
812                            result._unknown_fields.insert(key, value);
813                        }
814                    }
815                }
816                std::result::Result::Ok(result)
817            }
818        }
819        deserializer.deserialize_any(Visitor)
820    }
821}
822
823#[doc(hidden)]
824impl serde::ser::Serialize for ServiceConnectionMap {
825    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
826    where
827        S: serde::ser::Serializer,
828    {
829        use serde::ser::SerializeMap;
830        #[allow(unused_imports)]
831        use std::option::Option::Some;
832        let mut state = serializer.serialize_map(std::option::Option::None)?;
833        if !self.name.is_empty() {
834            state.serialize_entry("name", &self.name)?;
835        }
836        if self.create_time.is_some() {
837            state.serialize_entry("createTime", &self.create_time)?;
838        }
839        if self.update_time.is_some() {
840            state.serialize_entry("updateTime", &self.update_time)?;
841        }
842        if !self.labels.is_empty() {
843            state.serialize_entry("labels", &self.labels)?;
844        }
845        if !self.description.is_empty() {
846            state.serialize_entry("description", &self.description)?;
847        }
848        if !self.service_class.is_empty() {
849            state.serialize_entry("serviceClass", &self.service_class)?;
850        }
851        if !self.service_class_uri.is_empty() {
852            state.serialize_entry("serviceClassUri", &self.service_class_uri)?;
853        }
854        if !wkt::internal::is_default(&self.infrastructure) {
855            state.serialize_entry("infrastructure", &self.infrastructure)?;
856        }
857        if !self.producer_psc_configs.is_empty() {
858            state.serialize_entry("producerPscConfigs", &self.producer_psc_configs)?;
859        }
860        if !self.consumer_psc_configs.is_empty() {
861            state.serialize_entry("consumerPscConfigs", &self.consumer_psc_configs)?;
862        }
863        if !self.consumer_psc_connections.is_empty() {
864            state.serialize_entry("consumerPscConnections", &self.consumer_psc_connections)?;
865        }
866        if !self.token.is_empty() {
867            state.serialize_entry("token", &self.token)?;
868        }
869        if self.etag.is_some() {
870            state.serialize_entry("etag", &self.etag)?;
871        }
872        if !self._unknown_fields.is_empty() {
873            for (key, value) in self._unknown_fields.iter() {
874                state.serialize_entry(key, &value)?;
875            }
876        }
877        state.end()
878    }
879}
880
881impl std::fmt::Debug for ServiceConnectionMap {
882    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
883        let mut debug_struct = f.debug_struct("ServiceConnectionMap");
884        debug_struct.field("name", &self.name);
885        debug_struct.field("create_time", &self.create_time);
886        debug_struct.field("update_time", &self.update_time);
887        debug_struct.field("labels", &self.labels);
888        debug_struct.field("description", &self.description);
889        debug_struct.field("service_class", &self.service_class);
890        debug_struct.field("service_class_uri", &self.service_class_uri);
891        debug_struct.field("infrastructure", &self.infrastructure);
892        debug_struct.field("producer_psc_configs", &self.producer_psc_configs);
893        debug_struct.field("consumer_psc_configs", &self.consumer_psc_configs);
894        debug_struct.field("consumer_psc_connections", &self.consumer_psc_connections);
895        debug_struct.field("token", &self.token);
896        debug_struct.field("etag", &self.etag);
897        if !self._unknown_fields.is_empty() {
898            debug_struct.field("_unknown_fields", &self._unknown_fields);
899        }
900        debug_struct.finish()
901    }
902}
903
904/// Defines additional types related to [ServiceConnectionMap].
905pub mod service_connection_map {
906    #[allow(unused_imports)]
907    use super::*;
908
909    /// The PSC configurations on producer side.
910    #[derive(Clone, Default, PartialEq)]
911    #[non_exhaustive]
912    pub struct ProducerPscConfig {
913        /// The resource path of a service attachment.
914        /// Example:
915        /// projects/{projectNumOrId}/regions/{region}/serviceAttachments/{resourceId}.
916        pub service_attachment_uri: std::string::String,
917
918        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
919    }
920
921    impl ProducerPscConfig {
922        pub fn new() -> Self {
923            std::default::Default::default()
924        }
925
926        /// Sets the value of [service_attachment_uri][crate::model::service_connection_map::ProducerPscConfig::service_attachment_uri].
927        pub fn set_service_attachment_uri<T: std::convert::Into<std::string::String>>(
928            mut self,
929            v: T,
930        ) -> Self {
931            self.service_attachment_uri = v.into();
932            self
933        }
934    }
935
936    impl wkt::message::Message for ProducerPscConfig {
937        fn typename() -> &'static str {
938            "type.googleapis.com/google.cloud.networkconnectivity.v1.ServiceConnectionMap.ProducerPscConfig"
939        }
940    }
941
942    #[doc(hidden)]
943    impl<'de> serde::de::Deserialize<'de> for ProducerPscConfig {
944        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
945        where
946            D: serde::Deserializer<'de>,
947        {
948            #[allow(non_camel_case_types)]
949            #[doc(hidden)]
950            #[derive(PartialEq, Eq, Hash)]
951            enum __FieldTag {
952                __service_attachment_uri,
953                Unknown(std::string::String),
954            }
955            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
956                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
957                where
958                    D: serde::Deserializer<'de>,
959                {
960                    struct Visitor;
961                    impl<'de> serde::de::Visitor<'de> for Visitor {
962                        type Value = __FieldTag;
963                        fn expecting(
964                            &self,
965                            formatter: &mut std::fmt::Formatter,
966                        ) -> std::fmt::Result {
967                            formatter.write_str("a field name for ProducerPscConfig")
968                        }
969                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
970                        where
971                            E: serde::de::Error,
972                        {
973                            use std::result::Result::Ok;
974                            use std::string::ToString;
975                            match value {
976                                "serviceAttachmentUri" => Ok(__FieldTag::__service_attachment_uri),
977                                "service_attachment_uri" => {
978                                    Ok(__FieldTag::__service_attachment_uri)
979                                }
980                                _ => Ok(__FieldTag::Unknown(value.to_string())),
981                            }
982                        }
983                    }
984                    deserializer.deserialize_identifier(Visitor)
985                }
986            }
987            struct Visitor;
988            impl<'de> serde::de::Visitor<'de> for Visitor {
989                type Value = ProducerPscConfig;
990                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
991                    formatter.write_str("struct ProducerPscConfig")
992                }
993                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
994                where
995                    A: serde::de::MapAccess<'de>,
996                {
997                    #[allow(unused_imports)]
998                    use serde::de::Error;
999                    use std::option::Option::Some;
1000                    let mut fields = std::collections::HashSet::new();
1001                    let mut result = Self::Value::new();
1002                    while let Some(tag) = map.next_key::<__FieldTag>()? {
1003                        #[allow(clippy::match_single_binding)]
1004                        match tag {
1005                            __FieldTag::__service_attachment_uri => {
1006                                if !fields.insert(__FieldTag::__service_attachment_uri) {
1007                                    return std::result::Result::Err(A::Error::duplicate_field(
1008                                        "multiple values for service_attachment_uri",
1009                                    ));
1010                                }
1011                                result.service_attachment_uri = map
1012                                    .next_value::<std::option::Option<std::string::String>>()?
1013                                    .unwrap_or_default();
1014                            }
1015                            __FieldTag::Unknown(key) => {
1016                                let value = map.next_value::<serde_json::Value>()?;
1017                                result._unknown_fields.insert(key, value);
1018                            }
1019                        }
1020                    }
1021                    std::result::Result::Ok(result)
1022                }
1023            }
1024            deserializer.deserialize_any(Visitor)
1025        }
1026    }
1027
1028    #[doc(hidden)]
1029    impl serde::ser::Serialize for ProducerPscConfig {
1030        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1031        where
1032            S: serde::ser::Serializer,
1033        {
1034            use serde::ser::SerializeMap;
1035            #[allow(unused_imports)]
1036            use std::option::Option::Some;
1037            let mut state = serializer.serialize_map(std::option::Option::None)?;
1038            if !self.service_attachment_uri.is_empty() {
1039                state.serialize_entry("serviceAttachmentUri", &self.service_attachment_uri)?;
1040            }
1041            if !self._unknown_fields.is_empty() {
1042                for (key, value) in self._unknown_fields.iter() {
1043                    state.serialize_entry(key, &value)?;
1044                }
1045            }
1046            state.end()
1047        }
1048    }
1049
1050    impl std::fmt::Debug for ProducerPscConfig {
1051        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1052            let mut debug_struct = f.debug_struct("ProducerPscConfig");
1053            debug_struct.field("service_attachment_uri", &self.service_attachment_uri);
1054            if !self._unknown_fields.is_empty() {
1055                debug_struct.field("_unknown_fields", &self._unknown_fields);
1056            }
1057            debug_struct.finish()
1058        }
1059    }
1060
1061    /// Allow the producer to specify which consumers can connect to it.
1062    #[derive(Clone, Default, PartialEq)]
1063    #[non_exhaustive]
1064    pub struct ConsumerPscConfig {
1065        /// The consumer project where PSC connections are allowed to be created in.
1066        pub project: std::string::String,
1067
1068        /// The resource path of the consumer network where PSC connections are
1069        /// allowed to be created in. Note, this network does not need be in the
1070        /// ConsumerPscConfig.project in the case of SharedVPC.
1071        /// Example:
1072        /// projects/{projectNumOrId}/global/networks/{networkId}.
1073        pub network: std::string::String,
1074
1075        /// This is used in PSC consumer ForwardingRule to control whether the PSC
1076        /// endpoint can be accessed from another region.
1077        pub disable_global_access: bool,
1078
1079        /// Output only. Overall state of PSC Connections management for this
1080        /// consumer psc config.
1081        pub state: crate::model::service_connection_map::consumer_psc_config::State,
1082
1083        /// Immutable. Deprecated. Use producer_instance_metadata instead.
1084        /// An immutable identifier for the producer instance.
1085        #[deprecated]
1086        pub producer_instance_id: std::string::String,
1087
1088        /// Output only. A map to store mapping between customer vip and target
1089        /// service attachment. Only service attachment with producer specified ip
1090        /// addresses are stored here.
1091        pub service_attachment_ip_address_map:
1092            std::collections::HashMap<std::string::String, std::string::String>,
1093
1094        /// Required. The project ID or project number of the consumer project. This
1095        /// project is the one that the consumer uses to interact with the producer
1096        /// instance. From the perspective of a consumer who's created a producer
1097        /// instance, this is the project of the producer instance. Format:
1098        /// 'projects/<project_id_or_number>' Eg. 'projects/consumer-project' or
1099        /// 'projects/1234'
1100        pub consumer_instance_project: std::string::String,
1101
1102        /// Immutable. An immutable map for the producer instance metadata.
1103        pub producer_instance_metadata:
1104            std::collections::HashMap<std::string::String, std::string::String>,
1105
1106        /// The requested IP version for the PSC connection.
1107        pub ip_version: std::option::Option<crate::model::IPVersion>,
1108
1109        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1110    }
1111
1112    impl ConsumerPscConfig {
1113        pub fn new() -> Self {
1114            std::default::Default::default()
1115        }
1116
1117        /// Sets the value of [project][crate::model::service_connection_map::ConsumerPscConfig::project].
1118        pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1119            self.project = v.into();
1120            self
1121        }
1122
1123        /// Sets the value of [network][crate::model::service_connection_map::ConsumerPscConfig::network].
1124        pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1125            self.network = v.into();
1126            self
1127        }
1128
1129        /// Sets the value of [disable_global_access][crate::model::service_connection_map::ConsumerPscConfig::disable_global_access].
1130        pub fn set_disable_global_access<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1131            self.disable_global_access = v.into();
1132            self
1133        }
1134
1135        /// Sets the value of [state][crate::model::service_connection_map::ConsumerPscConfig::state].
1136        pub fn set_state<
1137            T: std::convert::Into<crate::model::service_connection_map::consumer_psc_config::State>,
1138        >(
1139            mut self,
1140            v: T,
1141        ) -> Self {
1142            self.state = v.into();
1143            self
1144        }
1145
1146        /// Sets the value of [producer_instance_id][crate::model::service_connection_map::ConsumerPscConfig::producer_instance_id].
1147        #[deprecated]
1148        pub fn set_producer_instance_id<T: std::convert::Into<std::string::String>>(
1149            mut self,
1150            v: T,
1151        ) -> Self {
1152            self.producer_instance_id = v.into();
1153            self
1154        }
1155
1156        /// Sets the value of [service_attachment_ip_address_map][crate::model::service_connection_map::ConsumerPscConfig::service_attachment_ip_address_map].
1157        pub fn set_service_attachment_ip_address_map<T, K, V>(mut self, v: T) -> Self
1158        where
1159            T: std::iter::IntoIterator<Item = (K, V)>,
1160            K: std::convert::Into<std::string::String>,
1161            V: std::convert::Into<std::string::String>,
1162        {
1163            use std::iter::Iterator;
1164            self.service_attachment_ip_address_map =
1165                v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1166            self
1167        }
1168
1169        /// Sets the value of [consumer_instance_project][crate::model::service_connection_map::ConsumerPscConfig::consumer_instance_project].
1170        pub fn set_consumer_instance_project<T: std::convert::Into<std::string::String>>(
1171            mut self,
1172            v: T,
1173        ) -> Self {
1174            self.consumer_instance_project = v.into();
1175            self
1176        }
1177
1178        /// Sets the value of [producer_instance_metadata][crate::model::service_connection_map::ConsumerPscConfig::producer_instance_metadata].
1179        pub fn set_producer_instance_metadata<T, K, V>(mut self, v: T) -> Self
1180        where
1181            T: std::iter::IntoIterator<Item = (K, V)>,
1182            K: std::convert::Into<std::string::String>,
1183            V: std::convert::Into<std::string::String>,
1184        {
1185            use std::iter::Iterator;
1186            self.producer_instance_metadata =
1187                v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1188            self
1189        }
1190
1191        /// Sets the value of [ip_version][crate::model::service_connection_map::ConsumerPscConfig::ip_version].
1192        pub fn set_ip_version<T>(mut self, v: T) -> Self
1193        where
1194            T: std::convert::Into<crate::model::IPVersion>,
1195        {
1196            self.ip_version = std::option::Option::Some(v.into());
1197            self
1198        }
1199
1200        /// Sets or clears the value of [ip_version][crate::model::service_connection_map::ConsumerPscConfig::ip_version].
1201        pub fn set_or_clear_ip_version<T>(mut self, v: std::option::Option<T>) -> Self
1202        where
1203            T: std::convert::Into<crate::model::IPVersion>,
1204        {
1205            self.ip_version = v.map(|x| x.into());
1206            self
1207        }
1208    }
1209
1210    impl wkt::message::Message for ConsumerPscConfig {
1211        fn typename() -> &'static str {
1212            "type.googleapis.com/google.cloud.networkconnectivity.v1.ServiceConnectionMap.ConsumerPscConfig"
1213        }
1214    }
1215
1216    #[doc(hidden)]
1217    impl<'de> serde::de::Deserialize<'de> for ConsumerPscConfig {
1218        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1219        where
1220            D: serde::Deserializer<'de>,
1221        {
1222            #[allow(non_camel_case_types)]
1223            #[doc(hidden)]
1224            #[derive(PartialEq, Eq, Hash)]
1225            enum __FieldTag {
1226                __project,
1227                __network,
1228                __disable_global_access,
1229                __state,
1230                __producer_instance_id,
1231                __service_attachment_ip_address_map,
1232                __consumer_instance_project,
1233                __producer_instance_metadata,
1234                __ip_version,
1235                Unknown(std::string::String),
1236            }
1237            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1238                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1239                where
1240                    D: serde::Deserializer<'de>,
1241                {
1242                    struct Visitor;
1243                    impl<'de> serde::de::Visitor<'de> for Visitor {
1244                        type Value = __FieldTag;
1245                        fn expecting(
1246                            &self,
1247                            formatter: &mut std::fmt::Formatter,
1248                        ) -> std::fmt::Result {
1249                            formatter.write_str("a field name for ConsumerPscConfig")
1250                        }
1251                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1252                        where
1253                            E: serde::de::Error,
1254                        {
1255                            use std::result::Result::Ok;
1256                            use std::string::ToString;
1257                            match value {
1258                                "project" => Ok(__FieldTag::__project),
1259                                "network" => Ok(__FieldTag::__network),
1260                                "disableGlobalAccess" => Ok(__FieldTag::__disable_global_access),
1261                                "disable_global_access" => Ok(__FieldTag::__disable_global_access),
1262                                "state" => Ok(__FieldTag::__state),
1263                                "producerInstanceId" => Ok(__FieldTag::__producer_instance_id),
1264                                "producer_instance_id" => Ok(__FieldTag::__producer_instance_id),
1265                                "serviceAttachmentIpAddressMap" => {
1266                                    Ok(__FieldTag::__service_attachment_ip_address_map)
1267                                }
1268                                "service_attachment_ip_address_map" => {
1269                                    Ok(__FieldTag::__service_attachment_ip_address_map)
1270                                }
1271                                "consumerInstanceProject" => {
1272                                    Ok(__FieldTag::__consumer_instance_project)
1273                                }
1274                                "consumer_instance_project" => {
1275                                    Ok(__FieldTag::__consumer_instance_project)
1276                                }
1277                                "producerInstanceMetadata" => {
1278                                    Ok(__FieldTag::__producer_instance_metadata)
1279                                }
1280                                "producer_instance_metadata" => {
1281                                    Ok(__FieldTag::__producer_instance_metadata)
1282                                }
1283                                "ipVersion" => Ok(__FieldTag::__ip_version),
1284                                "ip_version" => Ok(__FieldTag::__ip_version),
1285                                _ => Ok(__FieldTag::Unknown(value.to_string())),
1286                            }
1287                        }
1288                    }
1289                    deserializer.deserialize_identifier(Visitor)
1290                }
1291            }
1292            struct Visitor;
1293            impl<'de> serde::de::Visitor<'de> for Visitor {
1294                type Value = ConsumerPscConfig;
1295                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1296                    formatter.write_str("struct ConsumerPscConfig")
1297                }
1298                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1299                where
1300                    A: serde::de::MapAccess<'de>,
1301                {
1302                    #[allow(unused_imports)]
1303                    use serde::de::Error;
1304                    use std::option::Option::Some;
1305                    let mut fields = std::collections::HashSet::new();
1306                    let mut result = Self::Value::new();
1307                    while let Some(tag) = map.next_key::<__FieldTag>()? {
1308                        #[allow(clippy::match_single_binding)]
1309                        match tag {
1310                            __FieldTag::__project => {
1311                                if !fields.insert(__FieldTag::__project) {
1312                                    return std::result::Result::Err(A::Error::duplicate_field(
1313                                        "multiple values for project",
1314                                    ));
1315                                }
1316                                result.project = map
1317                                    .next_value::<std::option::Option<std::string::String>>()?
1318                                    .unwrap_or_default();
1319                            }
1320                            __FieldTag::__network => {
1321                                if !fields.insert(__FieldTag::__network) {
1322                                    return std::result::Result::Err(A::Error::duplicate_field(
1323                                        "multiple values for network",
1324                                    ));
1325                                }
1326                                result.network = map
1327                                    .next_value::<std::option::Option<std::string::String>>()?
1328                                    .unwrap_or_default();
1329                            }
1330                            __FieldTag::__disable_global_access => {
1331                                if !fields.insert(__FieldTag::__disable_global_access) {
1332                                    return std::result::Result::Err(A::Error::duplicate_field(
1333                                        "multiple values for disable_global_access",
1334                                    ));
1335                                }
1336                                result.disable_global_access = map
1337                                    .next_value::<std::option::Option<bool>>()?
1338                                    .unwrap_or_default();
1339                            }
1340                            __FieldTag::__state => {
1341                                if !fields.insert(__FieldTag::__state) {
1342                                    return std::result::Result::Err(A::Error::duplicate_field(
1343                                        "multiple values for state",
1344                                    ));
1345                                }
1346                                result.state = map.next_value::<std::option::Option<crate::model::service_connection_map::consumer_psc_config::State>>()?.unwrap_or_default();
1347                            }
1348                            __FieldTag::__producer_instance_id => {
1349                                if !fields.insert(__FieldTag::__producer_instance_id) {
1350                                    return std::result::Result::Err(A::Error::duplicate_field(
1351                                        "multiple values for producer_instance_id",
1352                                    ));
1353                                }
1354                                result.producer_instance_id = map
1355                                    .next_value::<std::option::Option<std::string::String>>()?
1356                                    .unwrap_or_default();
1357                            }
1358                            __FieldTag::__service_attachment_ip_address_map => {
1359                                if !fields.insert(__FieldTag::__service_attachment_ip_address_map) {
1360                                    return std::result::Result::Err(A::Error::duplicate_field(
1361                                        "multiple values for service_attachment_ip_address_map",
1362                                    ));
1363                                }
1364                                result.service_attachment_ip_address_map = map
1365                                    .next_value::<std::option::Option<
1366                                        std::collections::HashMap<
1367                                            std::string::String,
1368                                            std::string::String,
1369                                        >,
1370                                    >>()?
1371                                    .unwrap_or_default();
1372                            }
1373                            __FieldTag::__consumer_instance_project => {
1374                                if !fields.insert(__FieldTag::__consumer_instance_project) {
1375                                    return std::result::Result::Err(A::Error::duplicate_field(
1376                                        "multiple values for consumer_instance_project",
1377                                    ));
1378                                }
1379                                result.consumer_instance_project = map
1380                                    .next_value::<std::option::Option<std::string::String>>()?
1381                                    .unwrap_or_default();
1382                            }
1383                            __FieldTag::__producer_instance_metadata => {
1384                                if !fields.insert(__FieldTag::__producer_instance_metadata) {
1385                                    return std::result::Result::Err(A::Error::duplicate_field(
1386                                        "multiple values for producer_instance_metadata",
1387                                    ));
1388                                }
1389                                result.producer_instance_metadata = map
1390                                    .next_value::<std::option::Option<
1391                                        std::collections::HashMap<
1392                                            std::string::String,
1393                                            std::string::String,
1394                                        >,
1395                                    >>()?
1396                                    .unwrap_or_default();
1397                            }
1398                            __FieldTag::__ip_version => {
1399                                if !fields.insert(__FieldTag::__ip_version) {
1400                                    return std::result::Result::Err(A::Error::duplicate_field(
1401                                        "multiple values for ip_version",
1402                                    ));
1403                                }
1404                                result.ip_version = map
1405                                    .next_value::<std::option::Option<crate::model::IPVersion>>()?;
1406                            }
1407                            __FieldTag::Unknown(key) => {
1408                                let value = map.next_value::<serde_json::Value>()?;
1409                                result._unknown_fields.insert(key, value);
1410                            }
1411                        }
1412                    }
1413                    std::result::Result::Ok(result)
1414                }
1415            }
1416            deserializer.deserialize_any(Visitor)
1417        }
1418    }
1419
1420    #[doc(hidden)]
1421    impl serde::ser::Serialize for ConsumerPscConfig {
1422        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1423        where
1424            S: serde::ser::Serializer,
1425        {
1426            use serde::ser::SerializeMap;
1427            #[allow(unused_imports)]
1428            use std::option::Option::Some;
1429            let mut state = serializer.serialize_map(std::option::Option::None)?;
1430            if !self.project.is_empty() {
1431                state.serialize_entry("project", &self.project)?;
1432            }
1433            if !self.network.is_empty() {
1434                state.serialize_entry("network", &self.network)?;
1435            }
1436            if !wkt::internal::is_default(&self.disable_global_access) {
1437                state.serialize_entry("disableGlobalAccess", &self.disable_global_access)?;
1438            }
1439            if !wkt::internal::is_default(&self.state) {
1440                state.serialize_entry("state", &self.state)?;
1441            }
1442            if !self.producer_instance_id.is_empty() {
1443                state.serialize_entry("producerInstanceId", &self.producer_instance_id)?;
1444            }
1445            if !self.service_attachment_ip_address_map.is_empty() {
1446                state.serialize_entry(
1447                    "serviceAttachmentIpAddressMap",
1448                    &self.service_attachment_ip_address_map,
1449                )?;
1450            }
1451            if !self.consumer_instance_project.is_empty() {
1452                state
1453                    .serialize_entry("consumerInstanceProject", &self.consumer_instance_project)?;
1454            }
1455            if !self.producer_instance_metadata.is_empty() {
1456                state.serialize_entry(
1457                    "producerInstanceMetadata",
1458                    &self.producer_instance_metadata,
1459                )?;
1460            }
1461            if self.ip_version.is_some() {
1462                state.serialize_entry("ipVersion", &self.ip_version)?;
1463            }
1464            if !self._unknown_fields.is_empty() {
1465                for (key, value) in self._unknown_fields.iter() {
1466                    state.serialize_entry(key, &value)?;
1467                }
1468            }
1469            state.end()
1470        }
1471    }
1472
1473    impl std::fmt::Debug for ConsumerPscConfig {
1474        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1475            let mut debug_struct = f.debug_struct("ConsumerPscConfig");
1476            debug_struct.field("project", &self.project);
1477            debug_struct.field("network", &self.network);
1478            debug_struct.field("disable_global_access", &self.disable_global_access);
1479            debug_struct.field("state", &self.state);
1480            debug_struct.field("producer_instance_id", &self.producer_instance_id);
1481            debug_struct.field(
1482                "service_attachment_ip_address_map",
1483                &self.service_attachment_ip_address_map,
1484            );
1485            debug_struct.field("consumer_instance_project", &self.consumer_instance_project);
1486            debug_struct.field(
1487                "producer_instance_metadata",
1488                &self.producer_instance_metadata,
1489            );
1490            debug_struct.field("ip_version", &self.ip_version);
1491            if !self._unknown_fields.is_empty() {
1492                debug_struct.field("_unknown_fields", &self._unknown_fields);
1493            }
1494            debug_struct.finish()
1495        }
1496    }
1497
1498    /// Defines additional types related to [ConsumerPscConfig].
1499    pub mod consumer_psc_config {
1500        #[allow(unused_imports)]
1501        use super::*;
1502
1503        /// PSC Consumer Config State.
1504        ///
1505        /// # Working with unknown values
1506        ///
1507        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1508        /// additional enum variants at any time. Adding new variants is not considered
1509        /// a breaking change. Applications should write their code in anticipation of:
1510        ///
1511        /// - New values appearing in future releases of the client library, **and**
1512        /// - New values received dynamically, without application changes.
1513        ///
1514        /// Please consult the [Working with enums] section in the user guide for some
1515        /// guidelines.
1516        ///
1517        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1518        #[derive(Clone, Debug, PartialEq)]
1519        #[non_exhaustive]
1520        pub enum State {
1521            /// Default state, when Connection Map is created initially.
1522            Unspecified,
1523            /// Set when policy and map configuration is valid,
1524            /// and their matching can lead to allowing creation of PSC Connections
1525            /// subject to other constraints like connections limit.
1526            Valid,
1527            /// No Service Connection Policy found for this network and Service
1528            /// Class
1529            ConnectionPolicyMissing,
1530            /// Service Connection Policy limit reached for this network and Service
1531            /// Class
1532            PolicyLimitReached,
1533            /// The consumer instance project is not in
1534            /// AllowedGoogleProducersResourceHierarchyLevels of the matching
1535            /// ServiceConnectionPolicy.
1536            ConsumerInstanceProjectNotAllowlisted,
1537            /// If set, the enum was initialized with an unknown value.
1538            ///
1539            /// Applications can examine the value using [State::value] or
1540            /// [State::name].
1541            UnknownValue(state::UnknownValue),
1542        }
1543
1544        #[doc(hidden)]
1545        pub mod state {
1546            #[allow(unused_imports)]
1547            use super::*;
1548            #[derive(Clone, Debug, PartialEq)]
1549            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1550        }
1551
1552        impl State {
1553            /// Gets the enum value.
1554            ///
1555            /// Returns `None` if the enum contains an unknown value deserialized from
1556            /// the string representation of enums.
1557            pub fn value(&self) -> std::option::Option<i32> {
1558                match self {
1559                    Self::Unspecified => std::option::Option::Some(0),
1560                    Self::Valid => std::option::Option::Some(1),
1561                    Self::ConnectionPolicyMissing => std::option::Option::Some(2),
1562                    Self::PolicyLimitReached => std::option::Option::Some(3),
1563                    Self::ConsumerInstanceProjectNotAllowlisted => std::option::Option::Some(4),
1564                    Self::UnknownValue(u) => u.0.value(),
1565                }
1566            }
1567
1568            /// Gets the enum value as a string.
1569            ///
1570            /// Returns `None` if the enum contains an unknown value deserialized from
1571            /// the integer representation of enums.
1572            pub fn name(&self) -> std::option::Option<&str> {
1573                match self {
1574                    Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1575                    Self::Valid => std::option::Option::Some("VALID"),
1576                    Self::ConnectionPolicyMissing => {
1577                        std::option::Option::Some("CONNECTION_POLICY_MISSING")
1578                    }
1579                    Self::PolicyLimitReached => std::option::Option::Some("POLICY_LIMIT_REACHED"),
1580                    Self::ConsumerInstanceProjectNotAllowlisted => {
1581                        std::option::Option::Some("CONSUMER_INSTANCE_PROJECT_NOT_ALLOWLISTED")
1582                    }
1583                    Self::UnknownValue(u) => u.0.name(),
1584                }
1585            }
1586        }
1587
1588        impl std::default::Default for State {
1589            fn default() -> Self {
1590                use std::convert::From;
1591                Self::from(0)
1592            }
1593        }
1594
1595        impl std::fmt::Display for State {
1596            fn fmt(
1597                &self,
1598                f: &mut std::fmt::Formatter<'_>,
1599            ) -> std::result::Result<(), std::fmt::Error> {
1600                wkt::internal::display_enum(f, self.name(), self.value())
1601            }
1602        }
1603
1604        impl std::convert::From<i32> for State {
1605            fn from(value: i32) -> Self {
1606                match value {
1607                    0 => Self::Unspecified,
1608                    1 => Self::Valid,
1609                    2 => Self::ConnectionPolicyMissing,
1610                    3 => Self::PolicyLimitReached,
1611                    4 => Self::ConsumerInstanceProjectNotAllowlisted,
1612                    _ => Self::UnknownValue(state::UnknownValue(
1613                        wkt::internal::UnknownEnumValue::Integer(value),
1614                    )),
1615                }
1616            }
1617        }
1618
1619        impl std::convert::From<&str> for State {
1620            fn from(value: &str) -> Self {
1621                use std::string::ToString;
1622                match value {
1623                    "STATE_UNSPECIFIED" => Self::Unspecified,
1624                    "VALID" => Self::Valid,
1625                    "CONNECTION_POLICY_MISSING" => Self::ConnectionPolicyMissing,
1626                    "POLICY_LIMIT_REACHED" => Self::PolicyLimitReached,
1627                    "CONSUMER_INSTANCE_PROJECT_NOT_ALLOWLISTED" => {
1628                        Self::ConsumerInstanceProjectNotAllowlisted
1629                    }
1630                    _ => Self::UnknownValue(state::UnknownValue(
1631                        wkt::internal::UnknownEnumValue::String(value.to_string()),
1632                    )),
1633                }
1634            }
1635        }
1636
1637        impl serde::ser::Serialize for State {
1638            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1639            where
1640                S: serde::Serializer,
1641            {
1642                match self {
1643                    Self::Unspecified => serializer.serialize_i32(0),
1644                    Self::Valid => serializer.serialize_i32(1),
1645                    Self::ConnectionPolicyMissing => serializer.serialize_i32(2),
1646                    Self::PolicyLimitReached => serializer.serialize_i32(3),
1647                    Self::ConsumerInstanceProjectNotAllowlisted => serializer.serialize_i32(4),
1648                    Self::UnknownValue(u) => u.0.serialize(serializer),
1649                }
1650            }
1651        }
1652
1653        impl<'de> serde::de::Deserialize<'de> for State {
1654            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1655            where
1656                D: serde::Deserializer<'de>,
1657            {
1658                deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1659                    ".google.cloud.networkconnectivity.v1.ServiceConnectionMap.ConsumerPscConfig.State"))
1660            }
1661        }
1662    }
1663
1664    /// PSC connection details on consumer side.
1665    #[derive(Clone, Default, PartialEq)]
1666    #[non_exhaustive]
1667    pub struct ConsumerPscConnection {
1668        /// The URI of a service attachment which is the target of the PSC
1669        /// connection.
1670        pub service_attachment_uri: std::string::String,
1671
1672        /// The state of the PSC connection.
1673        pub state: crate::model::service_connection_map::consumer_psc_connection::State,
1674
1675        /// The consumer project whose PSC forwarding rule is connected to the
1676        /// service attachments in this service connection map.
1677        pub project: std::string::String,
1678
1679        /// The consumer network whose PSC forwarding rule is connected to the
1680        /// service attachments in this service connection map.
1681        /// Note that the network could be on a different project (shared VPC).
1682        pub network: std::string::String,
1683
1684        /// The PSC connection id of the PSC forwarding rule connected
1685        /// to the service attachments in this service connection map.
1686        pub psc_connection_id: std::string::String,
1687
1688        /// The IP literal allocated on the consumer network for the PSC forwarding
1689        /// rule that is created to connect to the producer service attachment in
1690        /// this service connection map.
1691        pub ip: std::string::String,
1692
1693        /// The error type indicates whether the error is consumer facing, producer
1694        /// facing or system internal.
1695        #[deprecated]
1696        pub error_type: crate::model::ConnectionErrorType,
1697
1698        /// The most recent error during operating this connection.
1699        #[deprecated]
1700        pub error: std::option::Option<rpc::model::Status>,
1701
1702        /// The last Compute Engine operation to setup PSC connection.
1703        pub gce_operation: std::string::String,
1704
1705        /// The URI of the consumer forwarding rule created.
1706        /// Example:
1707        /// projects/{projectNumOrId}/regions/us-east1/networks/{resourceId}.
1708        pub forwarding_rule: std::string::String,
1709
1710        /// Output only. The error info for the latest error during operating this
1711        /// connection.
1712        pub error_info: std::option::Option<rpc::model::ErrorInfo>,
1713
1714        /// Output only. The URI of the selected subnetwork selected to allocate IP
1715        /// address for this connection.
1716        pub selected_subnetwork: std::string::String,
1717
1718        /// Immutable. Deprecated. Use producer_instance_metadata instead.
1719        /// An immutable identifier for the producer instance.
1720        #[deprecated]
1721        pub producer_instance_id: std::string::String,
1722
1723        /// Immutable. An immutable map for the producer instance metadata.
1724        pub producer_instance_metadata:
1725            std::collections::HashMap<std::string::String, std::string::String>,
1726
1727        /// The requested IP version for the PSC connection.
1728        pub ip_version: std::option::Option<crate::model::IPVersion>,
1729
1730        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1731    }
1732
1733    impl ConsumerPscConnection {
1734        pub fn new() -> Self {
1735            std::default::Default::default()
1736        }
1737
1738        /// Sets the value of [service_attachment_uri][crate::model::service_connection_map::ConsumerPscConnection::service_attachment_uri].
1739        pub fn set_service_attachment_uri<T: std::convert::Into<std::string::String>>(
1740            mut self,
1741            v: T,
1742        ) -> Self {
1743            self.service_attachment_uri = v.into();
1744            self
1745        }
1746
1747        /// Sets the value of [state][crate::model::service_connection_map::ConsumerPscConnection::state].
1748        pub fn set_state<
1749            T: std::convert::Into<
1750                    crate::model::service_connection_map::consumer_psc_connection::State,
1751                >,
1752        >(
1753            mut self,
1754            v: T,
1755        ) -> Self {
1756            self.state = v.into();
1757            self
1758        }
1759
1760        /// Sets the value of [project][crate::model::service_connection_map::ConsumerPscConnection::project].
1761        pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1762            self.project = v.into();
1763            self
1764        }
1765
1766        /// Sets the value of [network][crate::model::service_connection_map::ConsumerPscConnection::network].
1767        pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1768            self.network = v.into();
1769            self
1770        }
1771
1772        /// Sets the value of [psc_connection_id][crate::model::service_connection_map::ConsumerPscConnection::psc_connection_id].
1773        pub fn set_psc_connection_id<T: std::convert::Into<std::string::String>>(
1774            mut self,
1775            v: T,
1776        ) -> Self {
1777            self.psc_connection_id = v.into();
1778            self
1779        }
1780
1781        /// Sets the value of [ip][crate::model::service_connection_map::ConsumerPscConnection::ip].
1782        pub fn set_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1783            self.ip = v.into();
1784            self
1785        }
1786
1787        /// Sets the value of [error_type][crate::model::service_connection_map::ConsumerPscConnection::error_type].
1788        #[deprecated]
1789        pub fn set_error_type<T: std::convert::Into<crate::model::ConnectionErrorType>>(
1790            mut self,
1791            v: T,
1792        ) -> Self {
1793            self.error_type = v.into();
1794            self
1795        }
1796
1797        /// Sets the value of [error][crate::model::service_connection_map::ConsumerPscConnection::error].
1798        #[deprecated]
1799        pub fn set_error<T>(mut self, v: T) -> Self
1800        where
1801            T: std::convert::Into<rpc::model::Status>,
1802        {
1803            self.error = std::option::Option::Some(v.into());
1804            self
1805        }
1806
1807        /// Sets or clears the value of [error][crate::model::service_connection_map::ConsumerPscConnection::error].
1808        #[deprecated]
1809        pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
1810        where
1811            T: std::convert::Into<rpc::model::Status>,
1812        {
1813            self.error = v.map(|x| x.into());
1814            self
1815        }
1816
1817        /// Sets the value of [gce_operation][crate::model::service_connection_map::ConsumerPscConnection::gce_operation].
1818        pub fn set_gce_operation<T: std::convert::Into<std::string::String>>(
1819            mut self,
1820            v: T,
1821        ) -> Self {
1822            self.gce_operation = v.into();
1823            self
1824        }
1825
1826        /// Sets the value of [forwarding_rule][crate::model::service_connection_map::ConsumerPscConnection::forwarding_rule].
1827        pub fn set_forwarding_rule<T: std::convert::Into<std::string::String>>(
1828            mut self,
1829            v: T,
1830        ) -> Self {
1831            self.forwarding_rule = v.into();
1832            self
1833        }
1834
1835        /// Sets the value of [error_info][crate::model::service_connection_map::ConsumerPscConnection::error_info].
1836        pub fn set_error_info<T>(mut self, v: T) -> Self
1837        where
1838            T: std::convert::Into<rpc::model::ErrorInfo>,
1839        {
1840            self.error_info = std::option::Option::Some(v.into());
1841            self
1842        }
1843
1844        /// Sets or clears the value of [error_info][crate::model::service_connection_map::ConsumerPscConnection::error_info].
1845        pub fn set_or_clear_error_info<T>(mut self, v: std::option::Option<T>) -> Self
1846        where
1847            T: std::convert::Into<rpc::model::ErrorInfo>,
1848        {
1849            self.error_info = v.map(|x| x.into());
1850            self
1851        }
1852
1853        /// Sets the value of [selected_subnetwork][crate::model::service_connection_map::ConsumerPscConnection::selected_subnetwork].
1854        pub fn set_selected_subnetwork<T: std::convert::Into<std::string::String>>(
1855            mut self,
1856            v: T,
1857        ) -> Self {
1858            self.selected_subnetwork = v.into();
1859            self
1860        }
1861
1862        /// Sets the value of [producer_instance_id][crate::model::service_connection_map::ConsumerPscConnection::producer_instance_id].
1863        #[deprecated]
1864        pub fn set_producer_instance_id<T: std::convert::Into<std::string::String>>(
1865            mut self,
1866            v: T,
1867        ) -> Self {
1868            self.producer_instance_id = v.into();
1869            self
1870        }
1871
1872        /// Sets the value of [producer_instance_metadata][crate::model::service_connection_map::ConsumerPscConnection::producer_instance_metadata].
1873        pub fn set_producer_instance_metadata<T, K, V>(mut self, v: T) -> Self
1874        where
1875            T: std::iter::IntoIterator<Item = (K, V)>,
1876            K: std::convert::Into<std::string::String>,
1877            V: std::convert::Into<std::string::String>,
1878        {
1879            use std::iter::Iterator;
1880            self.producer_instance_metadata =
1881                v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1882            self
1883        }
1884
1885        /// Sets the value of [ip_version][crate::model::service_connection_map::ConsumerPscConnection::ip_version].
1886        pub fn set_ip_version<T>(mut self, v: T) -> Self
1887        where
1888            T: std::convert::Into<crate::model::IPVersion>,
1889        {
1890            self.ip_version = std::option::Option::Some(v.into());
1891            self
1892        }
1893
1894        /// Sets or clears the value of [ip_version][crate::model::service_connection_map::ConsumerPscConnection::ip_version].
1895        pub fn set_or_clear_ip_version<T>(mut self, v: std::option::Option<T>) -> Self
1896        where
1897            T: std::convert::Into<crate::model::IPVersion>,
1898        {
1899            self.ip_version = v.map(|x| x.into());
1900            self
1901        }
1902    }
1903
1904    impl wkt::message::Message for ConsumerPscConnection {
1905        fn typename() -> &'static str {
1906            "type.googleapis.com/google.cloud.networkconnectivity.v1.ServiceConnectionMap.ConsumerPscConnection"
1907        }
1908    }
1909
1910    #[doc(hidden)]
1911    impl<'de> serde::de::Deserialize<'de> for ConsumerPscConnection {
1912        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1913        where
1914            D: serde::Deserializer<'de>,
1915        {
1916            #[allow(non_camel_case_types)]
1917            #[doc(hidden)]
1918            #[derive(PartialEq, Eq, Hash)]
1919            enum __FieldTag {
1920                __service_attachment_uri,
1921                __state,
1922                __project,
1923                __network,
1924                __psc_connection_id,
1925                __ip,
1926                __error_type,
1927                __error,
1928                __gce_operation,
1929                __forwarding_rule,
1930                __error_info,
1931                __selected_subnetwork,
1932                __producer_instance_id,
1933                __producer_instance_metadata,
1934                __ip_version,
1935                Unknown(std::string::String),
1936            }
1937            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1938                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1939                where
1940                    D: serde::Deserializer<'de>,
1941                {
1942                    struct Visitor;
1943                    impl<'de> serde::de::Visitor<'de> for Visitor {
1944                        type Value = __FieldTag;
1945                        fn expecting(
1946                            &self,
1947                            formatter: &mut std::fmt::Formatter,
1948                        ) -> std::fmt::Result {
1949                            formatter.write_str("a field name for ConsumerPscConnection")
1950                        }
1951                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1952                        where
1953                            E: serde::de::Error,
1954                        {
1955                            use std::result::Result::Ok;
1956                            use std::string::ToString;
1957                            match value {
1958                                "serviceAttachmentUri" => Ok(__FieldTag::__service_attachment_uri),
1959                                "service_attachment_uri" => {
1960                                    Ok(__FieldTag::__service_attachment_uri)
1961                                }
1962                                "state" => Ok(__FieldTag::__state),
1963                                "project" => Ok(__FieldTag::__project),
1964                                "network" => Ok(__FieldTag::__network),
1965                                "pscConnectionId" => Ok(__FieldTag::__psc_connection_id),
1966                                "psc_connection_id" => Ok(__FieldTag::__psc_connection_id),
1967                                "ip" => Ok(__FieldTag::__ip),
1968                                "errorType" => Ok(__FieldTag::__error_type),
1969                                "error_type" => Ok(__FieldTag::__error_type),
1970                                "error" => Ok(__FieldTag::__error),
1971                                "gceOperation" => Ok(__FieldTag::__gce_operation),
1972                                "gce_operation" => Ok(__FieldTag::__gce_operation),
1973                                "forwardingRule" => Ok(__FieldTag::__forwarding_rule),
1974                                "forwarding_rule" => Ok(__FieldTag::__forwarding_rule),
1975                                "errorInfo" => Ok(__FieldTag::__error_info),
1976                                "error_info" => Ok(__FieldTag::__error_info),
1977                                "selectedSubnetwork" => Ok(__FieldTag::__selected_subnetwork),
1978                                "selected_subnetwork" => Ok(__FieldTag::__selected_subnetwork),
1979                                "producerInstanceId" => Ok(__FieldTag::__producer_instance_id),
1980                                "producer_instance_id" => Ok(__FieldTag::__producer_instance_id),
1981                                "producerInstanceMetadata" => {
1982                                    Ok(__FieldTag::__producer_instance_metadata)
1983                                }
1984                                "producer_instance_metadata" => {
1985                                    Ok(__FieldTag::__producer_instance_metadata)
1986                                }
1987                                "ipVersion" => Ok(__FieldTag::__ip_version),
1988                                "ip_version" => Ok(__FieldTag::__ip_version),
1989                                _ => Ok(__FieldTag::Unknown(value.to_string())),
1990                            }
1991                        }
1992                    }
1993                    deserializer.deserialize_identifier(Visitor)
1994                }
1995            }
1996            struct Visitor;
1997            impl<'de> serde::de::Visitor<'de> for Visitor {
1998                type Value = ConsumerPscConnection;
1999                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2000                    formatter.write_str("struct ConsumerPscConnection")
2001                }
2002                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2003                where
2004                    A: serde::de::MapAccess<'de>,
2005                {
2006                    #[allow(unused_imports)]
2007                    use serde::de::Error;
2008                    use std::option::Option::Some;
2009                    let mut fields = std::collections::HashSet::new();
2010                    let mut result = Self::Value::new();
2011                    while let Some(tag) = map.next_key::<__FieldTag>()? {
2012                        #[allow(clippy::match_single_binding)]
2013                        match tag {
2014                            __FieldTag::__service_attachment_uri => {
2015                                if !fields.insert(__FieldTag::__service_attachment_uri) {
2016                                    return std::result::Result::Err(A::Error::duplicate_field(
2017                                        "multiple values for service_attachment_uri",
2018                                    ));
2019                                }
2020                                result.service_attachment_uri = map
2021                                    .next_value::<std::option::Option<std::string::String>>()?
2022                                    .unwrap_or_default();
2023                            }
2024                            __FieldTag::__state => {
2025                                if !fields.insert(__FieldTag::__state) {
2026                                    return std::result::Result::Err(A::Error::duplicate_field(
2027                                        "multiple values for state",
2028                                    ));
2029                                }
2030                                result.state = map.next_value::<std::option::Option<crate::model::service_connection_map::consumer_psc_connection::State>>()?.unwrap_or_default();
2031                            }
2032                            __FieldTag::__project => {
2033                                if !fields.insert(__FieldTag::__project) {
2034                                    return std::result::Result::Err(A::Error::duplicate_field(
2035                                        "multiple values for project",
2036                                    ));
2037                                }
2038                                result.project = map
2039                                    .next_value::<std::option::Option<std::string::String>>()?
2040                                    .unwrap_or_default();
2041                            }
2042                            __FieldTag::__network => {
2043                                if !fields.insert(__FieldTag::__network) {
2044                                    return std::result::Result::Err(A::Error::duplicate_field(
2045                                        "multiple values for network",
2046                                    ));
2047                                }
2048                                result.network = map
2049                                    .next_value::<std::option::Option<std::string::String>>()?
2050                                    .unwrap_or_default();
2051                            }
2052                            __FieldTag::__psc_connection_id => {
2053                                if !fields.insert(__FieldTag::__psc_connection_id) {
2054                                    return std::result::Result::Err(A::Error::duplicate_field(
2055                                        "multiple values for psc_connection_id",
2056                                    ));
2057                                }
2058                                result.psc_connection_id = map
2059                                    .next_value::<std::option::Option<std::string::String>>()?
2060                                    .unwrap_or_default();
2061                            }
2062                            __FieldTag::__ip => {
2063                                if !fields.insert(__FieldTag::__ip) {
2064                                    return std::result::Result::Err(A::Error::duplicate_field(
2065                                        "multiple values for ip",
2066                                    ));
2067                                }
2068                                result.ip = map
2069                                    .next_value::<std::option::Option<std::string::String>>()?
2070                                    .unwrap_or_default();
2071                            }
2072                            __FieldTag::__error_type => {
2073                                if !fields.insert(__FieldTag::__error_type) {
2074                                    return std::result::Result::Err(A::Error::duplicate_field(
2075                                        "multiple values for error_type",
2076                                    ));
2077                                }
2078                                result.error_type = map.next_value::<std::option::Option<crate::model::ConnectionErrorType>>()?.unwrap_or_default();
2079                            }
2080                            __FieldTag::__error => {
2081                                if !fields.insert(__FieldTag::__error) {
2082                                    return std::result::Result::Err(A::Error::duplicate_field(
2083                                        "multiple values for error",
2084                                    ));
2085                                }
2086                                result.error =
2087                                    map.next_value::<std::option::Option<rpc::model::Status>>()?;
2088                            }
2089                            __FieldTag::__gce_operation => {
2090                                if !fields.insert(__FieldTag::__gce_operation) {
2091                                    return std::result::Result::Err(A::Error::duplicate_field(
2092                                        "multiple values for gce_operation",
2093                                    ));
2094                                }
2095                                result.gce_operation = map
2096                                    .next_value::<std::option::Option<std::string::String>>()?
2097                                    .unwrap_or_default();
2098                            }
2099                            __FieldTag::__forwarding_rule => {
2100                                if !fields.insert(__FieldTag::__forwarding_rule) {
2101                                    return std::result::Result::Err(A::Error::duplicate_field(
2102                                        "multiple values for forwarding_rule",
2103                                    ));
2104                                }
2105                                result.forwarding_rule = map
2106                                    .next_value::<std::option::Option<std::string::String>>()?
2107                                    .unwrap_or_default();
2108                            }
2109                            __FieldTag::__error_info => {
2110                                if !fields.insert(__FieldTag::__error_info) {
2111                                    return std::result::Result::Err(A::Error::duplicate_field(
2112                                        "multiple values for error_info",
2113                                    ));
2114                                }
2115                                result.error_info =
2116                                    map.next_value::<std::option::Option<rpc::model::ErrorInfo>>()?;
2117                            }
2118                            __FieldTag::__selected_subnetwork => {
2119                                if !fields.insert(__FieldTag::__selected_subnetwork) {
2120                                    return std::result::Result::Err(A::Error::duplicate_field(
2121                                        "multiple values for selected_subnetwork",
2122                                    ));
2123                                }
2124                                result.selected_subnetwork = map
2125                                    .next_value::<std::option::Option<std::string::String>>()?
2126                                    .unwrap_or_default();
2127                            }
2128                            __FieldTag::__producer_instance_id => {
2129                                if !fields.insert(__FieldTag::__producer_instance_id) {
2130                                    return std::result::Result::Err(A::Error::duplicate_field(
2131                                        "multiple values for producer_instance_id",
2132                                    ));
2133                                }
2134                                result.producer_instance_id = map
2135                                    .next_value::<std::option::Option<std::string::String>>()?
2136                                    .unwrap_or_default();
2137                            }
2138                            __FieldTag::__producer_instance_metadata => {
2139                                if !fields.insert(__FieldTag::__producer_instance_metadata) {
2140                                    return std::result::Result::Err(A::Error::duplicate_field(
2141                                        "multiple values for producer_instance_metadata",
2142                                    ));
2143                                }
2144                                result.producer_instance_metadata = map
2145                                    .next_value::<std::option::Option<
2146                                        std::collections::HashMap<
2147                                            std::string::String,
2148                                            std::string::String,
2149                                        >,
2150                                    >>()?
2151                                    .unwrap_or_default();
2152                            }
2153                            __FieldTag::__ip_version => {
2154                                if !fields.insert(__FieldTag::__ip_version) {
2155                                    return std::result::Result::Err(A::Error::duplicate_field(
2156                                        "multiple values for ip_version",
2157                                    ));
2158                                }
2159                                result.ip_version = map
2160                                    .next_value::<std::option::Option<crate::model::IPVersion>>()?;
2161                            }
2162                            __FieldTag::Unknown(key) => {
2163                                let value = map.next_value::<serde_json::Value>()?;
2164                                result._unknown_fields.insert(key, value);
2165                            }
2166                        }
2167                    }
2168                    std::result::Result::Ok(result)
2169                }
2170            }
2171            deserializer.deserialize_any(Visitor)
2172        }
2173    }
2174
2175    #[doc(hidden)]
2176    impl serde::ser::Serialize for ConsumerPscConnection {
2177        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2178        where
2179            S: serde::ser::Serializer,
2180        {
2181            use serde::ser::SerializeMap;
2182            #[allow(unused_imports)]
2183            use std::option::Option::Some;
2184            let mut state = serializer.serialize_map(std::option::Option::None)?;
2185            if !self.service_attachment_uri.is_empty() {
2186                state.serialize_entry("serviceAttachmentUri", &self.service_attachment_uri)?;
2187            }
2188            if !wkt::internal::is_default(&self.state) {
2189                state.serialize_entry("state", &self.state)?;
2190            }
2191            if !self.project.is_empty() {
2192                state.serialize_entry("project", &self.project)?;
2193            }
2194            if !self.network.is_empty() {
2195                state.serialize_entry("network", &self.network)?;
2196            }
2197            if !self.psc_connection_id.is_empty() {
2198                state.serialize_entry("pscConnectionId", &self.psc_connection_id)?;
2199            }
2200            if !self.ip.is_empty() {
2201                state.serialize_entry("ip", &self.ip)?;
2202            }
2203            if !wkt::internal::is_default(&self.error_type) {
2204                state.serialize_entry("errorType", &self.error_type)?;
2205            }
2206            if self.error.is_some() {
2207                state.serialize_entry("error", &self.error)?;
2208            }
2209            if !self.gce_operation.is_empty() {
2210                state.serialize_entry("gceOperation", &self.gce_operation)?;
2211            }
2212            if !self.forwarding_rule.is_empty() {
2213                state.serialize_entry("forwardingRule", &self.forwarding_rule)?;
2214            }
2215            if self.error_info.is_some() {
2216                state.serialize_entry("errorInfo", &self.error_info)?;
2217            }
2218            if !self.selected_subnetwork.is_empty() {
2219                state.serialize_entry("selectedSubnetwork", &self.selected_subnetwork)?;
2220            }
2221            if !self.producer_instance_id.is_empty() {
2222                state.serialize_entry("producerInstanceId", &self.producer_instance_id)?;
2223            }
2224            if !self.producer_instance_metadata.is_empty() {
2225                state.serialize_entry(
2226                    "producerInstanceMetadata",
2227                    &self.producer_instance_metadata,
2228                )?;
2229            }
2230            if self.ip_version.is_some() {
2231                state.serialize_entry("ipVersion", &self.ip_version)?;
2232            }
2233            if !self._unknown_fields.is_empty() {
2234                for (key, value) in self._unknown_fields.iter() {
2235                    state.serialize_entry(key, &value)?;
2236                }
2237            }
2238            state.end()
2239        }
2240    }
2241
2242    impl std::fmt::Debug for ConsumerPscConnection {
2243        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2244            let mut debug_struct = f.debug_struct("ConsumerPscConnection");
2245            debug_struct.field("service_attachment_uri", &self.service_attachment_uri);
2246            debug_struct.field("state", &self.state);
2247            debug_struct.field("project", &self.project);
2248            debug_struct.field("network", &self.network);
2249            debug_struct.field("psc_connection_id", &self.psc_connection_id);
2250            debug_struct.field("ip", &self.ip);
2251            debug_struct.field("error_type", &self.error_type);
2252            debug_struct.field("error", &self.error);
2253            debug_struct.field("gce_operation", &self.gce_operation);
2254            debug_struct.field("forwarding_rule", &self.forwarding_rule);
2255            debug_struct.field("error_info", &self.error_info);
2256            debug_struct.field("selected_subnetwork", &self.selected_subnetwork);
2257            debug_struct.field("producer_instance_id", &self.producer_instance_id);
2258            debug_struct.field(
2259                "producer_instance_metadata",
2260                &self.producer_instance_metadata,
2261            );
2262            debug_struct.field("ip_version", &self.ip_version);
2263            if !self._unknown_fields.is_empty() {
2264                debug_struct.field("_unknown_fields", &self._unknown_fields);
2265            }
2266            debug_struct.finish()
2267        }
2268    }
2269
2270    /// Defines additional types related to [ConsumerPscConnection].
2271    pub mod consumer_psc_connection {
2272        #[allow(unused_imports)]
2273        use super::*;
2274
2275        /// The state of the PSC connection.
2276        /// We reserve the right to add more states without notice in the future.
2277        /// Users should not use exhaustive switch statements on this enum.
2278        /// See <https://google.aip.dev/216>.
2279        ///
2280        /// # Working with unknown values
2281        ///
2282        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2283        /// additional enum variants at any time. Adding new variants is not considered
2284        /// a breaking change. Applications should write their code in anticipation of:
2285        ///
2286        /// - New values appearing in future releases of the client library, **and**
2287        /// - New values received dynamically, without application changes.
2288        ///
2289        /// Please consult the [Working with enums] section in the user guide for some
2290        /// guidelines.
2291        ///
2292        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2293        #[derive(Clone, Debug, PartialEq)]
2294        #[non_exhaustive]
2295        pub enum State {
2296            /// An invalid state as the default case.
2297            Unspecified,
2298            /// The connection has been created successfully. However, for the
2299            /// up-to-date connection status, please use the service attachment's
2300            /// "ConnectedEndpoint.status" as the source of truth.
2301            Active,
2302            /// The connection is not functional since some resources on the connection
2303            /// fail to be created.
2304            Failed,
2305            /// The connection is being created.
2306            Creating,
2307            /// The connection is being deleted.
2308            Deleting,
2309            /// The connection is being repaired to complete creation.
2310            CreateRepairing,
2311            /// The connection is being repaired to complete deletion.
2312            DeleteRepairing,
2313            /// If set, the enum was initialized with an unknown value.
2314            ///
2315            /// Applications can examine the value using [State::value] or
2316            /// [State::name].
2317            UnknownValue(state::UnknownValue),
2318        }
2319
2320        #[doc(hidden)]
2321        pub mod state {
2322            #[allow(unused_imports)]
2323            use super::*;
2324            #[derive(Clone, Debug, PartialEq)]
2325            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2326        }
2327
2328        impl State {
2329            /// Gets the enum value.
2330            ///
2331            /// Returns `None` if the enum contains an unknown value deserialized from
2332            /// the string representation of enums.
2333            pub fn value(&self) -> std::option::Option<i32> {
2334                match self {
2335                    Self::Unspecified => std::option::Option::Some(0),
2336                    Self::Active => std::option::Option::Some(1),
2337                    Self::Failed => std::option::Option::Some(2),
2338                    Self::Creating => std::option::Option::Some(3),
2339                    Self::Deleting => std::option::Option::Some(4),
2340                    Self::CreateRepairing => std::option::Option::Some(5),
2341                    Self::DeleteRepairing => std::option::Option::Some(6),
2342                    Self::UnknownValue(u) => u.0.value(),
2343                }
2344            }
2345
2346            /// Gets the enum value as a string.
2347            ///
2348            /// Returns `None` if the enum contains an unknown value deserialized from
2349            /// the integer representation of enums.
2350            pub fn name(&self) -> std::option::Option<&str> {
2351                match self {
2352                    Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2353                    Self::Active => std::option::Option::Some("ACTIVE"),
2354                    Self::Failed => std::option::Option::Some("FAILED"),
2355                    Self::Creating => std::option::Option::Some("CREATING"),
2356                    Self::Deleting => std::option::Option::Some("DELETING"),
2357                    Self::CreateRepairing => std::option::Option::Some("CREATE_REPAIRING"),
2358                    Self::DeleteRepairing => std::option::Option::Some("DELETE_REPAIRING"),
2359                    Self::UnknownValue(u) => u.0.name(),
2360                }
2361            }
2362        }
2363
2364        impl std::default::Default for State {
2365            fn default() -> Self {
2366                use std::convert::From;
2367                Self::from(0)
2368            }
2369        }
2370
2371        impl std::fmt::Display for State {
2372            fn fmt(
2373                &self,
2374                f: &mut std::fmt::Formatter<'_>,
2375            ) -> std::result::Result<(), std::fmt::Error> {
2376                wkt::internal::display_enum(f, self.name(), self.value())
2377            }
2378        }
2379
2380        impl std::convert::From<i32> for State {
2381            fn from(value: i32) -> Self {
2382                match value {
2383                    0 => Self::Unspecified,
2384                    1 => Self::Active,
2385                    2 => Self::Failed,
2386                    3 => Self::Creating,
2387                    4 => Self::Deleting,
2388                    5 => Self::CreateRepairing,
2389                    6 => Self::DeleteRepairing,
2390                    _ => Self::UnknownValue(state::UnknownValue(
2391                        wkt::internal::UnknownEnumValue::Integer(value),
2392                    )),
2393                }
2394            }
2395        }
2396
2397        impl std::convert::From<&str> for State {
2398            fn from(value: &str) -> Self {
2399                use std::string::ToString;
2400                match value {
2401                    "STATE_UNSPECIFIED" => Self::Unspecified,
2402                    "ACTIVE" => Self::Active,
2403                    "FAILED" => Self::Failed,
2404                    "CREATING" => Self::Creating,
2405                    "DELETING" => Self::Deleting,
2406                    "CREATE_REPAIRING" => Self::CreateRepairing,
2407                    "DELETE_REPAIRING" => Self::DeleteRepairing,
2408                    _ => Self::UnknownValue(state::UnknownValue(
2409                        wkt::internal::UnknownEnumValue::String(value.to_string()),
2410                    )),
2411                }
2412            }
2413        }
2414
2415        impl serde::ser::Serialize for State {
2416            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2417            where
2418                S: serde::Serializer,
2419            {
2420                match self {
2421                    Self::Unspecified => serializer.serialize_i32(0),
2422                    Self::Active => serializer.serialize_i32(1),
2423                    Self::Failed => serializer.serialize_i32(2),
2424                    Self::Creating => serializer.serialize_i32(3),
2425                    Self::Deleting => serializer.serialize_i32(4),
2426                    Self::CreateRepairing => serializer.serialize_i32(5),
2427                    Self::DeleteRepairing => serializer.serialize_i32(6),
2428                    Self::UnknownValue(u) => u.0.serialize(serializer),
2429                }
2430            }
2431        }
2432
2433        impl<'de> serde::de::Deserialize<'de> for State {
2434            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2435            where
2436                D: serde::Deserializer<'de>,
2437            {
2438                deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2439                    ".google.cloud.networkconnectivity.v1.ServiceConnectionMap.ConsumerPscConnection.State"))
2440            }
2441        }
2442    }
2443}
2444
2445/// Request for ListServiceConnectionMaps.
2446#[derive(Clone, Default, PartialEq)]
2447#[non_exhaustive]
2448pub struct ListServiceConnectionMapsRequest {
2449    /// Required. The parent resource's name. ex. projects/123/locations/us-east1
2450    pub parent: std::string::String,
2451
2452    /// The maximum number of results per page that should be returned.
2453    pub page_size: i32,
2454
2455    /// The page token.
2456    pub page_token: std::string::String,
2457
2458    /// A filter expression that filters the results listed in the response.
2459    pub filter: std::string::String,
2460
2461    /// Sort the results by a certain order.
2462    pub order_by: std::string::String,
2463
2464    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2465}
2466
2467impl ListServiceConnectionMapsRequest {
2468    pub fn new() -> Self {
2469        std::default::Default::default()
2470    }
2471
2472    /// Sets the value of [parent][crate::model::ListServiceConnectionMapsRequest::parent].
2473    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2474        self.parent = v.into();
2475        self
2476    }
2477
2478    /// Sets the value of [page_size][crate::model::ListServiceConnectionMapsRequest::page_size].
2479    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2480        self.page_size = v.into();
2481        self
2482    }
2483
2484    /// Sets the value of [page_token][crate::model::ListServiceConnectionMapsRequest::page_token].
2485    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2486        self.page_token = v.into();
2487        self
2488    }
2489
2490    /// Sets the value of [filter][crate::model::ListServiceConnectionMapsRequest::filter].
2491    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2492        self.filter = v.into();
2493        self
2494    }
2495
2496    /// Sets the value of [order_by][crate::model::ListServiceConnectionMapsRequest::order_by].
2497    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2498        self.order_by = v.into();
2499        self
2500    }
2501}
2502
2503impl wkt::message::Message for ListServiceConnectionMapsRequest {
2504    fn typename() -> &'static str {
2505        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListServiceConnectionMapsRequest"
2506    }
2507}
2508
2509#[doc(hidden)]
2510impl<'de> serde::de::Deserialize<'de> for ListServiceConnectionMapsRequest {
2511    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2512    where
2513        D: serde::Deserializer<'de>,
2514    {
2515        #[allow(non_camel_case_types)]
2516        #[doc(hidden)]
2517        #[derive(PartialEq, Eq, Hash)]
2518        enum __FieldTag {
2519            __parent,
2520            __page_size,
2521            __page_token,
2522            __filter,
2523            __order_by,
2524            Unknown(std::string::String),
2525        }
2526        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2527            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2528            where
2529                D: serde::Deserializer<'de>,
2530            {
2531                struct Visitor;
2532                impl<'de> serde::de::Visitor<'de> for Visitor {
2533                    type Value = __FieldTag;
2534                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2535                        formatter.write_str("a field name for ListServiceConnectionMapsRequest")
2536                    }
2537                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2538                    where
2539                        E: serde::de::Error,
2540                    {
2541                        use std::result::Result::Ok;
2542                        use std::string::ToString;
2543                        match value {
2544                            "parent" => Ok(__FieldTag::__parent),
2545                            "pageSize" => Ok(__FieldTag::__page_size),
2546                            "page_size" => Ok(__FieldTag::__page_size),
2547                            "pageToken" => Ok(__FieldTag::__page_token),
2548                            "page_token" => Ok(__FieldTag::__page_token),
2549                            "filter" => Ok(__FieldTag::__filter),
2550                            "orderBy" => Ok(__FieldTag::__order_by),
2551                            "order_by" => Ok(__FieldTag::__order_by),
2552                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2553                        }
2554                    }
2555                }
2556                deserializer.deserialize_identifier(Visitor)
2557            }
2558        }
2559        struct Visitor;
2560        impl<'de> serde::de::Visitor<'de> for Visitor {
2561            type Value = ListServiceConnectionMapsRequest;
2562            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2563                formatter.write_str("struct ListServiceConnectionMapsRequest")
2564            }
2565            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2566            where
2567                A: serde::de::MapAccess<'de>,
2568            {
2569                #[allow(unused_imports)]
2570                use serde::de::Error;
2571                use std::option::Option::Some;
2572                let mut fields = std::collections::HashSet::new();
2573                let mut result = Self::Value::new();
2574                while let Some(tag) = map.next_key::<__FieldTag>()? {
2575                    #[allow(clippy::match_single_binding)]
2576                    match tag {
2577                        __FieldTag::__parent => {
2578                            if !fields.insert(__FieldTag::__parent) {
2579                                return std::result::Result::Err(A::Error::duplicate_field(
2580                                    "multiple values for parent",
2581                                ));
2582                            }
2583                            result.parent = map
2584                                .next_value::<std::option::Option<std::string::String>>()?
2585                                .unwrap_or_default();
2586                        }
2587                        __FieldTag::__page_size => {
2588                            if !fields.insert(__FieldTag::__page_size) {
2589                                return std::result::Result::Err(A::Error::duplicate_field(
2590                                    "multiple values for page_size",
2591                                ));
2592                            }
2593                            struct __With(std::option::Option<i32>);
2594                            impl<'de> serde::de::Deserialize<'de> for __With {
2595                                fn deserialize<D>(
2596                                    deserializer: D,
2597                                ) -> std::result::Result<Self, D::Error>
2598                                where
2599                                    D: serde::de::Deserializer<'de>,
2600                                {
2601                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2602                                }
2603                            }
2604                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
2605                        }
2606                        __FieldTag::__page_token => {
2607                            if !fields.insert(__FieldTag::__page_token) {
2608                                return std::result::Result::Err(A::Error::duplicate_field(
2609                                    "multiple values for page_token",
2610                                ));
2611                            }
2612                            result.page_token = map
2613                                .next_value::<std::option::Option<std::string::String>>()?
2614                                .unwrap_or_default();
2615                        }
2616                        __FieldTag::__filter => {
2617                            if !fields.insert(__FieldTag::__filter) {
2618                                return std::result::Result::Err(A::Error::duplicate_field(
2619                                    "multiple values for filter",
2620                                ));
2621                            }
2622                            result.filter = map
2623                                .next_value::<std::option::Option<std::string::String>>()?
2624                                .unwrap_or_default();
2625                        }
2626                        __FieldTag::__order_by => {
2627                            if !fields.insert(__FieldTag::__order_by) {
2628                                return std::result::Result::Err(A::Error::duplicate_field(
2629                                    "multiple values for order_by",
2630                                ));
2631                            }
2632                            result.order_by = map
2633                                .next_value::<std::option::Option<std::string::String>>()?
2634                                .unwrap_or_default();
2635                        }
2636                        __FieldTag::Unknown(key) => {
2637                            let value = map.next_value::<serde_json::Value>()?;
2638                            result._unknown_fields.insert(key, value);
2639                        }
2640                    }
2641                }
2642                std::result::Result::Ok(result)
2643            }
2644        }
2645        deserializer.deserialize_any(Visitor)
2646    }
2647}
2648
2649#[doc(hidden)]
2650impl serde::ser::Serialize for ListServiceConnectionMapsRequest {
2651    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2652    where
2653        S: serde::ser::Serializer,
2654    {
2655        use serde::ser::SerializeMap;
2656        #[allow(unused_imports)]
2657        use std::option::Option::Some;
2658        let mut state = serializer.serialize_map(std::option::Option::None)?;
2659        if !self.parent.is_empty() {
2660            state.serialize_entry("parent", &self.parent)?;
2661        }
2662        if !wkt::internal::is_default(&self.page_size) {
2663            struct __With<'a>(&'a i32);
2664            impl<'a> serde::ser::Serialize for __With<'a> {
2665                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2666                where
2667                    S: serde::ser::Serializer,
2668                {
2669                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2670                }
2671            }
2672            state.serialize_entry("pageSize", &__With(&self.page_size))?;
2673        }
2674        if !self.page_token.is_empty() {
2675            state.serialize_entry("pageToken", &self.page_token)?;
2676        }
2677        if !self.filter.is_empty() {
2678            state.serialize_entry("filter", &self.filter)?;
2679        }
2680        if !self.order_by.is_empty() {
2681            state.serialize_entry("orderBy", &self.order_by)?;
2682        }
2683        if !self._unknown_fields.is_empty() {
2684            for (key, value) in self._unknown_fields.iter() {
2685                state.serialize_entry(key, &value)?;
2686            }
2687        }
2688        state.end()
2689    }
2690}
2691
2692impl std::fmt::Debug for ListServiceConnectionMapsRequest {
2693    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2694        let mut debug_struct = f.debug_struct("ListServiceConnectionMapsRequest");
2695        debug_struct.field("parent", &self.parent);
2696        debug_struct.field("page_size", &self.page_size);
2697        debug_struct.field("page_token", &self.page_token);
2698        debug_struct.field("filter", &self.filter);
2699        debug_struct.field("order_by", &self.order_by);
2700        if !self._unknown_fields.is_empty() {
2701            debug_struct.field("_unknown_fields", &self._unknown_fields);
2702        }
2703        debug_struct.finish()
2704    }
2705}
2706
2707/// Response for ListServiceConnectionMaps.
2708#[derive(Clone, Default, PartialEq)]
2709#[non_exhaustive]
2710pub struct ListServiceConnectionMapsResponse {
2711    /// ServiceConnectionMaps to be returned.
2712    pub service_connection_maps: std::vec::Vec<crate::model::ServiceConnectionMap>,
2713
2714    /// The next pagination token in the List response. It should be used as
2715    /// page_token for the following request. An empty value means no more result.
2716    pub next_page_token: std::string::String,
2717
2718    /// Locations that could not be reached.
2719    pub unreachable: std::vec::Vec<std::string::String>,
2720
2721    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2722}
2723
2724impl ListServiceConnectionMapsResponse {
2725    pub fn new() -> Self {
2726        std::default::Default::default()
2727    }
2728
2729    /// Sets the value of [service_connection_maps][crate::model::ListServiceConnectionMapsResponse::service_connection_maps].
2730    pub fn set_service_connection_maps<T, V>(mut self, v: T) -> Self
2731    where
2732        T: std::iter::IntoIterator<Item = V>,
2733        V: std::convert::Into<crate::model::ServiceConnectionMap>,
2734    {
2735        use std::iter::Iterator;
2736        self.service_connection_maps = v.into_iter().map(|i| i.into()).collect();
2737        self
2738    }
2739
2740    /// Sets the value of [next_page_token][crate::model::ListServiceConnectionMapsResponse::next_page_token].
2741    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2742        self.next_page_token = v.into();
2743        self
2744    }
2745
2746    /// Sets the value of [unreachable][crate::model::ListServiceConnectionMapsResponse::unreachable].
2747    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
2748    where
2749        T: std::iter::IntoIterator<Item = V>,
2750        V: std::convert::Into<std::string::String>,
2751    {
2752        use std::iter::Iterator;
2753        self.unreachable = v.into_iter().map(|i| i.into()).collect();
2754        self
2755    }
2756}
2757
2758impl wkt::message::Message for ListServiceConnectionMapsResponse {
2759    fn typename() -> &'static str {
2760        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListServiceConnectionMapsResponse"
2761    }
2762}
2763
2764#[doc(hidden)]
2765impl gax::paginator::internal::PageableResponse for ListServiceConnectionMapsResponse {
2766    type PageItem = crate::model::ServiceConnectionMap;
2767
2768    fn items(self) -> std::vec::Vec<Self::PageItem> {
2769        self.service_connection_maps
2770    }
2771
2772    fn next_page_token(&self) -> std::string::String {
2773        use std::clone::Clone;
2774        self.next_page_token.clone()
2775    }
2776}
2777
2778#[doc(hidden)]
2779impl<'de> serde::de::Deserialize<'de> for ListServiceConnectionMapsResponse {
2780    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2781    where
2782        D: serde::Deserializer<'de>,
2783    {
2784        #[allow(non_camel_case_types)]
2785        #[doc(hidden)]
2786        #[derive(PartialEq, Eq, Hash)]
2787        enum __FieldTag {
2788            __service_connection_maps,
2789            __next_page_token,
2790            __unreachable,
2791            Unknown(std::string::String),
2792        }
2793        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2794            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2795            where
2796                D: serde::Deserializer<'de>,
2797            {
2798                struct Visitor;
2799                impl<'de> serde::de::Visitor<'de> for Visitor {
2800                    type Value = __FieldTag;
2801                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2802                        formatter.write_str("a field name for ListServiceConnectionMapsResponse")
2803                    }
2804                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2805                    where
2806                        E: serde::de::Error,
2807                    {
2808                        use std::result::Result::Ok;
2809                        use std::string::ToString;
2810                        match value {
2811                            "serviceConnectionMaps" => Ok(__FieldTag::__service_connection_maps),
2812                            "service_connection_maps" => Ok(__FieldTag::__service_connection_maps),
2813                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
2814                            "next_page_token" => Ok(__FieldTag::__next_page_token),
2815                            "unreachable" => Ok(__FieldTag::__unreachable),
2816                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2817                        }
2818                    }
2819                }
2820                deserializer.deserialize_identifier(Visitor)
2821            }
2822        }
2823        struct Visitor;
2824        impl<'de> serde::de::Visitor<'de> for Visitor {
2825            type Value = ListServiceConnectionMapsResponse;
2826            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2827                formatter.write_str("struct ListServiceConnectionMapsResponse")
2828            }
2829            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2830            where
2831                A: serde::de::MapAccess<'de>,
2832            {
2833                #[allow(unused_imports)]
2834                use serde::de::Error;
2835                use std::option::Option::Some;
2836                let mut fields = std::collections::HashSet::new();
2837                let mut result = Self::Value::new();
2838                while let Some(tag) = map.next_key::<__FieldTag>()? {
2839                    #[allow(clippy::match_single_binding)]
2840                    match tag {
2841                        __FieldTag::__service_connection_maps => {
2842                            if !fields.insert(__FieldTag::__service_connection_maps) {
2843                                return std::result::Result::Err(A::Error::duplicate_field(
2844                                    "multiple values for service_connection_maps",
2845                                ));
2846                            }
2847                            result.service_connection_maps = map
2848                                .next_value::<std::option::Option<
2849                                    std::vec::Vec<crate::model::ServiceConnectionMap>,
2850                                >>()?
2851                                .unwrap_or_default();
2852                        }
2853                        __FieldTag::__next_page_token => {
2854                            if !fields.insert(__FieldTag::__next_page_token) {
2855                                return std::result::Result::Err(A::Error::duplicate_field(
2856                                    "multiple values for next_page_token",
2857                                ));
2858                            }
2859                            result.next_page_token = map
2860                                .next_value::<std::option::Option<std::string::String>>()?
2861                                .unwrap_or_default();
2862                        }
2863                        __FieldTag::__unreachable => {
2864                            if !fields.insert(__FieldTag::__unreachable) {
2865                                return std::result::Result::Err(A::Error::duplicate_field(
2866                                    "multiple values for unreachable",
2867                                ));
2868                            }
2869                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
2870                        }
2871                        __FieldTag::Unknown(key) => {
2872                            let value = map.next_value::<serde_json::Value>()?;
2873                            result._unknown_fields.insert(key, value);
2874                        }
2875                    }
2876                }
2877                std::result::Result::Ok(result)
2878            }
2879        }
2880        deserializer.deserialize_any(Visitor)
2881    }
2882}
2883
2884#[doc(hidden)]
2885impl serde::ser::Serialize for ListServiceConnectionMapsResponse {
2886    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2887    where
2888        S: serde::ser::Serializer,
2889    {
2890        use serde::ser::SerializeMap;
2891        #[allow(unused_imports)]
2892        use std::option::Option::Some;
2893        let mut state = serializer.serialize_map(std::option::Option::None)?;
2894        if !self.service_connection_maps.is_empty() {
2895            state.serialize_entry("serviceConnectionMaps", &self.service_connection_maps)?;
2896        }
2897        if !self.next_page_token.is_empty() {
2898            state.serialize_entry("nextPageToken", &self.next_page_token)?;
2899        }
2900        if !self.unreachable.is_empty() {
2901            state.serialize_entry("unreachable", &self.unreachable)?;
2902        }
2903        if !self._unknown_fields.is_empty() {
2904            for (key, value) in self._unknown_fields.iter() {
2905                state.serialize_entry(key, &value)?;
2906            }
2907        }
2908        state.end()
2909    }
2910}
2911
2912impl std::fmt::Debug for ListServiceConnectionMapsResponse {
2913    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2914        let mut debug_struct = f.debug_struct("ListServiceConnectionMapsResponse");
2915        debug_struct.field("service_connection_maps", &self.service_connection_maps);
2916        debug_struct.field("next_page_token", &self.next_page_token);
2917        debug_struct.field("unreachable", &self.unreachable);
2918        if !self._unknown_fields.is_empty() {
2919            debug_struct.field("_unknown_fields", &self._unknown_fields);
2920        }
2921        debug_struct.finish()
2922    }
2923}
2924
2925/// Request for GetServiceConnectionMap.
2926#[derive(Clone, Default, PartialEq)]
2927#[non_exhaustive]
2928pub struct GetServiceConnectionMapRequest {
2929    /// Required. Name of the ServiceConnectionMap to get.
2930    pub name: std::string::String,
2931
2932    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2933}
2934
2935impl GetServiceConnectionMapRequest {
2936    pub fn new() -> Self {
2937        std::default::Default::default()
2938    }
2939
2940    /// Sets the value of [name][crate::model::GetServiceConnectionMapRequest::name].
2941    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2942        self.name = v.into();
2943        self
2944    }
2945}
2946
2947impl wkt::message::Message for GetServiceConnectionMapRequest {
2948    fn typename() -> &'static str {
2949        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetServiceConnectionMapRequest"
2950    }
2951}
2952
2953#[doc(hidden)]
2954impl<'de> serde::de::Deserialize<'de> for GetServiceConnectionMapRequest {
2955    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2956    where
2957        D: serde::Deserializer<'de>,
2958    {
2959        #[allow(non_camel_case_types)]
2960        #[doc(hidden)]
2961        #[derive(PartialEq, Eq, Hash)]
2962        enum __FieldTag {
2963            __name,
2964            Unknown(std::string::String),
2965        }
2966        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2967            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2968            where
2969                D: serde::Deserializer<'de>,
2970            {
2971                struct Visitor;
2972                impl<'de> serde::de::Visitor<'de> for Visitor {
2973                    type Value = __FieldTag;
2974                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2975                        formatter.write_str("a field name for GetServiceConnectionMapRequest")
2976                    }
2977                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2978                    where
2979                        E: serde::de::Error,
2980                    {
2981                        use std::result::Result::Ok;
2982                        use std::string::ToString;
2983                        match value {
2984                            "name" => Ok(__FieldTag::__name),
2985                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2986                        }
2987                    }
2988                }
2989                deserializer.deserialize_identifier(Visitor)
2990            }
2991        }
2992        struct Visitor;
2993        impl<'de> serde::de::Visitor<'de> for Visitor {
2994            type Value = GetServiceConnectionMapRequest;
2995            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2996                formatter.write_str("struct GetServiceConnectionMapRequest")
2997            }
2998            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2999            where
3000                A: serde::de::MapAccess<'de>,
3001            {
3002                #[allow(unused_imports)]
3003                use serde::de::Error;
3004                use std::option::Option::Some;
3005                let mut fields = std::collections::HashSet::new();
3006                let mut result = Self::Value::new();
3007                while let Some(tag) = map.next_key::<__FieldTag>()? {
3008                    #[allow(clippy::match_single_binding)]
3009                    match tag {
3010                        __FieldTag::__name => {
3011                            if !fields.insert(__FieldTag::__name) {
3012                                return std::result::Result::Err(A::Error::duplicate_field(
3013                                    "multiple values for name",
3014                                ));
3015                            }
3016                            result.name = map
3017                                .next_value::<std::option::Option<std::string::String>>()?
3018                                .unwrap_or_default();
3019                        }
3020                        __FieldTag::Unknown(key) => {
3021                            let value = map.next_value::<serde_json::Value>()?;
3022                            result._unknown_fields.insert(key, value);
3023                        }
3024                    }
3025                }
3026                std::result::Result::Ok(result)
3027            }
3028        }
3029        deserializer.deserialize_any(Visitor)
3030    }
3031}
3032
3033#[doc(hidden)]
3034impl serde::ser::Serialize for GetServiceConnectionMapRequest {
3035    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3036    where
3037        S: serde::ser::Serializer,
3038    {
3039        use serde::ser::SerializeMap;
3040        #[allow(unused_imports)]
3041        use std::option::Option::Some;
3042        let mut state = serializer.serialize_map(std::option::Option::None)?;
3043        if !self.name.is_empty() {
3044            state.serialize_entry("name", &self.name)?;
3045        }
3046        if !self._unknown_fields.is_empty() {
3047            for (key, value) in self._unknown_fields.iter() {
3048                state.serialize_entry(key, &value)?;
3049            }
3050        }
3051        state.end()
3052    }
3053}
3054
3055impl std::fmt::Debug for GetServiceConnectionMapRequest {
3056    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3057        let mut debug_struct = f.debug_struct("GetServiceConnectionMapRequest");
3058        debug_struct.field("name", &self.name);
3059        if !self._unknown_fields.is_empty() {
3060            debug_struct.field("_unknown_fields", &self._unknown_fields);
3061        }
3062        debug_struct.finish()
3063    }
3064}
3065
3066/// Request for CreateServiceConnectionMap.
3067#[derive(Clone, Default, PartialEq)]
3068#[non_exhaustive]
3069pub struct CreateServiceConnectionMapRequest {
3070    /// Required. The parent resource's name of the ServiceConnectionMap. ex.
3071    /// projects/123/locations/us-east1
3072    pub parent: std::string::String,
3073
3074    /// Optional. Resource ID
3075    /// (i.e. 'foo' in '[...]/projects/p/locations/l/serviceConnectionMaps/foo')
3076    /// See <https://google.aip.dev/122#resource-id-segments>
3077    /// Unique per location.
3078    /// If one is not provided, one will be generated.
3079    pub service_connection_map_id: std::string::String,
3080
3081    /// Required. Initial values for a new ServiceConnectionMaps
3082    pub service_connection_map: std::option::Option<crate::model::ServiceConnectionMap>,
3083
3084    /// Optional. An optional request ID to identify requests. Specify a unique
3085    /// request ID so that if you must retry your request, the server will know to
3086    /// ignore the request if it has already been completed. The server will
3087    /// guarantee that for at least 60 minutes since the first request.
3088    ///
3089    /// For example, consider a situation where you make an initial request and
3090    /// the request times out. If you make the request again with the same request
3091    /// ID, the server can check if original operation with the same request ID
3092    /// was received, and if so, will ignore the second request. This prevents
3093    /// clients from accidentally creating duplicate commitments.
3094    ///
3095    /// The request ID must be a valid UUID with the exception that zero UUID is
3096    /// not supported (00000000-0000-0000-0000-000000000000).
3097    pub request_id: std::string::String,
3098
3099    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3100}
3101
3102impl CreateServiceConnectionMapRequest {
3103    pub fn new() -> Self {
3104        std::default::Default::default()
3105    }
3106
3107    /// Sets the value of [parent][crate::model::CreateServiceConnectionMapRequest::parent].
3108    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3109        self.parent = v.into();
3110        self
3111    }
3112
3113    /// Sets the value of [service_connection_map_id][crate::model::CreateServiceConnectionMapRequest::service_connection_map_id].
3114    pub fn set_service_connection_map_id<T: std::convert::Into<std::string::String>>(
3115        mut self,
3116        v: T,
3117    ) -> Self {
3118        self.service_connection_map_id = v.into();
3119        self
3120    }
3121
3122    /// Sets the value of [service_connection_map][crate::model::CreateServiceConnectionMapRequest::service_connection_map].
3123    pub fn set_service_connection_map<T>(mut self, v: T) -> Self
3124    where
3125        T: std::convert::Into<crate::model::ServiceConnectionMap>,
3126    {
3127        self.service_connection_map = std::option::Option::Some(v.into());
3128        self
3129    }
3130
3131    /// Sets or clears the value of [service_connection_map][crate::model::CreateServiceConnectionMapRequest::service_connection_map].
3132    pub fn set_or_clear_service_connection_map<T>(mut self, v: std::option::Option<T>) -> Self
3133    where
3134        T: std::convert::Into<crate::model::ServiceConnectionMap>,
3135    {
3136        self.service_connection_map = v.map(|x| x.into());
3137        self
3138    }
3139
3140    /// Sets the value of [request_id][crate::model::CreateServiceConnectionMapRequest::request_id].
3141    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3142        self.request_id = v.into();
3143        self
3144    }
3145}
3146
3147impl wkt::message::Message for CreateServiceConnectionMapRequest {
3148    fn typename() -> &'static str {
3149        "type.googleapis.com/google.cloud.networkconnectivity.v1.CreateServiceConnectionMapRequest"
3150    }
3151}
3152
3153#[doc(hidden)]
3154impl<'de> serde::de::Deserialize<'de> for CreateServiceConnectionMapRequest {
3155    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3156    where
3157        D: serde::Deserializer<'de>,
3158    {
3159        #[allow(non_camel_case_types)]
3160        #[doc(hidden)]
3161        #[derive(PartialEq, Eq, Hash)]
3162        enum __FieldTag {
3163            __parent,
3164            __service_connection_map_id,
3165            __service_connection_map,
3166            __request_id,
3167            Unknown(std::string::String),
3168        }
3169        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3170            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3171            where
3172                D: serde::Deserializer<'de>,
3173            {
3174                struct Visitor;
3175                impl<'de> serde::de::Visitor<'de> for Visitor {
3176                    type Value = __FieldTag;
3177                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3178                        formatter.write_str("a field name for CreateServiceConnectionMapRequest")
3179                    }
3180                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3181                    where
3182                        E: serde::de::Error,
3183                    {
3184                        use std::result::Result::Ok;
3185                        use std::string::ToString;
3186                        match value {
3187                            "parent" => Ok(__FieldTag::__parent),
3188                            "serviceConnectionMapId" => Ok(__FieldTag::__service_connection_map_id),
3189                            "service_connection_map_id" => {
3190                                Ok(__FieldTag::__service_connection_map_id)
3191                            }
3192                            "serviceConnectionMap" => Ok(__FieldTag::__service_connection_map),
3193                            "service_connection_map" => Ok(__FieldTag::__service_connection_map),
3194                            "requestId" => Ok(__FieldTag::__request_id),
3195                            "request_id" => Ok(__FieldTag::__request_id),
3196                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3197                        }
3198                    }
3199                }
3200                deserializer.deserialize_identifier(Visitor)
3201            }
3202        }
3203        struct Visitor;
3204        impl<'de> serde::de::Visitor<'de> for Visitor {
3205            type Value = CreateServiceConnectionMapRequest;
3206            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3207                formatter.write_str("struct CreateServiceConnectionMapRequest")
3208            }
3209            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3210            where
3211                A: serde::de::MapAccess<'de>,
3212            {
3213                #[allow(unused_imports)]
3214                use serde::de::Error;
3215                use std::option::Option::Some;
3216                let mut fields = std::collections::HashSet::new();
3217                let mut result = Self::Value::new();
3218                while let Some(tag) = map.next_key::<__FieldTag>()? {
3219                    #[allow(clippy::match_single_binding)]
3220                    match tag {
3221                        __FieldTag::__parent => {
3222                            if !fields.insert(__FieldTag::__parent) {
3223                                return std::result::Result::Err(A::Error::duplicate_field(
3224                                    "multiple values for parent",
3225                                ));
3226                            }
3227                            result.parent = map
3228                                .next_value::<std::option::Option<std::string::String>>()?
3229                                .unwrap_or_default();
3230                        }
3231                        __FieldTag::__service_connection_map_id => {
3232                            if !fields.insert(__FieldTag::__service_connection_map_id) {
3233                                return std::result::Result::Err(A::Error::duplicate_field(
3234                                    "multiple values for service_connection_map_id",
3235                                ));
3236                            }
3237                            result.service_connection_map_id = map
3238                                .next_value::<std::option::Option<std::string::String>>()?
3239                                .unwrap_or_default();
3240                        }
3241                        __FieldTag::__service_connection_map => {
3242                            if !fields.insert(__FieldTag::__service_connection_map) {
3243                                return std::result::Result::Err(A::Error::duplicate_field(
3244                                    "multiple values for service_connection_map",
3245                                ));
3246                            }
3247                            result.service_connection_map = map.next_value::<std::option::Option<crate::model::ServiceConnectionMap>>()?
3248                                ;
3249                        }
3250                        __FieldTag::__request_id => {
3251                            if !fields.insert(__FieldTag::__request_id) {
3252                                return std::result::Result::Err(A::Error::duplicate_field(
3253                                    "multiple values for request_id",
3254                                ));
3255                            }
3256                            result.request_id = map
3257                                .next_value::<std::option::Option<std::string::String>>()?
3258                                .unwrap_or_default();
3259                        }
3260                        __FieldTag::Unknown(key) => {
3261                            let value = map.next_value::<serde_json::Value>()?;
3262                            result._unknown_fields.insert(key, value);
3263                        }
3264                    }
3265                }
3266                std::result::Result::Ok(result)
3267            }
3268        }
3269        deserializer.deserialize_any(Visitor)
3270    }
3271}
3272
3273#[doc(hidden)]
3274impl serde::ser::Serialize for CreateServiceConnectionMapRequest {
3275    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3276    where
3277        S: serde::ser::Serializer,
3278    {
3279        use serde::ser::SerializeMap;
3280        #[allow(unused_imports)]
3281        use std::option::Option::Some;
3282        let mut state = serializer.serialize_map(std::option::Option::None)?;
3283        if !self.parent.is_empty() {
3284            state.serialize_entry("parent", &self.parent)?;
3285        }
3286        if !self.service_connection_map_id.is_empty() {
3287            state.serialize_entry("serviceConnectionMapId", &self.service_connection_map_id)?;
3288        }
3289        if self.service_connection_map.is_some() {
3290            state.serialize_entry("serviceConnectionMap", &self.service_connection_map)?;
3291        }
3292        if !self.request_id.is_empty() {
3293            state.serialize_entry("requestId", &self.request_id)?;
3294        }
3295        if !self._unknown_fields.is_empty() {
3296            for (key, value) in self._unknown_fields.iter() {
3297                state.serialize_entry(key, &value)?;
3298            }
3299        }
3300        state.end()
3301    }
3302}
3303
3304impl std::fmt::Debug for CreateServiceConnectionMapRequest {
3305    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3306        let mut debug_struct = f.debug_struct("CreateServiceConnectionMapRequest");
3307        debug_struct.field("parent", &self.parent);
3308        debug_struct.field("service_connection_map_id", &self.service_connection_map_id);
3309        debug_struct.field("service_connection_map", &self.service_connection_map);
3310        debug_struct.field("request_id", &self.request_id);
3311        if !self._unknown_fields.is_empty() {
3312            debug_struct.field("_unknown_fields", &self._unknown_fields);
3313        }
3314        debug_struct.finish()
3315    }
3316}
3317
3318/// Request for UpdateServiceConnectionMap.
3319#[derive(Clone, Default, PartialEq)]
3320#[non_exhaustive]
3321pub struct UpdateServiceConnectionMapRequest {
3322    /// Optional. Field mask is used to specify the fields to be overwritten in the
3323    /// ServiceConnectionMap resource by the update.
3324    /// The fields specified in the update_mask are relative to the resource, not
3325    /// the full request. A field will be overwritten if it is in the mask. If the
3326    /// user does not provide a mask then all fields will be overwritten.
3327    pub update_mask: std::option::Option<wkt::FieldMask>,
3328
3329    /// Required. New values to be patched into the resource.
3330    pub service_connection_map: std::option::Option<crate::model::ServiceConnectionMap>,
3331
3332    /// Optional. An optional request ID to identify requests. Specify a unique
3333    /// request ID so that if you must retry your request, the server will know to
3334    /// ignore the request if it has already been completed. The server will
3335    /// guarantee that for at least 60 minutes since the first request.
3336    ///
3337    /// For example, consider a situation where you make an initial request and
3338    /// the request times out. If you make the request again with the same request
3339    /// ID, the server can check if original operation with the same request ID
3340    /// was received, and if so, will ignore the second request. This prevents
3341    /// clients from accidentally creating duplicate commitments.
3342    ///
3343    /// The request ID must be a valid UUID with the exception that zero UUID is
3344    /// not supported (00000000-0000-0000-0000-000000000000).
3345    pub request_id: std::string::String,
3346
3347    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3348}
3349
3350impl UpdateServiceConnectionMapRequest {
3351    pub fn new() -> Self {
3352        std::default::Default::default()
3353    }
3354
3355    /// Sets the value of [update_mask][crate::model::UpdateServiceConnectionMapRequest::update_mask].
3356    pub fn set_update_mask<T>(mut self, v: T) -> Self
3357    where
3358        T: std::convert::Into<wkt::FieldMask>,
3359    {
3360        self.update_mask = std::option::Option::Some(v.into());
3361        self
3362    }
3363
3364    /// Sets or clears the value of [update_mask][crate::model::UpdateServiceConnectionMapRequest::update_mask].
3365    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3366    where
3367        T: std::convert::Into<wkt::FieldMask>,
3368    {
3369        self.update_mask = v.map(|x| x.into());
3370        self
3371    }
3372
3373    /// Sets the value of [service_connection_map][crate::model::UpdateServiceConnectionMapRequest::service_connection_map].
3374    pub fn set_service_connection_map<T>(mut self, v: T) -> Self
3375    where
3376        T: std::convert::Into<crate::model::ServiceConnectionMap>,
3377    {
3378        self.service_connection_map = std::option::Option::Some(v.into());
3379        self
3380    }
3381
3382    /// Sets or clears the value of [service_connection_map][crate::model::UpdateServiceConnectionMapRequest::service_connection_map].
3383    pub fn set_or_clear_service_connection_map<T>(mut self, v: std::option::Option<T>) -> Self
3384    where
3385        T: std::convert::Into<crate::model::ServiceConnectionMap>,
3386    {
3387        self.service_connection_map = v.map(|x| x.into());
3388        self
3389    }
3390
3391    /// Sets the value of [request_id][crate::model::UpdateServiceConnectionMapRequest::request_id].
3392    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3393        self.request_id = v.into();
3394        self
3395    }
3396}
3397
3398impl wkt::message::Message for UpdateServiceConnectionMapRequest {
3399    fn typename() -> &'static str {
3400        "type.googleapis.com/google.cloud.networkconnectivity.v1.UpdateServiceConnectionMapRequest"
3401    }
3402}
3403
3404#[doc(hidden)]
3405impl<'de> serde::de::Deserialize<'de> for UpdateServiceConnectionMapRequest {
3406    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3407    where
3408        D: serde::Deserializer<'de>,
3409    {
3410        #[allow(non_camel_case_types)]
3411        #[doc(hidden)]
3412        #[derive(PartialEq, Eq, Hash)]
3413        enum __FieldTag {
3414            __update_mask,
3415            __service_connection_map,
3416            __request_id,
3417            Unknown(std::string::String),
3418        }
3419        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3420            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3421            where
3422                D: serde::Deserializer<'de>,
3423            {
3424                struct Visitor;
3425                impl<'de> serde::de::Visitor<'de> for Visitor {
3426                    type Value = __FieldTag;
3427                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3428                        formatter.write_str("a field name for UpdateServiceConnectionMapRequest")
3429                    }
3430                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3431                    where
3432                        E: serde::de::Error,
3433                    {
3434                        use std::result::Result::Ok;
3435                        use std::string::ToString;
3436                        match value {
3437                            "updateMask" => Ok(__FieldTag::__update_mask),
3438                            "update_mask" => Ok(__FieldTag::__update_mask),
3439                            "serviceConnectionMap" => Ok(__FieldTag::__service_connection_map),
3440                            "service_connection_map" => Ok(__FieldTag::__service_connection_map),
3441                            "requestId" => Ok(__FieldTag::__request_id),
3442                            "request_id" => Ok(__FieldTag::__request_id),
3443                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3444                        }
3445                    }
3446                }
3447                deserializer.deserialize_identifier(Visitor)
3448            }
3449        }
3450        struct Visitor;
3451        impl<'de> serde::de::Visitor<'de> for Visitor {
3452            type Value = UpdateServiceConnectionMapRequest;
3453            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3454                formatter.write_str("struct UpdateServiceConnectionMapRequest")
3455            }
3456            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3457            where
3458                A: serde::de::MapAccess<'de>,
3459            {
3460                #[allow(unused_imports)]
3461                use serde::de::Error;
3462                use std::option::Option::Some;
3463                let mut fields = std::collections::HashSet::new();
3464                let mut result = Self::Value::new();
3465                while let Some(tag) = map.next_key::<__FieldTag>()? {
3466                    #[allow(clippy::match_single_binding)]
3467                    match tag {
3468                        __FieldTag::__update_mask => {
3469                            if !fields.insert(__FieldTag::__update_mask) {
3470                                return std::result::Result::Err(A::Error::duplicate_field(
3471                                    "multiple values for update_mask",
3472                                ));
3473                            }
3474                            result.update_mask =
3475                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
3476                        }
3477                        __FieldTag::__service_connection_map => {
3478                            if !fields.insert(__FieldTag::__service_connection_map) {
3479                                return std::result::Result::Err(A::Error::duplicate_field(
3480                                    "multiple values for service_connection_map",
3481                                ));
3482                            }
3483                            result.service_connection_map = map.next_value::<std::option::Option<crate::model::ServiceConnectionMap>>()?
3484                                ;
3485                        }
3486                        __FieldTag::__request_id => {
3487                            if !fields.insert(__FieldTag::__request_id) {
3488                                return std::result::Result::Err(A::Error::duplicate_field(
3489                                    "multiple values for request_id",
3490                                ));
3491                            }
3492                            result.request_id = map
3493                                .next_value::<std::option::Option<std::string::String>>()?
3494                                .unwrap_or_default();
3495                        }
3496                        __FieldTag::Unknown(key) => {
3497                            let value = map.next_value::<serde_json::Value>()?;
3498                            result._unknown_fields.insert(key, value);
3499                        }
3500                    }
3501                }
3502                std::result::Result::Ok(result)
3503            }
3504        }
3505        deserializer.deserialize_any(Visitor)
3506    }
3507}
3508
3509#[doc(hidden)]
3510impl serde::ser::Serialize for UpdateServiceConnectionMapRequest {
3511    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3512    where
3513        S: serde::ser::Serializer,
3514    {
3515        use serde::ser::SerializeMap;
3516        #[allow(unused_imports)]
3517        use std::option::Option::Some;
3518        let mut state = serializer.serialize_map(std::option::Option::None)?;
3519        if self.update_mask.is_some() {
3520            state.serialize_entry("updateMask", &self.update_mask)?;
3521        }
3522        if self.service_connection_map.is_some() {
3523            state.serialize_entry("serviceConnectionMap", &self.service_connection_map)?;
3524        }
3525        if !self.request_id.is_empty() {
3526            state.serialize_entry("requestId", &self.request_id)?;
3527        }
3528        if !self._unknown_fields.is_empty() {
3529            for (key, value) in self._unknown_fields.iter() {
3530                state.serialize_entry(key, &value)?;
3531            }
3532        }
3533        state.end()
3534    }
3535}
3536
3537impl std::fmt::Debug for UpdateServiceConnectionMapRequest {
3538    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3539        let mut debug_struct = f.debug_struct("UpdateServiceConnectionMapRequest");
3540        debug_struct.field("update_mask", &self.update_mask);
3541        debug_struct.field("service_connection_map", &self.service_connection_map);
3542        debug_struct.field("request_id", &self.request_id);
3543        if !self._unknown_fields.is_empty() {
3544            debug_struct.field("_unknown_fields", &self._unknown_fields);
3545        }
3546        debug_struct.finish()
3547    }
3548}
3549
3550/// Request for DeleteServiceConnectionMap.
3551#[derive(Clone, Default, PartialEq)]
3552#[non_exhaustive]
3553pub struct DeleteServiceConnectionMapRequest {
3554    /// Required. The name of the ServiceConnectionMap to delete.
3555    pub name: std::string::String,
3556
3557    /// Optional. An optional request ID to identify requests. Specify a unique
3558    /// request ID so that if you must retry your request, the server will know to
3559    /// ignore the request if it has already been completed. The server will
3560    /// guarantee that for at least 60 minutes after the first request.
3561    ///
3562    /// For example, consider a situation where you make an initial request and
3563    /// the request times out. If you make the request again with the same request
3564    /// ID, the server can check if original operation with the same request ID
3565    /// was received, and if so, will ignore the second request. This prevents
3566    /// clients from accidentally creating duplicate commitments.
3567    ///
3568    /// The request ID must be a valid UUID with the exception that zero UUID is
3569    /// not supported (00000000-0000-0000-0000-000000000000).
3570    pub request_id: std::string::String,
3571
3572    /// Optional. The etag is computed by the server, and may be sent on update and
3573    /// delete requests to ensure the client has an up-to-date value before
3574    /// proceeding.
3575    pub etag: std::option::Option<std::string::String>,
3576
3577    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3578}
3579
3580impl DeleteServiceConnectionMapRequest {
3581    pub fn new() -> Self {
3582        std::default::Default::default()
3583    }
3584
3585    /// Sets the value of [name][crate::model::DeleteServiceConnectionMapRequest::name].
3586    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3587        self.name = v.into();
3588        self
3589    }
3590
3591    /// Sets the value of [request_id][crate::model::DeleteServiceConnectionMapRequest::request_id].
3592    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3593        self.request_id = v.into();
3594        self
3595    }
3596
3597    /// Sets the value of [etag][crate::model::DeleteServiceConnectionMapRequest::etag].
3598    pub fn set_etag<T>(mut self, v: T) -> Self
3599    where
3600        T: std::convert::Into<std::string::String>,
3601    {
3602        self.etag = std::option::Option::Some(v.into());
3603        self
3604    }
3605
3606    /// Sets or clears the value of [etag][crate::model::DeleteServiceConnectionMapRequest::etag].
3607    pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
3608    where
3609        T: std::convert::Into<std::string::String>,
3610    {
3611        self.etag = v.map(|x| x.into());
3612        self
3613    }
3614}
3615
3616impl wkt::message::Message for DeleteServiceConnectionMapRequest {
3617    fn typename() -> &'static str {
3618        "type.googleapis.com/google.cloud.networkconnectivity.v1.DeleteServiceConnectionMapRequest"
3619    }
3620}
3621
3622#[doc(hidden)]
3623impl<'de> serde::de::Deserialize<'de> for DeleteServiceConnectionMapRequest {
3624    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3625    where
3626        D: serde::Deserializer<'de>,
3627    {
3628        #[allow(non_camel_case_types)]
3629        #[doc(hidden)]
3630        #[derive(PartialEq, Eq, Hash)]
3631        enum __FieldTag {
3632            __name,
3633            __request_id,
3634            __etag,
3635            Unknown(std::string::String),
3636        }
3637        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3638            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3639            where
3640                D: serde::Deserializer<'de>,
3641            {
3642                struct Visitor;
3643                impl<'de> serde::de::Visitor<'de> for Visitor {
3644                    type Value = __FieldTag;
3645                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3646                        formatter.write_str("a field name for DeleteServiceConnectionMapRequest")
3647                    }
3648                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3649                    where
3650                        E: serde::de::Error,
3651                    {
3652                        use std::result::Result::Ok;
3653                        use std::string::ToString;
3654                        match value {
3655                            "name" => Ok(__FieldTag::__name),
3656                            "requestId" => Ok(__FieldTag::__request_id),
3657                            "request_id" => Ok(__FieldTag::__request_id),
3658                            "etag" => Ok(__FieldTag::__etag),
3659                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3660                        }
3661                    }
3662                }
3663                deserializer.deserialize_identifier(Visitor)
3664            }
3665        }
3666        struct Visitor;
3667        impl<'de> serde::de::Visitor<'de> for Visitor {
3668            type Value = DeleteServiceConnectionMapRequest;
3669            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3670                formatter.write_str("struct DeleteServiceConnectionMapRequest")
3671            }
3672            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3673            where
3674                A: serde::de::MapAccess<'de>,
3675            {
3676                #[allow(unused_imports)]
3677                use serde::de::Error;
3678                use std::option::Option::Some;
3679                let mut fields = std::collections::HashSet::new();
3680                let mut result = Self::Value::new();
3681                while let Some(tag) = map.next_key::<__FieldTag>()? {
3682                    #[allow(clippy::match_single_binding)]
3683                    match tag {
3684                        __FieldTag::__name => {
3685                            if !fields.insert(__FieldTag::__name) {
3686                                return std::result::Result::Err(A::Error::duplicate_field(
3687                                    "multiple values for name",
3688                                ));
3689                            }
3690                            result.name = map
3691                                .next_value::<std::option::Option<std::string::String>>()?
3692                                .unwrap_or_default();
3693                        }
3694                        __FieldTag::__request_id => {
3695                            if !fields.insert(__FieldTag::__request_id) {
3696                                return std::result::Result::Err(A::Error::duplicate_field(
3697                                    "multiple values for request_id",
3698                                ));
3699                            }
3700                            result.request_id = map
3701                                .next_value::<std::option::Option<std::string::String>>()?
3702                                .unwrap_or_default();
3703                        }
3704                        __FieldTag::__etag => {
3705                            if !fields.insert(__FieldTag::__etag) {
3706                                return std::result::Result::Err(A::Error::duplicate_field(
3707                                    "multiple values for etag",
3708                                ));
3709                            }
3710                            result.etag =
3711                                map.next_value::<std::option::Option<std::string::String>>()?;
3712                        }
3713                        __FieldTag::Unknown(key) => {
3714                            let value = map.next_value::<serde_json::Value>()?;
3715                            result._unknown_fields.insert(key, value);
3716                        }
3717                    }
3718                }
3719                std::result::Result::Ok(result)
3720            }
3721        }
3722        deserializer.deserialize_any(Visitor)
3723    }
3724}
3725
3726#[doc(hidden)]
3727impl serde::ser::Serialize for DeleteServiceConnectionMapRequest {
3728    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3729    where
3730        S: serde::ser::Serializer,
3731    {
3732        use serde::ser::SerializeMap;
3733        #[allow(unused_imports)]
3734        use std::option::Option::Some;
3735        let mut state = serializer.serialize_map(std::option::Option::None)?;
3736        if !self.name.is_empty() {
3737            state.serialize_entry("name", &self.name)?;
3738        }
3739        if !self.request_id.is_empty() {
3740            state.serialize_entry("requestId", &self.request_id)?;
3741        }
3742        if self.etag.is_some() {
3743            state.serialize_entry("etag", &self.etag)?;
3744        }
3745        if !self._unknown_fields.is_empty() {
3746            for (key, value) in self._unknown_fields.iter() {
3747                state.serialize_entry(key, &value)?;
3748            }
3749        }
3750        state.end()
3751    }
3752}
3753
3754impl std::fmt::Debug for DeleteServiceConnectionMapRequest {
3755    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3756        let mut debug_struct = f.debug_struct("DeleteServiceConnectionMapRequest");
3757        debug_struct.field("name", &self.name);
3758        debug_struct.field("request_id", &self.request_id);
3759        debug_struct.field("etag", &self.etag);
3760        if !self._unknown_fields.is_empty() {
3761            debug_struct.field("_unknown_fields", &self._unknown_fields);
3762        }
3763        debug_struct.finish()
3764    }
3765}
3766
3767/// The ServiceConnectionPolicy resource.
3768#[derive(Clone, Default, PartialEq)]
3769#[non_exhaustive]
3770pub struct ServiceConnectionPolicy {
3771    /// Immutable. The name of a ServiceConnectionPolicy.
3772    /// Format:
3773    /// projects/{project}/locations/{location}/serviceConnectionPolicies/{service_connection_policy}
3774    /// See: <https://google.aip.dev/122#fields-representing-resource-names>
3775    pub name: std::string::String,
3776
3777    /// Output only. Time when the ServiceConnectionPolicy was created.
3778    pub create_time: std::option::Option<wkt::Timestamp>,
3779
3780    /// Output only. Time when the ServiceConnectionPolicy was updated.
3781    pub update_time: std::option::Option<wkt::Timestamp>,
3782
3783    /// User-defined labels.
3784    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3785
3786    /// A description of this resource.
3787    pub description: std::string::String,
3788
3789    /// The resource path of the consumer network.
3790    /// Example:
3791    ///
3792    /// - projects/{projectNumOrId}/global/networks/{resourceId}.
3793    pub network: std::string::String,
3794
3795    /// The service class identifier for which this ServiceConnectionPolicy is for.
3796    /// The service class identifier is a unique, symbolic representation of a
3797    /// ServiceClass. It is provided by the Service Producer. Google services have
3798    /// a prefix of gcp or google-cloud. For example, gcp-memorystore-redis or
3799    /// google-cloud-sql. 3rd party services do not. For example,
3800    /// test-service-a3dfcx.
3801    pub service_class: std::string::String,
3802
3803    /// Output only. The type of underlying resources used to create the
3804    /// connection.
3805    pub infrastructure: crate::model::Infrastructure,
3806
3807    /// Configuration used for Private Service Connect connections. Used when
3808    /// Infrastructure is PSC.
3809    pub psc_config: std::option::Option<crate::model::service_connection_policy::PscConfig>,
3810
3811    /// Output only. [Output only] Information about each Private Service Connect
3812    /// connection.
3813    pub psc_connections: std::vec::Vec<crate::model::service_connection_policy::PscConnection>,
3814
3815    /// Optional. The etag is computed by the server, and may be sent on update and
3816    /// delete requests to ensure the client has an up-to-date value before
3817    /// proceeding.
3818    pub etag: std::option::Option<std::string::String>,
3819
3820    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3821}
3822
3823impl ServiceConnectionPolicy {
3824    pub fn new() -> Self {
3825        std::default::Default::default()
3826    }
3827
3828    /// Sets the value of [name][crate::model::ServiceConnectionPolicy::name].
3829    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3830        self.name = v.into();
3831        self
3832    }
3833
3834    /// Sets the value of [create_time][crate::model::ServiceConnectionPolicy::create_time].
3835    pub fn set_create_time<T>(mut self, v: T) -> Self
3836    where
3837        T: std::convert::Into<wkt::Timestamp>,
3838    {
3839        self.create_time = std::option::Option::Some(v.into());
3840        self
3841    }
3842
3843    /// Sets or clears the value of [create_time][crate::model::ServiceConnectionPolicy::create_time].
3844    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3845    where
3846        T: std::convert::Into<wkt::Timestamp>,
3847    {
3848        self.create_time = v.map(|x| x.into());
3849        self
3850    }
3851
3852    /// Sets the value of [update_time][crate::model::ServiceConnectionPolicy::update_time].
3853    pub fn set_update_time<T>(mut self, v: T) -> Self
3854    where
3855        T: std::convert::Into<wkt::Timestamp>,
3856    {
3857        self.update_time = std::option::Option::Some(v.into());
3858        self
3859    }
3860
3861    /// Sets or clears the value of [update_time][crate::model::ServiceConnectionPolicy::update_time].
3862    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3863    where
3864        T: std::convert::Into<wkt::Timestamp>,
3865    {
3866        self.update_time = v.map(|x| x.into());
3867        self
3868    }
3869
3870    /// Sets the value of [labels][crate::model::ServiceConnectionPolicy::labels].
3871    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3872    where
3873        T: std::iter::IntoIterator<Item = (K, V)>,
3874        K: std::convert::Into<std::string::String>,
3875        V: std::convert::Into<std::string::String>,
3876    {
3877        use std::iter::Iterator;
3878        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3879        self
3880    }
3881
3882    /// Sets the value of [description][crate::model::ServiceConnectionPolicy::description].
3883    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3884        self.description = v.into();
3885        self
3886    }
3887
3888    /// Sets the value of [network][crate::model::ServiceConnectionPolicy::network].
3889    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3890        self.network = v.into();
3891        self
3892    }
3893
3894    /// Sets the value of [service_class][crate::model::ServiceConnectionPolicy::service_class].
3895    pub fn set_service_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3896        self.service_class = v.into();
3897        self
3898    }
3899
3900    /// Sets the value of [infrastructure][crate::model::ServiceConnectionPolicy::infrastructure].
3901    pub fn set_infrastructure<T: std::convert::Into<crate::model::Infrastructure>>(
3902        mut self,
3903        v: T,
3904    ) -> Self {
3905        self.infrastructure = v.into();
3906        self
3907    }
3908
3909    /// Sets the value of [psc_config][crate::model::ServiceConnectionPolicy::psc_config].
3910    pub fn set_psc_config<T>(mut self, v: T) -> Self
3911    where
3912        T: std::convert::Into<crate::model::service_connection_policy::PscConfig>,
3913    {
3914        self.psc_config = std::option::Option::Some(v.into());
3915        self
3916    }
3917
3918    /// Sets or clears the value of [psc_config][crate::model::ServiceConnectionPolicy::psc_config].
3919    pub fn set_or_clear_psc_config<T>(mut self, v: std::option::Option<T>) -> Self
3920    where
3921        T: std::convert::Into<crate::model::service_connection_policy::PscConfig>,
3922    {
3923        self.psc_config = v.map(|x| x.into());
3924        self
3925    }
3926
3927    /// Sets the value of [psc_connections][crate::model::ServiceConnectionPolicy::psc_connections].
3928    pub fn set_psc_connections<T, V>(mut self, v: T) -> Self
3929    where
3930        T: std::iter::IntoIterator<Item = V>,
3931        V: std::convert::Into<crate::model::service_connection_policy::PscConnection>,
3932    {
3933        use std::iter::Iterator;
3934        self.psc_connections = v.into_iter().map(|i| i.into()).collect();
3935        self
3936    }
3937
3938    /// Sets the value of [etag][crate::model::ServiceConnectionPolicy::etag].
3939    pub fn set_etag<T>(mut self, v: T) -> Self
3940    where
3941        T: std::convert::Into<std::string::String>,
3942    {
3943        self.etag = std::option::Option::Some(v.into());
3944        self
3945    }
3946
3947    /// Sets or clears the value of [etag][crate::model::ServiceConnectionPolicy::etag].
3948    pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
3949    where
3950        T: std::convert::Into<std::string::String>,
3951    {
3952        self.etag = v.map(|x| x.into());
3953        self
3954    }
3955}
3956
3957impl wkt::message::Message for ServiceConnectionPolicy {
3958    fn typename() -> &'static str {
3959        "type.googleapis.com/google.cloud.networkconnectivity.v1.ServiceConnectionPolicy"
3960    }
3961}
3962
3963#[doc(hidden)]
3964impl<'de> serde::de::Deserialize<'de> for ServiceConnectionPolicy {
3965    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3966    where
3967        D: serde::Deserializer<'de>,
3968    {
3969        #[allow(non_camel_case_types)]
3970        #[doc(hidden)]
3971        #[derive(PartialEq, Eq, Hash)]
3972        enum __FieldTag {
3973            __name,
3974            __create_time,
3975            __update_time,
3976            __labels,
3977            __description,
3978            __network,
3979            __service_class,
3980            __infrastructure,
3981            __psc_config,
3982            __psc_connections,
3983            __etag,
3984            Unknown(std::string::String),
3985        }
3986        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3987            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3988            where
3989                D: serde::Deserializer<'de>,
3990            {
3991                struct Visitor;
3992                impl<'de> serde::de::Visitor<'de> for Visitor {
3993                    type Value = __FieldTag;
3994                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3995                        formatter.write_str("a field name for ServiceConnectionPolicy")
3996                    }
3997                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3998                    where
3999                        E: serde::de::Error,
4000                    {
4001                        use std::result::Result::Ok;
4002                        use std::string::ToString;
4003                        match value {
4004                            "name" => Ok(__FieldTag::__name),
4005                            "createTime" => Ok(__FieldTag::__create_time),
4006                            "create_time" => Ok(__FieldTag::__create_time),
4007                            "updateTime" => Ok(__FieldTag::__update_time),
4008                            "update_time" => Ok(__FieldTag::__update_time),
4009                            "labels" => Ok(__FieldTag::__labels),
4010                            "description" => Ok(__FieldTag::__description),
4011                            "network" => Ok(__FieldTag::__network),
4012                            "serviceClass" => Ok(__FieldTag::__service_class),
4013                            "service_class" => Ok(__FieldTag::__service_class),
4014                            "infrastructure" => Ok(__FieldTag::__infrastructure),
4015                            "pscConfig" => Ok(__FieldTag::__psc_config),
4016                            "psc_config" => Ok(__FieldTag::__psc_config),
4017                            "pscConnections" => Ok(__FieldTag::__psc_connections),
4018                            "psc_connections" => Ok(__FieldTag::__psc_connections),
4019                            "etag" => Ok(__FieldTag::__etag),
4020                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4021                        }
4022                    }
4023                }
4024                deserializer.deserialize_identifier(Visitor)
4025            }
4026        }
4027        struct Visitor;
4028        impl<'de> serde::de::Visitor<'de> for Visitor {
4029            type Value = ServiceConnectionPolicy;
4030            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4031                formatter.write_str("struct ServiceConnectionPolicy")
4032            }
4033            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4034            where
4035                A: serde::de::MapAccess<'de>,
4036            {
4037                #[allow(unused_imports)]
4038                use serde::de::Error;
4039                use std::option::Option::Some;
4040                let mut fields = std::collections::HashSet::new();
4041                let mut result = Self::Value::new();
4042                while let Some(tag) = map.next_key::<__FieldTag>()? {
4043                    #[allow(clippy::match_single_binding)]
4044                    match tag {
4045                        __FieldTag::__name => {
4046                            if !fields.insert(__FieldTag::__name) {
4047                                return std::result::Result::Err(A::Error::duplicate_field(
4048                                    "multiple values for name",
4049                                ));
4050                            }
4051                            result.name = map
4052                                .next_value::<std::option::Option<std::string::String>>()?
4053                                .unwrap_or_default();
4054                        }
4055                        __FieldTag::__create_time => {
4056                            if !fields.insert(__FieldTag::__create_time) {
4057                                return std::result::Result::Err(A::Error::duplicate_field(
4058                                    "multiple values for create_time",
4059                                ));
4060                            }
4061                            result.create_time =
4062                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
4063                        }
4064                        __FieldTag::__update_time => {
4065                            if !fields.insert(__FieldTag::__update_time) {
4066                                return std::result::Result::Err(A::Error::duplicate_field(
4067                                    "multiple values for update_time",
4068                                ));
4069                            }
4070                            result.update_time =
4071                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
4072                        }
4073                        __FieldTag::__labels => {
4074                            if !fields.insert(__FieldTag::__labels) {
4075                                return std::result::Result::Err(A::Error::duplicate_field(
4076                                    "multiple values for labels",
4077                                ));
4078                            }
4079                            result.labels = map
4080                                .next_value::<std::option::Option<
4081                                    std::collections::HashMap<
4082                                        std::string::String,
4083                                        std::string::String,
4084                                    >,
4085                                >>()?
4086                                .unwrap_or_default();
4087                        }
4088                        __FieldTag::__description => {
4089                            if !fields.insert(__FieldTag::__description) {
4090                                return std::result::Result::Err(A::Error::duplicate_field(
4091                                    "multiple values for description",
4092                                ));
4093                            }
4094                            result.description = map
4095                                .next_value::<std::option::Option<std::string::String>>()?
4096                                .unwrap_or_default();
4097                        }
4098                        __FieldTag::__network => {
4099                            if !fields.insert(__FieldTag::__network) {
4100                                return std::result::Result::Err(A::Error::duplicate_field(
4101                                    "multiple values for network",
4102                                ));
4103                            }
4104                            result.network = map
4105                                .next_value::<std::option::Option<std::string::String>>()?
4106                                .unwrap_or_default();
4107                        }
4108                        __FieldTag::__service_class => {
4109                            if !fields.insert(__FieldTag::__service_class) {
4110                                return std::result::Result::Err(A::Error::duplicate_field(
4111                                    "multiple values for service_class",
4112                                ));
4113                            }
4114                            result.service_class = map
4115                                .next_value::<std::option::Option<std::string::String>>()?
4116                                .unwrap_or_default();
4117                        }
4118                        __FieldTag::__infrastructure => {
4119                            if !fields.insert(__FieldTag::__infrastructure) {
4120                                return std::result::Result::Err(A::Error::duplicate_field(
4121                                    "multiple values for infrastructure",
4122                                ));
4123                            }
4124                            result.infrastructure = map
4125                                .next_value::<std::option::Option<crate::model::Infrastructure>>()?
4126                                .unwrap_or_default();
4127                        }
4128                        __FieldTag::__psc_config => {
4129                            if !fields.insert(__FieldTag::__psc_config) {
4130                                return std::result::Result::Err(A::Error::duplicate_field(
4131                                    "multiple values for psc_config",
4132                                ));
4133                            }
4134                            result.psc_config = map.next_value::<std::option::Option<
4135                                crate::model::service_connection_policy::PscConfig,
4136                            >>()?;
4137                        }
4138                        __FieldTag::__psc_connections => {
4139                            if !fields.insert(__FieldTag::__psc_connections) {
4140                                return std::result::Result::Err(A::Error::duplicate_field(
4141                                    "multiple values for psc_connections",
4142                                ));
4143                            }
4144                            result.psc_connections = map
4145                                .next_value::<std::option::Option<
4146                                    std::vec::Vec<
4147                                        crate::model::service_connection_policy::PscConnection,
4148                                    >,
4149                                >>()?
4150                                .unwrap_or_default();
4151                        }
4152                        __FieldTag::__etag => {
4153                            if !fields.insert(__FieldTag::__etag) {
4154                                return std::result::Result::Err(A::Error::duplicate_field(
4155                                    "multiple values for etag",
4156                                ));
4157                            }
4158                            result.etag =
4159                                map.next_value::<std::option::Option<std::string::String>>()?;
4160                        }
4161                        __FieldTag::Unknown(key) => {
4162                            let value = map.next_value::<serde_json::Value>()?;
4163                            result._unknown_fields.insert(key, value);
4164                        }
4165                    }
4166                }
4167                std::result::Result::Ok(result)
4168            }
4169        }
4170        deserializer.deserialize_any(Visitor)
4171    }
4172}
4173
4174#[doc(hidden)]
4175impl serde::ser::Serialize for ServiceConnectionPolicy {
4176    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4177    where
4178        S: serde::ser::Serializer,
4179    {
4180        use serde::ser::SerializeMap;
4181        #[allow(unused_imports)]
4182        use std::option::Option::Some;
4183        let mut state = serializer.serialize_map(std::option::Option::None)?;
4184        if !self.name.is_empty() {
4185            state.serialize_entry("name", &self.name)?;
4186        }
4187        if self.create_time.is_some() {
4188            state.serialize_entry("createTime", &self.create_time)?;
4189        }
4190        if self.update_time.is_some() {
4191            state.serialize_entry("updateTime", &self.update_time)?;
4192        }
4193        if !self.labels.is_empty() {
4194            state.serialize_entry("labels", &self.labels)?;
4195        }
4196        if !self.description.is_empty() {
4197            state.serialize_entry("description", &self.description)?;
4198        }
4199        if !self.network.is_empty() {
4200            state.serialize_entry("network", &self.network)?;
4201        }
4202        if !self.service_class.is_empty() {
4203            state.serialize_entry("serviceClass", &self.service_class)?;
4204        }
4205        if !wkt::internal::is_default(&self.infrastructure) {
4206            state.serialize_entry("infrastructure", &self.infrastructure)?;
4207        }
4208        if self.psc_config.is_some() {
4209            state.serialize_entry("pscConfig", &self.psc_config)?;
4210        }
4211        if !self.psc_connections.is_empty() {
4212            state.serialize_entry("pscConnections", &self.psc_connections)?;
4213        }
4214        if self.etag.is_some() {
4215            state.serialize_entry("etag", &self.etag)?;
4216        }
4217        if !self._unknown_fields.is_empty() {
4218            for (key, value) in self._unknown_fields.iter() {
4219                state.serialize_entry(key, &value)?;
4220            }
4221        }
4222        state.end()
4223    }
4224}
4225
4226impl std::fmt::Debug for ServiceConnectionPolicy {
4227    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4228        let mut debug_struct = f.debug_struct("ServiceConnectionPolicy");
4229        debug_struct.field("name", &self.name);
4230        debug_struct.field("create_time", &self.create_time);
4231        debug_struct.field("update_time", &self.update_time);
4232        debug_struct.field("labels", &self.labels);
4233        debug_struct.field("description", &self.description);
4234        debug_struct.field("network", &self.network);
4235        debug_struct.field("service_class", &self.service_class);
4236        debug_struct.field("infrastructure", &self.infrastructure);
4237        debug_struct.field("psc_config", &self.psc_config);
4238        debug_struct.field("psc_connections", &self.psc_connections);
4239        debug_struct.field("etag", &self.etag);
4240        if !self._unknown_fields.is_empty() {
4241            debug_struct.field("_unknown_fields", &self._unknown_fields);
4242        }
4243        debug_struct.finish()
4244    }
4245}
4246
4247/// Defines additional types related to [ServiceConnectionPolicy].
4248pub mod service_connection_policy {
4249    #[allow(unused_imports)]
4250    use super::*;
4251
4252    /// Configuration used for Private Service Connect connections. Used when
4253    /// Infrastructure is PSC.
4254    #[derive(Clone, Default, PartialEq)]
4255    #[non_exhaustive]
4256    pub struct PscConfig {
4257        /// The resource paths of subnetworks to use for IP address management.
4258        /// Example:
4259        /// projects/{projectNumOrId}/regions/{region}/subnetworks/{resourceId}.
4260        pub subnetworks: std::vec::Vec<std::string::String>,
4261
4262        /// Optional. Max number of PSC connections for this policy.
4263        pub limit: std::option::Option<i64>,
4264
4265        /// Required. ProducerInstanceLocation is used to specify which authorization
4266        /// mechanism to use to determine which projects the Producer instance can be
4267        /// within.
4268        pub producer_instance_location:
4269            crate::model::service_connection_policy::psc_config::ProducerInstanceLocation,
4270
4271        /// Optional. List of Projects, Folders, or Organizations from where the
4272        /// Producer instance can be within. For example, a network administrator can
4273        /// provide both 'organizations/foo' and 'projects/bar' as
4274        /// allowed_google_producers_resource_hierarchy_levels. This allowlists this
4275        /// network to connect with any Producer instance within the 'foo'
4276        /// organization or the 'bar' project. By default,
4277        /// allowed_google_producers_resource_hierarchy_level is empty. The format
4278        /// for each allowed_google_producers_resource_hierarchy_level is \<resource
4279        /// type\>/\<id\> where <resource type\> is one of 'projects', 'folders', or
4280        /// 'organizations' and \<id\> is either the ID or the number of the resource
4281        /// type. Format for each allowed_google_producers_resource_hierarchy_level
4282        /// value: 'projects/<project_id_or_number>' or 'folders/<folder_id>' or
4283        /// 'organizations/<organization_id>'
4284        /// Eg. [projects/my-project-id, projects/567, folders/891,
4285        /// organizations/123]
4286        pub allowed_google_producers_resource_hierarchy_level: std::vec::Vec<std::string::String>,
4287
4288        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4289    }
4290
4291    impl PscConfig {
4292        pub fn new() -> Self {
4293            std::default::Default::default()
4294        }
4295
4296        /// Sets the value of [subnetworks][crate::model::service_connection_policy::PscConfig::subnetworks].
4297        pub fn set_subnetworks<T, V>(mut self, v: T) -> Self
4298        where
4299            T: std::iter::IntoIterator<Item = V>,
4300            V: std::convert::Into<std::string::String>,
4301        {
4302            use std::iter::Iterator;
4303            self.subnetworks = v.into_iter().map(|i| i.into()).collect();
4304            self
4305        }
4306
4307        /// Sets the value of [limit][crate::model::service_connection_policy::PscConfig::limit].
4308        pub fn set_limit<T>(mut self, v: T) -> Self
4309        where
4310            T: std::convert::Into<i64>,
4311        {
4312            self.limit = std::option::Option::Some(v.into());
4313            self
4314        }
4315
4316        /// Sets or clears the value of [limit][crate::model::service_connection_policy::PscConfig::limit].
4317        pub fn set_or_clear_limit<T>(mut self, v: std::option::Option<T>) -> Self
4318        where
4319            T: std::convert::Into<i64>,
4320        {
4321            self.limit = v.map(|x| x.into());
4322            self
4323        }
4324
4325        /// Sets the value of [producer_instance_location][crate::model::service_connection_policy::PscConfig::producer_instance_location].
4326        pub fn set_producer_instance_location<
4327            T: std::convert::Into<
4328                    crate::model::service_connection_policy::psc_config::ProducerInstanceLocation,
4329                >,
4330        >(
4331            mut self,
4332            v: T,
4333        ) -> Self {
4334            self.producer_instance_location = v.into();
4335            self
4336        }
4337
4338        /// Sets the value of [allowed_google_producers_resource_hierarchy_level][crate::model::service_connection_policy::PscConfig::allowed_google_producers_resource_hierarchy_level].
4339        pub fn set_allowed_google_producers_resource_hierarchy_level<T, V>(mut self, v: T) -> Self
4340        where
4341            T: std::iter::IntoIterator<Item = V>,
4342            V: std::convert::Into<std::string::String>,
4343        {
4344            use std::iter::Iterator;
4345            self.allowed_google_producers_resource_hierarchy_level =
4346                v.into_iter().map(|i| i.into()).collect();
4347            self
4348        }
4349    }
4350
4351    impl wkt::message::Message for PscConfig {
4352        fn typename() -> &'static str {
4353            "type.googleapis.com/google.cloud.networkconnectivity.v1.ServiceConnectionPolicy.PscConfig"
4354        }
4355    }
4356
4357    #[doc(hidden)]
4358    impl<'de> serde::de::Deserialize<'de> for PscConfig {
4359        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4360        where
4361            D: serde::Deserializer<'de>,
4362        {
4363            #[allow(non_camel_case_types)]
4364            #[doc(hidden)]
4365            #[derive(PartialEq, Eq, Hash)]
4366            enum __FieldTag {
4367                __subnetworks,
4368                __limit,
4369                __producer_instance_location,
4370                __allowed_google_producers_resource_hierarchy_level,
4371                Unknown(std::string::String),
4372            }
4373            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4374                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4375                where
4376                    D: serde::Deserializer<'de>,
4377                {
4378                    struct Visitor;
4379                    impl<'de> serde::de::Visitor<'de> for Visitor {
4380                        type Value = __FieldTag;
4381                        fn expecting(
4382                            &self,
4383                            formatter: &mut std::fmt::Formatter,
4384                        ) -> std::fmt::Result {
4385                            formatter.write_str("a field name for PscConfig")
4386                        }
4387                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4388                        where
4389                            E: serde::de::Error,
4390                        {
4391                            use std::result::Result::Ok;
4392                            use std::string::ToString;
4393                            match value {
4394                                "subnetworks" => Ok(__FieldTag::__subnetworks),
4395                                "limit" => Ok(__FieldTag::__limit),
4396                                "producerInstanceLocation" => {
4397                                    Ok(__FieldTag::__producer_instance_location)
4398                                }
4399                                "producer_instance_location" => {
4400                                    Ok(__FieldTag::__producer_instance_location)
4401                                }
4402                                "allowedGoogleProducersResourceHierarchyLevel" => Ok(
4403                                    __FieldTag::__allowed_google_producers_resource_hierarchy_level,
4404                                ),
4405                                "allowed_google_producers_resource_hierarchy_level" => Ok(
4406                                    __FieldTag::__allowed_google_producers_resource_hierarchy_level,
4407                                ),
4408                                _ => Ok(__FieldTag::Unknown(value.to_string())),
4409                            }
4410                        }
4411                    }
4412                    deserializer.deserialize_identifier(Visitor)
4413                }
4414            }
4415            struct Visitor;
4416            impl<'de> serde::de::Visitor<'de> for Visitor {
4417                type Value = PscConfig;
4418                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4419                    formatter.write_str("struct PscConfig")
4420                }
4421                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4422                where
4423                    A: serde::de::MapAccess<'de>,
4424                {
4425                    #[allow(unused_imports)]
4426                    use serde::de::Error;
4427                    use std::option::Option::Some;
4428                    let mut fields = std::collections::HashSet::new();
4429                    let mut result = Self::Value::new();
4430                    while let Some(tag) = map.next_key::<__FieldTag>()? {
4431                        #[allow(clippy::match_single_binding)]
4432                        match tag {
4433                            __FieldTag::__subnetworks => {
4434                                if !fields.insert(__FieldTag::__subnetworks) {
4435                                    return std::result::Result::Err(A::Error::duplicate_field(
4436                                        "multiple values for subnetworks",
4437                                    ));
4438                                }
4439                                result.subnetworks = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
4440                            }
4441                            __FieldTag::__limit => {
4442                                if !fields.insert(__FieldTag::__limit) {
4443                                    return std::result::Result::Err(A::Error::duplicate_field(
4444                                        "multiple values for limit",
4445                                    ));
4446                                }
4447                                struct __With(std::option::Option<i64>);
4448                                impl<'de> serde::de::Deserialize<'de> for __With {
4449                                    fn deserialize<D>(
4450                                        deserializer: D,
4451                                    ) -> std::result::Result<Self, D::Error>
4452                                    where
4453                                        D: serde::de::Deserializer<'de>,
4454                                    {
4455                                        serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
4456                                    }
4457                                }
4458                                result.limit = map.next_value::<__With>()?.0;
4459                            }
4460                            __FieldTag::__producer_instance_location => {
4461                                if !fields.insert(__FieldTag::__producer_instance_location) {
4462                                    return std::result::Result::Err(A::Error::duplicate_field(
4463                                        "multiple values for producer_instance_location",
4464                                    ));
4465                                }
4466                                result.producer_instance_location = map.next_value::<std::option::Option<crate::model::service_connection_policy::psc_config::ProducerInstanceLocation>>()?.unwrap_or_default();
4467                            }
4468                            __FieldTag::__allowed_google_producers_resource_hierarchy_level => {
4469                                if !fields.insert(
4470                                    __FieldTag::__allowed_google_producers_resource_hierarchy_level,
4471                                ) {
4472                                    return std::result::Result::Err(A::Error::duplicate_field(
4473                                        "multiple values for allowed_google_producers_resource_hierarchy_level",
4474                                    ));
4475                                }
4476                                result.allowed_google_producers_resource_hierarchy_level = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
4477                            }
4478                            __FieldTag::Unknown(key) => {
4479                                let value = map.next_value::<serde_json::Value>()?;
4480                                result._unknown_fields.insert(key, value);
4481                            }
4482                        }
4483                    }
4484                    std::result::Result::Ok(result)
4485                }
4486            }
4487            deserializer.deserialize_any(Visitor)
4488        }
4489    }
4490
4491    #[doc(hidden)]
4492    impl serde::ser::Serialize for PscConfig {
4493        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4494        where
4495            S: serde::ser::Serializer,
4496        {
4497            use serde::ser::SerializeMap;
4498            #[allow(unused_imports)]
4499            use std::option::Option::Some;
4500            let mut state = serializer.serialize_map(std::option::Option::None)?;
4501            if !self.subnetworks.is_empty() {
4502                state.serialize_entry("subnetworks", &self.subnetworks)?;
4503            }
4504            if self.limit.is_some() {
4505                struct __With<'a>(&'a std::option::Option<i64>);
4506                impl<'a> serde::ser::Serialize for __With<'a> {
4507                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4508                    where
4509                        S: serde::ser::Serializer,
4510                    {
4511                        serde_with::As::<std::option::Option<wkt::internal::I64>>::serialize(
4512                            self.0, serializer,
4513                        )
4514                    }
4515                }
4516                state.serialize_entry("limit", &__With(&self.limit))?;
4517            }
4518            if !wkt::internal::is_default(&self.producer_instance_location) {
4519                state.serialize_entry(
4520                    "producerInstanceLocation",
4521                    &self.producer_instance_location,
4522                )?;
4523            }
4524            if !self
4525                .allowed_google_producers_resource_hierarchy_level
4526                .is_empty()
4527            {
4528                state.serialize_entry(
4529                    "allowedGoogleProducersResourceHierarchyLevel",
4530                    &self.allowed_google_producers_resource_hierarchy_level,
4531                )?;
4532            }
4533            if !self._unknown_fields.is_empty() {
4534                for (key, value) in self._unknown_fields.iter() {
4535                    state.serialize_entry(key, &value)?;
4536                }
4537            }
4538            state.end()
4539        }
4540    }
4541
4542    impl std::fmt::Debug for PscConfig {
4543        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4544            let mut debug_struct = f.debug_struct("PscConfig");
4545            debug_struct.field("subnetworks", &self.subnetworks);
4546            debug_struct.field("limit", &self.limit);
4547            debug_struct.field(
4548                "producer_instance_location",
4549                &self.producer_instance_location,
4550            );
4551            debug_struct.field(
4552                "allowed_google_producers_resource_hierarchy_level",
4553                &self.allowed_google_producers_resource_hierarchy_level,
4554            );
4555            if !self._unknown_fields.is_empty() {
4556                debug_struct.field("_unknown_fields", &self._unknown_fields);
4557            }
4558            debug_struct.finish()
4559        }
4560    }
4561
4562    /// Defines additional types related to [PscConfig].
4563    pub mod psc_config {
4564        #[allow(unused_imports)]
4565        use super::*;
4566
4567        /// ProducerInstanceLocation is used to specify which authorization mechanism
4568        /// to use to determine which projects the Producer instance can be within.
4569        ///
4570        /// # Working with unknown values
4571        ///
4572        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4573        /// additional enum variants at any time. Adding new variants is not considered
4574        /// a breaking change. Applications should write their code in anticipation of:
4575        ///
4576        /// - New values appearing in future releases of the client library, **and**
4577        /// - New values received dynamically, without application changes.
4578        ///
4579        /// Please consult the [Working with enums] section in the user guide for some
4580        /// guidelines.
4581        ///
4582        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4583        #[derive(Clone, Debug, PartialEq)]
4584        #[non_exhaustive]
4585        pub enum ProducerInstanceLocation {
4586            /// Producer instance location is not specified. When this option is
4587            /// chosen, then the PSC connections created by this
4588            /// ServiceConnectionPolicy must be within the same project as the Producer
4589            /// instance. This is the default ProducerInstanceLocation value.
4590            /// To allow for PSC connections from this network to other networks, use
4591            /// the CUSTOM_RESOURCE_HIERARCHY_LEVELS option.
4592            Unspecified,
4593            /// Producer instance must be within one of the values provided in
4594            /// allowed_google_producers_resource_hierarchy_level.
4595            CustomResourceHierarchyLevels,
4596            /// If set, the enum was initialized with an unknown value.
4597            ///
4598            /// Applications can examine the value using [ProducerInstanceLocation::value] or
4599            /// [ProducerInstanceLocation::name].
4600            UnknownValue(producer_instance_location::UnknownValue),
4601        }
4602
4603        #[doc(hidden)]
4604        pub mod producer_instance_location {
4605            #[allow(unused_imports)]
4606            use super::*;
4607            #[derive(Clone, Debug, PartialEq)]
4608            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4609        }
4610
4611        impl ProducerInstanceLocation {
4612            /// Gets the enum value.
4613            ///
4614            /// Returns `None` if the enum contains an unknown value deserialized from
4615            /// the string representation of enums.
4616            pub fn value(&self) -> std::option::Option<i32> {
4617                match self {
4618                    Self::Unspecified => std::option::Option::Some(0),
4619                    Self::CustomResourceHierarchyLevels => std::option::Option::Some(1),
4620                    Self::UnknownValue(u) => u.0.value(),
4621                }
4622            }
4623
4624            /// Gets the enum value as a string.
4625            ///
4626            /// Returns `None` if the enum contains an unknown value deserialized from
4627            /// the integer representation of enums.
4628            pub fn name(&self) -> std::option::Option<&str> {
4629                match self {
4630                    Self::Unspecified => {
4631                        std::option::Option::Some("PRODUCER_INSTANCE_LOCATION_UNSPECIFIED")
4632                    }
4633                    Self::CustomResourceHierarchyLevels => {
4634                        std::option::Option::Some("CUSTOM_RESOURCE_HIERARCHY_LEVELS")
4635                    }
4636                    Self::UnknownValue(u) => u.0.name(),
4637                }
4638            }
4639        }
4640
4641        impl std::default::Default for ProducerInstanceLocation {
4642            fn default() -> Self {
4643                use std::convert::From;
4644                Self::from(0)
4645            }
4646        }
4647
4648        impl std::fmt::Display for ProducerInstanceLocation {
4649            fn fmt(
4650                &self,
4651                f: &mut std::fmt::Formatter<'_>,
4652            ) -> std::result::Result<(), std::fmt::Error> {
4653                wkt::internal::display_enum(f, self.name(), self.value())
4654            }
4655        }
4656
4657        impl std::convert::From<i32> for ProducerInstanceLocation {
4658            fn from(value: i32) -> Self {
4659                match value {
4660                    0 => Self::Unspecified,
4661                    1 => Self::CustomResourceHierarchyLevels,
4662                    _ => Self::UnknownValue(producer_instance_location::UnknownValue(
4663                        wkt::internal::UnknownEnumValue::Integer(value),
4664                    )),
4665                }
4666            }
4667        }
4668
4669        impl std::convert::From<&str> for ProducerInstanceLocation {
4670            fn from(value: &str) -> Self {
4671                use std::string::ToString;
4672                match value {
4673                    "PRODUCER_INSTANCE_LOCATION_UNSPECIFIED" => Self::Unspecified,
4674                    "CUSTOM_RESOURCE_HIERARCHY_LEVELS" => Self::CustomResourceHierarchyLevels,
4675                    _ => Self::UnknownValue(producer_instance_location::UnknownValue(
4676                        wkt::internal::UnknownEnumValue::String(value.to_string()),
4677                    )),
4678                }
4679            }
4680        }
4681
4682        impl serde::ser::Serialize for ProducerInstanceLocation {
4683            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4684            where
4685                S: serde::Serializer,
4686            {
4687                match self {
4688                    Self::Unspecified => serializer.serialize_i32(0),
4689                    Self::CustomResourceHierarchyLevels => serializer.serialize_i32(1),
4690                    Self::UnknownValue(u) => u.0.serialize(serializer),
4691                }
4692            }
4693        }
4694
4695        impl<'de> serde::de::Deserialize<'de> for ProducerInstanceLocation {
4696            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4697            where
4698                D: serde::Deserializer<'de>,
4699            {
4700                deserializer.deserialize_any(wkt::internal::EnumVisitor::<ProducerInstanceLocation>::new(
4701                    ".google.cloud.networkconnectivity.v1.ServiceConnectionPolicy.PscConfig.ProducerInstanceLocation"))
4702            }
4703        }
4704    }
4705
4706    /// Information about a specific Private Service Connect connection.
4707    #[derive(Clone, Default, PartialEq)]
4708    #[non_exhaustive]
4709    pub struct PscConnection {
4710        /// State of the PSC Connection
4711        pub state: crate::model::service_connection_policy::State,
4712
4713        /// The resource reference of the PSC Forwarding Rule within the consumer
4714        /// VPC.
4715        pub consumer_forwarding_rule: std::string::String,
4716
4717        /// The resource reference of the consumer address.
4718        pub consumer_address: std::string::String,
4719
4720        /// The error type indicates whether the error is consumer facing, producer
4721        /// facing or system internal.
4722        #[deprecated]
4723        pub error_type: crate::model::ConnectionErrorType,
4724
4725        /// The most recent error during operating this connection.
4726        /// Deprecated, please use error_info instead.
4727        #[deprecated]
4728        pub error: std::option::Option<rpc::model::Status>,
4729
4730        /// The last Compute Engine operation to setup PSC connection.
4731        pub gce_operation: std::string::String,
4732
4733        /// The project where the PSC connection is created.
4734        pub consumer_target_project: std::string::String,
4735
4736        /// The PSC connection id of the PSC forwarding rule.
4737        pub psc_connection_id: std::string::String,
4738
4739        /// Output only. The error info for the latest error during operating this
4740        /// connection.
4741        pub error_info: std::option::Option<rpc::model::ErrorInfo>,
4742
4743        /// Output only. The URI of the subnetwork selected to allocate IP address
4744        /// for this connection.
4745        pub selected_subnetwork: std::string::String,
4746
4747        /// Immutable. Deprecated. Use producer_instance_metadata instead.
4748        /// An immutable identifier for the producer instance.
4749        #[deprecated]
4750        pub producer_instance_id: std::string::String,
4751
4752        /// Immutable. An immutable map for the producer instance metadata.
4753        pub producer_instance_metadata:
4754            std::collections::HashMap<std::string::String, std::string::String>,
4755
4756        /// Output only. [Output only] The service class associated with this PSC
4757        /// Connection. The value is derived from the SCPolicy and matches the
4758        /// service class name provided by the customer.
4759        pub service_class: std::string::String,
4760
4761        /// The requested IP version for the PSC connection.
4762        pub ip_version: std::option::Option<crate::model::IPVersion>,
4763
4764        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4765    }
4766
4767    impl PscConnection {
4768        pub fn new() -> Self {
4769            std::default::Default::default()
4770        }
4771
4772        /// Sets the value of [state][crate::model::service_connection_policy::PscConnection::state].
4773        pub fn set_state<T: std::convert::Into<crate::model::service_connection_policy::State>>(
4774            mut self,
4775            v: T,
4776        ) -> Self {
4777            self.state = v.into();
4778            self
4779        }
4780
4781        /// Sets the value of [consumer_forwarding_rule][crate::model::service_connection_policy::PscConnection::consumer_forwarding_rule].
4782        pub fn set_consumer_forwarding_rule<T: std::convert::Into<std::string::String>>(
4783            mut self,
4784            v: T,
4785        ) -> Self {
4786            self.consumer_forwarding_rule = v.into();
4787            self
4788        }
4789
4790        /// Sets the value of [consumer_address][crate::model::service_connection_policy::PscConnection::consumer_address].
4791        pub fn set_consumer_address<T: std::convert::Into<std::string::String>>(
4792            mut self,
4793            v: T,
4794        ) -> Self {
4795            self.consumer_address = v.into();
4796            self
4797        }
4798
4799        /// Sets the value of [error_type][crate::model::service_connection_policy::PscConnection::error_type].
4800        #[deprecated]
4801        pub fn set_error_type<T: std::convert::Into<crate::model::ConnectionErrorType>>(
4802            mut self,
4803            v: T,
4804        ) -> Self {
4805            self.error_type = v.into();
4806            self
4807        }
4808
4809        /// Sets the value of [error][crate::model::service_connection_policy::PscConnection::error].
4810        #[deprecated]
4811        pub fn set_error<T>(mut self, v: T) -> Self
4812        where
4813            T: std::convert::Into<rpc::model::Status>,
4814        {
4815            self.error = std::option::Option::Some(v.into());
4816            self
4817        }
4818
4819        /// Sets or clears the value of [error][crate::model::service_connection_policy::PscConnection::error].
4820        #[deprecated]
4821        pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
4822        where
4823            T: std::convert::Into<rpc::model::Status>,
4824        {
4825            self.error = v.map(|x| x.into());
4826            self
4827        }
4828
4829        /// Sets the value of [gce_operation][crate::model::service_connection_policy::PscConnection::gce_operation].
4830        pub fn set_gce_operation<T: std::convert::Into<std::string::String>>(
4831            mut self,
4832            v: T,
4833        ) -> Self {
4834            self.gce_operation = v.into();
4835            self
4836        }
4837
4838        /// Sets the value of [consumer_target_project][crate::model::service_connection_policy::PscConnection::consumer_target_project].
4839        pub fn set_consumer_target_project<T: std::convert::Into<std::string::String>>(
4840            mut self,
4841            v: T,
4842        ) -> Self {
4843            self.consumer_target_project = v.into();
4844            self
4845        }
4846
4847        /// Sets the value of [psc_connection_id][crate::model::service_connection_policy::PscConnection::psc_connection_id].
4848        pub fn set_psc_connection_id<T: std::convert::Into<std::string::String>>(
4849            mut self,
4850            v: T,
4851        ) -> Self {
4852            self.psc_connection_id = v.into();
4853            self
4854        }
4855
4856        /// Sets the value of [error_info][crate::model::service_connection_policy::PscConnection::error_info].
4857        pub fn set_error_info<T>(mut self, v: T) -> Self
4858        where
4859            T: std::convert::Into<rpc::model::ErrorInfo>,
4860        {
4861            self.error_info = std::option::Option::Some(v.into());
4862            self
4863        }
4864
4865        /// Sets or clears the value of [error_info][crate::model::service_connection_policy::PscConnection::error_info].
4866        pub fn set_or_clear_error_info<T>(mut self, v: std::option::Option<T>) -> Self
4867        where
4868            T: std::convert::Into<rpc::model::ErrorInfo>,
4869        {
4870            self.error_info = v.map(|x| x.into());
4871            self
4872        }
4873
4874        /// Sets the value of [selected_subnetwork][crate::model::service_connection_policy::PscConnection::selected_subnetwork].
4875        pub fn set_selected_subnetwork<T: std::convert::Into<std::string::String>>(
4876            mut self,
4877            v: T,
4878        ) -> Self {
4879            self.selected_subnetwork = v.into();
4880            self
4881        }
4882
4883        /// Sets the value of [producer_instance_id][crate::model::service_connection_policy::PscConnection::producer_instance_id].
4884        #[deprecated]
4885        pub fn set_producer_instance_id<T: std::convert::Into<std::string::String>>(
4886            mut self,
4887            v: T,
4888        ) -> Self {
4889            self.producer_instance_id = v.into();
4890            self
4891        }
4892
4893        /// Sets the value of [producer_instance_metadata][crate::model::service_connection_policy::PscConnection::producer_instance_metadata].
4894        pub fn set_producer_instance_metadata<T, K, V>(mut self, v: T) -> Self
4895        where
4896            T: std::iter::IntoIterator<Item = (K, V)>,
4897            K: std::convert::Into<std::string::String>,
4898            V: std::convert::Into<std::string::String>,
4899        {
4900            use std::iter::Iterator;
4901            self.producer_instance_metadata =
4902                v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4903            self
4904        }
4905
4906        /// Sets the value of [service_class][crate::model::service_connection_policy::PscConnection::service_class].
4907        pub fn set_service_class<T: std::convert::Into<std::string::String>>(
4908            mut self,
4909            v: T,
4910        ) -> Self {
4911            self.service_class = v.into();
4912            self
4913        }
4914
4915        /// Sets the value of [ip_version][crate::model::service_connection_policy::PscConnection::ip_version].
4916        pub fn set_ip_version<T>(mut self, v: T) -> Self
4917        where
4918            T: std::convert::Into<crate::model::IPVersion>,
4919        {
4920            self.ip_version = std::option::Option::Some(v.into());
4921            self
4922        }
4923
4924        /// Sets or clears the value of [ip_version][crate::model::service_connection_policy::PscConnection::ip_version].
4925        pub fn set_or_clear_ip_version<T>(mut self, v: std::option::Option<T>) -> Self
4926        where
4927            T: std::convert::Into<crate::model::IPVersion>,
4928        {
4929            self.ip_version = v.map(|x| x.into());
4930            self
4931        }
4932    }
4933
4934    impl wkt::message::Message for PscConnection {
4935        fn typename() -> &'static str {
4936            "type.googleapis.com/google.cloud.networkconnectivity.v1.ServiceConnectionPolicy.PscConnection"
4937        }
4938    }
4939
4940    #[doc(hidden)]
4941    impl<'de> serde::de::Deserialize<'de> for PscConnection {
4942        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4943        where
4944            D: serde::Deserializer<'de>,
4945        {
4946            #[allow(non_camel_case_types)]
4947            #[doc(hidden)]
4948            #[derive(PartialEq, Eq, Hash)]
4949            enum __FieldTag {
4950                __state,
4951                __consumer_forwarding_rule,
4952                __consumer_address,
4953                __error_type,
4954                __error,
4955                __gce_operation,
4956                __consumer_target_project,
4957                __psc_connection_id,
4958                __error_info,
4959                __selected_subnetwork,
4960                __producer_instance_id,
4961                __producer_instance_metadata,
4962                __service_class,
4963                __ip_version,
4964                Unknown(std::string::String),
4965            }
4966            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4967                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4968                where
4969                    D: serde::Deserializer<'de>,
4970                {
4971                    struct Visitor;
4972                    impl<'de> serde::de::Visitor<'de> for Visitor {
4973                        type Value = __FieldTag;
4974                        fn expecting(
4975                            &self,
4976                            formatter: &mut std::fmt::Formatter,
4977                        ) -> std::fmt::Result {
4978                            formatter.write_str("a field name for PscConnection")
4979                        }
4980                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4981                        where
4982                            E: serde::de::Error,
4983                        {
4984                            use std::result::Result::Ok;
4985                            use std::string::ToString;
4986                            match value {
4987                                "state" => Ok(__FieldTag::__state),
4988                                "consumerForwardingRule" => {
4989                                    Ok(__FieldTag::__consumer_forwarding_rule)
4990                                }
4991                                "consumer_forwarding_rule" => {
4992                                    Ok(__FieldTag::__consumer_forwarding_rule)
4993                                }
4994                                "consumerAddress" => Ok(__FieldTag::__consumer_address),
4995                                "consumer_address" => Ok(__FieldTag::__consumer_address),
4996                                "errorType" => Ok(__FieldTag::__error_type),
4997                                "error_type" => Ok(__FieldTag::__error_type),
4998                                "error" => Ok(__FieldTag::__error),
4999                                "gceOperation" => Ok(__FieldTag::__gce_operation),
5000                                "gce_operation" => Ok(__FieldTag::__gce_operation),
5001                                "consumerTargetProject" => {
5002                                    Ok(__FieldTag::__consumer_target_project)
5003                                }
5004                                "consumer_target_project" => {
5005                                    Ok(__FieldTag::__consumer_target_project)
5006                                }
5007                                "pscConnectionId" => Ok(__FieldTag::__psc_connection_id),
5008                                "psc_connection_id" => Ok(__FieldTag::__psc_connection_id),
5009                                "errorInfo" => Ok(__FieldTag::__error_info),
5010                                "error_info" => Ok(__FieldTag::__error_info),
5011                                "selectedSubnetwork" => Ok(__FieldTag::__selected_subnetwork),
5012                                "selected_subnetwork" => Ok(__FieldTag::__selected_subnetwork),
5013                                "producerInstanceId" => Ok(__FieldTag::__producer_instance_id),
5014                                "producer_instance_id" => Ok(__FieldTag::__producer_instance_id),
5015                                "producerInstanceMetadata" => {
5016                                    Ok(__FieldTag::__producer_instance_metadata)
5017                                }
5018                                "producer_instance_metadata" => {
5019                                    Ok(__FieldTag::__producer_instance_metadata)
5020                                }
5021                                "serviceClass" => Ok(__FieldTag::__service_class),
5022                                "service_class" => Ok(__FieldTag::__service_class),
5023                                "ipVersion" => Ok(__FieldTag::__ip_version),
5024                                "ip_version" => Ok(__FieldTag::__ip_version),
5025                                _ => Ok(__FieldTag::Unknown(value.to_string())),
5026                            }
5027                        }
5028                    }
5029                    deserializer.deserialize_identifier(Visitor)
5030                }
5031            }
5032            struct Visitor;
5033            impl<'de> serde::de::Visitor<'de> for Visitor {
5034                type Value = PscConnection;
5035                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5036                    formatter.write_str("struct PscConnection")
5037                }
5038                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5039                where
5040                    A: serde::de::MapAccess<'de>,
5041                {
5042                    #[allow(unused_imports)]
5043                    use serde::de::Error;
5044                    use std::option::Option::Some;
5045                    let mut fields = std::collections::HashSet::new();
5046                    let mut result = Self::Value::new();
5047                    while let Some(tag) = map.next_key::<__FieldTag>()? {
5048                        #[allow(clippy::match_single_binding)]
5049                        match tag {
5050                            __FieldTag::__state => {
5051                                if !fields.insert(__FieldTag::__state) {
5052                                    return std::result::Result::Err(A::Error::duplicate_field(
5053                                        "multiple values for state",
5054                                    ));
5055                                }
5056                                result.state = map
5057                                    .next_value::<std::option::Option<
5058                                        crate::model::service_connection_policy::State,
5059                                    >>()?
5060                                    .unwrap_or_default();
5061                            }
5062                            __FieldTag::__consumer_forwarding_rule => {
5063                                if !fields.insert(__FieldTag::__consumer_forwarding_rule) {
5064                                    return std::result::Result::Err(A::Error::duplicate_field(
5065                                        "multiple values for consumer_forwarding_rule",
5066                                    ));
5067                                }
5068                                result.consumer_forwarding_rule = map
5069                                    .next_value::<std::option::Option<std::string::String>>()?
5070                                    .unwrap_or_default();
5071                            }
5072                            __FieldTag::__consumer_address => {
5073                                if !fields.insert(__FieldTag::__consumer_address) {
5074                                    return std::result::Result::Err(A::Error::duplicate_field(
5075                                        "multiple values for consumer_address",
5076                                    ));
5077                                }
5078                                result.consumer_address = map
5079                                    .next_value::<std::option::Option<std::string::String>>()?
5080                                    .unwrap_or_default();
5081                            }
5082                            __FieldTag::__error_type => {
5083                                if !fields.insert(__FieldTag::__error_type) {
5084                                    return std::result::Result::Err(A::Error::duplicate_field(
5085                                        "multiple values for error_type",
5086                                    ));
5087                                }
5088                                result.error_type = map.next_value::<std::option::Option<crate::model::ConnectionErrorType>>()?.unwrap_or_default();
5089                            }
5090                            __FieldTag::__error => {
5091                                if !fields.insert(__FieldTag::__error) {
5092                                    return std::result::Result::Err(A::Error::duplicate_field(
5093                                        "multiple values for error",
5094                                    ));
5095                                }
5096                                result.error =
5097                                    map.next_value::<std::option::Option<rpc::model::Status>>()?;
5098                            }
5099                            __FieldTag::__gce_operation => {
5100                                if !fields.insert(__FieldTag::__gce_operation) {
5101                                    return std::result::Result::Err(A::Error::duplicate_field(
5102                                        "multiple values for gce_operation",
5103                                    ));
5104                                }
5105                                result.gce_operation = map
5106                                    .next_value::<std::option::Option<std::string::String>>()?
5107                                    .unwrap_or_default();
5108                            }
5109                            __FieldTag::__consumer_target_project => {
5110                                if !fields.insert(__FieldTag::__consumer_target_project) {
5111                                    return std::result::Result::Err(A::Error::duplicate_field(
5112                                        "multiple values for consumer_target_project",
5113                                    ));
5114                                }
5115                                result.consumer_target_project = map
5116                                    .next_value::<std::option::Option<std::string::String>>()?
5117                                    .unwrap_or_default();
5118                            }
5119                            __FieldTag::__psc_connection_id => {
5120                                if !fields.insert(__FieldTag::__psc_connection_id) {
5121                                    return std::result::Result::Err(A::Error::duplicate_field(
5122                                        "multiple values for psc_connection_id",
5123                                    ));
5124                                }
5125                                result.psc_connection_id = map
5126                                    .next_value::<std::option::Option<std::string::String>>()?
5127                                    .unwrap_or_default();
5128                            }
5129                            __FieldTag::__error_info => {
5130                                if !fields.insert(__FieldTag::__error_info) {
5131                                    return std::result::Result::Err(A::Error::duplicate_field(
5132                                        "multiple values for error_info",
5133                                    ));
5134                                }
5135                                result.error_info =
5136                                    map.next_value::<std::option::Option<rpc::model::ErrorInfo>>()?;
5137                            }
5138                            __FieldTag::__selected_subnetwork => {
5139                                if !fields.insert(__FieldTag::__selected_subnetwork) {
5140                                    return std::result::Result::Err(A::Error::duplicate_field(
5141                                        "multiple values for selected_subnetwork",
5142                                    ));
5143                                }
5144                                result.selected_subnetwork = map
5145                                    .next_value::<std::option::Option<std::string::String>>()?
5146                                    .unwrap_or_default();
5147                            }
5148                            __FieldTag::__producer_instance_id => {
5149                                if !fields.insert(__FieldTag::__producer_instance_id) {
5150                                    return std::result::Result::Err(A::Error::duplicate_field(
5151                                        "multiple values for producer_instance_id",
5152                                    ));
5153                                }
5154                                result.producer_instance_id = map
5155                                    .next_value::<std::option::Option<std::string::String>>()?
5156                                    .unwrap_or_default();
5157                            }
5158                            __FieldTag::__producer_instance_metadata => {
5159                                if !fields.insert(__FieldTag::__producer_instance_metadata) {
5160                                    return std::result::Result::Err(A::Error::duplicate_field(
5161                                        "multiple values for producer_instance_metadata",
5162                                    ));
5163                                }
5164                                result.producer_instance_metadata = map
5165                                    .next_value::<std::option::Option<
5166                                        std::collections::HashMap<
5167                                            std::string::String,
5168                                            std::string::String,
5169                                        >,
5170                                    >>()?
5171                                    .unwrap_or_default();
5172                            }
5173                            __FieldTag::__service_class => {
5174                                if !fields.insert(__FieldTag::__service_class) {
5175                                    return std::result::Result::Err(A::Error::duplicate_field(
5176                                        "multiple values for service_class",
5177                                    ));
5178                                }
5179                                result.service_class = map
5180                                    .next_value::<std::option::Option<std::string::String>>()?
5181                                    .unwrap_or_default();
5182                            }
5183                            __FieldTag::__ip_version => {
5184                                if !fields.insert(__FieldTag::__ip_version) {
5185                                    return std::result::Result::Err(A::Error::duplicate_field(
5186                                        "multiple values for ip_version",
5187                                    ));
5188                                }
5189                                result.ip_version = map
5190                                    .next_value::<std::option::Option<crate::model::IPVersion>>()?;
5191                            }
5192                            __FieldTag::Unknown(key) => {
5193                                let value = map.next_value::<serde_json::Value>()?;
5194                                result._unknown_fields.insert(key, value);
5195                            }
5196                        }
5197                    }
5198                    std::result::Result::Ok(result)
5199                }
5200            }
5201            deserializer.deserialize_any(Visitor)
5202        }
5203    }
5204
5205    #[doc(hidden)]
5206    impl serde::ser::Serialize for PscConnection {
5207        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5208        where
5209            S: serde::ser::Serializer,
5210        {
5211            use serde::ser::SerializeMap;
5212            #[allow(unused_imports)]
5213            use std::option::Option::Some;
5214            let mut state = serializer.serialize_map(std::option::Option::None)?;
5215            if !wkt::internal::is_default(&self.state) {
5216                state.serialize_entry("state", &self.state)?;
5217            }
5218            if !self.consumer_forwarding_rule.is_empty() {
5219                state.serialize_entry("consumerForwardingRule", &self.consumer_forwarding_rule)?;
5220            }
5221            if !self.consumer_address.is_empty() {
5222                state.serialize_entry("consumerAddress", &self.consumer_address)?;
5223            }
5224            if !wkt::internal::is_default(&self.error_type) {
5225                state.serialize_entry("errorType", &self.error_type)?;
5226            }
5227            if self.error.is_some() {
5228                state.serialize_entry("error", &self.error)?;
5229            }
5230            if !self.gce_operation.is_empty() {
5231                state.serialize_entry("gceOperation", &self.gce_operation)?;
5232            }
5233            if !self.consumer_target_project.is_empty() {
5234                state.serialize_entry("consumerTargetProject", &self.consumer_target_project)?;
5235            }
5236            if !self.psc_connection_id.is_empty() {
5237                state.serialize_entry("pscConnectionId", &self.psc_connection_id)?;
5238            }
5239            if self.error_info.is_some() {
5240                state.serialize_entry("errorInfo", &self.error_info)?;
5241            }
5242            if !self.selected_subnetwork.is_empty() {
5243                state.serialize_entry("selectedSubnetwork", &self.selected_subnetwork)?;
5244            }
5245            if !self.producer_instance_id.is_empty() {
5246                state.serialize_entry("producerInstanceId", &self.producer_instance_id)?;
5247            }
5248            if !self.producer_instance_metadata.is_empty() {
5249                state.serialize_entry(
5250                    "producerInstanceMetadata",
5251                    &self.producer_instance_metadata,
5252                )?;
5253            }
5254            if !self.service_class.is_empty() {
5255                state.serialize_entry("serviceClass", &self.service_class)?;
5256            }
5257            if self.ip_version.is_some() {
5258                state.serialize_entry("ipVersion", &self.ip_version)?;
5259            }
5260            if !self._unknown_fields.is_empty() {
5261                for (key, value) in self._unknown_fields.iter() {
5262                    state.serialize_entry(key, &value)?;
5263                }
5264            }
5265            state.end()
5266        }
5267    }
5268
5269    impl std::fmt::Debug for PscConnection {
5270        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5271            let mut debug_struct = f.debug_struct("PscConnection");
5272            debug_struct.field("state", &self.state);
5273            debug_struct.field("consumer_forwarding_rule", &self.consumer_forwarding_rule);
5274            debug_struct.field("consumer_address", &self.consumer_address);
5275            debug_struct.field("error_type", &self.error_type);
5276            debug_struct.field("error", &self.error);
5277            debug_struct.field("gce_operation", &self.gce_operation);
5278            debug_struct.field("consumer_target_project", &self.consumer_target_project);
5279            debug_struct.field("psc_connection_id", &self.psc_connection_id);
5280            debug_struct.field("error_info", &self.error_info);
5281            debug_struct.field("selected_subnetwork", &self.selected_subnetwork);
5282            debug_struct.field("producer_instance_id", &self.producer_instance_id);
5283            debug_struct.field(
5284                "producer_instance_metadata",
5285                &self.producer_instance_metadata,
5286            );
5287            debug_struct.field("service_class", &self.service_class);
5288            debug_struct.field("ip_version", &self.ip_version);
5289            if !self._unknown_fields.is_empty() {
5290                debug_struct.field("_unknown_fields", &self._unknown_fields);
5291            }
5292            debug_struct.finish()
5293        }
5294    }
5295
5296    /// The state of the PSC connection.
5297    /// We reserve the right to add more states without notice in the future.
5298    /// Users should not use exhaustive switch statements on this enum.
5299    /// See <https://google.aip.dev/216>.
5300    ///
5301    /// # Working with unknown values
5302    ///
5303    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5304    /// additional enum variants at any time. Adding new variants is not considered
5305    /// a breaking change. Applications should write their code in anticipation of:
5306    ///
5307    /// - New values appearing in future releases of the client library, **and**
5308    /// - New values received dynamically, without application changes.
5309    ///
5310    /// Please consult the [Working with enums] section in the user guide for some
5311    /// guidelines.
5312    ///
5313    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5314    #[derive(Clone, Debug, PartialEq)]
5315    #[non_exhaustive]
5316    pub enum State {
5317        /// An invalid state as the default case.
5318        Unspecified,
5319        /// The connection has been created successfully. However, for the
5320        /// up-to-date connection status, please use the created forwarding rule's
5321        /// "PscConnectionStatus" as the source of truth.
5322        Active,
5323        /// The connection is not functional since some resources on the connection
5324        /// fail to be created.
5325        Failed,
5326        /// The connection is being created.
5327        Creating,
5328        /// The connection is being deleted.
5329        Deleting,
5330        /// The connection is being repaired to complete creation.
5331        CreateRepairing,
5332        /// The connection is being repaired to complete deletion.
5333        DeleteRepairing,
5334        /// If set, the enum was initialized with an unknown value.
5335        ///
5336        /// Applications can examine the value using [State::value] or
5337        /// [State::name].
5338        UnknownValue(state::UnknownValue),
5339    }
5340
5341    #[doc(hidden)]
5342    pub mod state {
5343        #[allow(unused_imports)]
5344        use super::*;
5345        #[derive(Clone, Debug, PartialEq)]
5346        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5347    }
5348
5349    impl State {
5350        /// Gets the enum value.
5351        ///
5352        /// Returns `None` if the enum contains an unknown value deserialized from
5353        /// the string representation of enums.
5354        pub fn value(&self) -> std::option::Option<i32> {
5355            match self {
5356                Self::Unspecified => std::option::Option::Some(0),
5357                Self::Active => std::option::Option::Some(1),
5358                Self::Failed => std::option::Option::Some(2),
5359                Self::Creating => std::option::Option::Some(3),
5360                Self::Deleting => std::option::Option::Some(4),
5361                Self::CreateRepairing => std::option::Option::Some(5),
5362                Self::DeleteRepairing => std::option::Option::Some(6),
5363                Self::UnknownValue(u) => u.0.value(),
5364            }
5365        }
5366
5367        /// Gets the enum value as a string.
5368        ///
5369        /// Returns `None` if the enum contains an unknown value deserialized from
5370        /// the integer representation of enums.
5371        pub fn name(&self) -> std::option::Option<&str> {
5372            match self {
5373                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
5374                Self::Active => std::option::Option::Some("ACTIVE"),
5375                Self::Failed => std::option::Option::Some("FAILED"),
5376                Self::Creating => std::option::Option::Some("CREATING"),
5377                Self::Deleting => std::option::Option::Some("DELETING"),
5378                Self::CreateRepairing => std::option::Option::Some("CREATE_REPAIRING"),
5379                Self::DeleteRepairing => std::option::Option::Some("DELETE_REPAIRING"),
5380                Self::UnknownValue(u) => u.0.name(),
5381            }
5382        }
5383    }
5384
5385    impl std::default::Default for State {
5386        fn default() -> Self {
5387            use std::convert::From;
5388            Self::from(0)
5389        }
5390    }
5391
5392    impl std::fmt::Display for State {
5393        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5394            wkt::internal::display_enum(f, self.name(), self.value())
5395        }
5396    }
5397
5398    impl std::convert::From<i32> for State {
5399        fn from(value: i32) -> Self {
5400            match value {
5401                0 => Self::Unspecified,
5402                1 => Self::Active,
5403                2 => Self::Failed,
5404                3 => Self::Creating,
5405                4 => Self::Deleting,
5406                5 => Self::CreateRepairing,
5407                6 => Self::DeleteRepairing,
5408                _ => Self::UnknownValue(state::UnknownValue(
5409                    wkt::internal::UnknownEnumValue::Integer(value),
5410                )),
5411            }
5412        }
5413    }
5414
5415    impl std::convert::From<&str> for State {
5416        fn from(value: &str) -> Self {
5417            use std::string::ToString;
5418            match value {
5419                "STATE_UNSPECIFIED" => Self::Unspecified,
5420                "ACTIVE" => Self::Active,
5421                "FAILED" => Self::Failed,
5422                "CREATING" => Self::Creating,
5423                "DELETING" => Self::Deleting,
5424                "CREATE_REPAIRING" => Self::CreateRepairing,
5425                "DELETE_REPAIRING" => Self::DeleteRepairing,
5426                _ => Self::UnknownValue(state::UnknownValue(
5427                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5428                )),
5429            }
5430        }
5431    }
5432
5433    impl serde::ser::Serialize for State {
5434        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5435        where
5436            S: serde::Serializer,
5437        {
5438            match self {
5439                Self::Unspecified => serializer.serialize_i32(0),
5440                Self::Active => serializer.serialize_i32(1),
5441                Self::Failed => serializer.serialize_i32(2),
5442                Self::Creating => serializer.serialize_i32(3),
5443                Self::Deleting => serializer.serialize_i32(4),
5444                Self::CreateRepairing => serializer.serialize_i32(5),
5445                Self::DeleteRepairing => serializer.serialize_i32(6),
5446                Self::UnknownValue(u) => u.0.serialize(serializer),
5447            }
5448        }
5449    }
5450
5451    impl<'de> serde::de::Deserialize<'de> for State {
5452        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5453        where
5454            D: serde::Deserializer<'de>,
5455        {
5456            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
5457                ".google.cloud.networkconnectivity.v1.ServiceConnectionPolicy.State",
5458            ))
5459        }
5460    }
5461}
5462
5463/// Request for ListServiceConnectionPolicies.
5464#[derive(Clone, Default, PartialEq)]
5465#[non_exhaustive]
5466pub struct ListServiceConnectionPoliciesRequest {
5467    /// Required. The parent resource's name. ex. projects/123/locations/us-east1
5468    pub parent: std::string::String,
5469
5470    /// The maximum number of results per page that should be returned.
5471    pub page_size: i32,
5472
5473    /// The page token.
5474    pub page_token: std::string::String,
5475
5476    /// A filter expression that filters the results listed in the response.
5477    pub filter: std::string::String,
5478
5479    /// Sort the results by a certain order.
5480    pub order_by: std::string::String,
5481
5482    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5483}
5484
5485impl ListServiceConnectionPoliciesRequest {
5486    pub fn new() -> Self {
5487        std::default::Default::default()
5488    }
5489
5490    /// Sets the value of [parent][crate::model::ListServiceConnectionPoliciesRequest::parent].
5491    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5492        self.parent = v.into();
5493        self
5494    }
5495
5496    /// Sets the value of [page_size][crate::model::ListServiceConnectionPoliciesRequest::page_size].
5497    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5498        self.page_size = v.into();
5499        self
5500    }
5501
5502    /// Sets the value of [page_token][crate::model::ListServiceConnectionPoliciesRequest::page_token].
5503    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5504        self.page_token = v.into();
5505        self
5506    }
5507
5508    /// Sets the value of [filter][crate::model::ListServiceConnectionPoliciesRequest::filter].
5509    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5510        self.filter = v.into();
5511        self
5512    }
5513
5514    /// Sets the value of [order_by][crate::model::ListServiceConnectionPoliciesRequest::order_by].
5515    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5516        self.order_by = v.into();
5517        self
5518    }
5519}
5520
5521impl wkt::message::Message for ListServiceConnectionPoliciesRequest {
5522    fn typename() -> &'static str {
5523        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListServiceConnectionPoliciesRequest"
5524    }
5525}
5526
5527#[doc(hidden)]
5528impl<'de> serde::de::Deserialize<'de> for ListServiceConnectionPoliciesRequest {
5529    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5530    where
5531        D: serde::Deserializer<'de>,
5532    {
5533        #[allow(non_camel_case_types)]
5534        #[doc(hidden)]
5535        #[derive(PartialEq, Eq, Hash)]
5536        enum __FieldTag {
5537            __parent,
5538            __page_size,
5539            __page_token,
5540            __filter,
5541            __order_by,
5542            Unknown(std::string::String),
5543        }
5544        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5545            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5546            where
5547                D: serde::Deserializer<'de>,
5548            {
5549                struct Visitor;
5550                impl<'de> serde::de::Visitor<'de> for Visitor {
5551                    type Value = __FieldTag;
5552                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5553                        formatter.write_str("a field name for ListServiceConnectionPoliciesRequest")
5554                    }
5555                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5556                    where
5557                        E: serde::de::Error,
5558                    {
5559                        use std::result::Result::Ok;
5560                        use std::string::ToString;
5561                        match value {
5562                            "parent" => Ok(__FieldTag::__parent),
5563                            "pageSize" => Ok(__FieldTag::__page_size),
5564                            "page_size" => Ok(__FieldTag::__page_size),
5565                            "pageToken" => Ok(__FieldTag::__page_token),
5566                            "page_token" => Ok(__FieldTag::__page_token),
5567                            "filter" => Ok(__FieldTag::__filter),
5568                            "orderBy" => Ok(__FieldTag::__order_by),
5569                            "order_by" => Ok(__FieldTag::__order_by),
5570                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5571                        }
5572                    }
5573                }
5574                deserializer.deserialize_identifier(Visitor)
5575            }
5576        }
5577        struct Visitor;
5578        impl<'de> serde::de::Visitor<'de> for Visitor {
5579            type Value = ListServiceConnectionPoliciesRequest;
5580            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5581                formatter.write_str("struct ListServiceConnectionPoliciesRequest")
5582            }
5583            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5584            where
5585                A: serde::de::MapAccess<'de>,
5586            {
5587                #[allow(unused_imports)]
5588                use serde::de::Error;
5589                use std::option::Option::Some;
5590                let mut fields = std::collections::HashSet::new();
5591                let mut result = Self::Value::new();
5592                while let Some(tag) = map.next_key::<__FieldTag>()? {
5593                    #[allow(clippy::match_single_binding)]
5594                    match tag {
5595                        __FieldTag::__parent => {
5596                            if !fields.insert(__FieldTag::__parent) {
5597                                return std::result::Result::Err(A::Error::duplicate_field(
5598                                    "multiple values for parent",
5599                                ));
5600                            }
5601                            result.parent = map
5602                                .next_value::<std::option::Option<std::string::String>>()?
5603                                .unwrap_or_default();
5604                        }
5605                        __FieldTag::__page_size => {
5606                            if !fields.insert(__FieldTag::__page_size) {
5607                                return std::result::Result::Err(A::Error::duplicate_field(
5608                                    "multiple values for page_size",
5609                                ));
5610                            }
5611                            struct __With(std::option::Option<i32>);
5612                            impl<'de> serde::de::Deserialize<'de> for __With {
5613                                fn deserialize<D>(
5614                                    deserializer: D,
5615                                ) -> std::result::Result<Self, D::Error>
5616                                where
5617                                    D: serde::de::Deserializer<'de>,
5618                                {
5619                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
5620                                }
5621                            }
5622                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
5623                        }
5624                        __FieldTag::__page_token => {
5625                            if !fields.insert(__FieldTag::__page_token) {
5626                                return std::result::Result::Err(A::Error::duplicate_field(
5627                                    "multiple values for page_token",
5628                                ));
5629                            }
5630                            result.page_token = map
5631                                .next_value::<std::option::Option<std::string::String>>()?
5632                                .unwrap_or_default();
5633                        }
5634                        __FieldTag::__filter => {
5635                            if !fields.insert(__FieldTag::__filter) {
5636                                return std::result::Result::Err(A::Error::duplicate_field(
5637                                    "multiple values for filter",
5638                                ));
5639                            }
5640                            result.filter = map
5641                                .next_value::<std::option::Option<std::string::String>>()?
5642                                .unwrap_or_default();
5643                        }
5644                        __FieldTag::__order_by => {
5645                            if !fields.insert(__FieldTag::__order_by) {
5646                                return std::result::Result::Err(A::Error::duplicate_field(
5647                                    "multiple values for order_by",
5648                                ));
5649                            }
5650                            result.order_by = map
5651                                .next_value::<std::option::Option<std::string::String>>()?
5652                                .unwrap_or_default();
5653                        }
5654                        __FieldTag::Unknown(key) => {
5655                            let value = map.next_value::<serde_json::Value>()?;
5656                            result._unknown_fields.insert(key, value);
5657                        }
5658                    }
5659                }
5660                std::result::Result::Ok(result)
5661            }
5662        }
5663        deserializer.deserialize_any(Visitor)
5664    }
5665}
5666
5667#[doc(hidden)]
5668impl serde::ser::Serialize for ListServiceConnectionPoliciesRequest {
5669    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5670    where
5671        S: serde::ser::Serializer,
5672    {
5673        use serde::ser::SerializeMap;
5674        #[allow(unused_imports)]
5675        use std::option::Option::Some;
5676        let mut state = serializer.serialize_map(std::option::Option::None)?;
5677        if !self.parent.is_empty() {
5678            state.serialize_entry("parent", &self.parent)?;
5679        }
5680        if !wkt::internal::is_default(&self.page_size) {
5681            struct __With<'a>(&'a i32);
5682            impl<'a> serde::ser::Serialize for __With<'a> {
5683                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5684                where
5685                    S: serde::ser::Serializer,
5686                {
5687                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
5688                }
5689            }
5690            state.serialize_entry("pageSize", &__With(&self.page_size))?;
5691        }
5692        if !self.page_token.is_empty() {
5693            state.serialize_entry("pageToken", &self.page_token)?;
5694        }
5695        if !self.filter.is_empty() {
5696            state.serialize_entry("filter", &self.filter)?;
5697        }
5698        if !self.order_by.is_empty() {
5699            state.serialize_entry("orderBy", &self.order_by)?;
5700        }
5701        if !self._unknown_fields.is_empty() {
5702            for (key, value) in self._unknown_fields.iter() {
5703                state.serialize_entry(key, &value)?;
5704            }
5705        }
5706        state.end()
5707    }
5708}
5709
5710impl std::fmt::Debug for ListServiceConnectionPoliciesRequest {
5711    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5712        let mut debug_struct = f.debug_struct("ListServiceConnectionPoliciesRequest");
5713        debug_struct.field("parent", &self.parent);
5714        debug_struct.field("page_size", &self.page_size);
5715        debug_struct.field("page_token", &self.page_token);
5716        debug_struct.field("filter", &self.filter);
5717        debug_struct.field("order_by", &self.order_by);
5718        if !self._unknown_fields.is_empty() {
5719            debug_struct.field("_unknown_fields", &self._unknown_fields);
5720        }
5721        debug_struct.finish()
5722    }
5723}
5724
5725/// Response for ListServiceConnectionPolicies.
5726#[derive(Clone, Default, PartialEq)]
5727#[non_exhaustive]
5728pub struct ListServiceConnectionPoliciesResponse {
5729    /// ServiceConnectionPolicies to be returned.
5730    pub service_connection_policies: std::vec::Vec<crate::model::ServiceConnectionPolicy>,
5731
5732    /// The next pagination token in the List response. It should be used as
5733    /// page_token for the following request. An empty value means no more result.
5734    pub next_page_token: std::string::String,
5735
5736    /// Locations that could not be reached.
5737    pub unreachable: std::vec::Vec<std::string::String>,
5738
5739    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5740}
5741
5742impl ListServiceConnectionPoliciesResponse {
5743    pub fn new() -> Self {
5744        std::default::Default::default()
5745    }
5746
5747    /// Sets the value of [service_connection_policies][crate::model::ListServiceConnectionPoliciesResponse::service_connection_policies].
5748    pub fn set_service_connection_policies<T, V>(mut self, v: T) -> Self
5749    where
5750        T: std::iter::IntoIterator<Item = V>,
5751        V: std::convert::Into<crate::model::ServiceConnectionPolicy>,
5752    {
5753        use std::iter::Iterator;
5754        self.service_connection_policies = v.into_iter().map(|i| i.into()).collect();
5755        self
5756    }
5757
5758    /// Sets the value of [next_page_token][crate::model::ListServiceConnectionPoliciesResponse::next_page_token].
5759    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5760        self.next_page_token = v.into();
5761        self
5762    }
5763
5764    /// Sets the value of [unreachable][crate::model::ListServiceConnectionPoliciesResponse::unreachable].
5765    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
5766    where
5767        T: std::iter::IntoIterator<Item = V>,
5768        V: std::convert::Into<std::string::String>,
5769    {
5770        use std::iter::Iterator;
5771        self.unreachable = v.into_iter().map(|i| i.into()).collect();
5772        self
5773    }
5774}
5775
5776impl wkt::message::Message for ListServiceConnectionPoliciesResponse {
5777    fn typename() -> &'static str {
5778        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListServiceConnectionPoliciesResponse"
5779    }
5780}
5781
5782#[doc(hidden)]
5783impl gax::paginator::internal::PageableResponse for ListServiceConnectionPoliciesResponse {
5784    type PageItem = crate::model::ServiceConnectionPolicy;
5785
5786    fn items(self) -> std::vec::Vec<Self::PageItem> {
5787        self.service_connection_policies
5788    }
5789
5790    fn next_page_token(&self) -> std::string::String {
5791        use std::clone::Clone;
5792        self.next_page_token.clone()
5793    }
5794}
5795
5796#[doc(hidden)]
5797impl<'de> serde::de::Deserialize<'de> for ListServiceConnectionPoliciesResponse {
5798    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5799    where
5800        D: serde::Deserializer<'de>,
5801    {
5802        #[allow(non_camel_case_types)]
5803        #[doc(hidden)]
5804        #[derive(PartialEq, Eq, Hash)]
5805        enum __FieldTag {
5806            __service_connection_policies,
5807            __next_page_token,
5808            __unreachable,
5809            Unknown(std::string::String),
5810        }
5811        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5812            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5813            where
5814                D: serde::Deserializer<'de>,
5815            {
5816                struct Visitor;
5817                impl<'de> serde::de::Visitor<'de> for Visitor {
5818                    type Value = __FieldTag;
5819                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5820                        formatter
5821                            .write_str("a field name for ListServiceConnectionPoliciesResponse")
5822                    }
5823                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5824                    where
5825                        E: serde::de::Error,
5826                    {
5827                        use std::result::Result::Ok;
5828                        use std::string::ToString;
5829                        match value {
5830                            "serviceConnectionPolicies" => {
5831                                Ok(__FieldTag::__service_connection_policies)
5832                            }
5833                            "service_connection_policies" => {
5834                                Ok(__FieldTag::__service_connection_policies)
5835                            }
5836                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
5837                            "next_page_token" => Ok(__FieldTag::__next_page_token),
5838                            "unreachable" => Ok(__FieldTag::__unreachable),
5839                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5840                        }
5841                    }
5842                }
5843                deserializer.deserialize_identifier(Visitor)
5844            }
5845        }
5846        struct Visitor;
5847        impl<'de> serde::de::Visitor<'de> for Visitor {
5848            type Value = ListServiceConnectionPoliciesResponse;
5849            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5850                formatter.write_str("struct ListServiceConnectionPoliciesResponse")
5851            }
5852            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5853            where
5854                A: serde::de::MapAccess<'de>,
5855            {
5856                #[allow(unused_imports)]
5857                use serde::de::Error;
5858                use std::option::Option::Some;
5859                let mut fields = std::collections::HashSet::new();
5860                let mut result = Self::Value::new();
5861                while let Some(tag) = map.next_key::<__FieldTag>()? {
5862                    #[allow(clippy::match_single_binding)]
5863                    match tag {
5864                        __FieldTag::__service_connection_policies => {
5865                            if !fields.insert(__FieldTag::__service_connection_policies) {
5866                                return std::result::Result::Err(A::Error::duplicate_field(
5867                                    "multiple values for service_connection_policies",
5868                                ));
5869                            }
5870                            result.service_connection_policies = map
5871                                .next_value::<std::option::Option<
5872                                    std::vec::Vec<crate::model::ServiceConnectionPolicy>,
5873                                >>()?
5874                                .unwrap_or_default();
5875                        }
5876                        __FieldTag::__next_page_token => {
5877                            if !fields.insert(__FieldTag::__next_page_token) {
5878                                return std::result::Result::Err(A::Error::duplicate_field(
5879                                    "multiple values for next_page_token",
5880                                ));
5881                            }
5882                            result.next_page_token = map
5883                                .next_value::<std::option::Option<std::string::String>>()?
5884                                .unwrap_or_default();
5885                        }
5886                        __FieldTag::__unreachable => {
5887                            if !fields.insert(__FieldTag::__unreachable) {
5888                                return std::result::Result::Err(A::Error::duplicate_field(
5889                                    "multiple values for unreachable",
5890                                ));
5891                            }
5892                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
5893                        }
5894                        __FieldTag::Unknown(key) => {
5895                            let value = map.next_value::<serde_json::Value>()?;
5896                            result._unknown_fields.insert(key, value);
5897                        }
5898                    }
5899                }
5900                std::result::Result::Ok(result)
5901            }
5902        }
5903        deserializer.deserialize_any(Visitor)
5904    }
5905}
5906
5907#[doc(hidden)]
5908impl serde::ser::Serialize for ListServiceConnectionPoliciesResponse {
5909    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5910    where
5911        S: serde::ser::Serializer,
5912    {
5913        use serde::ser::SerializeMap;
5914        #[allow(unused_imports)]
5915        use std::option::Option::Some;
5916        let mut state = serializer.serialize_map(std::option::Option::None)?;
5917        if !self.service_connection_policies.is_empty() {
5918            state.serialize_entry(
5919                "serviceConnectionPolicies",
5920                &self.service_connection_policies,
5921            )?;
5922        }
5923        if !self.next_page_token.is_empty() {
5924            state.serialize_entry("nextPageToken", &self.next_page_token)?;
5925        }
5926        if !self.unreachable.is_empty() {
5927            state.serialize_entry("unreachable", &self.unreachable)?;
5928        }
5929        if !self._unknown_fields.is_empty() {
5930            for (key, value) in self._unknown_fields.iter() {
5931                state.serialize_entry(key, &value)?;
5932            }
5933        }
5934        state.end()
5935    }
5936}
5937
5938impl std::fmt::Debug for ListServiceConnectionPoliciesResponse {
5939    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5940        let mut debug_struct = f.debug_struct("ListServiceConnectionPoliciesResponse");
5941        debug_struct.field(
5942            "service_connection_policies",
5943            &self.service_connection_policies,
5944        );
5945        debug_struct.field("next_page_token", &self.next_page_token);
5946        debug_struct.field("unreachable", &self.unreachable);
5947        if !self._unknown_fields.is_empty() {
5948            debug_struct.field("_unknown_fields", &self._unknown_fields);
5949        }
5950        debug_struct.finish()
5951    }
5952}
5953
5954/// Request for GetServiceConnectionPolicy.
5955#[derive(Clone, Default, PartialEq)]
5956#[non_exhaustive]
5957pub struct GetServiceConnectionPolicyRequest {
5958    /// Required. Name of the ServiceConnectionPolicy to get.
5959    pub name: std::string::String,
5960
5961    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5962}
5963
5964impl GetServiceConnectionPolicyRequest {
5965    pub fn new() -> Self {
5966        std::default::Default::default()
5967    }
5968
5969    /// Sets the value of [name][crate::model::GetServiceConnectionPolicyRequest::name].
5970    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5971        self.name = v.into();
5972        self
5973    }
5974}
5975
5976impl wkt::message::Message for GetServiceConnectionPolicyRequest {
5977    fn typename() -> &'static str {
5978        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetServiceConnectionPolicyRequest"
5979    }
5980}
5981
5982#[doc(hidden)]
5983impl<'de> serde::de::Deserialize<'de> for GetServiceConnectionPolicyRequest {
5984    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5985    where
5986        D: serde::Deserializer<'de>,
5987    {
5988        #[allow(non_camel_case_types)]
5989        #[doc(hidden)]
5990        #[derive(PartialEq, Eq, Hash)]
5991        enum __FieldTag {
5992            __name,
5993            Unknown(std::string::String),
5994        }
5995        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5996            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5997            where
5998                D: serde::Deserializer<'de>,
5999            {
6000                struct Visitor;
6001                impl<'de> serde::de::Visitor<'de> for Visitor {
6002                    type Value = __FieldTag;
6003                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6004                        formatter.write_str("a field name for GetServiceConnectionPolicyRequest")
6005                    }
6006                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6007                    where
6008                        E: serde::de::Error,
6009                    {
6010                        use std::result::Result::Ok;
6011                        use std::string::ToString;
6012                        match value {
6013                            "name" => Ok(__FieldTag::__name),
6014                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6015                        }
6016                    }
6017                }
6018                deserializer.deserialize_identifier(Visitor)
6019            }
6020        }
6021        struct Visitor;
6022        impl<'de> serde::de::Visitor<'de> for Visitor {
6023            type Value = GetServiceConnectionPolicyRequest;
6024            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6025                formatter.write_str("struct GetServiceConnectionPolicyRequest")
6026            }
6027            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6028            where
6029                A: serde::de::MapAccess<'de>,
6030            {
6031                #[allow(unused_imports)]
6032                use serde::de::Error;
6033                use std::option::Option::Some;
6034                let mut fields = std::collections::HashSet::new();
6035                let mut result = Self::Value::new();
6036                while let Some(tag) = map.next_key::<__FieldTag>()? {
6037                    #[allow(clippy::match_single_binding)]
6038                    match tag {
6039                        __FieldTag::__name => {
6040                            if !fields.insert(__FieldTag::__name) {
6041                                return std::result::Result::Err(A::Error::duplicate_field(
6042                                    "multiple values for name",
6043                                ));
6044                            }
6045                            result.name = map
6046                                .next_value::<std::option::Option<std::string::String>>()?
6047                                .unwrap_or_default();
6048                        }
6049                        __FieldTag::Unknown(key) => {
6050                            let value = map.next_value::<serde_json::Value>()?;
6051                            result._unknown_fields.insert(key, value);
6052                        }
6053                    }
6054                }
6055                std::result::Result::Ok(result)
6056            }
6057        }
6058        deserializer.deserialize_any(Visitor)
6059    }
6060}
6061
6062#[doc(hidden)]
6063impl serde::ser::Serialize for GetServiceConnectionPolicyRequest {
6064    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6065    where
6066        S: serde::ser::Serializer,
6067    {
6068        use serde::ser::SerializeMap;
6069        #[allow(unused_imports)]
6070        use std::option::Option::Some;
6071        let mut state = serializer.serialize_map(std::option::Option::None)?;
6072        if !self.name.is_empty() {
6073            state.serialize_entry("name", &self.name)?;
6074        }
6075        if !self._unknown_fields.is_empty() {
6076            for (key, value) in self._unknown_fields.iter() {
6077                state.serialize_entry(key, &value)?;
6078            }
6079        }
6080        state.end()
6081    }
6082}
6083
6084impl std::fmt::Debug for GetServiceConnectionPolicyRequest {
6085    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6086        let mut debug_struct = f.debug_struct("GetServiceConnectionPolicyRequest");
6087        debug_struct.field("name", &self.name);
6088        if !self._unknown_fields.is_empty() {
6089            debug_struct.field("_unknown_fields", &self._unknown_fields);
6090        }
6091        debug_struct.finish()
6092    }
6093}
6094
6095/// Request for CreateServiceConnectionPolicy.
6096#[derive(Clone, Default, PartialEq)]
6097#[non_exhaustive]
6098pub struct CreateServiceConnectionPolicyRequest {
6099    /// Required. The parent resource's name of the ServiceConnectionPolicy. ex.
6100    /// projects/123/locations/us-east1
6101    pub parent: std::string::String,
6102
6103    /// Optional. Resource ID
6104    /// (i.e. 'foo' in
6105    /// '[...]/projects/p/locations/l/serviceConnectionPolicies/foo') See
6106    /// <https://google.aip.dev/122#resource-id-segments> Unique per location.
6107    pub service_connection_policy_id: std::string::String,
6108
6109    /// Required. Initial values for a new ServiceConnectionPolicies
6110    pub service_connection_policy: std::option::Option<crate::model::ServiceConnectionPolicy>,
6111
6112    /// Optional. An optional request ID to identify requests. Specify a unique
6113    /// request ID so that if you must retry your request, the server will know to
6114    /// ignore the request if it has already been completed. The server will
6115    /// guarantee that for at least 60 minutes since the first request.
6116    ///
6117    /// For example, consider a situation where you make an initial request and
6118    /// the request times out. If you make the request again with the same request
6119    /// ID, the server can check if original operation with the same request ID
6120    /// was received, and if so, will ignore the second request. This prevents
6121    /// clients from accidentally creating duplicate commitments.
6122    ///
6123    /// The request ID must be a valid UUID with the exception that zero UUID is
6124    /// not supported (00000000-0000-0000-0000-000000000000).
6125    pub request_id: std::string::String,
6126
6127    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6128}
6129
6130impl CreateServiceConnectionPolicyRequest {
6131    pub fn new() -> Self {
6132        std::default::Default::default()
6133    }
6134
6135    /// Sets the value of [parent][crate::model::CreateServiceConnectionPolicyRequest::parent].
6136    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6137        self.parent = v.into();
6138        self
6139    }
6140
6141    /// Sets the value of [service_connection_policy_id][crate::model::CreateServiceConnectionPolicyRequest::service_connection_policy_id].
6142    pub fn set_service_connection_policy_id<T: std::convert::Into<std::string::String>>(
6143        mut self,
6144        v: T,
6145    ) -> Self {
6146        self.service_connection_policy_id = v.into();
6147        self
6148    }
6149
6150    /// Sets the value of [service_connection_policy][crate::model::CreateServiceConnectionPolicyRequest::service_connection_policy].
6151    pub fn set_service_connection_policy<T>(mut self, v: T) -> Self
6152    where
6153        T: std::convert::Into<crate::model::ServiceConnectionPolicy>,
6154    {
6155        self.service_connection_policy = std::option::Option::Some(v.into());
6156        self
6157    }
6158
6159    /// Sets or clears the value of [service_connection_policy][crate::model::CreateServiceConnectionPolicyRequest::service_connection_policy].
6160    pub fn set_or_clear_service_connection_policy<T>(mut self, v: std::option::Option<T>) -> Self
6161    where
6162        T: std::convert::Into<crate::model::ServiceConnectionPolicy>,
6163    {
6164        self.service_connection_policy = v.map(|x| x.into());
6165        self
6166    }
6167
6168    /// Sets the value of [request_id][crate::model::CreateServiceConnectionPolicyRequest::request_id].
6169    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6170        self.request_id = v.into();
6171        self
6172    }
6173}
6174
6175impl wkt::message::Message for CreateServiceConnectionPolicyRequest {
6176    fn typename() -> &'static str {
6177        "type.googleapis.com/google.cloud.networkconnectivity.v1.CreateServiceConnectionPolicyRequest"
6178    }
6179}
6180
6181#[doc(hidden)]
6182impl<'de> serde::de::Deserialize<'de> for CreateServiceConnectionPolicyRequest {
6183    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6184    where
6185        D: serde::Deserializer<'de>,
6186    {
6187        #[allow(non_camel_case_types)]
6188        #[doc(hidden)]
6189        #[derive(PartialEq, Eq, Hash)]
6190        enum __FieldTag {
6191            __parent,
6192            __service_connection_policy_id,
6193            __service_connection_policy,
6194            __request_id,
6195            Unknown(std::string::String),
6196        }
6197        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6198            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6199            where
6200                D: serde::Deserializer<'de>,
6201            {
6202                struct Visitor;
6203                impl<'de> serde::de::Visitor<'de> for Visitor {
6204                    type Value = __FieldTag;
6205                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6206                        formatter.write_str("a field name for CreateServiceConnectionPolicyRequest")
6207                    }
6208                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6209                    where
6210                        E: serde::de::Error,
6211                    {
6212                        use std::result::Result::Ok;
6213                        use std::string::ToString;
6214                        match value {
6215                            "parent" => Ok(__FieldTag::__parent),
6216                            "serviceConnectionPolicyId" => {
6217                                Ok(__FieldTag::__service_connection_policy_id)
6218                            }
6219                            "service_connection_policy_id" => {
6220                                Ok(__FieldTag::__service_connection_policy_id)
6221                            }
6222                            "serviceConnectionPolicy" => {
6223                                Ok(__FieldTag::__service_connection_policy)
6224                            }
6225                            "service_connection_policy" => {
6226                                Ok(__FieldTag::__service_connection_policy)
6227                            }
6228                            "requestId" => Ok(__FieldTag::__request_id),
6229                            "request_id" => Ok(__FieldTag::__request_id),
6230                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6231                        }
6232                    }
6233                }
6234                deserializer.deserialize_identifier(Visitor)
6235            }
6236        }
6237        struct Visitor;
6238        impl<'de> serde::de::Visitor<'de> for Visitor {
6239            type Value = CreateServiceConnectionPolicyRequest;
6240            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6241                formatter.write_str("struct CreateServiceConnectionPolicyRequest")
6242            }
6243            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6244            where
6245                A: serde::de::MapAccess<'de>,
6246            {
6247                #[allow(unused_imports)]
6248                use serde::de::Error;
6249                use std::option::Option::Some;
6250                let mut fields = std::collections::HashSet::new();
6251                let mut result = Self::Value::new();
6252                while let Some(tag) = map.next_key::<__FieldTag>()? {
6253                    #[allow(clippy::match_single_binding)]
6254                    match tag {
6255                        __FieldTag::__parent => {
6256                            if !fields.insert(__FieldTag::__parent) {
6257                                return std::result::Result::Err(A::Error::duplicate_field(
6258                                    "multiple values for parent",
6259                                ));
6260                            }
6261                            result.parent = map
6262                                .next_value::<std::option::Option<std::string::String>>()?
6263                                .unwrap_or_default();
6264                        }
6265                        __FieldTag::__service_connection_policy_id => {
6266                            if !fields.insert(__FieldTag::__service_connection_policy_id) {
6267                                return std::result::Result::Err(A::Error::duplicate_field(
6268                                    "multiple values for service_connection_policy_id",
6269                                ));
6270                            }
6271                            result.service_connection_policy_id = map
6272                                .next_value::<std::option::Option<std::string::String>>()?
6273                                .unwrap_or_default();
6274                        }
6275                        __FieldTag::__service_connection_policy => {
6276                            if !fields.insert(__FieldTag::__service_connection_policy) {
6277                                return std::result::Result::Err(A::Error::duplicate_field(
6278                                    "multiple values for service_connection_policy",
6279                                ));
6280                            }
6281                            result.service_connection_policy = map.next_value::<std::option::Option<crate::model::ServiceConnectionPolicy>>()?
6282                                ;
6283                        }
6284                        __FieldTag::__request_id => {
6285                            if !fields.insert(__FieldTag::__request_id) {
6286                                return std::result::Result::Err(A::Error::duplicate_field(
6287                                    "multiple values for request_id",
6288                                ));
6289                            }
6290                            result.request_id = map
6291                                .next_value::<std::option::Option<std::string::String>>()?
6292                                .unwrap_or_default();
6293                        }
6294                        __FieldTag::Unknown(key) => {
6295                            let value = map.next_value::<serde_json::Value>()?;
6296                            result._unknown_fields.insert(key, value);
6297                        }
6298                    }
6299                }
6300                std::result::Result::Ok(result)
6301            }
6302        }
6303        deserializer.deserialize_any(Visitor)
6304    }
6305}
6306
6307#[doc(hidden)]
6308impl serde::ser::Serialize for CreateServiceConnectionPolicyRequest {
6309    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6310    where
6311        S: serde::ser::Serializer,
6312    {
6313        use serde::ser::SerializeMap;
6314        #[allow(unused_imports)]
6315        use std::option::Option::Some;
6316        let mut state = serializer.serialize_map(std::option::Option::None)?;
6317        if !self.parent.is_empty() {
6318            state.serialize_entry("parent", &self.parent)?;
6319        }
6320        if !self.service_connection_policy_id.is_empty() {
6321            state.serialize_entry(
6322                "serviceConnectionPolicyId",
6323                &self.service_connection_policy_id,
6324            )?;
6325        }
6326        if self.service_connection_policy.is_some() {
6327            state.serialize_entry("serviceConnectionPolicy", &self.service_connection_policy)?;
6328        }
6329        if !self.request_id.is_empty() {
6330            state.serialize_entry("requestId", &self.request_id)?;
6331        }
6332        if !self._unknown_fields.is_empty() {
6333            for (key, value) in self._unknown_fields.iter() {
6334                state.serialize_entry(key, &value)?;
6335            }
6336        }
6337        state.end()
6338    }
6339}
6340
6341impl std::fmt::Debug for CreateServiceConnectionPolicyRequest {
6342    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6343        let mut debug_struct = f.debug_struct("CreateServiceConnectionPolicyRequest");
6344        debug_struct.field("parent", &self.parent);
6345        debug_struct.field(
6346            "service_connection_policy_id",
6347            &self.service_connection_policy_id,
6348        );
6349        debug_struct.field("service_connection_policy", &self.service_connection_policy);
6350        debug_struct.field("request_id", &self.request_id);
6351        if !self._unknown_fields.is_empty() {
6352            debug_struct.field("_unknown_fields", &self._unknown_fields);
6353        }
6354        debug_struct.finish()
6355    }
6356}
6357
6358/// Request for UpdateServiceConnectionPolicy.
6359#[derive(Clone, Default, PartialEq)]
6360#[non_exhaustive]
6361pub struct UpdateServiceConnectionPolicyRequest {
6362    /// Optional. Field mask is used to specify the fields to be overwritten in the
6363    /// ServiceConnectionPolicy resource by the update.
6364    /// The fields specified in the update_mask are relative to the resource, not
6365    /// the full request. A field will be overwritten if it is in the mask. If the
6366    /// user does not provide a mask then all fields will be overwritten.
6367    pub update_mask: std::option::Option<wkt::FieldMask>,
6368
6369    /// Required. New values to be patched into the resource.
6370    pub service_connection_policy: std::option::Option<crate::model::ServiceConnectionPolicy>,
6371
6372    /// Optional. An optional request ID to identify requests. Specify a unique
6373    /// request ID so that if you must retry your request, the server will know to
6374    /// ignore the request if it has already been completed. The server will
6375    /// guarantee that for at least 60 minutes since the first request.
6376    ///
6377    /// For example, consider a situation where you make an initial request and
6378    /// the request times out. If you make the request again with the same request
6379    /// ID, the server can check if original operation with the same request ID
6380    /// was received, and if so, will ignore the second request. This prevents
6381    /// clients from accidentally creating duplicate commitments.
6382    ///
6383    /// The request ID must be a valid UUID with the exception that zero UUID is
6384    /// not supported (00000000-0000-0000-0000-000000000000).
6385    pub request_id: std::string::String,
6386
6387    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6388}
6389
6390impl UpdateServiceConnectionPolicyRequest {
6391    pub fn new() -> Self {
6392        std::default::Default::default()
6393    }
6394
6395    /// Sets the value of [update_mask][crate::model::UpdateServiceConnectionPolicyRequest::update_mask].
6396    pub fn set_update_mask<T>(mut self, v: T) -> Self
6397    where
6398        T: std::convert::Into<wkt::FieldMask>,
6399    {
6400        self.update_mask = std::option::Option::Some(v.into());
6401        self
6402    }
6403
6404    /// Sets or clears the value of [update_mask][crate::model::UpdateServiceConnectionPolicyRequest::update_mask].
6405    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6406    where
6407        T: std::convert::Into<wkt::FieldMask>,
6408    {
6409        self.update_mask = v.map(|x| x.into());
6410        self
6411    }
6412
6413    /// Sets the value of [service_connection_policy][crate::model::UpdateServiceConnectionPolicyRequest::service_connection_policy].
6414    pub fn set_service_connection_policy<T>(mut self, v: T) -> Self
6415    where
6416        T: std::convert::Into<crate::model::ServiceConnectionPolicy>,
6417    {
6418        self.service_connection_policy = std::option::Option::Some(v.into());
6419        self
6420    }
6421
6422    /// Sets or clears the value of [service_connection_policy][crate::model::UpdateServiceConnectionPolicyRequest::service_connection_policy].
6423    pub fn set_or_clear_service_connection_policy<T>(mut self, v: std::option::Option<T>) -> Self
6424    where
6425        T: std::convert::Into<crate::model::ServiceConnectionPolicy>,
6426    {
6427        self.service_connection_policy = v.map(|x| x.into());
6428        self
6429    }
6430
6431    /// Sets the value of [request_id][crate::model::UpdateServiceConnectionPolicyRequest::request_id].
6432    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6433        self.request_id = v.into();
6434        self
6435    }
6436}
6437
6438impl wkt::message::Message for UpdateServiceConnectionPolicyRequest {
6439    fn typename() -> &'static str {
6440        "type.googleapis.com/google.cloud.networkconnectivity.v1.UpdateServiceConnectionPolicyRequest"
6441    }
6442}
6443
6444#[doc(hidden)]
6445impl<'de> serde::de::Deserialize<'de> for UpdateServiceConnectionPolicyRequest {
6446    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6447    where
6448        D: serde::Deserializer<'de>,
6449    {
6450        #[allow(non_camel_case_types)]
6451        #[doc(hidden)]
6452        #[derive(PartialEq, Eq, Hash)]
6453        enum __FieldTag {
6454            __update_mask,
6455            __service_connection_policy,
6456            __request_id,
6457            Unknown(std::string::String),
6458        }
6459        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6460            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6461            where
6462                D: serde::Deserializer<'de>,
6463            {
6464                struct Visitor;
6465                impl<'de> serde::de::Visitor<'de> for Visitor {
6466                    type Value = __FieldTag;
6467                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6468                        formatter.write_str("a field name for UpdateServiceConnectionPolicyRequest")
6469                    }
6470                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6471                    where
6472                        E: serde::de::Error,
6473                    {
6474                        use std::result::Result::Ok;
6475                        use std::string::ToString;
6476                        match value {
6477                            "updateMask" => Ok(__FieldTag::__update_mask),
6478                            "update_mask" => Ok(__FieldTag::__update_mask),
6479                            "serviceConnectionPolicy" => {
6480                                Ok(__FieldTag::__service_connection_policy)
6481                            }
6482                            "service_connection_policy" => {
6483                                Ok(__FieldTag::__service_connection_policy)
6484                            }
6485                            "requestId" => Ok(__FieldTag::__request_id),
6486                            "request_id" => Ok(__FieldTag::__request_id),
6487                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6488                        }
6489                    }
6490                }
6491                deserializer.deserialize_identifier(Visitor)
6492            }
6493        }
6494        struct Visitor;
6495        impl<'de> serde::de::Visitor<'de> for Visitor {
6496            type Value = UpdateServiceConnectionPolicyRequest;
6497            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6498                formatter.write_str("struct UpdateServiceConnectionPolicyRequest")
6499            }
6500            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6501            where
6502                A: serde::de::MapAccess<'de>,
6503            {
6504                #[allow(unused_imports)]
6505                use serde::de::Error;
6506                use std::option::Option::Some;
6507                let mut fields = std::collections::HashSet::new();
6508                let mut result = Self::Value::new();
6509                while let Some(tag) = map.next_key::<__FieldTag>()? {
6510                    #[allow(clippy::match_single_binding)]
6511                    match tag {
6512                        __FieldTag::__update_mask => {
6513                            if !fields.insert(__FieldTag::__update_mask) {
6514                                return std::result::Result::Err(A::Error::duplicate_field(
6515                                    "multiple values for update_mask",
6516                                ));
6517                            }
6518                            result.update_mask =
6519                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
6520                        }
6521                        __FieldTag::__service_connection_policy => {
6522                            if !fields.insert(__FieldTag::__service_connection_policy) {
6523                                return std::result::Result::Err(A::Error::duplicate_field(
6524                                    "multiple values for service_connection_policy",
6525                                ));
6526                            }
6527                            result.service_connection_policy = map.next_value::<std::option::Option<crate::model::ServiceConnectionPolicy>>()?
6528                                ;
6529                        }
6530                        __FieldTag::__request_id => {
6531                            if !fields.insert(__FieldTag::__request_id) {
6532                                return std::result::Result::Err(A::Error::duplicate_field(
6533                                    "multiple values for request_id",
6534                                ));
6535                            }
6536                            result.request_id = map
6537                                .next_value::<std::option::Option<std::string::String>>()?
6538                                .unwrap_or_default();
6539                        }
6540                        __FieldTag::Unknown(key) => {
6541                            let value = map.next_value::<serde_json::Value>()?;
6542                            result._unknown_fields.insert(key, value);
6543                        }
6544                    }
6545                }
6546                std::result::Result::Ok(result)
6547            }
6548        }
6549        deserializer.deserialize_any(Visitor)
6550    }
6551}
6552
6553#[doc(hidden)]
6554impl serde::ser::Serialize for UpdateServiceConnectionPolicyRequest {
6555    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6556    where
6557        S: serde::ser::Serializer,
6558    {
6559        use serde::ser::SerializeMap;
6560        #[allow(unused_imports)]
6561        use std::option::Option::Some;
6562        let mut state = serializer.serialize_map(std::option::Option::None)?;
6563        if self.update_mask.is_some() {
6564            state.serialize_entry("updateMask", &self.update_mask)?;
6565        }
6566        if self.service_connection_policy.is_some() {
6567            state.serialize_entry("serviceConnectionPolicy", &self.service_connection_policy)?;
6568        }
6569        if !self.request_id.is_empty() {
6570            state.serialize_entry("requestId", &self.request_id)?;
6571        }
6572        if !self._unknown_fields.is_empty() {
6573            for (key, value) in self._unknown_fields.iter() {
6574                state.serialize_entry(key, &value)?;
6575            }
6576        }
6577        state.end()
6578    }
6579}
6580
6581impl std::fmt::Debug for UpdateServiceConnectionPolicyRequest {
6582    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6583        let mut debug_struct = f.debug_struct("UpdateServiceConnectionPolicyRequest");
6584        debug_struct.field("update_mask", &self.update_mask);
6585        debug_struct.field("service_connection_policy", &self.service_connection_policy);
6586        debug_struct.field("request_id", &self.request_id);
6587        if !self._unknown_fields.is_empty() {
6588            debug_struct.field("_unknown_fields", &self._unknown_fields);
6589        }
6590        debug_struct.finish()
6591    }
6592}
6593
6594/// Request for DeleteServiceConnectionPolicy.
6595#[derive(Clone, Default, PartialEq)]
6596#[non_exhaustive]
6597pub struct DeleteServiceConnectionPolicyRequest {
6598    /// Required. The name of the ServiceConnectionPolicy to delete.
6599    pub name: std::string::String,
6600
6601    /// Optional. An optional request ID to identify requests. Specify a unique
6602    /// request ID so that if you must retry your request, the server will know to
6603    /// ignore the request if it has already been completed. The server will
6604    /// guarantee that for at least 60 minutes after the first request.
6605    ///
6606    /// For example, consider a situation where you make an initial request and
6607    /// the request times out. If you make the request again with the same request
6608    /// ID, the server can check if original operation with the same request ID
6609    /// was received, and if so, will ignore the second request. This prevents
6610    /// clients from accidentally creating duplicate commitments.
6611    ///
6612    /// The request ID must be a valid UUID with the exception that zero UUID is
6613    /// not supported (00000000-0000-0000-0000-000000000000).
6614    pub request_id: std::string::String,
6615
6616    /// Optional. The etag is computed by the server, and may be sent on update and
6617    /// delete requests to ensure the client has an up-to-date value before
6618    /// proceeding.
6619    pub etag: std::option::Option<std::string::String>,
6620
6621    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6622}
6623
6624impl DeleteServiceConnectionPolicyRequest {
6625    pub fn new() -> Self {
6626        std::default::Default::default()
6627    }
6628
6629    /// Sets the value of [name][crate::model::DeleteServiceConnectionPolicyRequest::name].
6630    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6631        self.name = v.into();
6632        self
6633    }
6634
6635    /// Sets the value of [request_id][crate::model::DeleteServiceConnectionPolicyRequest::request_id].
6636    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6637        self.request_id = v.into();
6638        self
6639    }
6640
6641    /// Sets the value of [etag][crate::model::DeleteServiceConnectionPolicyRequest::etag].
6642    pub fn set_etag<T>(mut self, v: T) -> Self
6643    where
6644        T: std::convert::Into<std::string::String>,
6645    {
6646        self.etag = std::option::Option::Some(v.into());
6647        self
6648    }
6649
6650    /// Sets or clears the value of [etag][crate::model::DeleteServiceConnectionPolicyRequest::etag].
6651    pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
6652    where
6653        T: std::convert::Into<std::string::String>,
6654    {
6655        self.etag = v.map(|x| x.into());
6656        self
6657    }
6658}
6659
6660impl wkt::message::Message for DeleteServiceConnectionPolicyRequest {
6661    fn typename() -> &'static str {
6662        "type.googleapis.com/google.cloud.networkconnectivity.v1.DeleteServiceConnectionPolicyRequest"
6663    }
6664}
6665
6666#[doc(hidden)]
6667impl<'de> serde::de::Deserialize<'de> for DeleteServiceConnectionPolicyRequest {
6668    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6669    where
6670        D: serde::Deserializer<'de>,
6671    {
6672        #[allow(non_camel_case_types)]
6673        #[doc(hidden)]
6674        #[derive(PartialEq, Eq, Hash)]
6675        enum __FieldTag {
6676            __name,
6677            __request_id,
6678            __etag,
6679            Unknown(std::string::String),
6680        }
6681        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6682            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6683            where
6684                D: serde::Deserializer<'de>,
6685            {
6686                struct Visitor;
6687                impl<'de> serde::de::Visitor<'de> for Visitor {
6688                    type Value = __FieldTag;
6689                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6690                        formatter.write_str("a field name for DeleteServiceConnectionPolicyRequest")
6691                    }
6692                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6693                    where
6694                        E: serde::de::Error,
6695                    {
6696                        use std::result::Result::Ok;
6697                        use std::string::ToString;
6698                        match value {
6699                            "name" => Ok(__FieldTag::__name),
6700                            "requestId" => Ok(__FieldTag::__request_id),
6701                            "request_id" => Ok(__FieldTag::__request_id),
6702                            "etag" => Ok(__FieldTag::__etag),
6703                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6704                        }
6705                    }
6706                }
6707                deserializer.deserialize_identifier(Visitor)
6708            }
6709        }
6710        struct Visitor;
6711        impl<'de> serde::de::Visitor<'de> for Visitor {
6712            type Value = DeleteServiceConnectionPolicyRequest;
6713            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6714                formatter.write_str("struct DeleteServiceConnectionPolicyRequest")
6715            }
6716            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6717            where
6718                A: serde::de::MapAccess<'de>,
6719            {
6720                #[allow(unused_imports)]
6721                use serde::de::Error;
6722                use std::option::Option::Some;
6723                let mut fields = std::collections::HashSet::new();
6724                let mut result = Self::Value::new();
6725                while let Some(tag) = map.next_key::<__FieldTag>()? {
6726                    #[allow(clippy::match_single_binding)]
6727                    match tag {
6728                        __FieldTag::__name => {
6729                            if !fields.insert(__FieldTag::__name) {
6730                                return std::result::Result::Err(A::Error::duplicate_field(
6731                                    "multiple values for name",
6732                                ));
6733                            }
6734                            result.name = map
6735                                .next_value::<std::option::Option<std::string::String>>()?
6736                                .unwrap_or_default();
6737                        }
6738                        __FieldTag::__request_id => {
6739                            if !fields.insert(__FieldTag::__request_id) {
6740                                return std::result::Result::Err(A::Error::duplicate_field(
6741                                    "multiple values for request_id",
6742                                ));
6743                            }
6744                            result.request_id = map
6745                                .next_value::<std::option::Option<std::string::String>>()?
6746                                .unwrap_or_default();
6747                        }
6748                        __FieldTag::__etag => {
6749                            if !fields.insert(__FieldTag::__etag) {
6750                                return std::result::Result::Err(A::Error::duplicate_field(
6751                                    "multiple values for etag",
6752                                ));
6753                            }
6754                            result.etag =
6755                                map.next_value::<std::option::Option<std::string::String>>()?;
6756                        }
6757                        __FieldTag::Unknown(key) => {
6758                            let value = map.next_value::<serde_json::Value>()?;
6759                            result._unknown_fields.insert(key, value);
6760                        }
6761                    }
6762                }
6763                std::result::Result::Ok(result)
6764            }
6765        }
6766        deserializer.deserialize_any(Visitor)
6767    }
6768}
6769
6770#[doc(hidden)]
6771impl serde::ser::Serialize for DeleteServiceConnectionPolicyRequest {
6772    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6773    where
6774        S: serde::ser::Serializer,
6775    {
6776        use serde::ser::SerializeMap;
6777        #[allow(unused_imports)]
6778        use std::option::Option::Some;
6779        let mut state = serializer.serialize_map(std::option::Option::None)?;
6780        if !self.name.is_empty() {
6781            state.serialize_entry("name", &self.name)?;
6782        }
6783        if !self.request_id.is_empty() {
6784            state.serialize_entry("requestId", &self.request_id)?;
6785        }
6786        if self.etag.is_some() {
6787            state.serialize_entry("etag", &self.etag)?;
6788        }
6789        if !self._unknown_fields.is_empty() {
6790            for (key, value) in self._unknown_fields.iter() {
6791                state.serialize_entry(key, &value)?;
6792            }
6793        }
6794        state.end()
6795    }
6796}
6797
6798impl std::fmt::Debug for DeleteServiceConnectionPolicyRequest {
6799    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6800        let mut debug_struct = f.debug_struct("DeleteServiceConnectionPolicyRequest");
6801        debug_struct.field("name", &self.name);
6802        debug_struct.field("request_id", &self.request_id);
6803        debug_struct.field("etag", &self.etag);
6804        if !self._unknown_fields.is_empty() {
6805            debug_struct.field("_unknown_fields", &self._unknown_fields);
6806        }
6807        debug_struct.finish()
6808    }
6809}
6810
6811/// The ServiceClass resource.
6812#[derive(Clone, Default, PartialEq)]
6813#[non_exhaustive]
6814pub struct ServiceClass {
6815    /// Immutable. The name of a ServiceClass resource.
6816    /// Format:
6817    /// projects/{project}/locations/{location}/serviceClasses/{service_class}
6818    /// See: <https://google.aip.dev/122#fields-representing-resource-names>
6819    pub name: std::string::String,
6820
6821    /// Output only. The generated service class name. Use this name to refer to
6822    /// the Service class in Service Connection Maps and Service Connection
6823    /// Policies.
6824    pub service_class: std::string::String,
6825
6826    /// Output only. Time when the ServiceClass was created.
6827    pub create_time: std::option::Option<wkt::Timestamp>,
6828
6829    /// Output only. Time when the ServiceClass was updated.
6830    pub update_time: std::option::Option<wkt::Timestamp>,
6831
6832    /// User-defined labels.
6833    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6834
6835    /// A description of this resource.
6836    pub description: std::string::String,
6837
6838    /// Optional. The etag is computed by the server, and may be sent on update and
6839    /// delete requests to ensure the client has an up-to-date value before
6840    /// proceeding.
6841    pub etag: std::option::Option<std::string::String>,
6842
6843    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6844}
6845
6846impl ServiceClass {
6847    pub fn new() -> Self {
6848        std::default::Default::default()
6849    }
6850
6851    /// Sets the value of [name][crate::model::ServiceClass::name].
6852    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6853        self.name = v.into();
6854        self
6855    }
6856
6857    /// Sets the value of [service_class][crate::model::ServiceClass::service_class].
6858    pub fn set_service_class<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6859        self.service_class = v.into();
6860        self
6861    }
6862
6863    /// Sets the value of [create_time][crate::model::ServiceClass::create_time].
6864    pub fn set_create_time<T>(mut self, v: T) -> Self
6865    where
6866        T: std::convert::Into<wkt::Timestamp>,
6867    {
6868        self.create_time = std::option::Option::Some(v.into());
6869        self
6870    }
6871
6872    /// Sets or clears the value of [create_time][crate::model::ServiceClass::create_time].
6873    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6874    where
6875        T: std::convert::Into<wkt::Timestamp>,
6876    {
6877        self.create_time = v.map(|x| x.into());
6878        self
6879    }
6880
6881    /// Sets the value of [update_time][crate::model::ServiceClass::update_time].
6882    pub fn set_update_time<T>(mut self, v: T) -> Self
6883    where
6884        T: std::convert::Into<wkt::Timestamp>,
6885    {
6886        self.update_time = std::option::Option::Some(v.into());
6887        self
6888    }
6889
6890    /// Sets or clears the value of [update_time][crate::model::ServiceClass::update_time].
6891    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
6892    where
6893        T: std::convert::Into<wkt::Timestamp>,
6894    {
6895        self.update_time = v.map(|x| x.into());
6896        self
6897    }
6898
6899    /// Sets the value of [labels][crate::model::ServiceClass::labels].
6900    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6901    where
6902        T: std::iter::IntoIterator<Item = (K, V)>,
6903        K: std::convert::Into<std::string::String>,
6904        V: std::convert::Into<std::string::String>,
6905    {
6906        use std::iter::Iterator;
6907        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6908        self
6909    }
6910
6911    /// Sets the value of [description][crate::model::ServiceClass::description].
6912    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6913        self.description = v.into();
6914        self
6915    }
6916
6917    /// Sets the value of [etag][crate::model::ServiceClass::etag].
6918    pub fn set_etag<T>(mut self, v: T) -> Self
6919    where
6920        T: std::convert::Into<std::string::String>,
6921    {
6922        self.etag = std::option::Option::Some(v.into());
6923        self
6924    }
6925
6926    /// Sets or clears the value of [etag][crate::model::ServiceClass::etag].
6927    pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
6928    where
6929        T: std::convert::Into<std::string::String>,
6930    {
6931        self.etag = v.map(|x| x.into());
6932        self
6933    }
6934}
6935
6936impl wkt::message::Message for ServiceClass {
6937    fn typename() -> &'static str {
6938        "type.googleapis.com/google.cloud.networkconnectivity.v1.ServiceClass"
6939    }
6940}
6941
6942#[doc(hidden)]
6943impl<'de> serde::de::Deserialize<'de> for ServiceClass {
6944    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6945    where
6946        D: serde::Deserializer<'de>,
6947    {
6948        #[allow(non_camel_case_types)]
6949        #[doc(hidden)]
6950        #[derive(PartialEq, Eq, Hash)]
6951        enum __FieldTag {
6952            __name,
6953            __service_class,
6954            __create_time,
6955            __update_time,
6956            __labels,
6957            __description,
6958            __etag,
6959            Unknown(std::string::String),
6960        }
6961        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6962            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6963            where
6964                D: serde::Deserializer<'de>,
6965            {
6966                struct Visitor;
6967                impl<'de> serde::de::Visitor<'de> for Visitor {
6968                    type Value = __FieldTag;
6969                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6970                        formatter.write_str("a field name for ServiceClass")
6971                    }
6972                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6973                    where
6974                        E: serde::de::Error,
6975                    {
6976                        use std::result::Result::Ok;
6977                        use std::string::ToString;
6978                        match value {
6979                            "name" => Ok(__FieldTag::__name),
6980                            "serviceClass" => Ok(__FieldTag::__service_class),
6981                            "service_class" => Ok(__FieldTag::__service_class),
6982                            "createTime" => Ok(__FieldTag::__create_time),
6983                            "create_time" => Ok(__FieldTag::__create_time),
6984                            "updateTime" => Ok(__FieldTag::__update_time),
6985                            "update_time" => Ok(__FieldTag::__update_time),
6986                            "labels" => Ok(__FieldTag::__labels),
6987                            "description" => Ok(__FieldTag::__description),
6988                            "etag" => Ok(__FieldTag::__etag),
6989                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6990                        }
6991                    }
6992                }
6993                deserializer.deserialize_identifier(Visitor)
6994            }
6995        }
6996        struct Visitor;
6997        impl<'de> serde::de::Visitor<'de> for Visitor {
6998            type Value = ServiceClass;
6999            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7000                formatter.write_str("struct ServiceClass")
7001            }
7002            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7003            where
7004                A: serde::de::MapAccess<'de>,
7005            {
7006                #[allow(unused_imports)]
7007                use serde::de::Error;
7008                use std::option::Option::Some;
7009                let mut fields = std::collections::HashSet::new();
7010                let mut result = Self::Value::new();
7011                while let Some(tag) = map.next_key::<__FieldTag>()? {
7012                    #[allow(clippy::match_single_binding)]
7013                    match tag {
7014                        __FieldTag::__name => {
7015                            if !fields.insert(__FieldTag::__name) {
7016                                return std::result::Result::Err(A::Error::duplicate_field(
7017                                    "multiple values for name",
7018                                ));
7019                            }
7020                            result.name = map
7021                                .next_value::<std::option::Option<std::string::String>>()?
7022                                .unwrap_or_default();
7023                        }
7024                        __FieldTag::__service_class => {
7025                            if !fields.insert(__FieldTag::__service_class) {
7026                                return std::result::Result::Err(A::Error::duplicate_field(
7027                                    "multiple values for service_class",
7028                                ));
7029                            }
7030                            result.service_class = map
7031                                .next_value::<std::option::Option<std::string::String>>()?
7032                                .unwrap_or_default();
7033                        }
7034                        __FieldTag::__create_time => {
7035                            if !fields.insert(__FieldTag::__create_time) {
7036                                return std::result::Result::Err(A::Error::duplicate_field(
7037                                    "multiple values for create_time",
7038                                ));
7039                            }
7040                            result.create_time =
7041                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
7042                        }
7043                        __FieldTag::__update_time => {
7044                            if !fields.insert(__FieldTag::__update_time) {
7045                                return std::result::Result::Err(A::Error::duplicate_field(
7046                                    "multiple values for update_time",
7047                                ));
7048                            }
7049                            result.update_time =
7050                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
7051                        }
7052                        __FieldTag::__labels => {
7053                            if !fields.insert(__FieldTag::__labels) {
7054                                return std::result::Result::Err(A::Error::duplicate_field(
7055                                    "multiple values for labels",
7056                                ));
7057                            }
7058                            result.labels = map
7059                                .next_value::<std::option::Option<
7060                                    std::collections::HashMap<
7061                                        std::string::String,
7062                                        std::string::String,
7063                                    >,
7064                                >>()?
7065                                .unwrap_or_default();
7066                        }
7067                        __FieldTag::__description => {
7068                            if !fields.insert(__FieldTag::__description) {
7069                                return std::result::Result::Err(A::Error::duplicate_field(
7070                                    "multiple values for description",
7071                                ));
7072                            }
7073                            result.description = map
7074                                .next_value::<std::option::Option<std::string::String>>()?
7075                                .unwrap_or_default();
7076                        }
7077                        __FieldTag::__etag => {
7078                            if !fields.insert(__FieldTag::__etag) {
7079                                return std::result::Result::Err(A::Error::duplicate_field(
7080                                    "multiple values for etag",
7081                                ));
7082                            }
7083                            result.etag =
7084                                map.next_value::<std::option::Option<std::string::String>>()?;
7085                        }
7086                        __FieldTag::Unknown(key) => {
7087                            let value = map.next_value::<serde_json::Value>()?;
7088                            result._unknown_fields.insert(key, value);
7089                        }
7090                    }
7091                }
7092                std::result::Result::Ok(result)
7093            }
7094        }
7095        deserializer.deserialize_any(Visitor)
7096    }
7097}
7098
7099#[doc(hidden)]
7100impl serde::ser::Serialize for ServiceClass {
7101    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7102    where
7103        S: serde::ser::Serializer,
7104    {
7105        use serde::ser::SerializeMap;
7106        #[allow(unused_imports)]
7107        use std::option::Option::Some;
7108        let mut state = serializer.serialize_map(std::option::Option::None)?;
7109        if !self.name.is_empty() {
7110            state.serialize_entry("name", &self.name)?;
7111        }
7112        if !self.service_class.is_empty() {
7113            state.serialize_entry("serviceClass", &self.service_class)?;
7114        }
7115        if self.create_time.is_some() {
7116            state.serialize_entry("createTime", &self.create_time)?;
7117        }
7118        if self.update_time.is_some() {
7119            state.serialize_entry("updateTime", &self.update_time)?;
7120        }
7121        if !self.labels.is_empty() {
7122            state.serialize_entry("labels", &self.labels)?;
7123        }
7124        if !self.description.is_empty() {
7125            state.serialize_entry("description", &self.description)?;
7126        }
7127        if self.etag.is_some() {
7128            state.serialize_entry("etag", &self.etag)?;
7129        }
7130        if !self._unknown_fields.is_empty() {
7131            for (key, value) in self._unknown_fields.iter() {
7132                state.serialize_entry(key, &value)?;
7133            }
7134        }
7135        state.end()
7136    }
7137}
7138
7139impl std::fmt::Debug for ServiceClass {
7140    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7141        let mut debug_struct = f.debug_struct("ServiceClass");
7142        debug_struct.field("name", &self.name);
7143        debug_struct.field("service_class", &self.service_class);
7144        debug_struct.field("create_time", &self.create_time);
7145        debug_struct.field("update_time", &self.update_time);
7146        debug_struct.field("labels", &self.labels);
7147        debug_struct.field("description", &self.description);
7148        debug_struct.field("etag", &self.etag);
7149        if !self._unknown_fields.is_empty() {
7150            debug_struct.field("_unknown_fields", &self._unknown_fields);
7151        }
7152        debug_struct.finish()
7153    }
7154}
7155
7156/// Request for ListServiceClasses.
7157#[derive(Clone, Default, PartialEq)]
7158#[non_exhaustive]
7159pub struct ListServiceClassesRequest {
7160    /// Required. The parent resource's name. ex. projects/123/locations/us-east1
7161    pub parent: std::string::String,
7162
7163    /// The maximum number of results per page that should be returned.
7164    pub page_size: i32,
7165
7166    /// The page token.
7167    pub page_token: std::string::String,
7168
7169    /// A filter expression that filters the results listed in the response.
7170    pub filter: std::string::String,
7171
7172    /// Sort the results by a certain order.
7173    pub order_by: std::string::String,
7174
7175    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7176}
7177
7178impl ListServiceClassesRequest {
7179    pub fn new() -> Self {
7180        std::default::Default::default()
7181    }
7182
7183    /// Sets the value of [parent][crate::model::ListServiceClassesRequest::parent].
7184    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7185        self.parent = v.into();
7186        self
7187    }
7188
7189    /// Sets the value of [page_size][crate::model::ListServiceClassesRequest::page_size].
7190    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7191        self.page_size = v.into();
7192        self
7193    }
7194
7195    /// Sets the value of [page_token][crate::model::ListServiceClassesRequest::page_token].
7196    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7197        self.page_token = v.into();
7198        self
7199    }
7200
7201    /// Sets the value of [filter][crate::model::ListServiceClassesRequest::filter].
7202    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7203        self.filter = v.into();
7204        self
7205    }
7206
7207    /// Sets the value of [order_by][crate::model::ListServiceClassesRequest::order_by].
7208    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7209        self.order_by = v.into();
7210        self
7211    }
7212}
7213
7214impl wkt::message::Message for ListServiceClassesRequest {
7215    fn typename() -> &'static str {
7216        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListServiceClassesRequest"
7217    }
7218}
7219
7220#[doc(hidden)]
7221impl<'de> serde::de::Deserialize<'de> for ListServiceClassesRequest {
7222    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7223    where
7224        D: serde::Deserializer<'de>,
7225    {
7226        #[allow(non_camel_case_types)]
7227        #[doc(hidden)]
7228        #[derive(PartialEq, Eq, Hash)]
7229        enum __FieldTag {
7230            __parent,
7231            __page_size,
7232            __page_token,
7233            __filter,
7234            __order_by,
7235            Unknown(std::string::String),
7236        }
7237        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7238            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7239            where
7240                D: serde::Deserializer<'de>,
7241            {
7242                struct Visitor;
7243                impl<'de> serde::de::Visitor<'de> for Visitor {
7244                    type Value = __FieldTag;
7245                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7246                        formatter.write_str("a field name for ListServiceClassesRequest")
7247                    }
7248                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7249                    where
7250                        E: serde::de::Error,
7251                    {
7252                        use std::result::Result::Ok;
7253                        use std::string::ToString;
7254                        match value {
7255                            "parent" => Ok(__FieldTag::__parent),
7256                            "pageSize" => Ok(__FieldTag::__page_size),
7257                            "page_size" => Ok(__FieldTag::__page_size),
7258                            "pageToken" => Ok(__FieldTag::__page_token),
7259                            "page_token" => Ok(__FieldTag::__page_token),
7260                            "filter" => Ok(__FieldTag::__filter),
7261                            "orderBy" => Ok(__FieldTag::__order_by),
7262                            "order_by" => Ok(__FieldTag::__order_by),
7263                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7264                        }
7265                    }
7266                }
7267                deserializer.deserialize_identifier(Visitor)
7268            }
7269        }
7270        struct Visitor;
7271        impl<'de> serde::de::Visitor<'de> for Visitor {
7272            type Value = ListServiceClassesRequest;
7273            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7274                formatter.write_str("struct ListServiceClassesRequest")
7275            }
7276            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7277            where
7278                A: serde::de::MapAccess<'de>,
7279            {
7280                #[allow(unused_imports)]
7281                use serde::de::Error;
7282                use std::option::Option::Some;
7283                let mut fields = std::collections::HashSet::new();
7284                let mut result = Self::Value::new();
7285                while let Some(tag) = map.next_key::<__FieldTag>()? {
7286                    #[allow(clippy::match_single_binding)]
7287                    match tag {
7288                        __FieldTag::__parent => {
7289                            if !fields.insert(__FieldTag::__parent) {
7290                                return std::result::Result::Err(A::Error::duplicate_field(
7291                                    "multiple values for parent",
7292                                ));
7293                            }
7294                            result.parent = map
7295                                .next_value::<std::option::Option<std::string::String>>()?
7296                                .unwrap_or_default();
7297                        }
7298                        __FieldTag::__page_size => {
7299                            if !fields.insert(__FieldTag::__page_size) {
7300                                return std::result::Result::Err(A::Error::duplicate_field(
7301                                    "multiple values for page_size",
7302                                ));
7303                            }
7304                            struct __With(std::option::Option<i32>);
7305                            impl<'de> serde::de::Deserialize<'de> for __With {
7306                                fn deserialize<D>(
7307                                    deserializer: D,
7308                                ) -> std::result::Result<Self, D::Error>
7309                                where
7310                                    D: serde::de::Deserializer<'de>,
7311                                {
7312                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
7313                                }
7314                            }
7315                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
7316                        }
7317                        __FieldTag::__page_token => {
7318                            if !fields.insert(__FieldTag::__page_token) {
7319                                return std::result::Result::Err(A::Error::duplicate_field(
7320                                    "multiple values for page_token",
7321                                ));
7322                            }
7323                            result.page_token = map
7324                                .next_value::<std::option::Option<std::string::String>>()?
7325                                .unwrap_or_default();
7326                        }
7327                        __FieldTag::__filter => {
7328                            if !fields.insert(__FieldTag::__filter) {
7329                                return std::result::Result::Err(A::Error::duplicate_field(
7330                                    "multiple values for filter",
7331                                ));
7332                            }
7333                            result.filter = map
7334                                .next_value::<std::option::Option<std::string::String>>()?
7335                                .unwrap_or_default();
7336                        }
7337                        __FieldTag::__order_by => {
7338                            if !fields.insert(__FieldTag::__order_by) {
7339                                return std::result::Result::Err(A::Error::duplicate_field(
7340                                    "multiple values for order_by",
7341                                ));
7342                            }
7343                            result.order_by = map
7344                                .next_value::<std::option::Option<std::string::String>>()?
7345                                .unwrap_or_default();
7346                        }
7347                        __FieldTag::Unknown(key) => {
7348                            let value = map.next_value::<serde_json::Value>()?;
7349                            result._unknown_fields.insert(key, value);
7350                        }
7351                    }
7352                }
7353                std::result::Result::Ok(result)
7354            }
7355        }
7356        deserializer.deserialize_any(Visitor)
7357    }
7358}
7359
7360#[doc(hidden)]
7361impl serde::ser::Serialize for ListServiceClassesRequest {
7362    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7363    where
7364        S: serde::ser::Serializer,
7365    {
7366        use serde::ser::SerializeMap;
7367        #[allow(unused_imports)]
7368        use std::option::Option::Some;
7369        let mut state = serializer.serialize_map(std::option::Option::None)?;
7370        if !self.parent.is_empty() {
7371            state.serialize_entry("parent", &self.parent)?;
7372        }
7373        if !wkt::internal::is_default(&self.page_size) {
7374            struct __With<'a>(&'a i32);
7375            impl<'a> serde::ser::Serialize for __With<'a> {
7376                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7377                where
7378                    S: serde::ser::Serializer,
7379                {
7380                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
7381                }
7382            }
7383            state.serialize_entry("pageSize", &__With(&self.page_size))?;
7384        }
7385        if !self.page_token.is_empty() {
7386            state.serialize_entry("pageToken", &self.page_token)?;
7387        }
7388        if !self.filter.is_empty() {
7389            state.serialize_entry("filter", &self.filter)?;
7390        }
7391        if !self.order_by.is_empty() {
7392            state.serialize_entry("orderBy", &self.order_by)?;
7393        }
7394        if !self._unknown_fields.is_empty() {
7395            for (key, value) in self._unknown_fields.iter() {
7396                state.serialize_entry(key, &value)?;
7397            }
7398        }
7399        state.end()
7400    }
7401}
7402
7403impl std::fmt::Debug for ListServiceClassesRequest {
7404    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7405        let mut debug_struct = f.debug_struct("ListServiceClassesRequest");
7406        debug_struct.field("parent", &self.parent);
7407        debug_struct.field("page_size", &self.page_size);
7408        debug_struct.field("page_token", &self.page_token);
7409        debug_struct.field("filter", &self.filter);
7410        debug_struct.field("order_by", &self.order_by);
7411        if !self._unknown_fields.is_empty() {
7412            debug_struct.field("_unknown_fields", &self._unknown_fields);
7413        }
7414        debug_struct.finish()
7415    }
7416}
7417
7418/// Response for ListServiceClasses.
7419#[derive(Clone, Default, PartialEq)]
7420#[non_exhaustive]
7421pub struct ListServiceClassesResponse {
7422    /// ServiceClasses to be returned.
7423    pub service_classes: std::vec::Vec<crate::model::ServiceClass>,
7424
7425    /// The next pagination token in the List response. It should be used as
7426    /// page_token for the following request. An empty value means no more result.
7427    pub next_page_token: std::string::String,
7428
7429    /// Locations that could not be reached.
7430    pub unreachable: std::vec::Vec<std::string::String>,
7431
7432    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7433}
7434
7435impl ListServiceClassesResponse {
7436    pub fn new() -> Self {
7437        std::default::Default::default()
7438    }
7439
7440    /// Sets the value of [service_classes][crate::model::ListServiceClassesResponse::service_classes].
7441    pub fn set_service_classes<T, V>(mut self, v: T) -> Self
7442    where
7443        T: std::iter::IntoIterator<Item = V>,
7444        V: std::convert::Into<crate::model::ServiceClass>,
7445    {
7446        use std::iter::Iterator;
7447        self.service_classes = v.into_iter().map(|i| i.into()).collect();
7448        self
7449    }
7450
7451    /// Sets the value of [next_page_token][crate::model::ListServiceClassesResponse::next_page_token].
7452    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7453        self.next_page_token = v.into();
7454        self
7455    }
7456
7457    /// Sets the value of [unreachable][crate::model::ListServiceClassesResponse::unreachable].
7458    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
7459    where
7460        T: std::iter::IntoIterator<Item = V>,
7461        V: std::convert::Into<std::string::String>,
7462    {
7463        use std::iter::Iterator;
7464        self.unreachable = v.into_iter().map(|i| i.into()).collect();
7465        self
7466    }
7467}
7468
7469impl wkt::message::Message for ListServiceClassesResponse {
7470    fn typename() -> &'static str {
7471        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListServiceClassesResponse"
7472    }
7473}
7474
7475#[doc(hidden)]
7476impl gax::paginator::internal::PageableResponse for ListServiceClassesResponse {
7477    type PageItem = crate::model::ServiceClass;
7478
7479    fn items(self) -> std::vec::Vec<Self::PageItem> {
7480        self.service_classes
7481    }
7482
7483    fn next_page_token(&self) -> std::string::String {
7484        use std::clone::Clone;
7485        self.next_page_token.clone()
7486    }
7487}
7488
7489#[doc(hidden)]
7490impl<'de> serde::de::Deserialize<'de> for ListServiceClassesResponse {
7491    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7492    where
7493        D: serde::Deserializer<'de>,
7494    {
7495        #[allow(non_camel_case_types)]
7496        #[doc(hidden)]
7497        #[derive(PartialEq, Eq, Hash)]
7498        enum __FieldTag {
7499            __service_classes,
7500            __next_page_token,
7501            __unreachable,
7502            Unknown(std::string::String),
7503        }
7504        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7505            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7506            where
7507                D: serde::Deserializer<'de>,
7508            {
7509                struct Visitor;
7510                impl<'de> serde::de::Visitor<'de> for Visitor {
7511                    type Value = __FieldTag;
7512                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7513                        formatter.write_str("a field name for ListServiceClassesResponse")
7514                    }
7515                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7516                    where
7517                        E: serde::de::Error,
7518                    {
7519                        use std::result::Result::Ok;
7520                        use std::string::ToString;
7521                        match value {
7522                            "serviceClasses" => Ok(__FieldTag::__service_classes),
7523                            "service_classes" => Ok(__FieldTag::__service_classes),
7524                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
7525                            "next_page_token" => Ok(__FieldTag::__next_page_token),
7526                            "unreachable" => Ok(__FieldTag::__unreachable),
7527                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7528                        }
7529                    }
7530                }
7531                deserializer.deserialize_identifier(Visitor)
7532            }
7533        }
7534        struct Visitor;
7535        impl<'de> serde::de::Visitor<'de> for Visitor {
7536            type Value = ListServiceClassesResponse;
7537            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7538                formatter.write_str("struct ListServiceClassesResponse")
7539            }
7540            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7541            where
7542                A: serde::de::MapAccess<'de>,
7543            {
7544                #[allow(unused_imports)]
7545                use serde::de::Error;
7546                use std::option::Option::Some;
7547                let mut fields = std::collections::HashSet::new();
7548                let mut result = Self::Value::new();
7549                while let Some(tag) = map.next_key::<__FieldTag>()? {
7550                    #[allow(clippy::match_single_binding)]
7551                    match tag {
7552                        __FieldTag::__service_classes => {
7553                            if !fields.insert(__FieldTag::__service_classes) {
7554                                return std::result::Result::Err(A::Error::duplicate_field(
7555                                    "multiple values for service_classes",
7556                                ));
7557                            }
7558                            result.service_classes = map.next_value::<std::option::Option<std::vec::Vec<crate::model::ServiceClass>>>()?.unwrap_or_default();
7559                        }
7560                        __FieldTag::__next_page_token => {
7561                            if !fields.insert(__FieldTag::__next_page_token) {
7562                                return std::result::Result::Err(A::Error::duplicate_field(
7563                                    "multiple values for next_page_token",
7564                                ));
7565                            }
7566                            result.next_page_token = map
7567                                .next_value::<std::option::Option<std::string::String>>()?
7568                                .unwrap_or_default();
7569                        }
7570                        __FieldTag::__unreachable => {
7571                            if !fields.insert(__FieldTag::__unreachable) {
7572                                return std::result::Result::Err(A::Error::duplicate_field(
7573                                    "multiple values for unreachable",
7574                                ));
7575                            }
7576                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
7577                        }
7578                        __FieldTag::Unknown(key) => {
7579                            let value = map.next_value::<serde_json::Value>()?;
7580                            result._unknown_fields.insert(key, value);
7581                        }
7582                    }
7583                }
7584                std::result::Result::Ok(result)
7585            }
7586        }
7587        deserializer.deserialize_any(Visitor)
7588    }
7589}
7590
7591#[doc(hidden)]
7592impl serde::ser::Serialize for ListServiceClassesResponse {
7593    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7594    where
7595        S: serde::ser::Serializer,
7596    {
7597        use serde::ser::SerializeMap;
7598        #[allow(unused_imports)]
7599        use std::option::Option::Some;
7600        let mut state = serializer.serialize_map(std::option::Option::None)?;
7601        if !self.service_classes.is_empty() {
7602            state.serialize_entry("serviceClasses", &self.service_classes)?;
7603        }
7604        if !self.next_page_token.is_empty() {
7605            state.serialize_entry("nextPageToken", &self.next_page_token)?;
7606        }
7607        if !self.unreachable.is_empty() {
7608            state.serialize_entry("unreachable", &self.unreachable)?;
7609        }
7610        if !self._unknown_fields.is_empty() {
7611            for (key, value) in self._unknown_fields.iter() {
7612                state.serialize_entry(key, &value)?;
7613            }
7614        }
7615        state.end()
7616    }
7617}
7618
7619impl std::fmt::Debug for ListServiceClassesResponse {
7620    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7621        let mut debug_struct = f.debug_struct("ListServiceClassesResponse");
7622        debug_struct.field("service_classes", &self.service_classes);
7623        debug_struct.field("next_page_token", &self.next_page_token);
7624        debug_struct.field("unreachable", &self.unreachable);
7625        if !self._unknown_fields.is_empty() {
7626            debug_struct.field("_unknown_fields", &self._unknown_fields);
7627        }
7628        debug_struct.finish()
7629    }
7630}
7631
7632/// Request for GetServiceClass.
7633#[derive(Clone, Default, PartialEq)]
7634#[non_exhaustive]
7635pub struct GetServiceClassRequest {
7636    /// Required. Name of the ServiceClass to get.
7637    pub name: std::string::String,
7638
7639    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7640}
7641
7642impl GetServiceClassRequest {
7643    pub fn new() -> Self {
7644        std::default::Default::default()
7645    }
7646
7647    /// Sets the value of [name][crate::model::GetServiceClassRequest::name].
7648    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7649        self.name = v.into();
7650        self
7651    }
7652}
7653
7654impl wkt::message::Message for GetServiceClassRequest {
7655    fn typename() -> &'static str {
7656        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetServiceClassRequest"
7657    }
7658}
7659
7660#[doc(hidden)]
7661impl<'de> serde::de::Deserialize<'de> for GetServiceClassRequest {
7662    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7663    where
7664        D: serde::Deserializer<'de>,
7665    {
7666        #[allow(non_camel_case_types)]
7667        #[doc(hidden)]
7668        #[derive(PartialEq, Eq, Hash)]
7669        enum __FieldTag {
7670            __name,
7671            Unknown(std::string::String),
7672        }
7673        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7674            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7675            where
7676                D: serde::Deserializer<'de>,
7677            {
7678                struct Visitor;
7679                impl<'de> serde::de::Visitor<'de> for Visitor {
7680                    type Value = __FieldTag;
7681                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7682                        formatter.write_str("a field name for GetServiceClassRequest")
7683                    }
7684                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7685                    where
7686                        E: serde::de::Error,
7687                    {
7688                        use std::result::Result::Ok;
7689                        use std::string::ToString;
7690                        match value {
7691                            "name" => Ok(__FieldTag::__name),
7692                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7693                        }
7694                    }
7695                }
7696                deserializer.deserialize_identifier(Visitor)
7697            }
7698        }
7699        struct Visitor;
7700        impl<'de> serde::de::Visitor<'de> for Visitor {
7701            type Value = GetServiceClassRequest;
7702            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7703                formatter.write_str("struct GetServiceClassRequest")
7704            }
7705            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7706            where
7707                A: serde::de::MapAccess<'de>,
7708            {
7709                #[allow(unused_imports)]
7710                use serde::de::Error;
7711                use std::option::Option::Some;
7712                let mut fields = std::collections::HashSet::new();
7713                let mut result = Self::Value::new();
7714                while let Some(tag) = map.next_key::<__FieldTag>()? {
7715                    #[allow(clippy::match_single_binding)]
7716                    match tag {
7717                        __FieldTag::__name => {
7718                            if !fields.insert(__FieldTag::__name) {
7719                                return std::result::Result::Err(A::Error::duplicate_field(
7720                                    "multiple values for name",
7721                                ));
7722                            }
7723                            result.name = map
7724                                .next_value::<std::option::Option<std::string::String>>()?
7725                                .unwrap_or_default();
7726                        }
7727                        __FieldTag::Unknown(key) => {
7728                            let value = map.next_value::<serde_json::Value>()?;
7729                            result._unknown_fields.insert(key, value);
7730                        }
7731                    }
7732                }
7733                std::result::Result::Ok(result)
7734            }
7735        }
7736        deserializer.deserialize_any(Visitor)
7737    }
7738}
7739
7740#[doc(hidden)]
7741impl serde::ser::Serialize for GetServiceClassRequest {
7742    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7743    where
7744        S: serde::ser::Serializer,
7745    {
7746        use serde::ser::SerializeMap;
7747        #[allow(unused_imports)]
7748        use std::option::Option::Some;
7749        let mut state = serializer.serialize_map(std::option::Option::None)?;
7750        if !self.name.is_empty() {
7751            state.serialize_entry("name", &self.name)?;
7752        }
7753        if !self._unknown_fields.is_empty() {
7754            for (key, value) in self._unknown_fields.iter() {
7755                state.serialize_entry(key, &value)?;
7756            }
7757        }
7758        state.end()
7759    }
7760}
7761
7762impl std::fmt::Debug for GetServiceClassRequest {
7763    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7764        let mut debug_struct = f.debug_struct("GetServiceClassRequest");
7765        debug_struct.field("name", &self.name);
7766        if !self._unknown_fields.is_empty() {
7767            debug_struct.field("_unknown_fields", &self._unknown_fields);
7768        }
7769        debug_struct.finish()
7770    }
7771}
7772
7773/// Request for UpdateServiceClass.
7774#[derive(Clone, Default, PartialEq)]
7775#[non_exhaustive]
7776pub struct UpdateServiceClassRequest {
7777    /// Optional. Field mask is used to specify the fields to be overwritten in the
7778    /// ServiceClass resource by the update.
7779    /// The fields specified in the update_mask are relative to the resource, not
7780    /// the full request. A field will be overwritten if it is in the mask. If the
7781    /// user does not provide a mask then all fields will be overwritten.
7782    pub update_mask: std::option::Option<wkt::FieldMask>,
7783
7784    /// Required. New values to be patched into the resource.
7785    pub service_class: std::option::Option<crate::model::ServiceClass>,
7786
7787    /// Optional. An optional request ID to identify requests. Specify a unique
7788    /// request ID so that if you must retry your request, the server will know to
7789    /// ignore the request if it has already been completed. The server will
7790    /// guarantee that for at least 60 minutes since the first request.
7791    ///
7792    /// For example, consider a situation where you make an initial request and
7793    /// the request times out. If you make the request again with the same request
7794    /// ID, the server can check if original operation with the same request ID
7795    /// was received, and if so, will ignore the second request. This prevents
7796    /// clients from accidentally creating duplicate commitments.
7797    ///
7798    /// The request ID must be a valid UUID with the exception that zero UUID is
7799    /// not supported (00000000-0000-0000-0000-000000000000).
7800    pub request_id: std::string::String,
7801
7802    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7803}
7804
7805impl UpdateServiceClassRequest {
7806    pub fn new() -> Self {
7807        std::default::Default::default()
7808    }
7809
7810    /// Sets the value of [update_mask][crate::model::UpdateServiceClassRequest::update_mask].
7811    pub fn set_update_mask<T>(mut self, v: T) -> Self
7812    where
7813        T: std::convert::Into<wkt::FieldMask>,
7814    {
7815        self.update_mask = std::option::Option::Some(v.into());
7816        self
7817    }
7818
7819    /// Sets or clears the value of [update_mask][crate::model::UpdateServiceClassRequest::update_mask].
7820    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7821    where
7822        T: std::convert::Into<wkt::FieldMask>,
7823    {
7824        self.update_mask = v.map(|x| x.into());
7825        self
7826    }
7827
7828    /// Sets the value of [service_class][crate::model::UpdateServiceClassRequest::service_class].
7829    pub fn set_service_class<T>(mut self, v: T) -> Self
7830    where
7831        T: std::convert::Into<crate::model::ServiceClass>,
7832    {
7833        self.service_class = std::option::Option::Some(v.into());
7834        self
7835    }
7836
7837    /// Sets or clears the value of [service_class][crate::model::UpdateServiceClassRequest::service_class].
7838    pub fn set_or_clear_service_class<T>(mut self, v: std::option::Option<T>) -> Self
7839    where
7840        T: std::convert::Into<crate::model::ServiceClass>,
7841    {
7842        self.service_class = v.map(|x| x.into());
7843        self
7844    }
7845
7846    /// Sets the value of [request_id][crate::model::UpdateServiceClassRequest::request_id].
7847    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7848        self.request_id = v.into();
7849        self
7850    }
7851}
7852
7853impl wkt::message::Message for UpdateServiceClassRequest {
7854    fn typename() -> &'static str {
7855        "type.googleapis.com/google.cloud.networkconnectivity.v1.UpdateServiceClassRequest"
7856    }
7857}
7858
7859#[doc(hidden)]
7860impl<'de> serde::de::Deserialize<'de> for UpdateServiceClassRequest {
7861    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7862    where
7863        D: serde::Deserializer<'de>,
7864    {
7865        #[allow(non_camel_case_types)]
7866        #[doc(hidden)]
7867        #[derive(PartialEq, Eq, Hash)]
7868        enum __FieldTag {
7869            __update_mask,
7870            __service_class,
7871            __request_id,
7872            Unknown(std::string::String),
7873        }
7874        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7875            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7876            where
7877                D: serde::Deserializer<'de>,
7878            {
7879                struct Visitor;
7880                impl<'de> serde::de::Visitor<'de> for Visitor {
7881                    type Value = __FieldTag;
7882                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7883                        formatter.write_str("a field name for UpdateServiceClassRequest")
7884                    }
7885                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7886                    where
7887                        E: serde::de::Error,
7888                    {
7889                        use std::result::Result::Ok;
7890                        use std::string::ToString;
7891                        match value {
7892                            "updateMask" => Ok(__FieldTag::__update_mask),
7893                            "update_mask" => Ok(__FieldTag::__update_mask),
7894                            "serviceClass" => Ok(__FieldTag::__service_class),
7895                            "service_class" => Ok(__FieldTag::__service_class),
7896                            "requestId" => Ok(__FieldTag::__request_id),
7897                            "request_id" => Ok(__FieldTag::__request_id),
7898                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7899                        }
7900                    }
7901                }
7902                deserializer.deserialize_identifier(Visitor)
7903            }
7904        }
7905        struct Visitor;
7906        impl<'de> serde::de::Visitor<'de> for Visitor {
7907            type Value = UpdateServiceClassRequest;
7908            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7909                formatter.write_str("struct UpdateServiceClassRequest")
7910            }
7911            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7912            where
7913                A: serde::de::MapAccess<'de>,
7914            {
7915                #[allow(unused_imports)]
7916                use serde::de::Error;
7917                use std::option::Option::Some;
7918                let mut fields = std::collections::HashSet::new();
7919                let mut result = Self::Value::new();
7920                while let Some(tag) = map.next_key::<__FieldTag>()? {
7921                    #[allow(clippy::match_single_binding)]
7922                    match tag {
7923                        __FieldTag::__update_mask => {
7924                            if !fields.insert(__FieldTag::__update_mask) {
7925                                return std::result::Result::Err(A::Error::duplicate_field(
7926                                    "multiple values for update_mask",
7927                                ));
7928                            }
7929                            result.update_mask =
7930                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
7931                        }
7932                        __FieldTag::__service_class => {
7933                            if !fields.insert(__FieldTag::__service_class) {
7934                                return std::result::Result::Err(A::Error::duplicate_field(
7935                                    "multiple values for service_class",
7936                                ));
7937                            }
7938                            result.service_class = map
7939                                .next_value::<std::option::Option<crate::model::ServiceClass>>()?;
7940                        }
7941                        __FieldTag::__request_id => {
7942                            if !fields.insert(__FieldTag::__request_id) {
7943                                return std::result::Result::Err(A::Error::duplicate_field(
7944                                    "multiple values for request_id",
7945                                ));
7946                            }
7947                            result.request_id = map
7948                                .next_value::<std::option::Option<std::string::String>>()?
7949                                .unwrap_or_default();
7950                        }
7951                        __FieldTag::Unknown(key) => {
7952                            let value = map.next_value::<serde_json::Value>()?;
7953                            result._unknown_fields.insert(key, value);
7954                        }
7955                    }
7956                }
7957                std::result::Result::Ok(result)
7958            }
7959        }
7960        deserializer.deserialize_any(Visitor)
7961    }
7962}
7963
7964#[doc(hidden)]
7965impl serde::ser::Serialize for UpdateServiceClassRequest {
7966    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7967    where
7968        S: serde::ser::Serializer,
7969    {
7970        use serde::ser::SerializeMap;
7971        #[allow(unused_imports)]
7972        use std::option::Option::Some;
7973        let mut state = serializer.serialize_map(std::option::Option::None)?;
7974        if self.update_mask.is_some() {
7975            state.serialize_entry("updateMask", &self.update_mask)?;
7976        }
7977        if self.service_class.is_some() {
7978            state.serialize_entry("serviceClass", &self.service_class)?;
7979        }
7980        if !self.request_id.is_empty() {
7981            state.serialize_entry("requestId", &self.request_id)?;
7982        }
7983        if !self._unknown_fields.is_empty() {
7984            for (key, value) in self._unknown_fields.iter() {
7985                state.serialize_entry(key, &value)?;
7986            }
7987        }
7988        state.end()
7989    }
7990}
7991
7992impl std::fmt::Debug for UpdateServiceClassRequest {
7993    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7994        let mut debug_struct = f.debug_struct("UpdateServiceClassRequest");
7995        debug_struct.field("update_mask", &self.update_mask);
7996        debug_struct.field("service_class", &self.service_class);
7997        debug_struct.field("request_id", &self.request_id);
7998        if !self._unknown_fields.is_empty() {
7999            debug_struct.field("_unknown_fields", &self._unknown_fields);
8000        }
8001        debug_struct.finish()
8002    }
8003}
8004
8005/// Request for DeleteServiceClass.
8006#[derive(Clone, Default, PartialEq)]
8007#[non_exhaustive]
8008pub struct DeleteServiceClassRequest {
8009    /// Required. The name of the ServiceClass to delete.
8010    pub name: std::string::String,
8011
8012    /// Optional. An optional request ID to identify requests. Specify a unique
8013    /// request ID so that if you must retry your request, the server will know to
8014    /// ignore the request if it has already been completed. The server will
8015    /// guarantee that for at least 60 minutes after the first request.
8016    ///
8017    /// For example, consider a situation where you make an initial request and
8018    /// the request times out. If you make the request again with the same request
8019    /// ID, the server can check if original operation with the same request ID
8020    /// was received, and if so, will ignore the second request. This prevents
8021    /// clients from accidentally creating duplicate commitments.
8022    ///
8023    /// The request ID must be a valid UUID with the exception that zero UUID is
8024    /// not supported (00000000-0000-0000-0000-000000000000).
8025    pub request_id: std::string::String,
8026
8027    /// Optional. The etag is computed by the server, and may be sent on update and
8028    /// delete requests to ensure the client has an up-to-date value before
8029    /// proceeding.
8030    pub etag: std::option::Option<std::string::String>,
8031
8032    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8033}
8034
8035impl DeleteServiceClassRequest {
8036    pub fn new() -> Self {
8037        std::default::Default::default()
8038    }
8039
8040    /// Sets the value of [name][crate::model::DeleteServiceClassRequest::name].
8041    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8042        self.name = v.into();
8043        self
8044    }
8045
8046    /// Sets the value of [request_id][crate::model::DeleteServiceClassRequest::request_id].
8047    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8048        self.request_id = v.into();
8049        self
8050    }
8051
8052    /// Sets the value of [etag][crate::model::DeleteServiceClassRequest::etag].
8053    pub fn set_etag<T>(mut self, v: T) -> Self
8054    where
8055        T: std::convert::Into<std::string::String>,
8056    {
8057        self.etag = std::option::Option::Some(v.into());
8058        self
8059    }
8060
8061    /// Sets or clears the value of [etag][crate::model::DeleteServiceClassRequest::etag].
8062    pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
8063    where
8064        T: std::convert::Into<std::string::String>,
8065    {
8066        self.etag = v.map(|x| x.into());
8067        self
8068    }
8069}
8070
8071impl wkt::message::Message for DeleteServiceClassRequest {
8072    fn typename() -> &'static str {
8073        "type.googleapis.com/google.cloud.networkconnectivity.v1.DeleteServiceClassRequest"
8074    }
8075}
8076
8077#[doc(hidden)]
8078impl<'de> serde::de::Deserialize<'de> for DeleteServiceClassRequest {
8079    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8080    where
8081        D: serde::Deserializer<'de>,
8082    {
8083        #[allow(non_camel_case_types)]
8084        #[doc(hidden)]
8085        #[derive(PartialEq, Eq, Hash)]
8086        enum __FieldTag {
8087            __name,
8088            __request_id,
8089            __etag,
8090            Unknown(std::string::String),
8091        }
8092        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8093            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8094            where
8095                D: serde::Deserializer<'de>,
8096            {
8097                struct Visitor;
8098                impl<'de> serde::de::Visitor<'de> for Visitor {
8099                    type Value = __FieldTag;
8100                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8101                        formatter.write_str("a field name for DeleteServiceClassRequest")
8102                    }
8103                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8104                    where
8105                        E: serde::de::Error,
8106                    {
8107                        use std::result::Result::Ok;
8108                        use std::string::ToString;
8109                        match value {
8110                            "name" => Ok(__FieldTag::__name),
8111                            "requestId" => Ok(__FieldTag::__request_id),
8112                            "request_id" => Ok(__FieldTag::__request_id),
8113                            "etag" => Ok(__FieldTag::__etag),
8114                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8115                        }
8116                    }
8117                }
8118                deserializer.deserialize_identifier(Visitor)
8119            }
8120        }
8121        struct Visitor;
8122        impl<'de> serde::de::Visitor<'de> for Visitor {
8123            type Value = DeleteServiceClassRequest;
8124            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8125                formatter.write_str("struct DeleteServiceClassRequest")
8126            }
8127            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8128            where
8129                A: serde::de::MapAccess<'de>,
8130            {
8131                #[allow(unused_imports)]
8132                use serde::de::Error;
8133                use std::option::Option::Some;
8134                let mut fields = std::collections::HashSet::new();
8135                let mut result = Self::Value::new();
8136                while let Some(tag) = map.next_key::<__FieldTag>()? {
8137                    #[allow(clippy::match_single_binding)]
8138                    match tag {
8139                        __FieldTag::__name => {
8140                            if !fields.insert(__FieldTag::__name) {
8141                                return std::result::Result::Err(A::Error::duplicate_field(
8142                                    "multiple values for name",
8143                                ));
8144                            }
8145                            result.name = map
8146                                .next_value::<std::option::Option<std::string::String>>()?
8147                                .unwrap_or_default();
8148                        }
8149                        __FieldTag::__request_id => {
8150                            if !fields.insert(__FieldTag::__request_id) {
8151                                return std::result::Result::Err(A::Error::duplicate_field(
8152                                    "multiple values for request_id",
8153                                ));
8154                            }
8155                            result.request_id = map
8156                                .next_value::<std::option::Option<std::string::String>>()?
8157                                .unwrap_or_default();
8158                        }
8159                        __FieldTag::__etag => {
8160                            if !fields.insert(__FieldTag::__etag) {
8161                                return std::result::Result::Err(A::Error::duplicate_field(
8162                                    "multiple values for etag",
8163                                ));
8164                            }
8165                            result.etag =
8166                                map.next_value::<std::option::Option<std::string::String>>()?;
8167                        }
8168                        __FieldTag::Unknown(key) => {
8169                            let value = map.next_value::<serde_json::Value>()?;
8170                            result._unknown_fields.insert(key, value);
8171                        }
8172                    }
8173                }
8174                std::result::Result::Ok(result)
8175            }
8176        }
8177        deserializer.deserialize_any(Visitor)
8178    }
8179}
8180
8181#[doc(hidden)]
8182impl serde::ser::Serialize for DeleteServiceClassRequest {
8183    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8184    where
8185        S: serde::ser::Serializer,
8186    {
8187        use serde::ser::SerializeMap;
8188        #[allow(unused_imports)]
8189        use std::option::Option::Some;
8190        let mut state = serializer.serialize_map(std::option::Option::None)?;
8191        if !self.name.is_empty() {
8192            state.serialize_entry("name", &self.name)?;
8193        }
8194        if !self.request_id.is_empty() {
8195            state.serialize_entry("requestId", &self.request_id)?;
8196        }
8197        if self.etag.is_some() {
8198            state.serialize_entry("etag", &self.etag)?;
8199        }
8200        if !self._unknown_fields.is_empty() {
8201            for (key, value) in self._unknown_fields.iter() {
8202                state.serialize_entry(key, &value)?;
8203            }
8204        }
8205        state.end()
8206    }
8207}
8208
8209impl std::fmt::Debug for DeleteServiceClassRequest {
8210    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8211        let mut debug_struct = f.debug_struct("DeleteServiceClassRequest");
8212        debug_struct.field("name", &self.name);
8213        debug_struct.field("request_id", &self.request_id);
8214        debug_struct.field("etag", &self.etag);
8215        if !self._unknown_fields.is_empty() {
8216            debug_struct.field("_unknown_fields", &self._unknown_fields);
8217        }
8218        debug_struct.finish()
8219    }
8220}
8221
8222/// The ServiceConnectionToken resource.
8223#[derive(Clone, Default, PartialEq)]
8224#[non_exhaustive]
8225pub struct ServiceConnectionToken {
8226    /// Immutable. The name of a ServiceConnectionToken.
8227    /// Format:
8228    /// projects/{project}/locations/{location}/ServiceConnectionTokens/{service_connection_token}
8229    /// See: <https://google.aip.dev/122#fields-representing-resource-names>
8230    pub name: std::string::String,
8231
8232    /// Output only. Time when the ServiceConnectionToken was created.
8233    pub create_time: std::option::Option<wkt::Timestamp>,
8234
8235    /// Output only. Time when the ServiceConnectionToken was updated.
8236    pub update_time: std::option::Option<wkt::Timestamp>,
8237
8238    /// User-defined labels.
8239    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
8240
8241    /// A description of this resource.
8242    pub description: std::string::String,
8243
8244    /// The resource path of the network associated with this token.
8245    /// Example:
8246    /// projects/{projectNumOrId}/global/networks/{resourceId}.
8247    pub network: std::string::String,
8248
8249    /// Output only. The token generated by Automation.
8250    pub token: std::string::String,
8251
8252    /// Output only. The time to which this token is valid.
8253    pub expire_time: std::option::Option<wkt::Timestamp>,
8254
8255    /// Optional. The etag is computed by the server, and may be sent on update and
8256    /// delete requests to ensure the client has an up-to-date value before
8257    /// proceeding.
8258    pub etag: std::option::Option<std::string::String>,
8259
8260    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8261}
8262
8263impl ServiceConnectionToken {
8264    pub fn new() -> Self {
8265        std::default::Default::default()
8266    }
8267
8268    /// Sets the value of [name][crate::model::ServiceConnectionToken::name].
8269    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8270        self.name = v.into();
8271        self
8272    }
8273
8274    /// Sets the value of [create_time][crate::model::ServiceConnectionToken::create_time].
8275    pub fn set_create_time<T>(mut self, v: T) -> Self
8276    where
8277        T: std::convert::Into<wkt::Timestamp>,
8278    {
8279        self.create_time = std::option::Option::Some(v.into());
8280        self
8281    }
8282
8283    /// Sets or clears the value of [create_time][crate::model::ServiceConnectionToken::create_time].
8284    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8285    where
8286        T: std::convert::Into<wkt::Timestamp>,
8287    {
8288        self.create_time = v.map(|x| x.into());
8289        self
8290    }
8291
8292    /// Sets the value of [update_time][crate::model::ServiceConnectionToken::update_time].
8293    pub fn set_update_time<T>(mut self, v: T) -> Self
8294    where
8295        T: std::convert::Into<wkt::Timestamp>,
8296    {
8297        self.update_time = std::option::Option::Some(v.into());
8298        self
8299    }
8300
8301    /// Sets or clears the value of [update_time][crate::model::ServiceConnectionToken::update_time].
8302    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
8303    where
8304        T: std::convert::Into<wkt::Timestamp>,
8305    {
8306        self.update_time = v.map(|x| x.into());
8307        self
8308    }
8309
8310    /// Sets the value of [labels][crate::model::ServiceConnectionToken::labels].
8311    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
8312    where
8313        T: std::iter::IntoIterator<Item = (K, V)>,
8314        K: std::convert::Into<std::string::String>,
8315        V: std::convert::Into<std::string::String>,
8316    {
8317        use std::iter::Iterator;
8318        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8319        self
8320    }
8321
8322    /// Sets the value of [description][crate::model::ServiceConnectionToken::description].
8323    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8324        self.description = v.into();
8325        self
8326    }
8327
8328    /// Sets the value of [network][crate::model::ServiceConnectionToken::network].
8329    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8330        self.network = v.into();
8331        self
8332    }
8333
8334    /// Sets the value of [token][crate::model::ServiceConnectionToken::token].
8335    pub fn set_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8336        self.token = v.into();
8337        self
8338    }
8339
8340    /// Sets the value of [expire_time][crate::model::ServiceConnectionToken::expire_time].
8341    pub fn set_expire_time<T>(mut self, v: T) -> Self
8342    where
8343        T: std::convert::Into<wkt::Timestamp>,
8344    {
8345        self.expire_time = std::option::Option::Some(v.into());
8346        self
8347    }
8348
8349    /// Sets or clears the value of [expire_time][crate::model::ServiceConnectionToken::expire_time].
8350    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
8351    where
8352        T: std::convert::Into<wkt::Timestamp>,
8353    {
8354        self.expire_time = v.map(|x| x.into());
8355        self
8356    }
8357
8358    /// Sets the value of [etag][crate::model::ServiceConnectionToken::etag].
8359    pub fn set_etag<T>(mut self, v: T) -> Self
8360    where
8361        T: std::convert::Into<std::string::String>,
8362    {
8363        self.etag = std::option::Option::Some(v.into());
8364        self
8365    }
8366
8367    /// Sets or clears the value of [etag][crate::model::ServiceConnectionToken::etag].
8368    pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
8369    where
8370        T: std::convert::Into<std::string::String>,
8371    {
8372        self.etag = v.map(|x| x.into());
8373        self
8374    }
8375}
8376
8377impl wkt::message::Message for ServiceConnectionToken {
8378    fn typename() -> &'static str {
8379        "type.googleapis.com/google.cloud.networkconnectivity.v1.ServiceConnectionToken"
8380    }
8381}
8382
8383#[doc(hidden)]
8384impl<'de> serde::de::Deserialize<'de> for ServiceConnectionToken {
8385    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8386    where
8387        D: serde::Deserializer<'de>,
8388    {
8389        #[allow(non_camel_case_types)]
8390        #[doc(hidden)]
8391        #[derive(PartialEq, Eq, Hash)]
8392        enum __FieldTag {
8393            __name,
8394            __create_time,
8395            __update_time,
8396            __labels,
8397            __description,
8398            __network,
8399            __token,
8400            __expire_time,
8401            __etag,
8402            Unknown(std::string::String),
8403        }
8404        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8405            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8406            where
8407                D: serde::Deserializer<'de>,
8408            {
8409                struct Visitor;
8410                impl<'de> serde::de::Visitor<'de> for Visitor {
8411                    type Value = __FieldTag;
8412                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8413                        formatter.write_str("a field name for ServiceConnectionToken")
8414                    }
8415                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8416                    where
8417                        E: serde::de::Error,
8418                    {
8419                        use std::result::Result::Ok;
8420                        use std::string::ToString;
8421                        match value {
8422                            "name" => Ok(__FieldTag::__name),
8423                            "createTime" => Ok(__FieldTag::__create_time),
8424                            "create_time" => Ok(__FieldTag::__create_time),
8425                            "updateTime" => Ok(__FieldTag::__update_time),
8426                            "update_time" => Ok(__FieldTag::__update_time),
8427                            "labels" => Ok(__FieldTag::__labels),
8428                            "description" => Ok(__FieldTag::__description),
8429                            "network" => Ok(__FieldTag::__network),
8430                            "token" => Ok(__FieldTag::__token),
8431                            "expireTime" => Ok(__FieldTag::__expire_time),
8432                            "expire_time" => Ok(__FieldTag::__expire_time),
8433                            "etag" => Ok(__FieldTag::__etag),
8434                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8435                        }
8436                    }
8437                }
8438                deserializer.deserialize_identifier(Visitor)
8439            }
8440        }
8441        struct Visitor;
8442        impl<'de> serde::de::Visitor<'de> for Visitor {
8443            type Value = ServiceConnectionToken;
8444            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8445                formatter.write_str("struct ServiceConnectionToken")
8446            }
8447            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8448            where
8449                A: serde::de::MapAccess<'de>,
8450            {
8451                #[allow(unused_imports)]
8452                use serde::de::Error;
8453                use std::option::Option::Some;
8454                let mut fields = std::collections::HashSet::new();
8455                let mut result = Self::Value::new();
8456                while let Some(tag) = map.next_key::<__FieldTag>()? {
8457                    #[allow(clippy::match_single_binding)]
8458                    match tag {
8459                        __FieldTag::__name => {
8460                            if !fields.insert(__FieldTag::__name) {
8461                                return std::result::Result::Err(A::Error::duplicate_field(
8462                                    "multiple values for name",
8463                                ));
8464                            }
8465                            result.name = map
8466                                .next_value::<std::option::Option<std::string::String>>()?
8467                                .unwrap_or_default();
8468                        }
8469                        __FieldTag::__create_time => {
8470                            if !fields.insert(__FieldTag::__create_time) {
8471                                return std::result::Result::Err(A::Error::duplicate_field(
8472                                    "multiple values for create_time",
8473                                ));
8474                            }
8475                            result.create_time =
8476                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
8477                        }
8478                        __FieldTag::__update_time => {
8479                            if !fields.insert(__FieldTag::__update_time) {
8480                                return std::result::Result::Err(A::Error::duplicate_field(
8481                                    "multiple values for update_time",
8482                                ));
8483                            }
8484                            result.update_time =
8485                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
8486                        }
8487                        __FieldTag::__labels => {
8488                            if !fields.insert(__FieldTag::__labels) {
8489                                return std::result::Result::Err(A::Error::duplicate_field(
8490                                    "multiple values for labels",
8491                                ));
8492                            }
8493                            result.labels = map
8494                                .next_value::<std::option::Option<
8495                                    std::collections::HashMap<
8496                                        std::string::String,
8497                                        std::string::String,
8498                                    >,
8499                                >>()?
8500                                .unwrap_or_default();
8501                        }
8502                        __FieldTag::__description => {
8503                            if !fields.insert(__FieldTag::__description) {
8504                                return std::result::Result::Err(A::Error::duplicate_field(
8505                                    "multiple values for description",
8506                                ));
8507                            }
8508                            result.description = map
8509                                .next_value::<std::option::Option<std::string::String>>()?
8510                                .unwrap_or_default();
8511                        }
8512                        __FieldTag::__network => {
8513                            if !fields.insert(__FieldTag::__network) {
8514                                return std::result::Result::Err(A::Error::duplicate_field(
8515                                    "multiple values for network",
8516                                ));
8517                            }
8518                            result.network = map
8519                                .next_value::<std::option::Option<std::string::String>>()?
8520                                .unwrap_or_default();
8521                        }
8522                        __FieldTag::__token => {
8523                            if !fields.insert(__FieldTag::__token) {
8524                                return std::result::Result::Err(A::Error::duplicate_field(
8525                                    "multiple values for token",
8526                                ));
8527                            }
8528                            result.token = map
8529                                .next_value::<std::option::Option<std::string::String>>()?
8530                                .unwrap_or_default();
8531                        }
8532                        __FieldTag::__expire_time => {
8533                            if !fields.insert(__FieldTag::__expire_time) {
8534                                return std::result::Result::Err(A::Error::duplicate_field(
8535                                    "multiple values for expire_time",
8536                                ));
8537                            }
8538                            result.expire_time =
8539                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
8540                        }
8541                        __FieldTag::__etag => {
8542                            if !fields.insert(__FieldTag::__etag) {
8543                                return std::result::Result::Err(A::Error::duplicate_field(
8544                                    "multiple values for etag",
8545                                ));
8546                            }
8547                            result.etag =
8548                                map.next_value::<std::option::Option<std::string::String>>()?;
8549                        }
8550                        __FieldTag::Unknown(key) => {
8551                            let value = map.next_value::<serde_json::Value>()?;
8552                            result._unknown_fields.insert(key, value);
8553                        }
8554                    }
8555                }
8556                std::result::Result::Ok(result)
8557            }
8558        }
8559        deserializer.deserialize_any(Visitor)
8560    }
8561}
8562
8563#[doc(hidden)]
8564impl serde::ser::Serialize for ServiceConnectionToken {
8565    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8566    where
8567        S: serde::ser::Serializer,
8568    {
8569        use serde::ser::SerializeMap;
8570        #[allow(unused_imports)]
8571        use std::option::Option::Some;
8572        let mut state = serializer.serialize_map(std::option::Option::None)?;
8573        if !self.name.is_empty() {
8574            state.serialize_entry("name", &self.name)?;
8575        }
8576        if self.create_time.is_some() {
8577            state.serialize_entry("createTime", &self.create_time)?;
8578        }
8579        if self.update_time.is_some() {
8580            state.serialize_entry("updateTime", &self.update_time)?;
8581        }
8582        if !self.labels.is_empty() {
8583            state.serialize_entry("labels", &self.labels)?;
8584        }
8585        if !self.description.is_empty() {
8586            state.serialize_entry("description", &self.description)?;
8587        }
8588        if !self.network.is_empty() {
8589            state.serialize_entry("network", &self.network)?;
8590        }
8591        if !self.token.is_empty() {
8592            state.serialize_entry("token", &self.token)?;
8593        }
8594        if self.expire_time.is_some() {
8595            state.serialize_entry("expireTime", &self.expire_time)?;
8596        }
8597        if self.etag.is_some() {
8598            state.serialize_entry("etag", &self.etag)?;
8599        }
8600        if !self._unknown_fields.is_empty() {
8601            for (key, value) in self._unknown_fields.iter() {
8602                state.serialize_entry(key, &value)?;
8603            }
8604        }
8605        state.end()
8606    }
8607}
8608
8609impl std::fmt::Debug for ServiceConnectionToken {
8610    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8611        let mut debug_struct = f.debug_struct("ServiceConnectionToken");
8612        debug_struct.field("name", &self.name);
8613        debug_struct.field("create_time", &self.create_time);
8614        debug_struct.field("update_time", &self.update_time);
8615        debug_struct.field("labels", &self.labels);
8616        debug_struct.field("description", &self.description);
8617        debug_struct.field("network", &self.network);
8618        debug_struct.field("token", &self.token);
8619        debug_struct.field("expire_time", &self.expire_time);
8620        debug_struct.field("etag", &self.etag);
8621        if !self._unknown_fields.is_empty() {
8622            debug_struct.field("_unknown_fields", &self._unknown_fields);
8623        }
8624        debug_struct.finish()
8625    }
8626}
8627
8628/// Request for ListServiceConnectionTokens.
8629#[derive(Clone, Default, PartialEq)]
8630#[non_exhaustive]
8631pub struct ListServiceConnectionTokensRequest {
8632    /// Required. The parent resource's name. ex. projects/123/locations/us-east1
8633    pub parent: std::string::String,
8634
8635    /// The maximum number of results per page that should be returned.
8636    pub page_size: i32,
8637
8638    /// The page token.
8639    pub page_token: std::string::String,
8640
8641    /// A filter expression that filters the results listed in the response.
8642    pub filter: std::string::String,
8643
8644    /// Sort the results by a certain order.
8645    pub order_by: std::string::String,
8646
8647    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8648}
8649
8650impl ListServiceConnectionTokensRequest {
8651    pub fn new() -> Self {
8652        std::default::Default::default()
8653    }
8654
8655    /// Sets the value of [parent][crate::model::ListServiceConnectionTokensRequest::parent].
8656    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8657        self.parent = v.into();
8658        self
8659    }
8660
8661    /// Sets the value of [page_size][crate::model::ListServiceConnectionTokensRequest::page_size].
8662    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8663        self.page_size = v.into();
8664        self
8665    }
8666
8667    /// Sets the value of [page_token][crate::model::ListServiceConnectionTokensRequest::page_token].
8668    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8669        self.page_token = v.into();
8670        self
8671    }
8672
8673    /// Sets the value of [filter][crate::model::ListServiceConnectionTokensRequest::filter].
8674    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8675        self.filter = v.into();
8676        self
8677    }
8678
8679    /// Sets the value of [order_by][crate::model::ListServiceConnectionTokensRequest::order_by].
8680    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8681        self.order_by = v.into();
8682        self
8683    }
8684}
8685
8686impl wkt::message::Message for ListServiceConnectionTokensRequest {
8687    fn typename() -> &'static str {
8688        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListServiceConnectionTokensRequest"
8689    }
8690}
8691
8692#[doc(hidden)]
8693impl<'de> serde::de::Deserialize<'de> for ListServiceConnectionTokensRequest {
8694    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8695    where
8696        D: serde::Deserializer<'de>,
8697    {
8698        #[allow(non_camel_case_types)]
8699        #[doc(hidden)]
8700        #[derive(PartialEq, Eq, Hash)]
8701        enum __FieldTag {
8702            __parent,
8703            __page_size,
8704            __page_token,
8705            __filter,
8706            __order_by,
8707            Unknown(std::string::String),
8708        }
8709        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8710            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8711            where
8712                D: serde::Deserializer<'de>,
8713            {
8714                struct Visitor;
8715                impl<'de> serde::de::Visitor<'de> for Visitor {
8716                    type Value = __FieldTag;
8717                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8718                        formatter.write_str("a field name for ListServiceConnectionTokensRequest")
8719                    }
8720                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8721                    where
8722                        E: serde::de::Error,
8723                    {
8724                        use std::result::Result::Ok;
8725                        use std::string::ToString;
8726                        match value {
8727                            "parent" => Ok(__FieldTag::__parent),
8728                            "pageSize" => Ok(__FieldTag::__page_size),
8729                            "page_size" => Ok(__FieldTag::__page_size),
8730                            "pageToken" => Ok(__FieldTag::__page_token),
8731                            "page_token" => Ok(__FieldTag::__page_token),
8732                            "filter" => Ok(__FieldTag::__filter),
8733                            "orderBy" => Ok(__FieldTag::__order_by),
8734                            "order_by" => Ok(__FieldTag::__order_by),
8735                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8736                        }
8737                    }
8738                }
8739                deserializer.deserialize_identifier(Visitor)
8740            }
8741        }
8742        struct Visitor;
8743        impl<'de> serde::de::Visitor<'de> for Visitor {
8744            type Value = ListServiceConnectionTokensRequest;
8745            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8746                formatter.write_str("struct ListServiceConnectionTokensRequest")
8747            }
8748            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8749            where
8750                A: serde::de::MapAccess<'de>,
8751            {
8752                #[allow(unused_imports)]
8753                use serde::de::Error;
8754                use std::option::Option::Some;
8755                let mut fields = std::collections::HashSet::new();
8756                let mut result = Self::Value::new();
8757                while let Some(tag) = map.next_key::<__FieldTag>()? {
8758                    #[allow(clippy::match_single_binding)]
8759                    match tag {
8760                        __FieldTag::__parent => {
8761                            if !fields.insert(__FieldTag::__parent) {
8762                                return std::result::Result::Err(A::Error::duplicate_field(
8763                                    "multiple values for parent",
8764                                ));
8765                            }
8766                            result.parent = map
8767                                .next_value::<std::option::Option<std::string::String>>()?
8768                                .unwrap_or_default();
8769                        }
8770                        __FieldTag::__page_size => {
8771                            if !fields.insert(__FieldTag::__page_size) {
8772                                return std::result::Result::Err(A::Error::duplicate_field(
8773                                    "multiple values for page_size",
8774                                ));
8775                            }
8776                            struct __With(std::option::Option<i32>);
8777                            impl<'de> serde::de::Deserialize<'de> for __With {
8778                                fn deserialize<D>(
8779                                    deserializer: D,
8780                                ) -> std::result::Result<Self, D::Error>
8781                                where
8782                                    D: serde::de::Deserializer<'de>,
8783                                {
8784                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
8785                                }
8786                            }
8787                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
8788                        }
8789                        __FieldTag::__page_token => {
8790                            if !fields.insert(__FieldTag::__page_token) {
8791                                return std::result::Result::Err(A::Error::duplicate_field(
8792                                    "multiple values for page_token",
8793                                ));
8794                            }
8795                            result.page_token = map
8796                                .next_value::<std::option::Option<std::string::String>>()?
8797                                .unwrap_or_default();
8798                        }
8799                        __FieldTag::__filter => {
8800                            if !fields.insert(__FieldTag::__filter) {
8801                                return std::result::Result::Err(A::Error::duplicate_field(
8802                                    "multiple values for filter",
8803                                ));
8804                            }
8805                            result.filter = map
8806                                .next_value::<std::option::Option<std::string::String>>()?
8807                                .unwrap_or_default();
8808                        }
8809                        __FieldTag::__order_by => {
8810                            if !fields.insert(__FieldTag::__order_by) {
8811                                return std::result::Result::Err(A::Error::duplicate_field(
8812                                    "multiple values for order_by",
8813                                ));
8814                            }
8815                            result.order_by = map
8816                                .next_value::<std::option::Option<std::string::String>>()?
8817                                .unwrap_or_default();
8818                        }
8819                        __FieldTag::Unknown(key) => {
8820                            let value = map.next_value::<serde_json::Value>()?;
8821                            result._unknown_fields.insert(key, value);
8822                        }
8823                    }
8824                }
8825                std::result::Result::Ok(result)
8826            }
8827        }
8828        deserializer.deserialize_any(Visitor)
8829    }
8830}
8831
8832#[doc(hidden)]
8833impl serde::ser::Serialize for ListServiceConnectionTokensRequest {
8834    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8835    where
8836        S: serde::ser::Serializer,
8837    {
8838        use serde::ser::SerializeMap;
8839        #[allow(unused_imports)]
8840        use std::option::Option::Some;
8841        let mut state = serializer.serialize_map(std::option::Option::None)?;
8842        if !self.parent.is_empty() {
8843            state.serialize_entry("parent", &self.parent)?;
8844        }
8845        if !wkt::internal::is_default(&self.page_size) {
8846            struct __With<'a>(&'a i32);
8847            impl<'a> serde::ser::Serialize for __With<'a> {
8848                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8849                where
8850                    S: serde::ser::Serializer,
8851                {
8852                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
8853                }
8854            }
8855            state.serialize_entry("pageSize", &__With(&self.page_size))?;
8856        }
8857        if !self.page_token.is_empty() {
8858            state.serialize_entry("pageToken", &self.page_token)?;
8859        }
8860        if !self.filter.is_empty() {
8861            state.serialize_entry("filter", &self.filter)?;
8862        }
8863        if !self.order_by.is_empty() {
8864            state.serialize_entry("orderBy", &self.order_by)?;
8865        }
8866        if !self._unknown_fields.is_empty() {
8867            for (key, value) in self._unknown_fields.iter() {
8868                state.serialize_entry(key, &value)?;
8869            }
8870        }
8871        state.end()
8872    }
8873}
8874
8875impl std::fmt::Debug for ListServiceConnectionTokensRequest {
8876    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8877        let mut debug_struct = f.debug_struct("ListServiceConnectionTokensRequest");
8878        debug_struct.field("parent", &self.parent);
8879        debug_struct.field("page_size", &self.page_size);
8880        debug_struct.field("page_token", &self.page_token);
8881        debug_struct.field("filter", &self.filter);
8882        debug_struct.field("order_by", &self.order_by);
8883        if !self._unknown_fields.is_empty() {
8884            debug_struct.field("_unknown_fields", &self._unknown_fields);
8885        }
8886        debug_struct.finish()
8887    }
8888}
8889
8890/// Response for ListServiceConnectionTokens.
8891#[derive(Clone, Default, PartialEq)]
8892#[non_exhaustive]
8893pub struct ListServiceConnectionTokensResponse {
8894    /// ServiceConnectionTokens to be returned.
8895    pub service_connection_tokens: std::vec::Vec<crate::model::ServiceConnectionToken>,
8896
8897    /// The next pagination token in the List response. It should be used as
8898    /// page_token for the following request. An empty value means no more result.
8899    pub next_page_token: std::string::String,
8900
8901    /// Locations that could not be reached.
8902    pub unreachable: std::vec::Vec<std::string::String>,
8903
8904    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8905}
8906
8907impl ListServiceConnectionTokensResponse {
8908    pub fn new() -> Self {
8909        std::default::Default::default()
8910    }
8911
8912    /// Sets the value of [service_connection_tokens][crate::model::ListServiceConnectionTokensResponse::service_connection_tokens].
8913    pub fn set_service_connection_tokens<T, V>(mut self, v: T) -> Self
8914    where
8915        T: std::iter::IntoIterator<Item = V>,
8916        V: std::convert::Into<crate::model::ServiceConnectionToken>,
8917    {
8918        use std::iter::Iterator;
8919        self.service_connection_tokens = v.into_iter().map(|i| i.into()).collect();
8920        self
8921    }
8922
8923    /// Sets the value of [next_page_token][crate::model::ListServiceConnectionTokensResponse::next_page_token].
8924    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8925        self.next_page_token = v.into();
8926        self
8927    }
8928
8929    /// Sets the value of [unreachable][crate::model::ListServiceConnectionTokensResponse::unreachable].
8930    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
8931    where
8932        T: std::iter::IntoIterator<Item = V>,
8933        V: std::convert::Into<std::string::String>,
8934    {
8935        use std::iter::Iterator;
8936        self.unreachable = v.into_iter().map(|i| i.into()).collect();
8937        self
8938    }
8939}
8940
8941impl wkt::message::Message for ListServiceConnectionTokensResponse {
8942    fn typename() -> &'static str {
8943        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListServiceConnectionTokensResponse"
8944    }
8945}
8946
8947#[doc(hidden)]
8948impl gax::paginator::internal::PageableResponse for ListServiceConnectionTokensResponse {
8949    type PageItem = crate::model::ServiceConnectionToken;
8950
8951    fn items(self) -> std::vec::Vec<Self::PageItem> {
8952        self.service_connection_tokens
8953    }
8954
8955    fn next_page_token(&self) -> std::string::String {
8956        use std::clone::Clone;
8957        self.next_page_token.clone()
8958    }
8959}
8960
8961#[doc(hidden)]
8962impl<'de> serde::de::Deserialize<'de> for ListServiceConnectionTokensResponse {
8963    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8964    where
8965        D: serde::Deserializer<'de>,
8966    {
8967        #[allow(non_camel_case_types)]
8968        #[doc(hidden)]
8969        #[derive(PartialEq, Eq, Hash)]
8970        enum __FieldTag {
8971            __service_connection_tokens,
8972            __next_page_token,
8973            __unreachable,
8974            Unknown(std::string::String),
8975        }
8976        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8977            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8978            where
8979                D: serde::Deserializer<'de>,
8980            {
8981                struct Visitor;
8982                impl<'de> serde::de::Visitor<'de> for Visitor {
8983                    type Value = __FieldTag;
8984                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8985                        formatter.write_str("a field name for ListServiceConnectionTokensResponse")
8986                    }
8987                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8988                    where
8989                        E: serde::de::Error,
8990                    {
8991                        use std::result::Result::Ok;
8992                        use std::string::ToString;
8993                        match value {
8994                            "serviceConnectionTokens" => {
8995                                Ok(__FieldTag::__service_connection_tokens)
8996                            }
8997                            "service_connection_tokens" => {
8998                                Ok(__FieldTag::__service_connection_tokens)
8999                            }
9000                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
9001                            "next_page_token" => Ok(__FieldTag::__next_page_token),
9002                            "unreachable" => Ok(__FieldTag::__unreachable),
9003                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9004                        }
9005                    }
9006                }
9007                deserializer.deserialize_identifier(Visitor)
9008            }
9009        }
9010        struct Visitor;
9011        impl<'de> serde::de::Visitor<'de> for Visitor {
9012            type Value = ListServiceConnectionTokensResponse;
9013            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9014                formatter.write_str("struct ListServiceConnectionTokensResponse")
9015            }
9016            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9017            where
9018                A: serde::de::MapAccess<'de>,
9019            {
9020                #[allow(unused_imports)]
9021                use serde::de::Error;
9022                use std::option::Option::Some;
9023                let mut fields = std::collections::HashSet::new();
9024                let mut result = Self::Value::new();
9025                while let Some(tag) = map.next_key::<__FieldTag>()? {
9026                    #[allow(clippy::match_single_binding)]
9027                    match tag {
9028                        __FieldTag::__service_connection_tokens => {
9029                            if !fields.insert(__FieldTag::__service_connection_tokens) {
9030                                return std::result::Result::Err(A::Error::duplicate_field(
9031                                    "multiple values for service_connection_tokens",
9032                                ));
9033                            }
9034                            result.service_connection_tokens = map
9035                                .next_value::<std::option::Option<
9036                                    std::vec::Vec<crate::model::ServiceConnectionToken>,
9037                                >>()?
9038                                .unwrap_or_default();
9039                        }
9040                        __FieldTag::__next_page_token => {
9041                            if !fields.insert(__FieldTag::__next_page_token) {
9042                                return std::result::Result::Err(A::Error::duplicate_field(
9043                                    "multiple values for next_page_token",
9044                                ));
9045                            }
9046                            result.next_page_token = map
9047                                .next_value::<std::option::Option<std::string::String>>()?
9048                                .unwrap_or_default();
9049                        }
9050                        __FieldTag::__unreachable => {
9051                            if !fields.insert(__FieldTag::__unreachable) {
9052                                return std::result::Result::Err(A::Error::duplicate_field(
9053                                    "multiple values for unreachable",
9054                                ));
9055                            }
9056                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
9057                        }
9058                        __FieldTag::Unknown(key) => {
9059                            let value = map.next_value::<serde_json::Value>()?;
9060                            result._unknown_fields.insert(key, value);
9061                        }
9062                    }
9063                }
9064                std::result::Result::Ok(result)
9065            }
9066        }
9067        deserializer.deserialize_any(Visitor)
9068    }
9069}
9070
9071#[doc(hidden)]
9072impl serde::ser::Serialize for ListServiceConnectionTokensResponse {
9073    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9074    where
9075        S: serde::ser::Serializer,
9076    {
9077        use serde::ser::SerializeMap;
9078        #[allow(unused_imports)]
9079        use std::option::Option::Some;
9080        let mut state = serializer.serialize_map(std::option::Option::None)?;
9081        if !self.service_connection_tokens.is_empty() {
9082            state.serialize_entry("serviceConnectionTokens", &self.service_connection_tokens)?;
9083        }
9084        if !self.next_page_token.is_empty() {
9085            state.serialize_entry("nextPageToken", &self.next_page_token)?;
9086        }
9087        if !self.unreachable.is_empty() {
9088            state.serialize_entry("unreachable", &self.unreachable)?;
9089        }
9090        if !self._unknown_fields.is_empty() {
9091            for (key, value) in self._unknown_fields.iter() {
9092                state.serialize_entry(key, &value)?;
9093            }
9094        }
9095        state.end()
9096    }
9097}
9098
9099impl std::fmt::Debug for ListServiceConnectionTokensResponse {
9100    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9101        let mut debug_struct = f.debug_struct("ListServiceConnectionTokensResponse");
9102        debug_struct.field("service_connection_tokens", &self.service_connection_tokens);
9103        debug_struct.field("next_page_token", &self.next_page_token);
9104        debug_struct.field("unreachable", &self.unreachable);
9105        if !self._unknown_fields.is_empty() {
9106            debug_struct.field("_unknown_fields", &self._unknown_fields);
9107        }
9108        debug_struct.finish()
9109    }
9110}
9111
9112/// Request for GetServiceConnectionToken.
9113#[derive(Clone, Default, PartialEq)]
9114#[non_exhaustive]
9115pub struct GetServiceConnectionTokenRequest {
9116    /// Required. Name of the ServiceConnectionToken to get.
9117    pub name: std::string::String,
9118
9119    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9120}
9121
9122impl GetServiceConnectionTokenRequest {
9123    pub fn new() -> Self {
9124        std::default::Default::default()
9125    }
9126
9127    /// Sets the value of [name][crate::model::GetServiceConnectionTokenRequest::name].
9128    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9129        self.name = v.into();
9130        self
9131    }
9132}
9133
9134impl wkt::message::Message for GetServiceConnectionTokenRequest {
9135    fn typename() -> &'static str {
9136        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetServiceConnectionTokenRequest"
9137    }
9138}
9139
9140#[doc(hidden)]
9141impl<'de> serde::de::Deserialize<'de> for GetServiceConnectionTokenRequest {
9142    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9143    where
9144        D: serde::Deserializer<'de>,
9145    {
9146        #[allow(non_camel_case_types)]
9147        #[doc(hidden)]
9148        #[derive(PartialEq, Eq, Hash)]
9149        enum __FieldTag {
9150            __name,
9151            Unknown(std::string::String),
9152        }
9153        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9154            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9155            where
9156                D: serde::Deserializer<'de>,
9157            {
9158                struct Visitor;
9159                impl<'de> serde::de::Visitor<'de> for Visitor {
9160                    type Value = __FieldTag;
9161                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9162                        formatter.write_str("a field name for GetServiceConnectionTokenRequest")
9163                    }
9164                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9165                    where
9166                        E: serde::de::Error,
9167                    {
9168                        use std::result::Result::Ok;
9169                        use std::string::ToString;
9170                        match value {
9171                            "name" => Ok(__FieldTag::__name),
9172                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9173                        }
9174                    }
9175                }
9176                deserializer.deserialize_identifier(Visitor)
9177            }
9178        }
9179        struct Visitor;
9180        impl<'de> serde::de::Visitor<'de> for Visitor {
9181            type Value = GetServiceConnectionTokenRequest;
9182            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9183                formatter.write_str("struct GetServiceConnectionTokenRequest")
9184            }
9185            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9186            where
9187                A: serde::de::MapAccess<'de>,
9188            {
9189                #[allow(unused_imports)]
9190                use serde::de::Error;
9191                use std::option::Option::Some;
9192                let mut fields = std::collections::HashSet::new();
9193                let mut result = Self::Value::new();
9194                while let Some(tag) = map.next_key::<__FieldTag>()? {
9195                    #[allow(clippy::match_single_binding)]
9196                    match tag {
9197                        __FieldTag::__name => {
9198                            if !fields.insert(__FieldTag::__name) {
9199                                return std::result::Result::Err(A::Error::duplicate_field(
9200                                    "multiple values for name",
9201                                ));
9202                            }
9203                            result.name = map
9204                                .next_value::<std::option::Option<std::string::String>>()?
9205                                .unwrap_or_default();
9206                        }
9207                        __FieldTag::Unknown(key) => {
9208                            let value = map.next_value::<serde_json::Value>()?;
9209                            result._unknown_fields.insert(key, value);
9210                        }
9211                    }
9212                }
9213                std::result::Result::Ok(result)
9214            }
9215        }
9216        deserializer.deserialize_any(Visitor)
9217    }
9218}
9219
9220#[doc(hidden)]
9221impl serde::ser::Serialize for GetServiceConnectionTokenRequest {
9222    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9223    where
9224        S: serde::ser::Serializer,
9225    {
9226        use serde::ser::SerializeMap;
9227        #[allow(unused_imports)]
9228        use std::option::Option::Some;
9229        let mut state = serializer.serialize_map(std::option::Option::None)?;
9230        if !self.name.is_empty() {
9231            state.serialize_entry("name", &self.name)?;
9232        }
9233        if !self._unknown_fields.is_empty() {
9234            for (key, value) in self._unknown_fields.iter() {
9235                state.serialize_entry(key, &value)?;
9236            }
9237        }
9238        state.end()
9239    }
9240}
9241
9242impl std::fmt::Debug for GetServiceConnectionTokenRequest {
9243    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9244        let mut debug_struct = f.debug_struct("GetServiceConnectionTokenRequest");
9245        debug_struct.field("name", &self.name);
9246        if !self._unknown_fields.is_empty() {
9247            debug_struct.field("_unknown_fields", &self._unknown_fields);
9248        }
9249        debug_struct.finish()
9250    }
9251}
9252
9253/// Request for CreateServiceConnectionToken.
9254#[derive(Clone, Default, PartialEq)]
9255#[non_exhaustive]
9256pub struct CreateServiceConnectionTokenRequest {
9257    /// Required. The parent resource's name of the ServiceConnectionToken. ex.
9258    /// projects/123/locations/us-east1
9259    pub parent: std::string::String,
9260
9261    /// Optional. Resource ID
9262    /// (i.e. 'foo' in '[...]/projects/p/locations/l/ServiceConnectionTokens/foo')
9263    /// See <https://google.aip.dev/122#resource-id-segments>
9264    /// Unique per location.
9265    /// If one is not provided, one will be generated.
9266    pub service_connection_token_id: std::string::String,
9267
9268    /// Required. Initial values for a new ServiceConnectionTokens
9269    pub service_connection_token: std::option::Option<crate::model::ServiceConnectionToken>,
9270
9271    /// Optional. An optional request ID to identify requests. Specify a unique
9272    /// request ID so that if you must retry your request, the server will know to
9273    /// ignore the request if it has already been completed. The server will
9274    /// guarantee that for at least 60 minutes since the first request.
9275    ///
9276    /// For example, consider a situation where you make an initial request and
9277    /// the request times out. If you make the request again with the same request
9278    /// ID, the server can check if original operation with the same request ID
9279    /// was received, and if so, will ignore the second request. This prevents
9280    /// clients from accidentally creating duplicate commitments.
9281    ///
9282    /// The request ID must be a valid UUID with the exception that zero UUID is
9283    /// not supported (00000000-0000-0000-0000-000000000000).
9284    pub request_id: std::string::String,
9285
9286    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9287}
9288
9289impl CreateServiceConnectionTokenRequest {
9290    pub fn new() -> Self {
9291        std::default::Default::default()
9292    }
9293
9294    /// Sets the value of [parent][crate::model::CreateServiceConnectionTokenRequest::parent].
9295    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9296        self.parent = v.into();
9297        self
9298    }
9299
9300    /// Sets the value of [service_connection_token_id][crate::model::CreateServiceConnectionTokenRequest::service_connection_token_id].
9301    pub fn set_service_connection_token_id<T: std::convert::Into<std::string::String>>(
9302        mut self,
9303        v: T,
9304    ) -> Self {
9305        self.service_connection_token_id = v.into();
9306        self
9307    }
9308
9309    /// Sets the value of [service_connection_token][crate::model::CreateServiceConnectionTokenRequest::service_connection_token].
9310    pub fn set_service_connection_token<T>(mut self, v: T) -> Self
9311    where
9312        T: std::convert::Into<crate::model::ServiceConnectionToken>,
9313    {
9314        self.service_connection_token = std::option::Option::Some(v.into());
9315        self
9316    }
9317
9318    /// Sets or clears the value of [service_connection_token][crate::model::CreateServiceConnectionTokenRequest::service_connection_token].
9319    pub fn set_or_clear_service_connection_token<T>(mut self, v: std::option::Option<T>) -> Self
9320    where
9321        T: std::convert::Into<crate::model::ServiceConnectionToken>,
9322    {
9323        self.service_connection_token = v.map(|x| x.into());
9324        self
9325    }
9326
9327    /// Sets the value of [request_id][crate::model::CreateServiceConnectionTokenRequest::request_id].
9328    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9329        self.request_id = v.into();
9330        self
9331    }
9332}
9333
9334impl wkt::message::Message for CreateServiceConnectionTokenRequest {
9335    fn typename() -> &'static str {
9336        "type.googleapis.com/google.cloud.networkconnectivity.v1.CreateServiceConnectionTokenRequest"
9337    }
9338}
9339
9340#[doc(hidden)]
9341impl<'de> serde::de::Deserialize<'de> for CreateServiceConnectionTokenRequest {
9342    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9343    where
9344        D: serde::Deserializer<'de>,
9345    {
9346        #[allow(non_camel_case_types)]
9347        #[doc(hidden)]
9348        #[derive(PartialEq, Eq, Hash)]
9349        enum __FieldTag {
9350            __parent,
9351            __service_connection_token_id,
9352            __service_connection_token,
9353            __request_id,
9354            Unknown(std::string::String),
9355        }
9356        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9357            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9358            where
9359                D: serde::Deserializer<'de>,
9360            {
9361                struct Visitor;
9362                impl<'de> serde::de::Visitor<'de> for Visitor {
9363                    type Value = __FieldTag;
9364                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9365                        formatter.write_str("a field name for CreateServiceConnectionTokenRequest")
9366                    }
9367                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9368                    where
9369                        E: serde::de::Error,
9370                    {
9371                        use std::result::Result::Ok;
9372                        use std::string::ToString;
9373                        match value {
9374                            "parent" => Ok(__FieldTag::__parent),
9375                            "serviceConnectionTokenId" => {
9376                                Ok(__FieldTag::__service_connection_token_id)
9377                            }
9378                            "service_connection_token_id" => {
9379                                Ok(__FieldTag::__service_connection_token_id)
9380                            }
9381                            "serviceConnectionToken" => Ok(__FieldTag::__service_connection_token),
9382                            "service_connection_token" => {
9383                                Ok(__FieldTag::__service_connection_token)
9384                            }
9385                            "requestId" => Ok(__FieldTag::__request_id),
9386                            "request_id" => Ok(__FieldTag::__request_id),
9387                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9388                        }
9389                    }
9390                }
9391                deserializer.deserialize_identifier(Visitor)
9392            }
9393        }
9394        struct Visitor;
9395        impl<'de> serde::de::Visitor<'de> for Visitor {
9396            type Value = CreateServiceConnectionTokenRequest;
9397            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9398                formatter.write_str("struct CreateServiceConnectionTokenRequest")
9399            }
9400            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9401            where
9402                A: serde::de::MapAccess<'de>,
9403            {
9404                #[allow(unused_imports)]
9405                use serde::de::Error;
9406                use std::option::Option::Some;
9407                let mut fields = std::collections::HashSet::new();
9408                let mut result = Self::Value::new();
9409                while let Some(tag) = map.next_key::<__FieldTag>()? {
9410                    #[allow(clippy::match_single_binding)]
9411                    match tag {
9412                        __FieldTag::__parent => {
9413                            if !fields.insert(__FieldTag::__parent) {
9414                                return std::result::Result::Err(A::Error::duplicate_field(
9415                                    "multiple values for parent",
9416                                ));
9417                            }
9418                            result.parent = map
9419                                .next_value::<std::option::Option<std::string::String>>()?
9420                                .unwrap_or_default();
9421                        }
9422                        __FieldTag::__service_connection_token_id => {
9423                            if !fields.insert(__FieldTag::__service_connection_token_id) {
9424                                return std::result::Result::Err(A::Error::duplicate_field(
9425                                    "multiple values for service_connection_token_id",
9426                                ));
9427                            }
9428                            result.service_connection_token_id = map
9429                                .next_value::<std::option::Option<std::string::String>>()?
9430                                .unwrap_or_default();
9431                        }
9432                        __FieldTag::__service_connection_token => {
9433                            if !fields.insert(__FieldTag::__service_connection_token) {
9434                                return std::result::Result::Err(A::Error::duplicate_field(
9435                                    "multiple values for service_connection_token",
9436                                ));
9437                            }
9438                            result.service_connection_token = map.next_value::<std::option::Option<crate::model::ServiceConnectionToken>>()?
9439                                ;
9440                        }
9441                        __FieldTag::__request_id => {
9442                            if !fields.insert(__FieldTag::__request_id) {
9443                                return std::result::Result::Err(A::Error::duplicate_field(
9444                                    "multiple values for request_id",
9445                                ));
9446                            }
9447                            result.request_id = map
9448                                .next_value::<std::option::Option<std::string::String>>()?
9449                                .unwrap_or_default();
9450                        }
9451                        __FieldTag::Unknown(key) => {
9452                            let value = map.next_value::<serde_json::Value>()?;
9453                            result._unknown_fields.insert(key, value);
9454                        }
9455                    }
9456                }
9457                std::result::Result::Ok(result)
9458            }
9459        }
9460        deserializer.deserialize_any(Visitor)
9461    }
9462}
9463
9464#[doc(hidden)]
9465impl serde::ser::Serialize for CreateServiceConnectionTokenRequest {
9466    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9467    where
9468        S: serde::ser::Serializer,
9469    {
9470        use serde::ser::SerializeMap;
9471        #[allow(unused_imports)]
9472        use std::option::Option::Some;
9473        let mut state = serializer.serialize_map(std::option::Option::None)?;
9474        if !self.parent.is_empty() {
9475            state.serialize_entry("parent", &self.parent)?;
9476        }
9477        if !self.service_connection_token_id.is_empty() {
9478            state.serialize_entry(
9479                "serviceConnectionTokenId",
9480                &self.service_connection_token_id,
9481            )?;
9482        }
9483        if self.service_connection_token.is_some() {
9484            state.serialize_entry("serviceConnectionToken", &self.service_connection_token)?;
9485        }
9486        if !self.request_id.is_empty() {
9487            state.serialize_entry("requestId", &self.request_id)?;
9488        }
9489        if !self._unknown_fields.is_empty() {
9490            for (key, value) in self._unknown_fields.iter() {
9491                state.serialize_entry(key, &value)?;
9492            }
9493        }
9494        state.end()
9495    }
9496}
9497
9498impl std::fmt::Debug for CreateServiceConnectionTokenRequest {
9499    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9500        let mut debug_struct = f.debug_struct("CreateServiceConnectionTokenRequest");
9501        debug_struct.field("parent", &self.parent);
9502        debug_struct.field(
9503            "service_connection_token_id",
9504            &self.service_connection_token_id,
9505        );
9506        debug_struct.field("service_connection_token", &self.service_connection_token);
9507        debug_struct.field("request_id", &self.request_id);
9508        if !self._unknown_fields.is_empty() {
9509            debug_struct.field("_unknown_fields", &self._unknown_fields);
9510        }
9511        debug_struct.finish()
9512    }
9513}
9514
9515/// Request for DeleteServiceConnectionToken.
9516#[derive(Clone, Default, PartialEq)]
9517#[non_exhaustive]
9518pub struct DeleteServiceConnectionTokenRequest {
9519    /// Required. The name of the ServiceConnectionToken to delete.
9520    pub name: std::string::String,
9521
9522    /// Optional. An optional request ID to identify requests. Specify a unique
9523    /// request ID so that if you must retry your request, the server will know to
9524    /// ignore the request if it has already been completed. The server will
9525    /// guarantee that for at least 60 minutes after the first request.
9526    ///
9527    /// For example, consider a situation where you make an initial request and
9528    /// the request times out. If you make the request again with the same request
9529    /// ID, the server can check if original operation with the same request ID
9530    /// was received, and if so, will ignore the second request. This prevents
9531    /// clients from accidentally creating duplicate commitments.
9532    ///
9533    /// The request ID must be a valid UUID with the exception that zero UUID is
9534    /// not supported (00000000-0000-0000-0000-000000000000).
9535    pub request_id: std::string::String,
9536
9537    /// Optional. The etag is computed by the server, and may be sent on update and
9538    /// delete requests to ensure the client has an up-to-date value before
9539    /// proceeding.
9540    pub etag: std::option::Option<std::string::String>,
9541
9542    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9543}
9544
9545impl DeleteServiceConnectionTokenRequest {
9546    pub fn new() -> Self {
9547        std::default::Default::default()
9548    }
9549
9550    /// Sets the value of [name][crate::model::DeleteServiceConnectionTokenRequest::name].
9551    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9552        self.name = v.into();
9553        self
9554    }
9555
9556    /// Sets the value of [request_id][crate::model::DeleteServiceConnectionTokenRequest::request_id].
9557    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9558        self.request_id = v.into();
9559        self
9560    }
9561
9562    /// Sets the value of [etag][crate::model::DeleteServiceConnectionTokenRequest::etag].
9563    pub fn set_etag<T>(mut self, v: T) -> Self
9564    where
9565        T: std::convert::Into<std::string::String>,
9566    {
9567        self.etag = std::option::Option::Some(v.into());
9568        self
9569    }
9570
9571    /// Sets or clears the value of [etag][crate::model::DeleteServiceConnectionTokenRequest::etag].
9572    pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
9573    where
9574        T: std::convert::Into<std::string::String>,
9575    {
9576        self.etag = v.map(|x| x.into());
9577        self
9578    }
9579}
9580
9581impl wkt::message::Message for DeleteServiceConnectionTokenRequest {
9582    fn typename() -> &'static str {
9583        "type.googleapis.com/google.cloud.networkconnectivity.v1.DeleteServiceConnectionTokenRequest"
9584    }
9585}
9586
9587#[doc(hidden)]
9588impl<'de> serde::de::Deserialize<'de> for DeleteServiceConnectionTokenRequest {
9589    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9590    where
9591        D: serde::Deserializer<'de>,
9592    {
9593        #[allow(non_camel_case_types)]
9594        #[doc(hidden)]
9595        #[derive(PartialEq, Eq, Hash)]
9596        enum __FieldTag {
9597            __name,
9598            __request_id,
9599            __etag,
9600            Unknown(std::string::String),
9601        }
9602        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9603            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9604            where
9605                D: serde::Deserializer<'de>,
9606            {
9607                struct Visitor;
9608                impl<'de> serde::de::Visitor<'de> for Visitor {
9609                    type Value = __FieldTag;
9610                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9611                        formatter.write_str("a field name for DeleteServiceConnectionTokenRequest")
9612                    }
9613                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9614                    where
9615                        E: serde::de::Error,
9616                    {
9617                        use std::result::Result::Ok;
9618                        use std::string::ToString;
9619                        match value {
9620                            "name" => Ok(__FieldTag::__name),
9621                            "requestId" => Ok(__FieldTag::__request_id),
9622                            "request_id" => Ok(__FieldTag::__request_id),
9623                            "etag" => Ok(__FieldTag::__etag),
9624                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9625                        }
9626                    }
9627                }
9628                deserializer.deserialize_identifier(Visitor)
9629            }
9630        }
9631        struct Visitor;
9632        impl<'de> serde::de::Visitor<'de> for Visitor {
9633            type Value = DeleteServiceConnectionTokenRequest;
9634            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9635                formatter.write_str("struct DeleteServiceConnectionTokenRequest")
9636            }
9637            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9638            where
9639                A: serde::de::MapAccess<'de>,
9640            {
9641                #[allow(unused_imports)]
9642                use serde::de::Error;
9643                use std::option::Option::Some;
9644                let mut fields = std::collections::HashSet::new();
9645                let mut result = Self::Value::new();
9646                while let Some(tag) = map.next_key::<__FieldTag>()? {
9647                    #[allow(clippy::match_single_binding)]
9648                    match tag {
9649                        __FieldTag::__name => {
9650                            if !fields.insert(__FieldTag::__name) {
9651                                return std::result::Result::Err(A::Error::duplicate_field(
9652                                    "multiple values for name",
9653                                ));
9654                            }
9655                            result.name = map
9656                                .next_value::<std::option::Option<std::string::String>>()?
9657                                .unwrap_or_default();
9658                        }
9659                        __FieldTag::__request_id => {
9660                            if !fields.insert(__FieldTag::__request_id) {
9661                                return std::result::Result::Err(A::Error::duplicate_field(
9662                                    "multiple values for request_id",
9663                                ));
9664                            }
9665                            result.request_id = map
9666                                .next_value::<std::option::Option<std::string::String>>()?
9667                                .unwrap_or_default();
9668                        }
9669                        __FieldTag::__etag => {
9670                            if !fields.insert(__FieldTag::__etag) {
9671                                return std::result::Result::Err(A::Error::duplicate_field(
9672                                    "multiple values for etag",
9673                                ));
9674                            }
9675                            result.etag =
9676                                map.next_value::<std::option::Option<std::string::String>>()?;
9677                        }
9678                        __FieldTag::Unknown(key) => {
9679                            let value = map.next_value::<serde_json::Value>()?;
9680                            result._unknown_fields.insert(key, value);
9681                        }
9682                    }
9683                }
9684                std::result::Result::Ok(result)
9685            }
9686        }
9687        deserializer.deserialize_any(Visitor)
9688    }
9689}
9690
9691#[doc(hidden)]
9692impl serde::ser::Serialize for DeleteServiceConnectionTokenRequest {
9693    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9694    where
9695        S: serde::ser::Serializer,
9696    {
9697        use serde::ser::SerializeMap;
9698        #[allow(unused_imports)]
9699        use std::option::Option::Some;
9700        let mut state = serializer.serialize_map(std::option::Option::None)?;
9701        if !self.name.is_empty() {
9702            state.serialize_entry("name", &self.name)?;
9703        }
9704        if !self.request_id.is_empty() {
9705            state.serialize_entry("requestId", &self.request_id)?;
9706        }
9707        if self.etag.is_some() {
9708            state.serialize_entry("etag", &self.etag)?;
9709        }
9710        if !self._unknown_fields.is_empty() {
9711            for (key, value) in self._unknown_fields.iter() {
9712                state.serialize_entry(key, &value)?;
9713            }
9714        }
9715        state.end()
9716    }
9717}
9718
9719impl std::fmt::Debug for DeleteServiceConnectionTokenRequest {
9720    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9721        let mut debug_struct = f.debug_struct("DeleteServiceConnectionTokenRequest");
9722        debug_struct.field("name", &self.name);
9723        debug_struct.field("request_id", &self.request_id);
9724        debug_struct.field("etag", &self.etag);
9725        if !self._unknown_fields.is_empty() {
9726            debug_struct.field("_unknown_fields", &self._unknown_fields);
9727        }
9728        debug_struct.finish()
9729    }
9730}
9731
9732/// A Network Connectivity Center hub is a global management resource to which
9733/// you attach spokes. A single hub can contain spokes from multiple regions.
9734/// However, if any of a hub's spokes use the site-to-site data transfer feature,
9735/// the resources associated with those spokes must all be in the same VPC
9736/// network. Spokes that do not use site-to-site data transfer can be associated
9737/// with any VPC network in your project.
9738#[derive(Clone, Default, PartialEq)]
9739#[non_exhaustive]
9740pub struct Hub {
9741    /// Immutable. The name of the hub. Hub names must be unique. They use the
9742    /// following form:
9743    /// `projects/{project_number}/locations/global/hubs/{hub_id}`
9744    pub name: std::string::String,
9745
9746    /// Output only. The time the hub was created.
9747    pub create_time: std::option::Option<wkt::Timestamp>,
9748
9749    /// Output only. The time the hub was last updated.
9750    pub update_time: std::option::Option<wkt::Timestamp>,
9751
9752    /// Optional labels in key-value pair format. For more information about
9753    /// labels, see [Requirements for
9754    /// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements).
9755    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
9756
9757    /// Optional. An optional description of the hub.
9758    pub description: std::string::String,
9759
9760    /// Output only. The Google-generated UUID for the hub. This value is unique
9761    /// across all hub resources. If a hub is deleted and another with the same
9762    /// name is created, the new hub is assigned a different unique_id.
9763    pub unique_id: std::string::String,
9764
9765    /// Output only. The current lifecycle state of this hub.
9766    pub state: crate::model::State,
9767
9768    /// The VPC networks associated with this hub's spokes.
9769    ///
9770    /// This field is read-only. Network Connectivity Center automatically
9771    /// populates it based on the set of spokes attached to the hub.
9772    pub routing_vpcs: std::vec::Vec<crate::model::RoutingVPC>,
9773
9774    /// Output only. The route tables that belong to this hub. They use the
9775    /// following form:
9776    /// `projects/{project_number}/locations/global/hubs/{hub_id}/routeTables/{route_table_id}`
9777    ///
9778    /// This field is read-only. Network Connectivity Center automatically
9779    /// populates it based on the route tables nested under the hub.
9780    pub route_tables: std::vec::Vec<std::string::String>,
9781
9782    /// Output only. A summary of the spokes associated with a hub. The
9783    /// summary includes a count of spokes according to type
9784    /// and according to state. If any spokes are inactive,
9785    /// the summary also lists the reasons they are inactive,
9786    /// including a count for each reason.
9787    pub spoke_summary: std::option::Option<crate::model::SpokeSummary>,
9788
9789    /// Optional. The policy mode of this hub. This field can be either
9790    /// PRESET or CUSTOM. If unspecified, the
9791    /// policy_mode defaults to PRESET.
9792    pub policy_mode: crate::model::PolicyMode,
9793
9794    /// Optional. The topology implemented in this hub. Currently, this field is
9795    /// only used when policy_mode = PRESET. The available preset topologies are
9796    /// MESH and STAR. If preset_topology is unspecified and policy_mode = PRESET,
9797    /// the preset_topology defaults to MESH. When policy_mode = CUSTOM,
9798    /// the preset_topology is set to PRESET_TOPOLOGY_UNSPECIFIED.
9799    pub preset_topology: crate::model::PresetTopology,
9800
9801    /// Optional. Whether Private Service Connect connection propagation is enabled
9802    /// for the hub. If true, Private Service Connect endpoints in VPC spokes
9803    /// attached to the hub are made accessible to other VPC spokes attached to the
9804    /// hub. The default value is false.
9805    pub export_psc: std::option::Option<bool>,
9806
9807    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9808}
9809
9810impl Hub {
9811    pub fn new() -> Self {
9812        std::default::Default::default()
9813    }
9814
9815    /// Sets the value of [name][crate::model::Hub::name].
9816    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9817        self.name = v.into();
9818        self
9819    }
9820
9821    /// Sets the value of [create_time][crate::model::Hub::create_time].
9822    pub fn set_create_time<T>(mut self, v: T) -> Self
9823    where
9824        T: std::convert::Into<wkt::Timestamp>,
9825    {
9826        self.create_time = std::option::Option::Some(v.into());
9827        self
9828    }
9829
9830    /// Sets or clears the value of [create_time][crate::model::Hub::create_time].
9831    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9832    where
9833        T: std::convert::Into<wkt::Timestamp>,
9834    {
9835        self.create_time = v.map(|x| x.into());
9836        self
9837    }
9838
9839    /// Sets the value of [update_time][crate::model::Hub::update_time].
9840    pub fn set_update_time<T>(mut self, v: T) -> Self
9841    where
9842        T: std::convert::Into<wkt::Timestamp>,
9843    {
9844        self.update_time = std::option::Option::Some(v.into());
9845        self
9846    }
9847
9848    /// Sets or clears the value of [update_time][crate::model::Hub::update_time].
9849    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
9850    where
9851        T: std::convert::Into<wkt::Timestamp>,
9852    {
9853        self.update_time = v.map(|x| x.into());
9854        self
9855    }
9856
9857    /// Sets the value of [labels][crate::model::Hub::labels].
9858    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
9859    where
9860        T: std::iter::IntoIterator<Item = (K, V)>,
9861        K: std::convert::Into<std::string::String>,
9862        V: std::convert::Into<std::string::String>,
9863    {
9864        use std::iter::Iterator;
9865        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9866        self
9867    }
9868
9869    /// Sets the value of [description][crate::model::Hub::description].
9870    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9871        self.description = v.into();
9872        self
9873    }
9874
9875    /// Sets the value of [unique_id][crate::model::Hub::unique_id].
9876    pub fn set_unique_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9877        self.unique_id = v.into();
9878        self
9879    }
9880
9881    /// Sets the value of [state][crate::model::Hub::state].
9882    pub fn set_state<T: std::convert::Into<crate::model::State>>(mut self, v: T) -> Self {
9883        self.state = v.into();
9884        self
9885    }
9886
9887    /// Sets the value of [routing_vpcs][crate::model::Hub::routing_vpcs].
9888    pub fn set_routing_vpcs<T, V>(mut self, v: T) -> Self
9889    where
9890        T: std::iter::IntoIterator<Item = V>,
9891        V: std::convert::Into<crate::model::RoutingVPC>,
9892    {
9893        use std::iter::Iterator;
9894        self.routing_vpcs = v.into_iter().map(|i| i.into()).collect();
9895        self
9896    }
9897
9898    /// Sets the value of [route_tables][crate::model::Hub::route_tables].
9899    pub fn set_route_tables<T, V>(mut self, v: T) -> Self
9900    where
9901        T: std::iter::IntoIterator<Item = V>,
9902        V: std::convert::Into<std::string::String>,
9903    {
9904        use std::iter::Iterator;
9905        self.route_tables = v.into_iter().map(|i| i.into()).collect();
9906        self
9907    }
9908
9909    /// Sets the value of [spoke_summary][crate::model::Hub::spoke_summary].
9910    pub fn set_spoke_summary<T>(mut self, v: T) -> Self
9911    where
9912        T: std::convert::Into<crate::model::SpokeSummary>,
9913    {
9914        self.spoke_summary = std::option::Option::Some(v.into());
9915        self
9916    }
9917
9918    /// Sets or clears the value of [spoke_summary][crate::model::Hub::spoke_summary].
9919    pub fn set_or_clear_spoke_summary<T>(mut self, v: std::option::Option<T>) -> Self
9920    where
9921        T: std::convert::Into<crate::model::SpokeSummary>,
9922    {
9923        self.spoke_summary = v.map(|x| x.into());
9924        self
9925    }
9926
9927    /// Sets the value of [policy_mode][crate::model::Hub::policy_mode].
9928    pub fn set_policy_mode<T: std::convert::Into<crate::model::PolicyMode>>(
9929        mut self,
9930        v: T,
9931    ) -> Self {
9932        self.policy_mode = v.into();
9933        self
9934    }
9935
9936    /// Sets the value of [preset_topology][crate::model::Hub::preset_topology].
9937    pub fn set_preset_topology<T: std::convert::Into<crate::model::PresetTopology>>(
9938        mut self,
9939        v: T,
9940    ) -> Self {
9941        self.preset_topology = v.into();
9942        self
9943    }
9944
9945    /// Sets the value of [export_psc][crate::model::Hub::export_psc].
9946    pub fn set_export_psc<T>(mut self, v: T) -> Self
9947    where
9948        T: std::convert::Into<bool>,
9949    {
9950        self.export_psc = std::option::Option::Some(v.into());
9951        self
9952    }
9953
9954    /// Sets or clears the value of [export_psc][crate::model::Hub::export_psc].
9955    pub fn set_or_clear_export_psc<T>(mut self, v: std::option::Option<T>) -> Self
9956    where
9957        T: std::convert::Into<bool>,
9958    {
9959        self.export_psc = v.map(|x| x.into());
9960        self
9961    }
9962}
9963
9964impl wkt::message::Message for Hub {
9965    fn typename() -> &'static str {
9966        "type.googleapis.com/google.cloud.networkconnectivity.v1.Hub"
9967    }
9968}
9969
9970#[doc(hidden)]
9971impl<'de> serde::de::Deserialize<'de> for Hub {
9972    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9973    where
9974        D: serde::Deserializer<'de>,
9975    {
9976        #[allow(non_camel_case_types)]
9977        #[doc(hidden)]
9978        #[derive(PartialEq, Eq, Hash)]
9979        enum __FieldTag {
9980            __name,
9981            __create_time,
9982            __update_time,
9983            __labels,
9984            __description,
9985            __unique_id,
9986            __state,
9987            __routing_vpcs,
9988            __route_tables,
9989            __spoke_summary,
9990            __policy_mode,
9991            __preset_topology,
9992            __export_psc,
9993            Unknown(std::string::String),
9994        }
9995        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9996            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9997            where
9998                D: serde::Deserializer<'de>,
9999            {
10000                struct Visitor;
10001                impl<'de> serde::de::Visitor<'de> for Visitor {
10002                    type Value = __FieldTag;
10003                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10004                        formatter.write_str("a field name for Hub")
10005                    }
10006                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10007                    where
10008                        E: serde::de::Error,
10009                    {
10010                        use std::result::Result::Ok;
10011                        use std::string::ToString;
10012                        match value {
10013                            "name" => Ok(__FieldTag::__name),
10014                            "createTime" => Ok(__FieldTag::__create_time),
10015                            "create_time" => Ok(__FieldTag::__create_time),
10016                            "updateTime" => Ok(__FieldTag::__update_time),
10017                            "update_time" => Ok(__FieldTag::__update_time),
10018                            "labels" => Ok(__FieldTag::__labels),
10019                            "description" => Ok(__FieldTag::__description),
10020                            "uniqueId" => Ok(__FieldTag::__unique_id),
10021                            "unique_id" => Ok(__FieldTag::__unique_id),
10022                            "state" => Ok(__FieldTag::__state),
10023                            "routingVpcs" => Ok(__FieldTag::__routing_vpcs),
10024                            "routing_vpcs" => Ok(__FieldTag::__routing_vpcs),
10025                            "routeTables" => Ok(__FieldTag::__route_tables),
10026                            "route_tables" => Ok(__FieldTag::__route_tables),
10027                            "spokeSummary" => Ok(__FieldTag::__spoke_summary),
10028                            "spoke_summary" => Ok(__FieldTag::__spoke_summary),
10029                            "policyMode" => Ok(__FieldTag::__policy_mode),
10030                            "policy_mode" => Ok(__FieldTag::__policy_mode),
10031                            "presetTopology" => Ok(__FieldTag::__preset_topology),
10032                            "preset_topology" => Ok(__FieldTag::__preset_topology),
10033                            "exportPsc" => Ok(__FieldTag::__export_psc),
10034                            "export_psc" => Ok(__FieldTag::__export_psc),
10035                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10036                        }
10037                    }
10038                }
10039                deserializer.deserialize_identifier(Visitor)
10040            }
10041        }
10042        struct Visitor;
10043        impl<'de> serde::de::Visitor<'de> for Visitor {
10044            type Value = Hub;
10045            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10046                formatter.write_str("struct Hub")
10047            }
10048            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10049            where
10050                A: serde::de::MapAccess<'de>,
10051            {
10052                #[allow(unused_imports)]
10053                use serde::de::Error;
10054                use std::option::Option::Some;
10055                let mut fields = std::collections::HashSet::new();
10056                let mut result = Self::Value::new();
10057                while let Some(tag) = map.next_key::<__FieldTag>()? {
10058                    #[allow(clippy::match_single_binding)]
10059                    match tag {
10060                        __FieldTag::__name => {
10061                            if !fields.insert(__FieldTag::__name) {
10062                                return std::result::Result::Err(A::Error::duplicate_field(
10063                                    "multiple values for name",
10064                                ));
10065                            }
10066                            result.name = map
10067                                .next_value::<std::option::Option<std::string::String>>()?
10068                                .unwrap_or_default();
10069                        }
10070                        __FieldTag::__create_time => {
10071                            if !fields.insert(__FieldTag::__create_time) {
10072                                return std::result::Result::Err(A::Error::duplicate_field(
10073                                    "multiple values for create_time",
10074                                ));
10075                            }
10076                            result.create_time =
10077                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
10078                        }
10079                        __FieldTag::__update_time => {
10080                            if !fields.insert(__FieldTag::__update_time) {
10081                                return std::result::Result::Err(A::Error::duplicate_field(
10082                                    "multiple values for update_time",
10083                                ));
10084                            }
10085                            result.update_time =
10086                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
10087                        }
10088                        __FieldTag::__labels => {
10089                            if !fields.insert(__FieldTag::__labels) {
10090                                return std::result::Result::Err(A::Error::duplicate_field(
10091                                    "multiple values for labels",
10092                                ));
10093                            }
10094                            result.labels = map
10095                                .next_value::<std::option::Option<
10096                                    std::collections::HashMap<
10097                                        std::string::String,
10098                                        std::string::String,
10099                                    >,
10100                                >>()?
10101                                .unwrap_or_default();
10102                        }
10103                        __FieldTag::__description => {
10104                            if !fields.insert(__FieldTag::__description) {
10105                                return std::result::Result::Err(A::Error::duplicate_field(
10106                                    "multiple values for description",
10107                                ));
10108                            }
10109                            result.description = map
10110                                .next_value::<std::option::Option<std::string::String>>()?
10111                                .unwrap_or_default();
10112                        }
10113                        __FieldTag::__unique_id => {
10114                            if !fields.insert(__FieldTag::__unique_id) {
10115                                return std::result::Result::Err(A::Error::duplicate_field(
10116                                    "multiple values for unique_id",
10117                                ));
10118                            }
10119                            result.unique_id = map
10120                                .next_value::<std::option::Option<std::string::String>>()?
10121                                .unwrap_or_default();
10122                        }
10123                        __FieldTag::__state => {
10124                            if !fields.insert(__FieldTag::__state) {
10125                                return std::result::Result::Err(A::Error::duplicate_field(
10126                                    "multiple values for state",
10127                                ));
10128                            }
10129                            result.state = map
10130                                .next_value::<std::option::Option<crate::model::State>>()?
10131                                .unwrap_or_default();
10132                        }
10133                        __FieldTag::__routing_vpcs => {
10134                            if !fields.insert(__FieldTag::__routing_vpcs) {
10135                                return std::result::Result::Err(A::Error::duplicate_field(
10136                                    "multiple values for routing_vpcs",
10137                                ));
10138                            }
10139                            result.routing_vpcs = map.next_value::<std::option::Option<std::vec::Vec<crate::model::RoutingVPC>>>()?.unwrap_or_default();
10140                        }
10141                        __FieldTag::__route_tables => {
10142                            if !fields.insert(__FieldTag::__route_tables) {
10143                                return std::result::Result::Err(A::Error::duplicate_field(
10144                                    "multiple values for route_tables",
10145                                ));
10146                            }
10147                            result.route_tables = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
10148                        }
10149                        __FieldTag::__spoke_summary => {
10150                            if !fields.insert(__FieldTag::__spoke_summary) {
10151                                return std::result::Result::Err(A::Error::duplicate_field(
10152                                    "multiple values for spoke_summary",
10153                                ));
10154                            }
10155                            result.spoke_summary = map
10156                                .next_value::<std::option::Option<crate::model::SpokeSummary>>()?;
10157                        }
10158                        __FieldTag::__policy_mode => {
10159                            if !fields.insert(__FieldTag::__policy_mode) {
10160                                return std::result::Result::Err(A::Error::duplicate_field(
10161                                    "multiple values for policy_mode",
10162                                ));
10163                            }
10164                            result.policy_mode = map
10165                                .next_value::<std::option::Option<crate::model::PolicyMode>>()?
10166                                .unwrap_or_default();
10167                        }
10168                        __FieldTag::__preset_topology => {
10169                            if !fields.insert(__FieldTag::__preset_topology) {
10170                                return std::result::Result::Err(A::Error::duplicate_field(
10171                                    "multiple values for preset_topology",
10172                                ));
10173                            }
10174                            result.preset_topology = map
10175                                .next_value::<std::option::Option<crate::model::PresetTopology>>()?
10176                                .unwrap_or_default();
10177                        }
10178                        __FieldTag::__export_psc => {
10179                            if !fields.insert(__FieldTag::__export_psc) {
10180                                return std::result::Result::Err(A::Error::duplicate_field(
10181                                    "multiple values for export_psc",
10182                                ));
10183                            }
10184                            result.export_psc = map.next_value::<std::option::Option<bool>>()?;
10185                        }
10186                        __FieldTag::Unknown(key) => {
10187                            let value = map.next_value::<serde_json::Value>()?;
10188                            result._unknown_fields.insert(key, value);
10189                        }
10190                    }
10191                }
10192                std::result::Result::Ok(result)
10193            }
10194        }
10195        deserializer.deserialize_any(Visitor)
10196    }
10197}
10198
10199#[doc(hidden)]
10200impl serde::ser::Serialize for Hub {
10201    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10202    where
10203        S: serde::ser::Serializer,
10204    {
10205        use serde::ser::SerializeMap;
10206        #[allow(unused_imports)]
10207        use std::option::Option::Some;
10208        let mut state = serializer.serialize_map(std::option::Option::None)?;
10209        if !self.name.is_empty() {
10210            state.serialize_entry("name", &self.name)?;
10211        }
10212        if self.create_time.is_some() {
10213            state.serialize_entry("createTime", &self.create_time)?;
10214        }
10215        if self.update_time.is_some() {
10216            state.serialize_entry("updateTime", &self.update_time)?;
10217        }
10218        if !self.labels.is_empty() {
10219            state.serialize_entry("labels", &self.labels)?;
10220        }
10221        if !self.description.is_empty() {
10222            state.serialize_entry("description", &self.description)?;
10223        }
10224        if !self.unique_id.is_empty() {
10225            state.serialize_entry("uniqueId", &self.unique_id)?;
10226        }
10227        if !wkt::internal::is_default(&self.state) {
10228            state.serialize_entry("state", &self.state)?;
10229        }
10230        if !self.routing_vpcs.is_empty() {
10231            state.serialize_entry("routingVpcs", &self.routing_vpcs)?;
10232        }
10233        if !self.route_tables.is_empty() {
10234            state.serialize_entry("routeTables", &self.route_tables)?;
10235        }
10236        if self.spoke_summary.is_some() {
10237            state.serialize_entry("spokeSummary", &self.spoke_summary)?;
10238        }
10239        if !wkt::internal::is_default(&self.policy_mode) {
10240            state.serialize_entry("policyMode", &self.policy_mode)?;
10241        }
10242        if !wkt::internal::is_default(&self.preset_topology) {
10243            state.serialize_entry("presetTopology", &self.preset_topology)?;
10244        }
10245        if self.export_psc.is_some() {
10246            state.serialize_entry("exportPsc", &self.export_psc)?;
10247        }
10248        if !self._unknown_fields.is_empty() {
10249            for (key, value) in self._unknown_fields.iter() {
10250                state.serialize_entry(key, &value)?;
10251            }
10252        }
10253        state.end()
10254    }
10255}
10256
10257impl std::fmt::Debug for Hub {
10258    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10259        let mut debug_struct = f.debug_struct("Hub");
10260        debug_struct.field("name", &self.name);
10261        debug_struct.field("create_time", &self.create_time);
10262        debug_struct.field("update_time", &self.update_time);
10263        debug_struct.field("labels", &self.labels);
10264        debug_struct.field("description", &self.description);
10265        debug_struct.field("unique_id", &self.unique_id);
10266        debug_struct.field("state", &self.state);
10267        debug_struct.field("routing_vpcs", &self.routing_vpcs);
10268        debug_struct.field("route_tables", &self.route_tables);
10269        debug_struct.field("spoke_summary", &self.spoke_summary);
10270        debug_struct.field("policy_mode", &self.policy_mode);
10271        debug_struct.field("preset_topology", &self.preset_topology);
10272        debug_struct.field("export_psc", &self.export_psc);
10273        if !self._unknown_fields.is_empty() {
10274            debug_struct.field("_unknown_fields", &self._unknown_fields);
10275        }
10276        debug_struct.finish()
10277    }
10278}
10279
10280/// RoutingVPC contains information about the VPC networks associated
10281/// with the spokes of a Network Connectivity Center hub.
10282#[derive(Clone, Default, PartialEq)]
10283#[non_exhaustive]
10284pub struct RoutingVPC {
10285    /// The URI of the VPC network.
10286    pub uri: std::string::String,
10287
10288    /// Output only. If true, indicates that this VPC network is currently
10289    /// associated with spokes that use the data transfer feature (spokes where the
10290    /// site_to_site_data_transfer field is set to true). If you create new spokes
10291    /// that use data transfer, they must be associated with this VPC network. At
10292    /// most, one VPC network will have this field set to true.
10293    pub required_for_new_site_to_site_data_transfer_spokes: bool,
10294
10295    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10296}
10297
10298impl RoutingVPC {
10299    pub fn new() -> Self {
10300        std::default::Default::default()
10301    }
10302
10303    /// Sets the value of [uri][crate::model::RoutingVPC::uri].
10304    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10305        self.uri = v.into();
10306        self
10307    }
10308
10309    /// 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].
10310    pub fn set_required_for_new_site_to_site_data_transfer_spokes<T: std::convert::Into<bool>>(
10311        mut self,
10312        v: T,
10313    ) -> Self {
10314        self.required_for_new_site_to_site_data_transfer_spokes = v.into();
10315        self
10316    }
10317}
10318
10319impl wkt::message::Message for RoutingVPC {
10320    fn typename() -> &'static str {
10321        "type.googleapis.com/google.cloud.networkconnectivity.v1.RoutingVPC"
10322    }
10323}
10324
10325#[doc(hidden)]
10326impl<'de> serde::de::Deserialize<'de> for RoutingVPC {
10327    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10328    where
10329        D: serde::Deserializer<'de>,
10330    {
10331        #[allow(non_camel_case_types)]
10332        #[doc(hidden)]
10333        #[derive(PartialEq, Eq, Hash)]
10334        enum __FieldTag {
10335            __uri,
10336            __required_for_new_site_to_site_data_transfer_spokes,
10337            Unknown(std::string::String),
10338        }
10339        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10340            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10341            where
10342                D: serde::Deserializer<'de>,
10343            {
10344                struct Visitor;
10345                impl<'de> serde::de::Visitor<'de> for Visitor {
10346                    type Value = __FieldTag;
10347                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10348                        formatter.write_str("a field name for RoutingVPC")
10349                    }
10350                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10351                    where
10352                        E: serde::de::Error,
10353                    {
10354                        use std::result::Result::Ok;
10355                        use std::string::ToString;
10356                        match value {
10357                            "uri" => Ok(__FieldTag::__uri),
10358                            "requiredForNewSiteToSiteDataTransferSpokes" => Ok(
10359                                __FieldTag::__required_for_new_site_to_site_data_transfer_spokes,
10360                            ),
10361                            "required_for_new_site_to_site_data_transfer_spokes" => Ok(
10362                                __FieldTag::__required_for_new_site_to_site_data_transfer_spokes,
10363                            ),
10364                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10365                        }
10366                    }
10367                }
10368                deserializer.deserialize_identifier(Visitor)
10369            }
10370        }
10371        struct Visitor;
10372        impl<'de> serde::de::Visitor<'de> for Visitor {
10373            type Value = RoutingVPC;
10374            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10375                formatter.write_str("struct RoutingVPC")
10376            }
10377            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10378            where
10379                A: serde::de::MapAccess<'de>,
10380            {
10381                #[allow(unused_imports)]
10382                use serde::de::Error;
10383                use std::option::Option::Some;
10384                let mut fields = std::collections::HashSet::new();
10385                let mut result = Self::Value::new();
10386                while let Some(tag) = map.next_key::<__FieldTag>()? {
10387                    #[allow(clippy::match_single_binding)]
10388                    match tag {
10389                        __FieldTag::__uri => {
10390                            if !fields.insert(__FieldTag::__uri) {
10391                                return std::result::Result::Err(A::Error::duplicate_field(
10392                                    "multiple values for uri",
10393                                ));
10394                            }
10395                            result.uri = map
10396                                .next_value::<std::option::Option<std::string::String>>()?
10397                                .unwrap_or_default();
10398                        }
10399                        __FieldTag::__required_for_new_site_to_site_data_transfer_spokes => {
10400                            if !fields.insert(
10401                                __FieldTag::__required_for_new_site_to_site_data_transfer_spokes,
10402                            ) {
10403                                return std::result::Result::Err(A::Error::duplicate_field(
10404                                    "multiple values for required_for_new_site_to_site_data_transfer_spokes",
10405                                ));
10406                            }
10407                            result.required_for_new_site_to_site_data_transfer_spokes = map
10408                                .next_value::<std::option::Option<bool>>()?
10409                                .unwrap_or_default();
10410                        }
10411                        __FieldTag::Unknown(key) => {
10412                            let value = map.next_value::<serde_json::Value>()?;
10413                            result._unknown_fields.insert(key, value);
10414                        }
10415                    }
10416                }
10417                std::result::Result::Ok(result)
10418            }
10419        }
10420        deserializer.deserialize_any(Visitor)
10421    }
10422}
10423
10424#[doc(hidden)]
10425impl serde::ser::Serialize for RoutingVPC {
10426    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10427    where
10428        S: serde::ser::Serializer,
10429    {
10430        use serde::ser::SerializeMap;
10431        #[allow(unused_imports)]
10432        use std::option::Option::Some;
10433        let mut state = serializer.serialize_map(std::option::Option::None)?;
10434        if !self.uri.is_empty() {
10435            state.serialize_entry("uri", &self.uri)?;
10436        }
10437        if !wkt::internal::is_default(&self.required_for_new_site_to_site_data_transfer_spokes) {
10438            state.serialize_entry(
10439                "requiredForNewSiteToSiteDataTransferSpokes",
10440                &self.required_for_new_site_to_site_data_transfer_spokes,
10441            )?;
10442        }
10443        if !self._unknown_fields.is_empty() {
10444            for (key, value) in self._unknown_fields.iter() {
10445                state.serialize_entry(key, &value)?;
10446            }
10447        }
10448        state.end()
10449    }
10450}
10451
10452impl std::fmt::Debug for RoutingVPC {
10453    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10454        let mut debug_struct = f.debug_struct("RoutingVPC");
10455        debug_struct.field("uri", &self.uri);
10456        debug_struct.field(
10457            "required_for_new_site_to_site_data_transfer_spokes",
10458            &self.required_for_new_site_to_site_data_transfer_spokes,
10459        );
10460        if !self._unknown_fields.is_empty() {
10461            debug_struct.field("_unknown_fields", &self._unknown_fields);
10462        }
10463        debug_struct.finish()
10464    }
10465}
10466
10467/// A Network Connectivity Center spoke represents one or more network
10468/// connectivity resources.
10469///
10470/// When you create a spoke, you associate it with a hub. You must also
10471/// identify a value for exactly one of the following fields:
10472///
10473/// * linked_vpn_tunnels
10474/// * linked_interconnect_attachments
10475/// * linked_router_appliance_instances
10476/// * linked_vpc_network
10477#[derive(Clone, Default, PartialEq)]
10478#[non_exhaustive]
10479pub struct Spoke {
10480    /// Immutable. The name of the spoke. Spoke names must be unique. They use the
10481    /// following form:
10482    /// `projects/{project_number}/locations/{region}/spokes/{spoke_id}`
10483    pub name: std::string::String,
10484
10485    /// Output only. The time the spoke was created.
10486    pub create_time: std::option::Option<wkt::Timestamp>,
10487
10488    /// Output only. The time the spoke was last updated.
10489    pub update_time: std::option::Option<wkt::Timestamp>,
10490
10491    /// Optional labels in key-value pair format. For more information about
10492    /// labels, see [Requirements for
10493    /// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements).
10494    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10495
10496    /// Optional. An optional description of the spoke.
10497    pub description: std::string::String,
10498
10499    /// Immutable. The name of the hub that this spoke is attached to.
10500    pub hub: std::string::String,
10501
10502    /// Optional. The name of the group that this spoke is associated with.
10503    pub group: std::string::String,
10504
10505    /// Optional. VPN tunnels that are associated with the spoke.
10506    pub linked_vpn_tunnels: std::option::Option<crate::model::LinkedVpnTunnels>,
10507
10508    /// Optional. VLAN attachments that are associated with the spoke.
10509    pub linked_interconnect_attachments:
10510        std::option::Option<crate::model::LinkedInterconnectAttachments>,
10511
10512    /// Optional. Router appliance instances that are associated with the spoke.
10513    pub linked_router_appliance_instances:
10514        std::option::Option<crate::model::LinkedRouterApplianceInstances>,
10515
10516    /// Optional. VPC network that is associated with the spoke.
10517    pub linked_vpc_network: std::option::Option<crate::model::LinkedVpcNetwork>,
10518
10519    /// Optional. The linked producer VPC that is associated with the spoke.
10520    pub linked_producer_vpc_network: std::option::Option<crate::model::LinkedProducerVpcNetwork>,
10521
10522    /// Output only. The Google-generated UUID for the spoke. This value is unique
10523    /// across all spoke resources. If a spoke is deleted and another with the same
10524    /// name is created, the new spoke is assigned a different `unique_id`.
10525    pub unique_id: std::string::String,
10526
10527    /// Output only. The current lifecycle state of this spoke.
10528    pub state: crate::model::State,
10529
10530    /// Output only. The reasons for current state of the spoke.
10531    pub reasons: std::vec::Vec<crate::model::spoke::StateReason>,
10532
10533    /// Output only. The type of resource associated with the spoke.
10534    pub spoke_type: crate::model::SpokeType,
10535
10536    /// Optional. This checksum is computed by the server based on the value of
10537    /// other fields, and may be sent on update and delete requests to ensure the
10538    /// client has an up-to-date value before proceeding.
10539    pub etag: std::string::String,
10540
10541    /// Optional. The list of fields waiting for hub administration's approval.
10542    pub field_paths_pending_update: std::vec::Vec<std::string::String>,
10543
10544    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10545}
10546
10547impl Spoke {
10548    pub fn new() -> Self {
10549        std::default::Default::default()
10550    }
10551
10552    /// Sets the value of [name][crate::model::Spoke::name].
10553    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10554        self.name = v.into();
10555        self
10556    }
10557
10558    /// Sets the value of [create_time][crate::model::Spoke::create_time].
10559    pub fn set_create_time<T>(mut self, v: T) -> Self
10560    where
10561        T: std::convert::Into<wkt::Timestamp>,
10562    {
10563        self.create_time = std::option::Option::Some(v.into());
10564        self
10565    }
10566
10567    /// Sets or clears the value of [create_time][crate::model::Spoke::create_time].
10568    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10569    where
10570        T: std::convert::Into<wkt::Timestamp>,
10571    {
10572        self.create_time = v.map(|x| x.into());
10573        self
10574    }
10575
10576    /// Sets the value of [update_time][crate::model::Spoke::update_time].
10577    pub fn set_update_time<T>(mut self, v: T) -> Self
10578    where
10579        T: std::convert::Into<wkt::Timestamp>,
10580    {
10581        self.update_time = std::option::Option::Some(v.into());
10582        self
10583    }
10584
10585    /// Sets or clears the value of [update_time][crate::model::Spoke::update_time].
10586    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
10587    where
10588        T: std::convert::Into<wkt::Timestamp>,
10589    {
10590        self.update_time = v.map(|x| x.into());
10591        self
10592    }
10593
10594    /// Sets the value of [labels][crate::model::Spoke::labels].
10595    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10596    where
10597        T: std::iter::IntoIterator<Item = (K, V)>,
10598        K: std::convert::Into<std::string::String>,
10599        V: std::convert::Into<std::string::String>,
10600    {
10601        use std::iter::Iterator;
10602        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10603        self
10604    }
10605
10606    /// Sets the value of [description][crate::model::Spoke::description].
10607    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10608        self.description = v.into();
10609        self
10610    }
10611
10612    /// Sets the value of [hub][crate::model::Spoke::hub].
10613    pub fn set_hub<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10614        self.hub = v.into();
10615        self
10616    }
10617
10618    /// Sets the value of [group][crate::model::Spoke::group].
10619    pub fn set_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10620        self.group = v.into();
10621        self
10622    }
10623
10624    /// Sets the value of [linked_vpn_tunnels][crate::model::Spoke::linked_vpn_tunnels].
10625    pub fn set_linked_vpn_tunnels<T>(mut self, v: T) -> Self
10626    where
10627        T: std::convert::Into<crate::model::LinkedVpnTunnels>,
10628    {
10629        self.linked_vpn_tunnels = std::option::Option::Some(v.into());
10630        self
10631    }
10632
10633    /// Sets or clears the value of [linked_vpn_tunnels][crate::model::Spoke::linked_vpn_tunnels].
10634    pub fn set_or_clear_linked_vpn_tunnels<T>(mut self, v: std::option::Option<T>) -> Self
10635    where
10636        T: std::convert::Into<crate::model::LinkedVpnTunnels>,
10637    {
10638        self.linked_vpn_tunnels = v.map(|x| x.into());
10639        self
10640    }
10641
10642    /// Sets the value of [linked_interconnect_attachments][crate::model::Spoke::linked_interconnect_attachments].
10643    pub fn set_linked_interconnect_attachments<T>(mut self, v: T) -> Self
10644    where
10645        T: std::convert::Into<crate::model::LinkedInterconnectAttachments>,
10646    {
10647        self.linked_interconnect_attachments = std::option::Option::Some(v.into());
10648        self
10649    }
10650
10651    /// Sets or clears the value of [linked_interconnect_attachments][crate::model::Spoke::linked_interconnect_attachments].
10652    pub fn set_or_clear_linked_interconnect_attachments<T>(
10653        mut self,
10654        v: std::option::Option<T>,
10655    ) -> Self
10656    where
10657        T: std::convert::Into<crate::model::LinkedInterconnectAttachments>,
10658    {
10659        self.linked_interconnect_attachments = v.map(|x| x.into());
10660        self
10661    }
10662
10663    /// Sets the value of [linked_router_appliance_instances][crate::model::Spoke::linked_router_appliance_instances].
10664    pub fn set_linked_router_appliance_instances<T>(mut self, v: T) -> Self
10665    where
10666        T: std::convert::Into<crate::model::LinkedRouterApplianceInstances>,
10667    {
10668        self.linked_router_appliance_instances = std::option::Option::Some(v.into());
10669        self
10670    }
10671
10672    /// Sets or clears the value of [linked_router_appliance_instances][crate::model::Spoke::linked_router_appliance_instances].
10673    pub fn set_or_clear_linked_router_appliance_instances<T>(
10674        mut self,
10675        v: std::option::Option<T>,
10676    ) -> Self
10677    where
10678        T: std::convert::Into<crate::model::LinkedRouterApplianceInstances>,
10679    {
10680        self.linked_router_appliance_instances = v.map(|x| x.into());
10681        self
10682    }
10683
10684    /// Sets the value of [linked_vpc_network][crate::model::Spoke::linked_vpc_network].
10685    pub fn set_linked_vpc_network<T>(mut self, v: T) -> Self
10686    where
10687        T: std::convert::Into<crate::model::LinkedVpcNetwork>,
10688    {
10689        self.linked_vpc_network = std::option::Option::Some(v.into());
10690        self
10691    }
10692
10693    /// Sets or clears the value of [linked_vpc_network][crate::model::Spoke::linked_vpc_network].
10694    pub fn set_or_clear_linked_vpc_network<T>(mut self, v: std::option::Option<T>) -> Self
10695    where
10696        T: std::convert::Into<crate::model::LinkedVpcNetwork>,
10697    {
10698        self.linked_vpc_network = v.map(|x| x.into());
10699        self
10700    }
10701
10702    /// Sets the value of [linked_producer_vpc_network][crate::model::Spoke::linked_producer_vpc_network].
10703    pub fn set_linked_producer_vpc_network<T>(mut self, v: T) -> Self
10704    where
10705        T: std::convert::Into<crate::model::LinkedProducerVpcNetwork>,
10706    {
10707        self.linked_producer_vpc_network = std::option::Option::Some(v.into());
10708        self
10709    }
10710
10711    /// Sets or clears the value of [linked_producer_vpc_network][crate::model::Spoke::linked_producer_vpc_network].
10712    pub fn set_or_clear_linked_producer_vpc_network<T>(mut self, v: std::option::Option<T>) -> Self
10713    where
10714        T: std::convert::Into<crate::model::LinkedProducerVpcNetwork>,
10715    {
10716        self.linked_producer_vpc_network = v.map(|x| x.into());
10717        self
10718    }
10719
10720    /// Sets the value of [unique_id][crate::model::Spoke::unique_id].
10721    pub fn set_unique_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10722        self.unique_id = v.into();
10723        self
10724    }
10725
10726    /// Sets the value of [state][crate::model::Spoke::state].
10727    pub fn set_state<T: std::convert::Into<crate::model::State>>(mut self, v: T) -> Self {
10728        self.state = v.into();
10729        self
10730    }
10731
10732    /// Sets the value of [reasons][crate::model::Spoke::reasons].
10733    pub fn set_reasons<T, V>(mut self, v: T) -> Self
10734    where
10735        T: std::iter::IntoIterator<Item = V>,
10736        V: std::convert::Into<crate::model::spoke::StateReason>,
10737    {
10738        use std::iter::Iterator;
10739        self.reasons = v.into_iter().map(|i| i.into()).collect();
10740        self
10741    }
10742
10743    /// Sets the value of [spoke_type][crate::model::Spoke::spoke_type].
10744    pub fn set_spoke_type<T: std::convert::Into<crate::model::SpokeType>>(mut self, v: T) -> Self {
10745        self.spoke_type = v.into();
10746        self
10747    }
10748
10749    /// Sets the value of [etag][crate::model::Spoke::etag].
10750    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10751        self.etag = v.into();
10752        self
10753    }
10754
10755    /// Sets the value of [field_paths_pending_update][crate::model::Spoke::field_paths_pending_update].
10756    pub fn set_field_paths_pending_update<T, V>(mut self, v: T) -> Self
10757    where
10758        T: std::iter::IntoIterator<Item = V>,
10759        V: std::convert::Into<std::string::String>,
10760    {
10761        use std::iter::Iterator;
10762        self.field_paths_pending_update = v.into_iter().map(|i| i.into()).collect();
10763        self
10764    }
10765}
10766
10767impl wkt::message::Message for Spoke {
10768    fn typename() -> &'static str {
10769        "type.googleapis.com/google.cloud.networkconnectivity.v1.Spoke"
10770    }
10771}
10772
10773#[doc(hidden)]
10774impl<'de> serde::de::Deserialize<'de> for Spoke {
10775    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10776    where
10777        D: serde::Deserializer<'de>,
10778    {
10779        #[allow(non_camel_case_types)]
10780        #[doc(hidden)]
10781        #[derive(PartialEq, Eq, Hash)]
10782        enum __FieldTag {
10783            __name,
10784            __create_time,
10785            __update_time,
10786            __labels,
10787            __description,
10788            __hub,
10789            __group,
10790            __linked_vpn_tunnels,
10791            __linked_interconnect_attachments,
10792            __linked_router_appliance_instances,
10793            __linked_vpc_network,
10794            __linked_producer_vpc_network,
10795            __unique_id,
10796            __state,
10797            __reasons,
10798            __spoke_type,
10799            __etag,
10800            __field_paths_pending_update,
10801            Unknown(std::string::String),
10802        }
10803        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10804            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10805            where
10806                D: serde::Deserializer<'de>,
10807            {
10808                struct Visitor;
10809                impl<'de> serde::de::Visitor<'de> for Visitor {
10810                    type Value = __FieldTag;
10811                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10812                        formatter.write_str("a field name for Spoke")
10813                    }
10814                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10815                    where
10816                        E: serde::de::Error,
10817                    {
10818                        use std::result::Result::Ok;
10819                        use std::string::ToString;
10820                        match value {
10821                            "name" => Ok(__FieldTag::__name),
10822                            "createTime" => Ok(__FieldTag::__create_time),
10823                            "create_time" => Ok(__FieldTag::__create_time),
10824                            "updateTime" => Ok(__FieldTag::__update_time),
10825                            "update_time" => Ok(__FieldTag::__update_time),
10826                            "labels" => Ok(__FieldTag::__labels),
10827                            "description" => Ok(__FieldTag::__description),
10828                            "hub" => Ok(__FieldTag::__hub),
10829                            "group" => Ok(__FieldTag::__group),
10830                            "linkedVpnTunnels" => Ok(__FieldTag::__linked_vpn_tunnels),
10831                            "linked_vpn_tunnels" => Ok(__FieldTag::__linked_vpn_tunnels),
10832                            "linkedInterconnectAttachments" => {
10833                                Ok(__FieldTag::__linked_interconnect_attachments)
10834                            }
10835                            "linked_interconnect_attachments" => {
10836                                Ok(__FieldTag::__linked_interconnect_attachments)
10837                            }
10838                            "linkedRouterApplianceInstances" => {
10839                                Ok(__FieldTag::__linked_router_appliance_instances)
10840                            }
10841                            "linked_router_appliance_instances" => {
10842                                Ok(__FieldTag::__linked_router_appliance_instances)
10843                            }
10844                            "linkedVpcNetwork" => Ok(__FieldTag::__linked_vpc_network),
10845                            "linked_vpc_network" => Ok(__FieldTag::__linked_vpc_network),
10846                            "linkedProducerVpcNetwork" => {
10847                                Ok(__FieldTag::__linked_producer_vpc_network)
10848                            }
10849                            "linked_producer_vpc_network" => {
10850                                Ok(__FieldTag::__linked_producer_vpc_network)
10851                            }
10852                            "uniqueId" => Ok(__FieldTag::__unique_id),
10853                            "unique_id" => Ok(__FieldTag::__unique_id),
10854                            "state" => Ok(__FieldTag::__state),
10855                            "reasons" => Ok(__FieldTag::__reasons),
10856                            "spokeType" => Ok(__FieldTag::__spoke_type),
10857                            "spoke_type" => Ok(__FieldTag::__spoke_type),
10858                            "etag" => Ok(__FieldTag::__etag),
10859                            "fieldPathsPendingUpdate" => {
10860                                Ok(__FieldTag::__field_paths_pending_update)
10861                            }
10862                            "field_paths_pending_update" => {
10863                                Ok(__FieldTag::__field_paths_pending_update)
10864                            }
10865                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10866                        }
10867                    }
10868                }
10869                deserializer.deserialize_identifier(Visitor)
10870            }
10871        }
10872        struct Visitor;
10873        impl<'de> serde::de::Visitor<'de> for Visitor {
10874            type Value = Spoke;
10875            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10876                formatter.write_str("struct Spoke")
10877            }
10878            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10879            where
10880                A: serde::de::MapAccess<'de>,
10881            {
10882                #[allow(unused_imports)]
10883                use serde::de::Error;
10884                use std::option::Option::Some;
10885                let mut fields = std::collections::HashSet::new();
10886                let mut result = Self::Value::new();
10887                while let Some(tag) = map.next_key::<__FieldTag>()? {
10888                    #[allow(clippy::match_single_binding)]
10889                    match tag {
10890                        __FieldTag::__name => {
10891                            if !fields.insert(__FieldTag::__name) {
10892                                return std::result::Result::Err(A::Error::duplicate_field(
10893                                    "multiple values for name",
10894                                ));
10895                            }
10896                            result.name = map
10897                                .next_value::<std::option::Option<std::string::String>>()?
10898                                .unwrap_or_default();
10899                        }
10900                        __FieldTag::__create_time => {
10901                            if !fields.insert(__FieldTag::__create_time) {
10902                                return std::result::Result::Err(A::Error::duplicate_field(
10903                                    "multiple values for create_time",
10904                                ));
10905                            }
10906                            result.create_time =
10907                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
10908                        }
10909                        __FieldTag::__update_time => {
10910                            if !fields.insert(__FieldTag::__update_time) {
10911                                return std::result::Result::Err(A::Error::duplicate_field(
10912                                    "multiple values for update_time",
10913                                ));
10914                            }
10915                            result.update_time =
10916                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
10917                        }
10918                        __FieldTag::__labels => {
10919                            if !fields.insert(__FieldTag::__labels) {
10920                                return std::result::Result::Err(A::Error::duplicate_field(
10921                                    "multiple values for labels",
10922                                ));
10923                            }
10924                            result.labels = map
10925                                .next_value::<std::option::Option<
10926                                    std::collections::HashMap<
10927                                        std::string::String,
10928                                        std::string::String,
10929                                    >,
10930                                >>()?
10931                                .unwrap_or_default();
10932                        }
10933                        __FieldTag::__description => {
10934                            if !fields.insert(__FieldTag::__description) {
10935                                return std::result::Result::Err(A::Error::duplicate_field(
10936                                    "multiple values for description",
10937                                ));
10938                            }
10939                            result.description = map
10940                                .next_value::<std::option::Option<std::string::String>>()?
10941                                .unwrap_or_default();
10942                        }
10943                        __FieldTag::__hub => {
10944                            if !fields.insert(__FieldTag::__hub) {
10945                                return std::result::Result::Err(A::Error::duplicate_field(
10946                                    "multiple values for hub",
10947                                ));
10948                            }
10949                            result.hub = map
10950                                .next_value::<std::option::Option<std::string::String>>()?
10951                                .unwrap_or_default();
10952                        }
10953                        __FieldTag::__group => {
10954                            if !fields.insert(__FieldTag::__group) {
10955                                return std::result::Result::Err(A::Error::duplicate_field(
10956                                    "multiple values for group",
10957                                ));
10958                            }
10959                            result.group = map
10960                                .next_value::<std::option::Option<std::string::String>>()?
10961                                .unwrap_or_default();
10962                        }
10963                        __FieldTag::__linked_vpn_tunnels => {
10964                            if !fields.insert(__FieldTag::__linked_vpn_tunnels) {
10965                                return std::result::Result::Err(A::Error::duplicate_field(
10966                                    "multiple values for linked_vpn_tunnels",
10967                                ));
10968                            }
10969                            result.linked_vpn_tunnels = map
10970                                .next_value::<std::option::Option<crate::model::LinkedVpnTunnels>>(
10971                                )?;
10972                        }
10973                        __FieldTag::__linked_interconnect_attachments => {
10974                            if !fields.insert(__FieldTag::__linked_interconnect_attachments) {
10975                                return std::result::Result::Err(A::Error::duplicate_field(
10976                                    "multiple values for linked_interconnect_attachments",
10977                                ));
10978                            }
10979                            result.linked_interconnect_attachments =
10980                                map.next_value::<std::option::Option<
10981                                    crate::model::LinkedInterconnectAttachments,
10982                                >>()?;
10983                        }
10984                        __FieldTag::__linked_router_appliance_instances => {
10985                            if !fields.insert(__FieldTag::__linked_router_appliance_instances) {
10986                                return std::result::Result::Err(A::Error::duplicate_field(
10987                                    "multiple values for linked_router_appliance_instances",
10988                                ));
10989                            }
10990                            result.linked_router_appliance_instances =
10991                                map.next_value::<std::option::Option<
10992                                    crate::model::LinkedRouterApplianceInstances,
10993                                >>()?;
10994                        }
10995                        __FieldTag::__linked_vpc_network => {
10996                            if !fields.insert(__FieldTag::__linked_vpc_network) {
10997                                return std::result::Result::Err(A::Error::duplicate_field(
10998                                    "multiple values for linked_vpc_network",
10999                                ));
11000                            }
11001                            result.linked_vpc_network = map
11002                                .next_value::<std::option::Option<crate::model::LinkedVpcNetwork>>(
11003                                )?;
11004                        }
11005                        __FieldTag::__linked_producer_vpc_network => {
11006                            if !fields.insert(__FieldTag::__linked_producer_vpc_network) {
11007                                return std::result::Result::Err(A::Error::duplicate_field(
11008                                    "multiple values for linked_producer_vpc_network",
11009                                ));
11010                            }
11011                            result.linked_producer_vpc_network = map.next_value::<std::option::Option<crate::model::LinkedProducerVpcNetwork>>()?
11012                                ;
11013                        }
11014                        __FieldTag::__unique_id => {
11015                            if !fields.insert(__FieldTag::__unique_id) {
11016                                return std::result::Result::Err(A::Error::duplicate_field(
11017                                    "multiple values for unique_id",
11018                                ));
11019                            }
11020                            result.unique_id = map
11021                                .next_value::<std::option::Option<std::string::String>>()?
11022                                .unwrap_or_default();
11023                        }
11024                        __FieldTag::__state => {
11025                            if !fields.insert(__FieldTag::__state) {
11026                                return std::result::Result::Err(A::Error::duplicate_field(
11027                                    "multiple values for state",
11028                                ));
11029                            }
11030                            result.state = map
11031                                .next_value::<std::option::Option<crate::model::State>>()?
11032                                .unwrap_or_default();
11033                        }
11034                        __FieldTag::__reasons => {
11035                            if !fields.insert(__FieldTag::__reasons) {
11036                                return std::result::Result::Err(A::Error::duplicate_field(
11037                                    "multiple values for reasons",
11038                                ));
11039                            }
11040                            result.reasons = map
11041                                .next_value::<std::option::Option<
11042                                    std::vec::Vec<crate::model::spoke::StateReason>,
11043                                >>()?
11044                                .unwrap_or_default();
11045                        }
11046                        __FieldTag::__spoke_type => {
11047                            if !fields.insert(__FieldTag::__spoke_type) {
11048                                return std::result::Result::Err(A::Error::duplicate_field(
11049                                    "multiple values for spoke_type",
11050                                ));
11051                            }
11052                            result.spoke_type = map
11053                                .next_value::<std::option::Option<crate::model::SpokeType>>()?
11054                                .unwrap_or_default();
11055                        }
11056                        __FieldTag::__etag => {
11057                            if !fields.insert(__FieldTag::__etag) {
11058                                return std::result::Result::Err(A::Error::duplicate_field(
11059                                    "multiple values for etag",
11060                                ));
11061                            }
11062                            result.etag = map
11063                                .next_value::<std::option::Option<std::string::String>>()?
11064                                .unwrap_or_default();
11065                        }
11066                        __FieldTag::__field_paths_pending_update => {
11067                            if !fields.insert(__FieldTag::__field_paths_pending_update) {
11068                                return std::result::Result::Err(A::Error::duplicate_field(
11069                                    "multiple values for field_paths_pending_update",
11070                                ));
11071                            }
11072                            result.field_paths_pending_update = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
11073                        }
11074                        __FieldTag::Unknown(key) => {
11075                            let value = map.next_value::<serde_json::Value>()?;
11076                            result._unknown_fields.insert(key, value);
11077                        }
11078                    }
11079                }
11080                std::result::Result::Ok(result)
11081            }
11082        }
11083        deserializer.deserialize_any(Visitor)
11084    }
11085}
11086
11087#[doc(hidden)]
11088impl serde::ser::Serialize for Spoke {
11089    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11090    where
11091        S: serde::ser::Serializer,
11092    {
11093        use serde::ser::SerializeMap;
11094        #[allow(unused_imports)]
11095        use std::option::Option::Some;
11096        let mut state = serializer.serialize_map(std::option::Option::None)?;
11097        if !self.name.is_empty() {
11098            state.serialize_entry("name", &self.name)?;
11099        }
11100        if self.create_time.is_some() {
11101            state.serialize_entry("createTime", &self.create_time)?;
11102        }
11103        if self.update_time.is_some() {
11104            state.serialize_entry("updateTime", &self.update_time)?;
11105        }
11106        if !self.labels.is_empty() {
11107            state.serialize_entry("labels", &self.labels)?;
11108        }
11109        if !self.description.is_empty() {
11110            state.serialize_entry("description", &self.description)?;
11111        }
11112        if !self.hub.is_empty() {
11113            state.serialize_entry("hub", &self.hub)?;
11114        }
11115        if !self.group.is_empty() {
11116            state.serialize_entry("group", &self.group)?;
11117        }
11118        if self.linked_vpn_tunnels.is_some() {
11119            state.serialize_entry("linkedVpnTunnels", &self.linked_vpn_tunnels)?;
11120        }
11121        if self.linked_interconnect_attachments.is_some() {
11122            state.serialize_entry(
11123                "linkedInterconnectAttachments",
11124                &self.linked_interconnect_attachments,
11125            )?;
11126        }
11127        if self.linked_router_appliance_instances.is_some() {
11128            state.serialize_entry(
11129                "linkedRouterApplianceInstances",
11130                &self.linked_router_appliance_instances,
11131            )?;
11132        }
11133        if self.linked_vpc_network.is_some() {
11134            state.serialize_entry("linkedVpcNetwork", &self.linked_vpc_network)?;
11135        }
11136        if self.linked_producer_vpc_network.is_some() {
11137            state.serialize_entry(
11138                "linkedProducerVpcNetwork",
11139                &self.linked_producer_vpc_network,
11140            )?;
11141        }
11142        if !self.unique_id.is_empty() {
11143            state.serialize_entry("uniqueId", &self.unique_id)?;
11144        }
11145        if !wkt::internal::is_default(&self.state) {
11146            state.serialize_entry("state", &self.state)?;
11147        }
11148        if !self.reasons.is_empty() {
11149            state.serialize_entry("reasons", &self.reasons)?;
11150        }
11151        if !wkt::internal::is_default(&self.spoke_type) {
11152            state.serialize_entry("spokeType", &self.spoke_type)?;
11153        }
11154        if !self.etag.is_empty() {
11155            state.serialize_entry("etag", &self.etag)?;
11156        }
11157        if !self.field_paths_pending_update.is_empty() {
11158            state.serialize_entry("fieldPathsPendingUpdate", &self.field_paths_pending_update)?;
11159        }
11160        if !self._unknown_fields.is_empty() {
11161            for (key, value) in self._unknown_fields.iter() {
11162                state.serialize_entry(key, &value)?;
11163            }
11164        }
11165        state.end()
11166    }
11167}
11168
11169impl std::fmt::Debug for Spoke {
11170    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11171        let mut debug_struct = f.debug_struct("Spoke");
11172        debug_struct.field("name", &self.name);
11173        debug_struct.field("create_time", &self.create_time);
11174        debug_struct.field("update_time", &self.update_time);
11175        debug_struct.field("labels", &self.labels);
11176        debug_struct.field("description", &self.description);
11177        debug_struct.field("hub", &self.hub);
11178        debug_struct.field("group", &self.group);
11179        debug_struct.field("linked_vpn_tunnels", &self.linked_vpn_tunnels);
11180        debug_struct.field(
11181            "linked_interconnect_attachments",
11182            &self.linked_interconnect_attachments,
11183        );
11184        debug_struct.field(
11185            "linked_router_appliance_instances",
11186            &self.linked_router_appliance_instances,
11187        );
11188        debug_struct.field("linked_vpc_network", &self.linked_vpc_network);
11189        debug_struct.field(
11190            "linked_producer_vpc_network",
11191            &self.linked_producer_vpc_network,
11192        );
11193        debug_struct.field("unique_id", &self.unique_id);
11194        debug_struct.field("state", &self.state);
11195        debug_struct.field("reasons", &self.reasons);
11196        debug_struct.field("spoke_type", &self.spoke_type);
11197        debug_struct.field("etag", &self.etag);
11198        debug_struct.field(
11199            "field_paths_pending_update",
11200            &self.field_paths_pending_update,
11201        );
11202        if !self._unknown_fields.is_empty() {
11203            debug_struct.field("_unknown_fields", &self._unknown_fields);
11204        }
11205        debug_struct.finish()
11206    }
11207}
11208
11209/// Defines additional types related to [Spoke].
11210pub mod spoke {
11211    #[allow(unused_imports)]
11212    use super::*;
11213
11214    /// The reason a spoke is inactive.
11215    #[derive(Clone, Default, PartialEq)]
11216    #[non_exhaustive]
11217    pub struct StateReason {
11218        /// The code associated with this reason.
11219        pub code: crate::model::spoke::state_reason::Code,
11220
11221        /// Human-readable details about this reason.
11222        pub message: std::string::String,
11223
11224        /// Additional information provided by the user in the RejectSpoke call.
11225        pub user_details: std::string::String,
11226
11227        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11228    }
11229
11230    impl StateReason {
11231        pub fn new() -> Self {
11232            std::default::Default::default()
11233        }
11234
11235        /// Sets the value of [code][crate::model::spoke::StateReason::code].
11236        pub fn set_code<T: std::convert::Into<crate::model::spoke::state_reason::Code>>(
11237            mut self,
11238            v: T,
11239        ) -> Self {
11240            self.code = v.into();
11241            self
11242        }
11243
11244        /// Sets the value of [message][crate::model::spoke::StateReason::message].
11245        pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11246            self.message = v.into();
11247            self
11248        }
11249
11250        /// Sets the value of [user_details][crate::model::spoke::StateReason::user_details].
11251        pub fn set_user_details<T: std::convert::Into<std::string::String>>(
11252            mut self,
11253            v: T,
11254        ) -> Self {
11255            self.user_details = v.into();
11256            self
11257        }
11258    }
11259
11260    impl wkt::message::Message for StateReason {
11261        fn typename() -> &'static str {
11262            "type.googleapis.com/google.cloud.networkconnectivity.v1.Spoke.StateReason"
11263        }
11264    }
11265
11266    #[doc(hidden)]
11267    impl<'de> serde::de::Deserialize<'de> for StateReason {
11268        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11269        where
11270            D: serde::Deserializer<'de>,
11271        {
11272            #[allow(non_camel_case_types)]
11273            #[doc(hidden)]
11274            #[derive(PartialEq, Eq, Hash)]
11275            enum __FieldTag {
11276                __code,
11277                __message,
11278                __user_details,
11279                Unknown(std::string::String),
11280            }
11281            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11282                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11283                where
11284                    D: serde::Deserializer<'de>,
11285                {
11286                    struct Visitor;
11287                    impl<'de> serde::de::Visitor<'de> for Visitor {
11288                        type Value = __FieldTag;
11289                        fn expecting(
11290                            &self,
11291                            formatter: &mut std::fmt::Formatter,
11292                        ) -> std::fmt::Result {
11293                            formatter.write_str("a field name for StateReason")
11294                        }
11295                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11296                        where
11297                            E: serde::de::Error,
11298                        {
11299                            use std::result::Result::Ok;
11300                            use std::string::ToString;
11301                            match value {
11302                                "code" => Ok(__FieldTag::__code),
11303                                "message" => Ok(__FieldTag::__message),
11304                                "userDetails" => Ok(__FieldTag::__user_details),
11305                                "user_details" => Ok(__FieldTag::__user_details),
11306                                _ => Ok(__FieldTag::Unknown(value.to_string())),
11307                            }
11308                        }
11309                    }
11310                    deserializer.deserialize_identifier(Visitor)
11311                }
11312            }
11313            struct Visitor;
11314            impl<'de> serde::de::Visitor<'de> for Visitor {
11315                type Value = StateReason;
11316                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11317                    formatter.write_str("struct StateReason")
11318                }
11319                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11320                where
11321                    A: serde::de::MapAccess<'de>,
11322                {
11323                    #[allow(unused_imports)]
11324                    use serde::de::Error;
11325                    use std::option::Option::Some;
11326                    let mut fields = std::collections::HashSet::new();
11327                    let mut result = Self::Value::new();
11328                    while let Some(tag) = map.next_key::<__FieldTag>()? {
11329                        #[allow(clippy::match_single_binding)]
11330                        match tag {
11331                            __FieldTag::__code => {
11332                                if !fields.insert(__FieldTag::__code) {
11333                                    return std::result::Result::Err(A::Error::duplicate_field(
11334                                        "multiple values for code",
11335                                    ));
11336                                }
11337                                result.code =
11338                                    map.next_value::<std::option::Option<
11339                                        crate::model::spoke::state_reason::Code,
11340                                    >>()?
11341                                    .unwrap_or_default();
11342                            }
11343                            __FieldTag::__message => {
11344                                if !fields.insert(__FieldTag::__message) {
11345                                    return std::result::Result::Err(A::Error::duplicate_field(
11346                                        "multiple values for message",
11347                                    ));
11348                                }
11349                                result.message = map
11350                                    .next_value::<std::option::Option<std::string::String>>()?
11351                                    .unwrap_or_default();
11352                            }
11353                            __FieldTag::__user_details => {
11354                                if !fields.insert(__FieldTag::__user_details) {
11355                                    return std::result::Result::Err(A::Error::duplicate_field(
11356                                        "multiple values for user_details",
11357                                    ));
11358                                }
11359                                result.user_details = map
11360                                    .next_value::<std::option::Option<std::string::String>>()?
11361                                    .unwrap_or_default();
11362                            }
11363                            __FieldTag::Unknown(key) => {
11364                                let value = map.next_value::<serde_json::Value>()?;
11365                                result._unknown_fields.insert(key, value);
11366                            }
11367                        }
11368                    }
11369                    std::result::Result::Ok(result)
11370                }
11371            }
11372            deserializer.deserialize_any(Visitor)
11373        }
11374    }
11375
11376    #[doc(hidden)]
11377    impl serde::ser::Serialize for StateReason {
11378        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11379        where
11380            S: serde::ser::Serializer,
11381        {
11382            use serde::ser::SerializeMap;
11383            #[allow(unused_imports)]
11384            use std::option::Option::Some;
11385            let mut state = serializer.serialize_map(std::option::Option::None)?;
11386            if !wkt::internal::is_default(&self.code) {
11387                state.serialize_entry("code", &self.code)?;
11388            }
11389            if !self.message.is_empty() {
11390                state.serialize_entry("message", &self.message)?;
11391            }
11392            if !self.user_details.is_empty() {
11393                state.serialize_entry("userDetails", &self.user_details)?;
11394            }
11395            if !self._unknown_fields.is_empty() {
11396                for (key, value) in self._unknown_fields.iter() {
11397                    state.serialize_entry(key, &value)?;
11398                }
11399            }
11400            state.end()
11401        }
11402    }
11403
11404    impl std::fmt::Debug for StateReason {
11405        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11406            let mut debug_struct = f.debug_struct("StateReason");
11407            debug_struct.field("code", &self.code);
11408            debug_struct.field("message", &self.message);
11409            debug_struct.field("user_details", &self.user_details);
11410            if !self._unknown_fields.is_empty() {
11411                debug_struct.field("_unknown_fields", &self._unknown_fields);
11412            }
11413            debug_struct.finish()
11414        }
11415    }
11416
11417    /// Defines additional types related to [StateReason].
11418    pub mod state_reason {
11419        #[allow(unused_imports)]
11420        use super::*;
11421
11422        /// The Code enum represents the various reasons a state can be `INACTIVE`.
11423        ///
11424        /// # Working with unknown values
11425        ///
11426        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11427        /// additional enum variants at any time. Adding new variants is not considered
11428        /// a breaking change. Applications should write their code in anticipation of:
11429        ///
11430        /// - New values appearing in future releases of the client library, **and**
11431        /// - New values received dynamically, without application changes.
11432        ///
11433        /// Please consult the [Working with enums] section in the user guide for some
11434        /// guidelines.
11435        ///
11436        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11437        #[derive(Clone, Debug, PartialEq)]
11438        #[non_exhaustive]
11439        pub enum Code {
11440            /// No information available.
11441            Unspecified,
11442            /// The proposed spoke is pending review.
11443            PendingReview,
11444            /// The proposed spoke has been rejected by the hub administrator.
11445            Rejected,
11446            /// The spoke has been deactivated internally.
11447            Paused,
11448            /// Network Connectivity Center encountered errors while accepting
11449            /// the spoke.
11450            Failed,
11451            /// The proposed spoke update is pending review.
11452            UpdatePendingReview,
11453            /// The proposed spoke update has been rejected by the hub administrator.
11454            UpdateRejected,
11455            /// Network Connectivity Center encountered errors while accepting
11456            /// the spoke update.
11457            UpdateFailed,
11458            /// If set, the enum was initialized with an unknown value.
11459            ///
11460            /// Applications can examine the value using [Code::value] or
11461            /// [Code::name].
11462            UnknownValue(code::UnknownValue),
11463        }
11464
11465        #[doc(hidden)]
11466        pub mod code {
11467            #[allow(unused_imports)]
11468            use super::*;
11469            #[derive(Clone, Debug, PartialEq)]
11470            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11471        }
11472
11473        impl Code {
11474            /// Gets the enum value.
11475            ///
11476            /// Returns `None` if the enum contains an unknown value deserialized from
11477            /// the string representation of enums.
11478            pub fn value(&self) -> std::option::Option<i32> {
11479                match self {
11480                    Self::Unspecified => std::option::Option::Some(0),
11481                    Self::PendingReview => std::option::Option::Some(1),
11482                    Self::Rejected => std::option::Option::Some(2),
11483                    Self::Paused => std::option::Option::Some(3),
11484                    Self::Failed => std::option::Option::Some(4),
11485                    Self::UpdatePendingReview => std::option::Option::Some(5),
11486                    Self::UpdateRejected => std::option::Option::Some(6),
11487                    Self::UpdateFailed => std::option::Option::Some(7),
11488                    Self::UnknownValue(u) => u.0.value(),
11489                }
11490            }
11491
11492            /// Gets the enum value as a string.
11493            ///
11494            /// Returns `None` if the enum contains an unknown value deserialized from
11495            /// the integer representation of enums.
11496            pub fn name(&self) -> std::option::Option<&str> {
11497                match self {
11498                    Self::Unspecified => std::option::Option::Some("CODE_UNSPECIFIED"),
11499                    Self::PendingReview => std::option::Option::Some("PENDING_REVIEW"),
11500                    Self::Rejected => std::option::Option::Some("REJECTED"),
11501                    Self::Paused => std::option::Option::Some("PAUSED"),
11502                    Self::Failed => std::option::Option::Some("FAILED"),
11503                    Self::UpdatePendingReview => std::option::Option::Some("UPDATE_PENDING_REVIEW"),
11504                    Self::UpdateRejected => std::option::Option::Some("UPDATE_REJECTED"),
11505                    Self::UpdateFailed => std::option::Option::Some("UPDATE_FAILED"),
11506                    Self::UnknownValue(u) => u.0.name(),
11507                }
11508            }
11509        }
11510
11511        impl std::default::Default for Code {
11512            fn default() -> Self {
11513                use std::convert::From;
11514                Self::from(0)
11515            }
11516        }
11517
11518        impl std::fmt::Display for Code {
11519            fn fmt(
11520                &self,
11521                f: &mut std::fmt::Formatter<'_>,
11522            ) -> std::result::Result<(), std::fmt::Error> {
11523                wkt::internal::display_enum(f, self.name(), self.value())
11524            }
11525        }
11526
11527        impl std::convert::From<i32> for Code {
11528            fn from(value: i32) -> Self {
11529                match value {
11530                    0 => Self::Unspecified,
11531                    1 => Self::PendingReview,
11532                    2 => Self::Rejected,
11533                    3 => Self::Paused,
11534                    4 => Self::Failed,
11535                    5 => Self::UpdatePendingReview,
11536                    6 => Self::UpdateRejected,
11537                    7 => Self::UpdateFailed,
11538                    _ => Self::UnknownValue(code::UnknownValue(
11539                        wkt::internal::UnknownEnumValue::Integer(value),
11540                    )),
11541                }
11542            }
11543        }
11544
11545        impl std::convert::From<&str> for Code {
11546            fn from(value: &str) -> Self {
11547                use std::string::ToString;
11548                match value {
11549                    "CODE_UNSPECIFIED" => Self::Unspecified,
11550                    "PENDING_REVIEW" => Self::PendingReview,
11551                    "REJECTED" => Self::Rejected,
11552                    "PAUSED" => Self::Paused,
11553                    "FAILED" => Self::Failed,
11554                    "UPDATE_PENDING_REVIEW" => Self::UpdatePendingReview,
11555                    "UPDATE_REJECTED" => Self::UpdateRejected,
11556                    "UPDATE_FAILED" => Self::UpdateFailed,
11557                    _ => Self::UnknownValue(code::UnknownValue(
11558                        wkt::internal::UnknownEnumValue::String(value.to_string()),
11559                    )),
11560                }
11561            }
11562        }
11563
11564        impl serde::ser::Serialize for Code {
11565            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11566            where
11567                S: serde::Serializer,
11568            {
11569                match self {
11570                    Self::Unspecified => serializer.serialize_i32(0),
11571                    Self::PendingReview => serializer.serialize_i32(1),
11572                    Self::Rejected => serializer.serialize_i32(2),
11573                    Self::Paused => serializer.serialize_i32(3),
11574                    Self::Failed => serializer.serialize_i32(4),
11575                    Self::UpdatePendingReview => serializer.serialize_i32(5),
11576                    Self::UpdateRejected => serializer.serialize_i32(6),
11577                    Self::UpdateFailed => serializer.serialize_i32(7),
11578                    Self::UnknownValue(u) => u.0.serialize(serializer),
11579                }
11580            }
11581        }
11582
11583        impl<'de> serde::de::Deserialize<'de> for Code {
11584            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11585            where
11586                D: serde::Deserializer<'de>,
11587            {
11588                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Code>::new(
11589                    ".google.cloud.networkconnectivity.v1.Spoke.StateReason.Code",
11590                ))
11591            }
11592        }
11593    }
11594}
11595
11596#[derive(Clone, Default, PartialEq)]
11597#[non_exhaustive]
11598pub struct RouteTable {
11599    /// Immutable. The name of the route table. Route table names must be unique.
11600    /// They use the following form:
11601    /// `projects/{project_number}/locations/global/hubs/{hub}/routeTables/{route_table_id}`
11602    pub name: std::string::String,
11603
11604    /// Output only. The time the route table was created.
11605    pub create_time: std::option::Option<wkt::Timestamp>,
11606
11607    /// Output only. The time the route table was last updated.
11608    pub update_time: std::option::Option<wkt::Timestamp>,
11609
11610    /// Optional labels in key-value pair format. For more information about
11611    /// labels, see [Requirements for
11612    /// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements).
11613    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
11614
11615    /// An optional description of the route table.
11616    pub description: std::string::String,
11617
11618    /// Output only. The Google-generated UUID for the route table. This value is
11619    /// unique across all route table resources. If a route table is deleted and
11620    /// another with the same name is created, the new route table is assigned
11621    /// a different `uid`.
11622    pub uid: std::string::String,
11623
11624    /// Output only. The current lifecycle state of this route table.
11625    pub state: crate::model::State,
11626
11627    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11628}
11629
11630impl RouteTable {
11631    pub fn new() -> Self {
11632        std::default::Default::default()
11633    }
11634
11635    /// Sets the value of [name][crate::model::RouteTable::name].
11636    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11637        self.name = v.into();
11638        self
11639    }
11640
11641    /// Sets the value of [create_time][crate::model::RouteTable::create_time].
11642    pub fn set_create_time<T>(mut self, v: T) -> Self
11643    where
11644        T: std::convert::Into<wkt::Timestamp>,
11645    {
11646        self.create_time = std::option::Option::Some(v.into());
11647        self
11648    }
11649
11650    /// Sets or clears the value of [create_time][crate::model::RouteTable::create_time].
11651    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11652    where
11653        T: std::convert::Into<wkt::Timestamp>,
11654    {
11655        self.create_time = v.map(|x| x.into());
11656        self
11657    }
11658
11659    /// Sets the value of [update_time][crate::model::RouteTable::update_time].
11660    pub fn set_update_time<T>(mut self, v: T) -> Self
11661    where
11662        T: std::convert::Into<wkt::Timestamp>,
11663    {
11664        self.update_time = std::option::Option::Some(v.into());
11665        self
11666    }
11667
11668    /// Sets or clears the value of [update_time][crate::model::RouteTable::update_time].
11669    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11670    where
11671        T: std::convert::Into<wkt::Timestamp>,
11672    {
11673        self.update_time = v.map(|x| x.into());
11674        self
11675    }
11676
11677    /// Sets the value of [labels][crate::model::RouteTable::labels].
11678    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
11679    where
11680        T: std::iter::IntoIterator<Item = (K, V)>,
11681        K: std::convert::Into<std::string::String>,
11682        V: std::convert::Into<std::string::String>,
11683    {
11684        use std::iter::Iterator;
11685        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11686        self
11687    }
11688
11689    /// Sets the value of [description][crate::model::RouteTable::description].
11690    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11691        self.description = v.into();
11692        self
11693    }
11694
11695    /// Sets the value of [uid][crate::model::RouteTable::uid].
11696    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11697        self.uid = v.into();
11698        self
11699    }
11700
11701    /// Sets the value of [state][crate::model::RouteTable::state].
11702    pub fn set_state<T: std::convert::Into<crate::model::State>>(mut self, v: T) -> Self {
11703        self.state = v.into();
11704        self
11705    }
11706}
11707
11708impl wkt::message::Message for RouteTable {
11709    fn typename() -> &'static str {
11710        "type.googleapis.com/google.cloud.networkconnectivity.v1.RouteTable"
11711    }
11712}
11713
11714#[doc(hidden)]
11715impl<'de> serde::de::Deserialize<'de> for RouteTable {
11716    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11717    where
11718        D: serde::Deserializer<'de>,
11719    {
11720        #[allow(non_camel_case_types)]
11721        #[doc(hidden)]
11722        #[derive(PartialEq, Eq, Hash)]
11723        enum __FieldTag {
11724            __name,
11725            __create_time,
11726            __update_time,
11727            __labels,
11728            __description,
11729            __uid,
11730            __state,
11731            Unknown(std::string::String),
11732        }
11733        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11734            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11735            where
11736                D: serde::Deserializer<'de>,
11737            {
11738                struct Visitor;
11739                impl<'de> serde::de::Visitor<'de> for Visitor {
11740                    type Value = __FieldTag;
11741                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11742                        formatter.write_str("a field name for RouteTable")
11743                    }
11744                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11745                    where
11746                        E: serde::de::Error,
11747                    {
11748                        use std::result::Result::Ok;
11749                        use std::string::ToString;
11750                        match value {
11751                            "name" => Ok(__FieldTag::__name),
11752                            "createTime" => Ok(__FieldTag::__create_time),
11753                            "create_time" => Ok(__FieldTag::__create_time),
11754                            "updateTime" => Ok(__FieldTag::__update_time),
11755                            "update_time" => Ok(__FieldTag::__update_time),
11756                            "labels" => Ok(__FieldTag::__labels),
11757                            "description" => Ok(__FieldTag::__description),
11758                            "uid" => Ok(__FieldTag::__uid),
11759                            "state" => Ok(__FieldTag::__state),
11760                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11761                        }
11762                    }
11763                }
11764                deserializer.deserialize_identifier(Visitor)
11765            }
11766        }
11767        struct Visitor;
11768        impl<'de> serde::de::Visitor<'de> for Visitor {
11769            type Value = RouteTable;
11770            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11771                formatter.write_str("struct RouteTable")
11772            }
11773            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11774            where
11775                A: serde::de::MapAccess<'de>,
11776            {
11777                #[allow(unused_imports)]
11778                use serde::de::Error;
11779                use std::option::Option::Some;
11780                let mut fields = std::collections::HashSet::new();
11781                let mut result = Self::Value::new();
11782                while let Some(tag) = map.next_key::<__FieldTag>()? {
11783                    #[allow(clippy::match_single_binding)]
11784                    match tag {
11785                        __FieldTag::__name => {
11786                            if !fields.insert(__FieldTag::__name) {
11787                                return std::result::Result::Err(A::Error::duplicate_field(
11788                                    "multiple values for name",
11789                                ));
11790                            }
11791                            result.name = map
11792                                .next_value::<std::option::Option<std::string::String>>()?
11793                                .unwrap_or_default();
11794                        }
11795                        __FieldTag::__create_time => {
11796                            if !fields.insert(__FieldTag::__create_time) {
11797                                return std::result::Result::Err(A::Error::duplicate_field(
11798                                    "multiple values for create_time",
11799                                ));
11800                            }
11801                            result.create_time =
11802                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
11803                        }
11804                        __FieldTag::__update_time => {
11805                            if !fields.insert(__FieldTag::__update_time) {
11806                                return std::result::Result::Err(A::Error::duplicate_field(
11807                                    "multiple values for update_time",
11808                                ));
11809                            }
11810                            result.update_time =
11811                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
11812                        }
11813                        __FieldTag::__labels => {
11814                            if !fields.insert(__FieldTag::__labels) {
11815                                return std::result::Result::Err(A::Error::duplicate_field(
11816                                    "multiple values for labels",
11817                                ));
11818                            }
11819                            result.labels = map
11820                                .next_value::<std::option::Option<
11821                                    std::collections::HashMap<
11822                                        std::string::String,
11823                                        std::string::String,
11824                                    >,
11825                                >>()?
11826                                .unwrap_or_default();
11827                        }
11828                        __FieldTag::__description => {
11829                            if !fields.insert(__FieldTag::__description) {
11830                                return std::result::Result::Err(A::Error::duplicate_field(
11831                                    "multiple values for description",
11832                                ));
11833                            }
11834                            result.description = map
11835                                .next_value::<std::option::Option<std::string::String>>()?
11836                                .unwrap_or_default();
11837                        }
11838                        __FieldTag::__uid => {
11839                            if !fields.insert(__FieldTag::__uid) {
11840                                return std::result::Result::Err(A::Error::duplicate_field(
11841                                    "multiple values for uid",
11842                                ));
11843                            }
11844                            result.uid = map
11845                                .next_value::<std::option::Option<std::string::String>>()?
11846                                .unwrap_or_default();
11847                        }
11848                        __FieldTag::__state => {
11849                            if !fields.insert(__FieldTag::__state) {
11850                                return std::result::Result::Err(A::Error::duplicate_field(
11851                                    "multiple values for state",
11852                                ));
11853                            }
11854                            result.state = map
11855                                .next_value::<std::option::Option<crate::model::State>>()?
11856                                .unwrap_or_default();
11857                        }
11858                        __FieldTag::Unknown(key) => {
11859                            let value = map.next_value::<serde_json::Value>()?;
11860                            result._unknown_fields.insert(key, value);
11861                        }
11862                    }
11863                }
11864                std::result::Result::Ok(result)
11865            }
11866        }
11867        deserializer.deserialize_any(Visitor)
11868    }
11869}
11870
11871#[doc(hidden)]
11872impl serde::ser::Serialize for RouteTable {
11873    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11874    where
11875        S: serde::ser::Serializer,
11876    {
11877        use serde::ser::SerializeMap;
11878        #[allow(unused_imports)]
11879        use std::option::Option::Some;
11880        let mut state = serializer.serialize_map(std::option::Option::None)?;
11881        if !self.name.is_empty() {
11882            state.serialize_entry("name", &self.name)?;
11883        }
11884        if self.create_time.is_some() {
11885            state.serialize_entry("createTime", &self.create_time)?;
11886        }
11887        if self.update_time.is_some() {
11888            state.serialize_entry("updateTime", &self.update_time)?;
11889        }
11890        if !self.labels.is_empty() {
11891            state.serialize_entry("labels", &self.labels)?;
11892        }
11893        if !self.description.is_empty() {
11894            state.serialize_entry("description", &self.description)?;
11895        }
11896        if !self.uid.is_empty() {
11897            state.serialize_entry("uid", &self.uid)?;
11898        }
11899        if !wkt::internal::is_default(&self.state) {
11900            state.serialize_entry("state", &self.state)?;
11901        }
11902        if !self._unknown_fields.is_empty() {
11903            for (key, value) in self._unknown_fields.iter() {
11904                state.serialize_entry(key, &value)?;
11905            }
11906        }
11907        state.end()
11908    }
11909}
11910
11911impl std::fmt::Debug for RouteTable {
11912    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11913        let mut debug_struct = f.debug_struct("RouteTable");
11914        debug_struct.field("name", &self.name);
11915        debug_struct.field("create_time", &self.create_time);
11916        debug_struct.field("update_time", &self.update_time);
11917        debug_struct.field("labels", &self.labels);
11918        debug_struct.field("description", &self.description);
11919        debug_struct.field("uid", &self.uid);
11920        debug_struct.field("state", &self.state);
11921        if !self._unknown_fields.is_empty() {
11922            debug_struct.field("_unknown_fields", &self._unknown_fields);
11923        }
11924        debug_struct.finish()
11925    }
11926}
11927
11928/// A route defines a path from VM instances within a spoke to a specific
11929/// destination resource. Only VPC spokes have routes.
11930#[derive(Clone, Default, PartialEq)]
11931#[non_exhaustive]
11932pub struct Route {
11933    /// Immutable. The name of the route. Route names must be unique. Route names
11934    /// use the following form:
11935    /// `projects/{project_number}/locations/global/hubs/{hub}/routeTables/{route_table_id}/routes/{route_id}`
11936    pub name: std::string::String,
11937
11938    /// Output only. The time the route was created.
11939    pub create_time: std::option::Option<wkt::Timestamp>,
11940
11941    /// Output only. The time the route was last updated.
11942    pub update_time: std::option::Option<wkt::Timestamp>,
11943
11944    /// The destination IP address range.
11945    pub ip_cidr_range: std::string::String,
11946
11947    /// Output only. The route's type. Its type is determined by the properties of
11948    /// its IP address range.
11949    pub r#type: crate::model::RouteType,
11950
11951    /// Immutable. The destination VPC network for packets on this route.
11952    pub next_hop_vpc_network: std::option::Option<crate::model::NextHopVpcNetwork>,
11953
11954    /// Optional labels in key-value pair format. For more information about
11955    /// labels, see [Requirements for
11956    /// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements).
11957    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
11958
11959    /// An optional description of the route.
11960    pub description: std::string::String,
11961
11962    /// Output only. The Google-generated UUID for the route. This value is unique
11963    /// across all Network Connectivity Center route resources. If a
11964    /// route is deleted and another with the same name is created,
11965    /// the new route is assigned a different `uid`.
11966    pub uid: std::string::String,
11967
11968    /// Output only. The current lifecycle state of the route.
11969    pub state: crate::model::State,
11970
11971    /// Immutable. The spoke that this route leads to.
11972    /// Example: projects/12345/locations/global/spokes/SPOKE
11973    pub spoke: std::string::String,
11974
11975    /// Output only. The origin location of the route.
11976    /// Uses the following form: "projects/{project}/locations/{location}"
11977    /// Example: projects/1234/locations/us-central1
11978    pub location: std::string::String,
11979
11980    /// Output only. The priority of this route. Priority is used to break ties in
11981    /// cases where a destination matches more than one route. In these cases the
11982    /// route with the lowest-numbered priority value wins.
11983    pub priority: i64,
11984
11985    /// Immutable. The next-hop VPN tunnel for packets on this route.
11986    pub next_hop_vpn_tunnel: std::option::Option<crate::model::NextHopVPNTunnel>,
11987
11988    /// Immutable. The next-hop Router appliance instance for packets on this
11989    /// route.
11990    pub next_hop_router_appliance_instance:
11991        std::option::Option<crate::model::NextHopRouterApplianceInstance>,
11992
11993    /// Immutable. The next-hop VLAN attachment for packets on this route.
11994    pub next_hop_interconnect_attachment:
11995        std::option::Option<crate::model::NextHopInterconnectAttachment>,
11996
11997    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11998}
11999
12000impl Route {
12001    pub fn new() -> Self {
12002        std::default::Default::default()
12003    }
12004
12005    /// Sets the value of [name][crate::model::Route::name].
12006    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12007        self.name = v.into();
12008        self
12009    }
12010
12011    /// Sets the value of [create_time][crate::model::Route::create_time].
12012    pub fn set_create_time<T>(mut self, v: T) -> Self
12013    where
12014        T: std::convert::Into<wkt::Timestamp>,
12015    {
12016        self.create_time = std::option::Option::Some(v.into());
12017        self
12018    }
12019
12020    /// Sets or clears the value of [create_time][crate::model::Route::create_time].
12021    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12022    where
12023        T: std::convert::Into<wkt::Timestamp>,
12024    {
12025        self.create_time = v.map(|x| x.into());
12026        self
12027    }
12028
12029    /// Sets the value of [update_time][crate::model::Route::update_time].
12030    pub fn set_update_time<T>(mut self, v: T) -> Self
12031    where
12032        T: std::convert::Into<wkt::Timestamp>,
12033    {
12034        self.update_time = std::option::Option::Some(v.into());
12035        self
12036    }
12037
12038    /// Sets or clears the value of [update_time][crate::model::Route::update_time].
12039    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12040    where
12041        T: std::convert::Into<wkt::Timestamp>,
12042    {
12043        self.update_time = v.map(|x| x.into());
12044        self
12045    }
12046
12047    /// Sets the value of [ip_cidr_range][crate::model::Route::ip_cidr_range].
12048    pub fn set_ip_cidr_range<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12049        self.ip_cidr_range = v.into();
12050        self
12051    }
12052
12053    /// Sets the value of [r#type][crate::model::Route::type].
12054    pub fn set_type<T: std::convert::Into<crate::model::RouteType>>(mut self, v: T) -> Self {
12055        self.r#type = v.into();
12056        self
12057    }
12058
12059    /// Sets the value of [next_hop_vpc_network][crate::model::Route::next_hop_vpc_network].
12060    pub fn set_next_hop_vpc_network<T>(mut self, v: T) -> Self
12061    where
12062        T: std::convert::Into<crate::model::NextHopVpcNetwork>,
12063    {
12064        self.next_hop_vpc_network = std::option::Option::Some(v.into());
12065        self
12066    }
12067
12068    /// Sets or clears the value of [next_hop_vpc_network][crate::model::Route::next_hop_vpc_network].
12069    pub fn set_or_clear_next_hop_vpc_network<T>(mut self, v: std::option::Option<T>) -> Self
12070    where
12071        T: std::convert::Into<crate::model::NextHopVpcNetwork>,
12072    {
12073        self.next_hop_vpc_network = v.map(|x| x.into());
12074        self
12075    }
12076
12077    /// Sets the value of [labels][crate::model::Route::labels].
12078    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
12079    where
12080        T: std::iter::IntoIterator<Item = (K, V)>,
12081        K: std::convert::Into<std::string::String>,
12082        V: std::convert::Into<std::string::String>,
12083    {
12084        use std::iter::Iterator;
12085        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12086        self
12087    }
12088
12089    /// Sets the value of [description][crate::model::Route::description].
12090    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12091        self.description = v.into();
12092        self
12093    }
12094
12095    /// Sets the value of [uid][crate::model::Route::uid].
12096    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12097        self.uid = v.into();
12098        self
12099    }
12100
12101    /// Sets the value of [state][crate::model::Route::state].
12102    pub fn set_state<T: std::convert::Into<crate::model::State>>(mut self, v: T) -> Self {
12103        self.state = v.into();
12104        self
12105    }
12106
12107    /// Sets the value of [spoke][crate::model::Route::spoke].
12108    pub fn set_spoke<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12109        self.spoke = v.into();
12110        self
12111    }
12112
12113    /// Sets the value of [location][crate::model::Route::location].
12114    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12115        self.location = v.into();
12116        self
12117    }
12118
12119    /// Sets the value of [priority][crate::model::Route::priority].
12120    pub fn set_priority<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12121        self.priority = v.into();
12122        self
12123    }
12124
12125    /// Sets the value of [next_hop_vpn_tunnel][crate::model::Route::next_hop_vpn_tunnel].
12126    pub fn set_next_hop_vpn_tunnel<T>(mut self, v: T) -> Self
12127    where
12128        T: std::convert::Into<crate::model::NextHopVPNTunnel>,
12129    {
12130        self.next_hop_vpn_tunnel = std::option::Option::Some(v.into());
12131        self
12132    }
12133
12134    /// Sets or clears the value of [next_hop_vpn_tunnel][crate::model::Route::next_hop_vpn_tunnel].
12135    pub fn set_or_clear_next_hop_vpn_tunnel<T>(mut self, v: std::option::Option<T>) -> Self
12136    where
12137        T: std::convert::Into<crate::model::NextHopVPNTunnel>,
12138    {
12139        self.next_hop_vpn_tunnel = v.map(|x| x.into());
12140        self
12141    }
12142
12143    /// Sets the value of [next_hop_router_appliance_instance][crate::model::Route::next_hop_router_appliance_instance].
12144    pub fn set_next_hop_router_appliance_instance<T>(mut self, v: T) -> Self
12145    where
12146        T: std::convert::Into<crate::model::NextHopRouterApplianceInstance>,
12147    {
12148        self.next_hop_router_appliance_instance = std::option::Option::Some(v.into());
12149        self
12150    }
12151
12152    /// Sets or clears the value of [next_hop_router_appliance_instance][crate::model::Route::next_hop_router_appliance_instance].
12153    pub fn set_or_clear_next_hop_router_appliance_instance<T>(
12154        mut self,
12155        v: std::option::Option<T>,
12156    ) -> Self
12157    where
12158        T: std::convert::Into<crate::model::NextHopRouterApplianceInstance>,
12159    {
12160        self.next_hop_router_appliance_instance = v.map(|x| x.into());
12161        self
12162    }
12163
12164    /// Sets the value of [next_hop_interconnect_attachment][crate::model::Route::next_hop_interconnect_attachment].
12165    pub fn set_next_hop_interconnect_attachment<T>(mut self, v: T) -> Self
12166    where
12167        T: std::convert::Into<crate::model::NextHopInterconnectAttachment>,
12168    {
12169        self.next_hop_interconnect_attachment = std::option::Option::Some(v.into());
12170        self
12171    }
12172
12173    /// Sets or clears the value of [next_hop_interconnect_attachment][crate::model::Route::next_hop_interconnect_attachment].
12174    pub fn set_or_clear_next_hop_interconnect_attachment<T>(
12175        mut self,
12176        v: std::option::Option<T>,
12177    ) -> Self
12178    where
12179        T: std::convert::Into<crate::model::NextHopInterconnectAttachment>,
12180    {
12181        self.next_hop_interconnect_attachment = v.map(|x| x.into());
12182        self
12183    }
12184}
12185
12186impl wkt::message::Message for Route {
12187    fn typename() -> &'static str {
12188        "type.googleapis.com/google.cloud.networkconnectivity.v1.Route"
12189    }
12190}
12191
12192#[doc(hidden)]
12193impl<'de> serde::de::Deserialize<'de> for Route {
12194    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12195    where
12196        D: serde::Deserializer<'de>,
12197    {
12198        #[allow(non_camel_case_types)]
12199        #[doc(hidden)]
12200        #[derive(PartialEq, Eq, Hash)]
12201        enum __FieldTag {
12202            __name,
12203            __create_time,
12204            __update_time,
12205            __ip_cidr_range,
12206            __type,
12207            __next_hop_vpc_network,
12208            __labels,
12209            __description,
12210            __uid,
12211            __state,
12212            __spoke,
12213            __location,
12214            __priority,
12215            __next_hop_vpn_tunnel,
12216            __next_hop_router_appliance_instance,
12217            __next_hop_interconnect_attachment,
12218            Unknown(std::string::String),
12219        }
12220        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12221            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12222            where
12223                D: serde::Deserializer<'de>,
12224            {
12225                struct Visitor;
12226                impl<'de> serde::de::Visitor<'de> for Visitor {
12227                    type Value = __FieldTag;
12228                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12229                        formatter.write_str("a field name for Route")
12230                    }
12231                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12232                    where
12233                        E: serde::de::Error,
12234                    {
12235                        use std::result::Result::Ok;
12236                        use std::string::ToString;
12237                        match value {
12238                            "name" => Ok(__FieldTag::__name),
12239                            "createTime" => Ok(__FieldTag::__create_time),
12240                            "create_time" => Ok(__FieldTag::__create_time),
12241                            "updateTime" => Ok(__FieldTag::__update_time),
12242                            "update_time" => Ok(__FieldTag::__update_time),
12243                            "ipCidrRange" => Ok(__FieldTag::__ip_cidr_range),
12244                            "ip_cidr_range" => Ok(__FieldTag::__ip_cidr_range),
12245                            "type" => Ok(__FieldTag::__type),
12246                            "nextHopVpcNetwork" => Ok(__FieldTag::__next_hop_vpc_network),
12247                            "next_hop_vpc_network" => Ok(__FieldTag::__next_hop_vpc_network),
12248                            "labels" => Ok(__FieldTag::__labels),
12249                            "description" => Ok(__FieldTag::__description),
12250                            "uid" => Ok(__FieldTag::__uid),
12251                            "state" => Ok(__FieldTag::__state),
12252                            "spoke" => Ok(__FieldTag::__spoke),
12253                            "location" => Ok(__FieldTag::__location),
12254                            "priority" => Ok(__FieldTag::__priority),
12255                            "nextHopVpnTunnel" => Ok(__FieldTag::__next_hop_vpn_tunnel),
12256                            "next_hop_vpn_tunnel" => Ok(__FieldTag::__next_hop_vpn_tunnel),
12257                            "nextHopRouterApplianceInstance" => {
12258                                Ok(__FieldTag::__next_hop_router_appliance_instance)
12259                            }
12260                            "next_hop_router_appliance_instance" => {
12261                                Ok(__FieldTag::__next_hop_router_appliance_instance)
12262                            }
12263                            "nextHopInterconnectAttachment" => {
12264                                Ok(__FieldTag::__next_hop_interconnect_attachment)
12265                            }
12266                            "next_hop_interconnect_attachment" => {
12267                                Ok(__FieldTag::__next_hop_interconnect_attachment)
12268                            }
12269                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12270                        }
12271                    }
12272                }
12273                deserializer.deserialize_identifier(Visitor)
12274            }
12275        }
12276        struct Visitor;
12277        impl<'de> serde::de::Visitor<'de> for Visitor {
12278            type Value = Route;
12279            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12280                formatter.write_str("struct Route")
12281            }
12282            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12283            where
12284                A: serde::de::MapAccess<'de>,
12285            {
12286                #[allow(unused_imports)]
12287                use serde::de::Error;
12288                use std::option::Option::Some;
12289                let mut fields = std::collections::HashSet::new();
12290                let mut result = Self::Value::new();
12291                while let Some(tag) = map.next_key::<__FieldTag>()? {
12292                    #[allow(clippy::match_single_binding)]
12293                    match tag {
12294                        __FieldTag::__name => {
12295                            if !fields.insert(__FieldTag::__name) {
12296                                return std::result::Result::Err(A::Error::duplicate_field(
12297                                    "multiple values for name",
12298                                ));
12299                            }
12300                            result.name = map
12301                                .next_value::<std::option::Option<std::string::String>>()?
12302                                .unwrap_or_default();
12303                        }
12304                        __FieldTag::__create_time => {
12305                            if !fields.insert(__FieldTag::__create_time) {
12306                                return std::result::Result::Err(A::Error::duplicate_field(
12307                                    "multiple values for create_time",
12308                                ));
12309                            }
12310                            result.create_time =
12311                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
12312                        }
12313                        __FieldTag::__update_time => {
12314                            if !fields.insert(__FieldTag::__update_time) {
12315                                return std::result::Result::Err(A::Error::duplicate_field(
12316                                    "multiple values for update_time",
12317                                ));
12318                            }
12319                            result.update_time =
12320                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
12321                        }
12322                        __FieldTag::__ip_cidr_range => {
12323                            if !fields.insert(__FieldTag::__ip_cidr_range) {
12324                                return std::result::Result::Err(A::Error::duplicate_field(
12325                                    "multiple values for ip_cidr_range",
12326                                ));
12327                            }
12328                            result.ip_cidr_range = map
12329                                .next_value::<std::option::Option<std::string::String>>()?
12330                                .unwrap_or_default();
12331                        }
12332                        __FieldTag::__type => {
12333                            if !fields.insert(__FieldTag::__type) {
12334                                return std::result::Result::Err(A::Error::duplicate_field(
12335                                    "multiple values for type",
12336                                ));
12337                            }
12338                            result.r#type = map
12339                                .next_value::<std::option::Option<crate::model::RouteType>>()?
12340                                .unwrap_or_default();
12341                        }
12342                        __FieldTag::__next_hop_vpc_network => {
12343                            if !fields.insert(__FieldTag::__next_hop_vpc_network) {
12344                                return std::result::Result::Err(A::Error::duplicate_field(
12345                                    "multiple values for next_hop_vpc_network",
12346                                ));
12347                            }
12348                            result.next_hop_vpc_network = map
12349                                .next_value::<std::option::Option<crate::model::NextHopVpcNetwork>>(
12350                                )?;
12351                        }
12352                        __FieldTag::__labels => {
12353                            if !fields.insert(__FieldTag::__labels) {
12354                                return std::result::Result::Err(A::Error::duplicate_field(
12355                                    "multiple values for labels",
12356                                ));
12357                            }
12358                            result.labels = map
12359                                .next_value::<std::option::Option<
12360                                    std::collections::HashMap<
12361                                        std::string::String,
12362                                        std::string::String,
12363                                    >,
12364                                >>()?
12365                                .unwrap_or_default();
12366                        }
12367                        __FieldTag::__description => {
12368                            if !fields.insert(__FieldTag::__description) {
12369                                return std::result::Result::Err(A::Error::duplicate_field(
12370                                    "multiple values for description",
12371                                ));
12372                            }
12373                            result.description = map
12374                                .next_value::<std::option::Option<std::string::String>>()?
12375                                .unwrap_or_default();
12376                        }
12377                        __FieldTag::__uid => {
12378                            if !fields.insert(__FieldTag::__uid) {
12379                                return std::result::Result::Err(A::Error::duplicate_field(
12380                                    "multiple values for uid",
12381                                ));
12382                            }
12383                            result.uid = map
12384                                .next_value::<std::option::Option<std::string::String>>()?
12385                                .unwrap_or_default();
12386                        }
12387                        __FieldTag::__state => {
12388                            if !fields.insert(__FieldTag::__state) {
12389                                return std::result::Result::Err(A::Error::duplicate_field(
12390                                    "multiple values for state",
12391                                ));
12392                            }
12393                            result.state = map
12394                                .next_value::<std::option::Option<crate::model::State>>()?
12395                                .unwrap_or_default();
12396                        }
12397                        __FieldTag::__spoke => {
12398                            if !fields.insert(__FieldTag::__spoke) {
12399                                return std::result::Result::Err(A::Error::duplicate_field(
12400                                    "multiple values for spoke",
12401                                ));
12402                            }
12403                            result.spoke = map
12404                                .next_value::<std::option::Option<std::string::String>>()?
12405                                .unwrap_or_default();
12406                        }
12407                        __FieldTag::__location => {
12408                            if !fields.insert(__FieldTag::__location) {
12409                                return std::result::Result::Err(A::Error::duplicate_field(
12410                                    "multiple values for location",
12411                                ));
12412                            }
12413                            result.location = map
12414                                .next_value::<std::option::Option<std::string::String>>()?
12415                                .unwrap_or_default();
12416                        }
12417                        __FieldTag::__priority => {
12418                            if !fields.insert(__FieldTag::__priority) {
12419                                return std::result::Result::Err(A::Error::duplicate_field(
12420                                    "multiple values for priority",
12421                                ));
12422                            }
12423                            struct __With(std::option::Option<i64>);
12424                            impl<'de> serde::de::Deserialize<'de> for __With {
12425                                fn deserialize<D>(
12426                                    deserializer: D,
12427                                ) -> std::result::Result<Self, D::Error>
12428                                where
12429                                    D: serde::de::Deserializer<'de>,
12430                                {
12431                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
12432                                }
12433                            }
12434                            result.priority = map.next_value::<__With>()?.0.unwrap_or_default();
12435                        }
12436                        __FieldTag::__next_hop_vpn_tunnel => {
12437                            if !fields.insert(__FieldTag::__next_hop_vpn_tunnel) {
12438                                return std::result::Result::Err(A::Error::duplicate_field(
12439                                    "multiple values for next_hop_vpn_tunnel",
12440                                ));
12441                            }
12442                            result.next_hop_vpn_tunnel = map
12443                                .next_value::<std::option::Option<crate::model::NextHopVPNTunnel>>(
12444                                )?;
12445                        }
12446                        __FieldTag::__next_hop_router_appliance_instance => {
12447                            if !fields.insert(__FieldTag::__next_hop_router_appliance_instance) {
12448                                return std::result::Result::Err(A::Error::duplicate_field(
12449                                    "multiple values for next_hop_router_appliance_instance",
12450                                ));
12451                            }
12452                            result.next_hop_router_appliance_instance =
12453                                map.next_value::<std::option::Option<
12454                                    crate::model::NextHopRouterApplianceInstance,
12455                                >>()?;
12456                        }
12457                        __FieldTag::__next_hop_interconnect_attachment => {
12458                            if !fields.insert(__FieldTag::__next_hop_interconnect_attachment) {
12459                                return std::result::Result::Err(A::Error::duplicate_field(
12460                                    "multiple values for next_hop_interconnect_attachment",
12461                                ));
12462                            }
12463                            result.next_hop_interconnect_attachment =
12464                                map.next_value::<std::option::Option<
12465                                    crate::model::NextHopInterconnectAttachment,
12466                                >>()?;
12467                        }
12468                        __FieldTag::Unknown(key) => {
12469                            let value = map.next_value::<serde_json::Value>()?;
12470                            result._unknown_fields.insert(key, value);
12471                        }
12472                    }
12473                }
12474                std::result::Result::Ok(result)
12475            }
12476        }
12477        deserializer.deserialize_any(Visitor)
12478    }
12479}
12480
12481#[doc(hidden)]
12482impl serde::ser::Serialize for Route {
12483    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12484    where
12485        S: serde::ser::Serializer,
12486    {
12487        use serde::ser::SerializeMap;
12488        #[allow(unused_imports)]
12489        use std::option::Option::Some;
12490        let mut state = serializer.serialize_map(std::option::Option::None)?;
12491        if !self.name.is_empty() {
12492            state.serialize_entry("name", &self.name)?;
12493        }
12494        if self.create_time.is_some() {
12495            state.serialize_entry("createTime", &self.create_time)?;
12496        }
12497        if self.update_time.is_some() {
12498            state.serialize_entry("updateTime", &self.update_time)?;
12499        }
12500        if !self.ip_cidr_range.is_empty() {
12501            state.serialize_entry("ipCidrRange", &self.ip_cidr_range)?;
12502        }
12503        if !wkt::internal::is_default(&self.r#type) {
12504            state.serialize_entry("type", &self.r#type)?;
12505        }
12506        if self.next_hop_vpc_network.is_some() {
12507            state.serialize_entry("nextHopVpcNetwork", &self.next_hop_vpc_network)?;
12508        }
12509        if !self.labels.is_empty() {
12510            state.serialize_entry("labels", &self.labels)?;
12511        }
12512        if !self.description.is_empty() {
12513            state.serialize_entry("description", &self.description)?;
12514        }
12515        if !self.uid.is_empty() {
12516            state.serialize_entry("uid", &self.uid)?;
12517        }
12518        if !wkt::internal::is_default(&self.state) {
12519            state.serialize_entry("state", &self.state)?;
12520        }
12521        if !self.spoke.is_empty() {
12522            state.serialize_entry("spoke", &self.spoke)?;
12523        }
12524        if !self.location.is_empty() {
12525            state.serialize_entry("location", &self.location)?;
12526        }
12527        if !wkt::internal::is_default(&self.priority) {
12528            struct __With<'a>(&'a i64);
12529            impl<'a> serde::ser::Serialize for __With<'a> {
12530                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12531                where
12532                    S: serde::ser::Serializer,
12533                {
12534                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
12535                }
12536            }
12537            state.serialize_entry("priority", &__With(&self.priority))?;
12538        }
12539        if self.next_hop_vpn_tunnel.is_some() {
12540            state.serialize_entry("nextHopVpnTunnel", &self.next_hop_vpn_tunnel)?;
12541        }
12542        if self.next_hop_router_appliance_instance.is_some() {
12543            state.serialize_entry(
12544                "nextHopRouterApplianceInstance",
12545                &self.next_hop_router_appliance_instance,
12546            )?;
12547        }
12548        if self.next_hop_interconnect_attachment.is_some() {
12549            state.serialize_entry(
12550                "nextHopInterconnectAttachment",
12551                &self.next_hop_interconnect_attachment,
12552            )?;
12553        }
12554        if !self._unknown_fields.is_empty() {
12555            for (key, value) in self._unknown_fields.iter() {
12556                state.serialize_entry(key, &value)?;
12557            }
12558        }
12559        state.end()
12560    }
12561}
12562
12563impl std::fmt::Debug for Route {
12564    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12565        let mut debug_struct = f.debug_struct("Route");
12566        debug_struct.field("name", &self.name);
12567        debug_struct.field("create_time", &self.create_time);
12568        debug_struct.field("update_time", &self.update_time);
12569        debug_struct.field("ip_cidr_range", &self.ip_cidr_range);
12570        debug_struct.field("r#type", &self.r#type);
12571        debug_struct.field("next_hop_vpc_network", &self.next_hop_vpc_network);
12572        debug_struct.field("labels", &self.labels);
12573        debug_struct.field("description", &self.description);
12574        debug_struct.field("uid", &self.uid);
12575        debug_struct.field("state", &self.state);
12576        debug_struct.field("spoke", &self.spoke);
12577        debug_struct.field("location", &self.location);
12578        debug_struct.field("priority", &self.priority);
12579        debug_struct.field("next_hop_vpn_tunnel", &self.next_hop_vpn_tunnel);
12580        debug_struct.field(
12581            "next_hop_router_appliance_instance",
12582            &self.next_hop_router_appliance_instance,
12583        );
12584        debug_struct.field(
12585            "next_hop_interconnect_attachment",
12586            &self.next_hop_interconnect_attachment,
12587        );
12588        if !self._unknown_fields.is_empty() {
12589            debug_struct.field("_unknown_fields", &self._unknown_fields);
12590        }
12591        debug_struct.finish()
12592    }
12593}
12594
12595/// A group represents a subset of spokes attached to a hub.
12596#[derive(Clone, Default, PartialEq)]
12597#[non_exhaustive]
12598pub struct Group {
12599    /// Immutable. The name of the group. Group names must be unique. They
12600    /// use the following form:
12601    /// `projects/{project_number}/locations/global/hubs/{hub}/groups/{group_id}`
12602    pub name: std::string::String,
12603
12604    /// Output only. The time the group was created.
12605    pub create_time: std::option::Option<wkt::Timestamp>,
12606
12607    /// Output only. The time the group was last updated.
12608    pub update_time: std::option::Option<wkt::Timestamp>,
12609
12610    /// Optional. Labels in key-value pair format. For more information about
12611    /// labels, see [Requirements for
12612    /// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements).
12613    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
12614
12615    /// Optional. The description of the group.
12616    pub description: std::string::String,
12617
12618    /// Output only. The Google-generated UUID for the group. This value is unique
12619    /// across all group resources. If a group is deleted and
12620    /// another with the same name is created, the new route table is assigned
12621    /// a different unique_id.
12622    pub uid: std::string::String,
12623
12624    /// Output only. The current lifecycle state of this group.
12625    pub state: crate::model::State,
12626
12627    /// Optional. The auto-accept setting for this group.
12628    pub auto_accept: std::option::Option<crate::model::AutoAccept>,
12629
12630    /// Output only. The name of the route table that corresponds to this group.
12631    /// They use the following form:
12632    /// `projects/{project_number}/locations/global/hubs/{hub_id}/routeTables/{route_table_id}`
12633    pub route_table: std::string::String,
12634
12635    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12636}
12637
12638impl Group {
12639    pub fn new() -> Self {
12640        std::default::Default::default()
12641    }
12642
12643    /// Sets the value of [name][crate::model::Group::name].
12644    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12645        self.name = v.into();
12646        self
12647    }
12648
12649    /// Sets the value of [create_time][crate::model::Group::create_time].
12650    pub fn set_create_time<T>(mut self, v: T) -> Self
12651    where
12652        T: std::convert::Into<wkt::Timestamp>,
12653    {
12654        self.create_time = std::option::Option::Some(v.into());
12655        self
12656    }
12657
12658    /// Sets or clears the value of [create_time][crate::model::Group::create_time].
12659    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12660    where
12661        T: std::convert::Into<wkt::Timestamp>,
12662    {
12663        self.create_time = v.map(|x| x.into());
12664        self
12665    }
12666
12667    /// Sets the value of [update_time][crate::model::Group::update_time].
12668    pub fn set_update_time<T>(mut self, v: T) -> Self
12669    where
12670        T: std::convert::Into<wkt::Timestamp>,
12671    {
12672        self.update_time = std::option::Option::Some(v.into());
12673        self
12674    }
12675
12676    /// Sets or clears the value of [update_time][crate::model::Group::update_time].
12677    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12678    where
12679        T: std::convert::Into<wkt::Timestamp>,
12680    {
12681        self.update_time = v.map(|x| x.into());
12682        self
12683    }
12684
12685    /// Sets the value of [labels][crate::model::Group::labels].
12686    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
12687    where
12688        T: std::iter::IntoIterator<Item = (K, V)>,
12689        K: std::convert::Into<std::string::String>,
12690        V: std::convert::Into<std::string::String>,
12691    {
12692        use std::iter::Iterator;
12693        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12694        self
12695    }
12696
12697    /// Sets the value of [description][crate::model::Group::description].
12698    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12699        self.description = v.into();
12700        self
12701    }
12702
12703    /// Sets the value of [uid][crate::model::Group::uid].
12704    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12705        self.uid = v.into();
12706        self
12707    }
12708
12709    /// Sets the value of [state][crate::model::Group::state].
12710    pub fn set_state<T: std::convert::Into<crate::model::State>>(mut self, v: T) -> Self {
12711        self.state = v.into();
12712        self
12713    }
12714
12715    /// Sets the value of [auto_accept][crate::model::Group::auto_accept].
12716    pub fn set_auto_accept<T>(mut self, v: T) -> Self
12717    where
12718        T: std::convert::Into<crate::model::AutoAccept>,
12719    {
12720        self.auto_accept = std::option::Option::Some(v.into());
12721        self
12722    }
12723
12724    /// Sets or clears the value of [auto_accept][crate::model::Group::auto_accept].
12725    pub fn set_or_clear_auto_accept<T>(mut self, v: std::option::Option<T>) -> Self
12726    where
12727        T: std::convert::Into<crate::model::AutoAccept>,
12728    {
12729        self.auto_accept = v.map(|x| x.into());
12730        self
12731    }
12732
12733    /// Sets the value of [route_table][crate::model::Group::route_table].
12734    pub fn set_route_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12735        self.route_table = v.into();
12736        self
12737    }
12738}
12739
12740impl wkt::message::Message for Group {
12741    fn typename() -> &'static str {
12742        "type.googleapis.com/google.cloud.networkconnectivity.v1.Group"
12743    }
12744}
12745
12746#[doc(hidden)]
12747impl<'de> serde::de::Deserialize<'de> for Group {
12748    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12749    where
12750        D: serde::Deserializer<'de>,
12751    {
12752        #[allow(non_camel_case_types)]
12753        #[doc(hidden)]
12754        #[derive(PartialEq, Eq, Hash)]
12755        enum __FieldTag {
12756            __name,
12757            __create_time,
12758            __update_time,
12759            __labels,
12760            __description,
12761            __uid,
12762            __state,
12763            __auto_accept,
12764            __route_table,
12765            Unknown(std::string::String),
12766        }
12767        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12768            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12769            where
12770                D: serde::Deserializer<'de>,
12771            {
12772                struct Visitor;
12773                impl<'de> serde::de::Visitor<'de> for Visitor {
12774                    type Value = __FieldTag;
12775                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12776                        formatter.write_str("a field name for Group")
12777                    }
12778                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12779                    where
12780                        E: serde::de::Error,
12781                    {
12782                        use std::result::Result::Ok;
12783                        use std::string::ToString;
12784                        match value {
12785                            "name" => Ok(__FieldTag::__name),
12786                            "createTime" => Ok(__FieldTag::__create_time),
12787                            "create_time" => Ok(__FieldTag::__create_time),
12788                            "updateTime" => Ok(__FieldTag::__update_time),
12789                            "update_time" => Ok(__FieldTag::__update_time),
12790                            "labels" => Ok(__FieldTag::__labels),
12791                            "description" => Ok(__FieldTag::__description),
12792                            "uid" => Ok(__FieldTag::__uid),
12793                            "state" => Ok(__FieldTag::__state),
12794                            "autoAccept" => Ok(__FieldTag::__auto_accept),
12795                            "auto_accept" => Ok(__FieldTag::__auto_accept),
12796                            "routeTable" => Ok(__FieldTag::__route_table),
12797                            "route_table" => Ok(__FieldTag::__route_table),
12798                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12799                        }
12800                    }
12801                }
12802                deserializer.deserialize_identifier(Visitor)
12803            }
12804        }
12805        struct Visitor;
12806        impl<'de> serde::de::Visitor<'de> for Visitor {
12807            type Value = Group;
12808            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12809                formatter.write_str("struct Group")
12810            }
12811            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12812            where
12813                A: serde::de::MapAccess<'de>,
12814            {
12815                #[allow(unused_imports)]
12816                use serde::de::Error;
12817                use std::option::Option::Some;
12818                let mut fields = std::collections::HashSet::new();
12819                let mut result = Self::Value::new();
12820                while let Some(tag) = map.next_key::<__FieldTag>()? {
12821                    #[allow(clippy::match_single_binding)]
12822                    match tag {
12823                        __FieldTag::__name => {
12824                            if !fields.insert(__FieldTag::__name) {
12825                                return std::result::Result::Err(A::Error::duplicate_field(
12826                                    "multiple values for name",
12827                                ));
12828                            }
12829                            result.name = map
12830                                .next_value::<std::option::Option<std::string::String>>()?
12831                                .unwrap_or_default();
12832                        }
12833                        __FieldTag::__create_time => {
12834                            if !fields.insert(__FieldTag::__create_time) {
12835                                return std::result::Result::Err(A::Error::duplicate_field(
12836                                    "multiple values for create_time",
12837                                ));
12838                            }
12839                            result.create_time =
12840                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
12841                        }
12842                        __FieldTag::__update_time => {
12843                            if !fields.insert(__FieldTag::__update_time) {
12844                                return std::result::Result::Err(A::Error::duplicate_field(
12845                                    "multiple values for update_time",
12846                                ));
12847                            }
12848                            result.update_time =
12849                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
12850                        }
12851                        __FieldTag::__labels => {
12852                            if !fields.insert(__FieldTag::__labels) {
12853                                return std::result::Result::Err(A::Error::duplicate_field(
12854                                    "multiple values for labels",
12855                                ));
12856                            }
12857                            result.labels = map
12858                                .next_value::<std::option::Option<
12859                                    std::collections::HashMap<
12860                                        std::string::String,
12861                                        std::string::String,
12862                                    >,
12863                                >>()?
12864                                .unwrap_or_default();
12865                        }
12866                        __FieldTag::__description => {
12867                            if !fields.insert(__FieldTag::__description) {
12868                                return std::result::Result::Err(A::Error::duplicate_field(
12869                                    "multiple values for description",
12870                                ));
12871                            }
12872                            result.description = map
12873                                .next_value::<std::option::Option<std::string::String>>()?
12874                                .unwrap_or_default();
12875                        }
12876                        __FieldTag::__uid => {
12877                            if !fields.insert(__FieldTag::__uid) {
12878                                return std::result::Result::Err(A::Error::duplicate_field(
12879                                    "multiple values for uid",
12880                                ));
12881                            }
12882                            result.uid = map
12883                                .next_value::<std::option::Option<std::string::String>>()?
12884                                .unwrap_or_default();
12885                        }
12886                        __FieldTag::__state => {
12887                            if !fields.insert(__FieldTag::__state) {
12888                                return std::result::Result::Err(A::Error::duplicate_field(
12889                                    "multiple values for state",
12890                                ));
12891                            }
12892                            result.state = map
12893                                .next_value::<std::option::Option<crate::model::State>>()?
12894                                .unwrap_or_default();
12895                        }
12896                        __FieldTag::__auto_accept => {
12897                            if !fields.insert(__FieldTag::__auto_accept) {
12898                                return std::result::Result::Err(A::Error::duplicate_field(
12899                                    "multiple values for auto_accept",
12900                                ));
12901                            }
12902                            result.auto_accept =
12903                                map.next_value::<std::option::Option<crate::model::AutoAccept>>()?;
12904                        }
12905                        __FieldTag::__route_table => {
12906                            if !fields.insert(__FieldTag::__route_table) {
12907                                return std::result::Result::Err(A::Error::duplicate_field(
12908                                    "multiple values for route_table",
12909                                ));
12910                            }
12911                            result.route_table = map
12912                                .next_value::<std::option::Option<std::string::String>>()?
12913                                .unwrap_or_default();
12914                        }
12915                        __FieldTag::Unknown(key) => {
12916                            let value = map.next_value::<serde_json::Value>()?;
12917                            result._unknown_fields.insert(key, value);
12918                        }
12919                    }
12920                }
12921                std::result::Result::Ok(result)
12922            }
12923        }
12924        deserializer.deserialize_any(Visitor)
12925    }
12926}
12927
12928#[doc(hidden)]
12929impl serde::ser::Serialize for Group {
12930    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12931    where
12932        S: serde::ser::Serializer,
12933    {
12934        use serde::ser::SerializeMap;
12935        #[allow(unused_imports)]
12936        use std::option::Option::Some;
12937        let mut state = serializer.serialize_map(std::option::Option::None)?;
12938        if !self.name.is_empty() {
12939            state.serialize_entry("name", &self.name)?;
12940        }
12941        if self.create_time.is_some() {
12942            state.serialize_entry("createTime", &self.create_time)?;
12943        }
12944        if self.update_time.is_some() {
12945            state.serialize_entry("updateTime", &self.update_time)?;
12946        }
12947        if !self.labels.is_empty() {
12948            state.serialize_entry("labels", &self.labels)?;
12949        }
12950        if !self.description.is_empty() {
12951            state.serialize_entry("description", &self.description)?;
12952        }
12953        if !self.uid.is_empty() {
12954            state.serialize_entry("uid", &self.uid)?;
12955        }
12956        if !wkt::internal::is_default(&self.state) {
12957            state.serialize_entry("state", &self.state)?;
12958        }
12959        if self.auto_accept.is_some() {
12960            state.serialize_entry("autoAccept", &self.auto_accept)?;
12961        }
12962        if !self.route_table.is_empty() {
12963            state.serialize_entry("routeTable", &self.route_table)?;
12964        }
12965        if !self._unknown_fields.is_empty() {
12966            for (key, value) in self._unknown_fields.iter() {
12967                state.serialize_entry(key, &value)?;
12968            }
12969        }
12970        state.end()
12971    }
12972}
12973
12974impl std::fmt::Debug for Group {
12975    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12976        let mut debug_struct = f.debug_struct("Group");
12977        debug_struct.field("name", &self.name);
12978        debug_struct.field("create_time", &self.create_time);
12979        debug_struct.field("update_time", &self.update_time);
12980        debug_struct.field("labels", &self.labels);
12981        debug_struct.field("description", &self.description);
12982        debug_struct.field("uid", &self.uid);
12983        debug_struct.field("state", &self.state);
12984        debug_struct.field("auto_accept", &self.auto_accept);
12985        debug_struct.field("route_table", &self.route_table);
12986        if !self._unknown_fields.is_empty() {
12987            debug_struct.field("_unknown_fields", &self._unknown_fields);
12988        }
12989        debug_struct.finish()
12990    }
12991}
12992
12993/// The auto-accept setting for a group controls whether
12994/// proposed spokes are automatically attached to the hub. If auto-accept is
12995/// enabled, the spoke immediately is attached to the hub and becomes part of the
12996/// group. In this case, the new spoke is in the ACTIVE state.
12997/// If auto-accept is disabled, the spoke goes to the INACTIVE
12998/// state, and it must be reviewed and accepted by a hub
12999/// administrator.
13000#[derive(Clone, Default, PartialEq)]
13001#[non_exhaustive]
13002pub struct AutoAccept {
13003    /// Optional. A list of project ids or project numbers for which you want
13004    /// to enable auto-accept. The auto-accept setting is applied to
13005    /// spokes being created or updated in these projects.
13006    pub auto_accept_projects: std::vec::Vec<std::string::String>,
13007
13008    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13009}
13010
13011impl AutoAccept {
13012    pub fn new() -> Self {
13013        std::default::Default::default()
13014    }
13015
13016    /// Sets the value of [auto_accept_projects][crate::model::AutoAccept::auto_accept_projects].
13017    pub fn set_auto_accept_projects<T, V>(mut self, v: T) -> Self
13018    where
13019        T: std::iter::IntoIterator<Item = V>,
13020        V: std::convert::Into<std::string::String>,
13021    {
13022        use std::iter::Iterator;
13023        self.auto_accept_projects = v.into_iter().map(|i| i.into()).collect();
13024        self
13025    }
13026}
13027
13028impl wkt::message::Message for AutoAccept {
13029    fn typename() -> &'static str {
13030        "type.googleapis.com/google.cloud.networkconnectivity.v1.AutoAccept"
13031    }
13032}
13033
13034#[doc(hidden)]
13035impl<'de> serde::de::Deserialize<'de> for AutoAccept {
13036    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13037    where
13038        D: serde::Deserializer<'de>,
13039    {
13040        #[allow(non_camel_case_types)]
13041        #[doc(hidden)]
13042        #[derive(PartialEq, Eq, Hash)]
13043        enum __FieldTag {
13044            __auto_accept_projects,
13045            Unknown(std::string::String),
13046        }
13047        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13048            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13049            where
13050                D: serde::Deserializer<'de>,
13051            {
13052                struct Visitor;
13053                impl<'de> serde::de::Visitor<'de> for Visitor {
13054                    type Value = __FieldTag;
13055                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13056                        formatter.write_str("a field name for AutoAccept")
13057                    }
13058                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13059                    where
13060                        E: serde::de::Error,
13061                    {
13062                        use std::result::Result::Ok;
13063                        use std::string::ToString;
13064                        match value {
13065                            "autoAcceptProjects" => Ok(__FieldTag::__auto_accept_projects),
13066                            "auto_accept_projects" => Ok(__FieldTag::__auto_accept_projects),
13067                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13068                        }
13069                    }
13070                }
13071                deserializer.deserialize_identifier(Visitor)
13072            }
13073        }
13074        struct Visitor;
13075        impl<'de> serde::de::Visitor<'de> for Visitor {
13076            type Value = AutoAccept;
13077            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13078                formatter.write_str("struct AutoAccept")
13079            }
13080            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13081            where
13082                A: serde::de::MapAccess<'de>,
13083            {
13084                #[allow(unused_imports)]
13085                use serde::de::Error;
13086                use std::option::Option::Some;
13087                let mut fields = std::collections::HashSet::new();
13088                let mut result = Self::Value::new();
13089                while let Some(tag) = map.next_key::<__FieldTag>()? {
13090                    #[allow(clippy::match_single_binding)]
13091                    match tag {
13092                        __FieldTag::__auto_accept_projects => {
13093                            if !fields.insert(__FieldTag::__auto_accept_projects) {
13094                                return std::result::Result::Err(A::Error::duplicate_field(
13095                                    "multiple values for auto_accept_projects",
13096                                ));
13097                            }
13098                            result.auto_accept_projects = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
13099                        }
13100                        __FieldTag::Unknown(key) => {
13101                            let value = map.next_value::<serde_json::Value>()?;
13102                            result._unknown_fields.insert(key, value);
13103                        }
13104                    }
13105                }
13106                std::result::Result::Ok(result)
13107            }
13108        }
13109        deserializer.deserialize_any(Visitor)
13110    }
13111}
13112
13113#[doc(hidden)]
13114impl serde::ser::Serialize for AutoAccept {
13115    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13116    where
13117        S: serde::ser::Serializer,
13118    {
13119        use serde::ser::SerializeMap;
13120        #[allow(unused_imports)]
13121        use std::option::Option::Some;
13122        let mut state = serializer.serialize_map(std::option::Option::None)?;
13123        if !self.auto_accept_projects.is_empty() {
13124            state.serialize_entry("autoAcceptProjects", &self.auto_accept_projects)?;
13125        }
13126        if !self._unknown_fields.is_empty() {
13127            for (key, value) in self._unknown_fields.iter() {
13128                state.serialize_entry(key, &value)?;
13129            }
13130        }
13131        state.end()
13132    }
13133}
13134
13135impl std::fmt::Debug for AutoAccept {
13136    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13137        let mut debug_struct = f.debug_struct("AutoAccept");
13138        debug_struct.field("auto_accept_projects", &self.auto_accept_projects);
13139        if !self._unknown_fields.is_empty() {
13140            debug_struct.field("_unknown_fields", &self._unknown_fields);
13141        }
13142        debug_struct.finish()
13143    }
13144}
13145
13146/// Request for
13147/// [HubService.ListHubs][google.cloud.networkconnectivity.v1.HubService.ListHubs]
13148/// method.
13149///
13150/// [google.cloud.networkconnectivity.v1.HubService.ListHubs]: crate::client::HubService::list_hubs
13151#[derive(Clone, Default, PartialEq)]
13152#[non_exhaustive]
13153pub struct ListHubsRequest {
13154    /// Required. The parent resource's name.
13155    pub parent: std::string::String,
13156
13157    /// The maximum number of results per page to return.
13158    pub page_size: i32,
13159
13160    /// The page token.
13161    pub page_token: std::string::String,
13162
13163    /// An expression that filters the list of results.
13164    pub filter: std::string::String,
13165
13166    /// Sort the results by a certain order.
13167    pub order_by: std::string::String,
13168
13169    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13170}
13171
13172impl ListHubsRequest {
13173    pub fn new() -> Self {
13174        std::default::Default::default()
13175    }
13176
13177    /// Sets the value of [parent][crate::model::ListHubsRequest::parent].
13178    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13179        self.parent = v.into();
13180        self
13181    }
13182
13183    /// Sets the value of [page_size][crate::model::ListHubsRequest::page_size].
13184    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13185        self.page_size = v.into();
13186        self
13187    }
13188
13189    /// Sets the value of [page_token][crate::model::ListHubsRequest::page_token].
13190    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13191        self.page_token = v.into();
13192        self
13193    }
13194
13195    /// Sets the value of [filter][crate::model::ListHubsRequest::filter].
13196    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13197        self.filter = v.into();
13198        self
13199    }
13200
13201    /// Sets the value of [order_by][crate::model::ListHubsRequest::order_by].
13202    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13203        self.order_by = v.into();
13204        self
13205    }
13206}
13207
13208impl wkt::message::Message for ListHubsRequest {
13209    fn typename() -> &'static str {
13210        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListHubsRequest"
13211    }
13212}
13213
13214#[doc(hidden)]
13215impl<'de> serde::de::Deserialize<'de> for ListHubsRequest {
13216    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13217    where
13218        D: serde::Deserializer<'de>,
13219    {
13220        #[allow(non_camel_case_types)]
13221        #[doc(hidden)]
13222        #[derive(PartialEq, Eq, Hash)]
13223        enum __FieldTag {
13224            __parent,
13225            __page_size,
13226            __page_token,
13227            __filter,
13228            __order_by,
13229            Unknown(std::string::String),
13230        }
13231        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13232            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13233            where
13234                D: serde::Deserializer<'de>,
13235            {
13236                struct Visitor;
13237                impl<'de> serde::de::Visitor<'de> for Visitor {
13238                    type Value = __FieldTag;
13239                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13240                        formatter.write_str("a field name for ListHubsRequest")
13241                    }
13242                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13243                    where
13244                        E: serde::de::Error,
13245                    {
13246                        use std::result::Result::Ok;
13247                        use std::string::ToString;
13248                        match value {
13249                            "parent" => Ok(__FieldTag::__parent),
13250                            "pageSize" => Ok(__FieldTag::__page_size),
13251                            "page_size" => Ok(__FieldTag::__page_size),
13252                            "pageToken" => Ok(__FieldTag::__page_token),
13253                            "page_token" => Ok(__FieldTag::__page_token),
13254                            "filter" => Ok(__FieldTag::__filter),
13255                            "orderBy" => Ok(__FieldTag::__order_by),
13256                            "order_by" => Ok(__FieldTag::__order_by),
13257                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13258                        }
13259                    }
13260                }
13261                deserializer.deserialize_identifier(Visitor)
13262            }
13263        }
13264        struct Visitor;
13265        impl<'de> serde::de::Visitor<'de> for Visitor {
13266            type Value = ListHubsRequest;
13267            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13268                formatter.write_str("struct ListHubsRequest")
13269            }
13270            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13271            where
13272                A: serde::de::MapAccess<'de>,
13273            {
13274                #[allow(unused_imports)]
13275                use serde::de::Error;
13276                use std::option::Option::Some;
13277                let mut fields = std::collections::HashSet::new();
13278                let mut result = Self::Value::new();
13279                while let Some(tag) = map.next_key::<__FieldTag>()? {
13280                    #[allow(clippy::match_single_binding)]
13281                    match tag {
13282                        __FieldTag::__parent => {
13283                            if !fields.insert(__FieldTag::__parent) {
13284                                return std::result::Result::Err(A::Error::duplicate_field(
13285                                    "multiple values for parent",
13286                                ));
13287                            }
13288                            result.parent = map
13289                                .next_value::<std::option::Option<std::string::String>>()?
13290                                .unwrap_or_default();
13291                        }
13292                        __FieldTag::__page_size => {
13293                            if !fields.insert(__FieldTag::__page_size) {
13294                                return std::result::Result::Err(A::Error::duplicate_field(
13295                                    "multiple values for page_size",
13296                                ));
13297                            }
13298                            struct __With(std::option::Option<i32>);
13299                            impl<'de> serde::de::Deserialize<'de> for __With {
13300                                fn deserialize<D>(
13301                                    deserializer: D,
13302                                ) -> std::result::Result<Self, D::Error>
13303                                where
13304                                    D: serde::de::Deserializer<'de>,
13305                                {
13306                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
13307                                }
13308                            }
13309                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
13310                        }
13311                        __FieldTag::__page_token => {
13312                            if !fields.insert(__FieldTag::__page_token) {
13313                                return std::result::Result::Err(A::Error::duplicate_field(
13314                                    "multiple values for page_token",
13315                                ));
13316                            }
13317                            result.page_token = map
13318                                .next_value::<std::option::Option<std::string::String>>()?
13319                                .unwrap_or_default();
13320                        }
13321                        __FieldTag::__filter => {
13322                            if !fields.insert(__FieldTag::__filter) {
13323                                return std::result::Result::Err(A::Error::duplicate_field(
13324                                    "multiple values for filter",
13325                                ));
13326                            }
13327                            result.filter = map
13328                                .next_value::<std::option::Option<std::string::String>>()?
13329                                .unwrap_or_default();
13330                        }
13331                        __FieldTag::__order_by => {
13332                            if !fields.insert(__FieldTag::__order_by) {
13333                                return std::result::Result::Err(A::Error::duplicate_field(
13334                                    "multiple values for order_by",
13335                                ));
13336                            }
13337                            result.order_by = map
13338                                .next_value::<std::option::Option<std::string::String>>()?
13339                                .unwrap_or_default();
13340                        }
13341                        __FieldTag::Unknown(key) => {
13342                            let value = map.next_value::<serde_json::Value>()?;
13343                            result._unknown_fields.insert(key, value);
13344                        }
13345                    }
13346                }
13347                std::result::Result::Ok(result)
13348            }
13349        }
13350        deserializer.deserialize_any(Visitor)
13351    }
13352}
13353
13354#[doc(hidden)]
13355impl serde::ser::Serialize for ListHubsRequest {
13356    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13357    where
13358        S: serde::ser::Serializer,
13359    {
13360        use serde::ser::SerializeMap;
13361        #[allow(unused_imports)]
13362        use std::option::Option::Some;
13363        let mut state = serializer.serialize_map(std::option::Option::None)?;
13364        if !self.parent.is_empty() {
13365            state.serialize_entry("parent", &self.parent)?;
13366        }
13367        if !wkt::internal::is_default(&self.page_size) {
13368            struct __With<'a>(&'a i32);
13369            impl<'a> serde::ser::Serialize for __With<'a> {
13370                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13371                where
13372                    S: serde::ser::Serializer,
13373                {
13374                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
13375                }
13376            }
13377            state.serialize_entry("pageSize", &__With(&self.page_size))?;
13378        }
13379        if !self.page_token.is_empty() {
13380            state.serialize_entry("pageToken", &self.page_token)?;
13381        }
13382        if !self.filter.is_empty() {
13383            state.serialize_entry("filter", &self.filter)?;
13384        }
13385        if !self.order_by.is_empty() {
13386            state.serialize_entry("orderBy", &self.order_by)?;
13387        }
13388        if !self._unknown_fields.is_empty() {
13389            for (key, value) in self._unknown_fields.iter() {
13390                state.serialize_entry(key, &value)?;
13391            }
13392        }
13393        state.end()
13394    }
13395}
13396
13397impl std::fmt::Debug for ListHubsRequest {
13398    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13399        let mut debug_struct = f.debug_struct("ListHubsRequest");
13400        debug_struct.field("parent", &self.parent);
13401        debug_struct.field("page_size", &self.page_size);
13402        debug_struct.field("page_token", &self.page_token);
13403        debug_struct.field("filter", &self.filter);
13404        debug_struct.field("order_by", &self.order_by);
13405        if !self._unknown_fields.is_empty() {
13406            debug_struct.field("_unknown_fields", &self._unknown_fields);
13407        }
13408        debug_struct.finish()
13409    }
13410}
13411
13412/// Response for
13413/// [HubService.ListHubs][google.cloud.networkconnectivity.v1.HubService.ListHubs]
13414/// method.
13415///
13416/// [google.cloud.networkconnectivity.v1.HubService.ListHubs]: crate::client::HubService::list_hubs
13417#[derive(Clone, Default, PartialEq)]
13418#[non_exhaustive]
13419pub struct ListHubsResponse {
13420    /// The requested hubs.
13421    pub hubs: std::vec::Vec<crate::model::Hub>,
13422
13423    /// The token for the next page of the response. To see more results,
13424    /// use this value as the page_token for your next request. If this value
13425    /// is empty, there are no more results.
13426    pub next_page_token: std::string::String,
13427
13428    /// Locations that could not be reached.
13429    pub unreachable: std::vec::Vec<std::string::String>,
13430
13431    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13432}
13433
13434impl ListHubsResponse {
13435    pub fn new() -> Self {
13436        std::default::Default::default()
13437    }
13438
13439    /// Sets the value of [hubs][crate::model::ListHubsResponse::hubs].
13440    pub fn set_hubs<T, V>(mut self, v: T) -> Self
13441    where
13442        T: std::iter::IntoIterator<Item = V>,
13443        V: std::convert::Into<crate::model::Hub>,
13444    {
13445        use std::iter::Iterator;
13446        self.hubs = v.into_iter().map(|i| i.into()).collect();
13447        self
13448    }
13449
13450    /// Sets the value of [next_page_token][crate::model::ListHubsResponse::next_page_token].
13451    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13452        self.next_page_token = v.into();
13453        self
13454    }
13455
13456    /// Sets the value of [unreachable][crate::model::ListHubsResponse::unreachable].
13457    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
13458    where
13459        T: std::iter::IntoIterator<Item = V>,
13460        V: std::convert::Into<std::string::String>,
13461    {
13462        use std::iter::Iterator;
13463        self.unreachable = v.into_iter().map(|i| i.into()).collect();
13464        self
13465    }
13466}
13467
13468impl wkt::message::Message for ListHubsResponse {
13469    fn typename() -> &'static str {
13470        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListHubsResponse"
13471    }
13472}
13473
13474#[doc(hidden)]
13475impl gax::paginator::internal::PageableResponse for ListHubsResponse {
13476    type PageItem = crate::model::Hub;
13477
13478    fn items(self) -> std::vec::Vec<Self::PageItem> {
13479        self.hubs
13480    }
13481
13482    fn next_page_token(&self) -> std::string::String {
13483        use std::clone::Clone;
13484        self.next_page_token.clone()
13485    }
13486}
13487
13488#[doc(hidden)]
13489impl<'de> serde::de::Deserialize<'de> for ListHubsResponse {
13490    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13491    where
13492        D: serde::Deserializer<'de>,
13493    {
13494        #[allow(non_camel_case_types)]
13495        #[doc(hidden)]
13496        #[derive(PartialEq, Eq, Hash)]
13497        enum __FieldTag {
13498            __hubs,
13499            __next_page_token,
13500            __unreachable,
13501            Unknown(std::string::String),
13502        }
13503        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13504            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13505            where
13506                D: serde::Deserializer<'de>,
13507            {
13508                struct Visitor;
13509                impl<'de> serde::de::Visitor<'de> for Visitor {
13510                    type Value = __FieldTag;
13511                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13512                        formatter.write_str("a field name for ListHubsResponse")
13513                    }
13514                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13515                    where
13516                        E: serde::de::Error,
13517                    {
13518                        use std::result::Result::Ok;
13519                        use std::string::ToString;
13520                        match value {
13521                            "hubs" => Ok(__FieldTag::__hubs),
13522                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
13523                            "next_page_token" => Ok(__FieldTag::__next_page_token),
13524                            "unreachable" => Ok(__FieldTag::__unreachable),
13525                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13526                        }
13527                    }
13528                }
13529                deserializer.deserialize_identifier(Visitor)
13530            }
13531        }
13532        struct Visitor;
13533        impl<'de> serde::de::Visitor<'de> for Visitor {
13534            type Value = ListHubsResponse;
13535            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13536                formatter.write_str("struct ListHubsResponse")
13537            }
13538            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13539            where
13540                A: serde::de::MapAccess<'de>,
13541            {
13542                #[allow(unused_imports)]
13543                use serde::de::Error;
13544                use std::option::Option::Some;
13545                let mut fields = std::collections::HashSet::new();
13546                let mut result = Self::Value::new();
13547                while let Some(tag) = map.next_key::<__FieldTag>()? {
13548                    #[allow(clippy::match_single_binding)]
13549                    match tag {
13550                        __FieldTag::__hubs => {
13551                            if !fields.insert(__FieldTag::__hubs) {
13552                                return std::result::Result::Err(A::Error::duplicate_field(
13553                                    "multiple values for hubs",
13554                                ));
13555                            }
13556                            result.hubs = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Hub>>>()?.unwrap_or_default();
13557                        }
13558                        __FieldTag::__next_page_token => {
13559                            if !fields.insert(__FieldTag::__next_page_token) {
13560                                return std::result::Result::Err(A::Error::duplicate_field(
13561                                    "multiple values for next_page_token",
13562                                ));
13563                            }
13564                            result.next_page_token = map
13565                                .next_value::<std::option::Option<std::string::String>>()?
13566                                .unwrap_or_default();
13567                        }
13568                        __FieldTag::__unreachable => {
13569                            if !fields.insert(__FieldTag::__unreachable) {
13570                                return std::result::Result::Err(A::Error::duplicate_field(
13571                                    "multiple values for unreachable",
13572                                ));
13573                            }
13574                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
13575                        }
13576                        __FieldTag::Unknown(key) => {
13577                            let value = map.next_value::<serde_json::Value>()?;
13578                            result._unknown_fields.insert(key, value);
13579                        }
13580                    }
13581                }
13582                std::result::Result::Ok(result)
13583            }
13584        }
13585        deserializer.deserialize_any(Visitor)
13586    }
13587}
13588
13589#[doc(hidden)]
13590impl serde::ser::Serialize for ListHubsResponse {
13591    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13592    where
13593        S: serde::ser::Serializer,
13594    {
13595        use serde::ser::SerializeMap;
13596        #[allow(unused_imports)]
13597        use std::option::Option::Some;
13598        let mut state = serializer.serialize_map(std::option::Option::None)?;
13599        if !self.hubs.is_empty() {
13600            state.serialize_entry("hubs", &self.hubs)?;
13601        }
13602        if !self.next_page_token.is_empty() {
13603            state.serialize_entry("nextPageToken", &self.next_page_token)?;
13604        }
13605        if !self.unreachable.is_empty() {
13606            state.serialize_entry("unreachable", &self.unreachable)?;
13607        }
13608        if !self._unknown_fields.is_empty() {
13609            for (key, value) in self._unknown_fields.iter() {
13610                state.serialize_entry(key, &value)?;
13611            }
13612        }
13613        state.end()
13614    }
13615}
13616
13617impl std::fmt::Debug for ListHubsResponse {
13618    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13619        let mut debug_struct = f.debug_struct("ListHubsResponse");
13620        debug_struct.field("hubs", &self.hubs);
13621        debug_struct.field("next_page_token", &self.next_page_token);
13622        debug_struct.field("unreachable", &self.unreachable);
13623        if !self._unknown_fields.is_empty() {
13624            debug_struct.field("_unknown_fields", &self._unknown_fields);
13625        }
13626        debug_struct.finish()
13627    }
13628}
13629
13630/// Request for
13631/// [HubService.GetHub][google.cloud.networkconnectivity.v1.HubService.GetHub]
13632/// method.
13633///
13634/// [google.cloud.networkconnectivity.v1.HubService.GetHub]: crate::client::HubService::get_hub
13635#[derive(Clone, Default, PartialEq)]
13636#[non_exhaustive]
13637pub struct GetHubRequest {
13638    /// Required. The name of the hub resource to get.
13639    pub name: std::string::String,
13640
13641    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13642}
13643
13644impl GetHubRequest {
13645    pub fn new() -> Self {
13646        std::default::Default::default()
13647    }
13648
13649    /// Sets the value of [name][crate::model::GetHubRequest::name].
13650    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13651        self.name = v.into();
13652        self
13653    }
13654}
13655
13656impl wkt::message::Message for GetHubRequest {
13657    fn typename() -> &'static str {
13658        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetHubRequest"
13659    }
13660}
13661
13662#[doc(hidden)]
13663impl<'de> serde::de::Deserialize<'de> for GetHubRequest {
13664    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13665    where
13666        D: serde::Deserializer<'de>,
13667    {
13668        #[allow(non_camel_case_types)]
13669        #[doc(hidden)]
13670        #[derive(PartialEq, Eq, Hash)]
13671        enum __FieldTag {
13672            __name,
13673            Unknown(std::string::String),
13674        }
13675        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13676            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13677            where
13678                D: serde::Deserializer<'de>,
13679            {
13680                struct Visitor;
13681                impl<'de> serde::de::Visitor<'de> for Visitor {
13682                    type Value = __FieldTag;
13683                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13684                        formatter.write_str("a field name for GetHubRequest")
13685                    }
13686                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13687                    where
13688                        E: serde::de::Error,
13689                    {
13690                        use std::result::Result::Ok;
13691                        use std::string::ToString;
13692                        match value {
13693                            "name" => Ok(__FieldTag::__name),
13694                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13695                        }
13696                    }
13697                }
13698                deserializer.deserialize_identifier(Visitor)
13699            }
13700        }
13701        struct Visitor;
13702        impl<'de> serde::de::Visitor<'de> for Visitor {
13703            type Value = GetHubRequest;
13704            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13705                formatter.write_str("struct GetHubRequest")
13706            }
13707            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13708            where
13709                A: serde::de::MapAccess<'de>,
13710            {
13711                #[allow(unused_imports)]
13712                use serde::de::Error;
13713                use std::option::Option::Some;
13714                let mut fields = std::collections::HashSet::new();
13715                let mut result = Self::Value::new();
13716                while let Some(tag) = map.next_key::<__FieldTag>()? {
13717                    #[allow(clippy::match_single_binding)]
13718                    match tag {
13719                        __FieldTag::__name => {
13720                            if !fields.insert(__FieldTag::__name) {
13721                                return std::result::Result::Err(A::Error::duplicate_field(
13722                                    "multiple values for name",
13723                                ));
13724                            }
13725                            result.name = map
13726                                .next_value::<std::option::Option<std::string::String>>()?
13727                                .unwrap_or_default();
13728                        }
13729                        __FieldTag::Unknown(key) => {
13730                            let value = map.next_value::<serde_json::Value>()?;
13731                            result._unknown_fields.insert(key, value);
13732                        }
13733                    }
13734                }
13735                std::result::Result::Ok(result)
13736            }
13737        }
13738        deserializer.deserialize_any(Visitor)
13739    }
13740}
13741
13742#[doc(hidden)]
13743impl serde::ser::Serialize for GetHubRequest {
13744    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13745    where
13746        S: serde::ser::Serializer,
13747    {
13748        use serde::ser::SerializeMap;
13749        #[allow(unused_imports)]
13750        use std::option::Option::Some;
13751        let mut state = serializer.serialize_map(std::option::Option::None)?;
13752        if !self.name.is_empty() {
13753            state.serialize_entry("name", &self.name)?;
13754        }
13755        if !self._unknown_fields.is_empty() {
13756            for (key, value) in self._unknown_fields.iter() {
13757                state.serialize_entry(key, &value)?;
13758            }
13759        }
13760        state.end()
13761    }
13762}
13763
13764impl std::fmt::Debug for GetHubRequest {
13765    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13766        let mut debug_struct = f.debug_struct("GetHubRequest");
13767        debug_struct.field("name", &self.name);
13768        if !self._unknown_fields.is_empty() {
13769            debug_struct.field("_unknown_fields", &self._unknown_fields);
13770        }
13771        debug_struct.finish()
13772    }
13773}
13774
13775/// Request for
13776/// [HubService.CreateHub][google.cloud.networkconnectivity.v1.HubService.CreateHub]
13777/// method.
13778///
13779/// [google.cloud.networkconnectivity.v1.HubService.CreateHub]: crate::client::HubService::create_hub
13780#[derive(Clone, Default, PartialEq)]
13781#[non_exhaustive]
13782pub struct CreateHubRequest {
13783    /// Required. The parent resource.
13784    pub parent: std::string::String,
13785
13786    /// Required. A unique identifier for the hub.
13787    pub hub_id: std::string::String,
13788
13789    /// Required. The initial values for a new hub.
13790    pub hub: std::option::Option<crate::model::Hub>,
13791
13792    /// Optional. A request ID to identify requests. Specify a unique request ID so
13793    /// that if you must retry your request, the server knows to ignore the request
13794    /// if it has already been completed. The server guarantees that a request
13795    /// doesn't result in creation of duplicate commitments for at least 60
13796    /// minutes.
13797    ///
13798    /// For example, consider a situation where you make an initial request and
13799    /// the request times out. If you make the request again with the same request
13800    /// ID, the server can check to see whether the original operation
13801    /// was received. If it was, the server ignores the second request. This
13802    /// behavior prevents clients from mistakenly creating duplicate commitments.
13803    ///
13804    /// The request ID must be a valid UUID, with the exception that zero UUID is
13805    /// not supported (00000000-0000-0000-0000-000000000000).
13806    pub request_id: std::string::String,
13807
13808    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13809}
13810
13811impl CreateHubRequest {
13812    pub fn new() -> Self {
13813        std::default::Default::default()
13814    }
13815
13816    /// Sets the value of [parent][crate::model::CreateHubRequest::parent].
13817    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13818        self.parent = v.into();
13819        self
13820    }
13821
13822    /// Sets the value of [hub_id][crate::model::CreateHubRequest::hub_id].
13823    pub fn set_hub_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13824        self.hub_id = v.into();
13825        self
13826    }
13827
13828    /// Sets the value of [hub][crate::model::CreateHubRequest::hub].
13829    pub fn set_hub<T>(mut self, v: T) -> Self
13830    where
13831        T: std::convert::Into<crate::model::Hub>,
13832    {
13833        self.hub = std::option::Option::Some(v.into());
13834        self
13835    }
13836
13837    /// Sets or clears the value of [hub][crate::model::CreateHubRequest::hub].
13838    pub fn set_or_clear_hub<T>(mut self, v: std::option::Option<T>) -> Self
13839    where
13840        T: std::convert::Into<crate::model::Hub>,
13841    {
13842        self.hub = v.map(|x| x.into());
13843        self
13844    }
13845
13846    /// Sets the value of [request_id][crate::model::CreateHubRequest::request_id].
13847    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13848        self.request_id = v.into();
13849        self
13850    }
13851}
13852
13853impl wkt::message::Message for CreateHubRequest {
13854    fn typename() -> &'static str {
13855        "type.googleapis.com/google.cloud.networkconnectivity.v1.CreateHubRequest"
13856    }
13857}
13858
13859#[doc(hidden)]
13860impl<'de> serde::de::Deserialize<'de> for CreateHubRequest {
13861    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13862    where
13863        D: serde::Deserializer<'de>,
13864    {
13865        #[allow(non_camel_case_types)]
13866        #[doc(hidden)]
13867        #[derive(PartialEq, Eq, Hash)]
13868        enum __FieldTag {
13869            __parent,
13870            __hub_id,
13871            __hub,
13872            __request_id,
13873            Unknown(std::string::String),
13874        }
13875        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13876            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13877            where
13878                D: serde::Deserializer<'de>,
13879            {
13880                struct Visitor;
13881                impl<'de> serde::de::Visitor<'de> for Visitor {
13882                    type Value = __FieldTag;
13883                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13884                        formatter.write_str("a field name for CreateHubRequest")
13885                    }
13886                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13887                    where
13888                        E: serde::de::Error,
13889                    {
13890                        use std::result::Result::Ok;
13891                        use std::string::ToString;
13892                        match value {
13893                            "parent" => Ok(__FieldTag::__parent),
13894                            "hubId" => Ok(__FieldTag::__hub_id),
13895                            "hub_id" => Ok(__FieldTag::__hub_id),
13896                            "hub" => Ok(__FieldTag::__hub),
13897                            "requestId" => Ok(__FieldTag::__request_id),
13898                            "request_id" => Ok(__FieldTag::__request_id),
13899                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13900                        }
13901                    }
13902                }
13903                deserializer.deserialize_identifier(Visitor)
13904            }
13905        }
13906        struct Visitor;
13907        impl<'de> serde::de::Visitor<'de> for Visitor {
13908            type Value = CreateHubRequest;
13909            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13910                formatter.write_str("struct CreateHubRequest")
13911            }
13912            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13913            where
13914                A: serde::de::MapAccess<'de>,
13915            {
13916                #[allow(unused_imports)]
13917                use serde::de::Error;
13918                use std::option::Option::Some;
13919                let mut fields = std::collections::HashSet::new();
13920                let mut result = Self::Value::new();
13921                while let Some(tag) = map.next_key::<__FieldTag>()? {
13922                    #[allow(clippy::match_single_binding)]
13923                    match tag {
13924                        __FieldTag::__parent => {
13925                            if !fields.insert(__FieldTag::__parent) {
13926                                return std::result::Result::Err(A::Error::duplicate_field(
13927                                    "multiple values for parent",
13928                                ));
13929                            }
13930                            result.parent = map
13931                                .next_value::<std::option::Option<std::string::String>>()?
13932                                .unwrap_or_default();
13933                        }
13934                        __FieldTag::__hub_id => {
13935                            if !fields.insert(__FieldTag::__hub_id) {
13936                                return std::result::Result::Err(A::Error::duplicate_field(
13937                                    "multiple values for hub_id",
13938                                ));
13939                            }
13940                            result.hub_id = map
13941                                .next_value::<std::option::Option<std::string::String>>()?
13942                                .unwrap_or_default();
13943                        }
13944                        __FieldTag::__hub => {
13945                            if !fields.insert(__FieldTag::__hub) {
13946                                return std::result::Result::Err(A::Error::duplicate_field(
13947                                    "multiple values for hub",
13948                                ));
13949                            }
13950                            result.hub =
13951                                map.next_value::<std::option::Option<crate::model::Hub>>()?;
13952                        }
13953                        __FieldTag::__request_id => {
13954                            if !fields.insert(__FieldTag::__request_id) {
13955                                return std::result::Result::Err(A::Error::duplicate_field(
13956                                    "multiple values for request_id",
13957                                ));
13958                            }
13959                            result.request_id = map
13960                                .next_value::<std::option::Option<std::string::String>>()?
13961                                .unwrap_or_default();
13962                        }
13963                        __FieldTag::Unknown(key) => {
13964                            let value = map.next_value::<serde_json::Value>()?;
13965                            result._unknown_fields.insert(key, value);
13966                        }
13967                    }
13968                }
13969                std::result::Result::Ok(result)
13970            }
13971        }
13972        deserializer.deserialize_any(Visitor)
13973    }
13974}
13975
13976#[doc(hidden)]
13977impl serde::ser::Serialize for CreateHubRequest {
13978    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13979    where
13980        S: serde::ser::Serializer,
13981    {
13982        use serde::ser::SerializeMap;
13983        #[allow(unused_imports)]
13984        use std::option::Option::Some;
13985        let mut state = serializer.serialize_map(std::option::Option::None)?;
13986        if !self.parent.is_empty() {
13987            state.serialize_entry("parent", &self.parent)?;
13988        }
13989        if !self.hub_id.is_empty() {
13990            state.serialize_entry("hubId", &self.hub_id)?;
13991        }
13992        if self.hub.is_some() {
13993            state.serialize_entry("hub", &self.hub)?;
13994        }
13995        if !self.request_id.is_empty() {
13996            state.serialize_entry("requestId", &self.request_id)?;
13997        }
13998        if !self._unknown_fields.is_empty() {
13999            for (key, value) in self._unknown_fields.iter() {
14000                state.serialize_entry(key, &value)?;
14001            }
14002        }
14003        state.end()
14004    }
14005}
14006
14007impl std::fmt::Debug for CreateHubRequest {
14008    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14009        let mut debug_struct = f.debug_struct("CreateHubRequest");
14010        debug_struct.field("parent", &self.parent);
14011        debug_struct.field("hub_id", &self.hub_id);
14012        debug_struct.field("hub", &self.hub);
14013        debug_struct.field("request_id", &self.request_id);
14014        if !self._unknown_fields.is_empty() {
14015            debug_struct.field("_unknown_fields", &self._unknown_fields);
14016        }
14017        debug_struct.finish()
14018    }
14019}
14020
14021/// Request for
14022/// [HubService.UpdateHub][google.cloud.networkconnectivity.v1.HubService.UpdateHub]
14023/// method.
14024///
14025/// [google.cloud.networkconnectivity.v1.HubService.UpdateHub]: crate::client::HubService::update_hub
14026#[derive(Clone, Default, PartialEq)]
14027#[non_exhaustive]
14028pub struct UpdateHubRequest {
14029    /// Optional. In the case of an update to an existing hub, field mask is used
14030    /// to specify the fields to be overwritten. The fields specified in the
14031    /// update_mask are relative to the resource, not the full request. A field is
14032    /// overwritten if it is in the mask. If the user does not provide a mask, then
14033    /// all fields are overwritten.
14034    pub update_mask: std::option::Option<wkt::FieldMask>,
14035
14036    /// Required. The state that the hub should be in after the update.
14037    pub hub: std::option::Option<crate::model::Hub>,
14038
14039    /// Optional. A request ID to identify requests. Specify a unique request ID so
14040    /// that if you must retry your request, the server knows to ignore the request
14041    /// if it has already been completed. The server guarantees that a request
14042    /// doesn't result in creation of duplicate commitments for at least 60
14043    /// minutes.
14044    ///
14045    /// For example, consider a situation where you make an initial request and
14046    /// the request times out. If you make the request again with the same request
14047    /// ID, the server can check to see whether the original operation
14048    /// was received. If it was, the server ignores the second request. This
14049    /// behavior prevents clients from mistakenly creating duplicate commitments.
14050    ///
14051    /// The request ID must be a valid UUID, with the exception that zero UUID is
14052    /// not supported (00000000-0000-0000-0000-000000000000).
14053    pub request_id: std::string::String,
14054
14055    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14056}
14057
14058impl UpdateHubRequest {
14059    pub fn new() -> Self {
14060        std::default::Default::default()
14061    }
14062
14063    /// Sets the value of [update_mask][crate::model::UpdateHubRequest::update_mask].
14064    pub fn set_update_mask<T>(mut self, v: T) -> Self
14065    where
14066        T: std::convert::Into<wkt::FieldMask>,
14067    {
14068        self.update_mask = std::option::Option::Some(v.into());
14069        self
14070    }
14071
14072    /// Sets or clears the value of [update_mask][crate::model::UpdateHubRequest::update_mask].
14073    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
14074    where
14075        T: std::convert::Into<wkt::FieldMask>,
14076    {
14077        self.update_mask = v.map(|x| x.into());
14078        self
14079    }
14080
14081    /// Sets the value of [hub][crate::model::UpdateHubRequest::hub].
14082    pub fn set_hub<T>(mut self, v: T) -> Self
14083    where
14084        T: std::convert::Into<crate::model::Hub>,
14085    {
14086        self.hub = std::option::Option::Some(v.into());
14087        self
14088    }
14089
14090    /// Sets or clears the value of [hub][crate::model::UpdateHubRequest::hub].
14091    pub fn set_or_clear_hub<T>(mut self, v: std::option::Option<T>) -> Self
14092    where
14093        T: std::convert::Into<crate::model::Hub>,
14094    {
14095        self.hub = v.map(|x| x.into());
14096        self
14097    }
14098
14099    /// Sets the value of [request_id][crate::model::UpdateHubRequest::request_id].
14100    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14101        self.request_id = v.into();
14102        self
14103    }
14104}
14105
14106impl wkt::message::Message for UpdateHubRequest {
14107    fn typename() -> &'static str {
14108        "type.googleapis.com/google.cloud.networkconnectivity.v1.UpdateHubRequest"
14109    }
14110}
14111
14112#[doc(hidden)]
14113impl<'de> serde::de::Deserialize<'de> for UpdateHubRequest {
14114    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14115    where
14116        D: serde::Deserializer<'de>,
14117    {
14118        #[allow(non_camel_case_types)]
14119        #[doc(hidden)]
14120        #[derive(PartialEq, Eq, Hash)]
14121        enum __FieldTag {
14122            __update_mask,
14123            __hub,
14124            __request_id,
14125            Unknown(std::string::String),
14126        }
14127        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14128            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14129            where
14130                D: serde::Deserializer<'de>,
14131            {
14132                struct Visitor;
14133                impl<'de> serde::de::Visitor<'de> for Visitor {
14134                    type Value = __FieldTag;
14135                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14136                        formatter.write_str("a field name for UpdateHubRequest")
14137                    }
14138                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14139                    where
14140                        E: serde::de::Error,
14141                    {
14142                        use std::result::Result::Ok;
14143                        use std::string::ToString;
14144                        match value {
14145                            "updateMask" => Ok(__FieldTag::__update_mask),
14146                            "update_mask" => Ok(__FieldTag::__update_mask),
14147                            "hub" => Ok(__FieldTag::__hub),
14148                            "requestId" => Ok(__FieldTag::__request_id),
14149                            "request_id" => Ok(__FieldTag::__request_id),
14150                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14151                        }
14152                    }
14153                }
14154                deserializer.deserialize_identifier(Visitor)
14155            }
14156        }
14157        struct Visitor;
14158        impl<'de> serde::de::Visitor<'de> for Visitor {
14159            type Value = UpdateHubRequest;
14160            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14161                formatter.write_str("struct UpdateHubRequest")
14162            }
14163            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14164            where
14165                A: serde::de::MapAccess<'de>,
14166            {
14167                #[allow(unused_imports)]
14168                use serde::de::Error;
14169                use std::option::Option::Some;
14170                let mut fields = std::collections::HashSet::new();
14171                let mut result = Self::Value::new();
14172                while let Some(tag) = map.next_key::<__FieldTag>()? {
14173                    #[allow(clippy::match_single_binding)]
14174                    match tag {
14175                        __FieldTag::__update_mask => {
14176                            if !fields.insert(__FieldTag::__update_mask) {
14177                                return std::result::Result::Err(A::Error::duplicate_field(
14178                                    "multiple values for update_mask",
14179                                ));
14180                            }
14181                            result.update_mask =
14182                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
14183                        }
14184                        __FieldTag::__hub => {
14185                            if !fields.insert(__FieldTag::__hub) {
14186                                return std::result::Result::Err(A::Error::duplicate_field(
14187                                    "multiple values for hub",
14188                                ));
14189                            }
14190                            result.hub =
14191                                map.next_value::<std::option::Option<crate::model::Hub>>()?;
14192                        }
14193                        __FieldTag::__request_id => {
14194                            if !fields.insert(__FieldTag::__request_id) {
14195                                return std::result::Result::Err(A::Error::duplicate_field(
14196                                    "multiple values for request_id",
14197                                ));
14198                            }
14199                            result.request_id = map
14200                                .next_value::<std::option::Option<std::string::String>>()?
14201                                .unwrap_or_default();
14202                        }
14203                        __FieldTag::Unknown(key) => {
14204                            let value = map.next_value::<serde_json::Value>()?;
14205                            result._unknown_fields.insert(key, value);
14206                        }
14207                    }
14208                }
14209                std::result::Result::Ok(result)
14210            }
14211        }
14212        deserializer.deserialize_any(Visitor)
14213    }
14214}
14215
14216#[doc(hidden)]
14217impl serde::ser::Serialize for UpdateHubRequest {
14218    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14219    where
14220        S: serde::ser::Serializer,
14221    {
14222        use serde::ser::SerializeMap;
14223        #[allow(unused_imports)]
14224        use std::option::Option::Some;
14225        let mut state = serializer.serialize_map(std::option::Option::None)?;
14226        if self.update_mask.is_some() {
14227            state.serialize_entry("updateMask", &self.update_mask)?;
14228        }
14229        if self.hub.is_some() {
14230            state.serialize_entry("hub", &self.hub)?;
14231        }
14232        if !self.request_id.is_empty() {
14233            state.serialize_entry("requestId", &self.request_id)?;
14234        }
14235        if !self._unknown_fields.is_empty() {
14236            for (key, value) in self._unknown_fields.iter() {
14237                state.serialize_entry(key, &value)?;
14238            }
14239        }
14240        state.end()
14241    }
14242}
14243
14244impl std::fmt::Debug for UpdateHubRequest {
14245    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14246        let mut debug_struct = f.debug_struct("UpdateHubRequest");
14247        debug_struct.field("update_mask", &self.update_mask);
14248        debug_struct.field("hub", &self.hub);
14249        debug_struct.field("request_id", &self.request_id);
14250        if !self._unknown_fields.is_empty() {
14251            debug_struct.field("_unknown_fields", &self._unknown_fields);
14252        }
14253        debug_struct.finish()
14254    }
14255}
14256
14257/// The request for
14258/// [HubService.DeleteHub][google.cloud.networkconnectivity.v1.HubService.DeleteHub].
14259///
14260/// [google.cloud.networkconnectivity.v1.HubService.DeleteHub]: crate::client::HubService::delete_hub
14261#[derive(Clone, Default, PartialEq)]
14262#[non_exhaustive]
14263pub struct DeleteHubRequest {
14264    /// Required. The name of the hub to delete.
14265    pub name: std::string::String,
14266
14267    /// Optional. A request ID to identify requests. Specify a unique request ID so
14268    /// that if you must retry your request, the server knows to ignore the request
14269    /// if it has already been completed. The server guarantees that a request
14270    /// doesn't result in creation of duplicate commitments for at least 60
14271    /// minutes.
14272    ///
14273    /// For example, consider a situation where you make an initial request and
14274    /// the request times out. If you make the request again with the same request
14275    /// ID, the server can check to see whether the original operation
14276    /// was received. If it was, the server ignores the second request. This
14277    /// behavior prevents clients from mistakenly creating duplicate commitments.
14278    ///
14279    /// The request ID must be a valid UUID, with the exception that zero UUID is
14280    /// not supported (00000000-0000-0000-0000-000000000000).
14281    pub request_id: std::string::String,
14282
14283    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14284}
14285
14286impl DeleteHubRequest {
14287    pub fn new() -> Self {
14288        std::default::Default::default()
14289    }
14290
14291    /// Sets the value of [name][crate::model::DeleteHubRequest::name].
14292    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14293        self.name = v.into();
14294        self
14295    }
14296
14297    /// Sets the value of [request_id][crate::model::DeleteHubRequest::request_id].
14298    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14299        self.request_id = v.into();
14300        self
14301    }
14302}
14303
14304impl wkt::message::Message for DeleteHubRequest {
14305    fn typename() -> &'static str {
14306        "type.googleapis.com/google.cloud.networkconnectivity.v1.DeleteHubRequest"
14307    }
14308}
14309
14310#[doc(hidden)]
14311impl<'de> serde::de::Deserialize<'de> for DeleteHubRequest {
14312    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14313    where
14314        D: serde::Deserializer<'de>,
14315    {
14316        #[allow(non_camel_case_types)]
14317        #[doc(hidden)]
14318        #[derive(PartialEq, Eq, Hash)]
14319        enum __FieldTag {
14320            __name,
14321            __request_id,
14322            Unknown(std::string::String),
14323        }
14324        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14325            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14326            where
14327                D: serde::Deserializer<'de>,
14328            {
14329                struct Visitor;
14330                impl<'de> serde::de::Visitor<'de> for Visitor {
14331                    type Value = __FieldTag;
14332                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14333                        formatter.write_str("a field name for DeleteHubRequest")
14334                    }
14335                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14336                    where
14337                        E: serde::de::Error,
14338                    {
14339                        use std::result::Result::Ok;
14340                        use std::string::ToString;
14341                        match value {
14342                            "name" => Ok(__FieldTag::__name),
14343                            "requestId" => Ok(__FieldTag::__request_id),
14344                            "request_id" => Ok(__FieldTag::__request_id),
14345                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14346                        }
14347                    }
14348                }
14349                deserializer.deserialize_identifier(Visitor)
14350            }
14351        }
14352        struct Visitor;
14353        impl<'de> serde::de::Visitor<'de> for Visitor {
14354            type Value = DeleteHubRequest;
14355            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14356                formatter.write_str("struct DeleteHubRequest")
14357            }
14358            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14359            where
14360                A: serde::de::MapAccess<'de>,
14361            {
14362                #[allow(unused_imports)]
14363                use serde::de::Error;
14364                use std::option::Option::Some;
14365                let mut fields = std::collections::HashSet::new();
14366                let mut result = Self::Value::new();
14367                while let Some(tag) = map.next_key::<__FieldTag>()? {
14368                    #[allow(clippy::match_single_binding)]
14369                    match tag {
14370                        __FieldTag::__name => {
14371                            if !fields.insert(__FieldTag::__name) {
14372                                return std::result::Result::Err(A::Error::duplicate_field(
14373                                    "multiple values for name",
14374                                ));
14375                            }
14376                            result.name = map
14377                                .next_value::<std::option::Option<std::string::String>>()?
14378                                .unwrap_or_default();
14379                        }
14380                        __FieldTag::__request_id => {
14381                            if !fields.insert(__FieldTag::__request_id) {
14382                                return std::result::Result::Err(A::Error::duplicate_field(
14383                                    "multiple values for request_id",
14384                                ));
14385                            }
14386                            result.request_id = map
14387                                .next_value::<std::option::Option<std::string::String>>()?
14388                                .unwrap_or_default();
14389                        }
14390                        __FieldTag::Unknown(key) => {
14391                            let value = map.next_value::<serde_json::Value>()?;
14392                            result._unknown_fields.insert(key, value);
14393                        }
14394                    }
14395                }
14396                std::result::Result::Ok(result)
14397            }
14398        }
14399        deserializer.deserialize_any(Visitor)
14400    }
14401}
14402
14403#[doc(hidden)]
14404impl serde::ser::Serialize for DeleteHubRequest {
14405    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14406    where
14407        S: serde::ser::Serializer,
14408    {
14409        use serde::ser::SerializeMap;
14410        #[allow(unused_imports)]
14411        use std::option::Option::Some;
14412        let mut state = serializer.serialize_map(std::option::Option::None)?;
14413        if !self.name.is_empty() {
14414            state.serialize_entry("name", &self.name)?;
14415        }
14416        if !self.request_id.is_empty() {
14417            state.serialize_entry("requestId", &self.request_id)?;
14418        }
14419        if !self._unknown_fields.is_empty() {
14420            for (key, value) in self._unknown_fields.iter() {
14421                state.serialize_entry(key, &value)?;
14422            }
14423        }
14424        state.end()
14425    }
14426}
14427
14428impl std::fmt::Debug for DeleteHubRequest {
14429    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14430        let mut debug_struct = f.debug_struct("DeleteHubRequest");
14431        debug_struct.field("name", &self.name);
14432        debug_struct.field("request_id", &self.request_id);
14433        if !self._unknown_fields.is_empty() {
14434            debug_struct.field("_unknown_fields", &self._unknown_fields);
14435        }
14436        debug_struct.finish()
14437    }
14438}
14439
14440/// The request for
14441/// [HubService.ListHubSpokes][google.cloud.networkconnectivity.v1.HubService.ListHubSpokes].
14442///
14443/// [google.cloud.networkconnectivity.v1.HubService.ListHubSpokes]: crate::client::HubService::list_hub_spokes
14444#[derive(Clone, Default, PartialEq)]
14445#[non_exhaustive]
14446pub struct ListHubSpokesRequest {
14447    /// Required. The name of the hub.
14448    pub name: std::string::String,
14449
14450    /// A list of locations.
14451    /// Specify one of the following: `[global]`, a single region (for
14452    /// example, `[us-central1]`), or a combination of
14453    /// values (for example, `[global, us-central1, us-west1]`).
14454    /// If the spoke_locations field is populated, the list of results
14455    /// includes only spokes in the specified location.
14456    /// If the spoke_locations field is not populated, the list of results
14457    /// includes spokes in all locations.
14458    pub spoke_locations: std::vec::Vec<std::string::String>,
14459
14460    /// The maximum number of results to return per page.
14461    pub page_size: i32,
14462
14463    /// The page token.
14464    pub page_token: std::string::String,
14465
14466    /// An expression that filters the list of results.
14467    pub filter: std::string::String,
14468
14469    /// Sort the results by name or create_time.
14470    pub order_by: std::string::String,
14471
14472    /// The view of the spoke to return.
14473    /// The view that you use determines which spoke fields are included in the
14474    /// response.
14475    pub view: crate::model::list_hub_spokes_request::SpokeView,
14476
14477    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14478}
14479
14480impl ListHubSpokesRequest {
14481    pub fn new() -> Self {
14482        std::default::Default::default()
14483    }
14484
14485    /// Sets the value of [name][crate::model::ListHubSpokesRequest::name].
14486    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14487        self.name = v.into();
14488        self
14489    }
14490
14491    /// Sets the value of [spoke_locations][crate::model::ListHubSpokesRequest::spoke_locations].
14492    pub fn set_spoke_locations<T, V>(mut self, v: T) -> Self
14493    where
14494        T: std::iter::IntoIterator<Item = V>,
14495        V: std::convert::Into<std::string::String>,
14496    {
14497        use std::iter::Iterator;
14498        self.spoke_locations = v.into_iter().map(|i| i.into()).collect();
14499        self
14500    }
14501
14502    /// Sets the value of [page_size][crate::model::ListHubSpokesRequest::page_size].
14503    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14504        self.page_size = v.into();
14505        self
14506    }
14507
14508    /// Sets the value of [page_token][crate::model::ListHubSpokesRequest::page_token].
14509    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14510        self.page_token = v.into();
14511        self
14512    }
14513
14514    /// Sets the value of [filter][crate::model::ListHubSpokesRequest::filter].
14515    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14516        self.filter = v.into();
14517        self
14518    }
14519
14520    /// Sets the value of [order_by][crate::model::ListHubSpokesRequest::order_by].
14521    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14522        self.order_by = v.into();
14523        self
14524    }
14525
14526    /// Sets the value of [view][crate::model::ListHubSpokesRequest::view].
14527    pub fn set_view<T: std::convert::Into<crate::model::list_hub_spokes_request::SpokeView>>(
14528        mut self,
14529        v: T,
14530    ) -> Self {
14531        self.view = v.into();
14532        self
14533    }
14534}
14535
14536impl wkt::message::Message for ListHubSpokesRequest {
14537    fn typename() -> &'static str {
14538        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListHubSpokesRequest"
14539    }
14540}
14541
14542#[doc(hidden)]
14543impl<'de> serde::de::Deserialize<'de> for ListHubSpokesRequest {
14544    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14545    where
14546        D: serde::Deserializer<'de>,
14547    {
14548        #[allow(non_camel_case_types)]
14549        #[doc(hidden)]
14550        #[derive(PartialEq, Eq, Hash)]
14551        enum __FieldTag {
14552            __name,
14553            __spoke_locations,
14554            __page_size,
14555            __page_token,
14556            __filter,
14557            __order_by,
14558            __view,
14559            Unknown(std::string::String),
14560        }
14561        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14562            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14563            where
14564                D: serde::Deserializer<'de>,
14565            {
14566                struct Visitor;
14567                impl<'de> serde::de::Visitor<'de> for Visitor {
14568                    type Value = __FieldTag;
14569                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14570                        formatter.write_str("a field name for ListHubSpokesRequest")
14571                    }
14572                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14573                    where
14574                        E: serde::de::Error,
14575                    {
14576                        use std::result::Result::Ok;
14577                        use std::string::ToString;
14578                        match value {
14579                            "name" => Ok(__FieldTag::__name),
14580                            "spokeLocations" => Ok(__FieldTag::__spoke_locations),
14581                            "spoke_locations" => Ok(__FieldTag::__spoke_locations),
14582                            "pageSize" => Ok(__FieldTag::__page_size),
14583                            "page_size" => Ok(__FieldTag::__page_size),
14584                            "pageToken" => Ok(__FieldTag::__page_token),
14585                            "page_token" => Ok(__FieldTag::__page_token),
14586                            "filter" => Ok(__FieldTag::__filter),
14587                            "orderBy" => Ok(__FieldTag::__order_by),
14588                            "order_by" => Ok(__FieldTag::__order_by),
14589                            "view" => Ok(__FieldTag::__view),
14590                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14591                        }
14592                    }
14593                }
14594                deserializer.deserialize_identifier(Visitor)
14595            }
14596        }
14597        struct Visitor;
14598        impl<'de> serde::de::Visitor<'de> for Visitor {
14599            type Value = ListHubSpokesRequest;
14600            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14601                formatter.write_str("struct ListHubSpokesRequest")
14602            }
14603            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14604            where
14605                A: serde::de::MapAccess<'de>,
14606            {
14607                #[allow(unused_imports)]
14608                use serde::de::Error;
14609                use std::option::Option::Some;
14610                let mut fields = std::collections::HashSet::new();
14611                let mut result = Self::Value::new();
14612                while let Some(tag) = map.next_key::<__FieldTag>()? {
14613                    #[allow(clippy::match_single_binding)]
14614                    match tag {
14615                        __FieldTag::__name => {
14616                            if !fields.insert(__FieldTag::__name) {
14617                                return std::result::Result::Err(A::Error::duplicate_field(
14618                                    "multiple values for name",
14619                                ));
14620                            }
14621                            result.name = map
14622                                .next_value::<std::option::Option<std::string::String>>()?
14623                                .unwrap_or_default();
14624                        }
14625                        __FieldTag::__spoke_locations => {
14626                            if !fields.insert(__FieldTag::__spoke_locations) {
14627                                return std::result::Result::Err(A::Error::duplicate_field(
14628                                    "multiple values for spoke_locations",
14629                                ));
14630                            }
14631                            result.spoke_locations = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
14632                        }
14633                        __FieldTag::__page_size => {
14634                            if !fields.insert(__FieldTag::__page_size) {
14635                                return std::result::Result::Err(A::Error::duplicate_field(
14636                                    "multiple values for page_size",
14637                                ));
14638                            }
14639                            struct __With(std::option::Option<i32>);
14640                            impl<'de> serde::de::Deserialize<'de> for __With {
14641                                fn deserialize<D>(
14642                                    deserializer: D,
14643                                ) -> std::result::Result<Self, D::Error>
14644                                where
14645                                    D: serde::de::Deserializer<'de>,
14646                                {
14647                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
14648                                }
14649                            }
14650                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
14651                        }
14652                        __FieldTag::__page_token => {
14653                            if !fields.insert(__FieldTag::__page_token) {
14654                                return std::result::Result::Err(A::Error::duplicate_field(
14655                                    "multiple values for page_token",
14656                                ));
14657                            }
14658                            result.page_token = map
14659                                .next_value::<std::option::Option<std::string::String>>()?
14660                                .unwrap_or_default();
14661                        }
14662                        __FieldTag::__filter => {
14663                            if !fields.insert(__FieldTag::__filter) {
14664                                return std::result::Result::Err(A::Error::duplicate_field(
14665                                    "multiple values for filter",
14666                                ));
14667                            }
14668                            result.filter = map
14669                                .next_value::<std::option::Option<std::string::String>>()?
14670                                .unwrap_or_default();
14671                        }
14672                        __FieldTag::__order_by => {
14673                            if !fields.insert(__FieldTag::__order_by) {
14674                                return std::result::Result::Err(A::Error::duplicate_field(
14675                                    "multiple values for order_by",
14676                                ));
14677                            }
14678                            result.order_by = map
14679                                .next_value::<std::option::Option<std::string::String>>()?
14680                                .unwrap_or_default();
14681                        }
14682                        __FieldTag::__view => {
14683                            if !fields.insert(__FieldTag::__view) {
14684                                return std::result::Result::Err(A::Error::duplicate_field(
14685                                    "multiple values for view",
14686                                ));
14687                            }
14688                            result.view = map
14689                                .next_value::<std::option::Option<
14690                                    crate::model::list_hub_spokes_request::SpokeView,
14691                                >>()?
14692                                .unwrap_or_default();
14693                        }
14694                        __FieldTag::Unknown(key) => {
14695                            let value = map.next_value::<serde_json::Value>()?;
14696                            result._unknown_fields.insert(key, value);
14697                        }
14698                    }
14699                }
14700                std::result::Result::Ok(result)
14701            }
14702        }
14703        deserializer.deserialize_any(Visitor)
14704    }
14705}
14706
14707#[doc(hidden)]
14708impl serde::ser::Serialize for ListHubSpokesRequest {
14709    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14710    where
14711        S: serde::ser::Serializer,
14712    {
14713        use serde::ser::SerializeMap;
14714        #[allow(unused_imports)]
14715        use std::option::Option::Some;
14716        let mut state = serializer.serialize_map(std::option::Option::None)?;
14717        if !self.name.is_empty() {
14718            state.serialize_entry("name", &self.name)?;
14719        }
14720        if !self.spoke_locations.is_empty() {
14721            state.serialize_entry("spokeLocations", &self.spoke_locations)?;
14722        }
14723        if !wkt::internal::is_default(&self.page_size) {
14724            struct __With<'a>(&'a i32);
14725            impl<'a> serde::ser::Serialize for __With<'a> {
14726                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14727                where
14728                    S: serde::ser::Serializer,
14729                {
14730                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
14731                }
14732            }
14733            state.serialize_entry("pageSize", &__With(&self.page_size))?;
14734        }
14735        if !self.page_token.is_empty() {
14736            state.serialize_entry("pageToken", &self.page_token)?;
14737        }
14738        if !self.filter.is_empty() {
14739            state.serialize_entry("filter", &self.filter)?;
14740        }
14741        if !self.order_by.is_empty() {
14742            state.serialize_entry("orderBy", &self.order_by)?;
14743        }
14744        if !wkt::internal::is_default(&self.view) {
14745            state.serialize_entry("view", &self.view)?;
14746        }
14747        if !self._unknown_fields.is_empty() {
14748            for (key, value) in self._unknown_fields.iter() {
14749                state.serialize_entry(key, &value)?;
14750            }
14751        }
14752        state.end()
14753    }
14754}
14755
14756impl std::fmt::Debug for ListHubSpokesRequest {
14757    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14758        let mut debug_struct = f.debug_struct("ListHubSpokesRequest");
14759        debug_struct.field("name", &self.name);
14760        debug_struct.field("spoke_locations", &self.spoke_locations);
14761        debug_struct.field("page_size", &self.page_size);
14762        debug_struct.field("page_token", &self.page_token);
14763        debug_struct.field("filter", &self.filter);
14764        debug_struct.field("order_by", &self.order_by);
14765        debug_struct.field("view", &self.view);
14766        if !self._unknown_fields.is_empty() {
14767            debug_struct.field("_unknown_fields", &self._unknown_fields);
14768        }
14769        debug_struct.finish()
14770    }
14771}
14772
14773/// Defines additional types related to [ListHubSpokesRequest].
14774pub mod list_hub_spokes_request {
14775    #[allow(unused_imports)]
14776    use super::*;
14777
14778    /// Enum that controls which spoke fields are included in the response.
14779    ///
14780    /// # Working with unknown values
14781    ///
14782    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14783    /// additional enum variants at any time. Adding new variants is not considered
14784    /// a breaking change. Applications should write their code in anticipation of:
14785    ///
14786    /// - New values appearing in future releases of the client library, **and**
14787    /// - New values received dynamically, without application changes.
14788    ///
14789    /// Please consult the [Working with enums] section in the user guide for some
14790    /// guidelines.
14791    ///
14792    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14793    #[derive(Clone, Debug, PartialEq)]
14794    #[non_exhaustive]
14795    pub enum SpokeView {
14796        /// The spoke view is unspecified. When the spoke view is unspecified, the
14797        /// API returns the same fields as the `BASIC` view.
14798        Unspecified,
14799        /// Includes `name`, `create_time`, `hub`, `unique_id`, `state`, `reasons`,
14800        /// and `spoke_type`. This is the default value.
14801        Basic,
14802        /// Includes all spoke fields except `labels`.
14803        /// You can use the `DETAILED` view only when you set the `spoke_locations`
14804        /// field to `[global]`.
14805        Detailed,
14806        /// If set, the enum was initialized with an unknown value.
14807        ///
14808        /// Applications can examine the value using [SpokeView::value] or
14809        /// [SpokeView::name].
14810        UnknownValue(spoke_view::UnknownValue),
14811    }
14812
14813    #[doc(hidden)]
14814    pub mod spoke_view {
14815        #[allow(unused_imports)]
14816        use super::*;
14817        #[derive(Clone, Debug, PartialEq)]
14818        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14819    }
14820
14821    impl SpokeView {
14822        /// Gets the enum value.
14823        ///
14824        /// Returns `None` if the enum contains an unknown value deserialized from
14825        /// the string representation of enums.
14826        pub fn value(&self) -> std::option::Option<i32> {
14827            match self {
14828                Self::Unspecified => std::option::Option::Some(0),
14829                Self::Basic => std::option::Option::Some(1),
14830                Self::Detailed => std::option::Option::Some(2),
14831                Self::UnknownValue(u) => u.0.value(),
14832            }
14833        }
14834
14835        /// Gets the enum value as a string.
14836        ///
14837        /// Returns `None` if the enum contains an unknown value deserialized from
14838        /// the integer representation of enums.
14839        pub fn name(&self) -> std::option::Option<&str> {
14840            match self {
14841                Self::Unspecified => std::option::Option::Some("SPOKE_VIEW_UNSPECIFIED"),
14842                Self::Basic => std::option::Option::Some("BASIC"),
14843                Self::Detailed => std::option::Option::Some("DETAILED"),
14844                Self::UnknownValue(u) => u.0.name(),
14845            }
14846        }
14847    }
14848
14849    impl std::default::Default for SpokeView {
14850        fn default() -> Self {
14851            use std::convert::From;
14852            Self::from(0)
14853        }
14854    }
14855
14856    impl std::fmt::Display for SpokeView {
14857        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14858            wkt::internal::display_enum(f, self.name(), self.value())
14859        }
14860    }
14861
14862    impl std::convert::From<i32> for SpokeView {
14863        fn from(value: i32) -> Self {
14864            match value {
14865                0 => Self::Unspecified,
14866                1 => Self::Basic,
14867                2 => Self::Detailed,
14868                _ => Self::UnknownValue(spoke_view::UnknownValue(
14869                    wkt::internal::UnknownEnumValue::Integer(value),
14870                )),
14871            }
14872        }
14873    }
14874
14875    impl std::convert::From<&str> for SpokeView {
14876        fn from(value: &str) -> Self {
14877            use std::string::ToString;
14878            match value {
14879                "SPOKE_VIEW_UNSPECIFIED" => Self::Unspecified,
14880                "BASIC" => Self::Basic,
14881                "DETAILED" => Self::Detailed,
14882                _ => Self::UnknownValue(spoke_view::UnknownValue(
14883                    wkt::internal::UnknownEnumValue::String(value.to_string()),
14884                )),
14885            }
14886        }
14887    }
14888
14889    impl serde::ser::Serialize for SpokeView {
14890        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14891        where
14892            S: serde::Serializer,
14893        {
14894            match self {
14895                Self::Unspecified => serializer.serialize_i32(0),
14896                Self::Basic => serializer.serialize_i32(1),
14897                Self::Detailed => serializer.serialize_i32(2),
14898                Self::UnknownValue(u) => u.0.serialize(serializer),
14899            }
14900        }
14901    }
14902
14903    impl<'de> serde::de::Deserialize<'de> for SpokeView {
14904        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14905        where
14906            D: serde::Deserializer<'de>,
14907        {
14908            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SpokeView>::new(
14909                ".google.cloud.networkconnectivity.v1.ListHubSpokesRequest.SpokeView",
14910            ))
14911        }
14912    }
14913}
14914
14915/// The response for
14916/// [HubService.ListHubSpokes][google.cloud.networkconnectivity.v1.HubService.ListHubSpokes].
14917///
14918/// [google.cloud.networkconnectivity.v1.HubService.ListHubSpokes]: crate::client::HubService::list_hub_spokes
14919#[derive(Clone, Default, PartialEq)]
14920#[non_exhaustive]
14921pub struct ListHubSpokesResponse {
14922    /// The requested spokes.
14923    /// The spoke fields can be partially populated based on the `view` field in
14924    /// the request message.
14925    pub spokes: std::vec::Vec<crate::model::Spoke>,
14926
14927    /// The token for the next page of the response. To see more results,
14928    /// use this value as the page_token for your next request. If this value
14929    /// is empty, there are no more results.
14930    pub next_page_token: std::string::String,
14931
14932    /// Locations that could not be reached.
14933    pub unreachable: std::vec::Vec<std::string::String>,
14934
14935    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14936}
14937
14938impl ListHubSpokesResponse {
14939    pub fn new() -> Self {
14940        std::default::Default::default()
14941    }
14942
14943    /// Sets the value of [spokes][crate::model::ListHubSpokesResponse::spokes].
14944    pub fn set_spokes<T, V>(mut self, v: T) -> Self
14945    where
14946        T: std::iter::IntoIterator<Item = V>,
14947        V: std::convert::Into<crate::model::Spoke>,
14948    {
14949        use std::iter::Iterator;
14950        self.spokes = v.into_iter().map(|i| i.into()).collect();
14951        self
14952    }
14953
14954    /// Sets the value of [next_page_token][crate::model::ListHubSpokesResponse::next_page_token].
14955    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14956        self.next_page_token = v.into();
14957        self
14958    }
14959
14960    /// Sets the value of [unreachable][crate::model::ListHubSpokesResponse::unreachable].
14961    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
14962    where
14963        T: std::iter::IntoIterator<Item = V>,
14964        V: std::convert::Into<std::string::String>,
14965    {
14966        use std::iter::Iterator;
14967        self.unreachable = v.into_iter().map(|i| i.into()).collect();
14968        self
14969    }
14970}
14971
14972impl wkt::message::Message for ListHubSpokesResponse {
14973    fn typename() -> &'static str {
14974        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListHubSpokesResponse"
14975    }
14976}
14977
14978#[doc(hidden)]
14979impl gax::paginator::internal::PageableResponse for ListHubSpokesResponse {
14980    type PageItem = crate::model::Spoke;
14981
14982    fn items(self) -> std::vec::Vec<Self::PageItem> {
14983        self.spokes
14984    }
14985
14986    fn next_page_token(&self) -> std::string::String {
14987        use std::clone::Clone;
14988        self.next_page_token.clone()
14989    }
14990}
14991
14992#[doc(hidden)]
14993impl<'de> serde::de::Deserialize<'de> for ListHubSpokesResponse {
14994    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14995    where
14996        D: serde::Deserializer<'de>,
14997    {
14998        #[allow(non_camel_case_types)]
14999        #[doc(hidden)]
15000        #[derive(PartialEq, Eq, Hash)]
15001        enum __FieldTag {
15002            __spokes,
15003            __next_page_token,
15004            __unreachable,
15005            Unknown(std::string::String),
15006        }
15007        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15008            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15009            where
15010                D: serde::Deserializer<'de>,
15011            {
15012                struct Visitor;
15013                impl<'de> serde::de::Visitor<'de> for Visitor {
15014                    type Value = __FieldTag;
15015                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15016                        formatter.write_str("a field name for ListHubSpokesResponse")
15017                    }
15018                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15019                    where
15020                        E: serde::de::Error,
15021                    {
15022                        use std::result::Result::Ok;
15023                        use std::string::ToString;
15024                        match value {
15025                            "spokes" => Ok(__FieldTag::__spokes),
15026                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
15027                            "next_page_token" => Ok(__FieldTag::__next_page_token),
15028                            "unreachable" => Ok(__FieldTag::__unreachable),
15029                            _ => Ok(__FieldTag::Unknown(value.to_string())),
15030                        }
15031                    }
15032                }
15033                deserializer.deserialize_identifier(Visitor)
15034            }
15035        }
15036        struct Visitor;
15037        impl<'de> serde::de::Visitor<'de> for Visitor {
15038            type Value = ListHubSpokesResponse;
15039            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15040                formatter.write_str("struct ListHubSpokesResponse")
15041            }
15042            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15043            where
15044                A: serde::de::MapAccess<'de>,
15045            {
15046                #[allow(unused_imports)]
15047                use serde::de::Error;
15048                use std::option::Option::Some;
15049                let mut fields = std::collections::HashSet::new();
15050                let mut result = Self::Value::new();
15051                while let Some(tag) = map.next_key::<__FieldTag>()? {
15052                    #[allow(clippy::match_single_binding)]
15053                    match tag {
15054                        __FieldTag::__spokes => {
15055                            if !fields.insert(__FieldTag::__spokes) {
15056                                return std::result::Result::Err(A::Error::duplicate_field(
15057                                    "multiple values for spokes",
15058                                ));
15059                            }
15060                            result.spokes = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Spoke>>>()?.unwrap_or_default();
15061                        }
15062                        __FieldTag::__next_page_token => {
15063                            if !fields.insert(__FieldTag::__next_page_token) {
15064                                return std::result::Result::Err(A::Error::duplicate_field(
15065                                    "multiple values for next_page_token",
15066                                ));
15067                            }
15068                            result.next_page_token = map
15069                                .next_value::<std::option::Option<std::string::String>>()?
15070                                .unwrap_or_default();
15071                        }
15072                        __FieldTag::__unreachable => {
15073                            if !fields.insert(__FieldTag::__unreachable) {
15074                                return std::result::Result::Err(A::Error::duplicate_field(
15075                                    "multiple values for unreachable",
15076                                ));
15077                            }
15078                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
15079                        }
15080                        __FieldTag::Unknown(key) => {
15081                            let value = map.next_value::<serde_json::Value>()?;
15082                            result._unknown_fields.insert(key, value);
15083                        }
15084                    }
15085                }
15086                std::result::Result::Ok(result)
15087            }
15088        }
15089        deserializer.deserialize_any(Visitor)
15090    }
15091}
15092
15093#[doc(hidden)]
15094impl serde::ser::Serialize for ListHubSpokesResponse {
15095    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15096    where
15097        S: serde::ser::Serializer,
15098    {
15099        use serde::ser::SerializeMap;
15100        #[allow(unused_imports)]
15101        use std::option::Option::Some;
15102        let mut state = serializer.serialize_map(std::option::Option::None)?;
15103        if !self.spokes.is_empty() {
15104            state.serialize_entry("spokes", &self.spokes)?;
15105        }
15106        if !self.next_page_token.is_empty() {
15107            state.serialize_entry("nextPageToken", &self.next_page_token)?;
15108        }
15109        if !self.unreachable.is_empty() {
15110            state.serialize_entry("unreachable", &self.unreachable)?;
15111        }
15112        if !self._unknown_fields.is_empty() {
15113            for (key, value) in self._unknown_fields.iter() {
15114                state.serialize_entry(key, &value)?;
15115            }
15116        }
15117        state.end()
15118    }
15119}
15120
15121impl std::fmt::Debug for ListHubSpokesResponse {
15122    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15123        let mut debug_struct = f.debug_struct("ListHubSpokesResponse");
15124        debug_struct.field("spokes", &self.spokes);
15125        debug_struct.field("next_page_token", &self.next_page_token);
15126        debug_struct.field("unreachable", &self.unreachable);
15127        if !self._unknown_fields.is_empty() {
15128            debug_struct.field("_unknown_fields", &self._unknown_fields);
15129        }
15130        debug_struct.finish()
15131    }
15132}
15133
15134/// The request for
15135/// [HubService.QueryHubStatus][google.cloud.networkconnectivity.v1.HubService.QueryHubStatus].
15136///
15137/// [google.cloud.networkconnectivity.v1.HubService.QueryHubStatus]: crate::client::HubService::query_hub_status
15138#[derive(Clone, Default, PartialEq)]
15139#[non_exhaustive]
15140pub struct QueryHubStatusRequest {
15141    /// Required. The name of the hub.
15142    pub name: std::string::String,
15143
15144    /// Optional. The maximum number of results to return per page.
15145    pub page_size: i32,
15146
15147    /// Optional. The page token.
15148    pub page_token: std::string::String,
15149
15150    /// Optional. An expression that filters the list of results.
15151    /// The filter can be used to filter the results by the following fields:
15152    ///
15153    /// * `psc_propagation_status.source_spoke`
15154    /// * `psc_propagation_status.source_group`
15155    /// * `psc_propagation_status.source_forwarding_rule`
15156    /// * `psc_propagation_status.target_spoke`
15157    /// * `psc_propagation_status.target_group`
15158    /// * `psc_propagation_status.code`
15159    /// * `psc_propagation_status.message`
15160    pub filter: std::string::String,
15161
15162    /// Optional. Sort the results in ascending order by the specified fields.
15163    /// A comma-separated list of any of these fields:
15164    ///
15165    /// * `psc_propagation_status.source_spoke`
15166    /// * `psc_propagation_status.source_group`
15167    /// * `psc_propagation_status.source_forwarding_rule`
15168    /// * `psc_propagation_status.target_spoke`
15169    /// * `psc_propagation_status.target_group`
15170    /// * `psc_propagation_status.code`
15171    ///   If `group_by` is set, the value of the `order_by` field must be the
15172    ///   same as or a subset of the `group_by` field.
15173    pub order_by: std::string::String,
15174
15175    /// Optional. Aggregate the results by the specified fields.
15176    /// A comma-separated list of any of these fields:
15177    ///
15178    /// * `psc_propagation_status.source_spoke`
15179    /// * `psc_propagation_status.source_group`
15180    /// * `psc_propagation_status.source_forwarding_rule`
15181    /// * `psc_propagation_status.target_spoke`
15182    /// * `psc_propagation_status.target_group`
15183    /// * `psc_propagation_status.code`
15184    pub group_by: std::string::String,
15185
15186    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15187}
15188
15189impl QueryHubStatusRequest {
15190    pub fn new() -> Self {
15191        std::default::Default::default()
15192    }
15193
15194    /// Sets the value of [name][crate::model::QueryHubStatusRequest::name].
15195    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15196        self.name = v.into();
15197        self
15198    }
15199
15200    /// Sets the value of [page_size][crate::model::QueryHubStatusRequest::page_size].
15201    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15202        self.page_size = v.into();
15203        self
15204    }
15205
15206    /// Sets the value of [page_token][crate::model::QueryHubStatusRequest::page_token].
15207    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15208        self.page_token = v.into();
15209        self
15210    }
15211
15212    /// Sets the value of [filter][crate::model::QueryHubStatusRequest::filter].
15213    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15214        self.filter = v.into();
15215        self
15216    }
15217
15218    /// Sets the value of [order_by][crate::model::QueryHubStatusRequest::order_by].
15219    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15220        self.order_by = v.into();
15221        self
15222    }
15223
15224    /// Sets the value of [group_by][crate::model::QueryHubStatusRequest::group_by].
15225    pub fn set_group_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15226        self.group_by = v.into();
15227        self
15228    }
15229}
15230
15231impl wkt::message::Message for QueryHubStatusRequest {
15232    fn typename() -> &'static str {
15233        "type.googleapis.com/google.cloud.networkconnectivity.v1.QueryHubStatusRequest"
15234    }
15235}
15236
15237#[doc(hidden)]
15238impl<'de> serde::de::Deserialize<'de> for QueryHubStatusRequest {
15239    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15240    where
15241        D: serde::Deserializer<'de>,
15242    {
15243        #[allow(non_camel_case_types)]
15244        #[doc(hidden)]
15245        #[derive(PartialEq, Eq, Hash)]
15246        enum __FieldTag {
15247            __name,
15248            __page_size,
15249            __page_token,
15250            __filter,
15251            __order_by,
15252            __group_by,
15253            Unknown(std::string::String),
15254        }
15255        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15256            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15257            where
15258                D: serde::Deserializer<'de>,
15259            {
15260                struct Visitor;
15261                impl<'de> serde::de::Visitor<'de> for Visitor {
15262                    type Value = __FieldTag;
15263                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15264                        formatter.write_str("a field name for QueryHubStatusRequest")
15265                    }
15266                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15267                    where
15268                        E: serde::de::Error,
15269                    {
15270                        use std::result::Result::Ok;
15271                        use std::string::ToString;
15272                        match value {
15273                            "name" => Ok(__FieldTag::__name),
15274                            "pageSize" => Ok(__FieldTag::__page_size),
15275                            "page_size" => Ok(__FieldTag::__page_size),
15276                            "pageToken" => Ok(__FieldTag::__page_token),
15277                            "page_token" => Ok(__FieldTag::__page_token),
15278                            "filter" => Ok(__FieldTag::__filter),
15279                            "orderBy" => Ok(__FieldTag::__order_by),
15280                            "order_by" => Ok(__FieldTag::__order_by),
15281                            "groupBy" => Ok(__FieldTag::__group_by),
15282                            "group_by" => Ok(__FieldTag::__group_by),
15283                            _ => Ok(__FieldTag::Unknown(value.to_string())),
15284                        }
15285                    }
15286                }
15287                deserializer.deserialize_identifier(Visitor)
15288            }
15289        }
15290        struct Visitor;
15291        impl<'de> serde::de::Visitor<'de> for Visitor {
15292            type Value = QueryHubStatusRequest;
15293            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15294                formatter.write_str("struct QueryHubStatusRequest")
15295            }
15296            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15297            where
15298                A: serde::de::MapAccess<'de>,
15299            {
15300                #[allow(unused_imports)]
15301                use serde::de::Error;
15302                use std::option::Option::Some;
15303                let mut fields = std::collections::HashSet::new();
15304                let mut result = Self::Value::new();
15305                while let Some(tag) = map.next_key::<__FieldTag>()? {
15306                    #[allow(clippy::match_single_binding)]
15307                    match tag {
15308                        __FieldTag::__name => {
15309                            if !fields.insert(__FieldTag::__name) {
15310                                return std::result::Result::Err(A::Error::duplicate_field(
15311                                    "multiple values for name",
15312                                ));
15313                            }
15314                            result.name = map
15315                                .next_value::<std::option::Option<std::string::String>>()?
15316                                .unwrap_or_default();
15317                        }
15318                        __FieldTag::__page_size => {
15319                            if !fields.insert(__FieldTag::__page_size) {
15320                                return std::result::Result::Err(A::Error::duplicate_field(
15321                                    "multiple values for page_size",
15322                                ));
15323                            }
15324                            struct __With(std::option::Option<i32>);
15325                            impl<'de> serde::de::Deserialize<'de> for __With {
15326                                fn deserialize<D>(
15327                                    deserializer: D,
15328                                ) -> std::result::Result<Self, D::Error>
15329                                where
15330                                    D: serde::de::Deserializer<'de>,
15331                                {
15332                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
15333                                }
15334                            }
15335                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
15336                        }
15337                        __FieldTag::__page_token => {
15338                            if !fields.insert(__FieldTag::__page_token) {
15339                                return std::result::Result::Err(A::Error::duplicate_field(
15340                                    "multiple values for page_token",
15341                                ));
15342                            }
15343                            result.page_token = map
15344                                .next_value::<std::option::Option<std::string::String>>()?
15345                                .unwrap_or_default();
15346                        }
15347                        __FieldTag::__filter => {
15348                            if !fields.insert(__FieldTag::__filter) {
15349                                return std::result::Result::Err(A::Error::duplicate_field(
15350                                    "multiple values for filter",
15351                                ));
15352                            }
15353                            result.filter = map
15354                                .next_value::<std::option::Option<std::string::String>>()?
15355                                .unwrap_or_default();
15356                        }
15357                        __FieldTag::__order_by => {
15358                            if !fields.insert(__FieldTag::__order_by) {
15359                                return std::result::Result::Err(A::Error::duplicate_field(
15360                                    "multiple values for order_by",
15361                                ));
15362                            }
15363                            result.order_by = map
15364                                .next_value::<std::option::Option<std::string::String>>()?
15365                                .unwrap_or_default();
15366                        }
15367                        __FieldTag::__group_by => {
15368                            if !fields.insert(__FieldTag::__group_by) {
15369                                return std::result::Result::Err(A::Error::duplicate_field(
15370                                    "multiple values for group_by",
15371                                ));
15372                            }
15373                            result.group_by = map
15374                                .next_value::<std::option::Option<std::string::String>>()?
15375                                .unwrap_or_default();
15376                        }
15377                        __FieldTag::Unknown(key) => {
15378                            let value = map.next_value::<serde_json::Value>()?;
15379                            result._unknown_fields.insert(key, value);
15380                        }
15381                    }
15382                }
15383                std::result::Result::Ok(result)
15384            }
15385        }
15386        deserializer.deserialize_any(Visitor)
15387    }
15388}
15389
15390#[doc(hidden)]
15391impl serde::ser::Serialize for QueryHubStatusRequest {
15392    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15393    where
15394        S: serde::ser::Serializer,
15395    {
15396        use serde::ser::SerializeMap;
15397        #[allow(unused_imports)]
15398        use std::option::Option::Some;
15399        let mut state = serializer.serialize_map(std::option::Option::None)?;
15400        if !self.name.is_empty() {
15401            state.serialize_entry("name", &self.name)?;
15402        }
15403        if !wkt::internal::is_default(&self.page_size) {
15404            struct __With<'a>(&'a i32);
15405            impl<'a> serde::ser::Serialize for __With<'a> {
15406                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15407                where
15408                    S: serde::ser::Serializer,
15409                {
15410                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
15411                }
15412            }
15413            state.serialize_entry("pageSize", &__With(&self.page_size))?;
15414        }
15415        if !self.page_token.is_empty() {
15416            state.serialize_entry("pageToken", &self.page_token)?;
15417        }
15418        if !self.filter.is_empty() {
15419            state.serialize_entry("filter", &self.filter)?;
15420        }
15421        if !self.order_by.is_empty() {
15422            state.serialize_entry("orderBy", &self.order_by)?;
15423        }
15424        if !self.group_by.is_empty() {
15425            state.serialize_entry("groupBy", &self.group_by)?;
15426        }
15427        if !self._unknown_fields.is_empty() {
15428            for (key, value) in self._unknown_fields.iter() {
15429                state.serialize_entry(key, &value)?;
15430            }
15431        }
15432        state.end()
15433    }
15434}
15435
15436impl std::fmt::Debug for QueryHubStatusRequest {
15437    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15438        let mut debug_struct = f.debug_struct("QueryHubStatusRequest");
15439        debug_struct.field("name", &self.name);
15440        debug_struct.field("page_size", &self.page_size);
15441        debug_struct.field("page_token", &self.page_token);
15442        debug_struct.field("filter", &self.filter);
15443        debug_struct.field("order_by", &self.order_by);
15444        debug_struct.field("group_by", &self.group_by);
15445        if !self._unknown_fields.is_empty() {
15446            debug_struct.field("_unknown_fields", &self._unknown_fields);
15447        }
15448        debug_struct.finish()
15449    }
15450}
15451
15452/// The response for
15453/// [HubService.QueryHubStatus][google.cloud.networkconnectivity.v1.HubService.QueryHubStatus].
15454///
15455/// [google.cloud.networkconnectivity.v1.HubService.QueryHubStatus]: crate::client::HubService::query_hub_status
15456#[derive(Clone, Default, PartialEq)]
15457#[non_exhaustive]
15458pub struct QueryHubStatusResponse {
15459    /// The list of hub status.
15460    pub hub_status_entries: std::vec::Vec<crate::model::HubStatusEntry>,
15461
15462    /// The token for the next page of the response. To see more results,
15463    /// use this value as the page_token for your next request. If this value
15464    /// is empty, there are no more results.
15465    pub next_page_token: std::string::String,
15466
15467    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15468}
15469
15470impl QueryHubStatusResponse {
15471    pub fn new() -> Self {
15472        std::default::Default::default()
15473    }
15474
15475    /// Sets the value of [hub_status_entries][crate::model::QueryHubStatusResponse::hub_status_entries].
15476    pub fn set_hub_status_entries<T, V>(mut self, v: T) -> Self
15477    where
15478        T: std::iter::IntoIterator<Item = V>,
15479        V: std::convert::Into<crate::model::HubStatusEntry>,
15480    {
15481        use std::iter::Iterator;
15482        self.hub_status_entries = v.into_iter().map(|i| i.into()).collect();
15483        self
15484    }
15485
15486    /// Sets the value of [next_page_token][crate::model::QueryHubStatusResponse::next_page_token].
15487    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15488        self.next_page_token = v.into();
15489        self
15490    }
15491}
15492
15493impl wkt::message::Message for QueryHubStatusResponse {
15494    fn typename() -> &'static str {
15495        "type.googleapis.com/google.cloud.networkconnectivity.v1.QueryHubStatusResponse"
15496    }
15497}
15498
15499#[doc(hidden)]
15500impl gax::paginator::internal::PageableResponse for QueryHubStatusResponse {
15501    type PageItem = crate::model::HubStatusEntry;
15502
15503    fn items(self) -> std::vec::Vec<Self::PageItem> {
15504        self.hub_status_entries
15505    }
15506
15507    fn next_page_token(&self) -> std::string::String {
15508        use std::clone::Clone;
15509        self.next_page_token.clone()
15510    }
15511}
15512
15513#[doc(hidden)]
15514impl<'de> serde::de::Deserialize<'de> for QueryHubStatusResponse {
15515    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15516    where
15517        D: serde::Deserializer<'de>,
15518    {
15519        #[allow(non_camel_case_types)]
15520        #[doc(hidden)]
15521        #[derive(PartialEq, Eq, Hash)]
15522        enum __FieldTag {
15523            __hub_status_entries,
15524            __next_page_token,
15525            Unknown(std::string::String),
15526        }
15527        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15528            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15529            where
15530                D: serde::Deserializer<'de>,
15531            {
15532                struct Visitor;
15533                impl<'de> serde::de::Visitor<'de> for Visitor {
15534                    type Value = __FieldTag;
15535                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15536                        formatter.write_str("a field name for QueryHubStatusResponse")
15537                    }
15538                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15539                    where
15540                        E: serde::de::Error,
15541                    {
15542                        use std::result::Result::Ok;
15543                        use std::string::ToString;
15544                        match value {
15545                            "hubStatusEntries" => Ok(__FieldTag::__hub_status_entries),
15546                            "hub_status_entries" => Ok(__FieldTag::__hub_status_entries),
15547                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
15548                            "next_page_token" => Ok(__FieldTag::__next_page_token),
15549                            _ => Ok(__FieldTag::Unknown(value.to_string())),
15550                        }
15551                    }
15552                }
15553                deserializer.deserialize_identifier(Visitor)
15554            }
15555        }
15556        struct Visitor;
15557        impl<'de> serde::de::Visitor<'de> for Visitor {
15558            type Value = QueryHubStatusResponse;
15559            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15560                formatter.write_str("struct QueryHubStatusResponse")
15561            }
15562            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15563            where
15564                A: serde::de::MapAccess<'de>,
15565            {
15566                #[allow(unused_imports)]
15567                use serde::de::Error;
15568                use std::option::Option::Some;
15569                let mut fields = std::collections::HashSet::new();
15570                let mut result = Self::Value::new();
15571                while let Some(tag) = map.next_key::<__FieldTag>()? {
15572                    #[allow(clippy::match_single_binding)]
15573                    match tag {
15574                        __FieldTag::__hub_status_entries => {
15575                            if !fields.insert(__FieldTag::__hub_status_entries) {
15576                                return std::result::Result::Err(A::Error::duplicate_field(
15577                                    "multiple values for hub_status_entries",
15578                                ));
15579                            }
15580                            result.hub_status_entries =
15581                                map.next_value::<std::option::Option<
15582                                    std::vec::Vec<crate::model::HubStatusEntry>,
15583                                >>()?
15584                                .unwrap_or_default();
15585                        }
15586                        __FieldTag::__next_page_token => {
15587                            if !fields.insert(__FieldTag::__next_page_token) {
15588                                return std::result::Result::Err(A::Error::duplicate_field(
15589                                    "multiple values for next_page_token",
15590                                ));
15591                            }
15592                            result.next_page_token = map
15593                                .next_value::<std::option::Option<std::string::String>>()?
15594                                .unwrap_or_default();
15595                        }
15596                        __FieldTag::Unknown(key) => {
15597                            let value = map.next_value::<serde_json::Value>()?;
15598                            result._unknown_fields.insert(key, value);
15599                        }
15600                    }
15601                }
15602                std::result::Result::Ok(result)
15603            }
15604        }
15605        deserializer.deserialize_any(Visitor)
15606    }
15607}
15608
15609#[doc(hidden)]
15610impl serde::ser::Serialize for QueryHubStatusResponse {
15611    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15612    where
15613        S: serde::ser::Serializer,
15614    {
15615        use serde::ser::SerializeMap;
15616        #[allow(unused_imports)]
15617        use std::option::Option::Some;
15618        let mut state = serializer.serialize_map(std::option::Option::None)?;
15619        if !self.hub_status_entries.is_empty() {
15620            state.serialize_entry("hubStatusEntries", &self.hub_status_entries)?;
15621        }
15622        if !self.next_page_token.is_empty() {
15623            state.serialize_entry("nextPageToken", &self.next_page_token)?;
15624        }
15625        if !self._unknown_fields.is_empty() {
15626            for (key, value) in self._unknown_fields.iter() {
15627                state.serialize_entry(key, &value)?;
15628            }
15629        }
15630        state.end()
15631    }
15632}
15633
15634impl std::fmt::Debug for QueryHubStatusResponse {
15635    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15636        let mut debug_struct = f.debug_struct("QueryHubStatusResponse");
15637        debug_struct.field("hub_status_entries", &self.hub_status_entries);
15638        debug_struct.field("next_page_token", &self.next_page_token);
15639        if !self._unknown_fields.is_empty() {
15640            debug_struct.field("_unknown_fields", &self._unknown_fields);
15641        }
15642        debug_struct.finish()
15643    }
15644}
15645
15646/// A hub status entry represents the status of a set of propagated Private
15647/// Service Connect connections grouped by certain fields.
15648#[derive(Clone, Default, PartialEq)]
15649#[non_exhaustive]
15650pub struct HubStatusEntry {
15651    /// The number of propagated Private Service Connect connections with this
15652    /// status. If the `group_by` field was not set in the request message, the
15653    /// value of this field is 1.
15654    pub count: i32,
15655
15656    /// The fields that this entry is grouped by. This has the same value as the
15657    /// `group_by` field in the request message.
15658    pub group_by: std::string::String,
15659
15660    /// The Private Service Connect propagation status.
15661    pub psc_propagation_status: std::option::Option<crate::model::PscPropagationStatus>,
15662
15663    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15664}
15665
15666impl HubStatusEntry {
15667    pub fn new() -> Self {
15668        std::default::Default::default()
15669    }
15670
15671    /// Sets the value of [count][crate::model::HubStatusEntry::count].
15672    pub fn set_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15673        self.count = v.into();
15674        self
15675    }
15676
15677    /// Sets the value of [group_by][crate::model::HubStatusEntry::group_by].
15678    pub fn set_group_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15679        self.group_by = v.into();
15680        self
15681    }
15682
15683    /// Sets the value of [psc_propagation_status][crate::model::HubStatusEntry::psc_propagation_status].
15684    pub fn set_psc_propagation_status<T>(mut self, v: T) -> Self
15685    where
15686        T: std::convert::Into<crate::model::PscPropagationStatus>,
15687    {
15688        self.psc_propagation_status = std::option::Option::Some(v.into());
15689        self
15690    }
15691
15692    /// Sets or clears the value of [psc_propagation_status][crate::model::HubStatusEntry::psc_propagation_status].
15693    pub fn set_or_clear_psc_propagation_status<T>(mut self, v: std::option::Option<T>) -> Self
15694    where
15695        T: std::convert::Into<crate::model::PscPropagationStatus>,
15696    {
15697        self.psc_propagation_status = v.map(|x| x.into());
15698        self
15699    }
15700}
15701
15702impl wkt::message::Message for HubStatusEntry {
15703    fn typename() -> &'static str {
15704        "type.googleapis.com/google.cloud.networkconnectivity.v1.HubStatusEntry"
15705    }
15706}
15707
15708#[doc(hidden)]
15709impl<'de> serde::de::Deserialize<'de> for HubStatusEntry {
15710    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15711    where
15712        D: serde::Deserializer<'de>,
15713    {
15714        #[allow(non_camel_case_types)]
15715        #[doc(hidden)]
15716        #[derive(PartialEq, Eq, Hash)]
15717        enum __FieldTag {
15718            __count,
15719            __group_by,
15720            __psc_propagation_status,
15721            Unknown(std::string::String),
15722        }
15723        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15724            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15725            where
15726                D: serde::Deserializer<'de>,
15727            {
15728                struct Visitor;
15729                impl<'de> serde::de::Visitor<'de> for Visitor {
15730                    type Value = __FieldTag;
15731                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15732                        formatter.write_str("a field name for HubStatusEntry")
15733                    }
15734                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15735                    where
15736                        E: serde::de::Error,
15737                    {
15738                        use std::result::Result::Ok;
15739                        use std::string::ToString;
15740                        match value {
15741                            "count" => Ok(__FieldTag::__count),
15742                            "groupBy" => Ok(__FieldTag::__group_by),
15743                            "group_by" => Ok(__FieldTag::__group_by),
15744                            "pscPropagationStatus" => Ok(__FieldTag::__psc_propagation_status),
15745                            "psc_propagation_status" => Ok(__FieldTag::__psc_propagation_status),
15746                            _ => Ok(__FieldTag::Unknown(value.to_string())),
15747                        }
15748                    }
15749                }
15750                deserializer.deserialize_identifier(Visitor)
15751            }
15752        }
15753        struct Visitor;
15754        impl<'de> serde::de::Visitor<'de> for Visitor {
15755            type Value = HubStatusEntry;
15756            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15757                formatter.write_str("struct HubStatusEntry")
15758            }
15759            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15760            where
15761                A: serde::de::MapAccess<'de>,
15762            {
15763                #[allow(unused_imports)]
15764                use serde::de::Error;
15765                use std::option::Option::Some;
15766                let mut fields = std::collections::HashSet::new();
15767                let mut result = Self::Value::new();
15768                while let Some(tag) = map.next_key::<__FieldTag>()? {
15769                    #[allow(clippy::match_single_binding)]
15770                    match tag {
15771                        __FieldTag::__count => {
15772                            if !fields.insert(__FieldTag::__count) {
15773                                return std::result::Result::Err(A::Error::duplicate_field(
15774                                    "multiple values for count",
15775                                ));
15776                            }
15777                            struct __With(std::option::Option<i32>);
15778                            impl<'de> serde::de::Deserialize<'de> for __With {
15779                                fn deserialize<D>(
15780                                    deserializer: D,
15781                                ) -> std::result::Result<Self, D::Error>
15782                                where
15783                                    D: serde::de::Deserializer<'de>,
15784                                {
15785                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
15786                                }
15787                            }
15788                            result.count = map.next_value::<__With>()?.0.unwrap_or_default();
15789                        }
15790                        __FieldTag::__group_by => {
15791                            if !fields.insert(__FieldTag::__group_by) {
15792                                return std::result::Result::Err(A::Error::duplicate_field(
15793                                    "multiple values for group_by",
15794                                ));
15795                            }
15796                            result.group_by = map
15797                                .next_value::<std::option::Option<std::string::String>>()?
15798                                .unwrap_or_default();
15799                        }
15800                        __FieldTag::__psc_propagation_status => {
15801                            if !fields.insert(__FieldTag::__psc_propagation_status) {
15802                                return std::result::Result::Err(A::Error::duplicate_field(
15803                                    "multiple values for psc_propagation_status",
15804                                ));
15805                            }
15806                            result.psc_propagation_status = map.next_value::<std::option::Option<crate::model::PscPropagationStatus>>()?
15807                                ;
15808                        }
15809                        __FieldTag::Unknown(key) => {
15810                            let value = map.next_value::<serde_json::Value>()?;
15811                            result._unknown_fields.insert(key, value);
15812                        }
15813                    }
15814                }
15815                std::result::Result::Ok(result)
15816            }
15817        }
15818        deserializer.deserialize_any(Visitor)
15819    }
15820}
15821
15822#[doc(hidden)]
15823impl serde::ser::Serialize for HubStatusEntry {
15824    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15825    where
15826        S: serde::ser::Serializer,
15827    {
15828        use serde::ser::SerializeMap;
15829        #[allow(unused_imports)]
15830        use std::option::Option::Some;
15831        let mut state = serializer.serialize_map(std::option::Option::None)?;
15832        if !wkt::internal::is_default(&self.count) {
15833            struct __With<'a>(&'a i32);
15834            impl<'a> serde::ser::Serialize for __With<'a> {
15835                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15836                where
15837                    S: serde::ser::Serializer,
15838                {
15839                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
15840                }
15841            }
15842            state.serialize_entry("count", &__With(&self.count))?;
15843        }
15844        if !self.group_by.is_empty() {
15845            state.serialize_entry("groupBy", &self.group_by)?;
15846        }
15847        if self.psc_propagation_status.is_some() {
15848            state.serialize_entry("pscPropagationStatus", &self.psc_propagation_status)?;
15849        }
15850        if !self._unknown_fields.is_empty() {
15851            for (key, value) in self._unknown_fields.iter() {
15852                state.serialize_entry(key, &value)?;
15853            }
15854        }
15855        state.end()
15856    }
15857}
15858
15859impl std::fmt::Debug for HubStatusEntry {
15860    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15861        let mut debug_struct = f.debug_struct("HubStatusEntry");
15862        debug_struct.field("count", &self.count);
15863        debug_struct.field("group_by", &self.group_by);
15864        debug_struct.field("psc_propagation_status", &self.psc_propagation_status);
15865        if !self._unknown_fields.is_empty() {
15866            debug_struct.field("_unknown_fields", &self._unknown_fields);
15867        }
15868        debug_struct.finish()
15869    }
15870}
15871
15872/// The status of one or more propagated Private Service Connect connections in a
15873/// hub.
15874#[derive(Clone, Default, PartialEq)]
15875#[non_exhaustive]
15876pub struct PscPropagationStatus {
15877    /// The name of the spoke that the source forwarding rule belongs to.
15878    pub source_spoke: std::string::String,
15879
15880    /// The name of the group that the source spoke belongs to.
15881    pub source_group: std::string::String,
15882
15883    /// The name of the forwarding rule exported to the hub.
15884    pub source_forwarding_rule: std::string::String,
15885
15886    /// The name of the spoke that the source forwarding rule propagates to.
15887    pub target_spoke: std::string::String,
15888
15889    /// The name of the group that the target spoke belongs to.
15890    pub target_group: std::string::String,
15891
15892    /// The propagation status.
15893    pub code: crate::model::psc_propagation_status::Code,
15894
15895    /// The human-readable summary of the Private Service Connect connection
15896    /// propagation status.
15897    pub message: std::string::String,
15898
15899    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15900}
15901
15902impl PscPropagationStatus {
15903    pub fn new() -> Self {
15904        std::default::Default::default()
15905    }
15906
15907    /// Sets the value of [source_spoke][crate::model::PscPropagationStatus::source_spoke].
15908    pub fn set_source_spoke<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15909        self.source_spoke = v.into();
15910        self
15911    }
15912
15913    /// Sets the value of [source_group][crate::model::PscPropagationStatus::source_group].
15914    pub fn set_source_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15915        self.source_group = v.into();
15916        self
15917    }
15918
15919    /// Sets the value of [source_forwarding_rule][crate::model::PscPropagationStatus::source_forwarding_rule].
15920    pub fn set_source_forwarding_rule<T: std::convert::Into<std::string::String>>(
15921        mut self,
15922        v: T,
15923    ) -> Self {
15924        self.source_forwarding_rule = v.into();
15925        self
15926    }
15927
15928    /// Sets the value of [target_spoke][crate::model::PscPropagationStatus::target_spoke].
15929    pub fn set_target_spoke<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15930        self.target_spoke = v.into();
15931        self
15932    }
15933
15934    /// Sets the value of [target_group][crate::model::PscPropagationStatus::target_group].
15935    pub fn set_target_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15936        self.target_group = v.into();
15937        self
15938    }
15939
15940    /// Sets the value of [code][crate::model::PscPropagationStatus::code].
15941    pub fn set_code<T: std::convert::Into<crate::model::psc_propagation_status::Code>>(
15942        mut self,
15943        v: T,
15944    ) -> Self {
15945        self.code = v.into();
15946        self
15947    }
15948
15949    /// Sets the value of [message][crate::model::PscPropagationStatus::message].
15950    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15951        self.message = v.into();
15952        self
15953    }
15954}
15955
15956impl wkt::message::Message for PscPropagationStatus {
15957    fn typename() -> &'static str {
15958        "type.googleapis.com/google.cloud.networkconnectivity.v1.PscPropagationStatus"
15959    }
15960}
15961
15962#[doc(hidden)]
15963impl<'de> serde::de::Deserialize<'de> for PscPropagationStatus {
15964    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15965    where
15966        D: serde::Deserializer<'de>,
15967    {
15968        #[allow(non_camel_case_types)]
15969        #[doc(hidden)]
15970        #[derive(PartialEq, Eq, Hash)]
15971        enum __FieldTag {
15972            __source_spoke,
15973            __source_group,
15974            __source_forwarding_rule,
15975            __target_spoke,
15976            __target_group,
15977            __code,
15978            __message,
15979            Unknown(std::string::String),
15980        }
15981        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15982            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15983            where
15984                D: serde::Deserializer<'de>,
15985            {
15986                struct Visitor;
15987                impl<'de> serde::de::Visitor<'de> for Visitor {
15988                    type Value = __FieldTag;
15989                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15990                        formatter.write_str("a field name for PscPropagationStatus")
15991                    }
15992                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15993                    where
15994                        E: serde::de::Error,
15995                    {
15996                        use std::result::Result::Ok;
15997                        use std::string::ToString;
15998                        match value {
15999                            "sourceSpoke" => Ok(__FieldTag::__source_spoke),
16000                            "source_spoke" => Ok(__FieldTag::__source_spoke),
16001                            "sourceGroup" => Ok(__FieldTag::__source_group),
16002                            "source_group" => Ok(__FieldTag::__source_group),
16003                            "sourceForwardingRule" => Ok(__FieldTag::__source_forwarding_rule),
16004                            "source_forwarding_rule" => Ok(__FieldTag::__source_forwarding_rule),
16005                            "targetSpoke" => Ok(__FieldTag::__target_spoke),
16006                            "target_spoke" => Ok(__FieldTag::__target_spoke),
16007                            "targetGroup" => Ok(__FieldTag::__target_group),
16008                            "target_group" => Ok(__FieldTag::__target_group),
16009                            "code" => Ok(__FieldTag::__code),
16010                            "message" => Ok(__FieldTag::__message),
16011                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16012                        }
16013                    }
16014                }
16015                deserializer.deserialize_identifier(Visitor)
16016            }
16017        }
16018        struct Visitor;
16019        impl<'de> serde::de::Visitor<'de> for Visitor {
16020            type Value = PscPropagationStatus;
16021            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16022                formatter.write_str("struct PscPropagationStatus")
16023            }
16024            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16025            where
16026                A: serde::de::MapAccess<'de>,
16027            {
16028                #[allow(unused_imports)]
16029                use serde::de::Error;
16030                use std::option::Option::Some;
16031                let mut fields = std::collections::HashSet::new();
16032                let mut result = Self::Value::new();
16033                while let Some(tag) = map.next_key::<__FieldTag>()? {
16034                    #[allow(clippy::match_single_binding)]
16035                    match tag {
16036                        __FieldTag::__source_spoke => {
16037                            if !fields.insert(__FieldTag::__source_spoke) {
16038                                return std::result::Result::Err(A::Error::duplicate_field(
16039                                    "multiple values for source_spoke",
16040                                ));
16041                            }
16042                            result.source_spoke = map
16043                                .next_value::<std::option::Option<std::string::String>>()?
16044                                .unwrap_or_default();
16045                        }
16046                        __FieldTag::__source_group => {
16047                            if !fields.insert(__FieldTag::__source_group) {
16048                                return std::result::Result::Err(A::Error::duplicate_field(
16049                                    "multiple values for source_group",
16050                                ));
16051                            }
16052                            result.source_group = map
16053                                .next_value::<std::option::Option<std::string::String>>()?
16054                                .unwrap_or_default();
16055                        }
16056                        __FieldTag::__source_forwarding_rule => {
16057                            if !fields.insert(__FieldTag::__source_forwarding_rule) {
16058                                return std::result::Result::Err(A::Error::duplicate_field(
16059                                    "multiple values for source_forwarding_rule",
16060                                ));
16061                            }
16062                            result.source_forwarding_rule = map
16063                                .next_value::<std::option::Option<std::string::String>>()?
16064                                .unwrap_or_default();
16065                        }
16066                        __FieldTag::__target_spoke => {
16067                            if !fields.insert(__FieldTag::__target_spoke) {
16068                                return std::result::Result::Err(A::Error::duplicate_field(
16069                                    "multiple values for target_spoke",
16070                                ));
16071                            }
16072                            result.target_spoke = map
16073                                .next_value::<std::option::Option<std::string::String>>()?
16074                                .unwrap_or_default();
16075                        }
16076                        __FieldTag::__target_group => {
16077                            if !fields.insert(__FieldTag::__target_group) {
16078                                return std::result::Result::Err(A::Error::duplicate_field(
16079                                    "multiple values for target_group",
16080                                ));
16081                            }
16082                            result.target_group = map
16083                                .next_value::<std::option::Option<std::string::String>>()?
16084                                .unwrap_or_default();
16085                        }
16086                        __FieldTag::__code => {
16087                            if !fields.insert(__FieldTag::__code) {
16088                                return std::result::Result::Err(A::Error::duplicate_field(
16089                                    "multiple values for code",
16090                                ));
16091                            }
16092                            result.code = map.next_value::<std::option::Option<crate::model::psc_propagation_status::Code>>()?.unwrap_or_default();
16093                        }
16094                        __FieldTag::__message => {
16095                            if !fields.insert(__FieldTag::__message) {
16096                                return std::result::Result::Err(A::Error::duplicate_field(
16097                                    "multiple values for message",
16098                                ));
16099                            }
16100                            result.message = map
16101                                .next_value::<std::option::Option<std::string::String>>()?
16102                                .unwrap_or_default();
16103                        }
16104                        __FieldTag::Unknown(key) => {
16105                            let value = map.next_value::<serde_json::Value>()?;
16106                            result._unknown_fields.insert(key, value);
16107                        }
16108                    }
16109                }
16110                std::result::Result::Ok(result)
16111            }
16112        }
16113        deserializer.deserialize_any(Visitor)
16114    }
16115}
16116
16117#[doc(hidden)]
16118impl serde::ser::Serialize for PscPropagationStatus {
16119    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16120    where
16121        S: serde::ser::Serializer,
16122    {
16123        use serde::ser::SerializeMap;
16124        #[allow(unused_imports)]
16125        use std::option::Option::Some;
16126        let mut state = serializer.serialize_map(std::option::Option::None)?;
16127        if !self.source_spoke.is_empty() {
16128            state.serialize_entry("sourceSpoke", &self.source_spoke)?;
16129        }
16130        if !self.source_group.is_empty() {
16131            state.serialize_entry("sourceGroup", &self.source_group)?;
16132        }
16133        if !self.source_forwarding_rule.is_empty() {
16134            state.serialize_entry("sourceForwardingRule", &self.source_forwarding_rule)?;
16135        }
16136        if !self.target_spoke.is_empty() {
16137            state.serialize_entry("targetSpoke", &self.target_spoke)?;
16138        }
16139        if !self.target_group.is_empty() {
16140            state.serialize_entry("targetGroup", &self.target_group)?;
16141        }
16142        if !wkt::internal::is_default(&self.code) {
16143            state.serialize_entry("code", &self.code)?;
16144        }
16145        if !self.message.is_empty() {
16146            state.serialize_entry("message", &self.message)?;
16147        }
16148        if !self._unknown_fields.is_empty() {
16149            for (key, value) in self._unknown_fields.iter() {
16150                state.serialize_entry(key, &value)?;
16151            }
16152        }
16153        state.end()
16154    }
16155}
16156
16157impl std::fmt::Debug for PscPropagationStatus {
16158    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16159        let mut debug_struct = f.debug_struct("PscPropagationStatus");
16160        debug_struct.field("source_spoke", &self.source_spoke);
16161        debug_struct.field("source_group", &self.source_group);
16162        debug_struct.field("source_forwarding_rule", &self.source_forwarding_rule);
16163        debug_struct.field("target_spoke", &self.target_spoke);
16164        debug_struct.field("target_group", &self.target_group);
16165        debug_struct.field("code", &self.code);
16166        debug_struct.field("message", &self.message);
16167        if !self._unknown_fields.is_empty() {
16168            debug_struct.field("_unknown_fields", &self._unknown_fields);
16169        }
16170        debug_struct.finish()
16171    }
16172}
16173
16174/// Defines additional types related to [PscPropagationStatus].
16175pub mod psc_propagation_status {
16176    #[allow(unused_imports)]
16177    use super::*;
16178
16179    /// The Code enum represents the state of the Private Service Connect
16180    /// propagation.
16181    ///
16182    /// # Working with unknown values
16183    ///
16184    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16185    /// additional enum variants at any time. Adding new variants is not considered
16186    /// a breaking change. Applications should write their code in anticipation of:
16187    ///
16188    /// - New values appearing in future releases of the client library, **and**
16189    /// - New values received dynamically, without application changes.
16190    ///
16191    /// Please consult the [Working with enums] section in the user guide for some
16192    /// guidelines.
16193    ///
16194    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16195    #[derive(Clone, Debug, PartialEq)]
16196    #[non_exhaustive]
16197    pub enum Code {
16198        /// The code is unspecified.
16199        Unspecified,
16200        /// The propagated Private Service Connect connection is ready.
16201        Ready,
16202        /// The Private Service Connect connection is propagating. This is a
16203        /// transient state.
16204        Propagating,
16205        /// The Private Service Connect connection propagation failed because the VPC
16206        /// network or the project of the target spoke has exceeded the connection
16207        /// limit set by the producer.
16208        ErrorProducerPropagatedConnectionLimitExceeded,
16209        /// The Private Service Connect connection propagation failed because the NAT
16210        /// IP subnet space has been exhausted. It is equivalent to the `Needs
16211        /// attention` status of the Private Service Connect connection. See
16212        /// <https://cloud.google.com/vpc/docs/about-accessing-vpc-hosted-services-endpoints#connection-statuses>.
16213        ErrorProducerNatIpSpaceExhausted,
16214        /// The Private Service Connect connection propagation failed because the
16215        /// `PSC_ILB_CONSUMER_FORWARDING_RULES_PER_PRODUCER_NETWORK` quota in the
16216        /// producer VPC network has been exceeded.
16217        ErrorProducerQuotaExceeded,
16218        /// The Private Service Connect connection propagation failed because the
16219        /// `PSC_PROPAGATED_CONNECTIONS_PER_VPC_NETWORK` quota in the consumer
16220        /// VPC network has been exceeded.
16221        ErrorConsumerQuotaExceeded,
16222        /// If set, the enum was initialized with an unknown value.
16223        ///
16224        /// Applications can examine the value using [Code::value] or
16225        /// [Code::name].
16226        UnknownValue(code::UnknownValue),
16227    }
16228
16229    #[doc(hidden)]
16230    pub mod code {
16231        #[allow(unused_imports)]
16232        use super::*;
16233        #[derive(Clone, Debug, PartialEq)]
16234        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16235    }
16236
16237    impl Code {
16238        /// Gets the enum value.
16239        ///
16240        /// Returns `None` if the enum contains an unknown value deserialized from
16241        /// the string representation of enums.
16242        pub fn value(&self) -> std::option::Option<i32> {
16243            match self {
16244                Self::Unspecified => std::option::Option::Some(0),
16245                Self::Ready => std::option::Option::Some(1),
16246                Self::Propagating => std::option::Option::Some(2),
16247                Self::ErrorProducerPropagatedConnectionLimitExceeded => {
16248                    std::option::Option::Some(3)
16249                }
16250                Self::ErrorProducerNatIpSpaceExhausted => std::option::Option::Some(4),
16251                Self::ErrorProducerQuotaExceeded => std::option::Option::Some(5),
16252                Self::ErrorConsumerQuotaExceeded => std::option::Option::Some(6),
16253                Self::UnknownValue(u) => u.0.value(),
16254            }
16255        }
16256
16257        /// Gets the enum value as a string.
16258        ///
16259        /// Returns `None` if the enum contains an unknown value deserialized from
16260        /// the integer representation of enums.
16261        pub fn name(&self) -> std::option::Option<&str> {
16262            match self {
16263                Self::Unspecified => std::option::Option::Some("CODE_UNSPECIFIED"),
16264                Self::Ready => std::option::Option::Some("READY"),
16265                Self::Propagating => std::option::Option::Some("PROPAGATING"),
16266                Self::ErrorProducerPropagatedConnectionLimitExceeded => {
16267                    std::option::Option::Some("ERROR_PRODUCER_PROPAGATED_CONNECTION_LIMIT_EXCEEDED")
16268                }
16269                Self::ErrorProducerNatIpSpaceExhausted => {
16270                    std::option::Option::Some("ERROR_PRODUCER_NAT_IP_SPACE_EXHAUSTED")
16271                }
16272                Self::ErrorProducerQuotaExceeded => {
16273                    std::option::Option::Some("ERROR_PRODUCER_QUOTA_EXCEEDED")
16274                }
16275                Self::ErrorConsumerQuotaExceeded => {
16276                    std::option::Option::Some("ERROR_CONSUMER_QUOTA_EXCEEDED")
16277                }
16278                Self::UnknownValue(u) => u.0.name(),
16279            }
16280        }
16281    }
16282
16283    impl std::default::Default for Code {
16284        fn default() -> Self {
16285            use std::convert::From;
16286            Self::from(0)
16287        }
16288    }
16289
16290    impl std::fmt::Display for Code {
16291        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16292            wkt::internal::display_enum(f, self.name(), self.value())
16293        }
16294    }
16295
16296    impl std::convert::From<i32> for Code {
16297        fn from(value: i32) -> Self {
16298            match value {
16299                0 => Self::Unspecified,
16300                1 => Self::Ready,
16301                2 => Self::Propagating,
16302                3 => Self::ErrorProducerPropagatedConnectionLimitExceeded,
16303                4 => Self::ErrorProducerNatIpSpaceExhausted,
16304                5 => Self::ErrorProducerQuotaExceeded,
16305                6 => Self::ErrorConsumerQuotaExceeded,
16306                _ => Self::UnknownValue(code::UnknownValue(
16307                    wkt::internal::UnknownEnumValue::Integer(value),
16308                )),
16309            }
16310        }
16311    }
16312
16313    impl std::convert::From<&str> for Code {
16314        fn from(value: &str) -> Self {
16315            use std::string::ToString;
16316            match value {
16317                "CODE_UNSPECIFIED" => Self::Unspecified,
16318                "READY" => Self::Ready,
16319                "PROPAGATING" => Self::Propagating,
16320                "ERROR_PRODUCER_PROPAGATED_CONNECTION_LIMIT_EXCEEDED" => {
16321                    Self::ErrorProducerPropagatedConnectionLimitExceeded
16322                }
16323                "ERROR_PRODUCER_NAT_IP_SPACE_EXHAUSTED" => Self::ErrorProducerNatIpSpaceExhausted,
16324                "ERROR_PRODUCER_QUOTA_EXCEEDED" => Self::ErrorProducerQuotaExceeded,
16325                "ERROR_CONSUMER_QUOTA_EXCEEDED" => Self::ErrorConsumerQuotaExceeded,
16326                _ => Self::UnknownValue(code::UnknownValue(
16327                    wkt::internal::UnknownEnumValue::String(value.to_string()),
16328                )),
16329            }
16330        }
16331    }
16332
16333    impl serde::ser::Serialize for Code {
16334        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16335        where
16336            S: serde::Serializer,
16337        {
16338            match self {
16339                Self::Unspecified => serializer.serialize_i32(0),
16340                Self::Ready => serializer.serialize_i32(1),
16341                Self::Propagating => serializer.serialize_i32(2),
16342                Self::ErrorProducerPropagatedConnectionLimitExceeded => serializer.serialize_i32(3),
16343                Self::ErrorProducerNatIpSpaceExhausted => serializer.serialize_i32(4),
16344                Self::ErrorProducerQuotaExceeded => serializer.serialize_i32(5),
16345                Self::ErrorConsumerQuotaExceeded => serializer.serialize_i32(6),
16346                Self::UnknownValue(u) => u.0.serialize(serializer),
16347            }
16348        }
16349    }
16350
16351    impl<'de> serde::de::Deserialize<'de> for Code {
16352        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16353        where
16354            D: serde::Deserializer<'de>,
16355        {
16356            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Code>::new(
16357                ".google.cloud.networkconnectivity.v1.PscPropagationStatus.Code",
16358            ))
16359        }
16360    }
16361}
16362
16363/// The request for
16364/// [HubService.ListSpokes][google.cloud.networkconnectivity.v1.HubService.ListSpokes].
16365///
16366/// [google.cloud.networkconnectivity.v1.HubService.ListSpokes]: crate::client::HubService::list_spokes
16367#[derive(Clone, Default, PartialEq)]
16368#[non_exhaustive]
16369pub struct ListSpokesRequest {
16370    /// Required. The parent resource.
16371    pub parent: std::string::String,
16372
16373    /// The maximum number of results to return per page.
16374    pub page_size: i32,
16375
16376    /// The page token.
16377    pub page_token: std::string::String,
16378
16379    /// An expression that filters the list of results.
16380    pub filter: std::string::String,
16381
16382    /// Sort the results by a certain order.
16383    pub order_by: std::string::String,
16384
16385    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16386}
16387
16388impl ListSpokesRequest {
16389    pub fn new() -> Self {
16390        std::default::Default::default()
16391    }
16392
16393    /// Sets the value of [parent][crate::model::ListSpokesRequest::parent].
16394    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16395        self.parent = v.into();
16396        self
16397    }
16398
16399    /// Sets the value of [page_size][crate::model::ListSpokesRequest::page_size].
16400    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16401        self.page_size = v.into();
16402        self
16403    }
16404
16405    /// Sets the value of [page_token][crate::model::ListSpokesRequest::page_token].
16406    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16407        self.page_token = v.into();
16408        self
16409    }
16410
16411    /// Sets the value of [filter][crate::model::ListSpokesRequest::filter].
16412    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16413        self.filter = v.into();
16414        self
16415    }
16416
16417    /// Sets the value of [order_by][crate::model::ListSpokesRequest::order_by].
16418    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16419        self.order_by = v.into();
16420        self
16421    }
16422}
16423
16424impl wkt::message::Message for ListSpokesRequest {
16425    fn typename() -> &'static str {
16426        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListSpokesRequest"
16427    }
16428}
16429
16430#[doc(hidden)]
16431impl<'de> serde::de::Deserialize<'de> for ListSpokesRequest {
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            __parent,
16441            __page_size,
16442            __page_token,
16443            __filter,
16444            __order_by,
16445            Unknown(std::string::String),
16446        }
16447        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16448            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16449            where
16450                D: serde::Deserializer<'de>,
16451            {
16452                struct Visitor;
16453                impl<'de> serde::de::Visitor<'de> for Visitor {
16454                    type Value = __FieldTag;
16455                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16456                        formatter.write_str("a field name for ListSpokesRequest")
16457                    }
16458                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16459                    where
16460                        E: serde::de::Error,
16461                    {
16462                        use std::result::Result::Ok;
16463                        use std::string::ToString;
16464                        match value {
16465                            "parent" => Ok(__FieldTag::__parent),
16466                            "pageSize" => Ok(__FieldTag::__page_size),
16467                            "page_size" => Ok(__FieldTag::__page_size),
16468                            "pageToken" => Ok(__FieldTag::__page_token),
16469                            "page_token" => Ok(__FieldTag::__page_token),
16470                            "filter" => Ok(__FieldTag::__filter),
16471                            "orderBy" => Ok(__FieldTag::__order_by),
16472                            "order_by" => Ok(__FieldTag::__order_by),
16473                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16474                        }
16475                    }
16476                }
16477                deserializer.deserialize_identifier(Visitor)
16478            }
16479        }
16480        struct Visitor;
16481        impl<'de> serde::de::Visitor<'de> for Visitor {
16482            type Value = ListSpokesRequest;
16483            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16484                formatter.write_str("struct ListSpokesRequest")
16485            }
16486            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16487            where
16488                A: serde::de::MapAccess<'de>,
16489            {
16490                #[allow(unused_imports)]
16491                use serde::de::Error;
16492                use std::option::Option::Some;
16493                let mut fields = std::collections::HashSet::new();
16494                let mut result = Self::Value::new();
16495                while let Some(tag) = map.next_key::<__FieldTag>()? {
16496                    #[allow(clippy::match_single_binding)]
16497                    match tag {
16498                        __FieldTag::__parent => {
16499                            if !fields.insert(__FieldTag::__parent) {
16500                                return std::result::Result::Err(A::Error::duplicate_field(
16501                                    "multiple values for parent",
16502                                ));
16503                            }
16504                            result.parent = map
16505                                .next_value::<std::option::Option<std::string::String>>()?
16506                                .unwrap_or_default();
16507                        }
16508                        __FieldTag::__page_size => {
16509                            if !fields.insert(__FieldTag::__page_size) {
16510                                return std::result::Result::Err(A::Error::duplicate_field(
16511                                    "multiple values for page_size",
16512                                ));
16513                            }
16514                            struct __With(std::option::Option<i32>);
16515                            impl<'de> serde::de::Deserialize<'de> for __With {
16516                                fn deserialize<D>(
16517                                    deserializer: D,
16518                                ) -> std::result::Result<Self, D::Error>
16519                                where
16520                                    D: serde::de::Deserializer<'de>,
16521                                {
16522                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
16523                                }
16524                            }
16525                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
16526                        }
16527                        __FieldTag::__page_token => {
16528                            if !fields.insert(__FieldTag::__page_token) {
16529                                return std::result::Result::Err(A::Error::duplicate_field(
16530                                    "multiple values for page_token",
16531                                ));
16532                            }
16533                            result.page_token = map
16534                                .next_value::<std::option::Option<std::string::String>>()?
16535                                .unwrap_or_default();
16536                        }
16537                        __FieldTag::__filter => {
16538                            if !fields.insert(__FieldTag::__filter) {
16539                                return std::result::Result::Err(A::Error::duplicate_field(
16540                                    "multiple values for filter",
16541                                ));
16542                            }
16543                            result.filter = map
16544                                .next_value::<std::option::Option<std::string::String>>()?
16545                                .unwrap_or_default();
16546                        }
16547                        __FieldTag::__order_by => {
16548                            if !fields.insert(__FieldTag::__order_by) {
16549                                return std::result::Result::Err(A::Error::duplicate_field(
16550                                    "multiple values for order_by",
16551                                ));
16552                            }
16553                            result.order_by = map
16554                                .next_value::<std::option::Option<std::string::String>>()?
16555                                .unwrap_or_default();
16556                        }
16557                        __FieldTag::Unknown(key) => {
16558                            let value = map.next_value::<serde_json::Value>()?;
16559                            result._unknown_fields.insert(key, value);
16560                        }
16561                    }
16562                }
16563                std::result::Result::Ok(result)
16564            }
16565        }
16566        deserializer.deserialize_any(Visitor)
16567    }
16568}
16569
16570#[doc(hidden)]
16571impl serde::ser::Serialize for ListSpokesRequest {
16572    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16573    where
16574        S: serde::ser::Serializer,
16575    {
16576        use serde::ser::SerializeMap;
16577        #[allow(unused_imports)]
16578        use std::option::Option::Some;
16579        let mut state = serializer.serialize_map(std::option::Option::None)?;
16580        if !self.parent.is_empty() {
16581            state.serialize_entry("parent", &self.parent)?;
16582        }
16583        if !wkt::internal::is_default(&self.page_size) {
16584            struct __With<'a>(&'a i32);
16585            impl<'a> serde::ser::Serialize for __With<'a> {
16586                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16587                where
16588                    S: serde::ser::Serializer,
16589                {
16590                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
16591                }
16592            }
16593            state.serialize_entry("pageSize", &__With(&self.page_size))?;
16594        }
16595        if !self.page_token.is_empty() {
16596            state.serialize_entry("pageToken", &self.page_token)?;
16597        }
16598        if !self.filter.is_empty() {
16599            state.serialize_entry("filter", &self.filter)?;
16600        }
16601        if !self.order_by.is_empty() {
16602            state.serialize_entry("orderBy", &self.order_by)?;
16603        }
16604        if !self._unknown_fields.is_empty() {
16605            for (key, value) in self._unknown_fields.iter() {
16606                state.serialize_entry(key, &value)?;
16607            }
16608        }
16609        state.end()
16610    }
16611}
16612
16613impl std::fmt::Debug for ListSpokesRequest {
16614    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16615        let mut debug_struct = f.debug_struct("ListSpokesRequest");
16616        debug_struct.field("parent", &self.parent);
16617        debug_struct.field("page_size", &self.page_size);
16618        debug_struct.field("page_token", &self.page_token);
16619        debug_struct.field("filter", &self.filter);
16620        debug_struct.field("order_by", &self.order_by);
16621        if !self._unknown_fields.is_empty() {
16622            debug_struct.field("_unknown_fields", &self._unknown_fields);
16623        }
16624        debug_struct.finish()
16625    }
16626}
16627
16628/// The response for
16629/// [HubService.ListSpokes][google.cloud.networkconnectivity.v1.HubService.ListSpokes].
16630///
16631/// [google.cloud.networkconnectivity.v1.HubService.ListSpokes]: crate::client::HubService::list_spokes
16632#[derive(Clone, Default, PartialEq)]
16633#[non_exhaustive]
16634pub struct ListSpokesResponse {
16635    /// The requested spokes.
16636    pub spokes: std::vec::Vec<crate::model::Spoke>,
16637
16638    /// The token for the next page of the response. To see more results,
16639    /// use this value as the page_token for your next request. If this value
16640    /// is empty, there are no more results.
16641    pub next_page_token: std::string::String,
16642
16643    /// Locations that could not be reached.
16644    pub unreachable: std::vec::Vec<std::string::String>,
16645
16646    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16647}
16648
16649impl ListSpokesResponse {
16650    pub fn new() -> Self {
16651        std::default::Default::default()
16652    }
16653
16654    /// Sets the value of [spokes][crate::model::ListSpokesResponse::spokes].
16655    pub fn set_spokes<T, V>(mut self, v: T) -> Self
16656    where
16657        T: std::iter::IntoIterator<Item = V>,
16658        V: std::convert::Into<crate::model::Spoke>,
16659    {
16660        use std::iter::Iterator;
16661        self.spokes = v.into_iter().map(|i| i.into()).collect();
16662        self
16663    }
16664
16665    /// Sets the value of [next_page_token][crate::model::ListSpokesResponse::next_page_token].
16666    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16667        self.next_page_token = v.into();
16668        self
16669    }
16670
16671    /// Sets the value of [unreachable][crate::model::ListSpokesResponse::unreachable].
16672    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
16673    where
16674        T: std::iter::IntoIterator<Item = V>,
16675        V: std::convert::Into<std::string::String>,
16676    {
16677        use std::iter::Iterator;
16678        self.unreachable = v.into_iter().map(|i| i.into()).collect();
16679        self
16680    }
16681}
16682
16683impl wkt::message::Message for ListSpokesResponse {
16684    fn typename() -> &'static str {
16685        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListSpokesResponse"
16686    }
16687}
16688
16689#[doc(hidden)]
16690impl gax::paginator::internal::PageableResponse for ListSpokesResponse {
16691    type PageItem = crate::model::Spoke;
16692
16693    fn items(self) -> std::vec::Vec<Self::PageItem> {
16694        self.spokes
16695    }
16696
16697    fn next_page_token(&self) -> std::string::String {
16698        use std::clone::Clone;
16699        self.next_page_token.clone()
16700    }
16701}
16702
16703#[doc(hidden)]
16704impl<'de> serde::de::Deserialize<'de> for ListSpokesResponse {
16705    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16706    where
16707        D: serde::Deserializer<'de>,
16708    {
16709        #[allow(non_camel_case_types)]
16710        #[doc(hidden)]
16711        #[derive(PartialEq, Eq, Hash)]
16712        enum __FieldTag {
16713            __spokes,
16714            __next_page_token,
16715            __unreachable,
16716            Unknown(std::string::String),
16717        }
16718        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16719            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16720            where
16721                D: serde::Deserializer<'de>,
16722            {
16723                struct Visitor;
16724                impl<'de> serde::de::Visitor<'de> for Visitor {
16725                    type Value = __FieldTag;
16726                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16727                        formatter.write_str("a field name for ListSpokesResponse")
16728                    }
16729                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16730                    where
16731                        E: serde::de::Error,
16732                    {
16733                        use std::result::Result::Ok;
16734                        use std::string::ToString;
16735                        match value {
16736                            "spokes" => Ok(__FieldTag::__spokes),
16737                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
16738                            "next_page_token" => Ok(__FieldTag::__next_page_token),
16739                            "unreachable" => Ok(__FieldTag::__unreachable),
16740                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16741                        }
16742                    }
16743                }
16744                deserializer.deserialize_identifier(Visitor)
16745            }
16746        }
16747        struct Visitor;
16748        impl<'de> serde::de::Visitor<'de> for Visitor {
16749            type Value = ListSpokesResponse;
16750            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16751                formatter.write_str("struct ListSpokesResponse")
16752            }
16753            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16754            where
16755                A: serde::de::MapAccess<'de>,
16756            {
16757                #[allow(unused_imports)]
16758                use serde::de::Error;
16759                use std::option::Option::Some;
16760                let mut fields = std::collections::HashSet::new();
16761                let mut result = Self::Value::new();
16762                while let Some(tag) = map.next_key::<__FieldTag>()? {
16763                    #[allow(clippy::match_single_binding)]
16764                    match tag {
16765                        __FieldTag::__spokes => {
16766                            if !fields.insert(__FieldTag::__spokes) {
16767                                return std::result::Result::Err(A::Error::duplicate_field(
16768                                    "multiple values for spokes",
16769                                ));
16770                            }
16771                            result.spokes = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Spoke>>>()?.unwrap_or_default();
16772                        }
16773                        __FieldTag::__next_page_token => {
16774                            if !fields.insert(__FieldTag::__next_page_token) {
16775                                return std::result::Result::Err(A::Error::duplicate_field(
16776                                    "multiple values for next_page_token",
16777                                ));
16778                            }
16779                            result.next_page_token = map
16780                                .next_value::<std::option::Option<std::string::String>>()?
16781                                .unwrap_or_default();
16782                        }
16783                        __FieldTag::__unreachable => {
16784                            if !fields.insert(__FieldTag::__unreachable) {
16785                                return std::result::Result::Err(A::Error::duplicate_field(
16786                                    "multiple values for unreachable",
16787                                ));
16788                            }
16789                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
16790                        }
16791                        __FieldTag::Unknown(key) => {
16792                            let value = map.next_value::<serde_json::Value>()?;
16793                            result._unknown_fields.insert(key, value);
16794                        }
16795                    }
16796                }
16797                std::result::Result::Ok(result)
16798            }
16799        }
16800        deserializer.deserialize_any(Visitor)
16801    }
16802}
16803
16804#[doc(hidden)]
16805impl serde::ser::Serialize for ListSpokesResponse {
16806    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16807    where
16808        S: serde::ser::Serializer,
16809    {
16810        use serde::ser::SerializeMap;
16811        #[allow(unused_imports)]
16812        use std::option::Option::Some;
16813        let mut state = serializer.serialize_map(std::option::Option::None)?;
16814        if !self.spokes.is_empty() {
16815            state.serialize_entry("spokes", &self.spokes)?;
16816        }
16817        if !self.next_page_token.is_empty() {
16818            state.serialize_entry("nextPageToken", &self.next_page_token)?;
16819        }
16820        if !self.unreachable.is_empty() {
16821            state.serialize_entry("unreachable", &self.unreachable)?;
16822        }
16823        if !self._unknown_fields.is_empty() {
16824            for (key, value) in self._unknown_fields.iter() {
16825                state.serialize_entry(key, &value)?;
16826            }
16827        }
16828        state.end()
16829    }
16830}
16831
16832impl std::fmt::Debug for ListSpokesResponse {
16833    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16834        let mut debug_struct = f.debug_struct("ListSpokesResponse");
16835        debug_struct.field("spokes", &self.spokes);
16836        debug_struct.field("next_page_token", &self.next_page_token);
16837        debug_struct.field("unreachable", &self.unreachable);
16838        if !self._unknown_fields.is_empty() {
16839            debug_struct.field("_unknown_fields", &self._unknown_fields);
16840        }
16841        debug_struct.finish()
16842    }
16843}
16844
16845/// The request for
16846/// [HubService.GetSpoke][google.cloud.networkconnectivity.v1.HubService.GetSpoke].
16847///
16848/// [google.cloud.networkconnectivity.v1.HubService.GetSpoke]: crate::client::HubService::get_spoke
16849#[derive(Clone, Default, PartialEq)]
16850#[non_exhaustive]
16851pub struct GetSpokeRequest {
16852    /// Required. The name of the spoke resource.
16853    pub name: std::string::String,
16854
16855    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16856}
16857
16858impl GetSpokeRequest {
16859    pub fn new() -> Self {
16860        std::default::Default::default()
16861    }
16862
16863    /// Sets the value of [name][crate::model::GetSpokeRequest::name].
16864    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16865        self.name = v.into();
16866        self
16867    }
16868}
16869
16870impl wkt::message::Message for GetSpokeRequest {
16871    fn typename() -> &'static str {
16872        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetSpokeRequest"
16873    }
16874}
16875
16876#[doc(hidden)]
16877impl<'de> serde::de::Deserialize<'de> for GetSpokeRequest {
16878    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16879    where
16880        D: serde::Deserializer<'de>,
16881    {
16882        #[allow(non_camel_case_types)]
16883        #[doc(hidden)]
16884        #[derive(PartialEq, Eq, Hash)]
16885        enum __FieldTag {
16886            __name,
16887            Unknown(std::string::String),
16888        }
16889        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16890            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16891            where
16892                D: serde::Deserializer<'de>,
16893            {
16894                struct Visitor;
16895                impl<'de> serde::de::Visitor<'de> for Visitor {
16896                    type Value = __FieldTag;
16897                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16898                        formatter.write_str("a field name for GetSpokeRequest")
16899                    }
16900                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16901                    where
16902                        E: serde::de::Error,
16903                    {
16904                        use std::result::Result::Ok;
16905                        use std::string::ToString;
16906                        match value {
16907                            "name" => Ok(__FieldTag::__name),
16908                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16909                        }
16910                    }
16911                }
16912                deserializer.deserialize_identifier(Visitor)
16913            }
16914        }
16915        struct Visitor;
16916        impl<'de> serde::de::Visitor<'de> for Visitor {
16917            type Value = GetSpokeRequest;
16918            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16919                formatter.write_str("struct GetSpokeRequest")
16920            }
16921            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16922            where
16923                A: serde::de::MapAccess<'de>,
16924            {
16925                #[allow(unused_imports)]
16926                use serde::de::Error;
16927                use std::option::Option::Some;
16928                let mut fields = std::collections::HashSet::new();
16929                let mut result = Self::Value::new();
16930                while let Some(tag) = map.next_key::<__FieldTag>()? {
16931                    #[allow(clippy::match_single_binding)]
16932                    match tag {
16933                        __FieldTag::__name => {
16934                            if !fields.insert(__FieldTag::__name) {
16935                                return std::result::Result::Err(A::Error::duplicate_field(
16936                                    "multiple values for name",
16937                                ));
16938                            }
16939                            result.name = map
16940                                .next_value::<std::option::Option<std::string::String>>()?
16941                                .unwrap_or_default();
16942                        }
16943                        __FieldTag::Unknown(key) => {
16944                            let value = map.next_value::<serde_json::Value>()?;
16945                            result._unknown_fields.insert(key, value);
16946                        }
16947                    }
16948                }
16949                std::result::Result::Ok(result)
16950            }
16951        }
16952        deserializer.deserialize_any(Visitor)
16953    }
16954}
16955
16956#[doc(hidden)]
16957impl serde::ser::Serialize for GetSpokeRequest {
16958    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16959    where
16960        S: serde::ser::Serializer,
16961    {
16962        use serde::ser::SerializeMap;
16963        #[allow(unused_imports)]
16964        use std::option::Option::Some;
16965        let mut state = serializer.serialize_map(std::option::Option::None)?;
16966        if !self.name.is_empty() {
16967            state.serialize_entry("name", &self.name)?;
16968        }
16969        if !self._unknown_fields.is_empty() {
16970            for (key, value) in self._unknown_fields.iter() {
16971                state.serialize_entry(key, &value)?;
16972            }
16973        }
16974        state.end()
16975    }
16976}
16977
16978impl std::fmt::Debug for GetSpokeRequest {
16979    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16980        let mut debug_struct = f.debug_struct("GetSpokeRequest");
16981        debug_struct.field("name", &self.name);
16982        if !self._unknown_fields.is_empty() {
16983            debug_struct.field("_unknown_fields", &self._unknown_fields);
16984        }
16985        debug_struct.finish()
16986    }
16987}
16988
16989/// The request for
16990/// [HubService.CreateSpoke][google.cloud.networkconnectivity.v1.HubService.CreateSpoke].
16991///
16992/// [google.cloud.networkconnectivity.v1.HubService.CreateSpoke]: crate::client::HubService::create_spoke
16993#[derive(Clone, Default, PartialEq)]
16994#[non_exhaustive]
16995pub struct CreateSpokeRequest {
16996    /// Required. The parent resource.
16997    pub parent: std::string::String,
16998
16999    /// Required. Unique id for the spoke to create.
17000    pub spoke_id: std::string::String,
17001
17002    /// Required. The initial values for a new spoke.
17003    pub spoke: std::option::Option<crate::model::Spoke>,
17004
17005    /// Optional. A request ID to identify requests. Specify a unique request ID so
17006    /// that if you must retry your request, the server knows to ignore the request
17007    /// if it has already been completed. The server guarantees that a request
17008    /// doesn't result in creation of duplicate commitments for at least 60
17009    /// minutes.
17010    ///
17011    /// For example, consider a situation where you make an initial request and
17012    /// the request times out. If you make the request again with the same request
17013    /// ID, the server can check to see whether the original operation
17014    /// was received. If it was, the server ignores the second request. This
17015    /// behavior prevents clients from mistakenly creating duplicate commitments.
17016    ///
17017    /// The request ID must be a valid UUID, with the exception that zero UUID is
17018    /// not supported (00000000-0000-0000-0000-000000000000).
17019    pub request_id: std::string::String,
17020
17021    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17022}
17023
17024impl CreateSpokeRequest {
17025    pub fn new() -> Self {
17026        std::default::Default::default()
17027    }
17028
17029    /// Sets the value of [parent][crate::model::CreateSpokeRequest::parent].
17030    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17031        self.parent = v.into();
17032        self
17033    }
17034
17035    /// Sets the value of [spoke_id][crate::model::CreateSpokeRequest::spoke_id].
17036    pub fn set_spoke_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17037        self.spoke_id = v.into();
17038        self
17039    }
17040
17041    /// Sets the value of [spoke][crate::model::CreateSpokeRequest::spoke].
17042    pub fn set_spoke<T>(mut self, v: T) -> Self
17043    where
17044        T: std::convert::Into<crate::model::Spoke>,
17045    {
17046        self.spoke = std::option::Option::Some(v.into());
17047        self
17048    }
17049
17050    /// Sets or clears the value of [spoke][crate::model::CreateSpokeRequest::spoke].
17051    pub fn set_or_clear_spoke<T>(mut self, v: std::option::Option<T>) -> Self
17052    where
17053        T: std::convert::Into<crate::model::Spoke>,
17054    {
17055        self.spoke = v.map(|x| x.into());
17056        self
17057    }
17058
17059    /// Sets the value of [request_id][crate::model::CreateSpokeRequest::request_id].
17060    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17061        self.request_id = v.into();
17062        self
17063    }
17064}
17065
17066impl wkt::message::Message for CreateSpokeRequest {
17067    fn typename() -> &'static str {
17068        "type.googleapis.com/google.cloud.networkconnectivity.v1.CreateSpokeRequest"
17069    }
17070}
17071
17072#[doc(hidden)]
17073impl<'de> serde::de::Deserialize<'de> for CreateSpokeRequest {
17074    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17075    where
17076        D: serde::Deserializer<'de>,
17077    {
17078        #[allow(non_camel_case_types)]
17079        #[doc(hidden)]
17080        #[derive(PartialEq, Eq, Hash)]
17081        enum __FieldTag {
17082            __parent,
17083            __spoke_id,
17084            __spoke,
17085            __request_id,
17086            Unknown(std::string::String),
17087        }
17088        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17089            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17090            where
17091                D: serde::Deserializer<'de>,
17092            {
17093                struct Visitor;
17094                impl<'de> serde::de::Visitor<'de> for Visitor {
17095                    type Value = __FieldTag;
17096                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17097                        formatter.write_str("a field name for CreateSpokeRequest")
17098                    }
17099                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17100                    where
17101                        E: serde::de::Error,
17102                    {
17103                        use std::result::Result::Ok;
17104                        use std::string::ToString;
17105                        match value {
17106                            "parent" => Ok(__FieldTag::__parent),
17107                            "spokeId" => Ok(__FieldTag::__spoke_id),
17108                            "spoke_id" => Ok(__FieldTag::__spoke_id),
17109                            "spoke" => Ok(__FieldTag::__spoke),
17110                            "requestId" => Ok(__FieldTag::__request_id),
17111                            "request_id" => Ok(__FieldTag::__request_id),
17112                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17113                        }
17114                    }
17115                }
17116                deserializer.deserialize_identifier(Visitor)
17117            }
17118        }
17119        struct Visitor;
17120        impl<'de> serde::de::Visitor<'de> for Visitor {
17121            type Value = CreateSpokeRequest;
17122            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17123                formatter.write_str("struct CreateSpokeRequest")
17124            }
17125            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17126            where
17127                A: serde::de::MapAccess<'de>,
17128            {
17129                #[allow(unused_imports)]
17130                use serde::de::Error;
17131                use std::option::Option::Some;
17132                let mut fields = std::collections::HashSet::new();
17133                let mut result = Self::Value::new();
17134                while let Some(tag) = map.next_key::<__FieldTag>()? {
17135                    #[allow(clippy::match_single_binding)]
17136                    match tag {
17137                        __FieldTag::__parent => {
17138                            if !fields.insert(__FieldTag::__parent) {
17139                                return std::result::Result::Err(A::Error::duplicate_field(
17140                                    "multiple values for parent",
17141                                ));
17142                            }
17143                            result.parent = map
17144                                .next_value::<std::option::Option<std::string::String>>()?
17145                                .unwrap_or_default();
17146                        }
17147                        __FieldTag::__spoke_id => {
17148                            if !fields.insert(__FieldTag::__spoke_id) {
17149                                return std::result::Result::Err(A::Error::duplicate_field(
17150                                    "multiple values for spoke_id",
17151                                ));
17152                            }
17153                            result.spoke_id = map
17154                                .next_value::<std::option::Option<std::string::String>>()?
17155                                .unwrap_or_default();
17156                        }
17157                        __FieldTag::__spoke => {
17158                            if !fields.insert(__FieldTag::__spoke) {
17159                                return std::result::Result::Err(A::Error::duplicate_field(
17160                                    "multiple values for spoke",
17161                                ));
17162                            }
17163                            result.spoke =
17164                                map.next_value::<std::option::Option<crate::model::Spoke>>()?;
17165                        }
17166                        __FieldTag::__request_id => {
17167                            if !fields.insert(__FieldTag::__request_id) {
17168                                return std::result::Result::Err(A::Error::duplicate_field(
17169                                    "multiple values for request_id",
17170                                ));
17171                            }
17172                            result.request_id = map
17173                                .next_value::<std::option::Option<std::string::String>>()?
17174                                .unwrap_or_default();
17175                        }
17176                        __FieldTag::Unknown(key) => {
17177                            let value = map.next_value::<serde_json::Value>()?;
17178                            result._unknown_fields.insert(key, value);
17179                        }
17180                    }
17181                }
17182                std::result::Result::Ok(result)
17183            }
17184        }
17185        deserializer.deserialize_any(Visitor)
17186    }
17187}
17188
17189#[doc(hidden)]
17190impl serde::ser::Serialize for CreateSpokeRequest {
17191    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17192    where
17193        S: serde::ser::Serializer,
17194    {
17195        use serde::ser::SerializeMap;
17196        #[allow(unused_imports)]
17197        use std::option::Option::Some;
17198        let mut state = serializer.serialize_map(std::option::Option::None)?;
17199        if !self.parent.is_empty() {
17200            state.serialize_entry("parent", &self.parent)?;
17201        }
17202        if !self.spoke_id.is_empty() {
17203            state.serialize_entry("spokeId", &self.spoke_id)?;
17204        }
17205        if self.spoke.is_some() {
17206            state.serialize_entry("spoke", &self.spoke)?;
17207        }
17208        if !self.request_id.is_empty() {
17209            state.serialize_entry("requestId", &self.request_id)?;
17210        }
17211        if !self._unknown_fields.is_empty() {
17212            for (key, value) in self._unknown_fields.iter() {
17213                state.serialize_entry(key, &value)?;
17214            }
17215        }
17216        state.end()
17217    }
17218}
17219
17220impl std::fmt::Debug for CreateSpokeRequest {
17221    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17222        let mut debug_struct = f.debug_struct("CreateSpokeRequest");
17223        debug_struct.field("parent", &self.parent);
17224        debug_struct.field("spoke_id", &self.spoke_id);
17225        debug_struct.field("spoke", &self.spoke);
17226        debug_struct.field("request_id", &self.request_id);
17227        if !self._unknown_fields.is_empty() {
17228            debug_struct.field("_unknown_fields", &self._unknown_fields);
17229        }
17230        debug_struct.finish()
17231    }
17232}
17233
17234/// Request for
17235/// [HubService.UpdateSpoke][google.cloud.networkconnectivity.v1.HubService.UpdateSpoke]
17236/// method.
17237///
17238/// [google.cloud.networkconnectivity.v1.HubService.UpdateSpoke]: crate::client::HubService::update_spoke
17239#[derive(Clone, Default, PartialEq)]
17240#[non_exhaustive]
17241pub struct UpdateSpokeRequest {
17242    /// Optional. In the case of an update to an existing spoke, field mask is used
17243    /// to specify the fields to be overwritten. The fields specified in the
17244    /// update_mask are relative to the resource, not the full request. A field is
17245    /// overwritten if it is in the mask. If the user does not provide a mask, then
17246    /// all fields are overwritten.
17247    pub update_mask: std::option::Option<wkt::FieldMask>,
17248
17249    /// Required. The state that the spoke should be in after the update.
17250    pub spoke: std::option::Option<crate::model::Spoke>,
17251
17252    /// Optional. A request ID to identify requests. Specify a unique request ID so
17253    /// that if you must retry your request, the server knows to ignore the request
17254    /// if it has already been completed. The server guarantees that a request
17255    /// doesn't result in creation of duplicate commitments for at least 60
17256    /// minutes.
17257    ///
17258    /// For example, consider a situation where you make an initial request and
17259    /// the request times out. If you make the request again with the same request
17260    /// ID, the server can check to see whether the original operation
17261    /// was received. If it was, the server ignores the second request. This
17262    /// behavior prevents clients from mistakenly creating duplicate commitments.
17263    ///
17264    /// The request ID must be a valid UUID, with the exception that zero UUID is
17265    /// not supported (00000000-0000-0000-0000-000000000000).
17266    pub request_id: std::string::String,
17267
17268    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17269}
17270
17271impl UpdateSpokeRequest {
17272    pub fn new() -> Self {
17273        std::default::Default::default()
17274    }
17275
17276    /// Sets the value of [update_mask][crate::model::UpdateSpokeRequest::update_mask].
17277    pub fn set_update_mask<T>(mut self, v: T) -> Self
17278    where
17279        T: std::convert::Into<wkt::FieldMask>,
17280    {
17281        self.update_mask = std::option::Option::Some(v.into());
17282        self
17283    }
17284
17285    /// Sets or clears the value of [update_mask][crate::model::UpdateSpokeRequest::update_mask].
17286    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
17287    where
17288        T: std::convert::Into<wkt::FieldMask>,
17289    {
17290        self.update_mask = v.map(|x| x.into());
17291        self
17292    }
17293
17294    /// Sets the value of [spoke][crate::model::UpdateSpokeRequest::spoke].
17295    pub fn set_spoke<T>(mut self, v: T) -> Self
17296    where
17297        T: std::convert::Into<crate::model::Spoke>,
17298    {
17299        self.spoke = std::option::Option::Some(v.into());
17300        self
17301    }
17302
17303    /// Sets or clears the value of [spoke][crate::model::UpdateSpokeRequest::spoke].
17304    pub fn set_or_clear_spoke<T>(mut self, v: std::option::Option<T>) -> Self
17305    where
17306        T: std::convert::Into<crate::model::Spoke>,
17307    {
17308        self.spoke = v.map(|x| x.into());
17309        self
17310    }
17311
17312    /// Sets the value of [request_id][crate::model::UpdateSpokeRequest::request_id].
17313    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17314        self.request_id = v.into();
17315        self
17316    }
17317}
17318
17319impl wkt::message::Message for UpdateSpokeRequest {
17320    fn typename() -> &'static str {
17321        "type.googleapis.com/google.cloud.networkconnectivity.v1.UpdateSpokeRequest"
17322    }
17323}
17324
17325#[doc(hidden)]
17326impl<'de> serde::de::Deserialize<'de> for UpdateSpokeRequest {
17327    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17328    where
17329        D: serde::Deserializer<'de>,
17330    {
17331        #[allow(non_camel_case_types)]
17332        #[doc(hidden)]
17333        #[derive(PartialEq, Eq, Hash)]
17334        enum __FieldTag {
17335            __update_mask,
17336            __spoke,
17337            __request_id,
17338            Unknown(std::string::String),
17339        }
17340        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17341            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17342            where
17343                D: serde::Deserializer<'de>,
17344            {
17345                struct Visitor;
17346                impl<'de> serde::de::Visitor<'de> for Visitor {
17347                    type Value = __FieldTag;
17348                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17349                        formatter.write_str("a field name for UpdateSpokeRequest")
17350                    }
17351                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17352                    where
17353                        E: serde::de::Error,
17354                    {
17355                        use std::result::Result::Ok;
17356                        use std::string::ToString;
17357                        match value {
17358                            "updateMask" => Ok(__FieldTag::__update_mask),
17359                            "update_mask" => Ok(__FieldTag::__update_mask),
17360                            "spoke" => Ok(__FieldTag::__spoke),
17361                            "requestId" => Ok(__FieldTag::__request_id),
17362                            "request_id" => Ok(__FieldTag::__request_id),
17363                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17364                        }
17365                    }
17366                }
17367                deserializer.deserialize_identifier(Visitor)
17368            }
17369        }
17370        struct Visitor;
17371        impl<'de> serde::de::Visitor<'de> for Visitor {
17372            type Value = UpdateSpokeRequest;
17373            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17374                formatter.write_str("struct UpdateSpokeRequest")
17375            }
17376            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17377            where
17378                A: serde::de::MapAccess<'de>,
17379            {
17380                #[allow(unused_imports)]
17381                use serde::de::Error;
17382                use std::option::Option::Some;
17383                let mut fields = std::collections::HashSet::new();
17384                let mut result = Self::Value::new();
17385                while let Some(tag) = map.next_key::<__FieldTag>()? {
17386                    #[allow(clippy::match_single_binding)]
17387                    match tag {
17388                        __FieldTag::__update_mask => {
17389                            if !fields.insert(__FieldTag::__update_mask) {
17390                                return std::result::Result::Err(A::Error::duplicate_field(
17391                                    "multiple values for update_mask",
17392                                ));
17393                            }
17394                            result.update_mask =
17395                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
17396                        }
17397                        __FieldTag::__spoke => {
17398                            if !fields.insert(__FieldTag::__spoke) {
17399                                return std::result::Result::Err(A::Error::duplicate_field(
17400                                    "multiple values for spoke",
17401                                ));
17402                            }
17403                            result.spoke =
17404                                map.next_value::<std::option::Option<crate::model::Spoke>>()?;
17405                        }
17406                        __FieldTag::__request_id => {
17407                            if !fields.insert(__FieldTag::__request_id) {
17408                                return std::result::Result::Err(A::Error::duplicate_field(
17409                                    "multiple values for request_id",
17410                                ));
17411                            }
17412                            result.request_id = map
17413                                .next_value::<std::option::Option<std::string::String>>()?
17414                                .unwrap_or_default();
17415                        }
17416                        __FieldTag::Unknown(key) => {
17417                            let value = map.next_value::<serde_json::Value>()?;
17418                            result._unknown_fields.insert(key, value);
17419                        }
17420                    }
17421                }
17422                std::result::Result::Ok(result)
17423            }
17424        }
17425        deserializer.deserialize_any(Visitor)
17426    }
17427}
17428
17429#[doc(hidden)]
17430impl serde::ser::Serialize for UpdateSpokeRequest {
17431    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17432    where
17433        S: serde::ser::Serializer,
17434    {
17435        use serde::ser::SerializeMap;
17436        #[allow(unused_imports)]
17437        use std::option::Option::Some;
17438        let mut state = serializer.serialize_map(std::option::Option::None)?;
17439        if self.update_mask.is_some() {
17440            state.serialize_entry("updateMask", &self.update_mask)?;
17441        }
17442        if self.spoke.is_some() {
17443            state.serialize_entry("spoke", &self.spoke)?;
17444        }
17445        if !self.request_id.is_empty() {
17446            state.serialize_entry("requestId", &self.request_id)?;
17447        }
17448        if !self._unknown_fields.is_empty() {
17449            for (key, value) in self._unknown_fields.iter() {
17450                state.serialize_entry(key, &value)?;
17451            }
17452        }
17453        state.end()
17454    }
17455}
17456
17457impl std::fmt::Debug for UpdateSpokeRequest {
17458    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17459        let mut debug_struct = f.debug_struct("UpdateSpokeRequest");
17460        debug_struct.field("update_mask", &self.update_mask);
17461        debug_struct.field("spoke", &self.spoke);
17462        debug_struct.field("request_id", &self.request_id);
17463        if !self._unknown_fields.is_empty() {
17464            debug_struct.field("_unknown_fields", &self._unknown_fields);
17465        }
17466        debug_struct.finish()
17467    }
17468}
17469
17470/// The request for
17471/// [HubService.DeleteSpoke][google.cloud.networkconnectivity.v1.HubService.DeleteSpoke].
17472///
17473/// [google.cloud.networkconnectivity.v1.HubService.DeleteSpoke]: crate::client::HubService::delete_spoke
17474#[derive(Clone, Default, PartialEq)]
17475#[non_exhaustive]
17476pub struct DeleteSpokeRequest {
17477    /// Required. The name of the spoke to delete.
17478    pub name: std::string::String,
17479
17480    /// Optional. A request ID to identify requests. Specify a unique request ID so
17481    /// that if you must retry your request, the server knows to ignore the request
17482    /// if it has already been completed. The server guarantees that a request
17483    /// doesn't result in creation of duplicate commitments for at least 60
17484    /// minutes.
17485    ///
17486    /// For example, consider a situation where you make an initial request and
17487    /// the request times out. If you make the request again with the same request
17488    /// ID, the server can check to see whether the original operation
17489    /// was received. If it was, the server ignores the second request. This
17490    /// behavior prevents clients from mistakenly creating duplicate commitments.
17491    ///
17492    /// The request ID must be a valid UUID, with the exception that zero UUID is
17493    /// not supported (00000000-0000-0000-0000-000000000000).
17494    pub request_id: std::string::String,
17495
17496    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17497}
17498
17499impl DeleteSpokeRequest {
17500    pub fn new() -> Self {
17501        std::default::Default::default()
17502    }
17503
17504    /// Sets the value of [name][crate::model::DeleteSpokeRequest::name].
17505    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17506        self.name = v.into();
17507        self
17508    }
17509
17510    /// Sets the value of [request_id][crate::model::DeleteSpokeRequest::request_id].
17511    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17512        self.request_id = v.into();
17513        self
17514    }
17515}
17516
17517impl wkt::message::Message for DeleteSpokeRequest {
17518    fn typename() -> &'static str {
17519        "type.googleapis.com/google.cloud.networkconnectivity.v1.DeleteSpokeRequest"
17520    }
17521}
17522
17523#[doc(hidden)]
17524impl<'de> serde::de::Deserialize<'de> for DeleteSpokeRequest {
17525    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17526    where
17527        D: serde::Deserializer<'de>,
17528    {
17529        #[allow(non_camel_case_types)]
17530        #[doc(hidden)]
17531        #[derive(PartialEq, Eq, Hash)]
17532        enum __FieldTag {
17533            __name,
17534            __request_id,
17535            Unknown(std::string::String),
17536        }
17537        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17538            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17539            where
17540                D: serde::Deserializer<'de>,
17541            {
17542                struct Visitor;
17543                impl<'de> serde::de::Visitor<'de> for Visitor {
17544                    type Value = __FieldTag;
17545                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17546                        formatter.write_str("a field name for DeleteSpokeRequest")
17547                    }
17548                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17549                    where
17550                        E: serde::de::Error,
17551                    {
17552                        use std::result::Result::Ok;
17553                        use std::string::ToString;
17554                        match value {
17555                            "name" => Ok(__FieldTag::__name),
17556                            "requestId" => Ok(__FieldTag::__request_id),
17557                            "request_id" => Ok(__FieldTag::__request_id),
17558                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17559                        }
17560                    }
17561                }
17562                deserializer.deserialize_identifier(Visitor)
17563            }
17564        }
17565        struct Visitor;
17566        impl<'de> serde::de::Visitor<'de> for Visitor {
17567            type Value = DeleteSpokeRequest;
17568            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17569                formatter.write_str("struct DeleteSpokeRequest")
17570            }
17571            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17572            where
17573                A: serde::de::MapAccess<'de>,
17574            {
17575                #[allow(unused_imports)]
17576                use serde::de::Error;
17577                use std::option::Option::Some;
17578                let mut fields = std::collections::HashSet::new();
17579                let mut result = Self::Value::new();
17580                while let Some(tag) = map.next_key::<__FieldTag>()? {
17581                    #[allow(clippy::match_single_binding)]
17582                    match tag {
17583                        __FieldTag::__name => {
17584                            if !fields.insert(__FieldTag::__name) {
17585                                return std::result::Result::Err(A::Error::duplicate_field(
17586                                    "multiple values for name",
17587                                ));
17588                            }
17589                            result.name = map
17590                                .next_value::<std::option::Option<std::string::String>>()?
17591                                .unwrap_or_default();
17592                        }
17593                        __FieldTag::__request_id => {
17594                            if !fields.insert(__FieldTag::__request_id) {
17595                                return std::result::Result::Err(A::Error::duplicate_field(
17596                                    "multiple values for request_id",
17597                                ));
17598                            }
17599                            result.request_id = map
17600                                .next_value::<std::option::Option<std::string::String>>()?
17601                                .unwrap_or_default();
17602                        }
17603                        __FieldTag::Unknown(key) => {
17604                            let value = map.next_value::<serde_json::Value>()?;
17605                            result._unknown_fields.insert(key, value);
17606                        }
17607                    }
17608                }
17609                std::result::Result::Ok(result)
17610            }
17611        }
17612        deserializer.deserialize_any(Visitor)
17613    }
17614}
17615
17616#[doc(hidden)]
17617impl serde::ser::Serialize for DeleteSpokeRequest {
17618    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17619    where
17620        S: serde::ser::Serializer,
17621    {
17622        use serde::ser::SerializeMap;
17623        #[allow(unused_imports)]
17624        use std::option::Option::Some;
17625        let mut state = serializer.serialize_map(std::option::Option::None)?;
17626        if !self.name.is_empty() {
17627            state.serialize_entry("name", &self.name)?;
17628        }
17629        if !self.request_id.is_empty() {
17630            state.serialize_entry("requestId", &self.request_id)?;
17631        }
17632        if !self._unknown_fields.is_empty() {
17633            for (key, value) in self._unknown_fields.iter() {
17634                state.serialize_entry(key, &value)?;
17635            }
17636        }
17637        state.end()
17638    }
17639}
17640
17641impl std::fmt::Debug for DeleteSpokeRequest {
17642    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17643        let mut debug_struct = f.debug_struct("DeleteSpokeRequest");
17644        debug_struct.field("name", &self.name);
17645        debug_struct.field("request_id", &self.request_id);
17646        if !self._unknown_fields.is_empty() {
17647            debug_struct.field("_unknown_fields", &self._unknown_fields);
17648        }
17649        debug_struct.finish()
17650    }
17651}
17652
17653/// The request for
17654/// [HubService.AcceptHubSpoke][google.cloud.networkconnectivity.v1.HubService.AcceptHubSpoke].
17655///
17656/// [google.cloud.networkconnectivity.v1.HubService.AcceptHubSpoke]: crate::client::HubService::accept_hub_spoke
17657#[derive(Clone, Default, PartialEq)]
17658#[non_exhaustive]
17659pub struct AcceptHubSpokeRequest {
17660    /// Required. The name of the hub into which to accept the spoke.
17661    pub name: std::string::String,
17662
17663    /// Required. The URI of the spoke to accept into the hub.
17664    pub spoke_uri: std::string::String,
17665
17666    /// Optional. A request ID to identify requests. Specify a unique request ID so
17667    /// that if you must retry your request, the server knows to ignore the request
17668    /// if it has already been completed. The server guarantees that a request
17669    /// doesn't result in creation of duplicate commitments for at least 60
17670    /// minutes.
17671    ///
17672    /// For example, consider a situation where you make an initial request and
17673    /// the request times out. If you make the request again with the same request
17674    /// ID, the server can check to see whether the original operation
17675    /// was received. If it was, the server ignores the second request. This
17676    /// behavior prevents clients from mistakenly creating duplicate commitments.
17677    ///
17678    /// The request ID must be a valid UUID, with the exception that zero UUID is
17679    /// not supported (00000000-0000-0000-0000-000000000000).
17680    pub request_id: std::string::String,
17681
17682    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17683}
17684
17685impl AcceptHubSpokeRequest {
17686    pub fn new() -> Self {
17687        std::default::Default::default()
17688    }
17689
17690    /// Sets the value of [name][crate::model::AcceptHubSpokeRequest::name].
17691    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17692        self.name = v.into();
17693        self
17694    }
17695
17696    /// Sets the value of [spoke_uri][crate::model::AcceptHubSpokeRequest::spoke_uri].
17697    pub fn set_spoke_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17698        self.spoke_uri = v.into();
17699        self
17700    }
17701
17702    /// Sets the value of [request_id][crate::model::AcceptHubSpokeRequest::request_id].
17703    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17704        self.request_id = v.into();
17705        self
17706    }
17707}
17708
17709impl wkt::message::Message for AcceptHubSpokeRequest {
17710    fn typename() -> &'static str {
17711        "type.googleapis.com/google.cloud.networkconnectivity.v1.AcceptHubSpokeRequest"
17712    }
17713}
17714
17715#[doc(hidden)]
17716impl<'de> serde::de::Deserialize<'de> for AcceptHubSpokeRequest {
17717    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17718    where
17719        D: serde::Deserializer<'de>,
17720    {
17721        #[allow(non_camel_case_types)]
17722        #[doc(hidden)]
17723        #[derive(PartialEq, Eq, Hash)]
17724        enum __FieldTag {
17725            __name,
17726            __spoke_uri,
17727            __request_id,
17728            Unknown(std::string::String),
17729        }
17730        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17731            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17732            where
17733                D: serde::Deserializer<'de>,
17734            {
17735                struct Visitor;
17736                impl<'de> serde::de::Visitor<'de> for Visitor {
17737                    type Value = __FieldTag;
17738                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17739                        formatter.write_str("a field name for AcceptHubSpokeRequest")
17740                    }
17741                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17742                    where
17743                        E: serde::de::Error,
17744                    {
17745                        use std::result::Result::Ok;
17746                        use std::string::ToString;
17747                        match value {
17748                            "name" => Ok(__FieldTag::__name),
17749                            "spokeUri" => Ok(__FieldTag::__spoke_uri),
17750                            "spoke_uri" => Ok(__FieldTag::__spoke_uri),
17751                            "requestId" => Ok(__FieldTag::__request_id),
17752                            "request_id" => Ok(__FieldTag::__request_id),
17753                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17754                        }
17755                    }
17756                }
17757                deserializer.deserialize_identifier(Visitor)
17758            }
17759        }
17760        struct Visitor;
17761        impl<'de> serde::de::Visitor<'de> for Visitor {
17762            type Value = AcceptHubSpokeRequest;
17763            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17764                formatter.write_str("struct AcceptHubSpokeRequest")
17765            }
17766            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17767            where
17768                A: serde::de::MapAccess<'de>,
17769            {
17770                #[allow(unused_imports)]
17771                use serde::de::Error;
17772                use std::option::Option::Some;
17773                let mut fields = std::collections::HashSet::new();
17774                let mut result = Self::Value::new();
17775                while let Some(tag) = map.next_key::<__FieldTag>()? {
17776                    #[allow(clippy::match_single_binding)]
17777                    match tag {
17778                        __FieldTag::__name => {
17779                            if !fields.insert(__FieldTag::__name) {
17780                                return std::result::Result::Err(A::Error::duplicate_field(
17781                                    "multiple values for name",
17782                                ));
17783                            }
17784                            result.name = map
17785                                .next_value::<std::option::Option<std::string::String>>()?
17786                                .unwrap_or_default();
17787                        }
17788                        __FieldTag::__spoke_uri => {
17789                            if !fields.insert(__FieldTag::__spoke_uri) {
17790                                return std::result::Result::Err(A::Error::duplicate_field(
17791                                    "multiple values for spoke_uri",
17792                                ));
17793                            }
17794                            result.spoke_uri = map
17795                                .next_value::<std::option::Option<std::string::String>>()?
17796                                .unwrap_or_default();
17797                        }
17798                        __FieldTag::__request_id => {
17799                            if !fields.insert(__FieldTag::__request_id) {
17800                                return std::result::Result::Err(A::Error::duplicate_field(
17801                                    "multiple values for request_id",
17802                                ));
17803                            }
17804                            result.request_id = map
17805                                .next_value::<std::option::Option<std::string::String>>()?
17806                                .unwrap_or_default();
17807                        }
17808                        __FieldTag::Unknown(key) => {
17809                            let value = map.next_value::<serde_json::Value>()?;
17810                            result._unknown_fields.insert(key, value);
17811                        }
17812                    }
17813                }
17814                std::result::Result::Ok(result)
17815            }
17816        }
17817        deserializer.deserialize_any(Visitor)
17818    }
17819}
17820
17821#[doc(hidden)]
17822impl serde::ser::Serialize for AcceptHubSpokeRequest {
17823    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17824    where
17825        S: serde::ser::Serializer,
17826    {
17827        use serde::ser::SerializeMap;
17828        #[allow(unused_imports)]
17829        use std::option::Option::Some;
17830        let mut state = serializer.serialize_map(std::option::Option::None)?;
17831        if !self.name.is_empty() {
17832            state.serialize_entry("name", &self.name)?;
17833        }
17834        if !self.spoke_uri.is_empty() {
17835            state.serialize_entry("spokeUri", &self.spoke_uri)?;
17836        }
17837        if !self.request_id.is_empty() {
17838            state.serialize_entry("requestId", &self.request_id)?;
17839        }
17840        if !self._unknown_fields.is_empty() {
17841            for (key, value) in self._unknown_fields.iter() {
17842                state.serialize_entry(key, &value)?;
17843            }
17844        }
17845        state.end()
17846    }
17847}
17848
17849impl std::fmt::Debug for AcceptHubSpokeRequest {
17850    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17851        let mut debug_struct = f.debug_struct("AcceptHubSpokeRequest");
17852        debug_struct.field("name", &self.name);
17853        debug_struct.field("spoke_uri", &self.spoke_uri);
17854        debug_struct.field("request_id", &self.request_id);
17855        if !self._unknown_fields.is_empty() {
17856            debug_struct.field("_unknown_fields", &self._unknown_fields);
17857        }
17858        debug_struct.finish()
17859    }
17860}
17861
17862/// The response for
17863/// [HubService.AcceptHubSpoke][google.cloud.networkconnectivity.v1.HubService.AcceptHubSpoke].
17864///
17865/// [google.cloud.networkconnectivity.v1.HubService.AcceptHubSpoke]: crate::client::HubService::accept_hub_spoke
17866#[derive(Clone, Default, PartialEq)]
17867#[non_exhaustive]
17868pub struct AcceptHubSpokeResponse {
17869    /// The spoke that was operated on.
17870    pub spoke: std::option::Option<crate::model::Spoke>,
17871
17872    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17873}
17874
17875impl AcceptHubSpokeResponse {
17876    pub fn new() -> Self {
17877        std::default::Default::default()
17878    }
17879
17880    /// Sets the value of [spoke][crate::model::AcceptHubSpokeResponse::spoke].
17881    pub fn set_spoke<T>(mut self, v: T) -> Self
17882    where
17883        T: std::convert::Into<crate::model::Spoke>,
17884    {
17885        self.spoke = std::option::Option::Some(v.into());
17886        self
17887    }
17888
17889    /// Sets or clears the value of [spoke][crate::model::AcceptHubSpokeResponse::spoke].
17890    pub fn set_or_clear_spoke<T>(mut self, v: std::option::Option<T>) -> Self
17891    where
17892        T: std::convert::Into<crate::model::Spoke>,
17893    {
17894        self.spoke = v.map(|x| x.into());
17895        self
17896    }
17897}
17898
17899impl wkt::message::Message for AcceptHubSpokeResponse {
17900    fn typename() -> &'static str {
17901        "type.googleapis.com/google.cloud.networkconnectivity.v1.AcceptHubSpokeResponse"
17902    }
17903}
17904
17905#[doc(hidden)]
17906impl<'de> serde::de::Deserialize<'de> for AcceptHubSpokeResponse {
17907    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17908    where
17909        D: serde::Deserializer<'de>,
17910    {
17911        #[allow(non_camel_case_types)]
17912        #[doc(hidden)]
17913        #[derive(PartialEq, Eq, Hash)]
17914        enum __FieldTag {
17915            __spoke,
17916            Unknown(std::string::String),
17917        }
17918        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17919            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17920            where
17921                D: serde::Deserializer<'de>,
17922            {
17923                struct Visitor;
17924                impl<'de> serde::de::Visitor<'de> for Visitor {
17925                    type Value = __FieldTag;
17926                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17927                        formatter.write_str("a field name for AcceptHubSpokeResponse")
17928                    }
17929                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17930                    where
17931                        E: serde::de::Error,
17932                    {
17933                        use std::result::Result::Ok;
17934                        use std::string::ToString;
17935                        match value {
17936                            "spoke" => Ok(__FieldTag::__spoke),
17937                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17938                        }
17939                    }
17940                }
17941                deserializer.deserialize_identifier(Visitor)
17942            }
17943        }
17944        struct Visitor;
17945        impl<'de> serde::de::Visitor<'de> for Visitor {
17946            type Value = AcceptHubSpokeResponse;
17947            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17948                formatter.write_str("struct AcceptHubSpokeResponse")
17949            }
17950            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17951            where
17952                A: serde::de::MapAccess<'de>,
17953            {
17954                #[allow(unused_imports)]
17955                use serde::de::Error;
17956                use std::option::Option::Some;
17957                let mut fields = std::collections::HashSet::new();
17958                let mut result = Self::Value::new();
17959                while let Some(tag) = map.next_key::<__FieldTag>()? {
17960                    #[allow(clippy::match_single_binding)]
17961                    match tag {
17962                        __FieldTag::__spoke => {
17963                            if !fields.insert(__FieldTag::__spoke) {
17964                                return std::result::Result::Err(A::Error::duplicate_field(
17965                                    "multiple values for spoke",
17966                                ));
17967                            }
17968                            result.spoke =
17969                                map.next_value::<std::option::Option<crate::model::Spoke>>()?;
17970                        }
17971                        __FieldTag::Unknown(key) => {
17972                            let value = map.next_value::<serde_json::Value>()?;
17973                            result._unknown_fields.insert(key, value);
17974                        }
17975                    }
17976                }
17977                std::result::Result::Ok(result)
17978            }
17979        }
17980        deserializer.deserialize_any(Visitor)
17981    }
17982}
17983
17984#[doc(hidden)]
17985impl serde::ser::Serialize for AcceptHubSpokeResponse {
17986    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17987    where
17988        S: serde::ser::Serializer,
17989    {
17990        use serde::ser::SerializeMap;
17991        #[allow(unused_imports)]
17992        use std::option::Option::Some;
17993        let mut state = serializer.serialize_map(std::option::Option::None)?;
17994        if self.spoke.is_some() {
17995            state.serialize_entry("spoke", &self.spoke)?;
17996        }
17997        if !self._unknown_fields.is_empty() {
17998            for (key, value) in self._unknown_fields.iter() {
17999                state.serialize_entry(key, &value)?;
18000            }
18001        }
18002        state.end()
18003    }
18004}
18005
18006impl std::fmt::Debug for AcceptHubSpokeResponse {
18007    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18008        let mut debug_struct = f.debug_struct("AcceptHubSpokeResponse");
18009        debug_struct.field("spoke", &self.spoke);
18010        if !self._unknown_fields.is_empty() {
18011            debug_struct.field("_unknown_fields", &self._unknown_fields);
18012        }
18013        debug_struct.finish()
18014    }
18015}
18016
18017/// The request for
18018/// [HubService.RejectHubSpoke][google.cloud.networkconnectivity.v1.HubService.RejectHubSpoke].
18019///
18020/// [google.cloud.networkconnectivity.v1.HubService.RejectHubSpoke]: crate::client::HubService::reject_hub_spoke
18021#[derive(Clone, Default, PartialEq)]
18022#[non_exhaustive]
18023pub struct RejectHubSpokeRequest {
18024    /// Required. The name of the hub from which to reject the spoke.
18025    pub name: std::string::String,
18026
18027    /// Required. The URI of the spoke to reject from the hub.
18028    pub spoke_uri: std::string::String,
18029
18030    /// Optional. A request ID to identify requests. Specify a unique request ID so
18031    /// that if you must retry your request, the server knows to ignore the request
18032    /// if it has already been completed. The server guarantees that a request
18033    /// doesn't result in creation of duplicate commitments for at least 60
18034    /// minutes.
18035    ///
18036    /// For example, consider a situation where you make an initial request and
18037    /// the request times out. If you make the request again with the same request
18038    /// ID, the server can check to see whether the original operation
18039    /// was received. If it was, the server ignores the second request. This
18040    /// behavior prevents clients from mistakenly creating duplicate commitments.
18041    ///
18042    /// The request ID must be a valid UUID, with the exception that zero UUID is
18043    /// not supported (00000000-0000-0000-0000-000000000000).
18044    pub request_id: std::string::String,
18045
18046    /// Optional. Additional information provided by the hub administrator.
18047    pub details: std::string::String,
18048
18049    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18050}
18051
18052impl RejectHubSpokeRequest {
18053    pub fn new() -> Self {
18054        std::default::Default::default()
18055    }
18056
18057    /// Sets the value of [name][crate::model::RejectHubSpokeRequest::name].
18058    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18059        self.name = v.into();
18060        self
18061    }
18062
18063    /// Sets the value of [spoke_uri][crate::model::RejectHubSpokeRequest::spoke_uri].
18064    pub fn set_spoke_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18065        self.spoke_uri = v.into();
18066        self
18067    }
18068
18069    /// Sets the value of [request_id][crate::model::RejectHubSpokeRequest::request_id].
18070    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18071        self.request_id = v.into();
18072        self
18073    }
18074
18075    /// Sets the value of [details][crate::model::RejectHubSpokeRequest::details].
18076    pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18077        self.details = v.into();
18078        self
18079    }
18080}
18081
18082impl wkt::message::Message for RejectHubSpokeRequest {
18083    fn typename() -> &'static str {
18084        "type.googleapis.com/google.cloud.networkconnectivity.v1.RejectHubSpokeRequest"
18085    }
18086}
18087
18088#[doc(hidden)]
18089impl<'de> serde::de::Deserialize<'de> for RejectHubSpokeRequest {
18090    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18091    where
18092        D: serde::Deserializer<'de>,
18093    {
18094        #[allow(non_camel_case_types)]
18095        #[doc(hidden)]
18096        #[derive(PartialEq, Eq, Hash)]
18097        enum __FieldTag {
18098            __name,
18099            __spoke_uri,
18100            __request_id,
18101            __details,
18102            Unknown(std::string::String),
18103        }
18104        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18105            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18106            where
18107                D: serde::Deserializer<'de>,
18108            {
18109                struct Visitor;
18110                impl<'de> serde::de::Visitor<'de> for Visitor {
18111                    type Value = __FieldTag;
18112                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18113                        formatter.write_str("a field name for RejectHubSpokeRequest")
18114                    }
18115                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18116                    where
18117                        E: serde::de::Error,
18118                    {
18119                        use std::result::Result::Ok;
18120                        use std::string::ToString;
18121                        match value {
18122                            "name" => Ok(__FieldTag::__name),
18123                            "spokeUri" => Ok(__FieldTag::__spoke_uri),
18124                            "spoke_uri" => Ok(__FieldTag::__spoke_uri),
18125                            "requestId" => Ok(__FieldTag::__request_id),
18126                            "request_id" => Ok(__FieldTag::__request_id),
18127                            "details" => Ok(__FieldTag::__details),
18128                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18129                        }
18130                    }
18131                }
18132                deserializer.deserialize_identifier(Visitor)
18133            }
18134        }
18135        struct Visitor;
18136        impl<'de> serde::de::Visitor<'de> for Visitor {
18137            type Value = RejectHubSpokeRequest;
18138            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18139                formatter.write_str("struct RejectHubSpokeRequest")
18140            }
18141            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18142            where
18143                A: serde::de::MapAccess<'de>,
18144            {
18145                #[allow(unused_imports)]
18146                use serde::de::Error;
18147                use std::option::Option::Some;
18148                let mut fields = std::collections::HashSet::new();
18149                let mut result = Self::Value::new();
18150                while let Some(tag) = map.next_key::<__FieldTag>()? {
18151                    #[allow(clippy::match_single_binding)]
18152                    match tag {
18153                        __FieldTag::__name => {
18154                            if !fields.insert(__FieldTag::__name) {
18155                                return std::result::Result::Err(A::Error::duplicate_field(
18156                                    "multiple values for name",
18157                                ));
18158                            }
18159                            result.name = map
18160                                .next_value::<std::option::Option<std::string::String>>()?
18161                                .unwrap_or_default();
18162                        }
18163                        __FieldTag::__spoke_uri => {
18164                            if !fields.insert(__FieldTag::__spoke_uri) {
18165                                return std::result::Result::Err(A::Error::duplicate_field(
18166                                    "multiple values for spoke_uri",
18167                                ));
18168                            }
18169                            result.spoke_uri = map
18170                                .next_value::<std::option::Option<std::string::String>>()?
18171                                .unwrap_or_default();
18172                        }
18173                        __FieldTag::__request_id => {
18174                            if !fields.insert(__FieldTag::__request_id) {
18175                                return std::result::Result::Err(A::Error::duplicate_field(
18176                                    "multiple values for request_id",
18177                                ));
18178                            }
18179                            result.request_id = map
18180                                .next_value::<std::option::Option<std::string::String>>()?
18181                                .unwrap_or_default();
18182                        }
18183                        __FieldTag::__details => {
18184                            if !fields.insert(__FieldTag::__details) {
18185                                return std::result::Result::Err(A::Error::duplicate_field(
18186                                    "multiple values for details",
18187                                ));
18188                            }
18189                            result.details = map
18190                                .next_value::<std::option::Option<std::string::String>>()?
18191                                .unwrap_or_default();
18192                        }
18193                        __FieldTag::Unknown(key) => {
18194                            let value = map.next_value::<serde_json::Value>()?;
18195                            result._unknown_fields.insert(key, value);
18196                        }
18197                    }
18198                }
18199                std::result::Result::Ok(result)
18200            }
18201        }
18202        deserializer.deserialize_any(Visitor)
18203    }
18204}
18205
18206#[doc(hidden)]
18207impl serde::ser::Serialize for RejectHubSpokeRequest {
18208    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18209    where
18210        S: serde::ser::Serializer,
18211    {
18212        use serde::ser::SerializeMap;
18213        #[allow(unused_imports)]
18214        use std::option::Option::Some;
18215        let mut state = serializer.serialize_map(std::option::Option::None)?;
18216        if !self.name.is_empty() {
18217            state.serialize_entry("name", &self.name)?;
18218        }
18219        if !self.spoke_uri.is_empty() {
18220            state.serialize_entry("spokeUri", &self.spoke_uri)?;
18221        }
18222        if !self.request_id.is_empty() {
18223            state.serialize_entry("requestId", &self.request_id)?;
18224        }
18225        if !self.details.is_empty() {
18226            state.serialize_entry("details", &self.details)?;
18227        }
18228        if !self._unknown_fields.is_empty() {
18229            for (key, value) in self._unknown_fields.iter() {
18230                state.serialize_entry(key, &value)?;
18231            }
18232        }
18233        state.end()
18234    }
18235}
18236
18237impl std::fmt::Debug for RejectHubSpokeRequest {
18238    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18239        let mut debug_struct = f.debug_struct("RejectHubSpokeRequest");
18240        debug_struct.field("name", &self.name);
18241        debug_struct.field("spoke_uri", &self.spoke_uri);
18242        debug_struct.field("request_id", &self.request_id);
18243        debug_struct.field("details", &self.details);
18244        if !self._unknown_fields.is_empty() {
18245            debug_struct.field("_unknown_fields", &self._unknown_fields);
18246        }
18247        debug_struct.finish()
18248    }
18249}
18250
18251/// The response for
18252/// [HubService.RejectHubSpoke][google.cloud.networkconnectivity.v1.HubService.RejectHubSpoke].
18253///
18254/// [google.cloud.networkconnectivity.v1.HubService.RejectHubSpoke]: crate::client::HubService::reject_hub_spoke
18255#[derive(Clone, Default, PartialEq)]
18256#[non_exhaustive]
18257pub struct RejectHubSpokeResponse {
18258    /// The spoke that was operated on.
18259    pub spoke: std::option::Option<crate::model::Spoke>,
18260
18261    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18262}
18263
18264impl RejectHubSpokeResponse {
18265    pub fn new() -> Self {
18266        std::default::Default::default()
18267    }
18268
18269    /// Sets the value of [spoke][crate::model::RejectHubSpokeResponse::spoke].
18270    pub fn set_spoke<T>(mut self, v: T) -> Self
18271    where
18272        T: std::convert::Into<crate::model::Spoke>,
18273    {
18274        self.spoke = std::option::Option::Some(v.into());
18275        self
18276    }
18277
18278    /// Sets or clears the value of [spoke][crate::model::RejectHubSpokeResponse::spoke].
18279    pub fn set_or_clear_spoke<T>(mut self, v: std::option::Option<T>) -> Self
18280    where
18281        T: std::convert::Into<crate::model::Spoke>,
18282    {
18283        self.spoke = v.map(|x| x.into());
18284        self
18285    }
18286}
18287
18288impl wkt::message::Message for RejectHubSpokeResponse {
18289    fn typename() -> &'static str {
18290        "type.googleapis.com/google.cloud.networkconnectivity.v1.RejectHubSpokeResponse"
18291    }
18292}
18293
18294#[doc(hidden)]
18295impl<'de> serde::de::Deserialize<'de> for RejectHubSpokeResponse {
18296    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18297    where
18298        D: serde::Deserializer<'de>,
18299    {
18300        #[allow(non_camel_case_types)]
18301        #[doc(hidden)]
18302        #[derive(PartialEq, Eq, Hash)]
18303        enum __FieldTag {
18304            __spoke,
18305            Unknown(std::string::String),
18306        }
18307        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18308            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18309            where
18310                D: serde::Deserializer<'de>,
18311            {
18312                struct Visitor;
18313                impl<'de> serde::de::Visitor<'de> for Visitor {
18314                    type Value = __FieldTag;
18315                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18316                        formatter.write_str("a field name for RejectHubSpokeResponse")
18317                    }
18318                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18319                    where
18320                        E: serde::de::Error,
18321                    {
18322                        use std::result::Result::Ok;
18323                        use std::string::ToString;
18324                        match value {
18325                            "spoke" => Ok(__FieldTag::__spoke),
18326                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18327                        }
18328                    }
18329                }
18330                deserializer.deserialize_identifier(Visitor)
18331            }
18332        }
18333        struct Visitor;
18334        impl<'de> serde::de::Visitor<'de> for Visitor {
18335            type Value = RejectHubSpokeResponse;
18336            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18337                formatter.write_str("struct RejectHubSpokeResponse")
18338            }
18339            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18340            where
18341                A: serde::de::MapAccess<'de>,
18342            {
18343                #[allow(unused_imports)]
18344                use serde::de::Error;
18345                use std::option::Option::Some;
18346                let mut fields = std::collections::HashSet::new();
18347                let mut result = Self::Value::new();
18348                while let Some(tag) = map.next_key::<__FieldTag>()? {
18349                    #[allow(clippy::match_single_binding)]
18350                    match tag {
18351                        __FieldTag::__spoke => {
18352                            if !fields.insert(__FieldTag::__spoke) {
18353                                return std::result::Result::Err(A::Error::duplicate_field(
18354                                    "multiple values for spoke",
18355                                ));
18356                            }
18357                            result.spoke =
18358                                map.next_value::<std::option::Option<crate::model::Spoke>>()?;
18359                        }
18360                        __FieldTag::Unknown(key) => {
18361                            let value = map.next_value::<serde_json::Value>()?;
18362                            result._unknown_fields.insert(key, value);
18363                        }
18364                    }
18365                }
18366                std::result::Result::Ok(result)
18367            }
18368        }
18369        deserializer.deserialize_any(Visitor)
18370    }
18371}
18372
18373#[doc(hidden)]
18374impl serde::ser::Serialize for RejectHubSpokeResponse {
18375    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18376    where
18377        S: serde::ser::Serializer,
18378    {
18379        use serde::ser::SerializeMap;
18380        #[allow(unused_imports)]
18381        use std::option::Option::Some;
18382        let mut state = serializer.serialize_map(std::option::Option::None)?;
18383        if self.spoke.is_some() {
18384            state.serialize_entry("spoke", &self.spoke)?;
18385        }
18386        if !self._unknown_fields.is_empty() {
18387            for (key, value) in self._unknown_fields.iter() {
18388                state.serialize_entry(key, &value)?;
18389            }
18390        }
18391        state.end()
18392    }
18393}
18394
18395impl std::fmt::Debug for RejectHubSpokeResponse {
18396    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18397        let mut debug_struct = f.debug_struct("RejectHubSpokeResponse");
18398        debug_struct.field("spoke", &self.spoke);
18399        if !self._unknown_fields.is_empty() {
18400            debug_struct.field("_unknown_fields", &self._unknown_fields);
18401        }
18402        debug_struct.finish()
18403    }
18404}
18405
18406/// The request for
18407/// [HubService.AcceptSpokeUpdate][google.cloud.networkconnectivity.v1.HubService.AcceptSpokeUpdate].
18408///
18409/// [google.cloud.networkconnectivity.v1.HubService.AcceptSpokeUpdate]: crate::client::HubService::accept_spoke_update
18410#[derive(Clone, Default, PartialEq)]
18411#[non_exhaustive]
18412pub struct AcceptSpokeUpdateRequest {
18413    /// Required. The name of the hub to accept spoke update.
18414    pub name: std::string::String,
18415
18416    /// Required. The URI of the spoke to accept update.
18417    pub spoke_uri: std::string::String,
18418
18419    /// Required. The etag of the spoke to accept update.
18420    pub spoke_etag: std::string::String,
18421
18422    /// Optional. A request ID to identify requests. Specify a unique request ID so
18423    /// that if you must retry your request, the server knows to ignore the request
18424    /// if it has already been completed. The server guarantees that a request
18425    /// doesn't result in creation of duplicate commitments for at least 60
18426    /// minutes.
18427    ///
18428    /// For example, consider a situation where you make an initial request and
18429    /// the request times out. If you make the request again with the same request
18430    /// ID, the server can check to see whether the original operation
18431    /// was received. If it was, the server ignores the second request. This
18432    /// behavior prevents clients from mistakenly creating duplicate commitments.
18433    ///
18434    /// The request ID must be a valid UUID, with the exception that zero UUID is
18435    /// not supported (00000000-0000-0000-0000-000000000000).
18436    pub request_id: std::string::String,
18437
18438    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18439}
18440
18441impl AcceptSpokeUpdateRequest {
18442    pub fn new() -> Self {
18443        std::default::Default::default()
18444    }
18445
18446    /// Sets the value of [name][crate::model::AcceptSpokeUpdateRequest::name].
18447    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18448        self.name = v.into();
18449        self
18450    }
18451
18452    /// Sets the value of [spoke_uri][crate::model::AcceptSpokeUpdateRequest::spoke_uri].
18453    pub fn set_spoke_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18454        self.spoke_uri = v.into();
18455        self
18456    }
18457
18458    /// Sets the value of [spoke_etag][crate::model::AcceptSpokeUpdateRequest::spoke_etag].
18459    pub fn set_spoke_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18460        self.spoke_etag = v.into();
18461        self
18462    }
18463
18464    /// Sets the value of [request_id][crate::model::AcceptSpokeUpdateRequest::request_id].
18465    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18466        self.request_id = v.into();
18467        self
18468    }
18469}
18470
18471impl wkt::message::Message for AcceptSpokeUpdateRequest {
18472    fn typename() -> &'static str {
18473        "type.googleapis.com/google.cloud.networkconnectivity.v1.AcceptSpokeUpdateRequest"
18474    }
18475}
18476
18477#[doc(hidden)]
18478impl<'de> serde::de::Deserialize<'de> for AcceptSpokeUpdateRequest {
18479    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18480    where
18481        D: serde::Deserializer<'de>,
18482    {
18483        #[allow(non_camel_case_types)]
18484        #[doc(hidden)]
18485        #[derive(PartialEq, Eq, Hash)]
18486        enum __FieldTag {
18487            __name,
18488            __spoke_uri,
18489            __spoke_etag,
18490            __request_id,
18491            Unknown(std::string::String),
18492        }
18493        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18494            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18495            where
18496                D: serde::Deserializer<'de>,
18497            {
18498                struct Visitor;
18499                impl<'de> serde::de::Visitor<'de> for Visitor {
18500                    type Value = __FieldTag;
18501                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18502                        formatter.write_str("a field name for AcceptSpokeUpdateRequest")
18503                    }
18504                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18505                    where
18506                        E: serde::de::Error,
18507                    {
18508                        use std::result::Result::Ok;
18509                        use std::string::ToString;
18510                        match value {
18511                            "name" => Ok(__FieldTag::__name),
18512                            "spokeUri" => Ok(__FieldTag::__spoke_uri),
18513                            "spoke_uri" => Ok(__FieldTag::__spoke_uri),
18514                            "spokeEtag" => Ok(__FieldTag::__spoke_etag),
18515                            "spoke_etag" => Ok(__FieldTag::__spoke_etag),
18516                            "requestId" => Ok(__FieldTag::__request_id),
18517                            "request_id" => Ok(__FieldTag::__request_id),
18518                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18519                        }
18520                    }
18521                }
18522                deserializer.deserialize_identifier(Visitor)
18523            }
18524        }
18525        struct Visitor;
18526        impl<'de> serde::de::Visitor<'de> for Visitor {
18527            type Value = AcceptSpokeUpdateRequest;
18528            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18529                formatter.write_str("struct AcceptSpokeUpdateRequest")
18530            }
18531            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18532            where
18533                A: serde::de::MapAccess<'de>,
18534            {
18535                #[allow(unused_imports)]
18536                use serde::de::Error;
18537                use std::option::Option::Some;
18538                let mut fields = std::collections::HashSet::new();
18539                let mut result = Self::Value::new();
18540                while let Some(tag) = map.next_key::<__FieldTag>()? {
18541                    #[allow(clippy::match_single_binding)]
18542                    match tag {
18543                        __FieldTag::__name => {
18544                            if !fields.insert(__FieldTag::__name) {
18545                                return std::result::Result::Err(A::Error::duplicate_field(
18546                                    "multiple values for name",
18547                                ));
18548                            }
18549                            result.name = map
18550                                .next_value::<std::option::Option<std::string::String>>()?
18551                                .unwrap_or_default();
18552                        }
18553                        __FieldTag::__spoke_uri => {
18554                            if !fields.insert(__FieldTag::__spoke_uri) {
18555                                return std::result::Result::Err(A::Error::duplicate_field(
18556                                    "multiple values for spoke_uri",
18557                                ));
18558                            }
18559                            result.spoke_uri = map
18560                                .next_value::<std::option::Option<std::string::String>>()?
18561                                .unwrap_or_default();
18562                        }
18563                        __FieldTag::__spoke_etag => {
18564                            if !fields.insert(__FieldTag::__spoke_etag) {
18565                                return std::result::Result::Err(A::Error::duplicate_field(
18566                                    "multiple values for spoke_etag",
18567                                ));
18568                            }
18569                            result.spoke_etag = map
18570                                .next_value::<std::option::Option<std::string::String>>()?
18571                                .unwrap_or_default();
18572                        }
18573                        __FieldTag::__request_id => {
18574                            if !fields.insert(__FieldTag::__request_id) {
18575                                return std::result::Result::Err(A::Error::duplicate_field(
18576                                    "multiple values for request_id",
18577                                ));
18578                            }
18579                            result.request_id = map
18580                                .next_value::<std::option::Option<std::string::String>>()?
18581                                .unwrap_or_default();
18582                        }
18583                        __FieldTag::Unknown(key) => {
18584                            let value = map.next_value::<serde_json::Value>()?;
18585                            result._unknown_fields.insert(key, value);
18586                        }
18587                    }
18588                }
18589                std::result::Result::Ok(result)
18590            }
18591        }
18592        deserializer.deserialize_any(Visitor)
18593    }
18594}
18595
18596#[doc(hidden)]
18597impl serde::ser::Serialize for AcceptSpokeUpdateRequest {
18598    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18599    where
18600        S: serde::ser::Serializer,
18601    {
18602        use serde::ser::SerializeMap;
18603        #[allow(unused_imports)]
18604        use std::option::Option::Some;
18605        let mut state = serializer.serialize_map(std::option::Option::None)?;
18606        if !self.name.is_empty() {
18607            state.serialize_entry("name", &self.name)?;
18608        }
18609        if !self.spoke_uri.is_empty() {
18610            state.serialize_entry("spokeUri", &self.spoke_uri)?;
18611        }
18612        if !self.spoke_etag.is_empty() {
18613            state.serialize_entry("spokeEtag", &self.spoke_etag)?;
18614        }
18615        if !self.request_id.is_empty() {
18616            state.serialize_entry("requestId", &self.request_id)?;
18617        }
18618        if !self._unknown_fields.is_empty() {
18619            for (key, value) in self._unknown_fields.iter() {
18620                state.serialize_entry(key, &value)?;
18621            }
18622        }
18623        state.end()
18624    }
18625}
18626
18627impl std::fmt::Debug for AcceptSpokeUpdateRequest {
18628    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18629        let mut debug_struct = f.debug_struct("AcceptSpokeUpdateRequest");
18630        debug_struct.field("name", &self.name);
18631        debug_struct.field("spoke_uri", &self.spoke_uri);
18632        debug_struct.field("spoke_etag", &self.spoke_etag);
18633        debug_struct.field("request_id", &self.request_id);
18634        if !self._unknown_fields.is_empty() {
18635            debug_struct.field("_unknown_fields", &self._unknown_fields);
18636        }
18637        debug_struct.finish()
18638    }
18639}
18640
18641/// The response for
18642/// [HubService.AcceptSpokeUpdate][google.cloud.networkconnectivity.v1.HubService.AcceptSpokeUpdate].
18643///
18644/// [google.cloud.networkconnectivity.v1.HubService.AcceptSpokeUpdate]: crate::client::HubService::accept_spoke_update
18645#[derive(Clone, Default, PartialEq)]
18646#[non_exhaustive]
18647pub struct AcceptSpokeUpdateResponse {
18648    /// The spoke that was operated on.
18649    pub spoke: std::option::Option<crate::model::Spoke>,
18650
18651    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18652}
18653
18654impl AcceptSpokeUpdateResponse {
18655    pub fn new() -> Self {
18656        std::default::Default::default()
18657    }
18658
18659    /// Sets the value of [spoke][crate::model::AcceptSpokeUpdateResponse::spoke].
18660    pub fn set_spoke<T>(mut self, v: T) -> Self
18661    where
18662        T: std::convert::Into<crate::model::Spoke>,
18663    {
18664        self.spoke = std::option::Option::Some(v.into());
18665        self
18666    }
18667
18668    /// Sets or clears the value of [spoke][crate::model::AcceptSpokeUpdateResponse::spoke].
18669    pub fn set_or_clear_spoke<T>(mut self, v: std::option::Option<T>) -> Self
18670    where
18671        T: std::convert::Into<crate::model::Spoke>,
18672    {
18673        self.spoke = v.map(|x| x.into());
18674        self
18675    }
18676}
18677
18678impl wkt::message::Message for AcceptSpokeUpdateResponse {
18679    fn typename() -> &'static str {
18680        "type.googleapis.com/google.cloud.networkconnectivity.v1.AcceptSpokeUpdateResponse"
18681    }
18682}
18683
18684#[doc(hidden)]
18685impl<'de> serde::de::Deserialize<'de> for AcceptSpokeUpdateResponse {
18686    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18687    where
18688        D: serde::Deserializer<'de>,
18689    {
18690        #[allow(non_camel_case_types)]
18691        #[doc(hidden)]
18692        #[derive(PartialEq, Eq, Hash)]
18693        enum __FieldTag {
18694            __spoke,
18695            Unknown(std::string::String),
18696        }
18697        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18698            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18699            where
18700                D: serde::Deserializer<'de>,
18701            {
18702                struct Visitor;
18703                impl<'de> serde::de::Visitor<'de> for Visitor {
18704                    type Value = __FieldTag;
18705                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18706                        formatter.write_str("a field name for AcceptSpokeUpdateResponse")
18707                    }
18708                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18709                    where
18710                        E: serde::de::Error,
18711                    {
18712                        use std::result::Result::Ok;
18713                        use std::string::ToString;
18714                        match value {
18715                            "spoke" => Ok(__FieldTag::__spoke),
18716                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18717                        }
18718                    }
18719                }
18720                deserializer.deserialize_identifier(Visitor)
18721            }
18722        }
18723        struct Visitor;
18724        impl<'de> serde::de::Visitor<'de> for Visitor {
18725            type Value = AcceptSpokeUpdateResponse;
18726            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18727                formatter.write_str("struct AcceptSpokeUpdateResponse")
18728            }
18729            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18730            where
18731                A: serde::de::MapAccess<'de>,
18732            {
18733                #[allow(unused_imports)]
18734                use serde::de::Error;
18735                use std::option::Option::Some;
18736                let mut fields = std::collections::HashSet::new();
18737                let mut result = Self::Value::new();
18738                while let Some(tag) = map.next_key::<__FieldTag>()? {
18739                    #[allow(clippy::match_single_binding)]
18740                    match tag {
18741                        __FieldTag::__spoke => {
18742                            if !fields.insert(__FieldTag::__spoke) {
18743                                return std::result::Result::Err(A::Error::duplicate_field(
18744                                    "multiple values for spoke",
18745                                ));
18746                            }
18747                            result.spoke =
18748                                map.next_value::<std::option::Option<crate::model::Spoke>>()?;
18749                        }
18750                        __FieldTag::Unknown(key) => {
18751                            let value = map.next_value::<serde_json::Value>()?;
18752                            result._unknown_fields.insert(key, value);
18753                        }
18754                    }
18755                }
18756                std::result::Result::Ok(result)
18757            }
18758        }
18759        deserializer.deserialize_any(Visitor)
18760    }
18761}
18762
18763#[doc(hidden)]
18764impl serde::ser::Serialize for AcceptSpokeUpdateResponse {
18765    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18766    where
18767        S: serde::ser::Serializer,
18768    {
18769        use serde::ser::SerializeMap;
18770        #[allow(unused_imports)]
18771        use std::option::Option::Some;
18772        let mut state = serializer.serialize_map(std::option::Option::None)?;
18773        if self.spoke.is_some() {
18774            state.serialize_entry("spoke", &self.spoke)?;
18775        }
18776        if !self._unknown_fields.is_empty() {
18777            for (key, value) in self._unknown_fields.iter() {
18778                state.serialize_entry(key, &value)?;
18779            }
18780        }
18781        state.end()
18782    }
18783}
18784
18785impl std::fmt::Debug for AcceptSpokeUpdateResponse {
18786    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18787        let mut debug_struct = f.debug_struct("AcceptSpokeUpdateResponse");
18788        debug_struct.field("spoke", &self.spoke);
18789        if !self._unknown_fields.is_empty() {
18790            debug_struct.field("_unknown_fields", &self._unknown_fields);
18791        }
18792        debug_struct.finish()
18793    }
18794}
18795
18796/// The request for
18797/// [HubService.RejectSpokeUpdate][google.cloud.networkconnectivity.v1.HubService.RejectSpokeUpdate].
18798///
18799/// [google.cloud.networkconnectivity.v1.HubService.RejectSpokeUpdate]: crate::client::HubService::reject_spoke_update
18800#[derive(Clone, Default, PartialEq)]
18801#[non_exhaustive]
18802pub struct RejectSpokeUpdateRequest {
18803    /// Required. The name of the hub to reject spoke update.
18804    pub name: std::string::String,
18805
18806    /// Required. The URI of the spoke to reject update.
18807    pub spoke_uri: std::string::String,
18808
18809    /// Required. The etag of the spoke to reject update.
18810    pub spoke_etag: std::string::String,
18811
18812    /// Optional. Additional information provided by the hub administrator.
18813    pub details: std::string::String,
18814
18815    /// Optional. A request ID to identify requests. Specify a unique request ID so
18816    /// that if you must retry your request, the server knows to ignore the request
18817    /// if it has already been completed. The server guarantees that a request
18818    /// doesn't result in creation of duplicate commitments for at least 60
18819    /// minutes.
18820    ///
18821    /// For example, consider a situation where you make an initial request and
18822    /// the request times out. If you make the request again with the same request
18823    /// ID, the server can check to see whether the original operation
18824    /// was received. If it was, the server ignores the second request. This
18825    /// behavior prevents clients from mistakenly creating duplicate commitments.
18826    ///
18827    /// The request ID must be a valid UUID, with the exception that zero UUID is
18828    /// not supported (00000000-0000-0000-0000-000000000000).
18829    pub request_id: std::string::String,
18830
18831    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18832}
18833
18834impl RejectSpokeUpdateRequest {
18835    pub fn new() -> Self {
18836        std::default::Default::default()
18837    }
18838
18839    /// Sets the value of [name][crate::model::RejectSpokeUpdateRequest::name].
18840    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18841        self.name = v.into();
18842        self
18843    }
18844
18845    /// Sets the value of [spoke_uri][crate::model::RejectSpokeUpdateRequest::spoke_uri].
18846    pub fn set_spoke_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18847        self.spoke_uri = v.into();
18848        self
18849    }
18850
18851    /// Sets the value of [spoke_etag][crate::model::RejectSpokeUpdateRequest::spoke_etag].
18852    pub fn set_spoke_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18853        self.spoke_etag = v.into();
18854        self
18855    }
18856
18857    /// Sets the value of [details][crate::model::RejectSpokeUpdateRequest::details].
18858    pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18859        self.details = v.into();
18860        self
18861    }
18862
18863    /// Sets the value of [request_id][crate::model::RejectSpokeUpdateRequest::request_id].
18864    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18865        self.request_id = v.into();
18866        self
18867    }
18868}
18869
18870impl wkt::message::Message for RejectSpokeUpdateRequest {
18871    fn typename() -> &'static str {
18872        "type.googleapis.com/google.cloud.networkconnectivity.v1.RejectSpokeUpdateRequest"
18873    }
18874}
18875
18876#[doc(hidden)]
18877impl<'de> serde::de::Deserialize<'de> for RejectSpokeUpdateRequest {
18878    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18879    where
18880        D: serde::Deserializer<'de>,
18881    {
18882        #[allow(non_camel_case_types)]
18883        #[doc(hidden)]
18884        #[derive(PartialEq, Eq, Hash)]
18885        enum __FieldTag {
18886            __name,
18887            __spoke_uri,
18888            __spoke_etag,
18889            __details,
18890            __request_id,
18891            Unknown(std::string::String),
18892        }
18893        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
18894            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18895            where
18896                D: serde::Deserializer<'de>,
18897            {
18898                struct Visitor;
18899                impl<'de> serde::de::Visitor<'de> for Visitor {
18900                    type Value = __FieldTag;
18901                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18902                        formatter.write_str("a field name for RejectSpokeUpdateRequest")
18903                    }
18904                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
18905                    where
18906                        E: serde::de::Error,
18907                    {
18908                        use std::result::Result::Ok;
18909                        use std::string::ToString;
18910                        match value {
18911                            "name" => Ok(__FieldTag::__name),
18912                            "spokeUri" => Ok(__FieldTag::__spoke_uri),
18913                            "spoke_uri" => Ok(__FieldTag::__spoke_uri),
18914                            "spokeEtag" => Ok(__FieldTag::__spoke_etag),
18915                            "spoke_etag" => Ok(__FieldTag::__spoke_etag),
18916                            "details" => Ok(__FieldTag::__details),
18917                            "requestId" => Ok(__FieldTag::__request_id),
18918                            "request_id" => Ok(__FieldTag::__request_id),
18919                            _ => Ok(__FieldTag::Unknown(value.to_string())),
18920                        }
18921                    }
18922                }
18923                deserializer.deserialize_identifier(Visitor)
18924            }
18925        }
18926        struct Visitor;
18927        impl<'de> serde::de::Visitor<'de> for Visitor {
18928            type Value = RejectSpokeUpdateRequest;
18929            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
18930                formatter.write_str("struct RejectSpokeUpdateRequest")
18931            }
18932            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
18933            where
18934                A: serde::de::MapAccess<'de>,
18935            {
18936                #[allow(unused_imports)]
18937                use serde::de::Error;
18938                use std::option::Option::Some;
18939                let mut fields = std::collections::HashSet::new();
18940                let mut result = Self::Value::new();
18941                while let Some(tag) = map.next_key::<__FieldTag>()? {
18942                    #[allow(clippy::match_single_binding)]
18943                    match tag {
18944                        __FieldTag::__name => {
18945                            if !fields.insert(__FieldTag::__name) {
18946                                return std::result::Result::Err(A::Error::duplicate_field(
18947                                    "multiple values for name",
18948                                ));
18949                            }
18950                            result.name = map
18951                                .next_value::<std::option::Option<std::string::String>>()?
18952                                .unwrap_or_default();
18953                        }
18954                        __FieldTag::__spoke_uri => {
18955                            if !fields.insert(__FieldTag::__spoke_uri) {
18956                                return std::result::Result::Err(A::Error::duplicate_field(
18957                                    "multiple values for spoke_uri",
18958                                ));
18959                            }
18960                            result.spoke_uri = map
18961                                .next_value::<std::option::Option<std::string::String>>()?
18962                                .unwrap_or_default();
18963                        }
18964                        __FieldTag::__spoke_etag => {
18965                            if !fields.insert(__FieldTag::__spoke_etag) {
18966                                return std::result::Result::Err(A::Error::duplicate_field(
18967                                    "multiple values for spoke_etag",
18968                                ));
18969                            }
18970                            result.spoke_etag = map
18971                                .next_value::<std::option::Option<std::string::String>>()?
18972                                .unwrap_or_default();
18973                        }
18974                        __FieldTag::__details => {
18975                            if !fields.insert(__FieldTag::__details) {
18976                                return std::result::Result::Err(A::Error::duplicate_field(
18977                                    "multiple values for details",
18978                                ));
18979                            }
18980                            result.details = map
18981                                .next_value::<std::option::Option<std::string::String>>()?
18982                                .unwrap_or_default();
18983                        }
18984                        __FieldTag::__request_id => {
18985                            if !fields.insert(__FieldTag::__request_id) {
18986                                return std::result::Result::Err(A::Error::duplicate_field(
18987                                    "multiple values for request_id",
18988                                ));
18989                            }
18990                            result.request_id = map
18991                                .next_value::<std::option::Option<std::string::String>>()?
18992                                .unwrap_or_default();
18993                        }
18994                        __FieldTag::Unknown(key) => {
18995                            let value = map.next_value::<serde_json::Value>()?;
18996                            result._unknown_fields.insert(key, value);
18997                        }
18998                    }
18999                }
19000                std::result::Result::Ok(result)
19001            }
19002        }
19003        deserializer.deserialize_any(Visitor)
19004    }
19005}
19006
19007#[doc(hidden)]
19008impl serde::ser::Serialize for RejectSpokeUpdateRequest {
19009    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19010    where
19011        S: serde::ser::Serializer,
19012    {
19013        use serde::ser::SerializeMap;
19014        #[allow(unused_imports)]
19015        use std::option::Option::Some;
19016        let mut state = serializer.serialize_map(std::option::Option::None)?;
19017        if !self.name.is_empty() {
19018            state.serialize_entry("name", &self.name)?;
19019        }
19020        if !self.spoke_uri.is_empty() {
19021            state.serialize_entry("spokeUri", &self.spoke_uri)?;
19022        }
19023        if !self.spoke_etag.is_empty() {
19024            state.serialize_entry("spokeEtag", &self.spoke_etag)?;
19025        }
19026        if !self.details.is_empty() {
19027            state.serialize_entry("details", &self.details)?;
19028        }
19029        if !self.request_id.is_empty() {
19030            state.serialize_entry("requestId", &self.request_id)?;
19031        }
19032        if !self._unknown_fields.is_empty() {
19033            for (key, value) in self._unknown_fields.iter() {
19034                state.serialize_entry(key, &value)?;
19035            }
19036        }
19037        state.end()
19038    }
19039}
19040
19041impl std::fmt::Debug for RejectSpokeUpdateRequest {
19042    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19043        let mut debug_struct = f.debug_struct("RejectSpokeUpdateRequest");
19044        debug_struct.field("name", &self.name);
19045        debug_struct.field("spoke_uri", &self.spoke_uri);
19046        debug_struct.field("spoke_etag", &self.spoke_etag);
19047        debug_struct.field("details", &self.details);
19048        debug_struct.field("request_id", &self.request_id);
19049        if !self._unknown_fields.is_empty() {
19050            debug_struct.field("_unknown_fields", &self._unknown_fields);
19051        }
19052        debug_struct.finish()
19053    }
19054}
19055
19056/// The response for
19057/// [HubService.RejectSpokeUpdate][google.cloud.networkconnectivity.v1.HubService.RejectSpokeUpdate].
19058///
19059/// [google.cloud.networkconnectivity.v1.HubService.RejectSpokeUpdate]: crate::client::HubService::reject_spoke_update
19060#[derive(Clone, Default, PartialEq)]
19061#[non_exhaustive]
19062pub struct RejectSpokeUpdateResponse {
19063    /// The spoke that was operated on.
19064    pub spoke: std::option::Option<crate::model::Spoke>,
19065
19066    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19067}
19068
19069impl RejectSpokeUpdateResponse {
19070    pub fn new() -> Self {
19071        std::default::Default::default()
19072    }
19073
19074    /// Sets the value of [spoke][crate::model::RejectSpokeUpdateResponse::spoke].
19075    pub fn set_spoke<T>(mut self, v: T) -> Self
19076    where
19077        T: std::convert::Into<crate::model::Spoke>,
19078    {
19079        self.spoke = std::option::Option::Some(v.into());
19080        self
19081    }
19082
19083    /// Sets or clears the value of [spoke][crate::model::RejectSpokeUpdateResponse::spoke].
19084    pub fn set_or_clear_spoke<T>(mut self, v: std::option::Option<T>) -> Self
19085    where
19086        T: std::convert::Into<crate::model::Spoke>,
19087    {
19088        self.spoke = v.map(|x| x.into());
19089        self
19090    }
19091}
19092
19093impl wkt::message::Message for RejectSpokeUpdateResponse {
19094    fn typename() -> &'static str {
19095        "type.googleapis.com/google.cloud.networkconnectivity.v1.RejectSpokeUpdateResponse"
19096    }
19097}
19098
19099#[doc(hidden)]
19100impl<'de> serde::de::Deserialize<'de> for RejectSpokeUpdateResponse {
19101    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19102    where
19103        D: serde::Deserializer<'de>,
19104    {
19105        #[allow(non_camel_case_types)]
19106        #[doc(hidden)]
19107        #[derive(PartialEq, Eq, Hash)]
19108        enum __FieldTag {
19109            __spoke,
19110            Unknown(std::string::String),
19111        }
19112        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19113            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19114            where
19115                D: serde::Deserializer<'de>,
19116            {
19117                struct Visitor;
19118                impl<'de> serde::de::Visitor<'de> for Visitor {
19119                    type Value = __FieldTag;
19120                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19121                        formatter.write_str("a field name for RejectSpokeUpdateResponse")
19122                    }
19123                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19124                    where
19125                        E: serde::de::Error,
19126                    {
19127                        use std::result::Result::Ok;
19128                        use std::string::ToString;
19129                        match value {
19130                            "spoke" => Ok(__FieldTag::__spoke),
19131                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19132                        }
19133                    }
19134                }
19135                deserializer.deserialize_identifier(Visitor)
19136            }
19137        }
19138        struct Visitor;
19139        impl<'de> serde::de::Visitor<'de> for Visitor {
19140            type Value = RejectSpokeUpdateResponse;
19141            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19142                formatter.write_str("struct RejectSpokeUpdateResponse")
19143            }
19144            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19145            where
19146                A: serde::de::MapAccess<'de>,
19147            {
19148                #[allow(unused_imports)]
19149                use serde::de::Error;
19150                use std::option::Option::Some;
19151                let mut fields = std::collections::HashSet::new();
19152                let mut result = Self::Value::new();
19153                while let Some(tag) = map.next_key::<__FieldTag>()? {
19154                    #[allow(clippy::match_single_binding)]
19155                    match tag {
19156                        __FieldTag::__spoke => {
19157                            if !fields.insert(__FieldTag::__spoke) {
19158                                return std::result::Result::Err(A::Error::duplicate_field(
19159                                    "multiple values for spoke",
19160                                ));
19161                            }
19162                            result.spoke =
19163                                map.next_value::<std::option::Option<crate::model::Spoke>>()?;
19164                        }
19165                        __FieldTag::Unknown(key) => {
19166                            let value = map.next_value::<serde_json::Value>()?;
19167                            result._unknown_fields.insert(key, value);
19168                        }
19169                    }
19170                }
19171                std::result::Result::Ok(result)
19172            }
19173        }
19174        deserializer.deserialize_any(Visitor)
19175    }
19176}
19177
19178#[doc(hidden)]
19179impl serde::ser::Serialize for RejectSpokeUpdateResponse {
19180    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19181    where
19182        S: serde::ser::Serializer,
19183    {
19184        use serde::ser::SerializeMap;
19185        #[allow(unused_imports)]
19186        use std::option::Option::Some;
19187        let mut state = serializer.serialize_map(std::option::Option::None)?;
19188        if self.spoke.is_some() {
19189            state.serialize_entry("spoke", &self.spoke)?;
19190        }
19191        if !self._unknown_fields.is_empty() {
19192            for (key, value) in self._unknown_fields.iter() {
19193                state.serialize_entry(key, &value)?;
19194            }
19195        }
19196        state.end()
19197    }
19198}
19199
19200impl std::fmt::Debug for RejectSpokeUpdateResponse {
19201    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19202        let mut debug_struct = f.debug_struct("RejectSpokeUpdateResponse");
19203        debug_struct.field("spoke", &self.spoke);
19204        if !self._unknown_fields.is_empty() {
19205            debug_struct.field("_unknown_fields", &self._unknown_fields);
19206        }
19207        debug_struct.finish()
19208    }
19209}
19210
19211/// The request for
19212/// [HubService.GetRouteTable][google.cloud.networkconnectivity.v1.HubService.GetRouteTable].
19213///
19214/// [google.cloud.networkconnectivity.v1.HubService.GetRouteTable]: crate::client::HubService::get_route_table
19215#[derive(Clone, Default, PartialEq)]
19216#[non_exhaustive]
19217pub struct GetRouteTableRequest {
19218    /// Required. The name of the route table resource.
19219    pub name: std::string::String,
19220
19221    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19222}
19223
19224impl GetRouteTableRequest {
19225    pub fn new() -> Self {
19226        std::default::Default::default()
19227    }
19228
19229    /// Sets the value of [name][crate::model::GetRouteTableRequest::name].
19230    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19231        self.name = v.into();
19232        self
19233    }
19234}
19235
19236impl wkt::message::Message for GetRouteTableRequest {
19237    fn typename() -> &'static str {
19238        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetRouteTableRequest"
19239    }
19240}
19241
19242#[doc(hidden)]
19243impl<'de> serde::de::Deserialize<'de> for GetRouteTableRequest {
19244    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19245    where
19246        D: serde::Deserializer<'de>,
19247    {
19248        #[allow(non_camel_case_types)]
19249        #[doc(hidden)]
19250        #[derive(PartialEq, Eq, Hash)]
19251        enum __FieldTag {
19252            __name,
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 GetRouteTableRequest")
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                            "name" => Ok(__FieldTag::__name),
19274                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19275                        }
19276                    }
19277                }
19278                deserializer.deserialize_identifier(Visitor)
19279            }
19280        }
19281        struct Visitor;
19282        impl<'de> serde::de::Visitor<'de> for Visitor {
19283            type Value = GetRouteTableRequest;
19284            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19285                formatter.write_str("struct GetRouteTableRequest")
19286            }
19287            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19288            where
19289                A: serde::de::MapAccess<'de>,
19290            {
19291                #[allow(unused_imports)]
19292                use serde::de::Error;
19293                use std::option::Option::Some;
19294                let mut fields = std::collections::HashSet::new();
19295                let mut result = Self::Value::new();
19296                while let Some(tag) = map.next_key::<__FieldTag>()? {
19297                    #[allow(clippy::match_single_binding)]
19298                    match tag {
19299                        __FieldTag::__name => {
19300                            if !fields.insert(__FieldTag::__name) {
19301                                return std::result::Result::Err(A::Error::duplicate_field(
19302                                    "multiple values for name",
19303                                ));
19304                            }
19305                            result.name = map
19306                                .next_value::<std::option::Option<std::string::String>>()?
19307                                .unwrap_or_default();
19308                        }
19309                        __FieldTag::Unknown(key) => {
19310                            let value = map.next_value::<serde_json::Value>()?;
19311                            result._unknown_fields.insert(key, value);
19312                        }
19313                    }
19314                }
19315                std::result::Result::Ok(result)
19316            }
19317        }
19318        deserializer.deserialize_any(Visitor)
19319    }
19320}
19321
19322#[doc(hidden)]
19323impl serde::ser::Serialize for GetRouteTableRequest {
19324    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19325    where
19326        S: serde::ser::Serializer,
19327    {
19328        use serde::ser::SerializeMap;
19329        #[allow(unused_imports)]
19330        use std::option::Option::Some;
19331        let mut state = serializer.serialize_map(std::option::Option::None)?;
19332        if !self.name.is_empty() {
19333            state.serialize_entry("name", &self.name)?;
19334        }
19335        if !self._unknown_fields.is_empty() {
19336            for (key, value) in self._unknown_fields.iter() {
19337                state.serialize_entry(key, &value)?;
19338            }
19339        }
19340        state.end()
19341    }
19342}
19343
19344impl std::fmt::Debug for GetRouteTableRequest {
19345    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19346        let mut debug_struct = f.debug_struct("GetRouteTableRequest");
19347        debug_struct.field("name", &self.name);
19348        if !self._unknown_fields.is_empty() {
19349            debug_struct.field("_unknown_fields", &self._unknown_fields);
19350        }
19351        debug_struct.finish()
19352    }
19353}
19354
19355/// The request for
19356/// [HubService.GetRoute][google.cloud.networkconnectivity.v1.HubService.GetRoute].
19357///
19358/// [google.cloud.networkconnectivity.v1.HubService.GetRoute]: crate::client::HubService::get_route
19359#[derive(Clone, Default, PartialEq)]
19360#[non_exhaustive]
19361pub struct GetRouteRequest {
19362    /// Required. The name of the route resource.
19363    pub name: std::string::String,
19364
19365    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19366}
19367
19368impl GetRouteRequest {
19369    pub fn new() -> Self {
19370        std::default::Default::default()
19371    }
19372
19373    /// Sets the value of [name][crate::model::GetRouteRequest::name].
19374    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19375        self.name = v.into();
19376        self
19377    }
19378}
19379
19380impl wkt::message::Message for GetRouteRequest {
19381    fn typename() -> &'static str {
19382        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetRouteRequest"
19383    }
19384}
19385
19386#[doc(hidden)]
19387impl<'de> serde::de::Deserialize<'de> for GetRouteRequest {
19388    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19389    where
19390        D: serde::Deserializer<'de>,
19391    {
19392        #[allow(non_camel_case_types)]
19393        #[doc(hidden)]
19394        #[derive(PartialEq, Eq, Hash)]
19395        enum __FieldTag {
19396            __name,
19397            Unknown(std::string::String),
19398        }
19399        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19400            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19401            where
19402                D: serde::Deserializer<'de>,
19403            {
19404                struct Visitor;
19405                impl<'de> serde::de::Visitor<'de> for Visitor {
19406                    type Value = __FieldTag;
19407                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19408                        formatter.write_str("a field name for GetRouteRequest")
19409                    }
19410                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19411                    where
19412                        E: serde::de::Error,
19413                    {
19414                        use std::result::Result::Ok;
19415                        use std::string::ToString;
19416                        match value {
19417                            "name" => Ok(__FieldTag::__name),
19418                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19419                        }
19420                    }
19421                }
19422                deserializer.deserialize_identifier(Visitor)
19423            }
19424        }
19425        struct Visitor;
19426        impl<'de> serde::de::Visitor<'de> for Visitor {
19427            type Value = GetRouteRequest;
19428            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19429                formatter.write_str("struct GetRouteRequest")
19430            }
19431            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19432            where
19433                A: serde::de::MapAccess<'de>,
19434            {
19435                #[allow(unused_imports)]
19436                use serde::de::Error;
19437                use std::option::Option::Some;
19438                let mut fields = std::collections::HashSet::new();
19439                let mut result = Self::Value::new();
19440                while let Some(tag) = map.next_key::<__FieldTag>()? {
19441                    #[allow(clippy::match_single_binding)]
19442                    match tag {
19443                        __FieldTag::__name => {
19444                            if !fields.insert(__FieldTag::__name) {
19445                                return std::result::Result::Err(A::Error::duplicate_field(
19446                                    "multiple values for name",
19447                                ));
19448                            }
19449                            result.name = map
19450                                .next_value::<std::option::Option<std::string::String>>()?
19451                                .unwrap_or_default();
19452                        }
19453                        __FieldTag::Unknown(key) => {
19454                            let value = map.next_value::<serde_json::Value>()?;
19455                            result._unknown_fields.insert(key, value);
19456                        }
19457                    }
19458                }
19459                std::result::Result::Ok(result)
19460            }
19461        }
19462        deserializer.deserialize_any(Visitor)
19463    }
19464}
19465
19466#[doc(hidden)]
19467impl serde::ser::Serialize for GetRouteRequest {
19468    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19469    where
19470        S: serde::ser::Serializer,
19471    {
19472        use serde::ser::SerializeMap;
19473        #[allow(unused_imports)]
19474        use std::option::Option::Some;
19475        let mut state = serializer.serialize_map(std::option::Option::None)?;
19476        if !self.name.is_empty() {
19477            state.serialize_entry("name", &self.name)?;
19478        }
19479        if !self._unknown_fields.is_empty() {
19480            for (key, value) in self._unknown_fields.iter() {
19481                state.serialize_entry(key, &value)?;
19482            }
19483        }
19484        state.end()
19485    }
19486}
19487
19488impl std::fmt::Debug for GetRouteRequest {
19489    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19490        let mut debug_struct = f.debug_struct("GetRouteRequest");
19491        debug_struct.field("name", &self.name);
19492        if !self._unknown_fields.is_empty() {
19493            debug_struct.field("_unknown_fields", &self._unknown_fields);
19494        }
19495        debug_struct.finish()
19496    }
19497}
19498
19499/// Request for
19500/// [HubService.ListRoutes][google.cloud.networkconnectivity.v1.HubService.ListRoutes]
19501/// method.
19502///
19503/// [google.cloud.networkconnectivity.v1.HubService.ListRoutes]: crate::client::HubService::list_routes
19504#[derive(Clone, Default, PartialEq)]
19505#[non_exhaustive]
19506pub struct ListRoutesRequest {
19507    /// Required. The parent resource's name.
19508    pub parent: std::string::String,
19509
19510    /// The maximum number of results to return per page.
19511    pub page_size: i32,
19512
19513    /// The page token.
19514    pub page_token: std::string::String,
19515
19516    /// An expression that filters the list of results.
19517    pub filter: std::string::String,
19518
19519    /// Sort the results by a certain order.
19520    pub order_by: std::string::String,
19521
19522    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19523}
19524
19525impl ListRoutesRequest {
19526    pub fn new() -> Self {
19527        std::default::Default::default()
19528    }
19529
19530    /// Sets the value of [parent][crate::model::ListRoutesRequest::parent].
19531    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19532        self.parent = v.into();
19533        self
19534    }
19535
19536    /// Sets the value of [page_size][crate::model::ListRoutesRequest::page_size].
19537    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
19538        self.page_size = v.into();
19539        self
19540    }
19541
19542    /// Sets the value of [page_token][crate::model::ListRoutesRequest::page_token].
19543    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19544        self.page_token = v.into();
19545        self
19546    }
19547
19548    /// Sets the value of [filter][crate::model::ListRoutesRequest::filter].
19549    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19550        self.filter = v.into();
19551        self
19552    }
19553
19554    /// Sets the value of [order_by][crate::model::ListRoutesRequest::order_by].
19555    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19556        self.order_by = v.into();
19557        self
19558    }
19559}
19560
19561impl wkt::message::Message for ListRoutesRequest {
19562    fn typename() -> &'static str {
19563        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListRoutesRequest"
19564    }
19565}
19566
19567#[doc(hidden)]
19568impl<'de> serde::de::Deserialize<'de> for ListRoutesRequest {
19569    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19570    where
19571        D: serde::Deserializer<'de>,
19572    {
19573        #[allow(non_camel_case_types)]
19574        #[doc(hidden)]
19575        #[derive(PartialEq, Eq, Hash)]
19576        enum __FieldTag {
19577            __parent,
19578            __page_size,
19579            __page_token,
19580            __filter,
19581            __order_by,
19582            Unknown(std::string::String),
19583        }
19584        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19585            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19586            where
19587                D: serde::Deserializer<'de>,
19588            {
19589                struct Visitor;
19590                impl<'de> serde::de::Visitor<'de> for Visitor {
19591                    type Value = __FieldTag;
19592                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19593                        formatter.write_str("a field name for ListRoutesRequest")
19594                    }
19595                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19596                    where
19597                        E: serde::de::Error,
19598                    {
19599                        use std::result::Result::Ok;
19600                        use std::string::ToString;
19601                        match value {
19602                            "parent" => Ok(__FieldTag::__parent),
19603                            "pageSize" => Ok(__FieldTag::__page_size),
19604                            "page_size" => Ok(__FieldTag::__page_size),
19605                            "pageToken" => Ok(__FieldTag::__page_token),
19606                            "page_token" => Ok(__FieldTag::__page_token),
19607                            "filter" => Ok(__FieldTag::__filter),
19608                            "orderBy" => Ok(__FieldTag::__order_by),
19609                            "order_by" => Ok(__FieldTag::__order_by),
19610                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19611                        }
19612                    }
19613                }
19614                deserializer.deserialize_identifier(Visitor)
19615            }
19616        }
19617        struct Visitor;
19618        impl<'de> serde::de::Visitor<'de> for Visitor {
19619            type Value = ListRoutesRequest;
19620            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19621                formatter.write_str("struct ListRoutesRequest")
19622            }
19623            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19624            where
19625                A: serde::de::MapAccess<'de>,
19626            {
19627                #[allow(unused_imports)]
19628                use serde::de::Error;
19629                use std::option::Option::Some;
19630                let mut fields = std::collections::HashSet::new();
19631                let mut result = Self::Value::new();
19632                while let Some(tag) = map.next_key::<__FieldTag>()? {
19633                    #[allow(clippy::match_single_binding)]
19634                    match tag {
19635                        __FieldTag::__parent => {
19636                            if !fields.insert(__FieldTag::__parent) {
19637                                return std::result::Result::Err(A::Error::duplicate_field(
19638                                    "multiple values for parent",
19639                                ));
19640                            }
19641                            result.parent = map
19642                                .next_value::<std::option::Option<std::string::String>>()?
19643                                .unwrap_or_default();
19644                        }
19645                        __FieldTag::__page_size => {
19646                            if !fields.insert(__FieldTag::__page_size) {
19647                                return std::result::Result::Err(A::Error::duplicate_field(
19648                                    "multiple values for page_size",
19649                                ));
19650                            }
19651                            struct __With(std::option::Option<i32>);
19652                            impl<'de> serde::de::Deserialize<'de> for __With {
19653                                fn deserialize<D>(
19654                                    deserializer: D,
19655                                ) -> std::result::Result<Self, D::Error>
19656                                where
19657                                    D: serde::de::Deserializer<'de>,
19658                                {
19659                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
19660                                }
19661                            }
19662                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
19663                        }
19664                        __FieldTag::__page_token => {
19665                            if !fields.insert(__FieldTag::__page_token) {
19666                                return std::result::Result::Err(A::Error::duplicate_field(
19667                                    "multiple values for page_token",
19668                                ));
19669                            }
19670                            result.page_token = map
19671                                .next_value::<std::option::Option<std::string::String>>()?
19672                                .unwrap_or_default();
19673                        }
19674                        __FieldTag::__filter => {
19675                            if !fields.insert(__FieldTag::__filter) {
19676                                return std::result::Result::Err(A::Error::duplicate_field(
19677                                    "multiple values for filter",
19678                                ));
19679                            }
19680                            result.filter = map
19681                                .next_value::<std::option::Option<std::string::String>>()?
19682                                .unwrap_or_default();
19683                        }
19684                        __FieldTag::__order_by => {
19685                            if !fields.insert(__FieldTag::__order_by) {
19686                                return std::result::Result::Err(A::Error::duplicate_field(
19687                                    "multiple values for order_by",
19688                                ));
19689                            }
19690                            result.order_by = map
19691                                .next_value::<std::option::Option<std::string::String>>()?
19692                                .unwrap_or_default();
19693                        }
19694                        __FieldTag::Unknown(key) => {
19695                            let value = map.next_value::<serde_json::Value>()?;
19696                            result._unknown_fields.insert(key, value);
19697                        }
19698                    }
19699                }
19700                std::result::Result::Ok(result)
19701            }
19702        }
19703        deserializer.deserialize_any(Visitor)
19704    }
19705}
19706
19707#[doc(hidden)]
19708impl serde::ser::Serialize for ListRoutesRequest {
19709    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19710    where
19711        S: serde::ser::Serializer,
19712    {
19713        use serde::ser::SerializeMap;
19714        #[allow(unused_imports)]
19715        use std::option::Option::Some;
19716        let mut state = serializer.serialize_map(std::option::Option::None)?;
19717        if !self.parent.is_empty() {
19718            state.serialize_entry("parent", &self.parent)?;
19719        }
19720        if !wkt::internal::is_default(&self.page_size) {
19721            struct __With<'a>(&'a i32);
19722            impl<'a> serde::ser::Serialize for __With<'a> {
19723                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19724                where
19725                    S: serde::ser::Serializer,
19726                {
19727                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
19728                }
19729            }
19730            state.serialize_entry("pageSize", &__With(&self.page_size))?;
19731        }
19732        if !self.page_token.is_empty() {
19733            state.serialize_entry("pageToken", &self.page_token)?;
19734        }
19735        if !self.filter.is_empty() {
19736            state.serialize_entry("filter", &self.filter)?;
19737        }
19738        if !self.order_by.is_empty() {
19739            state.serialize_entry("orderBy", &self.order_by)?;
19740        }
19741        if !self._unknown_fields.is_empty() {
19742            for (key, value) in self._unknown_fields.iter() {
19743                state.serialize_entry(key, &value)?;
19744            }
19745        }
19746        state.end()
19747    }
19748}
19749
19750impl std::fmt::Debug for ListRoutesRequest {
19751    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19752        let mut debug_struct = f.debug_struct("ListRoutesRequest");
19753        debug_struct.field("parent", &self.parent);
19754        debug_struct.field("page_size", &self.page_size);
19755        debug_struct.field("page_token", &self.page_token);
19756        debug_struct.field("filter", &self.filter);
19757        debug_struct.field("order_by", &self.order_by);
19758        if !self._unknown_fields.is_empty() {
19759            debug_struct.field("_unknown_fields", &self._unknown_fields);
19760        }
19761        debug_struct.finish()
19762    }
19763}
19764
19765/// Response for
19766/// [HubService.ListRoutes][google.cloud.networkconnectivity.v1.HubService.ListRoutes]
19767/// method.
19768///
19769/// [google.cloud.networkconnectivity.v1.HubService.ListRoutes]: crate::client::HubService::list_routes
19770#[derive(Clone, Default, PartialEq)]
19771#[non_exhaustive]
19772pub struct ListRoutesResponse {
19773    /// The requested routes.
19774    pub routes: std::vec::Vec<crate::model::Route>,
19775
19776    /// The token for the next page of the response. To see more results,
19777    /// use this value as the page_token for your next request. If this value
19778    /// is empty, there are no more results.
19779    pub next_page_token: std::string::String,
19780
19781    /// RouteTables that could not be reached.
19782    pub unreachable: std::vec::Vec<std::string::String>,
19783
19784    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19785}
19786
19787impl ListRoutesResponse {
19788    pub fn new() -> Self {
19789        std::default::Default::default()
19790    }
19791
19792    /// Sets the value of [routes][crate::model::ListRoutesResponse::routes].
19793    pub fn set_routes<T, V>(mut self, v: T) -> Self
19794    where
19795        T: std::iter::IntoIterator<Item = V>,
19796        V: std::convert::Into<crate::model::Route>,
19797    {
19798        use std::iter::Iterator;
19799        self.routes = v.into_iter().map(|i| i.into()).collect();
19800        self
19801    }
19802
19803    /// Sets the value of [next_page_token][crate::model::ListRoutesResponse::next_page_token].
19804    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19805        self.next_page_token = v.into();
19806        self
19807    }
19808
19809    /// Sets the value of [unreachable][crate::model::ListRoutesResponse::unreachable].
19810    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
19811    where
19812        T: std::iter::IntoIterator<Item = V>,
19813        V: std::convert::Into<std::string::String>,
19814    {
19815        use std::iter::Iterator;
19816        self.unreachable = v.into_iter().map(|i| i.into()).collect();
19817        self
19818    }
19819}
19820
19821impl wkt::message::Message for ListRoutesResponse {
19822    fn typename() -> &'static str {
19823        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListRoutesResponse"
19824    }
19825}
19826
19827#[doc(hidden)]
19828impl gax::paginator::internal::PageableResponse for ListRoutesResponse {
19829    type PageItem = crate::model::Route;
19830
19831    fn items(self) -> std::vec::Vec<Self::PageItem> {
19832        self.routes
19833    }
19834
19835    fn next_page_token(&self) -> std::string::String {
19836        use std::clone::Clone;
19837        self.next_page_token.clone()
19838    }
19839}
19840
19841#[doc(hidden)]
19842impl<'de> serde::de::Deserialize<'de> for ListRoutesResponse {
19843    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19844    where
19845        D: serde::Deserializer<'de>,
19846    {
19847        #[allow(non_camel_case_types)]
19848        #[doc(hidden)]
19849        #[derive(PartialEq, Eq, Hash)]
19850        enum __FieldTag {
19851            __routes,
19852            __next_page_token,
19853            __unreachable,
19854            Unknown(std::string::String),
19855        }
19856        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
19857            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19858            where
19859                D: serde::Deserializer<'de>,
19860            {
19861                struct Visitor;
19862                impl<'de> serde::de::Visitor<'de> for Visitor {
19863                    type Value = __FieldTag;
19864                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19865                        formatter.write_str("a field name for ListRoutesResponse")
19866                    }
19867                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
19868                    where
19869                        E: serde::de::Error,
19870                    {
19871                        use std::result::Result::Ok;
19872                        use std::string::ToString;
19873                        match value {
19874                            "routes" => Ok(__FieldTag::__routes),
19875                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
19876                            "next_page_token" => Ok(__FieldTag::__next_page_token),
19877                            "unreachable" => Ok(__FieldTag::__unreachable),
19878                            _ => Ok(__FieldTag::Unknown(value.to_string())),
19879                        }
19880                    }
19881                }
19882                deserializer.deserialize_identifier(Visitor)
19883            }
19884        }
19885        struct Visitor;
19886        impl<'de> serde::de::Visitor<'de> for Visitor {
19887            type Value = ListRoutesResponse;
19888            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
19889                formatter.write_str("struct ListRoutesResponse")
19890            }
19891            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
19892            where
19893                A: serde::de::MapAccess<'de>,
19894            {
19895                #[allow(unused_imports)]
19896                use serde::de::Error;
19897                use std::option::Option::Some;
19898                let mut fields = std::collections::HashSet::new();
19899                let mut result = Self::Value::new();
19900                while let Some(tag) = map.next_key::<__FieldTag>()? {
19901                    #[allow(clippy::match_single_binding)]
19902                    match tag {
19903                        __FieldTag::__routes => {
19904                            if !fields.insert(__FieldTag::__routes) {
19905                                return std::result::Result::Err(A::Error::duplicate_field(
19906                                    "multiple values for routes",
19907                                ));
19908                            }
19909                            result.routes = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Route>>>()?.unwrap_or_default();
19910                        }
19911                        __FieldTag::__next_page_token => {
19912                            if !fields.insert(__FieldTag::__next_page_token) {
19913                                return std::result::Result::Err(A::Error::duplicate_field(
19914                                    "multiple values for next_page_token",
19915                                ));
19916                            }
19917                            result.next_page_token = map
19918                                .next_value::<std::option::Option<std::string::String>>()?
19919                                .unwrap_or_default();
19920                        }
19921                        __FieldTag::__unreachable => {
19922                            if !fields.insert(__FieldTag::__unreachable) {
19923                                return std::result::Result::Err(A::Error::duplicate_field(
19924                                    "multiple values for unreachable",
19925                                ));
19926                            }
19927                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
19928                        }
19929                        __FieldTag::Unknown(key) => {
19930                            let value = map.next_value::<serde_json::Value>()?;
19931                            result._unknown_fields.insert(key, value);
19932                        }
19933                    }
19934                }
19935                std::result::Result::Ok(result)
19936            }
19937        }
19938        deserializer.deserialize_any(Visitor)
19939    }
19940}
19941
19942#[doc(hidden)]
19943impl serde::ser::Serialize for ListRoutesResponse {
19944    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19945    where
19946        S: serde::ser::Serializer,
19947    {
19948        use serde::ser::SerializeMap;
19949        #[allow(unused_imports)]
19950        use std::option::Option::Some;
19951        let mut state = serializer.serialize_map(std::option::Option::None)?;
19952        if !self.routes.is_empty() {
19953            state.serialize_entry("routes", &self.routes)?;
19954        }
19955        if !self.next_page_token.is_empty() {
19956            state.serialize_entry("nextPageToken", &self.next_page_token)?;
19957        }
19958        if !self.unreachable.is_empty() {
19959            state.serialize_entry("unreachable", &self.unreachable)?;
19960        }
19961        if !self._unknown_fields.is_empty() {
19962            for (key, value) in self._unknown_fields.iter() {
19963                state.serialize_entry(key, &value)?;
19964            }
19965        }
19966        state.end()
19967    }
19968}
19969
19970impl std::fmt::Debug for ListRoutesResponse {
19971    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19972        let mut debug_struct = f.debug_struct("ListRoutesResponse");
19973        debug_struct.field("routes", &self.routes);
19974        debug_struct.field("next_page_token", &self.next_page_token);
19975        debug_struct.field("unreachable", &self.unreachable);
19976        if !self._unknown_fields.is_empty() {
19977            debug_struct.field("_unknown_fields", &self._unknown_fields);
19978        }
19979        debug_struct.finish()
19980    }
19981}
19982
19983/// Request for
19984/// [HubService.ListRouteTables][google.cloud.networkconnectivity.v1.HubService.ListRouteTables]
19985/// method.
19986///
19987/// [google.cloud.networkconnectivity.v1.HubService.ListRouteTables]: crate::client::HubService::list_route_tables
19988#[derive(Clone, Default, PartialEq)]
19989#[non_exhaustive]
19990pub struct ListRouteTablesRequest {
19991    /// Required. The parent resource's name.
19992    pub parent: std::string::String,
19993
19994    /// The maximum number of results to return per page.
19995    pub page_size: i32,
19996
19997    /// The page token.
19998    pub page_token: std::string::String,
19999
20000    /// An expression that filters the list of results.
20001    pub filter: std::string::String,
20002
20003    /// Sort the results by a certain order.
20004    pub order_by: std::string::String,
20005
20006    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20007}
20008
20009impl ListRouteTablesRequest {
20010    pub fn new() -> Self {
20011        std::default::Default::default()
20012    }
20013
20014    /// Sets the value of [parent][crate::model::ListRouteTablesRequest::parent].
20015    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20016        self.parent = v.into();
20017        self
20018    }
20019
20020    /// Sets the value of [page_size][crate::model::ListRouteTablesRequest::page_size].
20021    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
20022        self.page_size = v.into();
20023        self
20024    }
20025
20026    /// Sets the value of [page_token][crate::model::ListRouteTablesRequest::page_token].
20027    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20028        self.page_token = v.into();
20029        self
20030    }
20031
20032    /// Sets the value of [filter][crate::model::ListRouteTablesRequest::filter].
20033    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20034        self.filter = v.into();
20035        self
20036    }
20037
20038    /// Sets the value of [order_by][crate::model::ListRouteTablesRequest::order_by].
20039    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20040        self.order_by = v.into();
20041        self
20042    }
20043}
20044
20045impl wkt::message::Message for ListRouteTablesRequest {
20046    fn typename() -> &'static str {
20047        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListRouteTablesRequest"
20048    }
20049}
20050
20051#[doc(hidden)]
20052impl<'de> serde::de::Deserialize<'de> for ListRouteTablesRequest {
20053    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20054    where
20055        D: serde::Deserializer<'de>,
20056    {
20057        #[allow(non_camel_case_types)]
20058        #[doc(hidden)]
20059        #[derive(PartialEq, Eq, Hash)]
20060        enum __FieldTag {
20061            __parent,
20062            __page_size,
20063            __page_token,
20064            __filter,
20065            __order_by,
20066            Unknown(std::string::String),
20067        }
20068        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
20069            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20070            where
20071                D: serde::Deserializer<'de>,
20072            {
20073                struct Visitor;
20074                impl<'de> serde::de::Visitor<'de> for Visitor {
20075                    type Value = __FieldTag;
20076                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20077                        formatter.write_str("a field name for ListRouteTablesRequest")
20078                    }
20079                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
20080                    where
20081                        E: serde::de::Error,
20082                    {
20083                        use std::result::Result::Ok;
20084                        use std::string::ToString;
20085                        match value {
20086                            "parent" => Ok(__FieldTag::__parent),
20087                            "pageSize" => Ok(__FieldTag::__page_size),
20088                            "page_size" => Ok(__FieldTag::__page_size),
20089                            "pageToken" => Ok(__FieldTag::__page_token),
20090                            "page_token" => Ok(__FieldTag::__page_token),
20091                            "filter" => Ok(__FieldTag::__filter),
20092                            "orderBy" => Ok(__FieldTag::__order_by),
20093                            "order_by" => Ok(__FieldTag::__order_by),
20094                            _ => Ok(__FieldTag::Unknown(value.to_string())),
20095                        }
20096                    }
20097                }
20098                deserializer.deserialize_identifier(Visitor)
20099            }
20100        }
20101        struct Visitor;
20102        impl<'de> serde::de::Visitor<'de> for Visitor {
20103            type Value = ListRouteTablesRequest;
20104            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20105                formatter.write_str("struct ListRouteTablesRequest")
20106            }
20107            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
20108            where
20109                A: serde::de::MapAccess<'de>,
20110            {
20111                #[allow(unused_imports)]
20112                use serde::de::Error;
20113                use std::option::Option::Some;
20114                let mut fields = std::collections::HashSet::new();
20115                let mut result = Self::Value::new();
20116                while let Some(tag) = map.next_key::<__FieldTag>()? {
20117                    #[allow(clippy::match_single_binding)]
20118                    match tag {
20119                        __FieldTag::__parent => {
20120                            if !fields.insert(__FieldTag::__parent) {
20121                                return std::result::Result::Err(A::Error::duplicate_field(
20122                                    "multiple values for parent",
20123                                ));
20124                            }
20125                            result.parent = map
20126                                .next_value::<std::option::Option<std::string::String>>()?
20127                                .unwrap_or_default();
20128                        }
20129                        __FieldTag::__page_size => {
20130                            if !fields.insert(__FieldTag::__page_size) {
20131                                return std::result::Result::Err(A::Error::duplicate_field(
20132                                    "multiple values for page_size",
20133                                ));
20134                            }
20135                            struct __With(std::option::Option<i32>);
20136                            impl<'de> serde::de::Deserialize<'de> for __With {
20137                                fn deserialize<D>(
20138                                    deserializer: D,
20139                                ) -> std::result::Result<Self, D::Error>
20140                                where
20141                                    D: serde::de::Deserializer<'de>,
20142                                {
20143                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
20144                                }
20145                            }
20146                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
20147                        }
20148                        __FieldTag::__page_token => {
20149                            if !fields.insert(__FieldTag::__page_token) {
20150                                return std::result::Result::Err(A::Error::duplicate_field(
20151                                    "multiple values for page_token",
20152                                ));
20153                            }
20154                            result.page_token = map
20155                                .next_value::<std::option::Option<std::string::String>>()?
20156                                .unwrap_or_default();
20157                        }
20158                        __FieldTag::__filter => {
20159                            if !fields.insert(__FieldTag::__filter) {
20160                                return std::result::Result::Err(A::Error::duplicate_field(
20161                                    "multiple values for filter",
20162                                ));
20163                            }
20164                            result.filter = map
20165                                .next_value::<std::option::Option<std::string::String>>()?
20166                                .unwrap_or_default();
20167                        }
20168                        __FieldTag::__order_by => {
20169                            if !fields.insert(__FieldTag::__order_by) {
20170                                return std::result::Result::Err(A::Error::duplicate_field(
20171                                    "multiple values for order_by",
20172                                ));
20173                            }
20174                            result.order_by = map
20175                                .next_value::<std::option::Option<std::string::String>>()?
20176                                .unwrap_or_default();
20177                        }
20178                        __FieldTag::Unknown(key) => {
20179                            let value = map.next_value::<serde_json::Value>()?;
20180                            result._unknown_fields.insert(key, value);
20181                        }
20182                    }
20183                }
20184                std::result::Result::Ok(result)
20185            }
20186        }
20187        deserializer.deserialize_any(Visitor)
20188    }
20189}
20190
20191#[doc(hidden)]
20192impl serde::ser::Serialize for ListRouteTablesRequest {
20193    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20194    where
20195        S: serde::ser::Serializer,
20196    {
20197        use serde::ser::SerializeMap;
20198        #[allow(unused_imports)]
20199        use std::option::Option::Some;
20200        let mut state = serializer.serialize_map(std::option::Option::None)?;
20201        if !self.parent.is_empty() {
20202            state.serialize_entry("parent", &self.parent)?;
20203        }
20204        if !wkt::internal::is_default(&self.page_size) {
20205            struct __With<'a>(&'a i32);
20206            impl<'a> serde::ser::Serialize for __With<'a> {
20207                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20208                where
20209                    S: serde::ser::Serializer,
20210                {
20211                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
20212                }
20213            }
20214            state.serialize_entry("pageSize", &__With(&self.page_size))?;
20215        }
20216        if !self.page_token.is_empty() {
20217            state.serialize_entry("pageToken", &self.page_token)?;
20218        }
20219        if !self.filter.is_empty() {
20220            state.serialize_entry("filter", &self.filter)?;
20221        }
20222        if !self.order_by.is_empty() {
20223            state.serialize_entry("orderBy", &self.order_by)?;
20224        }
20225        if !self._unknown_fields.is_empty() {
20226            for (key, value) in self._unknown_fields.iter() {
20227                state.serialize_entry(key, &value)?;
20228            }
20229        }
20230        state.end()
20231    }
20232}
20233
20234impl std::fmt::Debug for ListRouteTablesRequest {
20235    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20236        let mut debug_struct = f.debug_struct("ListRouteTablesRequest");
20237        debug_struct.field("parent", &self.parent);
20238        debug_struct.field("page_size", &self.page_size);
20239        debug_struct.field("page_token", &self.page_token);
20240        debug_struct.field("filter", &self.filter);
20241        debug_struct.field("order_by", &self.order_by);
20242        if !self._unknown_fields.is_empty() {
20243            debug_struct.field("_unknown_fields", &self._unknown_fields);
20244        }
20245        debug_struct.finish()
20246    }
20247}
20248
20249/// Response for
20250/// [HubService.ListRouteTables][google.cloud.networkconnectivity.v1.HubService.ListRouteTables]
20251/// method.
20252///
20253/// [google.cloud.networkconnectivity.v1.HubService.ListRouteTables]: crate::client::HubService::list_route_tables
20254#[derive(Clone, Default, PartialEq)]
20255#[non_exhaustive]
20256pub struct ListRouteTablesResponse {
20257    /// The requested route tables.
20258    pub route_tables: std::vec::Vec<crate::model::RouteTable>,
20259
20260    /// The token for the next page of the response. To see more results,
20261    /// use this value as the page_token for your next request. If this value
20262    /// is empty, there are no more results.
20263    pub next_page_token: std::string::String,
20264
20265    /// Hubs that could not be reached.
20266    pub unreachable: std::vec::Vec<std::string::String>,
20267
20268    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20269}
20270
20271impl ListRouteTablesResponse {
20272    pub fn new() -> Self {
20273        std::default::Default::default()
20274    }
20275
20276    /// Sets the value of [route_tables][crate::model::ListRouteTablesResponse::route_tables].
20277    pub fn set_route_tables<T, V>(mut self, v: T) -> Self
20278    where
20279        T: std::iter::IntoIterator<Item = V>,
20280        V: std::convert::Into<crate::model::RouteTable>,
20281    {
20282        use std::iter::Iterator;
20283        self.route_tables = v.into_iter().map(|i| i.into()).collect();
20284        self
20285    }
20286
20287    /// Sets the value of [next_page_token][crate::model::ListRouteTablesResponse::next_page_token].
20288    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20289        self.next_page_token = v.into();
20290        self
20291    }
20292
20293    /// Sets the value of [unreachable][crate::model::ListRouteTablesResponse::unreachable].
20294    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
20295    where
20296        T: std::iter::IntoIterator<Item = V>,
20297        V: std::convert::Into<std::string::String>,
20298    {
20299        use std::iter::Iterator;
20300        self.unreachable = v.into_iter().map(|i| i.into()).collect();
20301        self
20302    }
20303}
20304
20305impl wkt::message::Message for ListRouteTablesResponse {
20306    fn typename() -> &'static str {
20307        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListRouteTablesResponse"
20308    }
20309}
20310
20311#[doc(hidden)]
20312impl gax::paginator::internal::PageableResponse for ListRouteTablesResponse {
20313    type PageItem = crate::model::RouteTable;
20314
20315    fn items(self) -> std::vec::Vec<Self::PageItem> {
20316        self.route_tables
20317    }
20318
20319    fn next_page_token(&self) -> std::string::String {
20320        use std::clone::Clone;
20321        self.next_page_token.clone()
20322    }
20323}
20324
20325#[doc(hidden)]
20326impl<'de> serde::de::Deserialize<'de> for ListRouteTablesResponse {
20327    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20328    where
20329        D: serde::Deserializer<'de>,
20330    {
20331        #[allow(non_camel_case_types)]
20332        #[doc(hidden)]
20333        #[derive(PartialEq, Eq, Hash)]
20334        enum __FieldTag {
20335            __route_tables,
20336            __next_page_token,
20337            __unreachable,
20338            Unknown(std::string::String),
20339        }
20340        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
20341            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20342            where
20343                D: serde::Deserializer<'de>,
20344            {
20345                struct Visitor;
20346                impl<'de> serde::de::Visitor<'de> for Visitor {
20347                    type Value = __FieldTag;
20348                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20349                        formatter.write_str("a field name for ListRouteTablesResponse")
20350                    }
20351                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
20352                    where
20353                        E: serde::de::Error,
20354                    {
20355                        use std::result::Result::Ok;
20356                        use std::string::ToString;
20357                        match value {
20358                            "routeTables" => Ok(__FieldTag::__route_tables),
20359                            "route_tables" => Ok(__FieldTag::__route_tables),
20360                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
20361                            "next_page_token" => Ok(__FieldTag::__next_page_token),
20362                            "unreachable" => Ok(__FieldTag::__unreachable),
20363                            _ => Ok(__FieldTag::Unknown(value.to_string())),
20364                        }
20365                    }
20366                }
20367                deserializer.deserialize_identifier(Visitor)
20368            }
20369        }
20370        struct Visitor;
20371        impl<'de> serde::de::Visitor<'de> for Visitor {
20372            type Value = ListRouteTablesResponse;
20373            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20374                formatter.write_str("struct ListRouteTablesResponse")
20375            }
20376            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
20377            where
20378                A: serde::de::MapAccess<'de>,
20379            {
20380                #[allow(unused_imports)]
20381                use serde::de::Error;
20382                use std::option::Option::Some;
20383                let mut fields = std::collections::HashSet::new();
20384                let mut result = Self::Value::new();
20385                while let Some(tag) = map.next_key::<__FieldTag>()? {
20386                    #[allow(clippy::match_single_binding)]
20387                    match tag {
20388                        __FieldTag::__route_tables => {
20389                            if !fields.insert(__FieldTag::__route_tables) {
20390                                return std::result::Result::Err(A::Error::duplicate_field(
20391                                    "multiple values for route_tables",
20392                                ));
20393                            }
20394                            result.route_tables = map.next_value::<std::option::Option<std::vec::Vec<crate::model::RouteTable>>>()?.unwrap_or_default();
20395                        }
20396                        __FieldTag::__next_page_token => {
20397                            if !fields.insert(__FieldTag::__next_page_token) {
20398                                return std::result::Result::Err(A::Error::duplicate_field(
20399                                    "multiple values for next_page_token",
20400                                ));
20401                            }
20402                            result.next_page_token = map
20403                                .next_value::<std::option::Option<std::string::String>>()?
20404                                .unwrap_or_default();
20405                        }
20406                        __FieldTag::__unreachable => {
20407                            if !fields.insert(__FieldTag::__unreachable) {
20408                                return std::result::Result::Err(A::Error::duplicate_field(
20409                                    "multiple values for unreachable",
20410                                ));
20411                            }
20412                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
20413                        }
20414                        __FieldTag::Unknown(key) => {
20415                            let value = map.next_value::<serde_json::Value>()?;
20416                            result._unknown_fields.insert(key, value);
20417                        }
20418                    }
20419                }
20420                std::result::Result::Ok(result)
20421            }
20422        }
20423        deserializer.deserialize_any(Visitor)
20424    }
20425}
20426
20427#[doc(hidden)]
20428impl serde::ser::Serialize for ListRouteTablesResponse {
20429    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20430    where
20431        S: serde::ser::Serializer,
20432    {
20433        use serde::ser::SerializeMap;
20434        #[allow(unused_imports)]
20435        use std::option::Option::Some;
20436        let mut state = serializer.serialize_map(std::option::Option::None)?;
20437        if !self.route_tables.is_empty() {
20438            state.serialize_entry("routeTables", &self.route_tables)?;
20439        }
20440        if !self.next_page_token.is_empty() {
20441            state.serialize_entry("nextPageToken", &self.next_page_token)?;
20442        }
20443        if !self.unreachable.is_empty() {
20444            state.serialize_entry("unreachable", &self.unreachable)?;
20445        }
20446        if !self._unknown_fields.is_empty() {
20447            for (key, value) in self._unknown_fields.iter() {
20448                state.serialize_entry(key, &value)?;
20449            }
20450        }
20451        state.end()
20452    }
20453}
20454
20455impl std::fmt::Debug for ListRouteTablesResponse {
20456    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20457        let mut debug_struct = f.debug_struct("ListRouteTablesResponse");
20458        debug_struct.field("route_tables", &self.route_tables);
20459        debug_struct.field("next_page_token", &self.next_page_token);
20460        debug_struct.field("unreachable", &self.unreachable);
20461        if !self._unknown_fields.is_empty() {
20462            debug_struct.field("_unknown_fields", &self._unknown_fields);
20463        }
20464        debug_struct.finish()
20465    }
20466}
20467
20468/// Request for
20469/// [HubService.ListGroups][google.cloud.networkconnectivity.v1.HubService.ListGroups]
20470/// method.
20471///
20472/// [google.cloud.networkconnectivity.v1.HubService.ListGroups]: crate::client::HubService::list_groups
20473#[derive(Clone, Default, PartialEq)]
20474#[non_exhaustive]
20475pub struct ListGroupsRequest {
20476    /// Required. The parent resource's name.
20477    pub parent: std::string::String,
20478
20479    /// The maximum number of results to return per page.
20480    pub page_size: i32,
20481
20482    /// The page token.
20483    pub page_token: std::string::String,
20484
20485    /// An expression that filters the list of results.
20486    pub filter: std::string::String,
20487
20488    /// Sort the results by a certain order.
20489    pub order_by: std::string::String,
20490
20491    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20492}
20493
20494impl ListGroupsRequest {
20495    pub fn new() -> Self {
20496        std::default::Default::default()
20497    }
20498
20499    /// Sets the value of [parent][crate::model::ListGroupsRequest::parent].
20500    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20501        self.parent = v.into();
20502        self
20503    }
20504
20505    /// Sets the value of [page_size][crate::model::ListGroupsRequest::page_size].
20506    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
20507        self.page_size = v.into();
20508        self
20509    }
20510
20511    /// Sets the value of [page_token][crate::model::ListGroupsRequest::page_token].
20512    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20513        self.page_token = v.into();
20514        self
20515    }
20516
20517    /// Sets the value of [filter][crate::model::ListGroupsRequest::filter].
20518    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20519        self.filter = v.into();
20520        self
20521    }
20522
20523    /// Sets the value of [order_by][crate::model::ListGroupsRequest::order_by].
20524    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20525        self.order_by = v.into();
20526        self
20527    }
20528}
20529
20530impl wkt::message::Message for ListGroupsRequest {
20531    fn typename() -> &'static str {
20532        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListGroupsRequest"
20533    }
20534}
20535
20536#[doc(hidden)]
20537impl<'de> serde::de::Deserialize<'de> for ListGroupsRequest {
20538    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20539    where
20540        D: serde::Deserializer<'de>,
20541    {
20542        #[allow(non_camel_case_types)]
20543        #[doc(hidden)]
20544        #[derive(PartialEq, Eq, Hash)]
20545        enum __FieldTag {
20546            __parent,
20547            __page_size,
20548            __page_token,
20549            __filter,
20550            __order_by,
20551            Unknown(std::string::String),
20552        }
20553        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
20554            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20555            where
20556                D: serde::Deserializer<'de>,
20557            {
20558                struct Visitor;
20559                impl<'de> serde::de::Visitor<'de> for Visitor {
20560                    type Value = __FieldTag;
20561                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20562                        formatter.write_str("a field name for ListGroupsRequest")
20563                    }
20564                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
20565                    where
20566                        E: serde::de::Error,
20567                    {
20568                        use std::result::Result::Ok;
20569                        use std::string::ToString;
20570                        match value {
20571                            "parent" => Ok(__FieldTag::__parent),
20572                            "pageSize" => Ok(__FieldTag::__page_size),
20573                            "page_size" => Ok(__FieldTag::__page_size),
20574                            "pageToken" => Ok(__FieldTag::__page_token),
20575                            "page_token" => Ok(__FieldTag::__page_token),
20576                            "filter" => Ok(__FieldTag::__filter),
20577                            "orderBy" => Ok(__FieldTag::__order_by),
20578                            "order_by" => Ok(__FieldTag::__order_by),
20579                            _ => Ok(__FieldTag::Unknown(value.to_string())),
20580                        }
20581                    }
20582                }
20583                deserializer.deserialize_identifier(Visitor)
20584            }
20585        }
20586        struct Visitor;
20587        impl<'de> serde::de::Visitor<'de> for Visitor {
20588            type Value = ListGroupsRequest;
20589            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20590                formatter.write_str("struct ListGroupsRequest")
20591            }
20592            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
20593            where
20594                A: serde::de::MapAccess<'de>,
20595            {
20596                #[allow(unused_imports)]
20597                use serde::de::Error;
20598                use std::option::Option::Some;
20599                let mut fields = std::collections::HashSet::new();
20600                let mut result = Self::Value::new();
20601                while let Some(tag) = map.next_key::<__FieldTag>()? {
20602                    #[allow(clippy::match_single_binding)]
20603                    match tag {
20604                        __FieldTag::__parent => {
20605                            if !fields.insert(__FieldTag::__parent) {
20606                                return std::result::Result::Err(A::Error::duplicate_field(
20607                                    "multiple values for parent",
20608                                ));
20609                            }
20610                            result.parent = map
20611                                .next_value::<std::option::Option<std::string::String>>()?
20612                                .unwrap_or_default();
20613                        }
20614                        __FieldTag::__page_size => {
20615                            if !fields.insert(__FieldTag::__page_size) {
20616                                return std::result::Result::Err(A::Error::duplicate_field(
20617                                    "multiple values for page_size",
20618                                ));
20619                            }
20620                            struct __With(std::option::Option<i32>);
20621                            impl<'de> serde::de::Deserialize<'de> for __With {
20622                                fn deserialize<D>(
20623                                    deserializer: D,
20624                                ) -> std::result::Result<Self, D::Error>
20625                                where
20626                                    D: serde::de::Deserializer<'de>,
20627                                {
20628                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
20629                                }
20630                            }
20631                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
20632                        }
20633                        __FieldTag::__page_token => {
20634                            if !fields.insert(__FieldTag::__page_token) {
20635                                return std::result::Result::Err(A::Error::duplicate_field(
20636                                    "multiple values for page_token",
20637                                ));
20638                            }
20639                            result.page_token = map
20640                                .next_value::<std::option::Option<std::string::String>>()?
20641                                .unwrap_or_default();
20642                        }
20643                        __FieldTag::__filter => {
20644                            if !fields.insert(__FieldTag::__filter) {
20645                                return std::result::Result::Err(A::Error::duplicate_field(
20646                                    "multiple values for filter",
20647                                ));
20648                            }
20649                            result.filter = map
20650                                .next_value::<std::option::Option<std::string::String>>()?
20651                                .unwrap_or_default();
20652                        }
20653                        __FieldTag::__order_by => {
20654                            if !fields.insert(__FieldTag::__order_by) {
20655                                return std::result::Result::Err(A::Error::duplicate_field(
20656                                    "multiple values for order_by",
20657                                ));
20658                            }
20659                            result.order_by = map
20660                                .next_value::<std::option::Option<std::string::String>>()?
20661                                .unwrap_or_default();
20662                        }
20663                        __FieldTag::Unknown(key) => {
20664                            let value = map.next_value::<serde_json::Value>()?;
20665                            result._unknown_fields.insert(key, value);
20666                        }
20667                    }
20668                }
20669                std::result::Result::Ok(result)
20670            }
20671        }
20672        deserializer.deserialize_any(Visitor)
20673    }
20674}
20675
20676#[doc(hidden)]
20677impl serde::ser::Serialize for ListGroupsRequest {
20678    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20679    where
20680        S: serde::ser::Serializer,
20681    {
20682        use serde::ser::SerializeMap;
20683        #[allow(unused_imports)]
20684        use std::option::Option::Some;
20685        let mut state = serializer.serialize_map(std::option::Option::None)?;
20686        if !self.parent.is_empty() {
20687            state.serialize_entry("parent", &self.parent)?;
20688        }
20689        if !wkt::internal::is_default(&self.page_size) {
20690            struct __With<'a>(&'a i32);
20691            impl<'a> serde::ser::Serialize for __With<'a> {
20692                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20693                where
20694                    S: serde::ser::Serializer,
20695                {
20696                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
20697                }
20698            }
20699            state.serialize_entry("pageSize", &__With(&self.page_size))?;
20700        }
20701        if !self.page_token.is_empty() {
20702            state.serialize_entry("pageToken", &self.page_token)?;
20703        }
20704        if !self.filter.is_empty() {
20705            state.serialize_entry("filter", &self.filter)?;
20706        }
20707        if !self.order_by.is_empty() {
20708            state.serialize_entry("orderBy", &self.order_by)?;
20709        }
20710        if !self._unknown_fields.is_empty() {
20711            for (key, value) in self._unknown_fields.iter() {
20712                state.serialize_entry(key, &value)?;
20713            }
20714        }
20715        state.end()
20716    }
20717}
20718
20719impl std::fmt::Debug for ListGroupsRequest {
20720    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20721        let mut debug_struct = f.debug_struct("ListGroupsRequest");
20722        debug_struct.field("parent", &self.parent);
20723        debug_struct.field("page_size", &self.page_size);
20724        debug_struct.field("page_token", &self.page_token);
20725        debug_struct.field("filter", &self.filter);
20726        debug_struct.field("order_by", &self.order_by);
20727        if !self._unknown_fields.is_empty() {
20728            debug_struct.field("_unknown_fields", &self._unknown_fields);
20729        }
20730        debug_struct.finish()
20731    }
20732}
20733
20734/// Response for
20735/// [HubService.ListGroups][google.cloud.networkconnectivity.v1.HubService.ListGroups]
20736/// method.
20737///
20738/// [google.cloud.networkconnectivity.v1.HubService.ListGroups]: crate::client::HubService::list_groups
20739#[derive(Clone, Default, PartialEq)]
20740#[non_exhaustive]
20741pub struct ListGroupsResponse {
20742    /// The requested groups.
20743    pub groups: std::vec::Vec<crate::model::Group>,
20744
20745    /// The token for the next page of the response. To see more results,
20746    /// use this value as the page_token for your next request. If this value
20747    /// is empty, there are no more results.
20748    pub next_page_token: std::string::String,
20749
20750    /// Hubs that could not be reached.
20751    pub unreachable: std::vec::Vec<std::string::String>,
20752
20753    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20754}
20755
20756impl ListGroupsResponse {
20757    pub fn new() -> Self {
20758        std::default::Default::default()
20759    }
20760
20761    /// Sets the value of [groups][crate::model::ListGroupsResponse::groups].
20762    pub fn set_groups<T, V>(mut self, v: T) -> Self
20763    where
20764        T: std::iter::IntoIterator<Item = V>,
20765        V: std::convert::Into<crate::model::Group>,
20766    {
20767        use std::iter::Iterator;
20768        self.groups = v.into_iter().map(|i| i.into()).collect();
20769        self
20770    }
20771
20772    /// Sets the value of [next_page_token][crate::model::ListGroupsResponse::next_page_token].
20773    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20774        self.next_page_token = v.into();
20775        self
20776    }
20777
20778    /// Sets the value of [unreachable][crate::model::ListGroupsResponse::unreachable].
20779    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
20780    where
20781        T: std::iter::IntoIterator<Item = V>,
20782        V: std::convert::Into<std::string::String>,
20783    {
20784        use std::iter::Iterator;
20785        self.unreachable = v.into_iter().map(|i| i.into()).collect();
20786        self
20787    }
20788}
20789
20790impl wkt::message::Message for ListGroupsResponse {
20791    fn typename() -> &'static str {
20792        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListGroupsResponse"
20793    }
20794}
20795
20796#[doc(hidden)]
20797impl gax::paginator::internal::PageableResponse for ListGroupsResponse {
20798    type PageItem = crate::model::Group;
20799
20800    fn items(self) -> std::vec::Vec<Self::PageItem> {
20801        self.groups
20802    }
20803
20804    fn next_page_token(&self) -> std::string::String {
20805        use std::clone::Clone;
20806        self.next_page_token.clone()
20807    }
20808}
20809
20810#[doc(hidden)]
20811impl<'de> serde::de::Deserialize<'de> for ListGroupsResponse {
20812    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20813    where
20814        D: serde::Deserializer<'de>,
20815    {
20816        #[allow(non_camel_case_types)]
20817        #[doc(hidden)]
20818        #[derive(PartialEq, Eq, Hash)]
20819        enum __FieldTag {
20820            __groups,
20821            __next_page_token,
20822            __unreachable,
20823            Unknown(std::string::String),
20824        }
20825        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
20826            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20827            where
20828                D: serde::Deserializer<'de>,
20829            {
20830                struct Visitor;
20831                impl<'de> serde::de::Visitor<'de> for Visitor {
20832                    type Value = __FieldTag;
20833                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20834                        formatter.write_str("a field name for ListGroupsResponse")
20835                    }
20836                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
20837                    where
20838                        E: serde::de::Error,
20839                    {
20840                        use std::result::Result::Ok;
20841                        use std::string::ToString;
20842                        match value {
20843                            "groups" => Ok(__FieldTag::__groups),
20844                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
20845                            "next_page_token" => Ok(__FieldTag::__next_page_token),
20846                            "unreachable" => Ok(__FieldTag::__unreachable),
20847                            _ => Ok(__FieldTag::Unknown(value.to_string())),
20848                        }
20849                    }
20850                }
20851                deserializer.deserialize_identifier(Visitor)
20852            }
20853        }
20854        struct Visitor;
20855        impl<'de> serde::de::Visitor<'de> for Visitor {
20856            type Value = ListGroupsResponse;
20857            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
20858                formatter.write_str("struct ListGroupsResponse")
20859            }
20860            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
20861            where
20862                A: serde::de::MapAccess<'de>,
20863            {
20864                #[allow(unused_imports)]
20865                use serde::de::Error;
20866                use std::option::Option::Some;
20867                let mut fields = std::collections::HashSet::new();
20868                let mut result = Self::Value::new();
20869                while let Some(tag) = map.next_key::<__FieldTag>()? {
20870                    #[allow(clippy::match_single_binding)]
20871                    match tag {
20872                        __FieldTag::__groups => {
20873                            if !fields.insert(__FieldTag::__groups) {
20874                                return std::result::Result::Err(A::Error::duplicate_field(
20875                                    "multiple values for groups",
20876                                ));
20877                            }
20878                            result.groups = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Group>>>()?.unwrap_or_default();
20879                        }
20880                        __FieldTag::__next_page_token => {
20881                            if !fields.insert(__FieldTag::__next_page_token) {
20882                                return std::result::Result::Err(A::Error::duplicate_field(
20883                                    "multiple values for next_page_token",
20884                                ));
20885                            }
20886                            result.next_page_token = map
20887                                .next_value::<std::option::Option<std::string::String>>()?
20888                                .unwrap_or_default();
20889                        }
20890                        __FieldTag::__unreachable => {
20891                            if !fields.insert(__FieldTag::__unreachable) {
20892                                return std::result::Result::Err(A::Error::duplicate_field(
20893                                    "multiple values for unreachable",
20894                                ));
20895                            }
20896                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
20897                        }
20898                        __FieldTag::Unknown(key) => {
20899                            let value = map.next_value::<serde_json::Value>()?;
20900                            result._unknown_fields.insert(key, value);
20901                        }
20902                    }
20903                }
20904                std::result::Result::Ok(result)
20905            }
20906        }
20907        deserializer.deserialize_any(Visitor)
20908    }
20909}
20910
20911#[doc(hidden)]
20912impl serde::ser::Serialize for ListGroupsResponse {
20913    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20914    where
20915        S: serde::ser::Serializer,
20916    {
20917        use serde::ser::SerializeMap;
20918        #[allow(unused_imports)]
20919        use std::option::Option::Some;
20920        let mut state = serializer.serialize_map(std::option::Option::None)?;
20921        if !self.groups.is_empty() {
20922            state.serialize_entry("groups", &self.groups)?;
20923        }
20924        if !self.next_page_token.is_empty() {
20925            state.serialize_entry("nextPageToken", &self.next_page_token)?;
20926        }
20927        if !self.unreachable.is_empty() {
20928            state.serialize_entry("unreachable", &self.unreachable)?;
20929        }
20930        if !self._unknown_fields.is_empty() {
20931            for (key, value) in self._unknown_fields.iter() {
20932                state.serialize_entry(key, &value)?;
20933            }
20934        }
20935        state.end()
20936    }
20937}
20938
20939impl std::fmt::Debug for ListGroupsResponse {
20940    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20941        let mut debug_struct = f.debug_struct("ListGroupsResponse");
20942        debug_struct.field("groups", &self.groups);
20943        debug_struct.field("next_page_token", &self.next_page_token);
20944        debug_struct.field("unreachable", &self.unreachable);
20945        if !self._unknown_fields.is_empty() {
20946            debug_struct.field("_unknown_fields", &self._unknown_fields);
20947        }
20948        debug_struct.finish()
20949    }
20950}
20951
20952/// A collection of Cloud VPN tunnel resources. These resources should be
20953/// redundant HA VPN tunnels that all advertise the same prefixes to Google
20954/// Cloud. Alternatively, in a passive/active configuration, all tunnels
20955/// should be capable of advertising the same prefixes.
20956#[derive(Clone, Default, PartialEq)]
20957#[non_exhaustive]
20958pub struct LinkedVpnTunnels {
20959    /// The URIs of linked VPN tunnel resources.
20960    pub uris: std::vec::Vec<std::string::String>,
20961
20962    /// A value that controls whether site-to-site data transfer is enabled for
20963    /// these resources. Data transfer is available only in [supported
20964    /// locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations).
20965    pub site_to_site_data_transfer: bool,
20966
20967    /// Output only. The VPC network where these VPN tunnels are located.
20968    pub vpc_network: std::string::String,
20969
20970    /// Optional. IP ranges allowed to be included during import from hub (does not
20971    /// control transit connectivity). The only allowed value for now is
20972    /// "ALL_IPV4_RANGES".
20973    pub include_import_ranges: std::vec::Vec<std::string::String>,
20974
20975    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20976}
20977
20978impl LinkedVpnTunnels {
20979    pub fn new() -> Self {
20980        std::default::Default::default()
20981    }
20982
20983    /// Sets the value of [uris][crate::model::LinkedVpnTunnels::uris].
20984    pub fn set_uris<T, V>(mut self, v: T) -> Self
20985    where
20986        T: std::iter::IntoIterator<Item = V>,
20987        V: std::convert::Into<std::string::String>,
20988    {
20989        use std::iter::Iterator;
20990        self.uris = v.into_iter().map(|i| i.into()).collect();
20991        self
20992    }
20993
20994    /// Sets the value of [site_to_site_data_transfer][crate::model::LinkedVpnTunnels::site_to_site_data_transfer].
20995    pub fn set_site_to_site_data_transfer<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
20996        self.site_to_site_data_transfer = v.into();
20997        self
20998    }
20999
21000    /// Sets the value of [vpc_network][crate::model::LinkedVpnTunnels::vpc_network].
21001    pub fn set_vpc_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21002        self.vpc_network = v.into();
21003        self
21004    }
21005
21006    /// Sets the value of [include_import_ranges][crate::model::LinkedVpnTunnels::include_import_ranges].
21007    pub fn set_include_import_ranges<T, V>(mut self, v: T) -> Self
21008    where
21009        T: std::iter::IntoIterator<Item = V>,
21010        V: std::convert::Into<std::string::String>,
21011    {
21012        use std::iter::Iterator;
21013        self.include_import_ranges = v.into_iter().map(|i| i.into()).collect();
21014        self
21015    }
21016}
21017
21018impl wkt::message::Message for LinkedVpnTunnels {
21019    fn typename() -> &'static str {
21020        "type.googleapis.com/google.cloud.networkconnectivity.v1.LinkedVpnTunnels"
21021    }
21022}
21023
21024#[doc(hidden)]
21025impl<'de> serde::de::Deserialize<'de> for LinkedVpnTunnels {
21026    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21027    where
21028        D: serde::Deserializer<'de>,
21029    {
21030        #[allow(non_camel_case_types)]
21031        #[doc(hidden)]
21032        #[derive(PartialEq, Eq, Hash)]
21033        enum __FieldTag {
21034            __uris,
21035            __site_to_site_data_transfer,
21036            __vpc_network,
21037            __include_import_ranges,
21038            Unknown(std::string::String),
21039        }
21040        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21041            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21042            where
21043                D: serde::Deserializer<'de>,
21044            {
21045                struct Visitor;
21046                impl<'de> serde::de::Visitor<'de> for Visitor {
21047                    type Value = __FieldTag;
21048                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21049                        formatter.write_str("a field name for LinkedVpnTunnels")
21050                    }
21051                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21052                    where
21053                        E: serde::de::Error,
21054                    {
21055                        use std::result::Result::Ok;
21056                        use std::string::ToString;
21057                        match value {
21058                            "uris" => Ok(__FieldTag::__uris),
21059                            "siteToSiteDataTransfer" => {
21060                                Ok(__FieldTag::__site_to_site_data_transfer)
21061                            }
21062                            "site_to_site_data_transfer" => {
21063                                Ok(__FieldTag::__site_to_site_data_transfer)
21064                            }
21065                            "vpcNetwork" => Ok(__FieldTag::__vpc_network),
21066                            "vpc_network" => Ok(__FieldTag::__vpc_network),
21067                            "includeImportRanges" => Ok(__FieldTag::__include_import_ranges),
21068                            "include_import_ranges" => Ok(__FieldTag::__include_import_ranges),
21069                            _ => Ok(__FieldTag::Unknown(value.to_string())),
21070                        }
21071                    }
21072                }
21073                deserializer.deserialize_identifier(Visitor)
21074            }
21075        }
21076        struct Visitor;
21077        impl<'de> serde::de::Visitor<'de> for Visitor {
21078            type Value = LinkedVpnTunnels;
21079            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21080                formatter.write_str("struct LinkedVpnTunnels")
21081            }
21082            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21083            where
21084                A: serde::de::MapAccess<'de>,
21085            {
21086                #[allow(unused_imports)]
21087                use serde::de::Error;
21088                use std::option::Option::Some;
21089                let mut fields = std::collections::HashSet::new();
21090                let mut result = Self::Value::new();
21091                while let Some(tag) = map.next_key::<__FieldTag>()? {
21092                    #[allow(clippy::match_single_binding)]
21093                    match tag {
21094                        __FieldTag::__uris => {
21095                            if !fields.insert(__FieldTag::__uris) {
21096                                return std::result::Result::Err(A::Error::duplicate_field(
21097                                    "multiple values for uris",
21098                                ));
21099                            }
21100                            result.uris = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
21101                        }
21102                        __FieldTag::__site_to_site_data_transfer => {
21103                            if !fields.insert(__FieldTag::__site_to_site_data_transfer) {
21104                                return std::result::Result::Err(A::Error::duplicate_field(
21105                                    "multiple values for site_to_site_data_transfer",
21106                                ));
21107                            }
21108                            result.site_to_site_data_transfer = map
21109                                .next_value::<std::option::Option<bool>>()?
21110                                .unwrap_or_default();
21111                        }
21112                        __FieldTag::__vpc_network => {
21113                            if !fields.insert(__FieldTag::__vpc_network) {
21114                                return std::result::Result::Err(A::Error::duplicate_field(
21115                                    "multiple values for vpc_network",
21116                                ));
21117                            }
21118                            result.vpc_network = map
21119                                .next_value::<std::option::Option<std::string::String>>()?
21120                                .unwrap_or_default();
21121                        }
21122                        __FieldTag::__include_import_ranges => {
21123                            if !fields.insert(__FieldTag::__include_import_ranges) {
21124                                return std::result::Result::Err(A::Error::duplicate_field(
21125                                    "multiple values for include_import_ranges",
21126                                ));
21127                            }
21128                            result.include_import_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
21129                        }
21130                        __FieldTag::Unknown(key) => {
21131                            let value = map.next_value::<serde_json::Value>()?;
21132                            result._unknown_fields.insert(key, value);
21133                        }
21134                    }
21135                }
21136                std::result::Result::Ok(result)
21137            }
21138        }
21139        deserializer.deserialize_any(Visitor)
21140    }
21141}
21142
21143#[doc(hidden)]
21144impl serde::ser::Serialize for LinkedVpnTunnels {
21145    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21146    where
21147        S: serde::ser::Serializer,
21148    {
21149        use serde::ser::SerializeMap;
21150        #[allow(unused_imports)]
21151        use std::option::Option::Some;
21152        let mut state = serializer.serialize_map(std::option::Option::None)?;
21153        if !self.uris.is_empty() {
21154            state.serialize_entry("uris", &self.uris)?;
21155        }
21156        if !wkt::internal::is_default(&self.site_to_site_data_transfer) {
21157            state.serialize_entry("siteToSiteDataTransfer", &self.site_to_site_data_transfer)?;
21158        }
21159        if !self.vpc_network.is_empty() {
21160            state.serialize_entry("vpcNetwork", &self.vpc_network)?;
21161        }
21162        if !self.include_import_ranges.is_empty() {
21163            state.serialize_entry("includeImportRanges", &self.include_import_ranges)?;
21164        }
21165        if !self._unknown_fields.is_empty() {
21166            for (key, value) in self._unknown_fields.iter() {
21167                state.serialize_entry(key, &value)?;
21168            }
21169        }
21170        state.end()
21171    }
21172}
21173
21174impl std::fmt::Debug for LinkedVpnTunnels {
21175    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21176        let mut debug_struct = f.debug_struct("LinkedVpnTunnels");
21177        debug_struct.field("uris", &self.uris);
21178        debug_struct.field(
21179            "site_to_site_data_transfer",
21180            &self.site_to_site_data_transfer,
21181        );
21182        debug_struct.field("vpc_network", &self.vpc_network);
21183        debug_struct.field("include_import_ranges", &self.include_import_ranges);
21184        if !self._unknown_fields.is_empty() {
21185            debug_struct.field("_unknown_fields", &self._unknown_fields);
21186        }
21187        debug_struct.finish()
21188    }
21189}
21190
21191/// A collection of VLAN attachment resources. These resources should
21192/// be redundant attachments that all advertise the same prefixes to Google
21193/// Cloud. Alternatively, in active/passive configurations, all attachments
21194/// should be capable of advertising the same prefixes.
21195#[derive(Clone, Default, PartialEq)]
21196#[non_exhaustive]
21197pub struct LinkedInterconnectAttachments {
21198    /// The URIs of linked interconnect attachment resources
21199    pub uris: std::vec::Vec<std::string::String>,
21200
21201    /// A value that controls whether site-to-site data transfer is enabled for
21202    /// these resources. Data transfer is available only in [supported
21203    /// locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations).
21204    pub site_to_site_data_transfer: bool,
21205
21206    /// Output only. The VPC network where these VLAN attachments are located.
21207    pub vpc_network: std::string::String,
21208
21209    /// Optional. IP ranges allowed to be included during import from hub (does not
21210    /// control transit connectivity). The only allowed value for now is
21211    /// "ALL_IPV4_RANGES".
21212    pub include_import_ranges: std::vec::Vec<std::string::String>,
21213
21214    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21215}
21216
21217impl LinkedInterconnectAttachments {
21218    pub fn new() -> Self {
21219        std::default::Default::default()
21220    }
21221
21222    /// Sets the value of [uris][crate::model::LinkedInterconnectAttachments::uris].
21223    pub fn set_uris<T, V>(mut self, v: T) -> Self
21224    where
21225        T: std::iter::IntoIterator<Item = V>,
21226        V: std::convert::Into<std::string::String>,
21227    {
21228        use std::iter::Iterator;
21229        self.uris = v.into_iter().map(|i| i.into()).collect();
21230        self
21231    }
21232
21233    /// Sets the value of [site_to_site_data_transfer][crate::model::LinkedInterconnectAttachments::site_to_site_data_transfer].
21234    pub fn set_site_to_site_data_transfer<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21235        self.site_to_site_data_transfer = v.into();
21236        self
21237    }
21238
21239    /// Sets the value of [vpc_network][crate::model::LinkedInterconnectAttachments::vpc_network].
21240    pub fn set_vpc_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21241        self.vpc_network = v.into();
21242        self
21243    }
21244
21245    /// Sets the value of [include_import_ranges][crate::model::LinkedInterconnectAttachments::include_import_ranges].
21246    pub fn set_include_import_ranges<T, V>(mut self, v: T) -> Self
21247    where
21248        T: std::iter::IntoIterator<Item = V>,
21249        V: std::convert::Into<std::string::String>,
21250    {
21251        use std::iter::Iterator;
21252        self.include_import_ranges = v.into_iter().map(|i| i.into()).collect();
21253        self
21254    }
21255}
21256
21257impl wkt::message::Message for LinkedInterconnectAttachments {
21258    fn typename() -> &'static str {
21259        "type.googleapis.com/google.cloud.networkconnectivity.v1.LinkedInterconnectAttachments"
21260    }
21261}
21262
21263#[doc(hidden)]
21264impl<'de> serde::de::Deserialize<'de> for LinkedInterconnectAttachments {
21265    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21266    where
21267        D: serde::Deserializer<'de>,
21268    {
21269        #[allow(non_camel_case_types)]
21270        #[doc(hidden)]
21271        #[derive(PartialEq, Eq, Hash)]
21272        enum __FieldTag {
21273            __uris,
21274            __site_to_site_data_transfer,
21275            __vpc_network,
21276            __include_import_ranges,
21277            Unknown(std::string::String),
21278        }
21279        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21280            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21281            where
21282                D: serde::Deserializer<'de>,
21283            {
21284                struct Visitor;
21285                impl<'de> serde::de::Visitor<'de> for Visitor {
21286                    type Value = __FieldTag;
21287                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21288                        formatter.write_str("a field name for LinkedInterconnectAttachments")
21289                    }
21290                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21291                    where
21292                        E: serde::de::Error,
21293                    {
21294                        use std::result::Result::Ok;
21295                        use std::string::ToString;
21296                        match value {
21297                            "uris" => Ok(__FieldTag::__uris),
21298                            "siteToSiteDataTransfer" => {
21299                                Ok(__FieldTag::__site_to_site_data_transfer)
21300                            }
21301                            "site_to_site_data_transfer" => {
21302                                Ok(__FieldTag::__site_to_site_data_transfer)
21303                            }
21304                            "vpcNetwork" => Ok(__FieldTag::__vpc_network),
21305                            "vpc_network" => Ok(__FieldTag::__vpc_network),
21306                            "includeImportRanges" => Ok(__FieldTag::__include_import_ranges),
21307                            "include_import_ranges" => Ok(__FieldTag::__include_import_ranges),
21308                            _ => Ok(__FieldTag::Unknown(value.to_string())),
21309                        }
21310                    }
21311                }
21312                deserializer.deserialize_identifier(Visitor)
21313            }
21314        }
21315        struct Visitor;
21316        impl<'de> serde::de::Visitor<'de> for Visitor {
21317            type Value = LinkedInterconnectAttachments;
21318            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21319                formatter.write_str("struct LinkedInterconnectAttachments")
21320            }
21321            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21322            where
21323                A: serde::de::MapAccess<'de>,
21324            {
21325                #[allow(unused_imports)]
21326                use serde::de::Error;
21327                use std::option::Option::Some;
21328                let mut fields = std::collections::HashSet::new();
21329                let mut result = Self::Value::new();
21330                while let Some(tag) = map.next_key::<__FieldTag>()? {
21331                    #[allow(clippy::match_single_binding)]
21332                    match tag {
21333                        __FieldTag::__uris => {
21334                            if !fields.insert(__FieldTag::__uris) {
21335                                return std::result::Result::Err(A::Error::duplicate_field(
21336                                    "multiple values for uris",
21337                                ));
21338                            }
21339                            result.uris = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
21340                        }
21341                        __FieldTag::__site_to_site_data_transfer => {
21342                            if !fields.insert(__FieldTag::__site_to_site_data_transfer) {
21343                                return std::result::Result::Err(A::Error::duplicate_field(
21344                                    "multiple values for site_to_site_data_transfer",
21345                                ));
21346                            }
21347                            result.site_to_site_data_transfer = map
21348                                .next_value::<std::option::Option<bool>>()?
21349                                .unwrap_or_default();
21350                        }
21351                        __FieldTag::__vpc_network => {
21352                            if !fields.insert(__FieldTag::__vpc_network) {
21353                                return std::result::Result::Err(A::Error::duplicate_field(
21354                                    "multiple values for vpc_network",
21355                                ));
21356                            }
21357                            result.vpc_network = map
21358                                .next_value::<std::option::Option<std::string::String>>()?
21359                                .unwrap_or_default();
21360                        }
21361                        __FieldTag::__include_import_ranges => {
21362                            if !fields.insert(__FieldTag::__include_import_ranges) {
21363                                return std::result::Result::Err(A::Error::duplicate_field(
21364                                    "multiple values for include_import_ranges",
21365                                ));
21366                            }
21367                            result.include_import_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
21368                        }
21369                        __FieldTag::Unknown(key) => {
21370                            let value = map.next_value::<serde_json::Value>()?;
21371                            result._unknown_fields.insert(key, value);
21372                        }
21373                    }
21374                }
21375                std::result::Result::Ok(result)
21376            }
21377        }
21378        deserializer.deserialize_any(Visitor)
21379    }
21380}
21381
21382#[doc(hidden)]
21383impl serde::ser::Serialize for LinkedInterconnectAttachments {
21384    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21385    where
21386        S: serde::ser::Serializer,
21387    {
21388        use serde::ser::SerializeMap;
21389        #[allow(unused_imports)]
21390        use std::option::Option::Some;
21391        let mut state = serializer.serialize_map(std::option::Option::None)?;
21392        if !self.uris.is_empty() {
21393            state.serialize_entry("uris", &self.uris)?;
21394        }
21395        if !wkt::internal::is_default(&self.site_to_site_data_transfer) {
21396            state.serialize_entry("siteToSiteDataTransfer", &self.site_to_site_data_transfer)?;
21397        }
21398        if !self.vpc_network.is_empty() {
21399            state.serialize_entry("vpcNetwork", &self.vpc_network)?;
21400        }
21401        if !self.include_import_ranges.is_empty() {
21402            state.serialize_entry("includeImportRanges", &self.include_import_ranges)?;
21403        }
21404        if !self._unknown_fields.is_empty() {
21405            for (key, value) in self._unknown_fields.iter() {
21406                state.serialize_entry(key, &value)?;
21407            }
21408        }
21409        state.end()
21410    }
21411}
21412
21413impl std::fmt::Debug for LinkedInterconnectAttachments {
21414    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21415        let mut debug_struct = f.debug_struct("LinkedInterconnectAttachments");
21416        debug_struct.field("uris", &self.uris);
21417        debug_struct.field(
21418            "site_to_site_data_transfer",
21419            &self.site_to_site_data_transfer,
21420        );
21421        debug_struct.field("vpc_network", &self.vpc_network);
21422        debug_struct.field("include_import_ranges", &self.include_import_ranges);
21423        if !self._unknown_fields.is_empty() {
21424            debug_struct.field("_unknown_fields", &self._unknown_fields);
21425        }
21426        debug_struct.finish()
21427    }
21428}
21429
21430/// A collection of router appliance instances. If you configure multiple router
21431/// appliance instances to receive data from the same set of sites outside of
21432/// Google Cloud, we recommend that you associate those instances with the same
21433/// spoke.
21434#[derive(Clone, Default, PartialEq)]
21435#[non_exhaustive]
21436pub struct LinkedRouterApplianceInstances {
21437    /// The list of router appliance instances.
21438    pub instances: std::vec::Vec<crate::model::RouterApplianceInstance>,
21439
21440    /// A value that controls whether site-to-site data transfer is enabled for
21441    /// these resources. Data transfer is available only in [supported
21442    /// locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations).
21443    pub site_to_site_data_transfer: bool,
21444
21445    /// Output only. The VPC network where these router appliance instances are
21446    /// located.
21447    pub vpc_network: std::string::String,
21448
21449    /// Optional. IP ranges allowed to be included during import from hub (does not
21450    /// control transit connectivity). The only allowed value for now is
21451    /// "ALL_IPV4_RANGES".
21452    pub include_import_ranges: std::vec::Vec<std::string::String>,
21453
21454    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21455}
21456
21457impl LinkedRouterApplianceInstances {
21458    pub fn new() -> Self {
21459        std::default::Default::default()
21460    }
21461
21462    /// Sets the value of [instances][crate::model::LinkedRouterApplianceInstances::instances].
21463    pub fn set_instances<T, V>(mut self, v: T) -> Self
21464    where
21465        T: std::iter::IntoIterator<Item = V>,
21466        V: std::convert::Into<crate::model::RouterApplianceInstance>,
21467    {
21468        use std::iter::Iterator;
21469        self.instances = v.into_iter().map(|i| i.into()).collect();
21470        self
21471    }
21472
21473    /// Sets the value of [site_to_site_data_transfer][crate::model::LinkedRouterApplianceInstances::site_to_site_data_transfer].
21474    pub fn set_site_to_site_data_transfer<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21475        self.site_to_site_data_transfer = v.into();
21476        self
21477    }
21478
21479    /// Sets the value of [vpc_network][crate::model::LinkedRouterApplianceInstances::vpc_network].
21480    pub fn set_vpc_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21481        self.vpc_network = v.into();
21482        self
21483    }
21484
21485    /// Sets the value of [include_import_ranges][crate::model::LinkedRouterApplianceInstances::include_import_ranges].
21486    pub fn set_include_import_ranges<T, V>(mut self, v: T) -> Self
21487    where
21488        T: std::iter::IntoIterator<Item = V>,
21489        V: std::convert::Into<std::string::String>,
21490    {
21491        use std::iter::Iterator;
21492        self.include_import_ranges = v.into_iter().map(|i| i.into()).collect();
21493        self
21494    }
21495}
21496
21497impl wkt::message::Message for LinkedRouterApplianceInstances {
21498    fn typename() -> &'static str {
21499        "type.googleapis.com/google.cloud.networkconnectivity.v1.LinkedRouterApplianceInstances"
21500    }
21501}
21502
21503#[doc(hidden)]
21504impl<'de> serde::de::Deserialize<'de> for LinkedRouterApplianceInstances {
21505    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21506    where
21507        D: serde::Deserializer<'de>,
21508    {
21509        #[allow(non_camel_case_types)]
21510        #[doc(hidden)]
21511        #[derive(PartialEq, Eq, Hash)]
21512        enum __FieldTag {
21513            __instances,
21514            __site_to_site_data_transfer,
21515            __vpc_network,
21516            __include_import_ranges,
21517            Unknown(std::string::String),
21518        }
21519        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21520            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21521            where
21522                D: serde::Deserializer<'de>,
21523            {
21524                struct Visitor;
21525                impl<'de> serde::de::Visitor<'de> for Visitor {
21526                    type Value = __FieldTag;
21527                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21528                        formatter.write_str("a field name for LinkedRouterApplianceInstances")
21529                    }
21530                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21531                    where
21532                        E: serde::de::Error,
21533                    {
21534                        use std::result::Result::Ok;
21535                        use std::string::ToString;
21536                        match value {
21537                            "instances" => Ok(__FieldTag::__instances),
21538                            "siteToSiteDataTransfer" => {
21539                                Ok(__FieldTag::__site_to_site_data_transfer)
21540                            }
21541                            "site_to_site_data_transfer" => {
21542                                Ok(__FieldTag::__site_to_site_data_transfer)
21543                            }
21544                            "vpcNetwork" => Ok(__FieldTag::__vpc_network),
21545                            "vpc_network" => Ok(__FieldTag::__vpc_network),
21546                            "includeImportRanges" => Ok(__FieldTag::__include_import_ranges),
21547                            "include_import_ranges" => Ok(__FieldTag::__include_import_ranges),
21548                            _ => Ok(__FieldTag::Unknown(value.to_string())),
21549                        }
21550                    }
21551                }
21552                deserializer.deserialize_identifier(Visitor)
21553            }
21554        }
21555        struct Visitor;
21556        impl<'de> serde::de::Visitor<'de> for Visitor {
21557            type Value = LinkedRouterApplianceInstances;
21558            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21559                formatter.write_str("struct LinkedRouterApplianceInstances")
21560            }
21561            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
21562            where
21563                A: serde::de::MapAccess<'de>,
21564            {
21565                #[allow(unused_imports)]
21566                use serde::de::Error;
21567                use std::option::Option::Some;
21568                let mut fields = std::collections::HashSet::new();
21569                let mut result = Self::Value::new();
21570                while let Some(tag) = map.next_key::<__FieldTag>()? {
21571                    #[allow(clippy::match_single_binding)]
21572                    match tag {
21573                        __FieldTag::__instances => {
21574                            if !fields.insert(__FieldTag::__instances) {
21575                                return std::result::Result::Err(A::Error::duplicate_field(
21576                                    "multiple values for instances",
21577                                ));
21578                            }
21579                            result.instances = map
21580                                .next_value::<std::option::Option<
21581                                    std::vec::Vec<crate::model::RouterApplianceInstance>,
21582                                >>()?
21583                                .unwrap_or_default();
21584                        }
21585                        __FieldTag::__site_to_site_data_transfer => {
21586                            if !fields.insert(__FieldTag::__site_to_site_data_transfer) {
21587                                return std::result::Result::Err(A::Error::duplicate_field(
21588                                    "multiple values for site_to_site_data_transfer",
21589                                ));
21590                            }
21591                            result.site_to_site_data_transfer = map
21592                                .next_value::<std::option::Option<bool>>()?
21593                                .unwrap_or_default();
21594                        }
21595                        __FieldTag::__vpc_network => {
21596                            if !fields.insert(__FieldTag::__vpc_network) {
21597                                return std::result::Result::Err(A::Error::duplicate_field(
21598                                    "multiple values for vpc_network",
21599                                ));
21600                            }
21601                            result.vpc_network = map
21602                                .next_value::<std::option::Option<std::string::String>>()?
21603                                .unwrap_or_default();
21604                        }
21605                        __FieldTag::__include_import_ranges => {
21606                            if !fields.insert(__FieldTag::__include_import_ranges) {
21607                                return std::result::Result::Err(A::Error::duplicate_field(
21608                                    "multiple values for include_import_ranges",
21609                                ));
21610                            }
21611                            result.include_import_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
21612                        }
21613                        __FieldTag::Unknown(key) => {
21614                            let value = map.next_value::<serde_json::Value>()?;
21615                            result._unknown_fields.insert(key, value);
21616                        }
21617                    }
21618                }
21619                std::result::Result::Ok(result)
21620            }
21621        }
21622        deserializer.deserialize_any(Visitor)
21623    }
21624}
21625
21626#[doc(hidden)]
21627impl serde::ser::Serialize for LinkedRouterApplianceInstances {
21628    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21629    where
21630        S: serde::ser::Serializer,
21631    {
21632        use serde::ser::SerializeMap;
21633        #[allow(unused_imports)]
21634        use std::option::Option::Some;
21635        let mut state = serializer.serialize_map(std::option::Option::None)?;
21636        if !self.instances.is_empty() {
21637            state.serialize_entry("instances", &self.instances)?;
21638        }
21639        if !wkt::internal::is_default(&self.site_to_site_data_transfer) {
21640            state.serialize_entry("siteToSiteDataTransfer", &self.site_to_site_data_transfer)?;
21641        }
21642        if !self.vpc_network.is_empty() {
21643            state.serialize_entry("vpcNetwork", &self.vpc_network)?;
21644        }
21645        if !self.include_import_ranges.is_empty() {
21646            state.serialize_entry("includeImportRanges", &self.include_import_ranges)?;
21647        }
21648        if !self._unknown_fields.is_empty() {
21649            for (key, value) in self._unknown_fields.iter() {
21650                state.serialize_entry(key, &value)?;
21651            }
21652        }
21653        state.end()
21654    }
21655}
21656
21657impl std::fmt::Debug for LinkedRouterApplianceInstances {
21658    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21659        let mut debug_struct = f.debug_struct("LinkedRouterApplianceInstances");
21660        debug_struct.field("instances", &self.instances);
21661        debug_struct.field(
21662            "site_to_site_data_transfer",
21663            &self.site_to_site_data_transfer,
21664        );
21665        debug_struct.field("vpc_network", &self.vpc_network);
21666        debug_struct.field("include_import_ranges", &self.include_import_ranges);
21667        if !self._unknown_fields.is_empty() {
21668            debug_struct.field("_unknown_fields", &self._unknown_fields);
21669        }
21670        debug_struct.finish()
21671    }
21672}
21673
21674/// An existing VPC network.
21675#[derive(Clone, Default, PartialEq)]
21676#[non_exhaustive]
21677pub struct LinkedVpcNetwork {
21678    /// Required. The URI of the VPC network resource.
21679    pub uri: std::string::String,
21680
21681    /// Optional. IP ranges encompassing the subnets to be excluded from peering.
21682    pub exclude_export_ranges: std::vec::Vec<std::string::String>,
21683
21684    /// Optional. IP ranges allowed to be included from peering.
21685    pub include_export_ranges: std::vec::Vec<std::string::String>,
21686
21687    /// Optional. The proposed include export IP ranges waiting for hub
21688    /// administration's approval.
21689    pub proposed_include_export_ranges: std::vec::Vec<std::string::String>,
21690
21691    /// Output only. The proposed exclude export IP ranges waiting for hub
21692    /// administration's approval.
21693    pub proposed_exclude_export_ranges: std::vec::Vec<std::string::String>,
21694
21695    /// Output only. The list of Producer VPC spokes that this VPC spoke is a
21696    /// service consumer VPC spoke for. These producer VPCs are connected through
21697    /// VPC peering to this spoke's backing VPC network. Because they are directly
21698    /// connected throuh VPC peering, NCC export filters do not apply between the
21699    /// service consumer VPC spoke and any of its producer VPC spokes. This VPC
21700    /// spoke cannot be deleted as long as any of these producer VPC spokes are
21701    /// connected to the NCC Hub.
21702    pub producer_vpc_spokes: std::vec::Vec<std::string::String>,
21703
21704    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21705}
21706
21707impl LinkedVpcNetwork {
21708    pub fn new() -> Self {
21709        std::default::Default::default()
21710    }
21711
21712    /// Sets the value of [uri][crate::model::LinkedVpcNetwork::uri].
21713    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21714        self.uri = v.into();
21715        self
21716    }
21717
21718    /// Sets the value of [exclude_export_ranges][crate::model::LinkedVpcNetwork::exclude_export_ranges].
21719    pub fn set_exclude_export_ranges<T, V>(mut self, v: T) -> Self
21720    where
21721        T: std::iter::IntoIterator<Item = V>,
21722        V: std::convert::Into<std::string::String>,
21723    {
21724        use std::iter::Iterator;
21725        self.exclude_export_ranges = v.into_iter().map(|i| i.into()).collect();
21726        self
21727    }
21728
21729    /// Sets the value of [include_export_ranges][crate::model::LinkedVpcNetwork::include_export_ranges].
21730    pub fn set_include_export_ranges<T, V>(mut self, v: T) -> Self
21731    where
21732        T: std::iter::IntoIterator<Item = V>,
21733        V: std::convert::Into<std::string::String>,
21734    {
21735        use std::iter::Iterator;
21736        self.include_export_ranges = v.into_iter().map(|i| i.into()).collect();
21737        self
21738    }
21739
21740    /// Sets the value of [proposed_include_export_ranges][crate::model::LinkedVpcNetwork::proposed_include_export_ranges].
21741    pub fn set_proposed_include_export_ranges<T, V>(mut self, v: T) -> Self
21742    where
21743        T: std::iter::IntoIterator<Item = V>,
21744        V: std::convert::Into<std::string::String>,
21745    {
21746        use std::iter::Iterator;
21747        self.proposed_include_export_ranges = v.into_iter().map(|i| i.into()).collect();
21748        self
21749    }
21750
21751    /// Sets the value of [proposed_exclude_export_ranges][crate::model::LinkedVpcNetwork::proposed_exclude_export_ranges].
21752    pub fn set_proposed_exclude_export_ranges<T, V>(mut self, v: T) -> Self
21753    where
21754        T: std::iter::IntoIterator<Item = V>,
21755        V: std::convert::Into<std::string::String>,
21756    {
21757        use std::iter::Iterator;
21758        self.proposed_exclude_export_ranges = v.into_iter().map(|i| i.into()).collect();
21759        self
21760    }
21761
21762    /// Sets the value of [producer_vpc_spokes][crate::model::LinkedVpcNetwork::producer_vpc_spokes].
21763    pub fn set_producer_vpc_spokes<T, V>(mut self, v: T) -> Self
21764    where
21765        T: std::iter::IntoIterator<Item = V>,
21766        V: std::convert::Into<std::string::String>,
21767    {
21768        use std::iter::Iterator;
21769        self.producer_vpc_spokes = v.into_iter().map(|i| i.into()).collect();
21770        self
21771    }
21772}
21773
21774impl wkt::message::Message for LinkedVpcNetwork {
21775    fn typename() -> &'static str {
21776        "type.googleapis.com/google.cloud.networkconnectivity.v1.LinkedVpcNetwork"
21777    }
21778}
21779
21780#[doc(hidden)]
21781impl<'de> serde::de::Deserialize<'de> for LinkedVpcNetwork {
21782    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21783    where
21784        D: serde::Deserializer<'de>,
21785    {
21786        #[allow(non_camel_case_types)]
21787        #[doc(hidden)]
21788        #[derive(PartialEq, Eq, Hash)]
21789        enum __FieldTag {
21790            __uri,
21791            __exclude_export_ranges,
21792            __include_export_ranges,
21793            __proposed_include_export_ranges,
21794            __proposed_exclude_export_ranges,
21795            __producer_vpc_spokes,
21796            Unknown(std::string::String),
21797        }
21798        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
21799            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21800            where
21801                D: serde::Deserializer<'de>,
21802            {
21803                struct Visitor;
21804                impl<'de> serde::de::Visitor<'de> for Visitor {
21805                    type Value = __FieldTag;
21806                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21807                        formatter.write_str("a field name for LinkedVpcNetwork")
21808                    }
21809                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
21810                    where
21811                        E: serde::de::Error,
21812                    {
21813                        use std::result::Result::Ok;
21814                        use std::string::ToString;
21815                        match value {
21816                            "uri" => Ok(__FieldTag::__uri),
21817                            "excludeExportRanges" => Ok(__FieldTag::__exclude_export_ranges),
21818                            "exclude_export_ranges" => Ok(__FieldTag::__exclude_export_ranges),
21819                            "includeExportRanges" => Ok(__FieldTag::__include_export_ranges),
21820                            "include_export_ranges" => Ok(__FieldTag::__include_export_ranges),
21821                            "proposedIncludeExportRanges" => {
21822                                Ok(__FieldTag::__proposed_include_export_ranges)
21823                            }
21824                            "proposed_include_export_ranges" => {
21825                                Ok(__FieldTag::__proposed_include_export_ranges)
21826                            }
21827                            "proposedExcludeExportRanges" => {
21828                                Ok(__FieldTag::__proposed_exclude_export_ranges)
21829                            }
21830                            "proposed_exclude_export_ranges" => {
21831                                Ok(__FieldTag::__proposed_exclude_export_ranges)
21832                            }
21833                            "producerVpcSpokes" => Ok(__FieldTag::__producer_vpc_spokes),
21834                            "producer_vpc_spokes" => Ok(__FieldTag::__producer_vpc_spokes),
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 = LinkedVpcNetwork;
21845            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
21846                formatter.write_str("struct LinkedVpcNetwork")
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::__exclude_export_ranges => {
21871                            if !fields.insert(__FieldTag::__exclude_export_ranges) {
21872                                return std::result::Result::Err(A::Error::duplicate_field(
21873                                    "multiple values for exclude_export_ranges",
21874                                ));
21875                            }
21876                            result.exclude_export_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
21877                        }
21878                        __FieldTag::__include_export_ranges => {
21879                            if !fields.insert(__FieldTag::__include_export_ranges) {
21880                                return std::result::Result::Err(A::Error::duplicate_field(
21881                                    "multiple values for include_export_ranges",
21882                                ));
21883                            }
21884                            result.include_export_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
21885                        }
21886                        __FieldTag::__proposed_include_export_ranges => {
21887                            if !fields.insert(__FieldTag::__proposed_include_export_ranges) {
21888                                return std::result::Result::Err(A::Error::duplicate_field(
21889                                    "multiple values for proposed_include_export_ranges",
21890                                ));
21891                            }
21892                            result.proposed_include_export_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
21893                        }
21894                        __FieldTag::__proposed_exclude_export_ranges => {
21895                            if !fields.insert(__FieldTag::__proposed_exclude_export_ranges) {
21896                                return std::result::Result::Err(A::Error::duplicate_field(
21897                                    "multiple values for proposed_exclude_export_ranges",
21898                                ));
21899                            }
21900                            result.proposed_exclude_export_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
21901                        }
21902                        __FieldTag::__producer_vpc_spokes => {
21903                            if !fields.insert(__FieldTag::__producer_vpc_spokes) {
21904                                return std::result::Result::Err(A::Error::duplicate_field(
21905                                    "multiple values for producer_vpc_spokes",
21906                                ));
21907                            }
21908                            result.producer_vpc_spokes = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
21909                        }
21910                        __FieldTag::Unknown(key) => {
21911                            let value = map.next_value::<serde_json::Value>()?;
21912                            result._unknown_fields.insert(key, value);
21913                        }
21914                    }
21915                }
21916                std::result::Result::Ok(result)
21917            }
21918        }
21919        deserializer.deserialize_any(Visitor)
21920    }
21921}
21922
21923#[doc(hidden)]
21924impl serde::ser::Serialize for LinkedVpcNetwork {
21925    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21926    where
21927        S: serde::ser::Serializer,
21928    {
21929        use serde::ser::SerializeMap;
21930        #[allow(unused_imports)]
21931        use std::option::Option::Some;
21932        let mut state = serializer.serialize_map(std::option::Option::None)?;
21933        if !self.uri.is_empty() {
21934            state.serialize_entry("uri", &self.uri)?;
21935        }
21936        if !self.exclude_export_ranges.is_empty() {
21937            state.serialize_entry("excludeExportRanges", &self.exclude_export_ranges)?;
21938        }
21939        if !self.include_export_ranges.is_empty() {
21940            state.serialize_entry("includeExportRanges", &self.include_export_ranges)?;
21941        }
21942        if !self.proposed_include_export_ranges.is_empty() {
21943            state.serialize_entry(
21944                "proposedIncludeExportRanges",
21945                &self.proposed_include_export_ranges,
21946            )?;
21947        }
21948        if !self.proposed_exclude_export_ranges.is_empty() {
21949            state.serialize_entry(
21950                "proposedExcludeExportRanges",
21951                &self.proposed_exclude_export_ranges,
21952            )?;
21953        }
21954        if !self.producer_vpc_spokes.is_empty() {
21955            state.serialize_entry("producerVpcSpokes", &self.producer_vpc_spokes)?;
21956        }
21957        if !self._unknown_fields.is_empty() {
21958            for (key, value) in self._unknown_fields.iter() {
21959                state.serialize_entry(key, &value)?;
21960            }
21961        }
21962        state.end()
21963    }
21964}
21965
21966impl std::fmt::Debug for LinkedVpcNetwork {
21967    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21968        let mut debug_struct = f.debug_struct("LinkedVpcNetwork");
21969        debug_struct.field("uri", &self.uri);
21970        debug_struct.field("exclude_export_ranges", &self.exclude_export_ranges);
21971        debug_struct.field("include_export_ranges", &self.include_export_ranges);
21972        debug_struct.field(
21973            "proposed_include_export_ranges",
21974            &self.proposed_include_export_ranges,
21975        );
21976        debug_struct.field(
21977            "proposed_exclude_export_ranges",
21978            &self.proposed_exclude_export_ranges,
21979        );
21980        debug_struct.field("producer_vpc_spokes", &self.producer_vpc_spokes);
21981        if !self._unknown_fields.is_empty() {
21982            debug_struct.field("_unknown_fields", &self._unknown_fields);
21983        }
21984        debug_struct.finish()
21985    }
21986}
21987
21988#[derive(Clone, Default, PartialEq)]
21989#[non_exhaustive]
21990pub struct LinkedProducerVpcNetwork {
21991    /// Immutable. The URI of the Service Consumer VPC that the Producer VPC is
21992    /// peered with.
21993    pub network: std::string::String,
21994
21995    /// Output only. The Service Consumer Network spoke.
21996    pub service_consumer_vpc_spoke: std::string::String,
21997
21998    /// Immutable. The name of the VPC peering between the Service Consumer VPC and
21999    /// the Producer VPC (defined in the Tenant project) which is added to the NCC
22000    /// hub. This peering must be in ACTIVE state.
22001    pub peering: std::string::String,
22002
22003    /// Output only. The URI of the Producer VPC.
22004    pub producer_network: std::string::String,
22005
22006    /// Optional. IP ranges encompassing the subnets to be excluded from peering.
22007    pub exclude_export_ranges: std::vec::Vec<std::string::String>,
22008
22009    /// Optional. IP ranges allowed to be included from peering.
22010    pub include_export_ranges: std::vec::Vec<std::string::String>,
22011
22012    /// Optional. The proposed include export IP ranges waiting for hub
22013    /// administration's approval.
22014    pub proposed_include_export_ranges: std::vec::Vec<std::string::String>,
22015
22016    /// Output only. The proposed exclude export IP ranges waiting for hub
22017    /// administration's approval.
22018    pub proposed_exclude_export_ranges: std::vec::Vec<std::string::String>,
22019
22020    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22021}
22022
22023impl LinkedProducerVpcNetwork {
22024    pub fn new() -> Self {
22025        std::default::Default::default()
22026    }
22027
22028    /// Sets the value of [network][crate::model::LinkedProducerVpcNetwork::network].
22029    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22030        self.network = v.into();
22031        self
22032    }
22033
22034    /// Sets the value of [service_consumer_vpc_spoke][crate::model::LinkedProducerVpcNetwork::service_consumer_vpc_spoke].
22035    pub fn set_service_consumer_vpc_spoke<T: std::convert::Into<std::string::String>>(
22036        mut self,
22037        v: T,
22038    ) -> Self {
22039        self.service_consumer_vpc_spoke = v.into();
22040        self
22041    }
22042
22043    /// Sets the value of [peering][crate::model::LinkedProducerVpcNetwork::peering].
22044    pub fn set_peering<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22045        self.peering = v.into();
22046        self
22047    }
22048
22049    /// Sets the value of [producer_network][crate::model::LinkedProducerVpcNetwork::producer_network].
22050    pub fn set_producer_network<T: std::convert::Into<std::string::String>>(
22051        mut self,
22052        v: T,
22053    ) -> Self {
22054        self.producer_network = v.into();
22055        self
22056    }
22057
22058    /// Sets the value of [exclude_export_ranges][crate::model::LinkedProducerVpcNetwork::exclude_export_ranges].
22059    pub fn set_exclude_export_ranges<T, V>(mut self, v: T) -> Self
22060    where
22061        T: std::iter::IntoIterator<Item = V>,
22062        V: std::convert::Into<std::string::String>,
22063    {
22064        use std::iter::Iterator;
22065        self.exclude_export_ranges = v.into_iter().map(|i| i.into()).collect();
22066        self
22067    }
22068
22069    /// Sets the value of [include_export_ranges][crate::model::LinkedProducerVpcNetwork::include_export_ranges].
22070    pub fn set_include_export_ranges<T, V>(mut self, v: T) -> Self
22071    where
22072        T: std::iter::IntoIterator<Item = V>,
22073        V: std::convert::Into<std::string::String>,
22074    {
22075        use std::iter::Iterator;
22076        self.include_export_ranges = v.into_iter().map(|i| i.into()).collect();
22077        self
22078    }
22079
22080    /// Sets the value of [proposed_include_export_ranges][crate::model::LinkedProducerVpcNetwork::proposed_include_export_ranges].
22081    pub fn set_proposed_include_export_ranges<T, V>(mut self, v: T) -> Self
22082    where
22083        T: std::iter::IntoIterator<Item = V>,
22084        V: std::convert::Into<std::string::String>,
22085    {
22086        use std::iter::Iterator;
22087        self.proposed_include_export_ranges = v.into_iter().map(|i| i.into()).collect();
22088        self
22089    }
22090
22091    /// Sets the value of [proposed_exclude_export_ranges][crate::model::LinkedProducerVpcNetwork::proposed_exclude_export_ranges].
22092    pub fn set_proposed_exclude_export_ranges<T, V>(mut self, v: T) -> Self
22093    where
22094        T: std::iter::IntoIterator<Item = V>,
22095        V: std::convert::Into<std::string::String>,
22096    {
22097        use std::iter::Iterator;
22098        self.proposed_exclude_export_ranges = v.into_iter().map(|i| i.into()).collect();
22099        self
22100    }
22101}
22102
22103impl wkt::message::Message for LinkedProducerVpcNetwork {
22104    fn typename() -> &'static str {
22105        "type.googleapis.com/google.cloud.networkconnectivity.v1.LinkedProducerVpcNetwork"
22106    }
22107}
22108
22109#[doc(hidden)]
22110impl<'de> serde::de::Deserialize<'de> for LinkedProducerVpcNetwork {
22111    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22112    where
22113        D: serde::Deserializer<'de>,
22114    {
22115        #[allow(non_camel_case_types)]
22116        #[doc(hidden)]
22117        #[derive(PartialEq, Eq, Hash)]
22118        enum __FieldTag {
22119            __network,
22120            __service_consumer_vpc_spoke,
22121            __peering,
22122            __producer_network,
22123            __exclude_export_ranges,
22124            __include_export_ranges,
22125            __proposed_include_export_ranges,
22126            __proposed_exclude_export_ranges,
22127            Unknown(std::string::String),
22128        }
22129        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22130            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22131            where
22132                D: serde::Deserializer<'de>,
22133            {
22134                struct Visitor;
22135                impl<'de> serde::de::Visitor<'de> for Visitor {
22136                    type Value = __FieldTag;
22137                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22138                        formatter.write_str("a field name for LinkedProducerVpcNetwork")
22139                    }
22140                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22141                    where
22142                        E: serde::de::Error,
22143                    {
22144                        use std::result::Result::Ok;
22145                        use std::string::ToString;
22146                        match value {
22147                            "network" => Ok(__FieldTag::__network),
22148                            "serviceConsumerVpcSpoke" => {
22149                                Ok(__FieldTag::__service_consumer_vpc_spoke)
22150                            }
22151                            "service_consumer_vpc_spoke" => {
22152                                Ok(__FieldTag::__service_consumer_vpc_spoke)
22153                            }
22154                            "peering" => Ok(__FieldTag::__peering),
22155                            "producerNetwork" => Ok(__FieldTag::__producer_network),
22156                            "producer_network" => Ok(__FieldTag::__producer_network),
22157                            "excludeExportRanges" => Ok(__FieldTag::__exclude_export_ranges),
22158                            "exclude_export_ranges" => Ok(__FieldTag::__exclude_export_ranges),
22159                            "includeExportRanges" => Ok(__FieldTag::__include_export_ranges),
22160                            "include_export_ranges" => Ok(__FieldTag::__include_export_ranges),
22161                            "proposedIncludeExportRanges" => {
22162                                Ok(__FieldTag::__proposed_include_export_ranges)
22163                            }
22164                            "proposed_include_export_ranges" => {
22165                                Ok(__FieldTag::__proposed_include_export_ranges)
22166                            }
22167                            "proposedExcludeExportRanges" => {
22168                                Ok(__FieldTag::__proposed_exclude_export_ranges)
22169                            }
22170                            "proposed_exclude_export_ranges" => {
22171                                Ok(__FieldTag::__proposed_exclude_export_ranges)
22172                            }
22173                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22174                        }
22175                    }
22176                }
22177                deserializer.deserialize_identifier(Visitor)
22178            }
22179        }
22180        struct Visitor;
22181        impl<'de> serde::de::Visitor<'de> for Visitor {
22182            type Value = LinkedProducerVpcNetwork;
22183            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22184                formatter.write_str("struct LinkedProducerVpcNetwork")
22185            }
22186            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22187            where
22188                A: serde::de::MapAccess<'de>,
22189            {
22190                #[allow(unused_imports)]
22191                use serde::de::Error;
22192                use std::option::Option::Some;
22193                let mut fields = std::collections::HashSet::new();
22194                let mut result = Self::Value::new();
22195                while let Some(tag) = map.next_key::<__FieldTag>()? {
22196                    #[allow(clippy::match_single_binding)]
22197                    match tag {
22198                        __FieldTag::__network => {
22199                            if !fields.insert(__FieldTag::__network) {
22200                                return std::result::Result::Err(A::Error::duplicate_field(
22201                                    "multiple values for network",
22202                                ));
22203                            }
22204                            result.network = map
22205                                .next_value::<std::option::Option<std::string::String>>()?
22206                                .unwrap_or_default();
22207                        }
22208                        __FieldTag::__service_consumer_vpc_spoke => {
22209                            if !fields.insert(__FieldTag::__service_consumer_vpc_spoke) {
22210                                return std::result::Result::Err(A::Error::duplicate_field(
22211                                    "multiple values for service_consumer_vpc_spoke",
22212                                ));
22213                            }
22214                            result.service_consumer_vpc_spoke = map
22215                                .next_value::<std::option::Option<std::string::String>>()?
22216                                .unwrap_or_default();
22217                        }
22218                        __FieldTag::__peering => {
22219                            if !fields.insert(__FieldTag::__peering) {
22220                                return std::result::Result::Err(A::Error::duplicate_field(
22221                                    "multiple values for peering",
22222                                ));
22223                            }
22224                            result.peering = map
22225                                .next_value::<std::option::Option<std::string::String>>()?
22226                                .unwrap_or_default();
22227                        }
22228                        __FieldTag::__producer_network => {
22229                            if !fields.insert(__FieldTag::__producer_network) {
22230                                return std::result::Result::Err(A::Error::duplicate_field(
22231                                    "multiple values for producer_network",
22232                                ));
22233                            }
22234                            result.producer_network = map
22235                                .next_value::<std::option::Option<std::string::String>>()?
22236                                .unwrap_or_default();
22237                        }
22238                        __FieldTag::__exclude_export_ranges => {
22239                            if !fields.insert(__FieldTag::__exclude_export_ranges) {
22240                                return std::result::Result::Err(A::Error::duplicate_field(
22241                                    "multiple values for exclude_export_ranges",
22242                                ));
22243                            }
22244                            result.exclude_export_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
22245                        }
22246                        __FieldTag::__include_export_ranges => {
22247                            if !fields.insert(__FieldTag::__include_export_ranges) {
22248                                return std::result::Result::Err(A::Error::duplicate_field(
22249                                    "multiple values for include_export_ranges",
22250                                ));
22251                            }
22252                            result.include_export_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
22253                        }
22254                        __FieldTag::__proposed_include_export_ranges => {
22255                            if !fields.insert(__FieldTag::__proposed_include_export_ranges) {
22256                                return std::result::Result::Err(A::Error::duplicate_field(
22257                                    "multiple values for proposed_include_export_ranges",
22258                                ));
22259                            }
22260                            result.proposed_include_export_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
22261                        }
22262                        __FieldTag::__proposed_exclude_export_ranges => {
22263                            if !fields.insert(__FieldTag::__proposed_exclude_export_ranges) {
22264                                return std::result::Result::Err(A::Error::duplicate_field(
22265                                    "multiple values for proposed_exclude_export_ranges",
22266                                ));
22267                            }
22268                            result.proposed_exclude_export_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
22269                        }
22270                        __FieldTag::Unknown(key) => {
22271                            let value = map.next_value::<serde_json::Value>()?;
22272                            result._unknown_fields.insert(key, value);
22273                        }
22274                    }
22275                }
22276                std::result::Result::Ok(result)
22277            }
22278        }
22279        deserializer.deserialize_any(Visitor)
22280    }
22281}
22282
22283#[doc(hidden)]
22284impl serde::ser::Serialize for LinkedProducerVpcNetwork {
22285    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22286    where
22287        S: serde::ser::Serializer,
22288    {
22289        use serde::ser::SerializeMap;
22290        #[allow(unused_imports)]
22291        use std::option::Option::Some;
22292        let mut state = serializer.serialize_map(std::option::Option::None)?;
22293        if !self.network.is_empty() {
22294            state.serialize_entry("network", &self.network)?;
22295        }
22296        if !self.service_consumer_vpc_spoke.is_empty() {
22297            state.serialize_entry("serviceConsumerVpcSpoke", &self.service_consumer_vpc_spoke)?;
22298        }
22299        if !self.peering.is_empty() {
22300            state.serialize_entry("peering", &self.peering)?;
22301        }
22302        if !self.producer_network.is_empty() {
22303            state.serialize_entry("producerNetwork", &self.producer_network)?;
22304        }
22305        if !self.exclude_export_ranges.is_empty() {
22306            state.serialize_entry("excludeExportRanges", &self.exclude_export_ranges)?;
22307        }
22308        if !self.include_export_ranges.is_empty() {
22309            state.serialize_entry("includeExportRanges", &self.include_export_ranges)?;
22310        }
22311        if !self.proposed_include_export_ranges.is_empty() {
22312            state.serialize_entry(
22313                "proposedIncludeExportRanges",
22314                &self.proposed_include_export_ranges,
22315            )?;
22316        }
22317        if !self.proposed_exclude_export_ranges.is_empty() {
22318            state.serialize_entry(
22319                "proposedExcludeExportRanges",
22320                &self.proposed_exclude_export_ranges,
22321            )?;
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
22332impl std::fmt::Debug for LinkedProducerVpcNetwork {
22333    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22334        let mut debug_struct = f.debug_struct("LinkedProducerVpcNetwork");
22335        debug_struct.field("network", &self.network);
22336        debug_struct.field(
22337            "service_consumer_vpc_spoke",
22338            &self.service_consumer_vpc_spoke,
22339        );
22340        debug_struct.field("peering", &self.peering);
22341        debug_struct.field("producer_network", &self.producer_network);
22342        debug_struct.field("exclude_export_ranges", &self.exclude_export_ranges);
22343        debug_struct.field("include_export_ranges", &self.include_export_ranges);
22344        debug_struct.field(
22345            "proposed_include_export_ranges",
22346            &self.proposed_include_export_ranges,
22347        );
22348        debug_struct.field(
22349            "proposed_exclude_export_ranges",
22350            &self.proposed_exclude_export_ranges,
22351        );
22352        if !self._unknown_fields.is_empty() {
22353            debug_struct.field("_unknown_fields", &self._unknown_fields);
22354        }
22355        debug_struct.finish()
22356    }
22357}
22358
22359/// A router appliance instance is a Compute Engine virtual machine (VM) instance
22360/// that acts as a BGP speaker. A router appliance instance is specified by the
22361/// URI of the VM and the internal IP address of one of the VM's network
22362/// interfaces.
22363#[derive(Clone, Default, PartialEq)]
22364#[non_exhaustive]
22365pub struct RouterApplianceInstance {
22366    /// The URI of the VM.
22367    pub virtual_machine: std::string::String,
22368
22369    /// The IP address on the VM to use for peering.
22370    pub ip_address: std::string::String,
22371
22372    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22373}
22374
22375impl RouterApplianceInstance {
22376    pub fn new() -> Self {
22377        std::default::Default::default()
22378    }
22379
22380    /// Sets the value of [virtual_machine][crate::model::RouterApplianceInstance::virtual_machine].
22381    pub fn set_virtual_machine<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22382        self.virtual_machine = v.into();
22383        self
22384    }
22385
22386    /// Sets the value of [ip_address][crate::model::RouterApplianceInstance::ip_address].
22387    pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22388        self.ip_address = v.into();
22389        self
22390    }
22391}
22392
22393impl wkt::message::Message for RouterApplianceInstance {
22394    fn typename() -> &'static str {
22395        "type.googleapis.com/google.cloud.networkconnectivity.v1.RouterApplianceInstance"
22396    }
22397}
22398
22399#[doc(hidden)]
22400impl<'de> serde::de::Deserialize<'de> for RouterApplianceInstance {
22401    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22402    where
22403        D: serde::Deserializer<'de>,
22404    {
22405        #[allow(non_camel_case_types)]
22406        #[doc(hidden)]
22407        #[derive(PartialEq, Eq, Hash)]
22408        enum __FieldTag {
22409            __virtual_machine,
22410            __ip_address,
22411            Unknown(std::string::String),
22412        }
22413        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22414            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22415            where
22416                D: serde::Deserializer<'de>,
22417            {
22418                struct Visitor;
22419                impl<'de> serde::de::Visitor<'de> for Visitor {
22420                    type Value = __FieldTag;
22421                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22422                        formatter.write_str("a field name for RouterApplianceInstance")
22423                    }
22424                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22425                    where
22426                        E: serde::de::Error,
22427                    {
22428                        use std::result::Result::Ok;
22429                        use std::string::ToString;
22430                        match value {
22431                            "virtualMachine" => Ok(__FieldTag::__virtual_machine),
22432                            "virtual_machine" => Ok(__FieldTag::__virtual_machine),
22433                            "ipAddress" => Ok(__FieldTag::__ip_address),
22434                            "ip_address" => Ok(__FieldTag::__ip_address),
22435                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22436                        }
22437                    }
22438                }
22439                deserializer.deserialize_identifier(Visitor)
22440            }
22441        }
22442        struct Visitor;
22443        impl<'de> serde::de::Visitor<'de> for Visitor {
22444            type Value = RouterApplianceInstance;
22445            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22446                formatter.write_str("struct RouterApplianceInstance")
22447            }
22448            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22449            where
22450                A: serde::de::MapAccess<'de>,
22451            {
22452                #[allow(unused_imports)]
22453                use serde::de::Error;
22454                use std::option::Option::Some;
22455                let mut fields = std::collections::HashSet::new();
22456                let mut result = Self::Value::new();
22457                while let Some(tag) = map.next_key::<__FieldTag>()? {
22458                    #[allow(clippy::match_single_binding)]
22459                    match tag {
22460                        __FieldTag::__virtual_machine => {
22461                            if !fields.insert(__FieldTag::__virtual_machine) {
22462                                return std::result::Result::Err(A::Error::duplicate_field(
22463                                    "multiple values for virtual_machine",
22464                                ));
22465                            }
22466                            result.virtual_machine = map
22467                                .next_value::<std::option::Option<std::string::String>>()?
22468                                .unwrap_or_default();
22469                        }
22470                        __FieldTag::__ip_address => {
22471                            if !fields.insert(__FieldTag::__ip_address) {
22472                                return std::result::Result::Err(A::Error::duplicate_field(
22473                                    "multiple values for ip_address",
22474                                ));
22475                            }
22476                            result.ip_address = map
22477                                .next_value::<std::option::Option<std::string::String>>()?
22478                                .unwrap_or_default();
22479                        }
22480                        __FieldTag::Unknown(key) => {
22481                            let value = map.next_value::<serde_json::Value>()?;
22482                            result._unknown_fields.insert(key, value);
22483                        }
22484                    }
22485                }
22486                std::result::Result::Ok(result)
22487            }
22488        }
22489        deserializer.deserialize_any(Visitor)
22490    }
22491}
22492
22493#[doc(hidden)]
22494impl serde::ser::Serialize for RouterApplianceInstance {
22495    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22496    where
22497        S: serde::ser::Serializer,
22498    {
22499        use serde::ser::SerializeMap;
22500        #[allow(unused_imports)]
22501        use std::option::Option::Some;
22502        let mut state = serializer.serialize_map(std::option::Option::None)?;
22503        if !self.virtual_machine.is_empty() {
22504            state.serialize_entry("virtualMachine", &self.virtual_machine)?;
22505        }
22506        if !self.ip_address.is_empty() {
22507            state.serialize_entry("ipAddress", &self.ip_address)?;
22508        }
22509        if !self._unknown_fields.is_empty() {
22510            for (key, value) in self._unknown_fields.iter() {
22511                state.serialize_entry(key, &value)?;
22512            }
22513        }
22514        state.end()
22515    }
22516}
22517
22518impl std::fmt::Debug for RouterApplianceInstance {
22519    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22520        let mut debug_struct = f.debug_struct("RouterApplianceInstance");
22521        debug_struct.field("virtual_machine", &self.virtual_machine);
22522        debug_struct.field("ip_address", &self.ip_address);
22523        if !self._unknown_fields.is_empty() {
22524            debug_struct.field("_unknown_fields", &self._unknown_fields);
22525        }
22526        debug_struct.finish()
22527    }
22528}
22529
22530/// Metadata about locations
22531#[derive(Clone, Default, PartialEq)]
22532#[non_exhaustive]
22533pub struct LocationMetadata {
22534    /// List of supported features
22535    pub location_features: std::vec::Vec<crate::model::LocationFeature>,
22536
22537    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22538}
22539
22540impl LocationMetadata {
22541    pub fn new() -> Self {
22542        std::default::Default::default()
22543    }
22544
22545    /// Sets the value of [location_features][crate::model::LocationMetadata::location_features].
22546    pub fn set_location_features<T, V>(mut self, v: T) -> Self
22547    where
22548        T: std::iter::IntoIterator<Item = V>,
22549        V: std::convert::Into<crate::model::LocationFeature>,
22550    {
22551        use std::iter::Iterator;
22552        self.location_features = v.into_iter().map(|i| i.into()).collect();
22553        self
22554    }
22555}
22556
22557impl wkt::message::Message for LocationMetadata {
22558    fn typename() -> &'static str {
22559        "type.googleapis.com/google.cloud.networkconnectivity.v1.LocationMetadata"
22560    }
22561}
22562
22563#[doc(hidden)]
22564impl<'de> serde::de::Deserialize<'de> for LocationMetadata {
22565    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22566    where
22567        D: serde::Deserializer<'de>,
22568    {
22569        #[allow(non_camel_case_types)]
22570        #[doc(hidden)]
22571        #[derive(PartialEq, Eq, Hash)]
22572        enum __FieldTag {
22573            __location_features,
22574            Unknown(std::string::String),
22575        }
22576        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22577            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22578            where
22579                D: serde::Deserializer<'de>,
22580            {
22581                struct Visitor;
22582                impl<'de> serde::de::Visitor<'de> for Visitor {
22583                    type Value = __FieldTag;
22584                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22585                        formatter.write_str("a field name for LocationMetadata")
22586                    }
22587                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22588                    where
22589                        E: serde::de::Error,
22590                    {
22591                        use std::result::Result::Ok;
22592                        use std::string::ToString;
22593                        match value {
22594                            "locationFeatures" => Ok(__FieldTag::__location_features),
22595                            "location_features" => Ok(__FieldTag::__location_features),
22596                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22597                        }
22598                    }
22599                }
22600                deserializer.deserialize_identifier(Visitor)
22601            }
22602        }
22603        struct Visitor;
22604        impl<'de> serde::de::Visitor<'de> for Visitor {
22605            type Value = LocationMetadata;
22606            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22607                formatter.write_str("struct LocationMetadata")
22608            }
22609            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22610            where
22611                A: serde::de::MapAccess<'de>,
22612            {
22613                #[allow(unused_imports)]
22614                use serde::de::Error;
22615                use std::option::Option::Some;
22616                let mut fields = std::collections::HashSet::new();
22617                let mut result = Self::Value::new();
22618                while let Some(tag) = map.next_key::<__FieldTag>()? {
22619                    #[allow(clippy::match_single_binding)]
22620                    match tag {
22621                        __FieldTag::__location_features => {
22622                            if !fields.insert(__FieldTag::__location_features) {
22623                                return std::result::Result::Err(A::Error::duplicate_field(
22624                                    "multiple values for location_features",
22625                                ));
22626                            }
22627                            result.location_features =
22628                                map.next_value::<std::option::Option<
22629                                    std::vec::Vec<crate::model::LocationFeature>,
22630                                >>()?
22631                                .unwrap_or_default();
22632                        }
22633                        __FieldTag::Unknown(key) => {
22634                            let value = map.next_value::<serde_json::Value>()?;
22635                            result._unknown_fields.insert(key, value);
22636                        }
22637                    }
22638                }
22639                std::result::Result::Ok(result)
22640            }
22641        }
22642        deserializer.deserialize_any(Visitor)
22643    }
22644}
22645
22646#[doc(hidden)]
22647impl serde::ser::Serialize for LocationMetadata {
22648    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22649    where
22650        S: serde::ser::Serializer,
22651    {
22652        use serde::ser::SerializeMap;
22653        #[allow(unused_imports)]
22654        use std::option::Option::Some;
22655        let mut state = serializer.serialize_map(std::option::Option::None)?;
22656        if !self.location_features.is_empty() {
22657            state.serialize_entry("locationFeatures", &self.location_features)?;
22658        }
22659        if !self._unknown_fields.is_empty() {
22660            for (key, value) in self._unknown_fields.iter() {
22661                state.serialize_entry(key, &value)?;
22662            }
22663        }
22664        state.end()
22665    }
22666}
22667
22668impl std::fmt::Debug for LocationMetadata {
22669    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22670        let mut debug_struct = f.debug_struct("LocationMetadata");
22671        debug_struct.field("location_features", &self.location_features);
22672        if !self._unknown_fields.is_empty() {
22673            debug_struct.field("_unknown_fields", &self._unknown_fields);
22674        }
22675        debug_struct.finish()
22676    }
22677}
22678
22679#[derive(Clone, Default, PartialEq)]
22680#[non_exhaustive]
22681pub struct NextHopVpcNetwork {
22682    /// The URI of the VPC network resource
22683    pub uri: std::string::String,
22684
22685    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22686}
22687
22688impl NextHopVpcNetwork {
22689    pub fn new() -> Self {
22690        std::default::Default::default()
22691    }
22692
22693    /// Sets the value of [uri][crate::model::NextHopVpcNetwork::uri].
22694    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22695        self.uri = v.into();
22696        self
22697    }
22698}
22699
22700impl wkt::message::Message for NextHopVpcNetwork {
22701    fn typename() -> &'static str {
22702        "type.googleapis.com/google.cloud.networkconnectivity.v1.NextHopVpcNetwork"
22703    }
22704}
22705
22706#[doc(hidden)]
22707impl<'de> serde::de::Deserialize<'de> for NextHopVpcNetwork {
22708    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22709    where
22710        D: serde::Deserializer<'de>,
22711    {
22712        #[allow(non_camel_case_types)]
22713        #[doc(hidden)]
22714        #[derive(PartialEq, Eq, Hash)]
22715        enum __FieldTag {
22716            __uri,
22717            Unknown(std::string::String),
22718        }
22719        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22720            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22721            where
22722                D: serde::Deserializer<'de>,
22723            {
22724                struct Visitor;
22725                impl<'de> serde::de::Visitor<'de> for Visitor {
22726                    type Value = __FieldTag;
22727                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22728                        formatter.write_str("a field name for NextHopVpcNetwork")
22729                    }
22730                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22731                    where
22732                        E: serde::de::Error,
22733                    {
22734                        use std::result::Result::Ok;
22735                        use std::string::ToString;
22736                        match value {
22737                            "uri" => Ok(__FieldTag::__uri),
22738                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22739                        }
22740                    }
22741                }
22742                deserializer.deserialize_identifier(Visitor)
22743            }
22744        }
22745        struct Visitor;
22746        impl<'de> serde::de::Visitor<'de> for Visitor {
22747            type Value = NextHopVpcNetwork;
22748            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22749                formatter.write_str("struct NextHopVpcNetwork")
22750            }
22751            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22752            where
22753                A: serde::de::MapAccess<'de>,
22754            {
22755                #[allow(unused_imports)]
22756                use serde::de::Error;
22757                use std::option::Option::Some;
22758                let mut fields = std::collections::HashSet::new();
22759                let mut result = Self::Value::new();
22760                while let Some(tag) = map.next_key::<__FieldTag>()? {
22761                    #[allow(clippy::match_single_binding)]
22762                    match tag {
22763                        __FieldTag::__uri => {
22764                            if !fields.insert(__FieldTag::__uri) {
22765                                return std::result::Result::Err(A::Error::duplicate_field(
22766                                    "multiple values for uri",
22767                                ));
22768                            }
22769                            result.uri = map
22770                                .next_value::<std::option::Option<std::string::String>>()?
22771                                .unwrap_or_default();
22772                        }
22773                        __FieldTag::Unknown(key) => {
22774                            let value = map.next_value::<serde_json::Value>()?;
22775                            result._unknown_fields.insert(key, value);
22776                        }
22777                    }
22778                }
22779                std::result::Result::Ok(result)
22780            }
22781        }
22782        deserializer.deserialize_any(Visitor)
22783    }
22784}
22785
22786#[doc(hidden)]
22787impl serde::ser::Serialize for NextHopVpcNetwork {
22788    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22789    where
22790        S: serde::ser::Serializer,
22791    {
22792        use serde::ser::SerializeMap;
22793        #[allow(unused_imports)]
22794        use std::option::Option::Some;
22795        let mut state = serializer.serialize_map(std::option::Option::None)?;
22796        if !self.uri.is_empty() {
22797            state.serialize_entry("uri", &self.uri)?;
22798        }
22799        if !self._unknown_fields.is_empty() {
22800            for (key, value) in self._unknown_fields.iter() {
22801                state.serialize_entry(key, &value)?;
22802            }
22803        }
22804        state.end()
22805    }
22806}
22807
22808impl std::fmt::Debug for NextHopVpcNetwork {
22809    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22810        let mut debug_struct = f.debug_struct("NextHopVpcNetwork");
22811        debug_struct.field("uri", &self.uri);
22812        if !self._unknown_fields.is_empty() {
22813            debug_struct.field("_unknown_fields", &self._unknown_fields);
22814        }
22815        debug_struct.finish()
22816    }
22817}
22818
22819/// A route next hop that leads to a VPN tunnel resource.
22820#[derive(Clone, Default, PartialEq)]
22821#[non_exhaustive]
22822pub struct NextHopVPNTunnel {
22823    /// The URI of the VPN tunnel resource.
22824    pub uri: std::string::String,
22825
22826    /// The VPC network where this VPN tunnel is located.
22827    pub vpc_network: std::string::String,
22828
22829    /// Indicates whether site-to-site data transfer is allowed for this VPN tunnel
22830    /// resource. Data transfer is available only in [supported
22831    /// locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations).
22832    pub site_to_site_data_transfer: bool,
22833
22834    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22835}
22836
22837impl NextHopVPNTunnel {
22838    pub fn new() -> Self {
22839        std::default::Default::default()
22840    }
22841
22842    /// Sets the value of [uri][crate::model::NextHopVPNTunnel::uri].
22843    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22844        self.uri = v.into();
22845        self
22846    }
22847
22848    /// Sets the value of [vpc_network][crate::model::NextHopVPNTunnel::vpc_network].
22849    pub fn set_vpc_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
22850        self.vpc_network = v.into();
22851        self
22852    }
22853
22854    /// Sets the value of [site_to_site_data_transfer][crate::model::NextHopVPNTunnel::site_to_site_data_transfer].
22855    pub fn set_site_to_site_data_transfer<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
22856        self.site_to_site_data_transfer = v.into();
22857        self
22858    }
22859}
22860
22861impl wkt::message::Message for NextHopVPNTunnel {
22862    fn typename() -> &'static str {
22863        "type.googleapis.com/google.cloud.networkconnectivity.v1.NextHopVPNTunnel"
22864    }
22865}
22866
22867#[doc(hidden)]
22868impl<'de> serde::de::Deserialize<'de> for NextHopVPNTunnel {
22869    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22870    where
22871        D: serde::Deserializer<'de>,
22872    {
22873        #[allow(non_camel_case_types)]
22874        #[doc(hidden)]
22875        #[derive(PartialEq, Eq, Hash)]
22876        enum __FieldTag {
22877            __uri,
22878            __vpc_network,
22879            __site_to_site_data_transfer,
22880            Unknown(std::string::String),
22881        }
22882        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
22883            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22884            where
22885                D: serde::Deserializer<'de>,
22886            {
22887                struct Visitor;
22888                impl<'de> serde::de::Visitor<'de> for Visitor {
22889                    type Value = __FieldTag;
22890                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22891                        formatter.write_str("a field name for NextHopVPNTunnel")
22892                    }
22893                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
22894                    where
22895                        E: serde::de::Error,
22896                    {
22897                        use std::result::Result::Ok;
22898                        use std::string::ToString;
22899                        match value {
22900                            "uri" => Ok(__FieldTag::__uri),
22901                            "vpcNetwork" => Ok(__FieldTag::__vpc_network),
22902                            "vpc_network" => Ok(__FieldTag::__vpc_network),
22903                            "siteToSiteDataTransfer" => {
22904                                Ok(__FieldTag::__site_to_site_data_transfer)
22905                            }
22906                            "site_to_site_data_transfer" => {
22907                                Ok(__FieldTag::__site_to_site_data_transfer)
22908                            }
22909                            _ => Ok(__FieldTag::Unknown(value.to_string())),
22910                        }
22911                    }
22912                }
22913                deserializer.deserialize_identifier(Visitor)
22914            }
22915        }
22916        struct Visitor;
22917        impl<'de> serde::de::Visitor<'de> for Visitor {
22918            type Value = NextHopVPNTunnel;
22919            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
22920                formatter.write_str("struct NextHopVPNTunnel")
22921            }
22922            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
22923            where
22924                A: serde::de::MapAccess<'de>,
22925            {
22926                #[allow(unused_imports)]
22927                use serde::de::Error;
22928                use std::option::Option::Some;
22929                let mut fields = std::collections::HashSet::new();
22930                let mut result = Self::Value::new();
22931                while let Some(tag) = map.next_key::<__FieldTag>()? {
22932                    #[allow(clippy::match_single_binding)]
22933                    match tag {
22934                        __FieldTag::__uri => {
22935                            if !fields.insert(__FieldTag::__uri) {
22936                                return std::result::Result::Err(A::Error::duplicate_field(
22937                                    "multiple values for uri",
22938                                ));
22939                            }
22940                            result.uri = map
22941                                .next_value::<std::option::Option<std::string::String>>()?
22942                                .unwrap_or_default();
22943                        }
22944                        __FieldTag::__vpc_network => {
22945                            if !fields.insert(__FieldTag::__vpc_network) {
22946                                return std::result::Result::Err(A::Error::duplicate_field(
22947                                    "multiple values for vpc_network",
22948                                ));
22949                            }
22950                            result.vpc_network = map
22951                                .next_value::<std::option::Option<std::string::String>>()?
22952                                .unwrap_or_default();
22953                        }
22954                        __FieldTag::__site_to_site_data_transfer => {
22955                            if !fields.insert(__FieldTag::__site_to_site_data_transfer) {
22956                                return std::result::Result::Err(A::Error::duplicate_field(
22957                                    "multiple values for site_to_site_data_transfer",
22958                                ));
22959                            }
22960                            result.site_to_site_data_transfer = map
22961                                .next_value::<std::option::Option<bool>>()?
22962                                .unwrap_or_default();
22963                        }
22964                        __FieldTag::Unknown(key) => {
22965                            let value = map.next_value::<serde_json::Value>()?;
22966                            result._unknown_fields.insert(key, value);
22967                        }
22968                    }
22969                }
22970                std::result::Result::Ok(result)
22971            }
22972        }
22973        deserializer.deserialize_any(Visitor)
22974    }
22975}
22976
22977#[doc(hidden)]
22978impl serde::ser::Serialize for NextHopVPNTunnel {
22979    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22980    where
22981        S: serde::ser::Serializer,
22982    {
22983        use serde::ser::SerializeMap;
22984        #[allow(unused_imports)]
22985        use std::option::Option::Some;
22986        let mut state = serializer.serialize_map(std::option::Option::None)?;
22987        if !self.uri.is_empty() {
22988            state.serialize_entry("uri", &self.uri)?;
22989        }
22990        if !self.vpc_network.is_empty() {
22991            state.serialize_entry("vpcNetwork", &self.vpc_network)?;
22992        }
22993        if !wkt::internal::is_default(&self.site_to_site_data_transfer) {
22994            state.serialize_entry("siteToSiteDataTransfer", &self.site_to_site_data_transfer)?;
22995        }
22996        if !self._unknown_fields.is_empty() {
22997            for (key, value) in self._unknown_fields.iter() {
22998                state.serialize_entry(key, &value)?;
22999            }
23000        }
23001        state.end()
23002    }
23003}
23004
23005impl std::fmt::Debug for NextHopVPNTunnel {
23006    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23007        let mut debug_struct = f.debug_struct("NextHopVPNTunnel");
23008        debug_struct.field("uri", &self.uri);
23009        debug_struct.field("vpc_network", &self.vpc_network);
23010        debug_struct.field(
23011            "site_to_site_data_transfer",
23012            &self.site_to_site_data_transfer,
23013        );
23014        if !self._unknown_fields.is_empty() {
23015            debug_struct.field("_unknown_fields", &self._unknown_fields);
23016        }
23017        debug_struct.finish()
23018    }
23019}
23020
23021/// A route next hop that leads to a Router appliance instance.
23022#[derive(Clone, Default, PartialEq)]
23023#[non_exhaustive]
23024pub struct NextHopRouterApplianceInstance {
23025    /// The URI of the Router appliance instance.
23026    pub uri: std::string::String,
23027
23028    /// The VPC network where this VM is located.
23029    pub vpc_network: std::string::String,
23030
23031    /// Indicates whether site-to-site data transfer is allowed for this Router
23032    /// appliance instance resource. Data transfer is available only in [supported
23033    /// locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations).
23034    pub site_to_site_data_transfer: bool,
23035
23036    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23037}
23038
23039impl NextHopRouterApplianceInstance {
23040    pub fn new() -> Self {
23041        std::default::Default::default()
23042    }
23043
23044    /// Sets the value of [uri][crate::model::NextHopRouterApplianceInstance::uri].
23045    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23046        self.uri = v.into();
23047        self
23048    }
23049
23050    /// Sets the value of [vpc_network][crate::model::NextHopRouterApplianceInstance::vpc_network].
23051    pub fn set_vpc_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23052        self.vpc_network = v.into();
23053        self
23054    }
23055
23056    /// Sets the value of [site_to_site_data_transfer][crate::model::NextHopRouterApplianceInstance::site_to_site_data_transfer].
23057    pub fn set_site_to_site_data_transfer<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
23058        self.site_to_site_data_transfer = v.into();
23059        self
23060    }
23061}
23062
23063impl wkt::message::Message for NextHopRouterApplianceInstance {
23064    fn typename() -> &'static str {
23065        "type.googleapis.com/google.cloud.networkconnectivity.v1.NextHopRouterApplianceInstance"
23066    }
23067}
23068
23069#[doc(hidden)]
23070impl<'de> serde::de::Deserialize<'de> for NextHopRouterApplianceInstance {
23071    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23072    where
23073        D: serde::Deserializer<'de>,
23074    {
23075        #[allow(non_camel_case_types)]
23076        #[doc(hidden)]
23077        #[derive(PartialEq, Eq, Hash)]
23078        enum __FieldTag {
23079            __uri,
23080            __vpc_network,
23081            __site_to_site_data_transfer,
23082            Unknown(std::string::String),
23083        }
23084        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
23085            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23086            where
23087                D: serde::Deserializer<'de>,
23088            {
23089                struct Visitor;
23090                impl<'de> serde::de::Visitor<'de> for Visitor {
23091                    type Value = __FieldTag;
23092                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23093                        formatter.write_str("a field name for NextHopRouterApplianceInstance")
23094                    }
23095                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
23096                    where
23097                        E: serde::de::Error,
23098                    {
23099                        use std::result::Result::Ok;
23100                        use std::string::ToString;
23101                        match value {
23102                            "uri" => Ok(__FieldTag::__uri),
23103                            "vpcNetwork" => Ok(__FieldTag::__vpc_network),
23104                            "vpc_network" => Ok(__FieldTag::__vpc_network),
23105                            "siteToSiteDataTransfer" => {
23106                                Ok(__FieldTag::__site_to_site_data_transfer)
23107                            }
23108                            "site_to_site_data_transfer" => {
23109                                Ok(__FieldTag::__site_to_site_data_transfer)
23110                            }
23111                            _ => Ok(__FieldTag::Unknown(value.to_string())),
23112                        }
23113                    }
23114                }
23115                deserializer.deserialize_identifier(Visitor)
23116            }
23117        }
23118        struct Visitor;
23119        impl<'de> serde::de::Visitor<'de> for Visitor {
23120            type Value = NextHopRouterApplianceInstance;
23121            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23122                formatter.write_str("struct NextHopRouterApplianceInstance")
23123            }
23124            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
23125            where
23126                A: serde::de::MapAccess<'de>,
23127            {
23128                #[allow(unused_imports)]
23129                use serde::de::Error;
23130                use std::option::Option::Some;
23131                let mut fields = std::collections::HashSet::new();
23132                let mut result = Self::Value::new();
23133                while let Some(tag) = map.next_key::<__FieldTag>()? {
23134                    #[allow(clippy::match_single_binding)]
23135                    match tag {
23136                        __FieldTag::__uri => {
23137                            if !fields.insert(__FieldTag::__uri) {
23138                                return std::result::Result::Err(A::Error::duplicate_field(
23139                                    "multiple values for uri",
23140                                ));
23141                            }
23142                            result.uri = map
23143                                .next_value::<std::option::Option<std::string::String>>()?
23144                                .unwrap_or_default();
23145                        }
23146                        __FieldTag::__vpc_network => {
23147                            if !fields.insert(__FieldTag::__vpc_network) {
23148                                return std::result::Result::Err(A::Error::duplicate_field(
23149                                    "multiple values for vpc_network",
23150                                ));
23151                            }
23152                            result.vpc_network = map
23153                                .next_value::<std::option::Option<std::string::String>>()?
23154                                .unwrap_or_default();
23155                        }
23156                        __FieldTag::__site_to_site_data_transfer => {
23157                            if !fields.insert(__FieldTag::__site_to_site_data_transfer) {
23158                                return std::result::Result::Err(A::Error::duplicate_field(
23159                                    "multiple values for site_to_site_data_transfer",
23160                                ));
23161                            }
23162                            result.site_to_site_data_transfer = map
23163                                .next_value::<std::option::Option<bool>>()?
23164                                .unwrap_or_default();
23165                        }
23166                        __FieldTag::Unknown(key) => {
23167                            let value = map.next_value::<serde_json::Value>()?;
23168                            result._unknown_fields.insert(key, value);
23169                        }
23170                    }
23171                }
23172                std::result::Result::Ok(result)
23173            }
23174        }
23175        deserializer.deserialize_any(Visitor)
23176    }
23177}
23178
23179#[doc(hidden)]
23180impl serde::ser::Serialize for NextHopRouterApplianceInstance {
23181    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23182    where
23183        S: serde::ser::Serializer,
23184    {
23185        use serde::ser::SerializeMap;
23186        #[allow(unused_imports)]
23187        use std::option::Option::Some;
23188        let mut state = serializer.serialize_map(std::option::Option::None)?;
23189        if !self.uri.is_empty() {
23190            state.serialize_entry("uri", &self.uri)?;
23191        }
23192        if !self.vpc_network.is_empty() {
23193            state.serialize_entry("vpcNetwork", &self.vpc_network)?;
23194        }
23195        if !wkt::internal::is_default(&self.site_to_site_data_transfer) {
23196            state.serialize_entry("siteToSiteDataTransfer", &self.site_to_site_data_transfer)?;
23197        }
23198        if !self._unknown_fields.is_empty() {
23199            for (key, value) in self._unknown_fields.iter() {
23200                state.serialize_entry(key, &value)?;
23201            }
23202        }
23203        state.end()
23204    }
23205}
23206
23207impl std::fmt::Debug for NextHopRouterApplianceInstance {
23208    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23209        let mut debug_struct = f.debug_struct("NextHopRouterApplianceInstance");
23210        debug_struct.field("uri", &self.uri);
23211        debug_struct.field("vpc_network", &self.vpc_network);
23212        debug_struct.field(
23213            "site_to_site_data_transfer",
23214            &self.site_to_site_data_transfer,
23215        );
23216        if !self._unknown_fields.is_empty() {
23217            debug_struct.field("_unknown_fields", &self._unknown_fields);
23218        }
23219        debug_struct.finish()
23220    }
23221}
23222
23223/// A route next hop that leads to an interconnect attachment resource.
23224#[derive(Clone, Default, PartialEq)]
23225#[non_exhaustive]
23226pub struct NextHopInterconnectAttachment {
23227    /// The URI of the interconnect attachment resource.
23228    pub uri: std::string::String,
23229
23230    /// The VPC network where this interconnect attachment is located.
23231    pub vpc_network: std::string::String,
23232
23233    /// Indicates whether site-to-site data transfer is allowed for this
23234    /// interconnect attachment resource. Data transfer is available only in
23235    /// [supported
23236    /// locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations).
23237    pub site_to_site_data_transfer: bool,
23238
23239    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23240}
23241
23242impl NextHopInterconnectAttachment {
23243    pub fn new() -> Self {
23244        std::default::Default::default()
23245    }
23246
23247    /// Sets the value of [uri][crate::model::NextHopInterconnectAttachment::uri].
23248    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23249        self.uri = v.into();
23250        self
23251    }
23252
23253    /// Sets the value of [vpc_network][crate::model::NextHopInterconnectAttachment::vpc_network].
23254    pub fn set_vpc_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23255        self.vpc_network = v.into();
23256        self
23257    }
23258
23259    /// Sets the value of [site_to_site_data_transfer][crate::model::NextHopInterconnectAttachment::site_to_site_data_transfer].
23260    pub fn set_site_to_site_data_transfer<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
23261        self.site_to_site_data_transfer = v.into();
23262        self
23263    }
23264}
23265
23266impl wkt::message::Message for NextHopInterconnectAttachment {
23267    fn typename() -> &'static str {
23268        "type.googleapis.com/google.cloud.networkconnectivity.v1.NextHopInterconnectAttachment"
23269    }
23270}
23271
23272#[doc(hidden)]
23273impl<'de> serde::de::Deserialize<'de> for NextHopInterconnectAttachment {
23274    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23275    where
23276        D: serde::Deserializer<'de>,
23277    {
23278        #[allow(non_camel_case_types)]
23279        #[doc(hidden)]
23280        #[derive(PartialEq, Eq, Hash)]
23281        enum __FieldTag {
23282            __uri,
23283            __vpc_network,
23284            __site_to_site_data_transfer,
23285            Unknown(std::string::String),
23286        }
23287        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
23288            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23289            where
23290                D: serde::Deserializer<'de>,
23291            {
23292                struct Visitor;
23293                impl<'de> serde::de::Visitor<'de> for Visitor {
23294                    type Value = __FieldTag;
23295                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23296                        formatter.write_str("a field name for NextHopInterconnectAttachment")
23297                    }
23298                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
23299                    where
23300                        E: serde::de::Error,
23301                    {
23302                        use std::result::Result::Ok;
23303                        use std::string::ToString;
23304                        match value {
23305                            "uri" => Ok(__FieldTag::__uri),
23306                            "vpcNetwork" => Ok(__FieldTag::__vpc_network),
23307                            "vpc_network" => Ok(__FieldTag::__vpc_network),
23308                            "siteToSiteDataTransfer" => {
23309                                Ok(__FieldTag::__site_to_site_data_transfer)
23310                            }
23311                            "site_to_site_data_transfer" => {
23312                                Ok(__FieldTag::__site_to_site_data_transfer)
23313                            }
23314                            _ => Ok(__FieldTag::Unknown(value.to_string())),
23315                        }
23316                    }
23317                }
23318                deserializer.deserialize_identifier(Visitor)
23319            }
23320        }
23321        struct Visitor;
23322        impl<'de> serde::de::Visitor<'de> for Visitor {
23323            type Value = NextHopInterconnectAttachment;
23324            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23325                formatter.write_str("struct NextHopInterconnectAttachment")
23326            }
23327            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
23328            where
23329                A: serde::de::MapAccess<'de>,
23330            {
23331                #[allow(unused_imports)]
23332                use serde::de::Error;
23333                use std::option::Option::Some;
23334                let mut fields = std::collections::HashSet::new();
23335                let mut result = Self::Value::new();
23336                while let Some(tag) = map.next_key::<__FieldTag>()? {
23337                    #[allow(clippy::match_single_binding)]
23338                    match tag {
23339                        __FieldTag::__uri => {
23340                            if !fields.insert(__FieldTag::__uri) {
23341                                return std::result::Result::Err(A::Error::duplicate_field(
23342                                    "multiple values for uri",
23343                                ));
23344                            }
23345                            result.uri = map
23346                                .next_value::<std::option::Option<std::string::String>>()?
23347                                .unwrap_or_default();
23348                        }
23349                        __FieldTag::__vpc_network => {
23350                            if !fields.insert(__FieldTag::__vpc_network) {
23351                                return std::result::Result::Err(A::Error::duplicate_field(
23352                                    "multiple values for vpc_network",
23353                                ));
23354                            }
23355                            result.vpc_network = map
23356                                .next_value::<std::option::Option<std::string::String>>()?
23357                                .unwrap_or_default();
23358                        }
23359                        __FieldTag::__site_to_site_data_transfer => {
23360                            if !fields.insert(__FieldTag::__site_to_site_data_transfer) {
23361                                return std::result::Result::Err(A::Error::duplicate_field(
23362                                    "multiple values for site_to_site_data_transfer",
23363                                ));
23364                            }
23365                            result.site_to_site_data_transfer = map
23366                                .next_value::<std::option::Option<bool>>()?
23367                                .unwrap_or_default();
23368                        }
23369                        __FieldTag::Unknown(key) => {
23370                            let value = map.next_value::<serde_json::Value>()?;
23371                            result._unknown_fields.insert(key, value);
23372                        }
23373                    }
23374                }
23375                std::result::Result::Ok(result)
23376            }
23377        }
23378        deserializer.deserialize_any(Visitor)
23379    }
23380}
23381
23382#[doc(hidden)]
23383impl serde::ser::Serialize for NextHopInterconnectAttachment {
23384    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23385    where
23386        S: serde::ser::Serializer,
23387    {
23388        use serde::ser::SerializeMap;
23389        #[allow(unused_imports)]
23390        use std::option::Option::Some;
23391        let mut state = serializer.serialize_map(std::option::Option::None)?;
23392        if !self.uri.is_empty() {
23393            state.serialize_entry("uri", &self.uri)?;
23394        }
23395        if !self.vpc_network.is_empty() {
23396            state.serialize_entry("vpcNetwork", &self.vpc_network)?;
23397        }
23398        if !wkt::internal::is_default(&self.site_to_site_data_transfer) {
23399            state.serialize_entry("siteToSiteDataTransfer", &self.site_to_site_data_transfer)?;
23400        }
23401        if !self._unknown_fields.is_empty() {
23402            for (key, value) in self._unknown_fields.iter() {
23403                state.serialize_entry(key, &value)?;
23404            }
23405        }
23406        state.end()
23407    }
23408}
23409
23410impl std::fmt::Debug for NextHopInterconnectAttachment {
23411    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23412        let mut debug_struct = f.debug_struct("NextHopInterconnectAttachment");
23413        debug_struct.field("uri", &self.uri);
23414        debug_struct.field("vpc_network", &self.vpc_network);
23415        debug_struct.field(
23416            "site_to_site_data_transfer",
23417            &self.site_to_site_data_transfer,
23418        );
23419        if !self._unknown_fields.is_empty() {
23420            debug_struct.field("_unknown_fields", &self._unknown_fields);
23421        }
23422        debug_struct.finish()
23423    }
23424}
23425
23426/// Summarizes information about the spokes associated with a hub.
23427/// The summary includes a count of spokes according to type
23428/// and according to state. If any spokes are inactive,
23429/// the summary also lists the reasons they are inactive,
23430/// including a count for each reason.
23431#[derive(Clone, Default, PartialEq)]
23432#[non_exhaustive]
23433pub struct SpokeSummary {
23434    /// Output only. Counts the number of spokes of each type that are
23435    /// associated with a specific hub.
23436    pub spoke_type_counts: std::vec::Vec<crate::model::spoke_summary::SpokeTypeCount>,
23437
23438    /// Output only. Counts the number of spokes that are in each state
23439    /// and associated with a given hub.
23440    pub spoke_state_counts: std::vec::Vec<crate::model::spoke_summary::SpokeStateCount>,
23441
23442    /// Output only. Counts the number of spokes that are inactive for each
23443    /// possible reason and associated with a given hub.
23444    pub spoke_state_reason_counts:
23445        std::vec::Vec<crate::model::spoke_summary::SpokeStateReasonCount>,
23446
23447    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23448}
23449
23450impl SpokeSummary {
23451    pub fn new() -> Self {
23452        std::default::Default::default()
23453    }
23454
23455    /// Sets the value of [spoke_type_counts][crate::model::SpokeSummary::spoke_type_counts].
23456    pub fn set_spoke_type_counts<T, V>(mut self, v: T) -> Self
23457    where
23458        T: std::iter::IntoIterator<Item = V>,
23459        V: std::convert::Into<crate::model::spoke_summary::SpokeTypeCount>,
23460    {
23461        use std::iter::Iterator;
23462        self.spoke_type_counts = v.into_iter().map(|i| i.into()).collect();
23463        self
23464    }
23465
23466    /// Sets the value of [spoke_state_counts][crate::model::SpokeSummary::spoke_state_counts].
23467    pub fn set_spoke_state_counts<T, V>(mut self, v: T) -> Self
23468    where
23469        T: std::iter::IntoIterator<Item = V>,
23470        V: std::convert::Into<crate::model::spoke_summary::SpokeStateCount>,
23471    {
23472        use std::iter::Iterator;
23473        self.spoke_state_counts = v.into_iter().map(|i| i.into()).collect();
23474        self
23475    }
23476
23477    /// Sets the value of [spoke_state_reason_counts][crate::model::SpokeSummary::spoke_state_reason_counts].
23478    pub fn set_spoke_state_reason_counts<T, V>(mut self, v: T) -> Self
23479    where
23480        T: std::iter::IntoIterator<Item = V>,
23481        V: std::convert::Into<crate::model::spoke_summary::SpokeStateReasonCount>,
23482    {
23483        use std::iter::Iterator;
23484        self.spoke_state_reason_counts = v.into_iter().map(|i| i.into()).collect();
23485        self
23486    }
23487}
23488
23489impl wkt::message::Message for SpokeSummary {
23490    fn typename() -> &'static str {
23491        "type.googleapis.com/google.cloud.networkconnectivity.v1.SpokeSummary"
23492    }
23493}
23494
23495#[doc(hidden)]
23496impl<'de> serde::de::Deserialize<'de> for SpokeSummary {
23497    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23498    where
23499        D: serde::Deserializer<'de>,
23500    {
23501        #[allow(non_camel_case_types)]
23502        #[doc(hidden)]
23503        #[derive(PartialEq, Eq, Hash)]
23504        enum __FieldTag {
23505            __spoke_type_counts,
23506            __spoke_state_counts,
23507            __spoke_state_reason_counts,
23508            Unknown(std::string::String),
23509        }
23510        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
23511            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23512            where
23513                D: serde::Deserializer<'de>,
23514            {
23515                struct Visitor;
23516                impl<'de> serde::de::Visitor<'de> for Visitor {
23517                    type Value = __FieldTag;
23518                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23519                        formatter.write_str("a field name for SpokeSummary")
23520                    }
23521                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
23522                    where
23523                        E: serde::de::Error,
23524                    {
23525                        use std::result::Result::Ok;
23526                        use std::string::ToString;
23527                        match value {
23528                            "spokeTypeCounts" => Ok(__FieldTag::__spoke_type_counts),
23529                            "spoke_type_counts" => Ok(__FieldTag::__spoke_type_counts),
23530                            "spokeStateCounts" => Ok(__FieldTag::__spoke_state_counts),
23531                            "spoke_state_counts" => Ok(__FieldTag::__spoke_state_counts),
23532                            "spokeStateReasonCounts" => Ok(__FieldTag::__spoke_state_reason_counts),
23533                            "spoke_state_reason_counts" => {
23534                                Ok(__FieldTag::__spoke_state_reason_counts)
23535                            }
23536                            _ => Ok(__FieldTag::Unknown(value.to_string())),
23537                        }
23538                    }
23539                }
23540                deserializer.deserialize_identifier(Visitor)
23541            }
23542        }
23543        struct Visitor;
23544        impl<'de> serde::de::Visitor<'de> for Visitor {
23545            type Value = SpokeSummary;
23546            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23547                formatter.write_str("struct SpokeSummary")
23548            }
23549            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
23550            where
23551                A: serde::de::MapAccess<'de>,
23552            {
23553                #[allow(unused_imports)]
23554                use serde::de::Error;
23555                use std::option::Option::Some;
23556                let mut fields = std::collections::HashSet::new();
23557                let mut result = Self::Value::new();
23558                while let Some(tag) = map.next_key::<__FieldTag>()? {
23559                    #[allow(clippy::match_single_binding)]
23560                    match tag {
23561                        __FieldTag::__spoke_type_counts => {
23562                            if !fields.insert(__FieldTag::__spoke_type_counts) {
23563                                return std::result::Result::Err(A::Error::duplicate_field(
23564                                    "multiple values for spoke_type_counts",
23565                                ));
23566                            }
23567                            result.spoke_type_counts = map
23568                                .next_value::<std::option::Option<
23569                                    std::vec::Vec<crate::model::spoke_summary::SpokeTypeCount>,
23570                                >>()?
23571                                .unwrap_or_default();
23572                        }
23573                        __FieldTag::__spoke_state_counts => {
23574                            if !fields.insert(__FieldTag::__spoke_state_counts) {
23575                                return std::result::Result::Err(A::Error::duplicate_field(
23576                                    "multiple values for spoke_state_counts",
23577                                ));
23578                            }
23579                            result.spoke_state_counts = map
23580                                .next_value::<std::option::Option<
23581                                    std::vec::Vec<crate::model::spoke_summary::SpokeStateCount>,
23582                                >>()?
23583                                .unwrap_or_default();
23584                        }
23585                        __FieldTag::__spoke_state_reason_counts => {
23586                            if !fields.insert(__FieldTag::__spoke_state_reason_counts) {
23587                                return std::result::Result::Err(A::Error::duplicate_field(
23588                                    "multiple values for spoke_state_reason_counts",
23589                                ));
23590                            }
23591                            result.spoke_state_reason_counts = map
23592                                .next_value::<std::option::Option<
23593                                    std::vec::Vec<
23594                                        crate::model::spoke_summary::SpokeStateReasonCount,
23595                                    >,
23596                                >>()?
23597                                .unwrap_or_default();
23598                        }
23599                        __FieldTag::Unknown(key) => {
23600                            let value = map.next_value::<serde_json::Value>()?;
23601                            result._unknown_fields.insert(key, value);
23602                        }
23603                    }
23604                }
23605                std::result::Result::Ok(result)
23606            }
23607        }
23608        deserializer.deserialize_any(Visitor)
23609    }
23610}
23611
23612#[doc(hidden)]
23613impl serde::ser::Serialize for SpokeSummary {
23614    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23615    where
23616        S: serde::ser::Serializer,
23617    {
23618        use serde::ser::SerializeMap;
23619        #[allow(unused_imports)]
23620        use std::option::Option::Some;
23621        let mut state = serializer.serialize_map(std::option::Option::None)?;
23622        if !self.spoke_type_counts.is_empty() {
23623            state.serialize_entry("spokeTypeCounts", &self.spoke_type_counts)?;
23624        }
23625        if !self.spoke_state_counts.is_empty() {
23626            state.serialize_entry("spokeStateCounts", &self.spoke_state_counts)?;
23627        }
23628        if !self.spoke_state_reason_counts.is_empty() {
23629            state.serialize_entry("spokeStateReasonCounts", &self.spoke_state_reason_counts)?;
23630        }
23631        if !self._unknown_fields.is_empty() {
23632            for (key, value) in self._unknown_fields.iter() {
23633                state.serialize_entry(key, &value)?;
23634            }
23635        }
23636        state.end()
23637    }
23638}
23639
23640impl std::fmt::Debug for SpokeSummary {
23641    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23642        let mut debug_struct = f.debug_struct("SpokeSummary");
23643        debug_struct.field("spoke_type_counts", &self.spoke_type_counts);
23644        debug_struct.field("spoke_state_counts", &self.spoke_state_counts);
23645        debug_struct.field("spoke_state_reason_counts", &self.spoke_state_reason_counts);
23646        if !self._unknown_fields.is_empty() {
23647            debug_struct.field("_unknown_fields", &self._unknown_fields);
23648        }
23649        debug_struct.finish()
23650    }
23651}
23652
23653/// Defines additional types related to [SpokeSummary].
23654pub mod spoke_summary {
23655    #[allow(unused_imports)]
23656    use super::*;
23657
23658    /// The number of spokes of a given type that are associated
23659    /// with a specific hub. The type indicates what kind of
23660    /// resource is associated with the spoke.
23661    #[derive(Clone, Default, PartialEq)]
23662    #[non_exhaustive]
23663    pub struct SpokeTypeCount {
23664        /// Output only. The type of the spokes.
23665        pub spoke_type: crate::model::SpokeType,
23666
23667        /// Output only. The total number of spokes of this type that are
23668        /// associated with the hub.
23669        pub count: i64,
23670
23671        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23672    }
23673
23674    impl SpokeTypeCount {
23675        pub fn new() -> Self {
23676            std::default::Default::default()
23677        }
23678
23679        /// Sets the value of [spoke_type][crate::model::spoke_summary::SpokeTypeCount::spoke_type].
23680        pub fn set_spoke_type<T: std::convert::Into<crate::model::SpokeType>>(
23681            mut self,
23682            v: T,
23683        ) -> Self {
23684            self.spoke_type = v.into();
23685            self
23686        }
23687
23688        /// Sets the value of [count][crate::model::spoke_summary::SpokeTypeCount::count].
23689        pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
23690            self.count = v.into();
23691            self
23692        }
23693    }
23694
23695    impl wkt::message::Message for SpokeTypeCount {
23696        fn typename() -> &'static str {
23697            "type.googleapis.com/google.cloud.networkconnectivity.v1.SpokeSummary.SpokeTypeCount"
23698        }
23699    }
23700
23701    #[doc(hidden)]
23702    impl<'de> serde::de::Deserialize<'de> for SpokeTypeCount {
23703        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23704        where
23705            D: serde::Deserializer<'de>,
23706        {
23707            #[allow(non_camel_case_types)]
23708            #[doc(hidden)]
23709            #[derive(PartialEq, Eq, Hash)]
23710            enum __FieldTag {
23711                __spoke_type,
23712                __count,
23713                Unknown(std::string::String),
23714            }
23715            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
23716                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23717                where
23718                    D: serde::Deserializer<'de>,
23719                {
23720                    struct Visitor;
23721                    impl<'de> serde::de::Visitor<'de> for Visitor {
23722                        type Value = __FieldTag;
23723                        fn expecting(
23724                            &self,
23725                            formatter: &mut std::fmt::Formatter,
23726                        ) -> std::fmt::Result {
23727                            formatter.write_str("a field name for SpokeTypeCount")
23728                        }
23729                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
23730                        where
23731                            E: serde::de::Error,
23732                        {
23733                            use std::result::Result::Ok;
23734                            use std::string::ToString;
23735                            match value {
23736                                "spokeType" => Ok(__FieldTag::__spoke_type),
23737                                "spoke_type" => Ok(__FieldTag::__spoke_type),
23738                                "count" => Ok(__FieldTag::__count),
23739                                _ => Ok(__FieldTag::Unknown(value.to_string())),
23740                            }
23741                        }
23742                    }
23743                    deserializer.deserialize_identifier(Visitor)
23744                }
23745            }
23746            struct Visitor;
23747            impl<'de> serde::de::Visitor<'de> for Visitor {
23748                type Value = SpokeTypeCount;
23749                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23750                    formatter.write_str("struct SpokeTypeCount")
23751                }
23752                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
23753                where
23754                    A: serde::de::MapAccess<'de>,
23755                {
23756                    #[allow(unused_imports)]
23757                    use serde::de::Error;
23758                    use std::option::Option::Some;
23759                    let mut fields = std::collections::HashSet::new();
23760                    let mut result = Self::Value::new();
23761                    while let Some(tag) = map.next_key::<__FieldTag>()? {
23762                        #[allow(clippy::match_single_binding)]
23763                        match tag {
23764                            __FieldTag::__spoke_type => {
23765                                if !fields.insert(__FieldTag::__spoke_type) {
23766                                    return std::result::Result::Err(A::Error::duplicate_field(
23767                                        "multiple values for spoke_type",
23768                                    ));
23769                                }
23770                                result.spoke_type = map
23771                                    .next_value::<std::option::Option<crate::model::SpokeType>>()?
23772                                    .unwrap_or_default();
23773                            }
23774                            __FieldTag::__count => {
23775                                if !fields.insert(__FieldTag::__count) {
23776                                    return std::result::Result::Err(A::Error::duplicate_field(
23777                                        "multiple values for count",
23778                                    ));
23779                                }
23780                                struct __With(std::option::Option<i64>);
23781                                impl<'de> serde::de::Deserialize<'de> for __With {
23782                                    fn deserialize<D>(
23783                                        deserializer: D,
23784                                    ) -> std::result::Result<Self, D::Error>
23785                                    where
23786                                        D: serde::de::Deserializer<'de>,
23787                                    {
23788                                        serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
23789                                    }
23790                                }
23791                                result.count = map.next_value::<__With>()?.0.unwrap_or_default();
23792                            }
23793                            __FieldTag::Unknown(key) => {
23794                                let value = map.next_value::<serde_json::Value>()?;
23795                                result._unknown_fields.insert(key, value);
23796                            }
23797                        }
23798                    }
23799                    std::result::Result::Ok(result)
23800                }
23801            }
23802            deserializer.deserialize_any(Visitor)
23803        }
23804    }
23805
23806    #[doc(hidden)]
23807    impl serde::ser::Serialize for SpokeTypeCount {
23808        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23809        where
23810            S: serde::ser::Serializer,
23811        {
23812            use serde::ser::SerializeMap;
23813            #[allow(unused_imports)]
23814            use std::option::Option::Some;
23815            let mut state = serializer.serialize_map(std::option::Option::None)?;
23816            if !wkt::internal::is_default(&self.spoke_type) {
23817                state.serialize_entry("spokeType", &self.spoke_type)?;
23818            }
23819            if !wkt::internal::is_default(&self.count) {
23820                struct __With<'a>(&'a i64);
23821                impl<'a> serde::ser::Serialize for __With<'a> {
23822                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23823                    where
23824                        S: serde::ser::Serializer,
23825                    {
23826                        serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
23827                    }
23828                }
23829                state.serialize_entry("count", &__With(&self.count))?;
23830            }
23831            if !self._unknown_fields.is_empty() {
23832                for (key, value) in self._unknown_fields.iter() {
23833                    state.serialize_entry(key, &value)?;
23834                }
23835            }
23836            state.end()
23837        }
23838    }
23839
23840    impl std::fmt::Debug for SpokeTypeCount {
23841        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23842            let mut debug_struct = f.debug_struct("SpokeTypeCount");
23843            debug_struct.field("spoke_type", &self.spoke_type);
23844            debug_struct.field("count", &self.count);
23845            if !self._unknown_fields.is_empty() {
23846                debug_struct.field("_unknown_fields", &self._unknown_fields);
23847            }
23848            debug_struct.finish()
23849        }
23850    }
23851
23852    /// The number of spokes that are in a particular state
23853    /// and associated with a given hub.
23854    #[derive(Clone, Default, PartialEq)]
23855    #[non_exhaustive]
23856    pub struct SpokeStateCount {
23857        /// Output only. The state of the spokes.
23858        pub state: crate::model::State,
23859
23860        /// Output only. The total number of spokes that are in this state
23861        /// and associated with a given hub.
23862        pub count: i64,
23863
23864        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23865    }
23866
23867    impl SpokeStateCount {
23868        pub fn new() -> Self {
23869            std::default::Default::default()
23870        }
23871
23872        /// Sets the value of [state][crate::model::spoke_summary::SpokeStateCount::state].
23873        pub fn set_state<T: std::convert::Into<crate::model::State>>(mut self, v: T) -> Self {
23874            self.state = v.into();
23875            self
23876        }
23877
23878        /// Sets the value of [count][crate::model::spoke_summary::SpokeStateCount::count].
23879        pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
23880            self.count = v.into();
23881            self
23882        }
23883    }
23884
23885    impl wkt::message::Message for SpokeStateCount {
23886        fn typename() -> &'static str {
23887            "type.googleapis.com/google.cloud.networkconnectivity.v1.SpokeSummary.SpokeStateCount"
23888        }
23889    }
23890
23891    #[doc(hidden)]
23892    impl<'de> serde::de::Deserialize<'de> for SpokeStateCount {
23893        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23894        where
23895            D: serde::Deserializer<'de>,
23896        {
23897            #[allow(non_camel_case_types)]
23898            #[doc(hidden)]
23899            #[derive(PartialEq, Eq, Hash)]
23900            enum __FieldTag {
23901                __state,
23902                __count,
23903                Unknown(std::string::String),
23904            }
23905            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
23906                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23907                where
23908                    D: serde::Deserializer<'de>,
23909                {
23910                    struct Visitor;
23911                    impl<'de> serde::de::Visitor<'de> for Visitor {
23912                        type Value = __FieldTag;
23913                        fn expecting(
23914                            &self,
23915                            formatter: &mut std::fmt::Formatter,
23916                        ) -> std::fmt::Result {
23917                            formatter.write_str("a field name for SpokeStateCount")
23918                        }
23919                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
23920                        where
23921                            E: serde::de::Error,
23922                        {
23923                            use std::result::Result::Ok;
23924                            use std::string::ToString;
23925                            match value {
23926                                "state" => Ok(__FieldTag::__state),
23927                                "count" => Ok(__FieldTag::__count),
23928                                _ => Ok(__FieldTag::Unknown(value.to_string())),
23929                            }
23930                        }
23931                    }
23932                    deserializer.deserialize_identifier(Visitor)
23933                }
23934            }
23935            struct Visitor;
23936            impl<'de> serde::de::Visitor<'de> for Visitor {
23937                type Value = SpokeStateCount;
23938                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
23939                    formatter.write_str("struct SpokeStateCount")
23940                }
23941                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
23942                where
23943                    A: serde::de::MapAccess<'de>,
23944                {
23945                    #[allow(unused_imports)]
23946                    use serde::de::Error;
23947                    use std::option::Option::Some;
23948                    let mut fields = std::collections::HashSet::new();
23949                    let mut result = Self::Value::new();
23950                    while let Some(tag) = map.next_key::<__FieldTag>()? {
23951                        #[allow(clippy::match_single_binding)]
23952                        match tag {
23953                            __FieldTag::__state => {
23954                                if !fields.insert(__FieldTag::__state) {
23955                                    return std::result::Result::Err(A::Error::duplicate_field(
23956                                        "multiple values for state",
23957                                    ));
23958                                }
23959                                result.state = map
23960                                    .next_value::<std::option::Option<crate::model::State>>()?
23961                                    .unwrap_or_default();
23962                            }
23963                            __FieldTag::__count => {
23964                                if !fields.insert(__FieldTag::__count) {
23965                                    return std::result::Result::Err(A::Error::duplicate_field(
23966                                        "multiple values for count",
23967                                    ));
23968                                }
23969                                struct __With(std::option::Option<i64>);
23970                                impl<'de> serde::de::Deserialize<'de> for __With {
23971                                    fn deserialize<D>(
23972                                        deserializer: D,
23973                                    ) -> std::result::Result<Self, D::Error>
23974                                    where
23975                                        D: serde::de::Deserializer<'de>,
23976                                    {
23977                                        serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
23978                                    }
23979                                }
23980                                result.count = map.next_value::<__With>()?.0.unwrap_or_default();
23981                            }
23982                            __FieldTag::Unknown(key) => {
23983                                let value = map.next_value::<serde_json::Value>()?;
23984                                result._unknown_fields.insert(key, value);
23985                            }
23986                        }
23987                    }
23988                    std::result::Result::Ok(result)
23989                }
23990            }
23991            deserializer.deserialize_any(Visitor)
23992        }
23993    }
23994
23995    #[doc(hidden)]
23996    impl serde::ser::Serialize for SpokeStateCount {
23997        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23998        where
23999            S: serde::ser::Serializer,
24000        {
24001            use serde::ser::SerializeMap;
24002            #[allow(unused_imports)]
24003            use std::option::Option::Some;
24004            let mut state = serializer.serialize_map(std::option::Option::None)?;
24005            if !wkt::internal::is_default(&self.state) {
24006                state.serialize_entry("state", &self.state)?;
24007            }
24008            if !wkt::internal::is_default(&self.count) {
24009                struct __With<'a>(&'a i64);
24010                impl<'a> serde::ser::Serialize for __With<'a> {
24011                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24012                    where
24013                        S: serde::ser::Serializer,
24014                    {
24015                        serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
24016                    }
24017                }
24018                state.serialize_entry("count", &__With(&self.count))?;
24019            }
24020            if !self._unknown_fields.is_empty() {
24021                for (key, value) in self._unknown_fields.iter() {
24022                    state.serialize_entry(key, &value)?;
24023                }
24024            }
24025            state.end()
24026        }
24027    }
24028
24029    impl std::fmt::Debug for SpokeStateCount {
24030        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24031            let mut debug_struct = f.debug_struct("SpokeStateCount");
24032            debug_struct.field("state", &self.state);
24033            debug_struct.field("count", &self.count);
24034            if !self._unknown_fields.is_empty() {
24035                debug_struct.field("_unknown_fields", &self._unknown_fields);
24036            }
24037            debug_struct.finish()
24038        }
24039    }
24040
24041    /// The number of spokes in the hub that are inactive for this reason.
24042    #[derive(Clone, Default, PartialEq)]
24043    #[non_exhaustive]
24044    pub struct SpokeStateReasonCount {
24045        /// Output only. The reason that a spoke is inactive.
24046        pub state_reason_code: crate::model::spoke::state_reason::Code,
24047
24048        /// Output only. The total number of spokes that are inactive for a
24049        /// particular reason and associated with a given hub.
24050        pub count: i64,
24051
24052        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24053    }
24054
24055    impl SpokeStateReasonCount {
24056        pub fn new() -> Self {
24057            std::default::Default::default()
24058        }
24059
24060        /// Sets the value of [state_reason_code][crate::model::spoke_summary::SpokeStateReasonCount::state_reason_code].
24061        pub fn set_state_reason_code<
24062            T: std::convert::Into<crate::model::spoke::state_reason::Code>,
24063        >(
24064            mut self,
24065            v: T,
24066        ) -> Self {
24067            self.state_reason_code = v.into();
24068            self
24069        }
24070
24071        /// Sets the value of [count][crate::model::spoke_summary::SpokeStateReasonCount::count].
24072        pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
24073            self.count = v.into();
24074            self
24075        }
24076    }
24077
24078    impl wkt::message::Message for SpokeStateReasonCount {
24079        fn typename() -> &'static str {
24080            "type.googleapis.com/google.cloud.networkconnectivity.v1.SpokeSummary.SpokeStateReasonCount"
24081        }
24082    }
24083
24084    #[doc(hidden)]
24085    impl<'de> serde::de::Deserialize<'de> for SpokeStateReasonCount {
24086        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24087        where
24088            D: serde::Deserializer<'de>,
24089        {
24090            #[allow(non_camel_case_types)]
24091            #[doc(hidden)]
24092            #[derive(PartialEq, Eq, Hash)]
24093            enum __FieldTag {
24094                __state_reason_code,
24095                __count,
24096                Unknown(std::string::String),
24097            }
24098            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
24099                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24100                where
24101                    D: serde::Deserializer<'de>,
24102                {
24103                    struct Visitor;
24104                    impl<'de> serde::de::Visitor<'de> for Visitor {
24105                        type Value = __FieldTag;
24106                        fn expecting(
24107                            &self,
24108                            formatter: &mut std::fmt::Formatter,
24109                        ) -> std::fmt::Result {
24110                            formatter.write_str("a field name for SpokeStateReasonCount")
24111                        }
24112                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
24113                        where
24114                            E: serde::de::Error,
24115                        {
24116                            use std::result::Result::Ok;
24117                            use std::string::ToString;
24118                            match value {
24119                                "stateReasonCode" => Ok(__FieldTag::__state_reason_code),
24120                                "state_reason_code" => Ok(__FieldTag::__state_reason_code),
24121                                "count" => Ok(__FieldTag::__count),
24122                                _ => Ok(__FieldTag::Unknown(value.to_string())),
24123                            }
24124                        }
24125                    }
24126                    deserializer.deserialize_identifier(Visitor)
24127                }
24128            }
24129            struct Visitor;
24130            impl<'de> serde::de::Visitor<'de> for Visitor {
24131                type Value = SpokeStateReasonCount;
24132                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24133                    formatter.write_str("struct SpokeStateReasonCount")
24134                }
24135                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
24136                where
24137                    A: serde::de::MapAccess<'de>,
24138                {
24139                    #[allow(unused_imports)]
24140                    use serde::de::Error;
24141                    use std::option::Option::Some;
24142                    let mut fields = std::collections::HashSet::new();
24143                    let mut result = Self::Value::new();
24144                    while let Some(tag) = map.next_key::<__FieldTag>()? {
24145                        #[allow(clippy::match_single_binding)]
24146                        match tag {
24147                            __FieldTag::__state_reason_code => {
24148                                if !fields.insert(__FieldTag::__state_reason_code) {
24149                                    return std::result::Result::Err(A::Error::duplicate_field(
24150                                        "multiple values for state_reason_code",
24151                                    ));
24152                                }
24153                                result.state_reason_code =
24154                                    map.next_value::<std::option::Option<
24155                                        crate::model::spoke::state_reason::Code,
24156                                    >>()?
24157                                    .unwrap_or_default();
24158                            }
24159                            __FieldTag::__count => {
24160                                if !fields.insert(__FieldTag::__count) {
24161                                    return std::result::Result::Err(A::Error::duplicate_field(
24162                                        "multiple values for count",
24163                                    ));
24164                                }
24165                                struct __With(std::option::Option<i64>);
24166                                impl<'de> serde::de::Deserialize<'de> for __With {
24167                                    fn deserialize<D>(
24168                                        deserializer: D,
24169                                    ) -> std::result::Result<Self, D::Error>
24170                                    where
24171                                        D: serde::de::Deserializer<'de>,
24172                                    {
24173                                        serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
24174                                    }
24175                                }
24176                                result.count = map.next_value::<__With>()?.0.unwrap_or_default();
24177                            }
24178                            __FieldTag::Unknown(key) => {
24179                                let value = map.next_value::<serde_json::Value>()?;
24180                                result._unknown_fields.insert(key, value);
24181                            }
24182                        }
24183                    }
24184                    std::result::Result::Ok(result)
24185                }
24186            }
24187            deserializer.deserialize_any(Visitor)
24188        }
24189    }
24190
24191    #[doc(hidden)]
24192    impl serde::ser::Serialize for SpokeStateReasonCount {
24193        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24194        where
24195            S: serde::ser::Serializer,
24196        {
24197            use serde::ser::SerializeMap;
24198            #[allow(unused_imports)]
24199            use std::option::Option::Some;
24200            let mut state = serializer.serialize_map(std::option::Option::None)?;
24201            if !wkt::internal::is_default(&self.state_reason_code) {
24202                state.serialize_entry("stateReasonCode", &self.state_reason_code)?;
24203            }
24204            if !wkt::internal::is_default(&self.count) {
24205                struct __With<'a>(&'a i64);
24206                impl<'a> serde::ser::Serialize for __With<'a> {
24207                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24208                    where
24209                        S: serde::ser::Serializer,
24210                    {
24211                        serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
24212                    }
24213                }
24214                state.serialize_entry("count", &__With(&self.count))?;
24215            }
24216            if !self._unknown_fields.is_empty() {
24217                for (key, value) in self._unknown_fields.iter() {
24218                    state.serialize_entry(key, &value)?;
24219                }
24220            }
24221            state.end()
24222        }
24223    }
24224
24225    impl std::fmt::Debug for SpokeStateReasonCount {
24226        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24227            let mut debug_struct = f.debug_struct("SpokeStateReasonCount");
24228            debug_struct.field("state_reason_code", &self.state_reason_code);
24229            debug_struct.field("count", &self.count);
24230            if !self._unknown_fields.is_empty() {
24231                debug_struct.field("_unknown_fields", &self._unknown_fields);
24232            }
24233            debug_struct.finish()
24234        }
24235    }
24236}
24237
24238/// The request for
24239/// [HubService.GetGroup][google.cloud.networkconnectivity.v1.HubService.GetGroup].
24240///
24241/// [google.cloud.networkconnectivity.v1.HubService.GetGroup]: crate::client::HubService::get_group
24242#[derive(Clone, Default, PartialEq)]
24243#[non_exhaustive]
24244pub struct GetGroupRequest {
24245    /// Required. The name of the route table resource.
24246    pub name: std::string::String,
24247
24248    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24249}
24250
24251impl GetGroupRequest {
24252    pub fn new() -> Self {
24253        std::default::Default::default()
24254    }
24255
24256    /// Sets the value of [name][crate::model::GetGroupRequest::name].
24257    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24258        self.name = v.into();
24259        self
24260    }
24261}
24262
24263impl wkt::message::Message for GetGroupRequest {
24264    fn typename() -> &'static str {
24265        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetGroupRequest"
24266    }
24267}
24268
24269#[doc(hidden)]
24270impl<'de> serde::de::Deserialize<'de> for GetGroupRequest {
24271    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24272    where
24273        D: serde::Deserializer<'de>,
24274    {
24275        #[allow(non_camel_case_types)]
24276        #[doc(hidden)]
24277        #[derive(PartialEq, Eq, Hash)]
24278        enum __FieldTag {
24279            __name,
24280            Unknown(std::string::String),
24281        }
24282        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
24283            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24284            where
24285                D: serde::Deserializer<'de>,
24286            {
24287                struct Visitor;
24288                impl<'de> serde::de::Visitor<'de> for Visitor {
24289                    type Value = __FieldTag;
24290                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24291                        formatter.write_str("a field name for GetGroupRequest")
24292                    }
24293                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
24294                    where
24295                        E: serde::de::Error,
24296                    {
24297                        use std::result::Result::Ok;
24298                        use std::string::ToString;
24299                        match value {
24300                            "name" => Ok(__FieldTag::__name),
24301                            _ => Ok(__FieldTag::Unknown(value.to_string())),
24302                        }
24303                    }
24304                }
24305                deserializer.deserialize_identifier(Visitor)
24306            }
24307        }
24308        struct Visitor;
24309        impl<'de> serde::de::Visitor<'de> for Visitor {
24310            type Value = GetGroupRequest;
24311            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24312                formatter.write_str("struct GetGroupRequest")
24313            }
24314            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
24315            where
24316                A: serde::de::MapAccess<'de>,
24317            {
24318                #[allow(unused_imports)]
24319                use serde::de::Error;
24320                use std::option::Option::Some;
24321                let mut fields = std::collections::HashSet::new();
24322                let mut result = Self::Value::new();
24323                while let Some(tag) = map.next_key::<__FieldTag>()? {
24324                    #[allow(clippy::match_single_binding)]
24325                    match tag {
24326                        __FieldTag::__name => {
24327                            if !fields.insert(__FieldTag::__name) {
24328                                return std::result::Result::Err(A::Error::duplicate_field(
24329                                    "multiple values for name",
24330                                ));
24331                            }
24332                            result.name = map
24333                                .next_value::<std::option::Option<std::string::String>>()?
24334                                .unwrap_or_default();
24335                        }
24336                        __FieldTag::Unknown(key) => {
24337                            let value = map.next_value::<serde_json::Value>()?;
24338                            result._unknown_fields.insert(key, value);
24339                        }
24340                    }
24341                }
24342                std::result::Result::Ok(result)
24343            }
24344        }
24345        deserializer.deserialize_any(Visitor)
24346    }
24347}
24348
24349#[doc(hidden)]
24350impl serde::ser::Serialize for GetGroupRequest {
24351    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24352    where
24353        S: serde::ser::Serializer,
24354    {
24355        use serde::ser::SerializeMap;
24356        #[allow(unused_imports)]
24357        use std::option::Option::Some;
24358        let mut state = serializer.serialize_map(std::option::Option::None)?;
24359        if !self.name.is_empty() {
24360            state.serialize_entry("name", &self.name)?;
24361        }
24362        if !self._unknown_fields.is_empty() {
24363            for (key, value) in self._unknown_fields.iter() {
24364                state.serialize_entry(key, &value)?;
24365            }
24366        }
24367        state.end()
24368    }
24369}
24370
24371impl std::fmt::Debug for GetGroupRequest {
24372    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24373        let mut debug_struct = f.debug_struct("GetGroupRequest");
24374        debug_struct.field("name", &self.name);
24375        if !self._unknown_fields.is_empty() {
24376            debug_struct.field("_unknown_fields", &self._unknown_fields);
24377        }
24378        debug_struct.finish()
24379    }
24380}
24381
24382/// Request for
24383/// [HubService.UpdateGroup][google.cloud.networkconnectivity.v1.HubService.UpdateGroup]
24384/// method.
24385///
24386/// [google.cloud.networkconnectivity.v1.HubService.UpdateGroup]: crate::client::HubService::update_group
24387#[derive(Clone, Default, PartialEq)]
24388#[non_exhaustive]
24389pub struct UpdateGroupRequest {
24390    /// Optional. In the case of an update to an existing group, field mask is used
24391    /// to specify the fields to be overwritten. The fields specified in the
24392    /// update_mask are relative to the resource, not the full request. A field is
24393    /// overwritten if it is in the mask. If the user does not provide a mask, then
24394    /// all fields are overwritten.
24395    pub update_mask: std::option::Option<wkt::FieldMask>,
24396
24397    /// Required. The state that the group should be in after the update.
24398    pub group: std::option::Option<crate::model::Group>,
24399
24400    /// Optional. A request ID to identify requests. Specify a unique request ID so
24401    /// that if you must retry your request, the server knows to ignore the request
24402    /// if it has already been completed. The server guarantees that a request
24403    /// doesn't result in creation of duplicate commitments for at least 60
24404    /// minutes.
24405    ///
24406    /// For example, consider a situation where you make an initial request and
24407    /// the request times out. If you make the request again with the same request
24408    /// ID, the server can check to see whether the original operation
24409    /// was received. If it was, the server ignores the second request. This
24410    /// behavior prevents clients from mistakenly creating duplicate commitments.
24411    ///
24412    /// The request ID must be a valid UUID, with the exception that zero UUID is
24413    /// not supported (00000000-0000-0000-0000-000000000000).
24414    pub request_id: std::string::String,
24415
24416    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24417}
24418
24419impl UpdateGroupRequest {
24420    pub fn new() -> Self {
24421        std::default::Default::default()
24422    }
24423
24424    /// Sets the value of [update_mask][crate::model::UpdateGroupRequest::update_mask].
24425    pub fn set_update_mask<T>(mut self, v: T) -> Self
24426    where
24427        T: std::convert::Into<wkt::FieldMask>,
24428    {
24429        self.update_mask = std::option::Option::Some(v.into());
24430        self
24431    }
24432
24433    /// Sets or clears the value of [update_mask][crate::model::UpdateGroupRequest::update_mask].
24434    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
24435    where
24436        T: std::convert::Into<wkt::FieldMask>,
24437    {
24438        self.update_mask = v.map(|x| x.into());
24439        self
24440    }
24441
24442    /// Sets the value of [group][crate::model::UpdateGroupRequest::group].
24443    pub fn set_group<T>(mut self, v: T) -> Self
24444    where
24445        T: std::convert::Into<crate::model::Group>,
24446    {
24447        self.group = std::option::Option::Some(v.into());
24448        self
24449    }
24450
24451    /// Sets or clears the value of [group][crate::model::UpdateGroupRequest::group].
24452    pub fn set_or_clear_group<T>(mut self, v: std::option::Option<T>) -> Self
24453    where
24454        T: std::convert::Into<crate::model::Group>,
24455    {
24456        self.group = v.map(|x| x.into());
24457        self
24458    }
24459
24460    /// Sets the value of [request_id][crate::model::UpdateGroupRequest::request_id].
24461    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24462        self.request_id = v.into();
24463        self
24464    }
24465}
24466
24467impl wkt::message::Message for UpdateGroupRequest {
24468    fn typename() -> &'static str {
24469        "type.googleapis.com/google.cloud.networkconnectivity.v1.UpdateGroupRequest"
24470    }
24471}
24472
24473#[doc(hidden)]
24474impl<'de> serde::de::Deserialize<'de> for UpdateGroupRequest {
24475    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24476    where
24477        D: serde::Deserializer<'de>,
24478    {
24479        #[allow(non_camel_case_types)]
24480        #[doc(hidden)]
24481        #[derive(PartialEq, Eq, Hash)]
24482        enum __FieldTag {
24483            __update_mask,
24484            __group,
24485            __request_id,
24486            Unknown(std::string::String),
24487        }
24488        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
24489            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24490            where
24491                D: serde::Deserializer<'de>,
24492            {
24493                struct Visitor;
24494                impl<'de> serde::de::Visitor<'de> for Visitor {
24495                    type Value = __FieldTag;
24496                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24497                        formatter.write_str("a field name for UpdateGroupRequest")
24498                    }
24499                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
24500                    where
24501                        E: serde::de::Error,
24502                    {
24503                        use std::result::Result::Ok;
24504                        use std::string::ToString;
24505                        match value {
24506                            "updateMask" => Ok(__FieldTag::__update_mask),
24507                            "update_mask" => Ok(__FieldTag::__update_mask),
24508                            "group" => Ok(__FieldTag::__group),
24509                            "requestId" => Ok(__FieldTag::__request_id),
24510                            "request_id" => Ok(__FieldTag::__request_id),
24511                            _ => Ok(__FieldTag::Unknown(value.to_string())),
24512                        }
24513                    }
24514                }
24515                deserializer.deserialize_identifier(Visitor)
24516            }
24517        }
24518        struct Visitor;
24519        impl<'de> serde::de::Visitor<'de> for Visitor {
24520            type Value = UpdateGroupRequest;
24521            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24522                formatter.write_str("struct UpdateGroupRequest")
24523            }
24524            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
24525            where
24526                A: serde::de::MapAccess<'de>,
24527            {
24528                #[allow(unused_imports)]
24529                use serde::de::Error;
24530                use std::option::Option::Some;
24531                let mut fields = std::collections::HashSet::new();
24532                let mut result = Self::Value::new();
24533                while let Some(tag) = map.next_key::<__FieldTag>()? {
24534                    #[allow(clippy::match_single_binding)]
24535                    match tag {
24536                        __FieldTag::__update_mask => {
24537                            if !fields.insert(__FieldTag::__update_mask) {
24538                                return std::result::Result::Err(A::Error::duplicate_field(
24539                                    "multiple values for update_mask",
24540                                ));
24541                            }
24542                            result.update_mask =
24543                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
24544                        }
24545                        __FieldTag::__group => {
24546                            if !fields.insert(__FieldTag::__group) {
24547                                return std::result::Result::Err(A::Error::duplicate_field(
24548                                    "multiple values for group",
24549                                ));
24550                            }
24551                            result.group =
24552                                map.next_value::<std::option::Option<crate::model::Group>>()?;
24553                        }
24554                        __FieldTag::__request_id => {
24555                            if !fields.insert(__FieldTag::__request_id) {
24556                                return std::result::Result::Err(A::Error::duplicate_field(
24557                                    "multiple values for request_id",
24558                                ));
24559                            }
24560                            result.request_id = map
24561                                .next_value::<std::option::Option<std::string::String>>()?
24562                                .unwrap_or_default();
24563                        }
24564                        __FieldTag::Unknown(key) => {
24565                            let value = map.next_value::<serde_json::Value>()?;
24566                            result._unknown_fields.insert(key, value);
24567                        }
24568                    }
24569                }
24570                std::result::Result::Ok(result)
24571            }
24572        }
24573        deserializer.deserialize_any(Visitor)
24574    }
24575}
24576
24577#[doc(hidden)]
24578impl serde::ser::Serialize for UpdateGroupRequest {
24579    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
24580    where
24581        S: serde::ser::Serializer,
24582    {
24583        use serde::ser::SerializeMap;
24584        #[allow(unused_imports)]
24585        use std::option::Option::Some;
24586        let mut state = serializer.serialize_map(std::option::Option::None)?;
24587        if self.update_mask.is_some() {
24588            state.serialize_entry("updateMask", &self.update_mask)?;
24589        }
24590        if self.group.is_some() {
24591            state.serialize_entry("group", &self.group)?;
24592        }
24593        if !self.request_id.is_empty() {
24594            state.serialize_entry("requestId", &self.request_id)?;
24595        }
24596        if !self._unknown_fields.is_empty() {
24597            for (key, value) in self._unknown_fields.iter() {
24598                state.serialize_entry(key, &value)?;
24599            }
24600        }
24601        state.end()
24602    }
24603}
24604
24605impl std::fmt::Debug for UpdateGroupRequest {
24606    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24607        let mut debug_struct = f.debug_struct("UpdateGroupRequest");
24608        debug_struct.field("update_mask", &self.update_mask);
24609        debug_struct.field("group", &self.group);
24610        debug_struct.field("request_id", &self.request_id);
24611        if !self._unknown_fields.is_empty() {
24612            debug_struct.field("_unknown_fields", &self._unknown_fields);
24613        }
24614        debug_struct.finish()
24615    }
24616}
24617
24618/// The internal range resource for IPAM operations within a VPC network.
24619/// Used to represent a private address range along with behavioral
24620/// characteristics of that range (its usage and peering behavior).
24621/// Networking resources can link to this range if they are created
24622/// as belonging to it.
24623#[derive(Clone, Default, PartialEq)]
24624#[non_exhaustive]
24625pub struct InternalRange {
24626    /// Identifier. The name of an internal range.
24627    /// Format:
24628    /// projects/{project}/locations/{location}/internalRanges/{internal_range}
24629    /// See: <https://google.aip.dev/122#fields-representing-resource-names>
24630    pub name: std::string::String,
24631
24632    /// Time when the internal range was created.
24633    pub create_time: std::option::Option<wkt::Timestamp>,
24634
24635    /// Time when the internal range was updated.
24636    pub update_time: std::option::Option<wkt::Timestamp>,
24637
24638    /// User-defined labels.
24639    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
24640
24641    /// Optional. A description of this resource.
24642    pub description: std::string::String,
24643
24644    /// Optional. The IP range that this internal range defines.
24645    /// NOTE: IPv6 ranges are limited to usage=EXTERNAL_TO_VPC and
24646    /// peering=FOR_SELF.
24647    /// NOTE: For IPv6 Ranges this field is compulsory, i.e. the address range must
24648    /// be specified explicitly.
24649    pub ip_cidr_range: std::string::String,
24650
24651    /// Immutable. The URL or resource ID of the network in which to reserve the
24652    /// internal range. The network cannot be deleted if there are any reserved
24653    /// internal ranges referring to it. Legacy networks are not supported. For
24654    /// example:
24655    /// <https://www.googleapis.com/compute/v1/projects/{project}/locations/global/networks/{network}>
24656    /// projects/{project}/locations/global/networks/{network}
24657    /// {network}
24658    pub network: std::string::String,
24659
24660    /// Optional. The type of usage set for this InternalRange.
24661    pub usage: crate::model::internal_range::Usage,
24662
24663    /// Optional. The type of peering set for this internal range.
24664    pub peering: crate::model::internal_range::Peering,
24665
24666    /// Optional. An alternate to ip_cidr_range. Can be set when trying to create
24667    /// an IPv4 reservation that automatically finds a free range of the given
24668    /// size. If both ip_cidr_range and prefix_length are set, there is an error if
24669    /// the range sizes do not match. Can also be used during updates to change the
24670    /// range size.
24671    /// NOTE: For IPv6 this field only works if ip_cidr_range is set as well, and
24672    /// both fields must match. In other words, with IPv6 this field only works as
24673    /// a redundant parameter.
24674    pub prefix_length: i32,
24675
24676    /// Optional. Can be set to narrow down or pick a different address space while
24677    /// searching for a free range. If not set, defaults to the "10.0.0.0/8"
24678    /// address space. This can be used to search in other rfc-1918 address
24679    /// spaces like "172.16.0.0/12" and "192.168.0.0/16" or non-rfc-1918
24680    /// address spaces used in the VPC.
24681    pub target_cidr_range: std::vec::Vec<std::string::String>,
24682
24683    /// Output only. The list of resources that refer to this internal range.
24684    /// Resources that use the internal range for their range allocation
24685    /// are referred to as users of the range. Other resources mark themselves
24686    /// as users while doing so by creating a reference to this internal range.
24687    /// Having a user, based on this reference, prevents deletion of the
24688    /// internal range referred to. Can be empty.
24689    pub users: std::vec::Vec<std::string::String>,
24690
24691    /// Optional. Types of resources that are allowed to overlap with the current
24692    /// internal range.
24693    pub overlaps: std::vec::Vec<crate::model::internal_range::Overlap>,
24694
24695    /// Optional. Must be present if usage is set to FOR_MIGRATION.
24696    pub migration: std::option::Option<crate::model::internal_range::Migration>,
24697
24698    /// Optional. Immutable ranges cannot have their fields modified, except for
24699    /// labels and description.
24700    pub immutable: bool,
24701
24702    /// Optional. Range auto-allocation options, may be set only when
24703    /// auto-allocation is selected by not setting ip_cidr_range (and setting
24704    /// prefix_length).
24705    pub allocation_options: std::option::Option<crate::model::internal_range::AllocationOptions>,
24706
24707    /// Optional. ExcludeCidrRanges flag. Specifies a set of CIDR blocks that
24708    /// allows exclusion of particular CIDR ranges from the auto-allocation
24709    /// process, without having to reserve these blocks
24710    pub exclude_cidr_ranges: std::vec::Vec<std::string::String>,
24711
24712    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24713}
24714
24715impl InternalRange {
24716    pub fn new() -> Self {
24717        std::default::Default::default()
24718    }
24719
24720    /// Sets the value of [name][crate::model::InternalRange::name].
24721    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24722        self.name = v.into();
24723        self
24724    }
24725
24726    /// Sets the value of [create_time][crate::model::InternalRange::create_time].
24727    pub fn set_create_time<T>(mut self, v: T) -> Self
24728    where
24729        T: std::convert::Into<wkt::Timestamp>,
24730    {
24731        self.create_time = std::option::Option::Some(v.into());
24732        self
24733    }
24734
24735    /// Sets or clears the value of [create_time][crate::model::InternalRange::create_time].
24736    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
24737    where
24738        T: std::convert::Into<wkt::Timestamp>,
24739    {
24740        self.create_time = v.map(|x| x.into());
24741        self
24742    }
24743
24744    /// Sets the value of [update_time][crate::model::InternalRange::update_time].
24745    pub fn set_update_time<T>(mut self, v: T) -> Self
24746    where
24747        T: std::convert::Into<wkt::Timestamp>,
24748    {
24749        self.update_time = std::option::Option::Some(v.into());
24750        self
24751    }
24752
24753    /// Sets or clears the value of [update_time][crate::model::InternalRange::update_time].
24754    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
24755    where
24756        T: std::convert::Into<wkt::Timestamp>,
24757    {
24758        self.update_time = v.map(|x| x.into());
24759        self
24760    }
24761
24762    /// Sets the value of [labels][crate::model::InternalRange::labels].
24763    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
24764    where
24765        T: std::iter::IntoIterator<Item = (K, V)>,
24766        K: std::convert::Into<std::string::String>,
24767        V: std::convert::Into<std::string::String>,
24768    {
24769        use std::iter::Iterator;
24770        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
24771        self
24772    }
24773
24774    /// Sets the value of [description][crate::model::InternalRange::description].
24775    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24776        self.description = v.into();
24777        self
24778    }
24779
24780    /// Sets the value of [ip_cidr_range][crate::model::InternalRange::ip_cidr_range].
24781    pub fn set_ip_cidr_range<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24782        self.ip_cidr_range = v.into();
24783        self
24784    }
24785
24786    /// Sets the value of [network][crate::model::InternalRange::network].
24787    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24788        self.network = v.into();
24789        self
24790    }
24791
24792    /// Sets the value of [usage][crate::model::InternalRange::usage].
24793    pub fn set_usage<T: std::convert::Into<crate::model::internal_range::Usage>>(
24794        mut self,
24795        v: T,
24796    ) -> Self {
24797        self.usage = v.into();
24798        self
24799    }
24800
24801    /// Sets the value of [peering][crate::model::InternalRange::peering].
24802    pub fn set_peering<T: std::convert::Into<crate::model::internal_range::Peering>>(
24803        mut self,
24804        v: T,
24805    ) -> Self {
24806        self.peering = v.into();
24807        self
24808    }
24809
24810    /// Sets the value of [prefix_length][crate::model::InternalRange::prefix_length].
24811    pub fn set_prefix_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
24812        self.prefix_length = v.into();
24813        self
24814    }
24815
24816    /// Sets the value of [target_cidr_range][crate::model::InternalRange::target_cidr_range].
24817    pub fn set_target_cidr_range<T, V>(mut self, v: T) -> Self
24818    where
24819        T: std::iter::IntoIterator<Item = V>,
24820        V: std::convert::Into<std::string::String>,
24821    {
24822        use std::iter::Iterator;
24823        self.target_cidr_range = v.into_iter().map(|i| i.into()).collect();
24824        self
24825    }
24826
24827    /// Sets the value of [users][crate::model::InternalRange::users].
24828    pub fn set_users<T, V>(mut self, v: T) -> Self
24829    where
24830        T: std::iter::IntoIterator<Item = V>,
24831        V: std::convert::Into<std::string::String>,
24832    {
24833        use std::iter::Iterator;
24834        self.users = v.into_iter().map(|i| i.into()).collect();
24835        self
24836    }
24837
24838    /// Sets the value of [overlaps][crate::model::InternalRange::overlaps].
24839    pub fn set_overlaps<T, V>(mut self, v: T) -> Self
24840    where
24841        T: std::iter::IntoIterator<Item = V>,
24842        V: std::convert::Into<crate::model::internal_range::Overlap>,
24843    {
24844        use std::iter::Iterator;
24845        self.overlaps = v.into_iter().map(|i| i.into()).collect();
24846        self
24847    }
24848
24849    /// Sets the value of [migration][crate::model::InternalRange::migration].
24850    pub fn set_migration<T>(mut self, v: T) -> Self
24851    where
24852        T: std::convert::Into<crate::model::internal_range::Migration>,
24853    {
24854        self.migration = std::option::Option::Some(v.into());
24855        self
24856    }
24857
24858    /// Sets or clears the value of [migration][crate::model::InternalRange::migration].
24859    pub fn set_or_clear_migration<T>(mut self, v: std::option::Option<T>) -> Self
24860    where
24861        T: std::convert::Into<crate::model::internal_range::Migration>,
24862    {
24863        self.migration = v.map(|x| x.into());
24864        self
24865    }
24866
24867    /// Sets the value of [immutable][crate::model::InternalRange::immutable].
24868    pub fn set_immutable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
24869        self.immutable = v.into();
24870        self
24871    }
24872
24873    /// Sets the value of [allocation_options][crate::model::InternalRange::allocation_options].
24874    pub fn set_allocation_options<T>(mut self, v: T) -> Self
24875    where
24876        T: std::convert::Into<crate::model::internal_range::AllocationOptions>,
24877    {
24878        self.allocation_options = std::option::Option::Some(v.into());
24879        self
24880    }
24881
24882    /// Sets or clears the value of [allocation_options][crate::model::InternalRange::allocation_options].
24883    pub fn set_or_clear_allocation_options<T>(mut self, v: std::option::Option<T>) -> Self
24884    where
24885        T: std::convert::Into<crate::model::internal_range::AllocationOptions>,
24886    {
24887        self.allocation_options = v.map(|x| x.into());
24888        self
24889    }
24890
24891    /// Sets the value of [exclude_cidr_ranges][crate::model::InternalRange::exclude_cidr_ranges].
24892    pub fn set_exclude_cidr_ranges<T, V>(mut self, v: T) -> Self
24893    where
24894        T: std::iter::IntoIterator<Item = V>,
24895        V: std::convert::Into<std::string::String>,
24896    {
24897        use std::iter::Iterator;
24898        self.exclude_cidr_ranges = v.into_iter().map(|i| i.into()).collect();
24899        self
24900    }
24901}
24902
24903impl wkt::message::Message for InternalRange {
24904    fn typename() -> &'static str {
24905        "type.googleapis.com/google.cloud.networkconnectivity.v1.InternalRange"
24906    }
24907}
24908
24909#[doc(hidden)]
24910impl<'de> serde::de::Deserialize<'de> for InternalRange {
24911    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24912    where
24913        D: serde::Deserializer<'de>,
24914    {
24915        #[allow(non_camel_case_types)]
24916        #[doc(hidden)]
24917        #[derive(PartialEq, Eq, Hash)]
24918        enum __FieldTag {
24919            __name,
24920            __create_time,
24921            __update_time,
24922            __labels,
24923            __description,
24924            __ip_cidr_range,
24925            __network,
24926            __usage,
24927            __peering,
24928            __prefix_length,
24929            __target_cidr_range,
24930            __users,
24931            __overlaps,
24932            __migration,
24933            __immutable,
24934            __allocation_options,
24935            __exclude_cidr_ranges,
24936            Unknown(std::string::String),
24937        }
24938        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
24939            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
24940            where
24941                D: serde::Deserializer<'de>,
24942            {
24943                struct Visitor;
24944                impl<'de> serde::de::Visitor<'de> for Visitor {
24945                    type Value = __FieldTag;
24946                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24947                        formatter.write_str("a field name for InternalRange")
24948                    }
24949                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
24950                    where
24951                        E: serde::de::Error,
24952                    {
24953                        use std::result::Result::Ok;
24954                        use std::string::ToString;
24955                        match value {
24956                            "name" => Ok(__FieldTag::__name),
24957                            "createTime" => Ok(__FieldTag::__create_time),
24958                            "create_time" => Ok(__FieldTag::__create_time),
24959                            "updateTime" => Ok(__FieldTag::__update_time),
24960                            "update_time" => Ok(__FieldTag::__update_time),
24961                            "labels" => Ok(__FieldTag::__labels),
24962                            "description" => Ok(__FieldTag::__description),
24963                            "ipCidrRange" => Ok(__FieldTag::__ip_cidr_range),
24964                            "ip_cidr_range" => Ok(__FieldTag::__ip_cidr_range),
24965                            "network" => Ok(__FieldTag::__network),
24966                            "usage" => Ok(__FieldTag::__usage),
24967                            "peering" => Ok(__FieldTag::__peering),
24968                            "prefixLength" => Ok(__FieldTag::__prefix_length),
24969                            "prefix_length" => Ok(__FieldTag::__prefix_length),
24970                            "targetCidrRange" => Ok(__FieldTag::__target_cidr_range),
24971                            "target_cidr_range" => Ok(__FieldTag::__target_cidr_range),
24972                            "users" => Ok(__FieldTag::__users),
24973                            "overlaps" => Ok(__FieldTag::__overlaps),
24974                            "migration" => Ok(__FieldTag::__migration),
24975                            "immutable" => Ok(__FieldTag::__immutable),
24976                            "allocationOptions" => Ok(__FieldTag::__allocation_options),
24977                            "allocation_options" => Ok(__FieldTag::__allocation_options),
24978                            "excludeCidrRanges" => Ok(__FieldTag::__exclude_cidr_ranges),
24979                            "exclude_cidr_ranges" => Ok(__FieldTag::__exclude_cidr_ranges),
24980                            _ => Ok(__FieldTag::Unknown(value.to_string())),
24981                        }
24982                    }
24983                }
24984                deserializer.deserialize_identifier(Visitor)
24985            }
24986        }
24987        struct Visitor;
24988        impl<'de> serde::de::Visitor<'de> for Visitor {
24989            type Value = InternalRange;
24990            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
24991                formatter.write_str("struct InternalRange")
24992            }
24993            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
24994            where
24995                A: serde::de::MapAccess<'de>,
24996            {
24997                #[allow(unused_imports)]
24998                use serde::de::Error;
24999                use std::option::Option::Some;
25000                let mut fields = std::collections::HashSet::new();
25001                let mut result = Self::Value::new();
25002                while let Some(tag) = map.next_key::<__FieldTag>()? {
25003                    #[allow(clippy::match_single_binding)]
25004                    match tag {
25005                        __FieldTag::__name => {
25006                            if !fields.insert(__FieldTag::__name) {
25007                                return std::result::Result::Err(A::Error::duplicate_field(
25008                                    "multiple values for name",
25009                                ));
25010                            }
25011                            result.name = map
25012                                .next_value::<std::option::Option<std::string::String>>()?
25013                                .unwrap_or_default();
25014                        }
25015                        __FieldTag::__create_time => {
25016                            if !fields.insert(__FieldTag::__create_time) {
25017                                return std::result::Result::Err(A::Error::duplicate_field(
25018                                    "multiple values for create_time",
25019                                ));
25020                            }
25021                            result.create_time =
25022                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
25023                        }
25024                        __FieldTag::__update_time => {
25025                            if !fields.insert(__FieldTag::__update_time) {
25026                                return std::result::Result::Err(A::Error::duplicate_field(
25027                                    "multiple values for update_time",
25028                                ));
25029                            }
25030                            result.update_time =
25031                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
25032                        }
25033                        __FieldTag::__labels => {
25034                            if !fields.insert(__FieldTag::__labels) {
25035                                return std::result::Result::Err(A::Error::duplicate_field(
25036                                    "multiple values for labels",
25037                                ));
25038                            }
25039                            result.labels = map
25040                                .next_value::<std::option::Option<
25041                                    std::collections::HashMap<
25042                                        std::string::String,
25043                                        std::string::String,
25044                                    >,
25045                                >>()?
25046                                .unwrap_or_default();
25047                        }
25048                        __FieldTag::__description => {
25049                            if !fields.insert(__FieldTag::__description) {
25050                                return std::result::Result::Err(A::Error::duplicate_field(
25051                                    "multiple values for description",
25052                                ));
25053                            }
25054                            result.description = map
25055                                .next_value::<std::option::Option<std::string::String>>()?
25056                                .unwrap_or_default();
25057                        }
25058                        __FieldTag::__ip_cidr_range => {
25059                            if !fields.insert(__FieldTag::__ip_cidr_range) {
25060                                return std::result::Result::Err(A::Error::duplicate_field(
25061                                    "multiple values for ip_cidr_range",
25062                                ));
25063                            }
25064                            result.ip_cidr_range = map
25065                                .next_value::<std::option::Option<std::string::String>>()?
25066                                .unwrap_or_default();
25067                        }
25068                        __FieldTag::__network => {
25069                            if !fields.insert(__FieldTag::__network) {
25070                                return std::result::Result::Err(A::Error::duplicate_field(
25071                                    "multiple values for network",
25072                                ));
25073                            }
25074                            result.network = map
25075                                .next_value::<std::option::Option<std::string::String>>()?
25076                                .unwrap_or_default();
25077                        }
25078                        __FieldTag::__usage => {
25079                            if !fields.insert(__FieldTag::__usage) {
25080                                return std::result::Result::Err(A::Error::duplicate_field(
25081                                    "multiple values for usage",
25082                                ));
25083                            }
25084                            result.usage = map.next_value::<std::option::Option<crate::model::internal_range::Usage>>()?.unwrap_or_default();
25085                        }
25086                        __FieldTag::__peering => {
25087                            if !fields.insert(__FieldTag::__peering) {
25088                                return std::result::Result::Err(A::Error::duplicate_field(
25089                                    "multiple values for peering",
25090                                ));
25091                            }
25092                            result.peering = map.next_value::<std::option::Option<crate::model::internal_range::Peering>>()?.unwrap_or_default();
25093                        }
25094                        __FieldTag::__prefix_length => {
25095                            if !fields.insert(__FieldTag::__prefix_length) {
25096                                return std::result::Result::Err(A::Error::duplicate_field(
25097                                    "multiple values for prefix_length",
25098                                ));
25099                            }
25100                            struct __With(std::option::Option<i32>);
25101                            impl<'de> serde::de::Deserialize<'de> for __With {
25102                                fn deserialize<D>(
25103                                    deserializer: D,
25104                                ) -> std::result::Result<Self, D::Error>
25105                                where
25106                                    D: serde::de::Deserializer<'de>,
25107                                {
25108                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
25109                                }
25110                            }
25111                            result.prefix_length =
25112                                map.next_value::<__With>()?.0.unwrap_or_default();
25113                        }
25114                        __FieldTag::__target_cidr_range => {
25115                            if !fields.insert(__FieldTag::__target_cidr_range) {
25116                                return std::result::Result::Err(A::Error::duplicate_field(
25117                                    "multiple values for target_cidr_range",
25118                                ));
25119                            }
25120                            result.target_cidr_range = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
25121                        }
25122                        __FieldTag::__users => {
25123                            if !fields.insert(__FieldTag::__users) {
25124                                return std::result::Result::Err(A::Error::duplicate_field(
25125                                    "multiple values for users",
25126                                ));
25127                            }
25128                            result.users = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
25129                        }
25130                        __FieldTag::__overlaps => {
25131                            if !fields.insert(__FieldTag::__overlaps) {
25132                                return std::result::Result::Err(A::Error::duplicate_field(
25133                                    "multiple values for overlaps",
25134                                ));
25135                            }
25136                            result.overlaps = map
25137                                .next_value::<std::option::Option<
25138                                    std::vec::Vec<crate::model::internal_range::Overlap>,
25139                                >>()?
25140                                .unwrap_or_default();
25141                        }
25142                        __FieldTag::__migration => {
25143                            if !fields.insert(__FieldTag::__migration) {
25144                                return std::result::Result::Err(A::Error::duplicate_field(
25145                                    "multiple values for migration",
25146                                ));
25147                            }
25148                            result.migration = map.next_value::<std::option::Option<crate::model::internal_range::Migration>>()?
25149                                ;
25150                        }
25151                        __FieldTag::__immutable => {
25152                            if !fields.insert(__FieldTag::__immutable) {
25153                                return std::result::Result::Err(A::Error::duplicate_field(
25154                                    "multiple values for immutable",
25155                                ));
25156                            }
25157                            result.immutable = map
25158                                .next_value::<std::option::Option<bool>>()?
25159                                .unwrap_or_default();
25160                        }
25161                        __FieldTag::__allocation_options => {
25162                            if !fields.insert(__FieldTag::__allocation_options) {
25163                                return std::result::Result::Err(A::Error::duplicate_field(
25164                                    "multiple values for allocation_options",
25165                                ));
25166                            }
25167                            result.allocation_options = map.next_value::<std::option::Option<
25168                                crate::model::internal_range::AllocationOptions,
25169                            >>()?;
25170                        }
25171                        __FieldTag::__exclude_cidr_ranges => {
25172                            if !fields.insert(__FieldTag::__exclude_cidr_ranges) {
25173                                return std::result::Result::Err(A::Error::duplicate_field(
25174                                    "multiple values for exclude_cidr_ranges",
25175                                ));
25176                            }
25177                            result.exclude_cidr_ranges = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
25178                        }
25179                        __FieldTag::Unknown(key) => {
25180                            let value = map.next_value::<serde_json::Value>()?;
25181                            result._unknown_fields.insert(key, value);
25182                        }
25183                    }
25184                }
25185                std::result::Result::Ok(result)
25186            }
25187        }
25188        deserializer.deserialize_any(Visitor)
25189    }
25190}
25191
25192#[doc(hidden)]
25193impl serde::ser::Serialize for InternalRange {
25194    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25195    where
25196        S: serde::ser::Serializer,
25197    {
25198        use serde::ser::SerializeMap;
25199        #[allow(unused_imports)]
25200        use std::option::Option::Some;
25201        let mut state = serializer.serialize_map(std::option::Option::None)?;
25202        if !self.name.is_empty() {
25203            state.serialize_entry("name", &self.name)?;
25204        }
25205        if self.create_time.is_some() {
25206            state.serialize_entry("createTime", &self.create_time)?;
25207        }
25208        if self.update_time.is_some() {
25209            state.serialize_entry("updateTime", &self.update_time)?;
25210        }
25211        if !self.labels.is_empty() {
25212            state.serialize_entry("labels", &self.labels)?;
25213        }
25214        if !self.description.is_empty() {
25215            state.serialize_entry("description", &self.description)?;
25216        }
25217        if !self.ip_cidr_range.is_empty() {
25218            state.serialize_entry("ipCidrRange", &self.ip_cidr_range)?;
25219        }
25220        if !self.network.is_empty() {
25221            state.serialize_entry("network", &self.network)?;
25222        }
25223        if !wkt::internal::is_default(&self.usage) {
25224            state.serialize_entry("usage", &self.usage)?;
25225        }
25226        if !wkt::internal::is_default(&self.peering) {
25227            state.serialize_entry("peering", &self.peering)?;
25228        }
25229        if !wkt::internal::is_default(&self.prefix_length) {
25230            struct __With<'a>(&'a i32);
25231            impl<'a> serde::ser::Serialize for __With<'a> {
25232                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25233                where
25234                    S: serde::ser::Serializer,
25235                {
25236                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
25237                }
25238            }
25239            state.serialize_entry("prefixLength", &__With(&self.prefix_length))?;
25240        }
25241        if !self.target_cidr_range.is_empty() {
25242            state.serialize_entry("targetCidrRange", &self.target_cidr_range)?;
25243        }
25244        if !self.users.is_empty() {
25245            state.serialize_entry("users", &self.users)?;
25246        }
25247        if !self.overlaps.is_empty() {
25248            state.serialize_entry("overlaps", &self.overlaps)?;
25249        }
25250        if self.migration.is_some() {
25251            state.serialize_entry("migration", &self.migration)?;
25252        }
25253        if !wkt::internal::is_default(&self.immutable) {
25254            state.serialize_entry("immutable", &self.immutable)?;
25255        }
25256        if self.allocation_options.is_some() {
25257            state.serialize_entry("allocationOptions", &self.allocation_options)?;
25258        }
25259        if !self.exclude_cidr_ranges.is_empty() {
25260            state.serialize_entry("excludeCidrRanges", &self.exclude_cidr_ranges)?;
25261        }
25262        if !self._unknown_fields.is_empty() {
25263            for (key, value) in self._unknown_fields.iter() {
25264                state.serialize_entry(key, &value)?;
25265            }
25266        }
25267        state.end()
25268    }
25269}
25270
25271impl std::fmt::Debug for InternalRange {
25272    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25273        let mut debug_struct = f.debug_struct("InternalRange");
25274        debug_struct.field("name", &self.name);
25275        debug_struct.field("create_time", &self.create_time);
25276        debug_struct.field("update_time", &self.update_time);
25277        debug_struct.field("labels", &self.labels);
25278        debug_struct.field("description", &self.description);
25279        debug_struct.field("ip_cidr_range", &self.ip_cidr_range);
25280        debug_struct.field("network", &self.network);
25281        debug_struct.field("usage", &self.usage);
25282        debug_struct.field("peering", &self.peering);
25283        debug_struct.field("prefix_length", &self.prefix_length);
25284        debug_struct.field("target_cidr_range", &self.target_cidr_range);
25285        debug_struct.field("users", &self.users);
25286        debug_struct.field("overlaps", &self.overlaps);
25287        debug_struct.field("migration", &self.migration);
25288        debug_struct.field("immutable", &self.immutable);
25289        debug_struct.field("allocation_options", &self.allocation_options);
25290        debug_struct.field("exclude_cidr_ranges", &self.exclude_cidr_ranges);
25291        if !self._unknown_fields.is_empty() {
25292            debug_struct.field("_unknown_fields", &self._unknown_fields);
25293        }
25294        debug_struct.finish()
25295    }
25296}
25297
25298/// Defines additional types related to [InternalRange].
25299pub mod internal_range {
25300    #[allow(unused_imports)]
25301    use super::*;
25302
25303    /// Specification for migration with source and target resource names.
25304    #[derive(Clone, Default, PartialEq)]
25305    #[non_exhaustive]
25306    pub struct Migration {
25307        /// Immutable. Resource path as an URI of the source resource, for example a
25308        /// subnet. The project for the source resource should match the project for
25309        /// the InternalRange. An example:
25310        /// /projects/{project}/regions/{region}/subnetworks/{subnet}
25311        pub source: std::string::String,
25312
25313        /// Immutable. Resource path of the target resource. The target project can
25314        /// be different, as in the cases when migrating to peer networks. For
25315        /// example:
25316        /// /projects/{project}/regions/{region}/subnetworks/{subnet}
25317        pub target: std::string::String,
25318
25319        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25320    }
25321
25322    impl Migration {
25323        pub fn new() -> Self {
25324            std::default::Default::default()
25325        }
25326
25327        /// Sets the value of [source][crate::model::internal_range::Migration::source].
25328        pub fn set_source<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25329            self.source = v.into();
25330            self
25331        }
25332
25333        /// Sets the value of [target][crate::model::internal_range::Migration::target].
25334        pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25335            self.target = v.into();
25336            self
25337        }
25338    }
25339
25340    impl wkt::message::Message for Migration {
25341        fn typename() -> &'static str {
25342            "type.googleapis.com/google.cloud.networkconnectivity.v1.InternalRange.Migration"
25343        }
25344    }
25345
25346    #[doc(hidden)]
25347    impl<'de> serde::de::Deserialize<'de> for Migration {
25348        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25349        where
25350            D: serde::Deserializer<'de>,
25351        {
25352            #[allow(non_camel_case_types)]
25353            #[doc(hidden)]
25354            #[derive(PartialEq, Eq, Hash)]
25355            enum __FieldTag {
25356                __source,
25357                __target,
25358                Unknown(std::string::String),
25359            }
25360            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
25361                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25362                where
25363                    D: serde::Deserializer<'de>,
25364                {
25365                    struct Visitor;
25366                    impl<'de> serde::de::Visitor<'de> for Visitor {
25367                        type Value = __FieldTag;
25368                        fn expecting(
25369                            &self,
25370                            formatter: &mut std::fmt::Formatter,
25371                        ) -> std::fmt::Result {
25372                            formatter.write_str("a field name for Migration")
25373                        }
25374                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
25375                        where
25376                            E: serde::de::Error,
25377                        {
25378                            use std::result::Result::Ok;
25379                            use std::string::ToString;
25380                            match value {
25381                                "source" => Ok(__FieldTag::__source),
25382                                "target" => Ok(__FieldTag::__target),
25383                                _ => Ok(__FieldTag::Unknown(value.to_string())),
25384                            }
25385                        }
25386                    }
25387                    deserializer.deserialize_identifier(Visitor)
25388                }
25389            }
25390            struct Visitor;
25391            impl<'de> serde::de::Visitor<'de> for Visitor {
25392                type Value = Migration;
25393                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25394                    formatter.write_str("struct Migration")
25395                }
25396                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
25397                where
25398                    A: serde::de::MapAccess<'de>,
25399                {
25400                    #[allow(unused_imports)]
25401                    use serde::de::Error;
25402                    use std::option::Option::Some;
25403                    let mut fields = std::collections::HashSet::new();
25404                    let mut result = Self::Value::new();
25405                    while let Some(tag) = map.next_key::<__FieldTag>()? {
25406                        #[allow(clippy::match_single_binding)]
25407                        match tag {
25408                            __FieldTag::__source => {
25409                                if !fields.insert(__FieldTag::__source) {
25410                                    return std::result::Result::Err(A::Error::duplicate_field(
25411                                        "multiple values for source",
25412                                    ));
25413                                }
25414                                result.source = map
25415                                    .next_value::<std::option::Option<std::string::String>>()?
25416                                    .unwrap_or_default();
25417                            }
25418                            __FieldTag::__target => {
25419                                if !fields.insert(__FieldTag::__target) {
25420                                    return std::result::Result::Err(A::Error::duplicate_field(
25421                                        "multiple values for target",
25422                                    ));
25423                                }
25424                                result.target = map
25425                                    .next_value::<std::option::Option<std::string::String>>()?
25426                                    .unwrap_or_default();
25427                            }
25428                            __FieldTag::Unknown(key) => {
25429                                let value = map.next_value::<serde_json::Value>()?;
25430                                result._unknown_fields.insert(key, value);
25431                            }
25432                        }
25433                    }
25434                    std::result::Result::Ok(result)
25435                }
25436            }
25437            deserializer.deserialize_any(Visitor)
25438        }
25439    }
25440
25441    #[doc(hidden)]
25442    impl serde::ser::Serialize for Migration {
25443        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25444        where
25445            S: serde::ser::Serializer,
25446        {
25447            use serde::ser::SerializeMap;
25448            #[allow(unused_imports)]
25449            use std::option::Option::Some;
25450            let mut state = serializer.serialize_map(std::option::Option::None)?;
25451            if !self.source.is_empty() {
25452                state.serialize_entry("source", &self.source)?;
25453            }
25454            if !self.target.is_empty() {
25455                state.serialize_entry("target", &self.target)?;
25456            }
25457            if !self._unknown_fields.is_empty() {
25458                for (key, value) in self._unknown_fields.iter() {
25459                    state.serialize_entry(key, &value)?;
25460                }
25461            }
25462            state.end()
25463        }
25464    }
25465
25466    impl std::fmt::Debug for Migration {
25467        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25468            let mut debug_struct = f.debug_struct("Migration");
25469            debug_struct.field("source", &self.source);
25470            debug_struct.field("target", &self.target);
25471            if !self._unknown_fields.is_empty() {
25472                debug_struct.field("_unknown_fields", &self._unknown_fields);
25473            }
25474            debug_struct.finish()
25475        }
25476    }
25477
25478    /// Range auto-allocation options, to be optionally used when CIDR block is not
25479    /// explicitly set.
25480    #[derive(Clone, Default, PartialEq)]
25481    #[non_exhaustive]
25482    pub struct AllocationOptions {
25483        /// Optional. Allocation strategy Not setting this field when the allocation
25484        /// is requested means an implementation defined strategy is used.
25485        pub allocation_strategy: crate::model::internal_range::AllocationStrategy,
25486
25487        /// Optional. This field must be set only when allocation_strategy is set to
25488        /// RANDOM_FIRST_N_AVAILABLE.
25489        /// The value should be the maximum expected parallelism of range creation
25490        /// requests issued to the same space of peered netwroks.
25491        pub first_available_ranges_lookup_size: i32,
25492
25493        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25494    }
25495
25496    impl AllocationOptions {
25497        pub fn new() -> Self {
25498            std::default::Default::default()
25499        }
25500
25501        /// Sets the value of [allocation_strategy][crate::model::internal_range::AllocationOptions::allocation_strategy].
25502        pub fn set_allocation_strategy<
25503            T: std::convert::Into<crate::model::internal_range::AllocationStrategy>,
25504        >(
25505            mut self,
25506            v: T,
25507        ) -> Self {
25508            self.allocation_strategy = v.into();
25509            self
25510        }
25511
25512        /// Sets the value of [first_available_ranges_lookup_size][crate::model::internal_range::AllocationOptions::first_available_ranges_lookup_size].
25513        pub fn set_first_available_ranges_lookup_size<T: std::convert::Into<i32>>(
25514            mut self,
25515            v: T,
25516        ) -> Self {
25517            self.first_available_ranges_lookup_size = v.into();
25518            self
25519        }
25520    }
25521
25522    impl wkt::message::Message for AllocationOptions {
25523        fn typename() -> &'static str {
25524            "type.googleapis.com/google.cloud.networkconnectivity.v1.InternalRange.AllocationOptions"
25525        }
25526    }
25527
25528    #[doc(hidden)]
25529    impl<'de> serde::de::Deserialize<'de> for AllocationOptions {
25530        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25531        where
25532            D: serde::Deserializer<'de>,
25533        {
25534            #[allow(non_camel_case_types)]
25535            #[doc(hidden)]
25536            #[derive(PartialEq, Eq, Hash)]
25537            enum __FieldTag {
25538                __allocation_strategy,
25539                __first_available_ranges_lookup_size,
25540                Unknown(std::string::String),
25541            }
25542            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
25543                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25544                where
25545                    D: serde::Deserializer<'de>,
25546                {
25547                    struct Visitor;
25548                    impl<'de> serde::de::Visitor<'de> for Visitor {
25549                        type Value = __FieldTag;
25550                        fn expecting(
25551                            &self,
25552                            formatter: &mut std::fmt::Formatter,
25553                        ) -> std::fmt::Result {
25554                            formatter.write_str("a field name for AllocationOptions")
25555                        }
25556                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
25557                        where
25558                            E: serde::de::Error,
25559                        {
25560                            use std::result::Result::Ok;
25561                            use std::string::ToString;
25562                            match value {
25563                                "allocationStrategy" => Ok(__FieldTag::__allocation_strategy),
25564                                "allocation_strategy" => Ok(__FieldTag::__allocation_strategy),
25565                                "firstAvailableRangesLookupSize" => {
25566                                    Ok(__FieldTag::__first_available_ranges_lookup_size)
25567                                }
25568                                "first_available_ranges_lookup_size" => {
25569                                    Ok(__FieldTag::__first_available_ranges_lookup_size)
25570                                }
25571                                _ => Ok(__FieldTag::Unknown(value.to_string())),
25572                            }
25573                        }
25574                    }
25575                    deserializer.deserialize_identifier(Visitor)
25576                }
25577            }
25578            struct Visitor;
25579            impl<'de> serde::de::Visitor<'de> for Visitor {
25580                type Value = AllocationOptions;
25581                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
25582                    formatter.write_str("struct AllocationOptions")
25583                }
25584                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
25585                where
25586                    A: serde::de::MapAccess<'de>,
25587                {
25588                    #[allow(unused_imports)]
25589                    use serde::de::Error;
25590                    use std::option::Option::Some;
25591                    let mut fields = std::collections::HashSet::new();
25592                    let mut result = Self::Value::new();
25593                    while let Some(tag) = map.next_key::<__FieldTag>()? {
25594                        #[allow(clippy::match_single_binding)]
25595                        match tag {
25596                            __FieldTag::__allocation_strategy => {
25597                                if !fields.insert(__FieldTag::__allocation_strategy) {
25598                                    return std::result::Result::Err(A::Error::duplicate_field(
25599                                        "multiple values for allocation_strategy",
25600                                    ));
25601                                }
25602                                result.allocation_strategy = map
25603                                    .next_value::<std::option::Option<
25604                                        crate::model::internal_range::AllocationStrategy,
25605                                    >>()?
25606                                    .unwrap_or_default();
25607                            }
25608                            __FieldTag::__first_available_ranges_lookup_size => {
25609                                if !fields.insert(__FieldTag::__first_available_ranges_lookup_size)
25610                                {
25611                                    return std::result::Result::Err(A::Error::duplicate_field(
25612                                        "multiple values for first_available_ranges_lookup_size",
25613                                    ));
25614                                }
25615                                struct __With(std::option::Option<i32>);
25616                                impl<'de> serde::de::Deserialize<'de> for __With {
25617                                    fn deserialize<D>(
25618                                        deserializer: D,
25619                                    ) -> std::result::Result<Self, D::Error>
25620                                    where
25621                                        D: serde::de::Deserializer<'de>,
25622                                    {
25623                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
25624                                    }
25625                                }
25626                                result.first_available_ranges_lookup_size =
25627                                    map.next_value::<__With>()?.0.unwrap_or_default();
25628                            }
25629                            __FieldTag::Unknown(key) => {
25630                                let value = map.next_value::<serde_json::Value>()?;
25631                                result._unknown_fields.insert(key, value);
25632                            }
25633                        }
25634                    }
25635                    std::result::Result::Ok(result)
25636                }
25637            }
25638            deserializer.deserialize_any(Visitor)
25639        }
25640    }
25641
25642    #[doc(hidden)]
25643    impl serde::ser::Serialize for AllocationOptions {
25644        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25645        where
25646            S: serde::ser::Serializer,
25647        {
25648            use serde::ser::SerializeMap;
25649            #[allow(unused_imports)]
25650            use std::option::Option::Some;
25651            let mut state = serializer.serialize_map(std::option::Option::None)?;
25652            if !wkt::internal::is_default(&self.allocation_strategy) {
25653                state.serialize_entry("allocationStrategy", &self.allocation_strategy)?;
25654            }
25655            if !wkt::internal::is_default(&self.first_available_ranges_lookup_size) {
25656                struct __With<'a>(&'a i32);
25657                impl<'a> serde::ser::Serialize for __With<'a> {
25658                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25659                    where
25660                        S: serde::ser::Serializer,
25661                    {
25662                        serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
25663                    }
25664                }
25665                state.serialize_entry(
25666                    "firstAvailableRangesLookupSize",
25667                    &__With(&self.first_available_ranges_lookup_size),
25668                )?;
25669            }
25670            if !self._unknown_fields.is_empty() {
25671                for (key, value) in self._unknown_fields.iter() {
25672                    state.serialize_entry(key, &value)?;
25673                }
25674            }
25675            state.end()
25676        }
25677    }
25678
25679    impl std::fmt::Debug for AllocationOptions {
25680        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25681            let mut debug_struct = f.debug_struct("AllocationOptions");
25682            debug_struct.field("allocation_strategy", &self.allocation_strategy);
25683            debug_struct.field(
25684                "first_available_ranges_lookup_size",
25685                &self.first_available_ranges_lookup_size,
25686            );
25687            if !self._unknown_fields.is_empty() {
25688                debug_struct.field("_unknown_fields", &self._unknown_fields);
25689            }
25690            debug_struct.finish()
25691        }
25692    }
25693
25694    /// Possible usage of an internal range.
25695    ///
25696    /// # Working with unknown values
25697    ///
25698    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25699    /// additional enum variants at any time. Adding new variants is not considered
25700    /// a breaking change. Applications should write their code in anticipation of:
25701    ///
25702    /// - New values appearing in future releases of the client library, **and**
25703    /// - New values received dynamically, without application changes.
25704    ///
25705    /// Please consult the [Working with enums] section in the user guide for some
25706    /// guidelines.
25707    ///
25708    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
25709    #[derive(Clone, Debug, PartialEq)]
25710    #[non_exhaustive]
25711    pub enum Usage {
25712        /// Unspecified usage is allowed in calls which identify the resource by
25713        /// other fields and do not need Usage set to complete. These are, i.e.:
25714        /// GetInternalRange and DeleteInternalRange.
25715        /// Usage needs to be specified explicitly in CreateInternalRange
25716        /// or UpdateInternalRange calls.
25717        Unspecified,
25718        /// A VPC resource can use the reserved CIDR block by associating it with the
25719        /// internal range resource if usage is set to FOR_VPC.
25720        ForVpc,
25721        /// Ranges created with EXTERNAL_TO_VPC cannot be associated with VPC
25722        /// resources and are meant to block out address ranges for various use
25723        /// cases, like for example, usage on-prem, with dynamic route announcements
25724        /// via interconnect.
25725        ExternalToVpc,
25726        /// Ranges created FOR_MIGRATION can be used to lock a CIDR range between a
25727        /// source and target subnet. If usage is set to FOR_MIGRATION, the peering
25728        /// value has to be set to FOR_SELF or default to FOR_SELF when unset.
25729        ForMigration,
25730        /// If set, the enum was initialized with an unknown value.
25731        ///
25732        /// Applications can examine the value using [Usage::value] or
25733        /// [Usage::name].
25734        UnknownValue(usage::UnknownValue),
25735    }
25736
25737    #[doc(hidden)]
25738    pub mod usage {
25739        #[allow(unused_imports)]
25740        use super::*;
25741        #[derive(Clone, Debug, PartialEq)]
25742        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25743    }
25744
25745    impl Usage {
25746        /// Gets the enum value.
25747        ///
25748        /// Returns `None` if the enum contains an unknown value deserialized from
25749        /// the string representation of enums.
25750        pub fn value(&self) -> std::option::Option<i32> {
25751            match self {
25752                Self::Unspecified => std::option::Option::Some(0),
25753                Self::ForVpc => std::option::Option::Some(1),
25754                Self::ExternalToVpc => std::option::Option::Some(2),
25755                Self::ForMigration => std::option::Option::Some(3),
25756                Self::UnknownValue(u) => u.0.value(),
25757            }
25758        }
25759
25760        /// Gets the enum value as a string.
25761        ///
25762        /// Returns `None` if the enum contains an unknown value deserialized from
25763        /// the integer representation of enums.
25764        pub fn name(&self) -> std::option::Option<&str> {
25765            match self {
25766                Self::Unspecified => std::option::Option::Some("USAGE_UNSPECIFIED"),
25767                Self::ForVpc => std::option::Option::Some("FOR_VPC"),
25768                Self::ExternalToVpc => std::option::Option::Some("EXTERNAL_TO_VPC"),
25769                Self::ForMigration => std::option::Option::Some("FOR_MIGRATION"),
25770                Self::UnknownValue(u) => u.0.name(),
25771            }
25772        }
25773    }
25774
25775    impl std::default::Default for Usage {
25776        fn default() -> Self {
25777            use std::convert::From;
25778            Self::from(0)
25779        }
25780    }
25781
25782    impl std::fmt::Display for Usage {
25783        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25784            wkt::internal::display_enum(f, self.name(), self.value())
25785        }
25786    }
25787
25788    impl std::convert::From<i32> for Usage {
25789        fn from(value: i32) -> Self {
25790            match value {
25791                0 => Self::Unspecified,
25792                1 => Self::ForVpc,
25793                2 => Self::ExternalToVpc,
25794                3 => Self::ForMigration,
25795                _ => Self::UnknownValue(usage::UnknownValue(
25796                    wkt::internal::UnknownEnumValue::Integer(value),
25797                )),
25798            }
25799        }
25800    }
25801
25802    impl std::convert::From<&str> for Usage {
25803        fn from(value: &str) -> Self {
25804            use std::string::ToString;
25805            match value {
25806                "USAGE_UNSPECIFIED" => Self::Unspecified,
25807                "FOR_VPC" => Self::ForVpc,
25808                "EXTERNAL_TO_VPC" => Self::ExternalToVpc,
25809                "FOR_MIGRATION" => Self::ForMigration,
25810                _ => Self::UnknownValue(usage::UnknownValue(
25811                    wkt::internal::UnknownEnumValue::String(value.to_string()),
25812                )),
25813            }
25814        }
25815    }
25816
25817    impl serde::ser::Serialize for Usage {
25818        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25819        where
25820            S: serde::Serializer,
25821        {
25822            match self {
25823                Self::Unspecified => serializer.serialize_i32(0),
25824                Self::ForVpc => serializer.serialize_i32(1),
25825                Self::ExternalToVpc => serializer.serialize_i32(2),
25826                Self::ForMigration => serializer.serialize_i32(3),
25827                Self::UnknownValue(u) => u.0.serialize(serializer),
25828            }
25829        }
25830    }
25831
25832    impl<'de> serde::de::Deserialize<'de> for Usage {
25833        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25834        where
25835            D: serde::Deserializer<'de>,
25836        {
25837            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Usage>::new(
25838                ".google.cloud.networkconnectivity.v1.InternalRange.Usage",
25839            ))
25840        }
25841    }
25842
25843    /// Peering type.
25844    ///
25845    /// # Working with unknown values
25846    ///
25847    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25848    /// additional enum variants at any time. Adding new variants is not considered
25849    /// a breaking change. Applications should write their code in anticipation of:
25850    ///
25851    /// - New values appearing in future releases of the client library, **and**
25852    /// - New values received dynamically, without application changes.
25853    ///
25854    /// Please consult the [Working with enums] section in the user guide for some
25855    /// guidelines.
25856    ///
25857    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
25858    #[derive(Clone, Debug, PartialEq)]
25859    #[non_exhaustive]
25860    pub enum Peering {
25861        /// If Peering is left unspecified in CreateInternalRange or
25862        /// UpdateInternalRange, it will be defaulted to FOR_SELF.
25863        Unspecified,
25864        /// This is the default behavior and represents the case that this
25865        /// internal range is intended to be used in the VPC in which it is created
25866        /// and is accessible from its peers. This implies that peers or
25867        /// peers-of-peers cannot use this range.
25868        ForSelf,
25869        /// This behavior can be set when the internal range is being reserved for
25870        /// usage by peers. This means that no resource within the VPC in which
25871        /// it is being created can use this to associate with a VPC resource, but
25872        /// one of the peers can. This represents donating a range for peers to
25873        /// use.
25874        ForPeer,
25875        /// This behavior can be set when the internal range is being reserved for
25876        /// usage by the VPC in which it is created, but not shared with peers.
25877        /// In a sense, it is local to the VPC. This can be used to create internal
25878        /// ranges for various purposes like HTTP_INTERNAL_LOAD_BALANCER or for
25879        /// Interconnect routes that are not shared with peers. This also implies
25880        /// that peers cannot use this range in a way that is visible to this VPC,
25881        /// but can re-use this range as long as it is NOT_SHARED from the peer VPC,
25882        /// too.
25883        NotShared,
25884        /// If set, the enum was initialized with an unknown value.
25885        ///
25886        /// Applications can examine the value using [Peering::value] or
25887        /// [Peering::name].
25888        UnknownValue(peering::UnknownValue),
25889    }
25890
25891    #[doc(hidden)]
25892    pub mod peering {
25893        #[allow(unused_imports)]
25894        use super::*;
25895        #[derive(Clone, Debug, PartialEq)]
25896        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25897    }
25898
25899    impl Peering {
25900        /// Gets the enum value.
25901        ///
25902        /// Returns `None` if the enum contains an unknown value deserialized from
25903        /// the string representation of enums.
25904        pub fn value(&self) -> std::option::Option<i32> {
25905            match self {
25906                Self::Unspecified => std::option::Option::Some(0),
25907                Self::ForSelf => std::option::Option::Some(1),
25908                Self::ForPeer => std::option::Option::Some(2),
25909                Self::NotShared => std::option::Option::Some(3),
25910                Self::UnknownValue(u) => u.0.value(),
25911            }
25912        }
25913
25914        /// Gets the enum value as a string.
25915        ///
25916        /// Returns `None` if the enum contains an unknown value deserialized from
25917        /// the integer representation of enums.
25918        pub fn name(&self) -> std::option::Option<&str> {
25919            match self {
25920                Self::Unspecified => std::option::Option::Some("PEERING_UNSPECIFIED"),
25921                Self::ForSelf => std::option::Option::Some("FOR_SELF"),
25922                Self::ForPeer => std::option::Option::Some("FOR_PEER"),
25923                Self::NotShared => std::option::Option::Some("NOT_SHARED"),
25924                Self::UnknownValue(u) => u.0.name(),
25925            }
25926        }
25927    }
25928
25929    impl std::default::Default for Peering {
25930        fn default() -> Self {
25931            use std::convert::From;
25932            Self::from(0)
25933        }
25934    }
25935
25936    impl std::fmt::Display for Peering {
25937        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25938            wkt::internal::display_enum(f, self.name(), self.value())
25939        }
25940    }
25941
25942    impl std::convert::From<i32> for Peering {
25943        fn from(value: i32) -> Self {
25944            match value {
25945                0 => Self::Unspecified,
25946                1 => Self::ForSelf,
25947                2 => Self::ForPeer,
25948                3 => Self::NotShared,
25949                _ => Self::UnknownValue(peering::UnknownValue(
25950                    wkt::internal::UnknownEnumValue::Integer(value),
25951                )),
25952            }
25953        }
25954    }
25955
25956    impl std::convert::From<&str> for Peering {
25957        fn from(value: &str) -> Self {
25958            use std::string::ToString;
25959            match value {
25960                "PEERING_UNSPECIFIED" => Self::Unspecified,
25961                "FOR_SELF" => Self::ForSelf,
25962                "FOR_PEER" => Self::ForPeer,
25963                "NOT_SHARED" => Self::NotShared,
25964                _ => Self::UnknownValue(peering::UnknownValue(
25965                    wkt::internal::UnknownEnumValue::String(value.to_string()),
25966                )),
25967            }
25968        }
25969    }
25970
25971    impl serde::ser::Serialize for Peering {
25972        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25973        where
25974            S: serde::Serializer,
25975        {
25976            match self {
25977                Self::Unspecified => serializer.serialize_i32(0),
25978                Self::ForSelf => serializer.serialize_i32(1),
25979                Self::ForPeer => serializer.serialize_i32(2),
25980                Self::NotShared => serializer.serialize_i32(3),
25981                Self::UnknownValue(u) => u.0.serialize(serializer),
25982            }
25983        }
25984    }
25985
25986    impl<'de> serde::de::Deserialize<'de> for Peering {
25987        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25988        where
25989            D: serde::Deserializer<'de>,
25990        {
25991            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Peering>::new(
25992                ".google.cloud.networkconnectivity.v1.InternalRange.Peering",
25993            ))
25994        }
25995    }
25996
25997    /// Overlap specifications.
25998    ///
25999    /// # Working with unknown values
26000    ///
26001    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
26002    /// additional enum variants at any time. Adding new variants is not considered
26003    /// a breaking change. Applications should write their code in anticipation of:
26004    ///
26005    /// - New values appearing in future releases of the client library, **and**
26006    /// - New values received dynamically, without application changes.
26007    ///
26008    /// Please consult the [Working with enums] section in the user guide for some
26009    /// guidelines.
26010    ///
26011    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
26012    #[derive(Clone, Debug, PartialEq)]
26013    #[non_exhaustive]
26014    pub enum Overlap {
26015        /// No overlap overrides.
26016        Unspecified,
26017        /// Allow creation of static routes more specific that the current
26018        /// internal range.
26019        RouteRange,
26020        /// Allow creation of internal ranges that overlap with existing subnets.
26021        ExistingSubnetRange,
26022        /// If set, the enum was initialized with an unknown value.
26023        ///
26024        /// Applications can examine the value using [Overlap::value] or
26025        /// [Overlap::name].
26026        UnknownValue(overlap::UnknownValue),
26027    }
26028
26029    #[doc(hidden)]
26030    pub mod overlap {
26031        #[allow(unused_imports)]
26032        use super::*;
26033        #[derive(Clone, Debug, PartialEq)]
26034        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
26035    }
26036
26037    impl Overlap {
26038        /// Gets the enum value.
26039        ///
26040        /// Returns `None` if the enum contains an unknown value deserialized from
26041        /// the string representation of enums.
26042        pub fn value(&self) -> std::option::Option<i32> {
26043            match self {
26044                Self::Unspecified => std::option::Option::Some(0),
26045                Self::RouteRange => std::option::Option::Some(1),
26046                Self::ExistingSubnetRange => std::option::Option::Some(2),
26047                Self::UnknownValue(u) => u.0.value(),
26048            }
26049        }
26050
26051        /// Gets the enum value as a string.
26052        ///
26053        /// Returns `None` if the enum contains an unknown value deserialized from
26054        /// the integer representation of enums.
26055        pub fn name(&self) -> std::option::Option<&str> {
26056            match self {
26057                Self::Unspecified => std::option::Option::Some("OVERLAP_UNSPECIFIED"),
26058                Self::RouteRange => std::option::Option::Some("OVERLAP_ROUTE_RANGE"),
26059                Self::ExistingSubnetRange => {
26060                    std::option::Option::Some("OVERLAP_EXISTING_SUBNET_RANGE")
26061                }
26062                Self::UnknownValue(u) => u.0.name(),
26063            }
26064        }
26065    }
26066
26067    impl std::default::Default for Overlap {
26068        fn default() -> Self {
26069            use std::convert::From;
26070            Self::from(0)
26071        }
26072    }
26073
26074    impl std::fmt::Display for Overlap {
26075        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
26076            wkt::internal::display_enum(f, self.name(), self.value())
26077        }
26078    }
26079
26080    impl std::convert::From<i32> for Overlap {
26081        fn from(value: i32) -> Self {
26082            match value {
26083                0 => Self::Unspecified,
26084                1 => Self::RouteRange,
26085                2 => Self::ExistingSubnetRange,
26086                _ => Self::UnknownValue(overlap::UnknownValue(
26087                    wkt::internal::UnknownEnumValue::Integer(value),
26088                )),
26089            }
26090        }
26091    }
26092
26093    impl std::convert::From<&str> for Overlap {
26094        fn from(value: &str) -> Self {
26095            use std::string::ToString;
26096            match value {
26097                "OVERLAP_UNSPECIFIED" => Self::Unspecified,
26098                "OVERLAP_ROUTE_RANGE" => Self::RouteRange,
26099                "OVERLAP_EXISTING_SUBNET_RANGE" => Self::ExistingSubnetRange,
26100                _ => Self::UnknownValue(overlap::UnknownValue(
26101                    wkt::internal::UnknownEnumValue::String(value.to_string()),
26102                )),
26103            }
26104        }
26105    }
26106
26107    impl serde::ser::Serialize for Overlap {
26108        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26109        where
26110            S: serde::Serializer,
26111        {
26112            match self {
26113                Self::Unspecified => serializer.serialize_i32(0),
26114                Self::RouteRange => serializer.serialize_i32(1),
26115                Self::ExistingSubnetRange => serializer.serialize_i32(2),
26116                Self::UnknownValue(u) => u.0.serialize(serializer),
26117            }
26118        }
26119    }
26120
26121    impl<'de> serde::de::Deserialize<'de> for Overlap {
26122        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26123        where
26124            D: serde::Deserializer<'de>,
26125        {
26126            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Overlap>::new(
26127                ".google.cloud.networkconnectivity.v1.InternalRange.Overlap",
26128            ))
26129        }
26130    }
26131
26132    /// Enumeration of range auto-allocation strategies
26133    ///
26134    /// # Working with unknown values
26135    ///
26136    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
26137    /// additional enum variants at any time. Adding new variants is not considered
26138    /// a breaking change. Applications should write their code in anticipation of:
26139    ///
26140    /// - New values appearing in future releases of the client library, **and**
26141    /// - New values received dynamically, without application changes.
26142    ///
26143    /// Please consult the [Working with enums] section in the user guide for some
26144    /// guidelines.
26145    ///
26146    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
26147    #[derive(Clone, Debug, PartialEq)]
26148    #[non_exhaustive]
26149    pub enum AllocationStrategy {
26150        /// Unspecified is the only valid option when the range is specified
26151        /// explicitly by ip_cidr_range field. Otherwise unspefified means using the
26152        /// default strategy.
26153        Unspecified,
26154        /// Random strategy, the legacy algorithm, used for backwards compatibility.
26155        /// This allocation strategy remains efficient in the case of concurrent
26156        /// allocation requests in the same peered network space and doesn't require
26157        /// providing the level of concurrency in an explicit parameter, but it is
26158        /// prone to fragmenting available address space.
26159        Random,
26160        /// Pick the first available address range. This strategy is deterministic
26161        /// and the result is easy to predict.
26162        FirstAvailable,
26163        /// Pick an arbitrary range out of the first N available ones. The N will be
26164        /// set in the first_available_ranges_lookup_size field. This strategy should
26165        /// be used when concurrent allocation requests are made in the same space of
26166        /// peered networks while the fragmentation of the addrress space is reduced.
26167        RandomFirstNAvailable,
26168        /// Pick the smallest but fitting available range. This deterministic
26169        /// strategy minimizes fragmentation of the address space.
26170        FirstSmallestFitting,
26171        /// If set, the enum was initialized with an unknown value.
26172        ///
26173        /// Applications can examine the value using [AllocationStrategy::value] or
26174        /// [AllocationStrategy::name].
26175        UnknownValue(allocation_strategy::UnknownValue),
26176    }
26177
26178    #[doc(hidden)]
26179    pub mod allocation_strategy {
26180        #[allow(unused_imports)]
26181        use super::*;
26182        #[derive(Clone, Debug, PartialEq)]
26183        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
26184    }
26185
26186    impl AllocationStrategy {
26187        /// Gets the enum value.
26188        ///
26189        /// Returns `None` if the enum contains an unknown value deserialized from
26190        /// the string representation of enums.
26191        pub fn value(&self) -> std::option::Option<i32> {
26192            match self {
26193                Self::Unspecified => std::option::Option::Some(0),
26194                Self::Random => std::option::Option::Some(1),
26195                Self::FirstAvailable => std::option::Option::Some(2),
26196                Self::RandomFirstNAvailable => std::option::Option::Some(3),
26197                Self::FirstSmallestFitting => std::option::Option::Some(4),
26198                Self::UnknownValue(u) => u.0.value(),
26199            }
26200        }
26201
26202        /// Gets the enum value as a string.
26203        ///
26204        /// Returns `None` if the enum contains an unknown value deserialized from
26205        /// the integer representation of enums.
26206        pub fn name(&self) -> std::option::Option<&str> {
26207            match self {
26208                Self::Unspecified => std::option::Option::Some("ALLOCATION_STRATEGY_UNSPECIFIED"),
26209                Self::Random => std::option::Option::Some("RANDOM"),
26210                Self::FirstAvailable => std::option::Option::Some("FIRST_AVAILABLE"),
26211                Self::RandomFirstNAvailable => {
26212                    std::option::Option::Some("RANDOM_FIRST_N_AVAILABLE")
26213                }
26214                Self::FirstSmallestFitting => std::option::Option::Some("FIRST_SMALLEST_FITTING"),
26215                Self::UnknownValue(u) => u.0.name(),
26216            }
26217        }
26218    }
26219
26220    impl std::default::Default for AllocationStrategy {
26221        fn default() -> Self {
26222            use std::convert::From;
26223            Self::from(0)
26224        }
26225    }
26226
26227    impl std::fmt::Display for AllocationStrategy {
26228        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
26229            wkt::internal::display_enum(f, self.name(), self.value())
26230        }
26231    }
26232
26233    impl std::convert::From<i32> for AllocationStrategy {
26234        fn from(value: i32) -> Self {
26235            match value {
26236                0 => Self::Unspecified,
26237                1 => Self::Random,
26238                2 => Self::FirstAvailable,
26239                3 => Self::RandomFirstNAvailable,
26240                4 => Self::FirstSmallestFitting,
26241                _ => Self::UnknownValue(allocation_strategy::UnknownValue(
26242                    wkt::internal::UnknownEnumValue::Integer(value),
26243                )),
26244            }
26245        }
26246    }
26247
26248    impl std::convert::From<&str> for AllocationStrategy {
26249        fn from(value: &str) -> Self {
26250            use std::string::ToString;
26251            match value {
26252                "ALLOCATION_STRATEGY_UNSPECIFIED" => Self::Unspecified,
26253                "RANDOM" => Self::Random,
26254                "FIRST_AVAILABLE" => Self::FirstAvailable,
26255                "RANDOM_FIRST_N_AVAILABLE" => Self::RandomFirstNAvailable,
26256                "FIRST_SMALLEST_FITTING" => Self::FirstSmallestFitting,
26257                _ => Self::UnknownValue(allocation_strategy::UnknownValue(
26258                    wkt::internal::UnknownEnumValue::String(value.to_string()),
26259                )),
26260            }
26261        }
26262    }
26263
26264    impl serde::ser::Serialize for AllocationStrategy {
26265        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26266        where
26267            S: serde::Serializer,
26268        {
26269            match self {
26270                Self::Unspecified => serializer.serialize_i32(0),
26271                Self::Random => serializer.serialize_i32(1),
26272                Self::FirstAvailable => serializer.serialize_i32(2),
26273                Self::RandomFirstNAvailable => serializer.serialize_i32(3),
26274                Self::FirstSmallestFitting => serializer.serialize_i32(4),
26275                Self::UnknownValue(u) => u.0.serialize(serializer),
26276            }
26277        }
26278    }
26279
26280    impl<'de> serde::de::Deserialize<'de> for AllocationStrategy {
26281        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26282        where
26283            D: serde::Deserializer<'de>,
26284        {
26285            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AllocationStrategy>::new(
26286                ".google.cloud.networkconnectivity.v1.InternalRange.AllocationStrategy",
26287            ))
26288        }
26289    }
26290}
26291
26292/// Request for InternalRangeService.ListInternalRanges
26293#[derive(Clone, Default, PartialEq)]
26294#[non_exhaustive]
26295pub struct ListInternalRangesRequest {
26296    /// Required. The parent resource's name.
26297    pub parent: std::string::String,
26298
26299    /// The maximum number of results per page that should be returned.
26300    pub page_size: i32,
26301
26302    /// The page token.
26303    pub page_token: std::string::String,
26304
26305    /// A filter expression that filters the results listed in the response.
26306    pub filter: std::string::String,
26307
26308    /// Sort the results by a certain order.
26309    pub order_by: std::string::String,
26310
26311    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26312}
26313
26314impl ListInternalRangesRequest {
26315    pub fn new() -> Self {
26316        std::default::Default::default()
26317    }
26318
26319    /// Sets the value of [parent][crate::model::ListInternalRangesRequest::parent].
26320    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26321        self.parent = v.into();
26322        self
26323    }
26324
26325    /// Sets the value of [page_size][crate::model::ListInternalRangesRequest::page_size].
26326    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26327        self.page_size = v.into();
26328        self
26329    }
26330
26331    /// Sets the value of [page_token][crate::model::ListInternalRangesRequest::page_token].
26332    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26333        self.page_token = v.into();
26334        self
26335    }
26336
26337    /// Sets the value of [filter][crate::model::ListInternalRangesRequest::filter].
26338    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26339        self.filter = v.into();
26340        self
26341    }
26342
26343    /// Sets the value of [order_by][crate::model::ListInternalRangesRequest::order_by].
26344    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26345        self.order_by = v.into();
26346        self
26347    }
26348}
26349
26350impl wkt::message::Message for ListInternalRangesRequest {
26351    fn typename() -> &'static str {
26352        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListInternalRangesRequest"
26353    }
26354}
26355
26356#[doc(hidden)]
26357impl<'de> serde::de::Deserialize<'de> for ListInternalRangesRequest {
26358    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26359    where
26360        D: serde::Deserializer<'de>,
26361    {
26362        #[allow(non_camel_case_types)]
26363        #[doc(hidden)]
26364        #[derive(PartialEq, Eq, Hash)]
26365        enum __FieldTag {
26366            __parent,
26367            __page_size,
26368            __page_token,
26369            __filter,
26370            __order_by,
26371            Unknown(std::string::String),
26372        }
26373        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
26374            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26375            where
26376                D: serde::Deserializer<'de>,
26377            {
26378                struct Visitor;
26379                impl<'de> serde::de::Visitor<'de> for Visitor {
26380                    type Value = __FieldTag;
26381                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26382                        formatter.write_str("a field name for ListInternalRangesRequest")
26383                    }
26384                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
26385                    where
26386                        E: serde::de::Error,
26387                    {
26388                        use std::result::Result::Ok;
26389                        use std::string::ToString;
26390                        match value {
26391                            "parent" => Ok(__FieldTag::__parent),
26392                            "pageSize" => Ok(__FieldTag::__page_size),
26393                            "page_size" => Ok(__FieldTag::__page_size),
26394                            "pageToken" => Ok(__FieldTag::__page_token),
26395                            "page_token" => Ok(__FieldTag::__page_token),
26396                            "filter" => Ok(__FieldTag::__filter),
26397                            "orderBy" => Ok(__FieldTag::__order_by),
26398                            "order_by" => Ok(__FieldTag::__order_by),
26399                            _ => Ok(__FieldTag::Unknown(value.to_string())),
26400                        }
26401                    }
26402                }
26403                deserializer.deserialize_identifier(Visitor)
26404            }
26405        }
26406        struct Visitor;
26407        impl<'de> serde::de::Visitor<'de> for Visitor {
26408            type Value = ListInternalRangesRequest;
26409            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26410                formatter.write_str("struct ListInternalRangesRequest")
26411            }
26412            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
26413            where
26414                A: serde::de::MapAccess<'de>,
26415            {
26416                #[allow(unused_imports)]
26417                use serde::de::Error;
26418                use std::option::Option::Some;
26419                let mut fields = std::collections::HashSet::new();
26420                let mut result = Self::Value::new();
26421                while let Some(tag) = map.next_key::<__FieldTag>()? {
26422                    #[allow(clippy::match_single_binding)]
26423                    match tag {
26424                        __FieldTag::__parent => {
26425                            if !fields.insert(__FieldTag::__parent) {
26426                                return std::result::Result::Err(A::Error::duplicate_field(
26427                                    "multiple values for parent",
26428                                ));
26429                            }
26430                            result.parent = map
26431                                .next_value::<std::option::Option<std::string::String>>()?
26432                                .unwrap_or_default();
26433                        }
26434                        __FieldTag::__page_size => {
26435                            if !fields.insert(__FieldTag::__page_size) {
26436                                return std::result::Result::Err(A::Error::duplicate_field(
26437                                    "multiple values for page_size",
26438                                ));
26439                            }
26440                            struct __With(std::option::Option<i32>);
26441                            impl<'de> serde::de::Deserialize<'de> for __With {
26442                                fn deserialize<D>(
26443                                    deserializer: D,
26444                                ) -> std::result::Result<Self, D::Error>
26445                                where
26446                                    D: serde::de::Deserializer<'de>,
26447                                {
26448                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
26449                                }
26450                            }
26451                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
26452                        }
26453                        __FieldTag::__page_token => {
26454                            if !fields.insert(__FieldTag::__page_token) {
26455                                return std::result::Result::Err(A::Error::duplicate_field(
26456                                    "multiple values for page_token",
26457                                ));
26458                            }
26459                            result.page_token = map
26460                                .next_value::<std::option::Option<std::string::String>>()?
26461                                .unwrap_or_default();
26462                        }
26463                        __FieldTag::__filter => {
26464                            if !fields.insert(__FieldTag::__filter) {
26465                                return std::result::Result::Err(A::Error::duplicate_field(
26466                                    "multiple values for filter",
26467                                ));
26468                            }
26469                            result.filter = map
26470                                .next_value::<std::option::Option<std::string::String>>()?
26471                                .unwrap_or_default();
26472                        }
26473                        __FieldTag::__order_by => {
26474                            if !fields.insert(__FieldTag::__order_by) {
26475                                return std::result::Result::Err(A::Error::duplicate_field(
26476                                    "multiple values for order_by",
26477                                ));
26478                            }
26479                            result.order_by = map
26480                                .next_value::<std::option::Option<std::string::String>>()?
26481                                .unwrap_or_default();
26482                        }
26483                        __FieldTag::Unknown(key) => {
26484                            let value = map.next_value::<serde_json::Value>()?;
26485                            result._unknown_fields.insert(key, value);
26486                        }
26487                    }
26488                }
26489                std::result::Result::Ok(result)
26490            }
26491        }
26492        deserializer.deserialize_any(Visitor)
26493    }
26494}
26495
26496#[doc(hidden)]
26497impl serde::ser::Serialize for ListInternalRangesRequest {
26498    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26499    where
26500        S: serde::ser::Serializer,
26501    {
26502        use serde::ser::SerializeMap;
26503        #[allow(unused_imports)]
26504        use std::option::Option::Some;
26505        let mut state = serializer.serialize_map(std::option::Option::None)?;
26506        if !self.parent.is_empty() {
26507            state.serialize_entry("parent", &self.parent)?;
26508        }
26509        if !wkt::internal::is_default(&self.page_size) {
26510            struct __With<'a>(&'a i32);
26511            impl<'a> serde::ser::Serialize for __With<'a> {
26512                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26513                where
26514                    S: serde::ser::Serializer,
26515                {
26516                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
26517                }
26518            }
26519            state.serialize_entry("pageSize", &__With(&self.page_size))?;
26520        }
26521        if !self.page_token.is_empty() {
26522            state.serialize_entry("pageToken", &self.page_token)?;
26523        }
26524        if !self.filter.is_empty() {
26525            state.serialize_entry("filter", &self.filter)?;
26526        }
26527        if !self.order_by.is_empty() {
26528            state.serialize_entry("orderBy", &self.order_by)?;
26529        }
26530        if !self._unknown_fields.is_empty() {
26531            for (key, value) in self._unknown_fields.iter() {
26532                state.serialize_entry(key, &value)?;
26533            }
26534        }
26535        state.end()
26536    }
26537}
26538
26539impl std::fmt::Debug for ListInternalRangesRequest {
26540    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26541        let mut debug_struct = f.debug_struct("ListInternalRangesRequest");
26542        debug_struct.field("parent", &self.parent);
26543        debug_struct.field("page_size", &self.page_size);
26544        debug_struct.field("page_token", &self.page_token);
26545        debug_struct.field("filter", &self.filter);
26546        debug_struct.field("order_by", &self.order_by);
26547        if !self._unknown_fields.is_empty() {
26548            debug_struct.field("_unknown_fields", &self._unknown_fields);
26549        }
26550        debug_struct.finish()
26551    }
26552}
26553
26554/// Response for InternalRange.ListInternalRanges
26555#[derive(Clone, Default, PartialEq)]
26556#[non_exhaustive]
26557pub struct ListInternalRangesResponse {
26558    /// Internal ranges to be returned.
26559    pub internal_ranges: std::vec::Vec<crate::model::InternalRange>,
26560
26561    /// The next pagination token in the List response. It should be used as
26562    /// page_token for the following request. An empty value means no more result.
26563    pub next_page_token: std::string::String,
26564
26565    /// Locations that could not be reached.
26566    pub unreachable: std::vec::Vec<std::string::String>,
26567
26568    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26569}
26570
26571impl ListInternalRangesResponse {
26572    pub fn new() -> Self {
26573        std::default::Default::default()
26574    }
26575
26576    /// Sets the value of [internal_ranges][crate::model::ListInternalRangesResponse::internal_ranges].
26577    pub fn set_internal_ranges<T, V>(mut self, v: T) -> Self
26578    where
26579        T: std::iter::IntoIterator<Item = V>,
26580        V: std::convert::Into<crate::model::InternalRange>,
26581    {
26582        use std::iter::Iterator;
26583        self.internal_ranges = v.into_iter().map(|i| i.into()).collect();
26584        self
26585    }
26586
26587    /// Sets the value of [next_page_token][crate::model::ListInternalRangesResponse::next_page_token].
26588    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26589        self.next_page_token = v.into();
26590        self
26591    }
26592
26593    /// Sets the value of [unreachable][crate::model::ListInternalRangesResponse::unreachable].
26594    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
26595    where
26596        T: std::iter::IntoIterator<Item = V>,
26597        V: std::convert::Into<std::string::String>,
26598    {
26599        use std::iter::Iterator;
26600        self.unreachable = v.into_iter().map(|i| i.into()).collect();
26601        self
26602    }
26603}
26604
26605impl wkt::message::Message for ListInternalRangesResponse {
26606    fn typename() -> &'static str {
26607        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListInternalRangesResponse"
26608    }
26609}
26610
26611#[doc(hidden)]
26612impl gax::paginator::internal::PageableResponse for ListInternalRangesResponse {
26613    type PageItem = crate::model::InternalRange;
26614
26615    fn items(self) -> std::vec::Vec<Self::PageItem> {
26616        self.internal_ranges
26617    }
26618
26619    fn next_page_token(&self) -> std::string::String {
26620        use std::clone::Clone;
26621        self.next_page_token.clone()
26622    }
26623}
26624
26625#[doc(hidden)]
26626impl<'de> serde::de::Deserialize<'de> for ListInternalRangesResponse {
26627    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26628    where
26629        D: serde::Deserializer<'de>,
26630    {
26631        #[allow(non_camel_case_types)]
26632        #[doc(hidden)]
26633        #[derive(PartialEq, Eq, Hash)]
26634        enum __FieldTag {
26635            __internal_ranges,
26636            __next_page_token,
26637            __unreachable,
26638            Unknown(std::string::String),
26639        }
26640        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
26641            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26642            where
26643                D: serde::Deserializer<'de>,
26644            {
26645                struct Visitor;
26646                impl<'de> serde::de::Visitor<'de> for Visitor {
26647                    type Value = __FieldTag;
26648                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26649                        formatter.write_str("a field name for ListInternalRangesResponse")
26650                    }
26651                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
26652                    where
26653                        E: serde::de::Error,
26654                    {
26655                        use std::result::Result::Ok;
26656                        use std::string::ToString;
26657                        match value {
26658                            "internalRanges" => Ok(__FieldTag::__internal_ranges),
26659                            "internal_ranges" => Ok(__FieldTag::__internal_ranges),
26660                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
26661                            "next_page_token" => Ok(__FieldTag::__next_page_token),
26662                            "unreachable" => Ok(__FieldTag::__unreachable),
26663                            _ => Ok(__FieldTag::Unknown(value.to_string())),
26664                        }
26665                    }
26666                }
26667                deserializer.deserialize_identifier(Visitor)
26668            }
26669        }
26670        struct Visitor;
26671        impl<'de> serde::de::Visitor<'de> for Visitor {
26672            type Value = ListInternalRangesResponse;
26673            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26674                formatter.write_str("struct ListInternalRangesResponse")
26675            }
26676            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
26677            where
26678                A: serde::de::MapAccess<'de>,
26679            {
26680                #[allow(unused_imports)]
26681                use serde::de::Error;
26682                use std::option::Option::Some;
26683                let mut fields = std::collections::HashSet::new();
26684                let mut result = Self::Value::new();
26685                while let Some(tag) = map.next_key::<__FieldTag>()? {
26686                    #[allow(clippy::match_single_binding)]
26687                    match tag {
26688                        __FieldTag::__internal_ranges => {
26689                            if !fields.insert(__FieldTag::__internal_ranges) {
26690                                return std::result::Result::Err(A::Error::duplicate_field(
26691                                    "multiple values for internal_ranges",
26692                                ));
26693                            }
26694                            result.internal_ranges = map.next_value::<std::option::Option<std::vec::Vec<crate::model::InternalRange>>>()?.unwrap_or_default();
26695                        }
26696                        __FieldTag::__next_page_token => {
26697                            if !fields.insert(__FieldTag::__next_page_token) {
26698                                return std::result::Result::Err(A::Error::duplicate_field(
26699                                    "multiple values for next_page_token",
26700                                ));
26701                            }
26702                            result.next_page_token = map
26703                                .next_value::<std::option::Option<std::string::String>>()?
26704                                .unwrap_or_default();
26705                        }
26706                        __FieldTag::__unreachable => {
26707                            if !fields.insert(__FieldTag::__unreachable) {
26708                                return std::result::Result::Err(A::Error::duplicate_field(
26709                                    "multiple values for unreachable",
26710                                ));
26711                            }
26712                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
26713                        }
26714                        __FieldTag::Unknown(key) => {
26715                            let value = map.next_value::<serde_json::Value>()?;
26716                            result._unknown_fields.insert(key, value);
26717                        }
26718                    }
26719                }
26720                std::result::Result::Ok(result)
26721            }
26722        }
26723        deserializer.deserialize_any(Visitor)
26724    }
26725}
26726
26727#[doc(hidden)]
26728impl serde::ser::Serialize for ListInternalRangesResponse {
26729    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26730    where
26731        S: serde::ser::Serializer,
26732    {
26733        use serde::ser::SerializeMap;
26734        #[allow(unused_imports)]
26735        use std::option::Option::Some;
26736        let mut state = serializer.serialize_map(std::option::Option::None)?;
26737        if !self.internal_ranges.is_empty() {
26738            state.serialize_entry("internalRanges", &self.internal_ranges)?;
26739        }
26740        if !self.next_page_token.is_empty() {
26741            state.serialize_entry("nextPageToken", &self.next_page_token)?;
26742        }
26743        if !self.unreachable.is_empty() {
26744            state.serialize_entry("unreachable", &self.unreachable)?;
26745        }
26746        if !self._unknown_fields.is_empty() {
26747            for (key, value) in self._unknown_fields.iter() {
26748                state.serialize_entry(key, &value)?;
26749            }
26750        }
26751        state.end()
26752    }
26753}
26754
26755impl std::fmt::Debug for ListInternalRangesResponse {
26756    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26757        let mut debug_struct = f.debug_struct("ListInternalRangesResponse");
26758        debug_struct.field("internal_ranges", &self.internal_ranges);
26759        debug_struct.field("next_page_token", &self.next_page_token);
26760        debug_struct.field("unreachable", &self.unreachable);
26761        if !self._unknown_fields.is_empty() {
26762            debug_struct.field("_unknown_fields", &self._unknown_fields);
26763        }
26764        debug_struct.finish()
26765    }
26766}
26767
26768/// Request for InternalRangeService.GetInternalRange
26769#[derive(Clone, Default, PartialEq)]
26770#[non_exhaustive]
26771pub struct GetInternalRangeRequest {
26772    /// Required. Name of the InternalRange to get.
26773    pub name: std::string::String,
26774
26775    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26776}
26777
26778impl GetInternalRangeRequest {
26779    pub fn new() -> Self {
26780        std::default::Default::default()
26781    }
26782
26783    /// Sets the value of [name][crate::model::GetInternalRangeRequest::name].
26784    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26785        self.name = v.into();
26786        self
26787    }
26788}
26789
26790impl wkt::message::Message for GetInternalRangeRequest {
26791    fn typename() -> &'static str {
26792        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetInternalRangeRequest"
26793    }
26794}
26795
26796#[doc(hidden)]
26797impl<'de> serde::de::Deserialize<'de> for GetInternalRangeRequest {
26798    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26799    where
26800        D: serde::Deserializer<'de>,
26801    {
26802        #[allow(non_camel_case_types)]
26803        #[doc(hidden)]
26804        #[derive(PartialEq, Eq, Hash)]
26805        enum __FieldTag {
26806            __name,
26807            Unknown(std::string::String),
26808        }
26809        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
26810            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26811            where
26812                D: serde::Deserializer<'de>,
26813            {
26814                struct Visitor;
26815                impl<'de> serde::de::Visitor<'de> for Visitor {
26816                    type Value = __FieldTag;
26817                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26818                        formatter.write_str("a field name for GetInternalRangeRequest")
26819                    }
26820                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
26821                    where
26822                        E: serde::de::Error,
26823                    {
26824                        use std::result::Result::Ok;
26825                        use std::string::ToString;
26826                        match value {
26827                            "name" => Ok(__FieldTag::__name),
26828                            _ => Ok(__FieldTag::Unknown(value.to_string())),
26829                        }
26830                    }
26831                }
26832                deserializer.deserialize_identifier(Visitor)
26833            }
26834        }
26835        struct Visitor;
26836        impl<'de> serde::de::Visitor<'de> for Visitor {
26837            type Value = GetInternalRangeRequest;
26838            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
26839                formatter.write_str("struct GetInternalRangeRequest")
26840            }
26841            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
26842            where
26843                A: serde::de::MapAccess<'de>,
26844            {
26845                #[allow(unused_imports)]
26846                use serde::de::Error;
26847                use std::option::Option::Some;
26848                let mut fields = std::collections::HashSet::new();
26849                let mut result = Self::Value::new();
26850                while let Some(tag) = map.next_key::<__FieldTag>()? {
26851                    #[allow(clippy::match_single_binding)]
26852                    match tag {
26853                        __FieldTag::__name => {
26854                            if !fields.insert(__FieldTag::__name) {
26855                                return std::result::Result::Err(A::Error::duplicate_field(
26856                                    "multiple values for name",
26857                                ));
26858                            }
26859                            result.name = map
26860                                .next_value::<std::option::Option<std::string::String>>()?
26861                                .unwrap_or_default();
26862                        }
26863                        __FieldTag::Unknown(key) => {
26864                            let value = map.next_value::<serde_json::Value>()?;
26865                            result._unknown_fields.insert(key, value);
26866                        }
26867                    }
26868                }
26869                std::result::Result::Ok(result)
26870            }
26871        }
26872        deserializer.deserialize_any(Visitor)
26873    }
26874}
26875
26876#[doc(hidden)]
26877impl serde::ser::Serialize for GetInternalRangeRequest {
26878    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
26879    where
26880        S: serde::ser::Serializer,
26881    {
26882        use serde::ser::SerializeMap;
26883        #[allow(unused_imports)]
26884        use std::option::Option::Some;
26885        let mut state = serializer.serialize_map(std::option::Option::None)?;
26886        if !self.name.is_empty() {
26887            state.serialize_entry("name", &self.name)?;
26888        }
26889        if !self._unknown_fields.is_empty() {
26890            for (key, value) in self._unknown_fields.iter() {
26891                state.serialize_entry(key, &value)?;
26892            }
26893        }
26894        state.end()
26895    }
26896}
26897
26898impl std::fmt::Debug for GetInternalRangeRequest {
26899    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26900        let mut debug_struct = f.debug_struct("GetInternalRangeRequest");
26901        debug_struct.field("name", &self.name);
26902        if !self._unknown_fields.is_empty() {
26903            debug_struct.field("_unknown_fields", &self._unknown_fields);
26904        }
26905        debug_struct.finish()
26906    }
26907}
26908
26909/// Request for InternalRangeService.CreateInternalRange
26910#[derive(Clone, Default, PartialEq)]
26911#[non_exhaustive]
26912pub struct CreateInternalRangeRequest {
26913    /// Required. The parent resource's name of the internal range.
26914    pub parent: std::string::String,
26915
26916    /// Optional. Resource ID
26917    /// (i.e. 'foo' in '[...]/projects/p/locations/l/internalRanges/foo')
26918    /// See <https://google.aip.dev/122#resource-id-segments>
26919    /// Unique per location.
26920    pub internal_range_id: std::string::String,
26921
26922    /// Required. Initial values for a new internal range
26923    pub internal_range: std::option::Option<crate::model::InternalRange>,
26924
26925    /// Optional. An optional request ID to identify requests. Specify a unique
26926    /// request ID so that if you must retry your request, the server will know to
26927    /// ignore the request if it has already been completed. The server will
26928    /// guarantee that for at least 60 minutes since the first request.
26929    ///
26930    /// For example, consider a situation where you make an initial request and
26931    /// the request times out. If you make the request again with the same request
26932    /// ID, the server can check if original operation with the same request ID
26933    /// was received, and if so, will ignore the second request. This prevents
26934    /// clients from accidentally creating duplicate commitments.
26935    ///
26936    /// The request ID must be a valid UUID with the exception that zero UUID is
26937    /// not supported (00000000-0000-0000-0000-000000000000).
26938    pub request_id: std::string::String,
26939
26940    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26941}
26942
26943impl CreateInternalRangeRequest {
26944    pub fn new() -> Self {
26945        std::default::Default::default()
26946    }
26947
26948    /// Sets the value of [parent][crate::model::CreateInternalRangeRequest::parent].
26949    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26950        self.parent = v.into();
26951        self
26952    }
26953
26954    /// Sets the value of [internal_range_id][crate::model::CreateInternalRangeRequest::internal_range_id].
26955    pub fn set_internal_range_id<T: std::convert::Into<std::string::String>>(
26956        mut self,
26957        v: T,
26958    ) -> Self {
26959        self.internal_range_id = v.into();
26960        self
26961    }
26962
26963    /// Sets the value of [internal_range][crate::model::CreateInternalRangeRequest::internal_range].
26964    pub fn set_internal_range<T>(mut self, v: T) -> Self
26965    where
26966        T: std::convert::Into<crate::model::InternalRange>,
26967    {
26968        self.internal_range = std::option::Option::Some(v.into());
26969        self
26970    }
26971
26972    /// Sets or clears the value of [internal_range][crate::model::CreateInternalRangeRequest::internal_range].
26973    pub fn set_or_clear_internal_range<T>(mut self, v: std::option::Option<T>) -> Self
26974    where
26975        T: std::convert::Into<crate::model::InternalRange>,
26976    {
26977        self.internal_range = v.map(|x| x.into());
26978        self
26979    }
26980
26981    /// Sets the value of [request_id][crate::model::CreateInternalRangeRequest::request_id].
26982    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26983        self.request_id = v.into();
26984        self
26985    }
26986}
26987
26988impl wkt::message::Message for CreateInternalRangeRequest {
26989    fn typename() -> &'static str {
26990        "type.googleapis.com/google.cloud.networkconnectivity.v1.CreateInternalRangeRequest"
26991    }
26992}
26993
26994#[doc(hidden)]
26995impl<'de> serde::de::Deserialize<'de> for CreateInternalRangeRequest {
26996    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
26997    where
26998        D: serde::Deserializer<'de>,
26999    {
27000        #[allow(non_camel_case_types)]
27001        #[doc(hidden)]
27002        #[derive(PartialEq, Eq, Hash)]
27003        enum __FieldTag {
27004            __parent,
27005            __internal_range_id,
27006            __internal_range,
27007            __request_id,
27008            Unknown(std::string::String),
27009        }
27010        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
27011            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27012            where
27013                D: serde::Deserializer<'de>,
27014            {
27015                struct Visitor;
27016                impl<'de> serde::de::Visitor<'de> for Visitor {
27017                    type Value = __FieldTag;
27018                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
27019                        formatter.write_str("a field name for CreateInternalRangeRequest")
27020                    }
27021                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
27022                    where
27023                        E: serde::de::Error,
27024                    {
27025                        use std::result::Result::Ok;
27026                        use std::string::ToString;
27027                        match value {
27028                            "parent" => Ok(__FieldTag::__parent),
27029                            "internalRangeId" => Ok(__FieldTag::__internal_range_id),
27030                            "internal_range_id" => Ok(__FieldTag::__internal_range_id),
27031                            "internalRange" => Ok(__FieldTag::__internal_range),
27032                            "internal_range" => Ok(__FieldTag::__internal_range),
27033                            "requestId" => Ok(__FieldTag::__request_id),
27034                            "request_id" => Ok(__FieldTag::__request_id),
27035                            _ => Ok(__FieldTag::Unknown(value.to_string())),
27036                        }
27037                    }
27038                }
27039                deserializer.deserialize_identifier(Visitor)
27040            }
27041        }
27042        struct Visitor;
27043        impl<'de> serde::de::Visitor<'de> for Visitor {
27044            type Value = CreateInternalRangeRequest;
27045            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
27046                formatter.write_str("struct CreateInternalRangeRequest")
27047            }
27048            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
27049            where
27050                A: serde::de::MapAccess<'de>,
27051            {
27052                #[allow(unused_imports)]
27053                use serde::de::Error;
27054                use std::option::Option::Some;
27055                let mut fields = std::collections::HashSet::new();
27056                let mut result = Self::Value::new();
27057                while let Some(tag) = map.next_key::<__FieldTag>()? {
27058                    #[allow(clippy::match_single_binding)]
27059                    match tag {
27060                        __FieldTag::__parent => {
27061                            if !fields.insert(__FieldTag::__parent) {
27062                                return std::result::Result::Err(A::Error::duplicate_field(
27063                                    "multiple values for parent",
27064                                ));
27065                            }
27066                            result.parent = map
27067                                .next_value::<std::option::Option<std::string::String>>()?
27068                                .unwrap_or_default();
27069                        }
27070                        __FieldTag::__internal_range_id => {
27071                            if !fields.insert(__FieldTag::__internal_range_id) {
27072                                return std::result::Result::Err(A::Error::duplicate_field(
27073                                    "multiple values for internal_range_id",
27074                                ));
27075                            }
27076                            result.internal_range_id = map
27077                                .next_value::<std::option::Option<std::string::String>>()?
27078                                .unwrap_or_default();
27079                        }
27080                        __FieldTag::__internal_range => {
27081                            if !fields.insert(__FieldTag::__internal_range) {
27082                                return std::result::Result::Err(A::Error::duplicate_field(
27083                                    "multiple values for internal_range",
27084                                ));
27085                            }
27086                            result.internal_range = map
27087                                .next_value::<std::option::Option<crate::model::InternalRange>>()?;
27088                        }
27089                        __FieldTag::__request_id => {
27090                            if !fields.insert(__FieldTag::__request_id) {
27091                                return std::result::Result::Err(A::Error::duplicate_field(
27092                                    "multiple values for request_id",
27093                                ));
27094                            }
27095                            result.request_id = map
27096                                .next_value::<std::option::Option<std::string::String>>()?
27097                                .unwrap_or_default();
27098                        }
27099                        __FieldTag::Unknown(key) => {
27100                            let value = map.next_value::<serde_json::Value>()?;
27101                            result._unknown_fields.insert(key, value);
27102                        }
27103                    }
27104                }
27105                std::result::Result::Ok(result)
27106            }
27107        }
27108        deserializer.deserialize_any(Visitor)
27109    }
27110}
27111
27112#[doc(hidden)]
27113impl serde::ser::Serialize for CreateInternalRangeRequest {
27114    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27115    where
27116        S: serde::ser::Serializer,
27117    {
27118        use serde::ser::SerializeMap;
27119        #[allow(unused_imports)]
27120        use std::option::Option::Some;
27121        let mut state = serializer.serialize_map(std::option::Option::None)?;
27122        if !self.parent.is_empty() {
27123            state.serialize_entry("parent", &self.parent)?;
27124        }
27125        if !self.internal_range_id.is_empty() {
27126            state.serialize_entry("internalRangeId", &self.internal_range_id)?;
27127        }
27128        if self.internal_range.is_some() {
27129            state.serialize_entry("internalRange", &self.internal_range)?;
27130        }
27131        if !self.request_id.is_empty() {
27132            state.serialize_entry("requestId", &self.request_id)?;
27133        }
27134        if !self._unknown_fields.is_empty() {
27135            for (key, value) in self._unknown_fields.iter() {
27136                state.serialize_entry(key, &value)?;
27137            }
27138        }
27139        state.end()
27140    }
27141}
27142
27143impl std::fmt::Debug for CreateInternalRangeRequest {
27144    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27145        let mut debug_struct = f.debug_struct("CreateInternalRangeRequest");
27146        debug_struct.field("parent", &self.parent);
27147        debug_struct.field("internal_range_id", &self.internal_range_id);
27148        debug_struct.field("internal_range", &self.internal_range);
27149        debug_struct.field("request_id", &self.request_id);
27150        if !self._unknown_fields.is_empty() {
27151            debug_struct.field("_unknown_fields", &self._unknown_fields);
27152        }
27153        debug_struct.finish()
27154    }
27155}
27156
27157/// Request for InternalRangeService.UpdateInternalRange
27158#[derive(Clone, Default, PartialEq)]
27159#[non_exhaustive]
27160pub struct UpdateInternalRangeRequest {
27161    /// Optional. Field mask is used to specify the fields to be overwritten in the
27162    /// InternalRange resource by the update.
27163    /// The fields specified in the update_mask are relative to the resource, not
27164    /// the full request. A field will be overwritten if it is in the mask. If the
27165    /// user does not provide a mask then all fields will be overwritten.
27166    pub update_mask: std::option::Option<wkt::FieldMask>,
27167
27168    /// Required. New values to be patched into the resource.
27169    pub internal_range: std::option::Option<crate::model::InternalRange>,
27170
27171    /// Optional. An optional request ID to identify requests. Specify a unique
27172    /// request ID so that if you must retry your request, the server will know to
27173    /// ignore the request if it has already been completed. The server will
27174    /// guarantee that for at least 60 minutes since the first request.
27175    ///
27176    /// For example, consider a situation where you make an initial request and
27177    /// the request times out. If you make the request again with the same request
27178    /// ID, the server can check if original operation with the same request ID
27179    /// was received, and if so, will ignore the second request. This prevents
27180    /// clients from accidentally creating duplicate commitments.
27181    ///
27182    /// The request ID must be a valid UUID with the exception that zero UUID is
27183    /// not supported (00000000-0000-0000-0000-000000000000).
27184    pub request_id: std::string::String,
27185
27186    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27187}
27188
27189impl UpdateInternalRangeRequest {
27190    pub fn new() -> Self {
27191        std::default::Default::default()
27192    }
27193
27194    /// Sets the value of [update_mask][crate::model::UpdateInternalRangeRequest::update_mask].
27195    pub fn set_update_mask<T>(mut self, v: T) -> Self
27196    where
27197        T: std::convert::Into<wkt::FieldMask>,
27198    {
27199        self.update_mask = std::option::Option::Some(v.into());
27200        self
27201    }
27202
27203    /// Sets or clears the value of [update_mask][crate::model::UpdateInternalRangeRequest::update_mask].
27204    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
27205    where
27206        T: std::convert::Into<wkt::FieldMask>,
27207    {
27208        self.update_mask = v.map(|x| x.into());
27209        self
27210    }
27211
27212    /// Sets the value of [internal_range][crate::model::UpdateInternalRangeRequest::internal_range].
27213    pub fn set_internal_range<T>(mut self, v: T) -> Self
27214    where
27215        T: std::convert::Into<crate::model::InternalRange>,
27216    {
27217        self.internal_range = std::option::Option::Some(v.into());
27218        self
27219    }
27220
27221    /// Sets or clears the value of [internal_range][crate::model::UpdateInternalRangeRequest::internal_range].
27222    pub fn set_or_clear_internal_range<T>(mut self, v: std::option::Option<T>) -> Self
27223    where
27224        T: std::convert::Into<crate::model::InternalRange>,
27225    {
27226        self.internal_range = v.map(|x| x.into());
27227        self
27228    }
27229
27230    /// Sets the value of [request_id][crate::model::UpdateInternalRangeRequest::request_id].
27231    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27232        self.request_id = v.into();
27233        self
27234    }
27235}
27236
27237impl wkt::message::Message for UpdateInternalRangeRequest {
27238    fn typename() -> &'static str {
27239        "type.googleapis.com/google.cloud.networkconnectivity.v1.UpdateInternalRangeRequest"
27240    }
27241}
27242
27243#[doc(hidden)]
27244impl<'de> serde::de::Deserialize<'de> for UpdateInternalRangeRequest {
27245    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27246    where
27247        D: serde::Deserializer<'de>,
27248    {
27249        #[allow(non_camel_case_types)]
27250        #[doc(hidden)]
27251        #[derive(PartialEq, Eq, Hash)]
27252        enum __FieldTag {
27253            __update_mask,
27254            __internal_range,
27255            __request_id,
27256            Unknown(std::string::String),
27257        }
27258        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
27259            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27260            where
27261                D: serde::Deserializer<'de>,
27262            {
27263                struct Visitor;
27264                impl<'de> serde::de::Visitor<'de> for Visitor {
27265                    type Value = __FieldTag;
27266                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
27267                        formatter.write_str("a field name for UpdateInternalRangeRequest")
27268                    }
27269                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
27270                    where
27271                        E: serde::de::Error,
27272                    {
27273                        use std::result::Result::Ok;
27274                        use std::string::ToString;
27275                        match value {
27276                            "updateMask" => Ok(__FieldTag::__update_mask),
27277                            "update_mask" => Ok(__FieldTag::__update_mask),
27278                            "internalRange" => Ok(__FieldTag::__internal_range),
27279                            "internal_range" => Ok(__FieldTag::__internal_range),
27280                            "requestId" => Ok(__FieldTag::__request_id),
27281                            "request_id" => Ok(__FieldTag::__request_id),
27282                            _ => Ok(__FieldTag::Unknown(value.to_string())),
27283                        }
27284                    }
27285                }
27286                deserializer.deserialize_identifier(Visitor)
27287            }
27288        }
27289        struct Visitor;
27290        impl<'de> serde::de::Visitor<'de> for Visitor {
27291            type Value = UpdateInternalRangeRequest;
27292            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
27293                formatter.write_str("struct UpdateInternalRangeRequest")
27294            }
27295            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
27296            where
27297                A: serde::de::MapAccess<'de>,
27298            {
27299                #[allow(unused_imports)]
27300                use serde::de::Error;
27301                use std::option::Option::Some;
27302                let mut fields = std::collections::HashSet::new();
27303                let mut result = Self::Value::new();
27304                while let Some(tag) = map.next_key::<__FieldTag>()? {
27305                    #[allow(clippy::match_single_binding)]
27306                    match tag {
27307                        __FieldTag::__update_mask => {
27308                            if !fields.insert(__FieldTag::__update_mask) {
27309                                return std::result::Result::Err(A::Error::duplicate_field(
27310                                    "multiple values for update_mask",
27311                                ));
27312                            }
27313                            result.update_mask =
27314                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
27315                        }
27316                        __FieldTag::__internal_range => {
27317                            if !fields.insert(__FieldTag::__internal_range) {
27318                                return std::result::Result::Err(A::Error::duplicate_field(
27319                                    "multiple values for internal_range",
27320                                ));
27321                            }
27322                            result.internal_range = map
27323                                .next_value::<std::option::Option<crate::model::InternalRange>>()?;
27324                        }
27325                        __FieldTag::__request_id => {
27326                            if !fields.insert(__FieldTag::__request_id) {
27327                                return std::result::Result::Err(A::Error::duplicate_field(
27328                                    "multiple values for request_id",
27329                                ));
27330                            }
27331                            result.request_id = map
27332                                .next_value::<std::option::Option<std::string::String>>()?
27333                                .unwrap_or_default();
27334                        }
27335                        __FieldTag::Unknown(key) => {
27336                            let value = map.next_value::<serde_json::Value>()?;
27337                            result._unknown_fields.insert(key, value);
27338                        }
27339                    }
27340                }
27341                std::result::Result::Ok(result)
27342            }
27343        }
27344        deserializer.deserialize_any(Visitor)
27345    }
27346}
27347
27348#[doc(hidden)]
27349impl serde::ser::Serialize for UpdateInternalRangeRequest {
27350    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27351    where
27352        S: serde::ser::Serializer,
27353    {
27354        use serde::ser::SerializeMap;
27355        #[allow(unused_imports)]
27356        use std::option::Option::Some;
27357        let mut state = serializer.serialize_map(std::option::Option::None)?;
27358        if self.update_mask.is_some() {
27359            state.serialize_entry("updateMask", &self.update_mask)?;
27360        }
27361        if self.internal_range.is_some() {
27362            state.serialize_entry("internalRange", &self.internal_range)?;
27363        }
27364        if !self.request_id.is_empty() {
27365            state.serialize_entry("requestId", &self.request_id)?;
27366        }
27367        if !self._unknown_fields.is_empty() {
27368            for (key, value) in self._unknown_fields.iter() {
27369                state.serialize_entry(key, &value)?;
27370            }
27371        }
27372        state.end()
27373    }
27374}
27375
27376impl std::fmt::Debug for UpdateInternalRangeRequest {
27377    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27378        let mut debug_struct = f.debug_struct("UpdateInternalRangeRequest");
27379        debug_struct.field("update_mask", &self.update_mask);
27380        debug_struct.field("internal_range", &self.internal_range);
27381        debug_struct.field("request_id", &self.request_id);
27382        if !self._unknown_fields.is_empty() {
27383            debug_struct.field("_unknown_fields", &self._unknown_fields);
27384        }
27385        debug_struct.finish()
27386    }
27387}
27388
27389/// Request for InternalRangeService.DeleteInternalRange
27390#[derive(Clone, Default, PartialEq)]
27391#[non_exhaustive]
27392pub struct DeleteInternalRangeRequest {
27393    /// Required. The name of the internal range to delete.
27394    pub name: std::string::String,
27395
27396    /// Optional. An optional request ID to identify requests. Specify a unique
27397    /// request ID so that if you must retry your request, the server will know to
27398    /// ignore the request if it has already been completed. The server will
27399    /// guarantee that for at least 60 minutes after the first request.
27400    ///
27401    /// For example, consider a situation where you make an initial request and
27402    /// the request times out. If you make the request again with the same request
27403    /// ID, the server can check if original operation with the same request ID
27404    /// was received, and if so, will ignore the second request. This prevents
27405    /// clients from accidentally creating duplicate commitments.
27406    ///
27407    /// The request ID must be a valid UUID with the exception that zero UUID is
27408    /// not supported (00000000-0000-0000-0000-000000000000).
27409    pub request_id: std::string::String,
27410
27411    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27412}
27413
27414impl DeleteInternalRangeRequest {
27415    pub fn new() -> Self {
27416        std::default::Default::default()
27417    }
27418
27419    /// Sets the value of [name][crate::model::DeleteInternalRangeRequest::name].
27420    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27421        self.name = v.into();
27422        self
27423    }
27424
27425    /// Sets the value of [request_id][crate::model::DeleteInternalRangeRequest::request_id].
27426    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27427        self.request_id = v.into();
27428        self
27429    }
27430}
27431
27432impl wkt::message::Message for DeleteInternalRangeRequest {
27433    fn typename() -> &'static str {
27434        "type.googleapis.com/google.cloud.networkconnectivity.v1.DeleteInternalRangeRequest"
27435    }
27436}
27437
27438#[doc(hidden)]
27439impl<'de> serde::de::Deserialize<'de> for DeleteInternalRangeRequest {
27440    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27441    where
27442        D: serde::Deserializer<'de>,
27443    {
27444        #[allow(non_camel_case_types)]
27445        #[doc(hidden)]
27446        #[derive(PartialEq, Eq, Hash)]
27447        enum __FieldTag {
27448            __name,
27449            __request_id,
27450            Unknown(std::string::String),
27451        }
27452        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
27453            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27454            where
27455                D: serde::Deserializer<'de>,
27456            {
27457                struct Visitor;
27458                impl<'de> serde::de::Visitor<'de> for Visitor {
27459                    type Value = __FieldTag;
27460                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
27461                        formatter.write_str("a field name for DeleteInternalRangeRequest")
27462                    }
27463                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
27464                    where
27465                        E: serde::de::Error,
27466                    {
27467                        use std::result::Result::Ok;
27468                        use std::string::ToString;
27469                        match value {
27470                            "name" => Ok(__FieldTag::__name),
27471                            "requestId" => Ok(__FieldTag::__request_id),
27472                            "request_id" => Ok(__FieldTag::__request_id),
27473                            _ => Ok(__FieldTag::Unknown(value.to_string())),
27474                        }
27475                    }
27476                }
27477                deserializer.deserialize_identifier(Visitor)
27478            }
27479        }
27480        struct Visitor;
27481        impl<'de> serde::de::Visitor<'de> for Visitor {
27482            type Value = DeleteInternalRangeRequest;
27483            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
27484                formatter.write_str("struct DeleteInternalRangeRequest")
27485            }
27486            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
27487            where
27488                A: serde::de::MapAccess<'de>,
27489            {
27490                #[allow(unused_imports)]
27491                use serde::de::Error;
27492                use std::option::Option::Some;
27493                let mut fields = std::collections::HashSet::new();
27494                let mut result = Self::Value::new();
27495                while let Some(tag) = map.next_key::<__FieldTag>()? {
27496                    #[allow(clippy::match_single_binding)]
27497                    match tag {
27498                        __FieldTag::__name => {
27499                            if !fields.insert(__FieldTag::__name) {
27500                                return std::result::Result::Err(A::Error::duplicate_field(
27501                                    "multiple values for name",
27502                                ));
27503                            }
27504                            result.name = map
27505                                .next_value::<std::option::Option<std::string::String>>()?
27506                                .unwrap_or_default();
27507                        }
27508                        __FieldTag::__request_id => {
27509                            if !fields.insert(__FieldTag::__request_id) {
27510                                return std::result::Result::Err(A::Error::duplicate_field(
27511                                    "multiple values for request_id",
27512                                ));
27513                            }
27514                            result.request_id = map
27515                                .next_value::<std::option::Option<std::string::String>>()?
27516                                .unwrap_or_default();
27517                        }
27518                        __FieldTag::Unknown(key) => {
27519                            let value = map.next_value::<serde_json::Value>()?;
27520                            result._unknown_fields.insert(key, value);
27521                        }
27522                    }
27523                }
27524                std::result::Result::Ok(result)
27525            }
27526        }
27527        deserializer.deserialize_any(Visitor)
27528    }
27529}
27530
27531#[doc(hidden)]
27532impl serde::ser::Serialize for DeleteInternalRangeRequest {
27533    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27534    where
27535        S: serde::ser::Serializer,
27536    {
27537        use serde::ser::SerializeMap;
27538        #[allow(unused_imports)]
27539        use std::option::Option::Some;
27540        let mut state = serializer.serialize_map(std::option::Option::None)?;
27541        if !self.name.is_empty() {
27542            state.serialize_entry("name", &self.name)?;
27543        }
27544        if !self.request_id.is_empty() {
27545            state.serialize_entry("requestId", &self.request_id)?;
27546        }
27547        if !self._unknown_fields.is_empty() {
27548            for (key, value) in self._unknown_fields.iter() {
27549                state.serialize_entry(key, &value)?;
27550            }
27551        }
27552        state.end()
27553    }
27554}
27555
27556impl std::fmt::Debug for DeleteInternalRangeRequest {
27557    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27558        let mut debug_struct = f.debug_struct("DeleteInternalRangeRequest");
27559        debug_struct.field("name", &self.name);
27560        debug_struct.field("request_id", &self.request_id);
27561        if !self._unknown_fields.is_empty() {
27562            debug_struct.field("_unknown_fields", &self._unknown_fields);
27563        }
27564        debug_struct.finish()
27565    }
27566}
27567
27568/// Policy-based routes route L4 network traffic based on not just destination IP
27569/// address, but also source IP address, protocol, and more. If a policy-based
27570/// route conflicts with other types of routes, the policy-based route always
27571/// takes precedence.
27572#[derive(Clone, Default, PartialEq)]
27573#[non_exhaustive]
27574pub struct PolicyBasedRoute {
27575    /// Immutable. A unique name of the resource in the form of
27576    /// `projects/{project_number}/locations/global/PolicyBasedRoutes/{policy_based_route_id}`
27577    pub name: std::string::String,
27578
27579    /// Output only. Time when the policy-based route was created.
27580    pub create_time: std::option::Option<wkt::Timestamp>,
27581
27582    /// Output only. Time when the policy-based route was updated.
27583    pub update_time: std::option::Option<wkt::Timestamp>,
27584
27585    /// User-defined labels.
27586    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
27587
27588    /// Optional. An optional description of this resource. Provide this field when
27589    /// you create the resource.
27590    pub description: std::string::String,
27591
27592    /// Required. Fully-qualified URL of the network that this route applies to,
27593    /// for example: projects/my-project/global/networks/my-network.
27594    pub network: std::string::String,
27595
27596    /// Required. The filter to match L4 traffic.
27597    pub filter: std::option::Option<crate::model::policy_based_route::Filter>,
27598
27599    /// Optional. The priority of this policy-based route. Priority is used to
27600    /// break ties in cases where there are more than one matching policy-based
27601    /// routes found. In cases where multiple policy-based routes are matched, the
27602    /// one with the lowest-numbered priority value wins. The default value is
27603    /// 1000. The priority value must be from 1 to 65535, inclusive.
27604    pub priority: i32,
27605
27606    /// Output only. If potential misconfigurations are detected for this route,
27607    /// this field will be populated with warning messages.
27608    pub warnings: std::vec::Vec<crate::model::policy_based_route::Warnings>,
27609
27610    /// Output only. Server-defined fully-qualified URL for this resource.
27611    pub self_link: std::string::String,
27612
27613    /// Output only. Type of this resource. Always
27614    /// networkconnectivity#policyBasedRoute for policy-based Route resources.
27615    pub kind: std::string::String,
27616
27617    /// Target specifies network endpoints that this policy-based route applies to.
27618    /// If no target is specified, the PBR will be installed on all network
27619    /// endpoints (e.g. VMs, VPNs, and Interconnects) in the VPC.
27620    pub target: std::option::Option<crate::model::policy_based_route::Target>,
27621
27622    pub next_hop: std::option::Option<crate::model::policy_based_route::NextHop>,
27623
27624    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27625}
27626
27627impl PolicyBasedRoute {
27628    pub fn new() -> Self {
27629        std::default::Default::default()
27630    }
27631
27632    /// Sets the value of [name][crate::model::PolicyBasedRoute::name].
27633    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27634        self.name = v.into();
27635        self
27636    }
27637
27638    /// Sets the value of [create_time][crate::model::PolicyBasedRoute::create_time].
27639    pub fn set_create_time<T>(mut self, v: T) -> Self
27640    where
27641        T: std::convert::Into<wkt::Timestamp>,
27642    {
27643        self.create_time = std::option::Option::Some(v.into());
27644        self
27645    }
27646
27647    /// Sets or clears the value of [create_time][crate::model::PolicyBasedRoute::create_time].
27648    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
27649    where
27650        T: std::convert::Into<wkt::Timestamp>,
27651    {
27652        self.create_time = v.map(|x| x.into());
27653        self
27654    }
27655
27656    /// Sets the value of [update_time][crate::model::PolicyBasedRoute::update_time].
27657    pub fn set_update_time<T>(mut self, v: T) -> Self
27658    where
27659        T: std::convert::Into<wkt::Timestamp>,
27660    {
27661        self.update_time = std::option::Option::Some(v.into());
27662        self
27663    }
27664
27665    /// Sets or clears the value of [update_time][crate::model::PolicyBasedRoute::update_time].
27666    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
27667    where
27668        T: std::convert::Into<wkt::Timestamp>,
27669    {
27670        self.update_time = v.map(|x| x.into());
27671        self
27672    }
27673
27674    /// Sets the value of [labels][crate::model::PolicyBasedRoute::labels].
27675    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
27676    where
27677        T: std::iter::IntoIterator<Item = (K, V)>,
27678        K: std::convert::Into<std::string::String>,
27679        V: std::convert::Into<std::string::String>,
27680    {
27681        use std::iter::Iterator;
27682        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
27683        self
27684    }
27685
27686    /// Sets the value of [description][crate::model::PolicyBasedRoute::description].
27687    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27688        self.description = v.into();
27689        self
27690    }
27691
27692    /// Sets the value of [network][crate::model::PolicyBasedRoute::network].
27693    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27694        self.network = v.into();
27695        self
27696    }
27697
27698    /// Sets the value of [filter][crate::model::PolicyBasedRoute::filter].
27699    pub fn set_filter<T>(mut self, v: T) -> Self
27700    where
27701        T: std::convert::Into<crate::model::policy_based_route::Filter>,
27702    {
27703        self.filter = std::option::Option::Some(v.into());
27704        self
27705    }
27706
27707    /// Sets or clears the value of [filter][crate::model::PolicyBasedRoute::filter].
27708    pub fn set_or_clear_filter<T>(mut self, v: std::option::Option<T>) -> Self
27709    where
27710        T: std::convert::Into<crate::model::policy_based_route::Filter>,
27711    {
27712        self.filter = v.map(|x| x.into());
27713        self
27714    }
27715
27716    /// Sets the value of [priority][crate::model::PolicyBasedRoute::priority].
27717    pub fn set_priority<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
27718        self.priority = v.into();
27719        self
27720    }
27721
27722    /// Sets the value of [warnings][crate::model::PolicyBasedRoute::warnings].
27723    pub fn set_warnings<T, V>(mut self, v: T) -> Self
27724    where
27725        T: std::iter::IntoIterator<Item = V>,
27726        V: std::convert::Into<crate::model::policy_based_route::Warnings>,
27727    {
27728        use std::iter::Iterator;
27729        self.warnings = v.into_iter().map(|i| i.into()).collect();
27730        self
27731    }
27732
27733    /// Sets the value of [self_link][crate::model::PolicyBasedRoute::self_link].
27734    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27735        self.self_link = v.into();
27736        self
27737    }
27738
27739    /// Sets the value of [kind][crate::model::PolicyBasedRoute::kind].
27740    pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27741        self.kind = v.into();
27742        self
27743    }
27744
27745    /// Sets the value of [target][crate::model::PolicyBasedRoute::target].
27746    ///
27747    /// Note that all the setters affecting `target` are mutually
27748    /// exclusive.
27749    pub fn set_target<
27750        T: std::convert::Into<std::option::Option<crate::model::policy_based_route::Target>>,
27751    >(
27752        mut self,
27753        v: T,
27754    ) -> Self {
27755        self.target = v.into();
27756        self
27757    }
27758
27759    /// The value of [target][crate::model::PolicyBasedRoute::target]
27760    /// if it holds a `VirtualMachine`, `None` if the field is not set or
27761    /// holds a different branch.
27762    pub fn virtual_machine(
27763        &self,
27764    ) -> std::option::Option<&std::boxed::Box<crate::model::policy_based_route::VirtualMachine>>
27765    {
27766        #[allow(unreachable_patterns)]
27767        self.target.as_ref().and_then(|v| match v {
27768            crate::model::policy_based_route::Target::VirtualMachine(v) => {
27769                std::option::Option::Some(v)
27770            }
27771            _ => std::option::Option::None,
27772        })
27773    }
27774
27775    /// Sets the value of [target][crate::model::PolicyBasedRoute::target]
27776    /// to hold a `VirtualMachine`.
27777    ///
27778    /// Note that all the setters affecting `target` are
27779    /// mutually exclusive.
27780    pub fn set_virtual_machine<
27781        T: std::convert::Into<std::boxed::Box<crate::model::policy_based_route::VirtualMachine>>,
27782    >(
27783        mut self,
27784        v: T,
27785    ) -> Self {
27786        self.target = std::option::Option::Some(
27787            crate::model::policy_based_route::Target::VirtualMachine(v.into()),
27788        );
27789        self
27790    }
27791
27792    /// The value of [target][crate::model::PolicyBasedRoute::target]
27793    /// if it holds a `InterconnectAttachment`, `None` if the field is not set or
27794    /// holds a different branch.
27795    pub fn interconnect_attachment(
27796        &self,
27797    ) -> std::option::Option<
27798        &std::boxed::Box<crate::model::policy_based_route::InterconnectAttachment>,
27799    > {
27800        #[allow(unreachable_patterns)]
27801        self.target.as_ref().and_then(|v| match v {
27802            crate::model::policy_based_route::Target::InterconnectAttachment(v) => {
27803                std::option::Option::Some(v)
27804            }
27805            _ => std::option::Option::None,
27806        })
27807    }
27808
27809    /// Sets the value of [target][crate::model::PolicyBasedRoute::target]
27810    /// to hold a `InterconnectAttachment`.
27811    ///
27812    /// Note that all the setters affecting `target` are
27813    /// mutually exclusive.
27814    pub fn set_interconnect_attachment<
27815        T: std::convert::Into<
27816                std::boxed::Box<crate::model::policy_based_route::InterconnectAttachment>,
27817            >,
27818    >(
27819        mut self,
27820        v: T,
27821    ) -> Self {
27822        self.target = std::option::Option::Some(
27823            crate::model::policy_based_route::Target::InterconnectAttachment(v.into()),
27824        );
27825        self
27826    }
27827
27828    /// Sets the value of [next_hop][crate::model::PolicyBasedRoute::next_hop].
27829    ///
27830    /// Note that all the setters affecting `next_hop` are mutually
27831    /// exclusive.
27832    pub fn set_next_hop<
27833        T: std::convert::Into<std::option::Option<crate::model::policy_based_route::NextHop>>,
27834    >(
27835        mut self,
27836        v: T,
27837    ) -> Self {
27838        self.next_hop = v.into();
27839        self
27840    }
27841
27842    /// The value of [next_hop][crate::model::PolicyBasedRoute::next_hop]
27843    /// if it holds a `NextHopIlbIp`, `None` if the field is not set or
27844    /// holds a different branch.
27845    pub fn next_hop_ilb_ip(&self) -> std::option::Option<&std::string::String> {
27846        #[allow(unreachable_patterns)]
27847        self.next_hop.as_ref().and_then(|v| match v {
27848            crate::model::policy_based_route::NextHop::NextHopIlbIp(v) => {
27849                std::option::Option::Some(v)
27850            }
27851            _ => std::option::Option::None,
27852        })
27853    }
27854
27855    /// Sets the value of [next_hop][crate::model::PolicyBasedRoute::next_hop]
27856    /// to hold a `NextHopIlbIp`.
27857    ///
27858    /// Note that all the setters affecting `next_hop` are
27859    /// mutually exclusive.
27860    pub fn set_next_hop_ilb_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27861        self.next_hop = std::option::Option::Some(
27862            crate::model::policy_based_route::NextHop::NextHopIlbIp(v.into()),
27863        );
27864        self
27865    }
27866
27867    /// The value of [next_hop][crate::model::PolicyBasedRoute::next_hop]
27868    /// if it holds a `NextHopOtherRoutes`, `None` if the field is not set or
27869    /// holds a different branch.
27870    pub fn next_hop_other_routes(
27871        &self,
27872    ) -> std::option::Option<&crate::model::policy_based_route::OtherRoutes> {
27873        #[allow(unreachable_patterns)]
27874        self.next_hop.as_ref().and_then(|v| match v {
27875            crate::model::policy_based_route::NextHop::NextHopOtherRoutes(v) => {
27876                std::option::Option::Some(v)
27877            }
27878            _ => std::option::Option::None,
27879        })
27880    }
27881
27882    /// Sets the value of [next_hop][crate::model::PolicyBasedRoute::next_hop]
27883    /// to hold a `NextHopOtherRoutes`.
27884    ///
27885    /// Note that all the setters affecting `next_hop` are
27886    /// mutually exclusive.
27887    pub fn set_next_hop_other_routes<
27888        T: std::convert::Into<crate::model::policy_based_route::OtherRoutes>,
27889    >(
27890        mut self,
27891        v: T,
27892    ) -> Self {
27893        self.next_hop = std::option::Option::Some(
27894            crate::model::policy_based_route::NextHop::NextHopOtherRoutes(v.into()),
27895        );
27896        self
27897    }
27898}
27899
27900impl wkt::message::Message for PolicyBasedRoute {
27901    fn typename() -> &'static str {
27902        "type.googleapis.com/google.cloud.networkconnectivity.v1.PolicyBasedRoute"
27903    }
27904}
27905
27906#[doc(hidden)]
27907impl<'de> serde::de::Deserialize<'de> for PolicyBasedRoute {
27908    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27909    where
27910        D: serde::Deserializer<'de>,
27911    {
27912        #[allow(non_camel_case_types)]
27913        #[doc(hidden)]
27914        #[derive(PartialEq, Eq, Hash)]
27915        enum __FieldTag {
27916            __virtual_machine,
27917            __interconnect_attachment,
27918            __next_hop_ilb_ip,
27919            __next_hop_other_routes,
27920            __name,
27921            __create_time,
27922            __update_time,
27923            __labels,
27924            __description,
27925            __network,
27926            __filter,
27927            __priority,
27928            __warnings,
27929            __self_link,
27930            __kind,
27931            Unknown(std::string::String),
27932        }
27933        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
27934            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27935            where
27936                D: serde::Deserializer<'de>,
27937            {
27938                struct Visitor;
27939                impl<'de> serde::de::Visitor<'de> for Visitor {
27940                    type Value = __FieldTag;
27941                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
27942                        formatter.write_str("a field name for PolicyBasedRoute")
27943                    }
27944                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
27945                    where
27946                        E: serde::de::Error,
27947                    {
27948                        use std::result::Result::Ok;
27949                        use std::string::ToString;
27950                        match value {
27951                            "virtualMachine" => Ok(__FieldTag::__virtual_machine),
27952                            "virtual_machine" => Ok(__FieldTag::__virtual_machine),
27953                            "interconnectAttachment" => Ok(__FieldTag::__interconnect_attachment),
27954                            "interconnect_attachment" => Ok(__FieldTag::__interconnect_attachment),
27955                            "nextHopIlbIp" => Ok(__FieldTag::__next_hop_ilb_ip),
27956                            "next_hop_ilb_ip" => Ok(__FieldTag::__next_hop_ilb_ip),
27957                            "nextHopOtherRoutes" => Ok(__FieldTag::__next_hop_other_routes),
27958                            "next_hop_other_routes" => Ok(__FieldTag::__next_hop_other_routes),
27959                            "name" => Ok(__FieldTag::__name),
27960                            "createTime" => Ok(__FieldTag::__create_time),
27961                            "create_time" => Ok(__FieldTag::__create_time),
27962                            "updateTime" => Ok(__FieldTag::__update_time),
27963                            "update_time" => Ok(__FieldTag::__update_time),
27964                            "labels" => Ok(__FieldTag::__labels),
27965                            "description" => Ok(__FieldTag::__description),
27966                            "network" => Ok(__FieldTag::__network),
27967                            "filter" => Ok(__FieldTag::__filter),
27968                            "priority" => Ok(__FieldTag::__priority),
27969                            "warnings" => Ok(__FieldTag::__warnings),
27970                            "selfLink" => Ok(__FieldTag::__self_link),
27971                            "self_link" => Ok(__FieldTag::__self_link),
27972                            "kind" => Ok(__FieldTag::__kind),
27973                            _ => Ok(__FieldTag::Unknown(value.to_string())),
27974                        }
27975                    }
27976                }
27977                deserializer.deserialize_identifier(Visitor)
27978            }
27979        }
27980        struct Visitor;
27981        impl<'de> serde::de::Visitor<'de> for Visitor {
27982            type Value = PolicyBasedRoute;
27983            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
27984                formatter.write_str("struct PolicyBasedRoute")
27985            }
27986            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
27987            where
27988                A: serde::de::MapAccess<'de>,
27989            {
27990                #[allow(unused_imports)]
27991                use serde::de::Error;
27992                use std::option::Option::Some;
27993                let mut fields = std::collections::HashSet::new();
27994                let mut result = Self::Value::new();
27995                while let Some(tag) = map.next_key::<__FieldTag>()? {
27996                    #[allow(clippy::match_single_binding)]
27997                    match tag {
27998                        __FieldTag::__virtual_machine => {
27999                            if !fields.insert(__FieldTag::__virtual_machine) {
28000                                return std::result::Result::Err(A::Error::duplicate_field(
28001                                    "multiple values for virtual_machine",
28002                                ));
28003                            }
28004                            if result.target.is_some() {
28005                                return std::result::Result::Err(A::Error::duplicate_field(
28006                                    "multiple values for `target`, a oneof with full ID .google.cloud.networkconnectivity.v1.PolicyBasedRoute.virtual_machine, latest field was virtualMachine",
28007                                ));
28008                            }
28009                            result.target = std::option::Option::Some(
28010                                crate::model::policy_based_route::Target::VirtualMachine(
28011                                    map.next_value::<std::option::Option<
28012                                        std::boxed::Box<
28013                                            crate::model::policy_based_route::VirtualMachine,
28014                                        >,
28015                                    >>()?
28016                                    .unwrap_or_default(),
28017                                ),
28018                            );
28019                        }
28020                        __FieldTag::__interconnect_attachment => {
28021                            if !fields.insert(__FieldTag::__interconnect_attachment) {
28022                                return std::result::Result::Err(A::Error::duplicate_field(
28023                                    "multiple values for interconnect_attachment",
28024                                ));
28025                            }
28026                            if result.target.is_some() {
28027                                return std::result::Result::Err(A::Error::duplicate_field(
28028                                    "multiple values for `target`, a oneof with full ID .google.cloud.networkconnectivity.v1.PolicyBasedRoute.interconnect_attachment, latest field was interconnectAttachment",
28029                                ));
28030                            }
28031                            result.target = std::option::Option::Some(
28032                                crate::model::policy_based_route::Target::InterconnectAttachment(
28033                                    map.next_value::<std::option::Option<std::boxed::Box<crate::model::policy_based_route::InterconnectAttachment>>>()?.unwrap_or_default()
28034                                ),
28035                            );
28036                        }
28037                        __FieldTag::__next_hop_ilb_ip => {
28038                            if !fields.insert(__FieldTag::__next_hop_ilb_ip) {
28039                                return std::result::Result::Err(A::Error::duplicate_field(
28040                                    "multiple values for next_hop_ilb_ip",
28041                                ));
28042                            }
28043                            if result.next_hop.is_some() {
28044                                return std::result::Result::Err(A::Error::duplicate_field(
28045                                    "multiple values for `next_hop`, a oneof with full ID .google.cloud.networkconnectivity.v1.PolicyBasedRoute.next_hop_ilb_ip, latest field was nextHopIlbIp",
28046                                ));
28047                            }
28048                            result.next_hop = std::option::Option::Some(
28049                                crate::model::policy_based_route::NextHop::NextHopIlbIp(
28050                                    map.next_value::<std::option::Option<std::string::String>>()?
28051                                        .unwrap_or_default(),
28052                                ),
28053                            );
28054                        }
28055                        __FieldTag::__next_hop_other_routes => {
28056                            if !fields.insert(__FieldTag::__next_hop_other_routes) {
28057                                return std::result::Result::Err(A::Error::duplicate_field(
28058                                    "multiple values for next_hop_other_routes",
28059                                ));
28060                            }
28061                            if result.next_hop.is_some() {
28062                                return std::result::Result::Err(A::Error::duplicate_field(
28063                                    "multiple values for `next_hop`, a oneof with full ID .google.cloud.networkconnectivity.v1.PolicyBasedRoute.next_hop_other_routes, latest field was nextHopOtherRoutes",
28064                                ));
28065                            }
28066                            result.next_hop = std::option::Option::Some(
28067                                crate::model::policy_based_route::NextHop::NextHopOtherRoutes(
28068                                    map.next_value::<std::option::Option<
28069                                        crate::model::policy_based_route::OtherRoutes,
28070                                    >>()?
28071                                    .unwrap_or_default(),
28072                                ),
28073                            );
28074                        }
28075                        __FieldTag::__name => {
28076                            if !fields.insert(__FieldTag::__name) {
28077                                return std::result::Result::Err(A::Error::duplicate_field(
28078                                    "multiple values for name",
28079                                ));
28080                            }
28081                            result.name = map
28082                                .next_value::<std::option::Option<std::string::String>>()?
28083                                .unwrap_or_default();
28084                        }
28085                        __FieldTag::__create_time => {
28086                            if !fields.insert(__FieldTag::__create_time) {
28087                                return std::result::Result::Err(A::Error::duplicate_field(
28088                                    "multiple values for create_time",
28089                                ));
28090                            }
28091                            result.create_time =
28092                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
28093                        }
28094                        __FieldTag::__update_time => {
28095                            if !fields.insert(__FieldTag::__update_time) {
28096                                return std::result::Result::Err(A::Error::duplicate_field(
28097                                    "multiple values for update_time",
28098                                ));
28099                            }
28100                            result.update_time =
28101                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
28102                        }
28103                        __FieldTag::__labels => {
28104                            if !fields.insert(__FieldTag::__labels) {
28105                                return std::result::Result::Err(A::Error::duplicate_field(
28106                                    "multiple values for labels",
28107                                ));
28108                            }
28109                            result.labels = map
28110                                .next_value::<std::option::Option<
28111                                    std::collections::HashMap<
28112                                        std::string::String,
28113                                        std::string::String,
28114                                    >,
28115                                >>()?
28116                                .unwrap_or_default();
28117                        }
28118                        __FieldTag::__description => {
28119                            if !fields.insert(__FieldTag::__description) {
28120                                return std::result::Result::Err(A::Error::duplicate_field(
28121                                    "multiple values for description",
28122                                ));
28123                            }
28124                            result.description = map
28125                                .next_value::<std::option::Option<std::string::String>>()?
28126                                .unwrap_or_default();
28127                        }
28128                        __FieldTag::__network => {
28129                            if !fields.insert(__FieldTag::__network) {
28130                                return std::result::Result::Err(A::Error::duplicate_field(
28131                                    "multiple values for network",
28132                                ));
28133                            }
28134                            result.network = map
28135                                .next_value::<std::option::Option<std::string::String>>()?
28136                                .unwrap_or_default();
28137                        }
28138                        __FieldTag::__filter => {
28139                            if !fields.insert(__FieldTag::__filter) {
28140                                return std::result::Result::Err(A::Error::duplicate_field(
28141                                    "multiple values for filter",
28142                                ));
28143                            }
28144                            result.filter = map.next_value::<std::option::Option<crate::model::policy_based_route::Filter>>()?
28145                                ;
28146                        }
28147                        __FieldTag::__priority => {
28148                            if !fields.insert(__FieldTag::__priority) {
28149                                return std::result::Result::Err(A::Error::duplicate_field(
28150                                    "multiple values for priority",
28151                                ));
28152                            }
28153                            struct __With(std::option::Option<i32>);
28154                            impl<'de> serde::de::Deserialize<'de> for __With {
28155                                fn deserialize<D>(
28156                                    deserializer: D,
28157                                ) -> std::result::Result<Self, D::Error>
28158                                where
28159                                    D: serde::de::Deserializer<'de>,
28160                                {
28161                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
28162                                }
28163                            }
28164                            result.priority = map.next_value::<__With>()?.0.unwrap_or_default();
28165                        }
28166                        __FieldTag::__warnings => {
28167                            if !fields.insert(__FieldTag::__warnings) {
28168                                return std::result::Result::Err(A::Error::duplicate_field(
28169                                    "multiple values for warnings",
28170                                ));
28171                            }
28172                            result.warnings = map
28173                                .next_value::<std::option::Option<
28174                                    std::vec::Vec<crate::model::policy_based_route::Warnings>,
28175                                >>()?
28176                                .unwrap_or_default();
28177                        }
28178                        __FieldTag::__self_link => {
28179                            if !fields.insert(__FieldTag::__self_link) {
28180                                return std::result::Result::Err(A::Error::duplicate_field(
28181                                    "multiple values for self_link",
28182                                ));
28183                            }
28184                            result.self_link = map
28185                                .next_value::<std::option::Option<std::string::String>>()?
28186                                .unwrap_or_default();
28187                        }
28188                        __FieldTag::__kind => {
28189                            if !fields.insert(__FieldTag::__kind) {
28190                                return std::result::Result::Err(A::Error::duplicate_field(
28191                                    "multiple values for kind",
28192                                ));
28193                            }
28194                            result.kind = map
28195                                .next_value::<std::option::Option<std::string::String>>()?
28196                                .unwrap_or_default();
28197                        }
28198                        __FieldTag::Unknown(key) => {
28199                            let value = map.next_value::<serde_json::Value>()?;
28200                            result._unknown_fields.insert(key, value);
28201                        }
28202                    }
28203                }
28204                std::result::Result::Ok(result)
28205            }
28206        }
28207        deserializer.deserialize_any(Visitor)
28208    }
28209}
28210
28211#[doc(hidden)]
28212impl serde::ser::Serialize for PolicyBasedRoute {
28213    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28214    where
28215        S: serde::ser::Serializer,
28216    {
28217        use serde::ser::SerializeMap;
28218        #[allow(unused_imports)]
28219        use std::option::Option::Some;
28220        let mut state = serializer.serialize_map(std::option::Option::None)?;
28221        if let Some(value) = self.virtual_machine() {
28222            state.serialize_entry("virtualMachine", value)?;
28223        }
28224        if let Some(value) = self.interconnect_attachment() {
28225            state.serialize_entry("interconnectAttachment", value)?;
28226        }
28227        if let Some(value) = self.next_hop_ilb_ip() {
28228            state.serialize_entry("nextHopIlbIp", value)?;
28229        }
28230        if let Some(value) = self.next_hop_other_routes() {
28231            state.serialize_entry("nextHopOtherRoutes", value)?;
28232        }
28233        if !self.name.is_empty() {
28234            state.serialize_entry("name", &self.name)?;
28235        }
28236        if self.create_time.is_some() {
28237            state.serialize_entry("createTime", &self.create_time)?;
28238        }
28239        if self.update_time.is_some() {
28240            state.serialize_entry("updateTime", &self.update_time)?;
28241        }
28242        if !self.labels.is_empty() {
28243            state.serialize_entry("labels", &self.labels)?;
28244        }
28245        if !self.description.is_empty() {
28246            state.serialize_entry("description", &self.description)?;
28247        }
28248        if !self.network.is_empty() {
28249            state.serialize_entry("network", &self.network)?;
28250        }
28251        if self.filter.is_some() {
28252            state.serialize_entry("filter", &self.filter)?;
28253        }
28254        if !wkt::internal::is_default(&self.priority) {
28255            struct __With<'a>(&'a i32);
28256            impl<'a> serde::ser::Serialize for __With<'a> {
28257                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28258                where
28259                    S: serde::ser::Serializer,
28260                {
28261                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
28262                }
28263            }
28264            state.serialize_entry("priority", &__With(&self.priority))?;
28265        }
28266        if !self.warnings.is_empty() {
28267            state.serialize_entry("warnings", &self.warnings)?;
28268        }
28269        if !self.self_link.is_empty() {
28270            state.serialize_entry("selfLink", &self.self_link)?;
28271        }
28272        if !self.kind.is_empty() {
28273            state.serialize_entry("kind", &self.kind)?;
28274        }
28275        if !self._unknown_fields.is_empty() {
28276            for (key, value) in self._unknown_fields.iter() {
28277                state.serialize_entry(key, &value)?;
28278            }
28279        }
28280        state.end()
28281    }
28282}
28283
28284impl std::fmt::Debug for PolicyBasedRoute {
28285    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28286        let mut debug_struct = f.debug_struct("PolicyBasedRoute");
28287        debug_struct.field("name", &self.name);
28288        debug_struct.field("create_time", &self.create_time);
28289        debug_struct.field("update_time", &self.update_time);
28290        debug_struct.field("labels", &self.labels);
28291        debug_struct.field("description", &self.description);
28292        debug_struct.field("network", &self.network);
28293        debug_struct.field("filter", &self.filter);
28294        debug_struct.field("priority", &self.priority);
28295        debug_struct.field("warnings", &self.warnings);
28296        debug_struct.field("self_link", &self.self_link);
28297        debug_struct.field("kind", &self.kind);
28298        debug_struct.field("target", &self.target);
28299        debug_struct.field("next_hop", &self.next_hop);
28300        if !self._unknown_fields.is_empty() {
28301            debug_struct.field("_unknown_fields", &self._unknown_fields);
28302        }
28303        debug_struct.finish()
28304    }
28305}
28306
28307/// Defines additional types related to [PolicyBasedRoute].
28308pub mod policy_based_route {
28309    #[allow(unused_imports)]
28310    use super::*;
28311
28312    /// VM instances that this policy-based route applies to.
28313    #[derive(Clone, Default, PartialEq)]
28314    #[non_exhaustive]
28315    pub struct VirtualMachine {
28316        /// Optional. A list of VM instance tags that this policy-based route applies
28317        /// to. VM instances that have ANY of tags specified here installs this PBR.
28318        pub tags: std::vec::Vec<std::string::String>,
28319
28320        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
28321    }
28322
28323    impl VirtualMachine {
28324        pub fn new() -> Self {
28325            std::default::Default::default()
28326        }
28327
28328        /// Sets the value of [tags][crate::model::policy_based_route::VirtualMachine::tags].
28329        pub fn set_tags<T, V>(mut self, v: T) -> Self
28330        where
28331            T: std::iter::IntoIterator<Item = V>,
28332            V: std::convert::Into<std::string::String>,
28333        {
28334            use std::iter::Iterator;
28335            self.tags = v.into_iter().map(|i| i.into()).collect();
28336            self
28337        }
28338    }
28339
28340    impl wkt::message::Message for VirtualMachine {
28341        fn typename() -> &'static str {
28342            "type.googleapis.com/google.cloud.networkconnectivity.v1.PolicyBasedRoute.VirtualMachine"
28343        }
28344    }
28345
28346    #[doc(hidden)]
28347    impl<'de> serde::de::Deserialize<'de> for VirtualMachine {
28348        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28349        where
28350            D: serde::Deserializer<'de>,
28351        {
28352            #[allow(non_camel_case_types)]
28353            #[doc(hidden)]
28354            #[derive(PartialEq, Eq, Hash)]
28355            enum __FieldTag {
28356                __tags,
28357                Unknown(std::string::String),
28358            }
28359            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
28360                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28361                where
28362                    D: serde::Deserializer<'de>,
28363                {
28364                    struct Visitor;
28365                    impl<'de> serde::de::Visitor<'de> for Visitor {
28366                        type Value = __FieldTag;
28367                        fn expecting(
28368                            &self,
28369                            formatter: &mut std::fmt::Formatter,
28370                        ) -> std::fmt::Result {
28371                            formatter.write_str("a field name for VirtualMachine")
28372                        }
28373                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
28374                        where
28375                            E: serde::de::Error,
28376                        {
28377                            use std::result::Result::Ok;
28378                            use std::string::ToString;
28379                            match value {
28380                                "tags" => Ok(__FieldTag::__tags),
28381                                _ => Ok(__FieldTag::Unknown(value.to_string())),
28382                            }
28383                        }
28384                    }
28385                    deserializer.deserialize_identifier(Visitor)
28386                }
28387            }
28388            struct Visitor;
28389            impl<'de> serde::de::Visitor<'de> for Visitor {
28390                type Value = VirtualMachine;
28391                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
28392                    formatter.write_str("struct VirtualMachine")
28393                }
28394                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
28395                where
28396                    A: serde::de::MapAccess<'de>,
28397                {
28398                    #[allow(unused_imports)]
28399                    use serde::de::Error;
28400                    use std::option::Option::Some;
28401                    let mut fields = std::collections::HashSet::new();
28402                    let mut result = Self::Value::new();
28403                    while let Some(tag) = map.next_key::<__FieldTag>()? {
28404                        #[allow(clippy::match_single_binding)]
28405                        match tag {
28406                            __FieldTag::__tags => {
28407                                if !fields.insert(__FieldTag::__tags) {
28408                                    return std::result::Result::Err(A::Error::duplicate_field(
28409                                        "multiple values for tags",
28410                                    ));
28411                                }
28412                                result.tags = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
28413                            }
28414                            __FieldTag::Unknown(key) => {
28415                                let value = map.next_value::<serde_json::Value>()?;
28416                                result._unknown_fields.insert(key, value);
28417                            }
28418                        }
28419                    }
28420                    std::result::Result::Ok(result)
28421                }
28422            }
28423            deserializer.deserialize_any(Visitor)
28424        }
28425    }
28426
28427    #[doc(hidden)]
28428    impl serde::ser::Serialize for VirtualMachine {
28429        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28430        where
28431            S: serde::ser::Serializer,
28432        {
28433            use serde::ser::SerializeMap;
28434            #[allow(unused_imports)]
28435            use std::option::Option::Some;
28436            let mut state = serializer.serialize_map(std::option::Option::None)?;
28437            if !self.tags.is_empty() {
28438                state.serialize_entry("tags", &self.tags)?;
28439            }
28440            if !self._unknown_fields.is_empty() {
28441                for (key, value) in self._unknown_fields.iter() {
28442                    state.serialize_entry(key, &value)?;
28443                }
28444            }
28445            state.end()
28446        }
28447    }
28448
28449    impl std::fmt::Debug for VirtualMachine {
28450        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28451            let mut debug_struct = f.debug_struct("VirtualMachine");
28452            debug_struct.field("tags", &self.tags);
28453            if !self._unknown_fields.is_empty() {
28454                debug_struct.field("_unknown_fields", &self._unknown_fields);
28455            }
28456            debug_struct.finish()
28457        }
28458    }
28459
28460    /// InterconnectAttachment that this route applies to.
28461    #[derive(Clone, Default, PartialEq)]
28462    #[non_exhaustive]
28463    pub struct InterconnectAttachment {
28464        /// Optional. Cloud region to install this policy-based route on interconnect
28465        /// attachment. Use `all` to install it on all interconnect attachments.
28466        pub region: std::string::String,
28467
28468        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
28469    }
28470
28471    impl InterconnectAttachment {
28472        pub fn new() -> Self {
28473            std::default::Default::default()
28474        }
28475
28476        /// Sets the value of [region][crate::model::policy_based_route::InterconnectAttachment::region].
28477        pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
28478            self.region = v.into();
28479            self
28480        }
28481    }
28482
28483    impl wkt::message::Message for InterconnectAttachment {
28484        fn typename() -> &'static str {
28485            "type.googleapis.com/google.cloud.networkconnectivity.v1.PolicyBasedRoute.InterconnectAttachment"
28486        }
28487    }
28488
28489    #[doc(hidden)]
28490    impl<'de> serde::de::Deserialize<'de> for InterconnectAttachment {
28491        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28492        where
28493            D: serde::Deserializer<'de>,
28494        {
28495            #[allow(non_camel_case_types)]
28496            #[doc(hidden)]
28497            #[derive(PartialEq, Eq, Hash)]
28498            enum __FieldTag {
28499                __region,
28500                Unknown(std::string::String),
28501            }
28502            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
28503                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28504                where
28505                    D: serde::Deserializer<'de>,
28506                {
28507                    struct Visitor;
28508                    impl<'de> serde::de::Visitor<'de> for Visitor {
28509                        type Value = __FieldTag;
28510                        fn expecting(
28511                            &self,
28512                            formatter: &mut std::fmt::Formatter,
28513                        ) -> std::fmt::Result {
28514                            formatter.write_str("a field name for InterconnectAttachment")
28515                        }
28516                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
28517                        where
28518                            E: serde::de::Error,
28519                        {
28520                            use std::result::Result::Ok;
28521                            use std::string::ToString;
28522                            match value {
28523                                "region" => Ok(__FieldTag::__region),
28524                                _ => Ok(__FieldTag::Unknown(value.to_string())),
28525                            }
28526                        }
28527                    }
28528                    deserializer.deserialize_identifier(Visitor)
28529                }
28530            }
28531            struct Visitor;
28532            impl<'de> serde::de::Visitor<'de> for Visitor {
28533                type Value = InterconnectAttachment;
28534                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
28535                    formatter.write_str("struct InterconnectAttachment")
28536                }
28537                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
28538                where
28539                    A: serde::de::MapAccess<'de>,
28540                {
28541                    #[allow(unused_imports)]
28542                    use serde::de::Error;
28543                    use std::option::Option::Some;
28544                    let mut fields = std::collections::HashSet::new();
28545                    let mut result = Self::Value::new();
28546                    while let Some(tag) = map.next_key::<__FieldTag>()? {
28547                        #[allow(clippy::match_single_binding)]
28548                        match tag {
28549                            __FieldTag::__region => {
28550                                if !fields.insert(__FieldTag::__region) {
28551                                    return std::result::Result::Err(A::Error::duplicate_field(
28552                                        "multiple values for region",
28553                                    ));
28554                                }
28555                                result.region = map
28556                                    .next_value::<std::option::Option<std::string::String>>()?
28557                                    .unwrap_or_default();
28558                            }
28559                            __FieldTag::Unknown(key) => {
28560                                let value = map.next_value::<serde_json::Value>()?;
28561                                result._unknown_fields.insert(key, value);
28562                            }
28563                        }
28564                    }
28565                    std::result::Result::Ok(result)
28566                }
28567            }
28568            deserializer.deserialize_any(Visitor)
28569        }
28570    }
28571
28572    #[doc(hidden)]
28573    impl serde::ser::Serialize for InterconnectAttachment {
28574        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28575        where
28576            S: serde::ser::Serializer,
28577        {
28578            use serde::ser::SerializeMap;
28579            #[allow(unused_imports)]
28580            use std::option::Option::Some;
28581            let mut state = serializer.serialize_map(std::option::Option::None)?;
28582            if !self.region.is_empty() {
28583                state.serialize_entry("region", &self.region)?;
28584            }
28585            if !self._unknown_fields.is_empty() {
28586                for (key, value) in self._unknown_fields.iter() {
28587                    state.serialize_entry(key, &value)?;
28588                }
28589            }
28590            state.end()
28591        }
28592    }
28593
28594    impl std::fmt::Debug for InterconnectAttachment {
28595        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28596            let mut debug_struct = f.debug_struct("InterconnectAttachment");
28597            debug_struct.field("region", &self.region);
28598            if !self._unknown_fields.is_empty() {
28599                debug_struct.field("_unknown_fields", &self._unknown_fields);
28600            }
28601            debug_struct.finish()
28602        }
28603    }
28604
28605    /// Filter matches L4 traffic.
28606    #[derive(Clone, Default, PartialEq)]
28607    #[non_exhaustive]
28608    pub struct Filter {
28609        /// Optional. The IP protocol that this policy-based route applies to. Valid
28610        /// values are 'TCP', 'UDP', and 'ALL'. Default is 'ALL'.
28611        pub ip_protocol: std::string::String,
28612
28613        /// Optional. The source IP range of outgoing packets that this policy-based
28614        /// route applies to. Default is "0.0.0.0/0" if protocol version is IPv4.
28615        pub src_range: std::string::String,
28616
28617        /// Optional. The destination IP range of outgoing packets that this
28618        /// policy-based route applies to. Default is "0.0.0.0/0" if protocol version
28619        /// is IPv4.
28620        pub dest_range: std::string::String,
28621
28622        /// Required. Internet protocol versions this policy-based route applies to.
28623        /// For this version, only IPV4 is supported. IPV6 is supported in preview.
28624        pub protocol_version: crate::model::policy_based_route::filter::ProtocolVersion,
28625
28626        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
28627    }
28628
28629    impl Filter {
28630        pub fn new() -> Self {
28631            std::default::Default::default()
28632        }
28633
28634        /// Sets the value of [ip_protocol][crate::model::policy_based_route::Filter::ip_protocol].
28635        pub fn set_ip_protocol<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
28636            self.ip_protocol = v.into();
28637            self
28638        }
28639
28640        /// Sets the value of [src_range][crate::model::policy_based_route::Filter::src_range].
28641        pub fn set_src_range<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
28642            self.src_range = v.into();
28643            self
28644        }
28645
28646        /// Sets the value of [dest_range][crate::model::policy_based_route::Filter::dest_range].
28647        pub fn set_dest_range<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
28648            self.dest_range = v.into();
28649            self
28650        }
28651
28652        /// Sets the value of [protocol_version][crate::model::policy_based_route::Filter::protocol_version].
28653        pub fn set_protocol_version<
28654            T: std::convert::Into<crate::model::policy_based_route::filter::ProtocolVersion>,
28655        >(
28656            mut self,
28657            v: T,
28658        ) -> Self {
28659            self.protocol_version = v.into();
28660            self
28661        }
28662    }
28663
28664    impl wkt::message::Message for Filter {
28665        fn typename() -> &'static str {
28666            "type.googleapis.com/google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter"
28667        }
28668    }
28669
28670    #[doc(hidden)]
28671    impl<'de> serde::de::Deserialize<'de> for Filter {
28672        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28673        where
28674            D: serde::Deserializer<'de>,
28675        {
28676            #[allow(non_camel_case_types)]
28677            #[doc(hidden)]
28678            #[derive(PartialEq, Eq, Hash)]
28679            enum __FieldTag {
28680                __ip_protocol,
28681                __src_range,
28682                __dest_range,
28683                __protocol_version,
28684                Unknown(std::string::String),
28685            }
28686            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
28687                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28688                where
28689                    D: serde::Deserializer<'de>,
28690                {
28691                    struct Visitor;
28692                    impl<'de> serde::de::Visitor<'de> for Visitor {
28693                        type Value = __FieldTag;
28694                        fn expecting(
28695                            &self,
28696                            formatter: &mut std::fmt::Formatter,
28697                        ) -> std::fmt::Result {
28698                            formatter.write_str("a field name for Filter")
28699                        }
28700                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
28701                        where
28702                            E: serde::de::Error,
28703                        {
28704                            use std::result::Result::Ok;
28705                            use std::string::ToString;
28706                            match value {
28707                                "ipProtocol" => Ok(__FieldTag::__ip_protocol),
28708                                "ip_protocol" => Ok(__FieldTag::__ip_protocol),
28709                                "srcRange" => Ok(__FieldTag::__src_range),
28710                                "src_range" => Ok(__FieldTag::__src_range),
28711                                "destRange" => Ok(__FieldTag::__dest_range),
28712                                "dest_range" => Ok(__FieldTag::__dest_range),
28713                                "protocolVersion" => Ok(__FieldTag::__protocol_version),
28714                                "protocol_version" => Ok(__FieldTag::__protocol_version),
28715                                _ => Ok(__FieldTag::Unknown(value.to_string())),
28716                            }
28717                        }
28718                    }
28719                    deserializer.deserialize_identifier(Visitor)
28720                }
28721            }
28722            struct Visitor;
28723            impl<'de> serde::de::Visitor<'de> for Visitor {
28724                type Value = Filter;
28725                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
28726                    formatter.write_str("struct Filter")
28727                }
28728                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
28729                where
28730                    A: serde::de::MapAccess<'de>,
28731                {
28732                    #[allow(unused_imports)]
28733                    use serde::de::Error;
28734                    use std::option::Option::Some;
28735                    let mut fields = std::collections::HashSet::new();
28736                    let mut result = Self::Value::new();
28737                    while let Some(tag) = map.next_key::<__FieldTag>()? {
28738                        #[allow(clippy::match_single_binding)]
28739                        match tag {
28740                            __FieldTag::__ip_protocol => {
28741                                if !fields.insert(__FieldTag::__ip_protocol) {
28742                                    return std::result::Result::Err(A::Error::duplicate_field(
28743                                        "multiple values for ip_protocol",
28744                                    ));
28745                                }
28746                                result.ip_protocol = map
28747                                    .next_value::<std::option::Option<std::string::String>>()?
28748                                    .unwrap_or_default();
28749                            }
28750                            __FieldTag::__src_range => {
28751                                if !fields.insert(__FieldTag::__src_range) {
28752                                    return std::result::Result::Err(A::Error::duplicate_field(
28753                                        "multiple values for src_range",
28754                                    ));
28755                                }
28756                                result.src_range = map
28757                                    .next_value::<std::option::Option<std::string::String>>()?
28758                                    .unwrap_or_default();
28759                            }
28760                            __FieldTag::__dest_range => {
28761                                if !fields.insert(__FieldTag::__dest_range) {
28762                                    return std::result::Result::Err(A::Error::duplicate_field(
28763                                        "multiple values for dest_range",
28764                                    ));
28765                                }
28766                                result.dest_range = map
28767                                    .next_value::<std::option::Option<std::string::String>>()?
28768                                    .unwrap_or_default();
28769                            }
28770                            __FieldTag::__protocol_version => {
28771                                if !fields.insert(__FieldTag::__protocol_version) {
28772                                    return std::result::Result::Err(A::Error::duplicate_field(
28773                                        "multiple values for protocol_version",
28774                                    ));
28775                                }
28776                                result.protocol_version = map
28777                                    .next_value::<std::option::Option<
28778                                        crate::model::policy_based_route::filter::ProtocolVersion,
28779                                    >>()?
28780                                    .unwrap_or_default();
28781                            }
28782                            __FieldTag::Unknown(key) => {
28783                                let value = map.next_value::<serde_json::Value>()?;
28784                                result._unknown_fields.insert(key, value);
28785                            }
28786                        }
28787                    }
28788                    std::result::Result::Ok(result)
28789                }
28790            }
28791            deserializer.deserialize_any(Visitor)
28792        }
28793    }
28794
28795    #[doc(hidden)]
28796    impl serde::ser::Serialize for Filter {
28797        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28798        where
28799            S: serde::ser::Serializer,
28800        {
28801            use serde::ser::SerializeMap;
28802            #[allow(unused_imports)]
28803            use std::option::Option::Some;
28804            let mut state = serializer.serialize_map(std::option::Option::None)?;
28805            if !self.ip_protocol.is_empty() {
28806                state.serialize_entry("ipProtocol", &self.ip_protocol)?;
28807            }
28808            if !self.src_range.is_empty() {
28809                state.serialize_entry("srcRange", &self.src_range)?;
28810            }
28811            if !self.dest_range.is_empty() {
28812                state.serialize_entry("destRange", &self.dest_range)?;
28813            }
28814            if !wkt::internal::is_default(&self.protocol_version) {
28815                state.serialize_entry("protocolVersion", &self.protocol_version)?;
28816            }
28817            if !self._unknown_fields.is_empty() {
28818                for (key, value) in self._unknown_fields.iter() {
28819                    state.serialize_entry(key, &value)?;
28820                }
28821            }
28822            state.end()
28823        }
28824    }
28825
28826    impl std::fmt::Debug for Filter {
28827        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28828            let mut debug_struct = f.debug_struct("Filter");
28829            debug_struct.field("ip_protocol", &self.ip_protocol);
28830            debug_struct.field("src_range", &self.src_range);
28831            debug_struct.field("dest_range", &self.dest_range);
28832            debug_struct.field("protocol_version", &self.protocol_version);
28833            if !self._unknown_fields.is_empty() {
28834                debug_struct.field("_unknown_fields", &self._unknown_fields);
28835            }
28836            debug_struct.finish()
28837        }
28838    }
28839
28840    /// Defines additional types related to [Filter].
28841    pub mod filter {
28842        #[allow(unused_imports)]
28843        use super::*;
28844
28845        /// The internet protocol version.
28846        ///
28847        /// # Working with unknown values
28848        ///
28849        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
28850        /// additional enum variants at any time. Adding new variants is not considered
28851        /// a breaking change. Applications should write their code in anticipation of:
28852        ///
28853        /// - New values appearing in future releases of the client library, **and**
28854        /// - New values received dynamically, without application changes.
28855        ///
28856        /// Please consult the [Working with enums] section in the user guide for some
28857        /// guidelines.
28858        ///
28859        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
28860        #[derive(Clone, Debug, PartialEq)]
28861        #[non_exhaustive]
28862        pub enum ProtocolVersion {
28863            /// Default value.
28864            Unspecified,
28865            /// The PBR is for IPv4 internet protocol traffic.
28866            Ipv4,
28867            /// If set, the enum was initialized with an unknown value.
28868            ///
28869            /// Applications can examine the value using [ProtocolVersion::value] or
28870            /// [ProtocolVersion::name].
28871            UnknownValue(protocol_version::UnknownValue),
28872        }
28873
28874        #[doc(hidden)]
28875        pub mod protocol_version {
28876            #[allow(unused_imports)]
28877            use super::*;
28878            #[derive(Clone, Debug, PartialEq)]
28879            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
28880        }
28881
28882        impl ProtocolVersion {
28883            /// Gets the enum value.
28884            ///
28885            /// Returns `None` if the enum contains an unknown value deserialized from
28886            /// the string representation of enums.
28887            pub fn value(&self) -> std::option::Option<i32> {
28888                match self {
28889                    Self::Unspecified => std::option::Option::Some(0),
28890                    Self::Ipv4 => std::option::Option::Some(1),
28891                    Self::UnknownValue(u) => u.0.value(),
28892                }
28893            }
28894
28895            /// Gets the enum value as a string.
28896            ///
28897            /// Returns `None` if the enum contains an unknown value deserialized from
28898            /// the integer representation of enums.
28899            pub fn name(&self) -> std::option::Option<&str> {
28900                match self {
28901                    Self::Unspecified => std::option::Option::Some("PROTOCOL_VERSION_UNSPECIFIED"),
28902                    Self::Ipv4 => std::option::Option::Some("IPV4"),
28903                    Self::UnknownValue(u) => u.0.name(),
28904                }
28905            }
28906        }
28907
28908        impl std::default::Default for ProtocolVersion {
28909            fn default() -> Self {
28910                use std::convert::From;
28911                Self::from(0)
28912            }
28913        }
28914
28915        impl std::fmt::Display for ProtocolVersion {
28916            fn fmt(
28917                &self,
28918                f: &mut std::fmt::Formatter<'_>,
28919            ) -> std::result::Result<(), std::fmt::Error> {
28920                wkt::internal::display_enum(f, self.name(), self.value())
28921            }
28922        }
28923
28924        impl std::convert::From<i32> for ProtocolVersion {
28925            fn from(value: i32) -> Self {
28926                match value {
28927                    0 => Self::Unspecified,
28928                    1 => Self::Ipv4,
28929                    _ => Self::UnknownValue(protocol_version::UnknownValue(
28930                        wkt::internal::UnknownEnumValue::Integer(value),
28931                    )),
28932                }
28933            }
28934        }
28935
28936        impl std::convert::From<&str> for ProtocolVersion {
28937            fn from(value: &str) -> Self {
28938                use std::string::ToString;
28939                match value {
28940                    "PROTOCOL_VERSION_UNSPECIFIED" => Self::Unspecified,
28941                    "IPV4" => Self::Ipv4,
28942                    _ => Self::UnknownValue(protocol_version::UnknownValue(
28943                        wkt::internal::UnknownEnumValue::String(value.to_string()),
28944                    )),
28945                }
28946            }
28947        }
28948
28949        impl serde::ser::Serialize for ProtocolVersion {
28950            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28951            where
28952                S: serde::Serializer,
28953            {
28954                match self {
28955                    Self::Unspecified => serializer.serialize_i32(0),
28956                    Self::Ipv4 => serializer.serialize_i32(1),
28957                    Self::UnknownValue(u) => u.0.serialize(serializer),
28958                }
28959            }
28960        }
28961
28962        impl<'de> serde::de::Deserialize<'de> for ProtocolVersion {
28963            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28964            where
28965                D: serde::Deserializer<'de>,
28966            {
28967                deserializer.deserialize_any(wkt::internal::EnumVisitor::<ProtocolVersion>::new(
28968                    ".google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter.ProtocolVersion",
28969                ))
28970            }
28971        }
28972    }
28973
28974    /// Informational warning message.
28975    #[derive(Clone, Default, PartialEq)]
28976    #[non_exhaustive]
28977    pub struct Warnings {
28978        /// Output only. A warning code, if applicable.
28979        pub code: crate::model::policy_based_route::warnings::Code,
28980
28981        /// Output only. Metadata about this warning in key: value format. The key
28982        /// should provides more detail on the warning being returned. For example,
28983        /// for warnings where there are no results in a list request for a
28984        /// particular zone, this key might be scope and the key value might be the
28985        /// zone name. Other examples might be a key indicating a deprecated resource
28986        /// and a suggested replacement.
28987        pub data: std::collections::HashMap<std::string::String, std::string::String>,
28988
28989        /// Output only. A human-readable description of the warning code.
28990        pub warning_message: std::string::String,
28991
28992        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
28993    }
28994
28995    impl Warnings {
28996        pub fn new() -> Self {
28997            std::default::Default::default()
28998        }
28999
29000        /// Sets the value of [code][crate::model::policy_based_route::Warnings::code].
29001        pub fn set_code<T: std::convert::Into<crate::model::policy_based_route::warnings::Code>>(
29002            mut self,
29003            v: T,
29004        ) -> Self {
29005            self.code = v.into();
29006            self
29007        }
29008
29009        /// Sets the value of [data][crate::model::policy_based_route::Warnings::data].
29010        pub fn set_data<T, K, V>(mut self, v: T) -> Self
29011        where
29012            T: std::iter::IntoIterator<Item = (K, V)>,
29013            K: std::convert::Into<std::string::String>,
29014            V: std::convert::Into<std::string::String>,
29015        {
29016            use std::iter::Iterator;
29017            self.data = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
29018            self
29019        }
29020
29021        /// Sets the value of [warning_message][crate::model::policy_based_route::Warnings::warning_message].
29022        pub fn set_warning_message<T: std::convert::Into<std::string::String>>(
29023            mut self,
29024            v: T,
29025        ) -> Self {
29026            self.warning_message = v.into();
29027            self
29028        }
29029    }
29030
29031    impl wkt::message::Message for Warnings {
29032        fn typename() -> &'static str {
29033            "type.googleapis.com/google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings"
29034        }
29035    }
29036
29037    #[doc(hidden)]
29038    impl<'de> serde::de::Deserialize<'de> for Warnings {
29039        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29040        where
29041            D: serde::Deserializer<'de>,
29042        {
29043            #[allow(non_camel_case_types)]
29044            #[doc(hidden)]
29045            #[derive(PartialEq, Eq, Hash)]
29046            enum __FieldTag {
29047                __code,
29048                __data,
29049                __warning_message,
29050                Unknown(std::string::String),
29051            }
29052            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
29053                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29054                where
29055                    D: serde::Deserializer<'de>,
29056                {
29057                    struct Visitor;
29058                    impl<'de> serde::de::Visitor<'de> for Visitor {
29059                        type Value = __FieldTag;
29060                        fn expecting(
29061                            &self,
29062                            formatter: &mut std::fmt::Formatter,
29063                        ) -> std::fmt::Result {
29064                            formatter.write_str("a field name for Warnings")
29065                        }
29066                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
29067                        where
29068                            E: serde::de::Error,
29069                        {
29070                            use std::result::Result::Ok;
29071                            use std::string::ToString;
29072                            match value {
29073                                "code" => Ok(__FieldTag::__code),
29074                                "data" => Ok(__FieldTag::__data),
29075                                "warningMessage" => Ok(__FieldTag::__warning_message),
29076                                "warning_message" => Ok(__FieldTag::__warning_message),
29077                                _ => Ok(__FieldTag::Unknown(value.to_string())),
29078                            }
29079                        }
29080                    }
29081                    deserializer.deserialize_identifier(Visitor)
29082                }
29083            }
29084            struct Visitor;
29085            impl<'de> serde::de::Visitor<'de> for Visitor {
29086                type Value = Warnings;
29087                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
29088                    formatter.write_str("struct Warnings")
29089                }
29090                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
29091                where
29092                    A: serde::de::MapAccess<'de>,
29093                {
29094                    #[allow(unused_imports)]
29095                    use serde::de::Error;
29096                    use std::option::Option::Some;
29097                    let mut fields = std::collections::HashSet::new();
29098                    let mut result = Self::Value::new();
29099                    while let Some(tag) = map.next_key::<__FieldTag>()? {
29100                        #[allow(clippy::match_single_binding)]
29101                        match tag {
29102                            __FieldTag::__code => {
29103                                if !fields.insert(__FieldTag::__code) {
29104                                    return std::result::Result::Err(A::Error::duplicate_field(
29105                                        "multiple values for code",
29106                                    ));
29107                                }
29108                                result.code = map
29109                                    .next_value::<std::option::Option<
29110                                        crate::model::policy_based_route::warnings::Code,
29111                                    >>()?
29112                                    .unwrap_or_default();
29113                            }
29114                            __FieldTag::__data => {
29115                                if !fields.insert(__FieldTag::__data) {
29116                                    return std::result::Result::Err(A::Error::duplicate_field(
29117                                        "multiple values for data",
29118                                    ));
29119                                }
29120                                result.data = map
29121                                    .next_value::<std::option::Option<
29122                                        std::collections::HashMap<
29123                                            std::string::String,
29124                                            std::string::String,
29125                                        >,
29126                                    >>()?
29127                                    .unwrap_or_default();
29128                            }
29129                            __FieldTag::__warning_message => {
29130                                if !fields.insert(__FieldTag::__warning_message) {
29131                                    return std::result::Result::Err(A::Error::duplicate_field(
29132                                        "multiple values for warning_message",
29133                                    ));
29134                                }
29135                                result.warning_message = map
29136                                    .next_value::<std::option::Option<std::string::String>>()?
29137                                    .unwrap_or_default();
29138                            }
29139                            __FieldTag::Unknown(key) => {
29140                                let value = map.next_value::<serde_json::Value>()?;
29141                                result._unknown_fields.insert(key, value);
29142                            }
29143                        }
29144                    }
29145                    std::result::Result::Ok(result)
29146                }
29147            }
29148            deserializer.deserialize_any(Visitor)
29149        }
29150    }
29151
29152    #[doc(hidden)]
29153    impl serde::ser::Serialize for Warnings {
29154        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
29155        where
29156            S: serde::ser::Serializer,
29157        {
29158            use serde::ser::SerializeMap;
29159            #[allow(unused_imports)]
29160            use std::option::Option::Some;
29161            let mut state = serializer.serialize_map(std::option::Option::None)?;
29162            if !wkt::internal::is_default(&self.code) {
29163                state.serialize_entry("code", &self.code)?;
29164            }
29165            if !self.data.is_empty() {
29166                state.serialize_entry("data", &self.data)?;
29167            }
29168            if !self.warning_message.is_empty() {
29169                state.serialize_entry("warningMessage", &self.warning_message)?;
29170            }
29171            if !self._unknown_fields.is_empty() {
29172                for (key, value) in self._unknown_fields.iter() {
29173                    state.serialize_entry(key, &value)?;
29174                }
29175            }
29176            state.end()
29177        }
29178    }
29179
29180    impl std::fmt::Debug for Warnings {
29181        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29182            let mut debug_struct = f.debug_struct("Warnings");
29183            debug_struct.field("code", &self.code);
29184            debug_struct.field("data", &self.data);
29185            debug_struct.field("warning_message", &self.warning_message);
29186            if !self._unknown_fields.is_empty() {
29187                debug_struct.field("_unknown_fields", &self._unknown_fields);
29188            }
29189            debug_struct.finish()
29190        }
29191    }
29192
29193    /// Defines additional types related to [Warnings].
29194    pub mod warnings {
29195        #[allow(unused_imports)]
29196        use super::*;
29197
29198        /// Warning code for policy-based routing. Expect to add values in the
29199        /// future.
29200        ///
29201        /// # Working with unknown values
29202        ///
29203        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
29204        /// additional enum variants at any time. Adding new variants is not considered
29205        /// a breaking change. Applications should write their code in anticipation of:
29206        ///
29207        /// - New values appearing in future releases of the client library, **and**
29208        /// - New values received dynamically, without application changes.
29209        ///
29210        /// Please consult the [Working with enums] section in the user guide for some
29211        /// guidelines.
29212        ///
29213        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
29214        #[derive(Clone, Debug, PartialEq)]
29215        #[non_exhaustive]
29216        pub enum Code {
29217            /// Default value.
29218            WarningUnspecified,
29219            /// The policy-based route is not active and functioning. Common causes are
29220            /// that the dependent network was deleted or the resource project was
29221            /// turned off.
29222            ResourceNotActive,
29223            /// The policy-based route is being modified (e.g. created/deleted) at this
29224            /// time.
29225            ResourceBeingModified,
29226            /// If set, the enum was initialized with an unknown value.
29227            ///
29228            /// Applications can examine the value using [Code::value] or
29229            /// [Code::name].
29230            UnknownValue(code::UnknownValue),
29231        }
29232
29233        #[doc(hidden)]
29234        pub mod code {
29235            #[allow(unused_imports)]
29236            use super::*;
29237            #[derive(Clone, Debug, PartialEq)]
29238            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
29239        }
29240
29241        impl Code {
29242            /// Gets the enum value.
29243            ///
29244            /// Returns `None` if the enum contains an unknown value deserialized from
29245            /// the string representation of enums.
29246            pub fn value(&self) -> std::option::Option<i32> {
29247                match self {
29248                    Self::WarningUnspecified => std::option::Option::Some(0),
29249                    Self::ResourceNotActive => std::option::Option::Some(1),
29250                    Self::ResourceBeingModified => std::option::Option::Some(2),
29251                    Self::UnknownValue(u) => u.0.value(),
29252                }
29253            }
29254
29255            /// Gets the enum value as a string.
29256            ///
29257            /// Returns `None` if the enum contains an unknown value deserialized from
29258            /// the integer representation of enums.
29259            pub fn name(&self) -> std::option::Option<&str> {
29260                match self {
29261                    Self::WarningUnspecified => std::option::Option::Some("WARNING_UNSPECIFIED"),
29262                    Self::ResourceNotActive => std::option::Option::Some("RESOURCE_NOT_ACTIVE"),
29263                    Self::ResourceBeingModified => {
29264                        std::option::Option::Some("RESOURCE_BEING_MODIFIED")
29265                    }
29266                    Self::UnknownValue(u) => u.0.name(),
29267                }
29268            }
29269        }
29270
29271        impl std::default::Default for Code {
29272            fn default() -> Self {
29273                use std::convert::From;
29274                Self::from(0)
29275            }
29276        }
29277
29278        impl std::fmt::Display for Code {
29279            fn fmt(
29280                &self,
29281                f: &mut std::fmt::Formatter<'_>,
29282            ) -> std::result::Result<(), std::fmt::Error> {
29283                wkt::internal::display_enum(f, self.name(), self.value())
29284            }
29285        }
29286
29287        impl std::convert::From<i32> for Code {
29288            fn from(value: i32) -> Self {
29289                match value {
29290                    0 => Self::WarningUnspecified,
29291                    1 => Self::ResourceNotActive,
29292                    2 => Self::ResourceBeingModified,
29293                    _ => Self::UnknownValue(code::UnknownValue(
29294                        wkt::internal::UnknownEnumValue::Integer(value),
29295                    )),
29296                }
29297            }
29298        }
29299
29300        impl std::convert::From<&str> for Code {
29301            fn from(value: &str) -> Self {
29302                use std::string::ToString;
29303                match value {
29304                    "WARNING_UNSPECIFIED" => Self::WarningUnspecified,
29305                    "RESOURCE_NOT_ACTIVE" => Self::ResourceNotActive,
29306                    "RESOURCE_BEING_MODIFIED" => Self::ResourceBeingModified,
29307                    _ => Self::UnknownValue(code::UnknownValue(
29308                        wkt::internal::UnknownEnumValue::String(value.to_string()),
29309                    )),
29310                }
29311            }
29312        }
29313
29314        impl serde::ser::Serialize for Code {
29315            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
29316            where
29317                S: serde::Serializer,
29318            {
29319                match self {
29320                    Self::WarningUnspecified => serializer.serialize_i32(0),
29321                    Self::ResourceNotActive => serializer.serialize_i32(1),
29322                    Self::ResourceBeingModified => serializer.serialize_i32(2),
29323                    Self::UnknownValue(u) => u.0.serialize(serializer),
29324                }
29325            }
29326        }
29327
29328        impl<'de> serde::de::Deserialize<'de> for Code {
29329            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29330            where
29331                D: serde::Deserializer<'de>,
29332            {
29333                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Code>::new(
29334                    ".google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.Code",
29335                ))
29336            }
29337        }
29338    }
29339
29340    /// The other routing cases.
29341    ///
29342    /// # Working with unknown values
29343    ///
29344    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
29345    /// additional enum variants at any time. Adding new variants is not considered
29346    /// a breaking change. Applications should write their code in anticipation of:
29347    ///
29348    /// - New values appearing in future releases of the client library, **and**
29349    /// - New values received dynamically, without application changes.
29350    ///
29351    /// Please consult the [Working with enums] section in the user guide for some
29352    /// guidelines.
29353    ///
29354    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
29355    #[derive(Clone, Debug, PartialEq)]
29356    #[non_exhaustive]
29357    pub enum OtherRoutes {
29358        /// Default value.
29359        Unspecified,
29360        /// Use the routes from the default routing tables (system-generated routes,
29361        /// custom routes, peering route) to determine the next hop. This effectively
29362        /// excludes matching packets being applied on other PBRs with a lower
29363        /// priority.
29364        DefaultRouting,
29365        /// If set, the enum was initialized with an unknown value.
29366        ///
29367        /// Applications can examine the value using [OtherRoutes::value] or
29368        /// [OtherRoutes::name].
29369        UnknownValue(other_routes::UnknownValue),
29370    }
29371
29372    #[doc(hidden)]
29373    pub mod other_routes {
29374        #[allow(unused_imports)]
29375        use super::*;
29376        #[derive(Clone, Debug, PartialEq)]
29377        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
29378    }
29379
29380    impl OtherRoutes {
29381        /// Gets the enum value.
29382        ///
29383        /// Returns `None` if the enum contains an unknown value deserialized from
29384        /// the string representation of enums.
29385        pub fn value(&self) -> std::option::Option<i32> {
29386            match self {
29387                Self::Unspecified => std::option::Option::Some(0),
29388                Self::DefaultRouting => std::option::Option::Some(1),
29389                Self::UnknownValue(u) => u.0.value(),
29390            }
29391        }
29392
29393        /// Gets the enum value as a string.
29394        ///
29395        /// Returns `None` if the enum contains an unknown value deserialized from
29396        /// the integer representation of enums.
29397        pub fn name(&self) -> std::option::Option<&str> {
29398            match self {
29399                Self::Unspecified => std::option::Option::Some("OTHER_ROUTES_UNSPECIFIED"),
29400                Self::DefaultRouting => std::option::Option::Some("DEFAULT_ROUTING"),
29401                Self::UnknownValue(u) => u.0.name(),
29402            }
29403        }
29404    }
29405
29406    impl std::default::Default for OtherRoutes {
29407        fn default() -> Self {
29408            use std::convert::From;
29409            Self::from(0)
29410        }
29411    }
29412
29413    impl std::fmt::Display for OtherRoutes {
29414        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
29415            wkt::internal::display_enum(f, self.name(), self.value())
29416        }
29417    }
29418
29419    impl std::convert::From<i32> for OtherRoutes {
29420        fn from(value: i32) -> Self {
29421            match value {
29422                0 => Self::Unspecified,
29423                1 => Self::DefaultRouting,
29424                _ => Self::UnknownValue(other_routes::UnknownValue(
29425                    wkt::internal::UnknownEnumValue::Integer(value),
29426                )),
29427            }
29428        }
29429    }
29430
29431    impl std::convert::From<&str> for OtherRoutes {
29432        fn from(value: &str) -> Self {
29433            use std::string::ToString;
29434            match value {
29435                "OTHER_ROUTES_UNSPECIFIED" => Self::Unspecified,
29436                "DEFAULT_ROUTING" => Self::DefaultRouting,
29437                _ => Self::UnknownValue(other_routes::UnknownValue(
29438                    wkt::internal::UnknownEnumValue::String(value.to_string()),
29439                )),
29440            }
29441        }
29442    }
29443
29444    impl serde::ser::Serialize for OtherRoutes {
29445        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
29446        where
29447            S: serde::Serializer,
29448        {
29449            match self {
29450                Self::Unspecified => serializer.serialize_i32(0),
29451                Self::DefaultRouting => serializer.serialize_i32(1),
29452                Self::UnknownValue(u) => u.0.serialize(serializer),
29453            }
29454        }
29455    }
29456
29457    impl<'de> serde::de::Deserialize<'de> for OtherRoutes {
29458        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29459        where
29460            D: serde::Deserializer<'de>,
29461        {
29462            deserializer.deserialize_any(wkt::internal::EnumVisitor::<OtherRoutes>::new(
29463                ".google.cloud.networkconnectivity.v1.PolicyBasedRoute.OtherRoutes",
29464            ))
29465        }
29466    }
29467
29468    /// Target specifies network endpoints that this policy-based route applies to.
29469    /// If no target is specified, the PBR will be installed on all network
29470    /// endpoints (e.g. VMs, VPNs, and Interconnects) in the VPC.
29471    #[derive(Clone, Debug, PartialEq)]
29472    #[non_exhaustive]
29473    pub enum Target {
29474        /// Optional. VM instances that this policy-based route applies to.
29475        VirtualMachine(std::boxed::Box<crate::model::policy_based_route::VirtualMachine>),
29476        /// Optional. The interconnect attachments that this policy-based route
29477        /// applies to.
29478        InterconnectAttachment(
29479            std::boxed::Box<crate::model::policy_based_route::InterconnectAttachment>,
29480        ),
29481    }
29482
29483    #[derive(Clone, Debug, PartialEq)]
29484    #[non_exhaustive]
29485    pub enum NextHop {
29486        /// Optional. The IP address of a global-access-enabled L4 ILB that is the
29487        /// next hop for matching packets. For this version, only nextHopIlbIp is
29488        /// supported.
29489        NextHopIlbIp(std::string::String),
29490        /// Optional. Other routes that will be referenced to determine the next hop
29491        /// of the packet.
29492        NextHopOtherRoutes(crate::model::policy_based_route::OtherRoutes),
29493    }
29494}
29495
29496/// Request for
29497/// [PolicyBasedRoutingService.ListPolicyBasedRoutes][google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.ListPolicyBasedRoutes]
29498/// method.
29499///
29500/// [google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.ListPolicyBasedRoutes]: crate::client::PolicyBasedRoutingService::list_policy_based_routes
29501#[derive(Clone, Default, PartialEq)]
29502#[non_exhaustive]
29503pub struct ListPolicyBasedRoutesRequest {
29504    /// Required. The parent resource's name.
29505    pub parent: std::string::String,
29506
29507    /// The maximum number of results per page that should be returned.
29508    pub page_size: i32,
29509
29510    /// The page token.
29511    pub page_token: std::string::String,
29512
29513    /// A filter expression that filters the results listed in the response.
29514    pub filter: std::string::String,
29515
29516    /// Sort the results by a certain order.
29517    pub order_by: std::string::String,
29518
29519    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
29520}
29521
29522impl ListPolicyBasedRoutesRequest {
29523    pub fn new() -> Self {
29524        std::default::Default::default()
29525    }
29526
29527    /// Sets the value of [parent][crate::model::ListPolicyBasedRoutesRequest::parent].
29528    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
29529        self.parent = v.into();
29530        self
29531    }
29532
29533    /// Sets the value of [page_size][crate::model::ListPolicyBasedRoutesRequest::page_size].
29534    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
29535        self.page_size = v.into();
29536        self
29537    }
29538
29539    /// Sets the value of [page_token][crate::model::ListPolicyBasedRoutesRequest::page_token].
29540    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
29541        self.page_token = v.into();
29542        self
29543    }
29544
29545    /// Sets the value of [filter][crate::model::ListPolicyBasedRoutesRequest::filter].
29546    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
29547        self.filter = v.into();
29548        self
29549    }
29550
29551    /// Sets the value of [order_by][crate::model::ListPolicyBasedRoutesRequest::order_by].
29552    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
29553        self.order_by = v.into();
29554        self
29555    }
29556}
29557
29558impl wkt::message::Message for ListPolicyBasedRoutesRequest {
29559    fn typename() -> &'static str {
29560        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesRequest"
29561    }
29562}
29563
29564#[doc(hidden)]
29565impl<'de> serde::de::Deserialize<'de> for ListPolicyBasedRoutesRequest {
29566    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29567    where
29568        D: serde::Deserializer<'de>,
29569    {
29570        #[allow(non_camel_case_types)]
29571        #[doc(hidden)]
29572        #[derive(PartialEq, Eq, Hash)]
29573        enum __FieldTag {
29574            __parent,
29575            __page_size,
29576            __page_token,
29577            __filter,
29578            __order_by,
29579            Unknown(std::string::String),
29580        }
29581        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
29582            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29583            where
29584                D: serde::Deserializer<'de>,
29585            {
29586                struct Visitor;
29587                impl<'de> serde::de::Visitor<'de> for Visitor {
29588                    type Value = __FieldTag;
29589                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
29590                        formatter.write_str("a field name for ListPolicyBasedRoutesRequest")
29591                    }
29592                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
29593                    where
29594                        E: serde::de::Error,
29595                    {
29596                        use std::result::Result::Ok;
29597                        use std::string::ToString;
29598                        match value {
29599                            "parent" => Ok(__FieldTag::__parent),
29600                            "pageSize" => Ok(__FieldTag::__page_size),
29601                            "page_size" => Ok(__FieldTag::__page_size),
29602                            "pageToken" => Ok(__FieldTag::__page_token),
29603                            "page_token" => Ok(__FieldTag::__page_token),
29604                            "filter" => Ok(__FieldTag::__filter),
29605                            "orderBy" => Ok(__FieldTag::__order_by),
29606                            "order_by" => Ok(__FieldTag::__order_by),
29607                            _ => Ok(__FieldTag::Unknown(value.to_string())),
29608                        }
29609                    }
29610                }
29611                deserializer.deserialize_identifier(Visitor)
29612            }
29613        }
29614        struct Visitor;
29615        impl<'de> serde::de::Visitor<'de> for Visitor {
29616            type Value = ListPolicyBasedRoutesRequest;
29617            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
29618                formatter.write_str("struct ListPolicyBasedRoutesRequest")
29619            }
29620            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
29621            where
29622                A: serde::de::MapAccess<'de>,
29623            {
29624                #[allow(unused_imports)]
29625                use serde::de::Error;
29626                use std::option::Option::Some;
29627                let mut fields = std::collections::HashSet::new();
29628                let mut result = Self::Value::new();
29629                while let Some(tag) = map.next_key::<__FieldTag>()? {
29630                    #[allow(clippy::match_single_binding)]
29631                    match tag {
29632                        __FieldTag::__parent => {
29633                            if !fields.insert(__FieldTag::__parent) {
29634                                return std::result::Result::Err(A::Error::duplicate_field(
29635                                    "multiple values for parent",
29636                                ));
29637                            }
29638                            result.parent = map
29639                                .next_value::<std::option::Option<std::string::String>>()?
29640                                .unwrap_or_default();
29641                        }
29642                        __FieldTag::__page_size => {
29643                            if !fields.insert(__FieldTag::__page_size) {
29644                                return std::result::Result::Err(A::Error::duplicate_field(
29645                                    "multiple values for page_size",
29646                                ));
29647                            }
29648                            struct __With(std::option::Option<i32>);
29649                            impl<'de> serde::de::Deserialize<'de> for __With {
29650                                fn deserialize<D>(
29651                                    deserializer: D,
29652                                ) -> std::result::Result<Self, D::Error>
29653                                where
29654                                    D: serde::de::Deserializer<'de>,
29655                                {
29656                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
29657                                }
29658                            }
29659                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
29660                        }
29661                        __FieldTag::__page_token => {
29662                            if !fields.insert(__FieldTag::__page_token) {
29663                                return std::result::Result::Err(A::Error::duplicate_field(
29664                                    "multiple values for page_token",
29665                                ));
29666                            }
29667                            result.page_token = map
29668                                .next_value::<std::option::Option<std::string::String>>()?
29669                                .unwrap_or_default();
29670                        }
29671                        __FieldTag::__filter => {
29672                            if !fields.insert(__FieldTag::__filter) {
29673                                return std::result::Result::Err(A::Error::duplicate_field(
29674                                    "multiple values for filter",
29675                                ));
29676                            }
29677                            result.filter = map
29678                                .next_value::<std::option::Option<std::string::String>>()?
29679                                .unwrap_or_default();
29680                        }
29681                        __FieldTag::__order_by => {
29682                            if !fields.insert(__FieldTag::__order_by) {
29683                                return std::result::Result::Err(A::Error::duplicate_field(
29684                                    "multiple values for order_by",
29685                                ));
29686                            }
29687                            result.order_by = map
29688                                .next_value::<std::option::Option<std::string::String>>()?
29689                                .unwrap_or_default();
29690                        }
29691                        __FieldTag::Unknown(key) => {
29692                            let value = map.next_value::<serde_json::Value>()?;
29693                            result._unknown_fields.insert(key, value);
29694                        }
29695                    }
29696                }
29697                std::result::Result::Ok(result)
29698            }
29699        }
29700        deserializer.deserialize_any(Visitor)
29701    }
29702}
29703
29704#[doc(hidden)]
29705impl serde::ser::Serialize for ListPolicyBasedRoutesRequest {
29706    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
29707    where
29708        S: serde::ser::Serializer,
29709    {
29710        use serde::ser::SerializeMap;
29711        #[allow(unused_imports)]
29712        use std::option::Option::Some;
29713        let mut state = serializer.serialize_map(std::option::Option::None)?;
29714        if !self.parent.is_empty() {
29715            state.serialize_entry("parent", &self.parent)?;
29716        }
29717        if !wkt::internal::is_default(&self.page_size) {
29718            struct __With<'a>(&'a i32);
29719            impl<'a> serde::ser::Serialize for __With<'a> {
29720                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
29721                where
29722                    S: serde::ser::Serializer,
29723                {
29724                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
29725                }
29726            }
29727            state.serialize_entry("pageSize", &__With(&self.page_size))?;
29728        }
29729        if !self.page_token.is_empty() {
29730            state.serialize_entry("pageToken", &self.page_token)?;
29731        }
29732        if !self.filter.is_empty() {
29733            state.serialize_entry("filter", &self.filter)?;
29734        }
29735        if !self.order_by.is_empty() {
29736            state.serialize_entry("orderBy", &self.order_by)?;
29737        }
29738        if !self._unknown_fields.is_empty() {
29739            for (key, value) in self._unknown_fields.iter() {
29740                state.serialize_entry(key, &value)?;
29741            }
29742        }
29743        state.end()
29744    }
29745}
29746
29747impl std::fmt::Debug for ListPolicyBasedRoutesRequest {
29748    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29749        let mut debug_struct = f.debug_struct("ListPolicyBasedRoutesRequest");
29750        debug_struct.field("parent", &self.parent);
29751        debug_struct.field("page_size", &self.page_size);
29752        debug_struct.field("page_token", &self.page_token);
29753        debug_struct.field("filter", &self.filter);
29754        debug_struct.field("order_by", &self.order_by);
29755        if !self._unknown_fields.is_empty() {
29756            debug_struct.field("_unknown_fields", &self._unknown_fields);
29757        }
29758        debug_struct.finish()
29759    }
29760}
29761
29762/// Response for
29763/// [PolicyBasedRoutingService.ListPolicyBasedRoutes][google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.ListPolicyBasedRoutes]
29764/// method.
29765///
29766/// [google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.ListPolicyBasedRoutes]: crate::client::PolicyBasedRoutingService::list_policy_based_routes
29767#[derive(Clone, Default, PartialEq)]
29768#[non_exhaustive]
29769pub struct ListPolicyBasedRoutesResponse {
29770    /// Policy-based routes to be returned.
29771    pub policy_based_routes: std::vec::Vec<crate::model::PolicyBasedRoute>,
29772
29773    /// The next pagination token in the List response. It should be used as
29774    /// page_token for the following request. An empty value means no more result.
29775    pub next_page_token: std::string::String,
29776
29777    /// Locations that could not be reached.
29778    pub unreachable: std::vec::Vec<std::string::String>,
29779
29780    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
29781}
29782
29783impl ListPolicyBasedRoutesResponse {
29784    pub fn new() -> Self {
29785        std::default::Default::default()
29786    }
29787
29788    /// Sets the value of [policy_based_routes][crate::model::ListPolicyBasedRoutesResponse::policy_based_routes].
29789    pub fn set_policy_based_routes<T, V>(mut self, v: T) -> Self
29790    where
29791        T: std::iter::IntoIterator<Item = V>,
29792        V: std::convert::Into<crate::model::PolicyBasedRoute>,
29793    {
29794        use std::iter::Iterator;
29795        self.policy_based_routes = v.into_iter().map(|i| i.into()).collect();
29796        self
29797    }
29798
29799    /// Sets the value of [next_page_token][crate::model::ListPolicyBasedRoutesResponse::next_page_token].
29800    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
29801        self.next_page_token = v.into();
29802        self
29803    }
29804
29805    /// Sets the value of [unreachable][crate::model::ListPolicyBasedRoutesResponse::unreachable].
29806    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
29807    where
29808        T: std::iter::IntoIterator<Item = V>,
29809        V: std::convert::Into<std::string::String>,
29810    {
29811        use std::iter::Iterator;
29812        self.unreachable = v.into_iter().map(|i| i.into()).collect();
29813        self
29814    }
29815}
29816
29817impl wkt::message::Message for ListPolicyBasedRoutesResponse {
29818    fn typename() -> &'static str {
29819        "type.googleapis.com/google.cloud.networkconnectivity.v1.ListPolicyBasedRoutesResponse"
29820    }
29821}
29822
29823#[doc(hidden)]
29824impl gax::paginator::internal::PageableResponse for ListPolicyBasedRoutesResponse {
29825    type PageItem = crate::model::PolicyBasedRoute;
29826
29827    fn items(self) -> std::vec::Vec<Self::PageItem> {
29828        self.policy_based_routes
29829    }
29830
29831    fn next_page_token(&self) -> std::string::String {
29832        use std::clone::Clone;
29833        self.next_page_token.clone()
29834    }
29835}
29836
29837#[doc(hidden)]
29838impl<'de> serde::de::Deserialize<'de> for ListPolicyBasedRoutesResponse {
29839    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29840    where
29841        D: serde::Deserializer<'de>,
29842    {
29843        #[allow(non_camel_case_types)]
29844        #[doc(hidden)]
29845        #[derive(PartialEq, Eq, Hash)]
29846        enum __FieldTag {
29847            __policy_based_routes,
29848            __next_page_token,
29849            __unreachable,
29850            Unknown(std::string::String),
29851        }
29852        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
29853            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
29854            where
29855                D: serde::Deserializer<'de>,
29856            {
29857                struct Visitor;
29858                impl<'de> serde::de::Visitor<'de> for Visitor {
29859                    type Value = __FieldTag;
29860                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
29861                        formatter.write_str("a field name for ListPolicyBasedRoutesResponse")
29862                    }
29863                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
29864                    where
29865                        E: serde::de::Error,
29866                    {
29867                        use std::result::Result::Ok;
29868                        use std::string::ToString;
29869                        match value {
29870                            "policyBasedRoutes" => Ok(__FieldTag::__policy_based_routes),
29871                            "policy_based_routes" => Ok(__FieldTag::__policy_based_routes),
29872                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
29873                            "next_page_token" => Ok(__FieldTag::__next_page_token),
29874                            "unreachable" => Ok(__FieldTag::__unreachable),
29875                            _ => Ok(__FieldTag::Unknown(value.to_string())),
29876                        }
29877                    }
29878                }
29879                deserializer.deserialize_identifier(Visitor)
29880            }
29881        }
29882        struct Visitor;
29883        impl<'de> serde::de::Visitor<'de> for Visitor {
29884            type Value = ListPolicyBasedRoutesResponse;
29885            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
29886                formatter.write_str("struct ListPolicyBasedRoutesResponse")
29887            }
29888            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
29889            where
29890                A: serde::de::MapAccess<'de>,
29891            {
29892                #[allow(unused_imports)]
29893                use serde::de::Error;
29894                use std::option::Option::Some;
29895                let mut fields = std::collections::HashSet::new();
29896                let mut result = Self::Value::new();
29897                while let Some(tag) = map.next_key::<__FieldTag>()? {
29898                    #[allow(clippy::match_single_binding)]
29899                    match tag {
29900                        __FieldTag::__policy_based_routes => {
29901                            if !fields.insert(__FieldTag::__policy_based_routes) {
29902                                return std::result::Result::Err(A::Error::duplicate_field(
29903                                    "multiple values for policy_based_routes",
29904                                ));
29905                            }
29906                            result.policy_based_routes =
29907                                map.next_value::<std::option::Option<
29908                                    std::vec::Vec<crate::model::PolicyBasedRoute>,
29909                                >>()?
29910                                .unwrap_or_default();
29911                        }
29912                        __FieldTag::__next_page_token => {
29913                            if !fields.insert(__FieldTag::__next_page_token) {
29914                                return std::result::Result::Err(A::Error::duplicate_field(
29915                                    "multiple values for next_page_token",
29916                                ));
29917                            }
29918                            result.next_page_token = map
29919                                .next_value::<std::option::Option<std::string::String>>()?
29920                                .unwrap_or_default();
29921                        }
29922                        __FieldTag::__unreachable => {
29923                            if !fields.insert(__FieldTag::__unreachable) {
29924                                return std::result::Result::Err(A::Error::duplicate_field(
29925                                    "multiple values for unreachable",
29926                                ));
29927                            }
29928                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
29929                        }
29930                        __FieldTag::Unknown(key) => {
29931                            let value = map.next_value::<serde_json::Value>()?;
29932                            result._unknown_fields.insert(key, value);
29933                        }
29934                    }
29935                }
29936                std::result::Result::Ok(result)
29937            }
29938        }
29939        deserializer.deserialize_any(Visitor)
29940    }
29941}
29942
29943#[doc(hidden)]
29944impl serde::ser::Serialize for ListPolicyBasedRoutesResponse {
29945    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
29946    where
29947        S: serde::ser::Serializer,
29948    {
29949        use serde::ser::SerializeMap;
29950        #[allow(unused_imports)]
29951        use std::option::Option::Some;
29952        let mut state = serializer.serialize_map(std::option::Option::None)?;
29953        if !self.policy_based_routes.is_empty() {
29954            state.serialize_entry("policyBasedRoutes", &self.policy_based_routes)?;
29955        }
29956        if !self.next_page_token.is_empty() {
29957            state.serialize_entry("nextPageToken", &self.next_page_token)?;
29958        }
29959        if !self.unreachable.is_empty() {
29960            state.serialize_entry("unreachable", &self.unreachable)?;
29961        }
29962        if !self._unknown_fields.is_empty() {
29963            for (key, value) in self._unknown_fields.iter() {
29964                state.serialize_entry(key, &value)?;
29965            }
29966        }
29967        state.end()
29968    }
29969}
29970
29971impl std::fmt::Debug for ListPolicyBasedRoutesResponse {
29972    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29973        let mut debug_struct = f.debug_struct("ListPolicyBasedRoutesResponse");
29974        debug_struct.field("policy_based_routes", &self.policy_based_routes);
29975        debug_struct.field("next_page_token", &self.next_page_token);
29976        debug_struct.field("unreachable", &self.unreachable);
29977        if !self._unknown_fields.is_empty() {
29978            debug_struct.field("_unknown_fields", &self._unknown_fields);
29979        }
29980        debug_struct.finish()
29981    }
29982}
29983
29984/// Request for
29985/// [PolicyBasedRoutingService.GetPolicyBasedRoute][google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.GetPolicyBasedRoute]
29986/// method.
29987///
29988/// [google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.GetPolicyBasedRoute]: crate::client::PolicyBasedRoutingService::get_policy_based_route
29989#[derive(Clone, Default, PartialEq)]
29990#[non_exhaustive]
29991pub struct GetPolicyBasedRouteRequest {
29992    /// Required. Name of the PolicyBasedRoute resource to get.
29993    pub name: std::string::String,
29994
29995    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
29996}
29997
29998impl GetPolicyBasedRouteRequest {
29999    pub fn new() -> Self {
30000        std::default::Default::default()
30001    }
30002
30003    /// Sets the value of [name][crate::model::GetPolicyBasedRouteRequest::name].
30004    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
30005        self.name = v.into();
30006        self
30007    }
30008}
30009
30010impl wkt::message::Message for GetPolicyBasedRouteRequest {
30011    fn typename() -> &'static str {
30012        "type.googleapis.com/google.cloud.networkconnectivity.v1.GetPolicyBasedRouteRequest"
30013    }
30014}
30015
30016#[doc(hidden)]
30017impl<'de> serde::de::Deserialize<'de> for GetPolicyBasedRouteRequest {
30018    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30019    where
30020        D: serde::Deserializer<'de>,
30021    {
30022        #[allow(non_camel_case_types)]
30023        #[doc(hidden)]
30024        #[derive(PartialEq, Eq, Hash)]
30025        enum __FieldTag {
30026            __name,
30027            Unknown(std::string::String),
30028        }
30029        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
30030            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30031            where
30032                D: serde::Deserializer<'de>,
30033            {
30034                struct Visitor;
30035                impl<'de> serde::de::Visitor<'de> for Visitor {
30036                    type Value = __FieldTag;
30037                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
30038                        formatter.write_str("a field name for GetPolicyBasedRouteRequest")
30039                    }
30040                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
30041                    where
30042                        E: serde::de::Error,
30043                    {
30044                        use std::result::Result::Ok;
30045                        use std::string::ToString;
30046                        match value {
30047                            "name" => Ok(__FieldTag::__name),
30048                            _ => Ok(__FieldTag::Unknown(value.to_string())),
30049                        }
30050                    }
30051                }
30052                deserializer.deserialize_identifier(Visitor)
30053            }
30054        }
30055        struct Visitor;
30056        impl<'de> serde::de::Visitor<'de> for Visitor {
30057            type Value = GetPolicyBasedRouteRequest;
30058            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
30059                formatter.write_str("struct GetPolicyBasedRouteRequest")
30060            }
30061            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
30062            where
30063                A: serde::de::MapAccess<'de>,
30064            {
30065                #[allow(unused_imports)]
30066                use serde::de::Error;
30067                use std::option::Option::Some;
30068                let mut fields = std::collections::HashSet::new();
30069                let mut result = Self::Value::new();
30070                while let Some(tag) = map.next_key::<__FieldTag>()? {
30071                    #[allow(clippy::match_single_binding)]
30072                    match tag {
30073                        __FieldTag::__name => {
30074                            if !fields.insert(__FieldTag::__name) {
30075                                return std::result::Result::Err(A::Error::duplicate_field(
30076                                    "multiple values for name",
30077                                ));
30078                            }
30079                            result.name = map
30080                                .next_value::<std::option::Option<std::string::String>>()?
30081                                .unwrap_or_default();
30082                        }
30083                        __FieldTag::Unknown(key) => {
30084                            let value = map.next_value::<serde_json::Value>()?;
30085                            result._unknown_fields.insert(key, value);
30086                        }
30087                    }
30088                }
30089                std::result::Result::Ok(result)
30090            }
30091        }
30092        deserializer.deserialize_any(Visitor)
30093    }
30094}
30095
30096#[doc(hidden)]
30097impl serde::ser::Serialize for GetPolicyBasedRouteRequest {
30098    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
30099    where
30100        S: serde::ser::Serializer,
30101    {
30102        use serde::ser::SerializeMap;
30103        #[allow(unused_imports)]
30104        use std::option::Option::Some;
30105        let mut state = serializer.serialize_map(std::option::Option::None)?;
30106        if !self.name.is_empty() {
30107            state.serialize_entry("name", &self.name)?;
30108        }
30109        if !self._unknown_fields.is_empty() {
30110            for (key, value) in self._unknown_fields.iter() {
30111                state.serialize_entry(key, &value)?;
30112            }
30113        }
30114        state.end()
30115    }
30116}
30117
30118impl std::fmt::Debug for GetPolicyBasedRouteRequest {
30119    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
30120        let mut debug_struct = f.debug_struct("GetPolicyBasedRouteRequest");
30121        debug_struct.field("name", &self.name);
30122        if !self._unknown_fields.is_empty() {
30123            debug_struct.field("_unknown_fields", &self._unknown_fields);
30124        }
30125        debug_struct.finish()
30126    }
30127}
30128
30129/// Request for
30130/// [PolicyBasedRoutingService.CreatePolicyBasedRoute][google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.CreatePolicyBasedRoute]
30131/// method.
30132///
30133/// [google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.CreatePolicyBasedRoute]: crate::client::PolicyBasedRoutingService::create_policy_based_route
30134#[derive(Clone, Default, PartialEq)]
30135#[non_exhaustive]
30136pub struct CreatePolicyBasedRouteRequest {
30137    /// Required. The parent resource's name of the PolicyBasedRoute.
30138    pub parent: std::string::String,
30139
30140    /// Required. Unique id for the policy-based route to create. Provided by the
30141    /// client when the resource is created. The name must comply with
30142    /// <https://google.aip.dev/122#resource-id-segments>. Specifically, the name
30143    /// must be 1-63 characters long and match the regular expression
30144    /// [a-z]([a-z0-9-]*[a-z0-9])?. The first character must be a lowercase letter,
30145    /// and all following characters (except for the last character) must be a
30146    /// dash, lowercase letter, or digit. The last character must be a lowercase
30147    /// letter or digit.
30148    pub policy_based_route_id: std::string::String,
30149
30150    /// Required. Initial values for a new policy-based route.
30151    pub policy_based_route: std::option::Option<crate::model::PolicyBasedRoute>,
30152
30153    /// Optional. An optional request ID to identify requests. Specify a unique
30154    /// request ID so that if you must retry your request, the server knows to
30155    /// ignore the request if it has already been completed. The server guarantees
30156    /// that for at least 60 minutes since the first request.
30157    ///
30158    /// For example, consider a situation where you make an initial request and
30159    /// the request times out. If you make the request again with the same request
30160    /// ID, the server can check if original operation with the same request ID
30161    /// was received, and if so, ignores the second request. This prevents clients
30162    /// from accidentally creating duplicate commitments.
30163    ///
30164    /// The request ID must be a valid UUID with the exception that zero UUID is
30165    /// not supported (00000000-0000-0000-0000-000000000000).
30166    pub request_id: std::string::String,
30167
30168    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
30169}
30170
30171impl CreatePolicyBasedRouteRequest {
30172    pub fn new() -> Self {
30173        std::default::Default::default()
30174    }
30175
30176    /// Sets the value of [parent][crate::model::CreatePolicyBasedRouteRequest::parent].
30177    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
30178        self.parent = v.into();
30179        self
30180    }
30181
30182    /// Sets the value of [policy_based_route_id][crate::model::CreatePolicyBasedRouteRequest::policy_based_route_id].
30183    pub fn set_policy_based_route_id<T: std::convert::Into<std::string::String>>(
30184        mut self,
30185        v: T,
30186    ) -> Self {
30187        self.policy_based_route_id = v.into();
30188        self
30189    }
30190
30191    /// Sets the value of [policy_based_route][crate::model::CreatePolicyBasedRouteRequest::policy_based_route].
30192    pub fn set_policy_based_route<T>(mut self, v: T) -> Self
30193    where
30194        T: std::convert::Into<crate::model::PolicyBasedRoute>,
30195    {
30196        self.policy_based_route = std::option::Option::Some(v.into());
30197        self
30198    }
30199
30200    /// Sets or clears the value of [policy_based_route][crate::model::CreatePolicyBasedRouteRequest::policy_based_route].
30201    pub fn set_or_clear_policy_based_route<T>(mut self, v: std::option::Option<T>) -> Self
30202    where
30203        T: std::convert::Into<crate::model::PolicyBasedRoute>,
30204    {
30205        self.policy_based_route = v.map(|x| x.into());
30206        self
30207    }
30208
30209    /// Sets the value of [request_id][crate::model::CreatePolicyBasedRouteRequest::request_id].
30210    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
30211        self.request_id = v.into();
30212        self
30213    }
30214}
30215
30216impl wkt::message::Message for CreatePolicyBasedRouteRequest {
30217    fn typename() -> &'static str {
30218        "type.googleapis.com/google.cloud.networkconnectivity.v1.CreatePolicyBasedRouteRequest"
30219    }
30220}
30221
30222#[doc(hidden)]
30223impl<'de> serde::de::Deserialize<'de> for CreatePolicyBasedRouteRequest {
30224    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30225    where
30226        D: serde::Deserializer<'de>,
30227    {
30228        #[allow(non_camel_case_types)]
30229        #[doc(hidden)]
30230        #[derive(PartialEq, Eq, Hash)]
30231        enum __FieldTag {
30232            __parent,
30233            __policy_based_route_id,
30234            __policy_based_route,
30235            __request_id,
30236            Unknown(std::string::String),
30237        }
30238        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
30239            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30240            where
30241                D: serde::Deserializer<'de>,
30242            {
30243                struct Visitor;
30244                impl<'de> serde::de::Visitor<'de> for Visitor {
30245                    type Value = __FieldTag;
30246                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
30247                        formatter.write_str("a field name for CreatePolicyBasedRouteRequest")
30248                    }
30249                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
30250                    where
30251                        E: serde::de::Error,
30252                    {
30253                        use std::result::Result::Ok;
30254                        use std::string::ToString;
30255                        match value {
30256                            "parent" => Ok(__FieldTag::__parent),
30257                            "policyBasedRouteId" => Ok(__FieldTag::__policy_based_route_id),
30258                            "policy_based_route_id" => Ok(__FieldTag::__policy_based_route_id),
30259                            "policyBasedRoute" => Ok(__FieldTag::__policy_based_route),
30260                            "policy_based_route" => Ok(__FieldTag::__policy_based_route),
30261                            "requestId" => Ok(__FieldTag::__request_id),
30262                            "request_id" => Ok(__FieldTag::__request_id),
30263                            _ => Ok(__FieldTag::Unknown(value.to_string())),
30264                        }
30265                    }
30266                }
30267                deserializer.deserialize_identifier(Visitor)
30268            }
30269        }
30270        struct Visitor;
30271        impl<'de> serde::de::Visitor<'de> for Visitor {
30272            type Value = CreatePolicyBasedRouteRequest;
30273            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
30274                formatter.write_str("struct CreatePolicyBasedRouteRequest")
30275            }
30276            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
30277            where
30278                A: serde::de::MapAccess<'de>,
30279            {
30280                #[allow(unused_imports)]
30281                use serde::de::Error;
30282                use std::option::Option::Some;
30283                let mut fields = std::collections::HashSet::new();
30284                let mut result = Self::Value::new();
30285                while let Some(tag) = map.next_key::<__FieldTag>()? {
30286                    #[allow(clippy::match_single_binding)]
30287                    match tag {
30288                        __FieldTag::__parent => {
30289                            if !fields.insert(__FieldTag::__parent) {
30290                                return std::result::Result::Err(A::Error::duplicate_field(
30291                                    "multiple values for parent",
30292                                ));
30293                            }
30294                            result.parent = map
30295                                .next_value::<std::option::Option<std::string::String>>()?
30296                                .unwrap_or_default();
30297                        }
30298                        __FieldTag::__policy_based_route_id => {
30299                            if !fields.insert(__FieldTag::__policy_based_route_id) {
30300                                return std::result::Result::Err(A::Error::duplicate_field(
30301                                    "multiple values for policy_based_route_id",
30302                                ));
30303                            }
30304                            result.policy_based_route_id = map
30305                                .next_value::<std::option::Option<std::string::String>>()?
30306                                .unwrap_or_default();
30307                        }
30308                        __FieldTag::__policy_based_route => {
30309                            if !fields.insert(__FieldTag::__policy_based_route) {
30310                                return std::result::Result::Err(A::Error::duplicate_field(
30311                                    "multiple values for policy_based_route",
30312                                ));
30313                            }
30314                            result.policy_based_route = map
30315                                .next_value::<std::option::Option<crate::model::PolicyBasedRoute>>(
30316                                )?;
30317                        }
30318                        __FieldTag::__request_id => {
30319                            if !fields.insert(__FieldTag::__request_id) {
30320                                return std::result::Result::Err(A::Error::duplicate_field(
30321                                    "multiple values for request_id",
30322                                ));
30323                            }
30324                            result.request_id = map
30325                                .next_value::<std::option::Option<std::string::String>>()?
30326                                .unwrap_or_default();
30327                        }
30328                        __FieldTag::Unknown(key) => {
30329                            let value = map.next_value::<serde_json::Value>()?;
30330                            result._unknown_fields.insert(key, value);
30331                        }
30332                    }
30333                }
30334                std::result::Result::Ok(result)
30335            }
30336        }
30337        deserializer.deserialize_any(Visitor)
30338    }
30339}
30340
30341#[doc(hidden)]
30342impl serde::ser::Serialize for CreatePolicyBasedRouteRequest {
30343    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
30344    where
30345        S: serde::ser::Serializer,
30346    {
30347        use serde::ser::SerializeMap;
30348        #[allow(unused_imports)]
30349        use std::option::Option::Some;
30350        let mut state = serializer.serialize_map(std::option::Option::None)?;
30351        if !self.parent.is_empty() {
30352            state.serialize_entry("parent", &self.parent)?;
30353        }
30354        if !self.policy_based_route_id.is_empty() {
30355            state.serialize_entry("policyBasedRouteId", &self.policy_based_route_id)?;
30356        }
30357        if self.policy_based_route.is_some() {
30358            state.serialize_entry("policyBasedRoute", &self.policy_based_route)?;
30359        }
30360        if !self.request_id.is_empty() {
30361            state.serialize_entry("requestId", &self.request_id)?;
30362        }
30363        if !self._unknown_fields.is_empty() {
30364            for (key, value) in self._unknown_fields.iter() {
30365                state.serialize_entry(key, &value)?;
30366            }
30367        }
30368        state.end()
30369    }
30370}
30371
30372impl std::fmt::Debug for CreatePolicyBasedRouteRequest {
30373    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
30374        let mut debug_struct = f.debug_struct("CreatePolicyBasedRouteRequest");
30375        debug_struct.field("parent", &self.parent);
30376        debug_struct.field("policy_based_route_id", &self.policy_based_route_id);
30377        debug_struct.field("policy_based_route", &self.policy_based_route);
30378        debug_struct.field("request_id", &self.request_id);
30379        if !self._unknown_fields.is_empty() {
30380            debug_struct.field("_unknown_fields", &self._unknown_fields);
30381        }
30382        debug_struct.finish()
30383    }
30384}
30385
30386/// Request for
30387/// [PolicyBasedRoutingService.DeletePolicyBasedRoute][google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.DeletePolicyBasedRoute]
30388/// method.
30389///
30390/// [google.cloud.networkconnectivity.v1.PolicyBasedRoutingService.DeletePolicyBasedRoute]: crate::client::PolicyBasedRoutingService::delete_policy_based_route
30391#[derive(Clone, Default, PartialEq)]
30392#[non_exhaustive]
30393pub struct DeletePolicyBasedRouteRequest {
30394    /// Required. Name of the policy-based route resource to delete.
30395    pub name: std::string::String,
30396
30397    /// Optional. An optional request ID to identify requests. Specify a unique
30398    /// request ID so that if you must retry your request, the server knows to
30399    /// ignore the request if it has already been completed. The server guarantees
30400    /// that for at least 60 minutes after the first request.
30401    ///
30402    /// For example, consider a situation where you make an initial request and
30403    /// the request times out. If you make the request again with the same request
30404    /// ID, the server can check if original operation with the same request ID
30405    /// was received, and if so, ignores the second request. This prevents clients
30406    /// from accidentally creating duplicate commitments.
30407    ///
30408    /// The request ID must be a valid UUID with the exception that zero UUID is
30409    /// not supported (00000000-0000-0000-0000-000000000000).
30410    pub request_id: std::string::String,
30411
30412    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
30413}
30414
30415impl DeletePolicyBasedRouteRequest {
30416    pub fn new() -> Self {
30417        std::default::Default::default()
30418    }
30419
30420    /// Sets the value of [name][crate::model::DeletePolicyBasedRouteRequest::name].
30421    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
30422        self.name = v.into();
30423        self
30424    }
30425
30426    /// Sets the value of [request_id][crate::model::DeletePolicyBasedRouteRequest::request_id].
30427    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
30428        self.request_id = v.into();
30429        self
30430    }
30431}
30432
30433impl wkt::message::Message for DeletePolicyBasedRouteRequest {
30434    fn typename() -> &'static str {
30435        "type.googleapis.com/google.cloud.networkconnectivity.v1.DeletePolicyBasedRouteRequest"
30436    }
30437}
30438
30439#[doc(hidden)]
30440impl<'de> serde::de::Deserialize<'de> for DeletePolicyBasedRouteRequest {
30441    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30442    where
30443        D: serde::Deserializer<'de>,
30444    {
30445        #[allow(non_camel_case_types)]
30446        #[doc(hidden)]
30447        #[derive(PartialEq, Eq, Hash)]
30448        enum __FieldTag {
30449            __name,
30450            __request_id,
30451            Unknown(std::string::String),
30452        }
30453        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
30454            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30455            where
30456                D: serde::Deserializer<'de>,
30457            {
30458                struct Visitor;
30459                impl<'de> serde::de::Visitor<'de> for Visitor {
30460                    type Value = __FieldTag;
30461                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
30462                        formatter.write_str("a field name for DeletePolicyBasedRouteRequest")
30463                    }
30464                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
30465                    where
30466                        E: serde::de::Error,
30467                    {
30468                        use std::result::Result::Ok;
30469                        use std::string::ToString;
30470                        match value {
30471                            "name" => Ok(__FieldTag::__name),
30472                            "requestId" => Ok(__FieldTag::__request_id),
30473                            "request_id" => Ok(__FieldTag::__request_id),
30474                            _ => Ok(__FieldTag::Unknown(value.to_string())),
30475                        }
30476                    }
30477                }
30478                deserializer.deserialize_identifier(Visitor)
30479            }
30480        }
30481        struct Visitor;
30482        impl<'de> serde::de::Visitor<'de> for Visitor {
30483            type Value = DeletePolicyBasedRouteRequest;
30484            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
30485                formatter.write_str("struct DeletePolicyBasedRouteRequest")
30486            }
30487            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
30488            where
30489                A: serde::de::MapAccess<'de>,
30490            {
30491                #[allow(unused_imports)]
30492                use serde::de::Error;
30493                use std::option::Option::Some;
30494                let mut fields = std::collections::HashSet::new();
30495                let mut result = Self::Value::new();
30496                while let Some(tag) = map.next_key::<__FieldTag>()? {
30497                    #[allow(clippy::match_single_binding)]
30498                    match tag {
30499                        __FieldTag::__name => {
30500                            if !fields.insert(__FieldTag::__name) {
30501                                return std::result::Result::Err(A::Error::duplicate_field(
30502                                    "multiple values for name",
30503                                ));
30504                            }
30505                            result.name = map
30506                                .next_value::<std::option::Option<std::string::String>>()?
30507                                .unwrap_or_default();
30508                        }
30509                        __FieldTag::__request_id => {
30510                            if !fields.insert(__FieldTag::__request_id) {
30511                                return std::result::Result::Err(A::Error::duplicate_field(
30512                                    "multiple values for request_id",
30513                                ));
30514                            }
30515                            result.request_id = map
30516                                .next_value::<std::option::Option<std::string::String>>()?
30517                                .unwrap_or_default();
30518                        }
30519                        __FieldTag::Unknown(key) => {
30520                            let value = map.next_value::<serde_json::Value>()?;
30521                            result._unknown_fields.insert(key, value);
30522                        }
30523                    }
30524                }
30525                std::result::Result::Ok(result)
30526            }
30527        }
30528        deserializer.deserialize_any(Visitor)
30529    }
30530}
30531
30532#[doc(hidden)]
30533impl serde::ser::Serialize for DeletePolicyBasedRouteRequest {
30534    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
30535    where
30536        S: serde::ser::Serializer,
30537    {
30538        use serde::ser::SerializeMap;
30539        #[allow(unused_imports)]
30540        use std::option::Option::Some;
30541        let mut state = serializer.serialize_map(std::option::Option::None)?;
30542        if !self.name.is_empty() {
30543            state.serialize_entry("name", &self.name)?;
30544        }
30545        if !self.request_id.is_empty() {
30546            state.serialize_entry("requestId", &self.request_id)?;
30547        }
30548        if !self._unknown_fields.is_empty() {
30549            for (key, value) in self._unknown_fields.iter() {
30550                state.serialize_entry(key, &value)?;
30551            }
30552        }
30553        state.end()
30554    }
30555}
30556
30557impl std::fmt::Debug for DeletePolicyBasedRouteRequest {
30558    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
30559        let mut debug_struct = f.debug_struct("DeletePolicyBasedRouteRequest");
30560        debug_struct.field("name", &self.name);
30561        debug_struct.field("request_id", &self.request_id);
30562        if !self._unknown_fields.is_empty() {
30563            debug_struct.field("_unknown_fields", &self._unknown_fields);
30564        }
30565        debug_struct.finish()
30566    }
30567}
30568
30569/// The infrastructure used for connections between consumers/producers.
30570///
30571/// # Working with unknown values
30572///
30573/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
30574/// additional enum variants at any time. Adding new variants is not considered
30575/// a breaking change. Applications should write their code in anticipation of:
30576///
30577/// - New values appearing in future releases of the client library, **and**
30578/// - New values received dynamically, without application changes.
30579///
30580/// Please consult the [Working with enums] section in the user guide for some
30581/// guidelines.
30582///
30583/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
30584#[derive(Clone, Debug, PartialEq)]
30585#[non_exhaustive]
30586pub enum Infrastructure {
30587    /// An invalid infrastructure as the default case.
30588    Unspecified,
30589    /// Private Service Connect is used for connections.
30590    Psc,
30591    /// If set, the enum was initialized with an unknown value.
30592    ///
30593    /// Applications can examine the value using [Infrastructure::value] or
30594    /// [Infrastructure::name].
30595    UnknownValue(infrastructure::UnknownValue),
30596}
30597
30598#[doc(hidden)]
30599pub mod infrastructure {
30600    #[allow(unused_imports)]
30601    use super::*;
30602    #[derive(Clone, Debug, PartialEq)]
30603    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
30604}
30605
30606impl Infrastructure {
30607    /// Gets the enum value.
30608    ///
30609    /// Returns `None` if the enum contains an unknown value deserialized from
30610    /// the string representation of enums.
30611    pub fn value(&self) -> std::option::Option<i32> {
30612        match self {
30613            Self::Unspecified => std::option::Option::Some(0),
30614            Self::Psc => std::option::Option::Some(1),
30615            Self::UnknownValue(u) => u.0.value(),
30616        }
30617    }
30618
30619    /// Gets the enum value as a string.
30620    ///
30621    /// Returns `None` if the enum contains an unknown value deserialized from
30622    /// the integer representation of enums.
30623    pub fn name(&self) -> std::option::Option<&str> {
30624        match self {
30625            Self::Unspecified => std::option::Option::Some("INFRASTRUCTURE_UNSPECIFIED"),
30626            Self::Psc => std::option::Option::Some("PSC"),
30627            Self::UnknownValue(u) => u.0.name(),
30628        }
30629    }
30630}
30631
30632impl std::default::Default for Infrastructure {
30633    fn default() -> Self {
30634        use std::convert::From;
30635        Self::from(0)
30636    }
30637}
30638
30639impl std::fmt::Display for Infrastructure {
30640    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
30641        wkt::internal::display_enum(f, self.name(), self.value())
30642    }
30643}
30644
30645impl std::convert::From<i32> for Infrastructure {
30646    fn from(value: i32) -> Self {
30647        match value {
30648            0 => Self::Unspecified,
30649            1 => Self::Psc,
30650            _ => Self::UnknownValue(infrastructure::UnknownValue(
30651                wkt::internal::UnknownEnumValue::Integer(value),
30652            )),
30653        }
30654    }
30655}
30656
30657impl std::convert::From<&str> for Infrastructure {
30658    fn from(value: &str) -> Self {
30659        use std::string::ToString;
30660        match value {
30661            "INFRASTRUCTURE_UNSPECIFIED" => Self::Unspecified,
30662            "PSC" => Self::Psc,
30663            _ => Self::UnknownValue(infrastructure::UnknownValue(
30664                wkt::internal::UnknownEnumValue::String(value.to_string()),
30665            )),
30666        }
30667    }
30668}
30669
30670impl serde::ser::Serialize for Infrastructure {
30671    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
30672    where
30673        S: serde::Serializer,
30674    {
30675        match self {
30676            Self::Unspecified => serializer.serialize_i32(0),
30677            Self::Psc => serializer.serialize_i32(1),
30678            Self::UnknownValue(u) => u.0.serialize(serializer),
30679        }
30680    }
30681}
30682
30683impl<'de> serde::de::Deserialize<'de> for Infrastructure {
30684    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30685    where
30686        D: serde::Deserializer<'de>,
30687    {
30688        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Infrastructure>::new(
30689            ".google.cloud.networkconnectivity.v1.Infrastructure",
30690        ))
30691    }
30692}
30693
30694/// The error type indicates whether a connection error is consumer facing,
30695/// producer facing or system internal.
30696///
30697/// # Working with unknown values
30698///
30699/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
30700/// additional enum variants at any time. Adding new variants is not considered
30701/// a breaking change. Applications should write their code in anticipation of:
30702///
30703/// - New values appearing in future releases of the client library, **and**
30704/// - New values received dynamically, without application changes.
30705///
30706/// Please consult the [Working with enums] section in the user guide for some
30707/// guidelines.
30708///
30709/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
30710#[derive(Clone, Debug, PartialEq)]
30711#[non_exhaustive]
30712pub enum ConnectionErrorType {
30713    /// An invalid error type as the default case.
30714    Unspecified,
30715    /// The error is due to Service Automation system internal.
30716    ErrorInternal,
30717    /// The error is due to the setup on consumer side.
30718    ErrorConsumerSide,
30719    /// The error is due to the setup on producer side.
30720    ErrorProducerSide,
30721    /// If set, the enum was initialized with an unknown value.
30722    ///
30723    /// Applications can examine the value using [ConnectionErrorType::value] or
30724    /// [ConnectionErrorType::name].
30725    UnknownValue(connection_error_type::UnknownValue),
30726}
30727
30728#[doc(hidden)]
30729pub mod connection_error_type {
30730    #[allow(unused_imports)]
30731    use super::*;
30732    #[derive(Clone, Debug, PartialEq)]
30733    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
30734}
30735
30736impl ConnectionErrorType {
30737    /// Gets the enum value.
30738    ///
30739    /// Returns `None` if the enum contains an unknown value deserialized from
30740    /// the string representation of enums.
30741    pub fn value(&self) -> std::option::Option<i32> {
30742        match self {
30743            Self::Unspecified => std::option::Option::Some(0),
30744            Self::ErrorInternal => std::option::Option::Some(1),
30745            Self::ErrorConsumerSide => std::option::Option::Some(2),
30746            Self::ErrorProducerSide => std::option::Option::Some(3),
30747            Self::UnknownValue(u) => u.0.value(),
30748        }
30749    }
30750
30751    /// Gets the enum value as a string.
30752    ///
30753    /// Returns `None` if the enum contains an unknown value deserialized from
30754    /// the integer representation of enums.
30755    pub fn name(&self) -> std::option::Option<&str> {
30756        match self {
30757            Self::Unspecified => std::option::Option::Some("CONNECTION_ERROR_TYPE_UNSPECIFIED"),
30758            Self::ErrorInternal => std::option::Option::Some("ERROR_INTERNAL"),
30759            Self::ErrorConsumerSide => std::option::Option::Some("ERROR_CONSUMER_SIDE"),
30760            Self::ErrorProducerSide => std::option::Option::Some("ERROR_PRODUCER_SIDE"),
30761            Self::UnknownValue(u) => u.0.name(),
30762        }
30763    }
30764}
30765
30766impl std::default::Default for ConnectionErrorType {
30767    fn default() -> Self {
30768        use std::convert::From;
30769        Self::from(0)
30770    }
30771}
30772
30773impl std::fmt::Display for ConnectionErrorType {
30774    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
30775        wkt::internal::display_enum(f, self.name(), self.value())
30776    }
30777}
30778
30779impl std::convert::From<i32> for ConnectionErrorType {
30780    fn from(value: i32) -> Self {
30781        match value {
30782            0 => Self::Unspecified,
30783            1 => Self::ErrorInternal,
30784            2 => Self::ErrorConsumerSide,
30785            3 => Self::ErrorProducerSide,
30786            _ => Self::UnknownValue(connection_error_type::UnknownValue(
30787                wkt::internal::UnknownEnumValue::Integer(value),
30788            )),
30789        }
30790    }
30791}
30792
30793impl std::convert::From<&str> for ConnectionErrorType {
30794    fn from(value: &str) -> Self {
30795        use std::string::ToString;
30796        match value {
30797            "CONNECTION_ERROR_TYPE_UNSPECIFIED" => Self::Unspecified,
30798            "ERROR_INTERNAL" => Self::ErrorInternal,
30799            "ERROR_CONSUMER_SIDE" => Self::ErrorConsumerSide,
30800            "ERROR_PRODUCER_SIDE" => Self::ErrorProducerSide,
30801            _ => Self::UnknownValue(connection_error_type::UnknownValue(
30802                wkt::internal::UnknownEnumValue::String(value.to_string()),
30803            )),
30804        }
30805    }
30806}
30807
30808impl serde::ser::Serialize for ConnectionErrorType {
30809    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
30810    where
30811        S: serde::Serializer,
30812    {
30813        match self {
30814            Self::Unspecified => serializer.serialize_i32(0),
30815            Self::ErrorInternal => serializer.serialize_i32(1),
30816            Self::ErrorConsumerSide => serializer.serialize_i32(2),
30817            Self::ErrorProducerSide => serializer.serialize_i32(3),
30818            Self::UnknownValue(u) => u.0.serialize(serializer),
30819        }
30820    }
30821}
30822
30823impl<'de> serde::de::Deserialize<'de> for ConnectionErrorType {
30824    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30825    where
30826        D: serde::Deserializer<'de>,
30827    {
30828        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConnectionErrorType>::new(
30829            ".google.cloud.networkconnectivity.v1.ConnectionErrorType",
30830        ))
30831    }
30832}
30833
30834/// The requested IP version for the PSC connection.
30835///
30836/// # Working with unknown values
30837///
30838/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
30839/// additional enum variants at any time. Adding new variants is not considered
30840/// a breaking change. Applications should write their code in anticipation of:
30841///
30842/// - New values appearing in future releases of the client library, **and**
30843/// - New values received dynamically, without application changes.
30844///
30845/// Please consult the [Working with enums] section in the user guide for some
30846/// guidelines.
30847///
30848/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
30849#[derive(Clone, Debug, PartialEq)]
30850#[non_exhaustive]
30851pub enum IPVersion {
30852    /// Default value. We will use IPv4 or IPv6 depending on the IP version of
30853    /// first available subnetwork.
30854    Unspecified,
30855    /// Will use IPv4 only.
30856    Ipv4,
30857    /// Will use IPv6 only.
30858    Ipv6,
30859    /// If set, the enum was initialized with an unknown value.
30860    ///
30861    /// Applications can examine the value using [IPVersion::value] or
30862    /// [IPVersion::name].
30863    UnknownValue(ip_version::UnknownValue),
30864}
30865
30866#[doc(hidden)]
30867pub mod ip_version {
30868    #[allow(unused_imports)]
30869    use super::*;
30870    #[derive(Clone, Debug, PartialEq)]
30871    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
30872}
30873
30874impl IPVersion {
30875    /// Gets the enum value.
30876    ///
30877    /// Returns `None` if the enum contains an unknown value deserialized from
30878    /// the string representation of enums.
30879    pub fn value(&self) -> std::option::Option<i32> {
30880        match self {
30881            Self::Unspecified => std::option::Option::Some(0),
30882            Self::Ipv4 => std::option::Option::Some(1),
30883            Self::Ipv6 => std::option::Option::Some(2),
30884            Self::UnknownValue(u) => u.0.value(),
30885        }
30886    }
30887
30888    /// Gets the enum value as a string.
30889    ///
30890    /// Returns `None` if the enum contains an unknown value deserialized from
30891    /// the integer representation of enums.
30892    pub fn name(&self) -> std::option::Option<&str> {
30893        match self {
30894            Self::Unspecified => std::option::Option::Some("IP_VERSION_UNSPECIFIED"),
30895            Self::Ipv4 => std::option::Option::Some("IPV4"),
30896            Self::Ipv6 => std::option::Option::Some("IPV6"),
30897            Self::UnknownValue(u) => u.0.name(),
30898        }
30899    }
30900}
30901
30902impl std::default::Default for IPVersion {
30903    fn default() -> Self {
30904        use std::convert::From;
30905        Self::from(0)
30906    }
30907}
30908
30909impl std::fmt::Display for IPVersion {
30910    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
30911        wkt::internal::display_enum(f, self.name(), self.value())
30912    }
30913}
30914
30915impl std::convert::From<i32> for IPVersion {
30916    fn from(value: i32) -> Self {
30917        match value {
30918            0 => Self::Unspecified,
30919            1 => Self::Ipv4,
30920            2 => Self::Ipv6,
30921            _ => Self::UnknownValue(ip_version::UnknownValue(
30922                wkt::internal::UnknownEnumValue::Integer(value),
30923            )),
30924        }
30925    }
30926}
30927
30928impl std::convert::From<&str> for IPVersion {
30929    fn from(value: &str) -> Self {
30930        use std::string::ToString;
30931        match value {
30932            "IP_VERSION_UNSPECIFIED" => Self::Unspecified,
30933            "IPV4" => Self::Ipv4,
30934            "IPV6" => Self::Ipv6,
30935            _ => Self::UnknownValue(ip_version::UnknownValue(
30936                wkt::internal::UnknownEnumValue::String(value.to_string()),
30937            )),
30938        }
30939    }
30940}
30941
30942impl serde::ser::Serialize for IPVersion {
30943    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
30944    where
30945        S: serde::Serializer,
30946    {
30947        match self {
30948            Self::Unspecified => serializer.serialize_i32(0),
30949            Self::Ipv4 => serializer.serialize_i32(1),
30950            Self::Ipv6 => serializer.serialize_i32(2),
30951            Self::UnknownValue(u) => u.0.serialize(serializer),
30952        }
30953    }
30954}
30955
30956impl<'de> serde::de::Deserialize<'de> for IPVersion {
30957    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
30958    where
30959        D: serde::Deserializer<'de>,
30960    {
30961        deserializer.deserialize_any(wkt::internal::EnumVisitor::<IPVersion>::new(
30962            ".google.cloud.networkconnectivity.v1.IPVersion",
30963        ))
30964    }
30965}
30966
30967/// Supported features for a location
30968///
30969/// # Working with unknown values
30970///
30971/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
30972/// additional enum variants at any time. Adding new variants is not considered
30973/// a breaking change. Applications should write their code in anticipation of:
30974///
30975/// - New values appearing in future releases of the client library, **and**
30976/// - New values received dynamically, without application changes.
30977///
30978/// Please consult the [Working with enums] section in the user guide for some
30979/// guidelines.
30980///
30981/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
30982#[derive(Clone, Debug, PartialEq)]
30983#[non_exhaustive]
30984pub enum LocationFeature {
30985    /// No publicly supported feature in this location
30986    Unspecified,
30987    /// Site-to-cloud spokes are supported in this location
30988    SiteToCloudSpokes,
30989    /// Site-to-site spokes are supported in this location
30990    SiteToSiteSpokes,
30991    /// If set, the enum was initialized with an unknown value.
30992    ///
30993    /// Applications can examine the value using [LocationFeature::value] or
30994    /// [LocationFeature::name].
30995    UnknownValue(location_feature::UnknownValue),
30996}
30997
30998#[doc(hidden)]
30999pub mod location_feature {
31000    #[allow(unused_imports)]
31001    use super::*;
31002    #[derive(Clone, Debug, PartialEq)]
31003    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
31004}
31005
31006impl LocationFeature {
31007    /// Gets the enum value.
31008    ///
31009    /// Returns `None` if the enum contains an unknown value deserialized from
31010    /// the string representation of enums.
31011    pub fn value(&self) -> std::option::Option<i32> {
31012        match self {
31013            Self::Unspecified => std::option::Option::Some(0),
31014            Self::SiteToCloudSpokes => std::option::Option::Some(1),
31015            Self::SiteToSiteSpokes => std::option::Option::Some(2),
31016            Self::UnknownValue(u) => u.0.value(),
31017        }
31018    }
31019
31020    /// Gets the enum value as a string.
31021    ///
31022    /// Returns `None` if the enum contains an unknown value deserialized from
31023    /// the integer representation of enums.
31024    pub fn name(&self) -> std::option::Option<&str> {
31025        match self {
31026            Self::Unspecified => std::option::Option::Some("LOCATION_FEATURE_UNSPECIFIED"),
31027            Self::SiteToCloudSpokes => std::option::Option::Some("SITE_TO_CLOUD_SPOKES"),
31028            Self::SiteToSiteSpokes => std::option::Option::Some("SITE_TO_SITE_SPOKES"),
31029            Self::UnknownValue(u) => u.0.name(),
31030        }
31031    }
31032}
31033
31034impl std::default::Default for LocationFeature {
31035    fn default() -> Self {
31036        use std::convert::From;
31037        Self::from(0)
31038    }
31039}
31040
31041impl std::fmt::Display for LocationFeature {
31042    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
31043        wkt::internal::display_enum(f, self.name(), self.value())
31044    }
31045}
31046
31047impl std::convert::From<i32> for LocationFeature {
31048    fn from(value: i32) -> Self {
31049        match value {
31050            0 => Self::Unspecified,
31051            1 => Self::SiteToCloudSpokes,
31052            2 => Self::SiteToSiteSpokes,
31053            _ => Self::UnknownValue(location_feature::UnknownValue(
31054                wkt::internal::UnknownEnumValue::Integer(value),
31055            )),
31056        }
31057    }
31058}
31059
31060impl std::convert::From<&str> for LocationFeature {
31061    fn from(value: &str) -> Self {
31062        use std::string::ToString;
31063        match value {
31064            "LOCATION_FEATURE_UNSPECIFIED" => Self::Unspecified,
31065            "SITE_TO_CLOUD_SPOKES" => Self::SiteToCloudSpokes,
31066            "SITE_TO_SITE_SPOKES" => Self::SiteToSiteSpokes,
31067            _ => Self::UnknownValue(location_feature::UnknownValue(
31068                wkt::internal::UnknownEnumValue::String(value.to_string()),
31069            )),
31070        }
31071    }
31072}
31073
31074impl serde::ser::Serialize for LocationFeature {
31075    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
31076    where
31077        S: serde::Serializer,
31078    {
31079        match self {
31080            Self::Unspecified => serializer.serialize_i32(0),
31081            Self::SiteToCloudSpokes => serializer.serialize_i32(1),
31082            Self::SiteToSiteSpokes => serializer.serialize_i32(2),
31083            Self::UnknownValue(u) => u.0.serialize(serializer),
31084        }
31085    }
31086}
31087
31088impl<'de> serde::de::Deserialize<'de> for LocationFeature {
31089    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31090    where
31091        D: serde::Deserializer<'de>,
31092    {
31093        deserializer.deserialize_any(wkt::internal::EnumVisitor::<LocationFeature>::new(
31094            ".google.cloud.networkconnectivity.v1.LocationFeature",
31095        ))
31096    }
31097}
31098
31099/// The route's type
31100///
31101/// # Working with unknown values
31102///
31103/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
31104/// additional enum variants at any time. Adding new variants is not considered
31105/// a breaking change. Applications should write their code in anticipation of:
31106///
31107/// - New values appearing in future releases of the client library, **and**
31108/// - New values received dynamically, without application changes.
31109///
31110/// Please consult the [Working with enums] section in the user guide for some
31111/// guidelines.
31112///
31113/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
31114#[derive(Clone, Debug, PartialEq)]
31115#[non_exhaustive]
31116pub enum RouteType {
31117    /// No route type information specified
31118    Unspecified,
31119    /// The route leads to a destination within the primary address range of the
31120    /// VPC network's subnet.
31121    VpcPrimarySubnet,
31122    /// The route leads to a destination within the secondary address range of the
31123    /// VPC network's subnet.
31124    VpcSecondarySubnet,
31125    /// The route leads to a destination in a dynamic route. Dynamic routes are
31126    /// derived from Border Gateway Protocol (BGP) advertisements received from an
31127    /// NCC hybrid spoke.
31128    DynamicRoute,
31129    /// If set, the enum was initialized with an unknown value.
31130    ///
31131    /// Applications can examine the value using [RouteType::value] or
31132    /// [RouteType::name].
31133    UnknownValue(route_type::UnknownValue),
31134}
31135
31136#[doc(hidden)]
31137pub mod route_type {
31138    #[allow(unused_imports)]
31139    use super::*;
31140    #[derive(Clone, Debug, PartialEq)]
31141    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
31142}
31143
31144impl RouteType {
31145    /// Gets the enum value.
31146    ///
31147    /// Returns `None` if the enum contains an unknown value deserialized from
31148    /// the string representation of enums.
31149    pub fn value(&self) -> std::option::Option<i32> {
31150        match self {
31151            Self::Unspecified => std::option::Option::Some(0),
31152            Self::VpcPrimarySubnet => std::option::Option::Some(1),
31153            Self::VpcSecondarySubnet => std::option::Option::Some(2),
31154            Self::DynamicRoute => std::option::Option::Some(3),
31155            Self::UnknownValue(u) => u.0.value(),
31156        }
31157    }
31158
31159    /// Gets the enum value as a string.
31160    ///
31161    /// Returns `None` if the enum contains an unknown value deserialized from
31162    /// the integer representation of enums.
31163    pub fn name(&self) -> std::option::Option<&str> {
31164        match self {
31165            Self::Unspecified => std::option::Option::Some("ROUTE_TYPE_UNSPECIFIED"),
31166            Self::VpcPrimarySubnet => std::option::Option::Some("VPC_PRIMARY_SUBNET"),
31167            Self::VpcSecondarySubnet => std::option::Option::Some("VPC_SECONDARY_SUBNET"),
31168            Self::DynamicRoute => std::option::Option::Some("DYNAMIC_ROUTE"),
31169            Self::UnknownValue(u) => u.0.name(),
31170        }
31171    }
31172}
31173
31174impl std::default::Default for RouteType {
31175    fn default() -> Self {
31176        use std::convert::From;
31177        Self::from(0)
31178    }
31179}
31180
31181impl std::fmt::Display for RouteType {
31182    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
31183        wkt::internal::display_enum(f, self.name(), self.value())
31184    }
31185}
31186
31187impl std::convert::From<i32> for RouteType {
31188    fn from(value: i32) -> Self {
31189        match value {
31190            0 => Self::Unspecified,
31191            1 => Self::VpcPrimarySubnet,
31192            2 => Self::VpcSecondarySubnet,
31193            3 => Self::DynamicRoute,
31194            _ => Self::UnknownValue(route_type::UnknownValue(
31195                wkt::internal::UnknownEnumValue::Integer(value),
31196            )),
31197        }
31198    }
31199}
31200
31201impl std::convert::From<&str> for RouteType {
31202    fn from(value: &str) -> Self {
31203        use std::string::ToString;
31204        match value {
31205            "ROUTE_TYPE_UNSPECIFIED" => Self::Unspecified,
31206            "VPC_PRIMARY_SUBNET" => Self::VpcPrimarySubnet,
31207            "VPC_SECONDARY_SUBNET" => Self::VpcSecondarySubnet,
31208            "DYNAMIC_ROUTE" => Self::DynamicRoute,
31209            _ => Self::UnknownValue(route_type::UnknownValue(
31210                wkt::internal::UnknownEnumValue::String(value.to_string()),
31211            )),
31212        }
31213    }
31214}
31215
31216impl serde::ser::Serialize for RouteType {
31217    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
31218    where
31219        S: serde::Serializer,
31220    {
31221        match self {
31222            Self::Unspecified => serializer.serialize_i32(0),
31223            Self::VpcPrimarySubnet => serializer.serialize_i32(1),
31224            Self::VpcSecondarySubnet => serializer.serialize_i32(2),
31225            Self::DynamicRoute => serializer.serialize_i32(3),
31226            Self::UnknownValue(u) => u.0.serialize(serializer),
31227        }
31228    }
31229}
31230
31231impl<'de> serde::de::Deserialize<'de> for RouteType {
31232    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31233    where
31234        D: serde::Deserializer<'de>,
31235    {
31236        deserializer.deserialize_any(wkt::internal::EnumVisitor::<RouteType>::new(
31237            ".google.cloud.networkconnectivity.v1.RouteType",
31238        ))
31239    }
31240}
31241
31242/// The State enum represents the lifecycle stage of a Network Connectivity
31243/// Center resource.
31244///
31245/// # Working with unknown values
31246///
31247/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
31248/// additional enum variants at any time. Adding new variants is not considered
31249/// a breaking change. Applications should write their code in anticipation of:
31250///
31251/// - New values appearing in future releases of the client library, **and**
31252/// - New values received dynamically, without application changes.
31253///
31254/// Please consult the [Working with enums] section in the user guide for some
31255/// guidelines.
31256///
31257/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
31258#[derive(Clone, Debug, PartialEq)]
31259#[non_exhaustive]
31260pub enum State {
31261    /// No state information available
31262    Unspecified,
31263    /// The resource's create operation is in progress.
31264    Creating,
31265    /// The resource is active
31266    Active,
31267    /// The resource's delete operation is in progress.
31268    Deleting,
31269    /// The resource's accept operation is in progress.
31270    Accepting,
31271    /// The resource's reject operation is in progress.
31272    Rejecting,
31273    /// The resource's update operation is in progress.
31274    Updating,
31275    /// The resource is inactive.
31276    Inactive,
31277    /// The hub associated with this spoke resource has been deleted.
31278    /// This state applies to spoke resources only.
31279    Obsolete,
31280    /// The resource is in an undefined state due to resource creation or deletion
31281    /// failure. You can try to delete the resource later or contact support for
31282    /// help.
31283    Failed,
31284    /// If set, the enum was initialized with an unknown value.
31285    ///
31286    /// Applications can examine the value using [State::value] or
31287    /// [State::name].
31288    UnknownValue(state::UnknownValue),
31289}
31290
31291#[doc(hidden)]
31292pub mod state {
31293    #[allow(unused_imports)]
31294    use super::*;
31295    #[derive(Clone, Debug, PartialEq)]
31296    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
31297}
31298
31299impl State {
31300    /// Gets the enum value.
31301    ///
31302    /// Returns `None` if the enum contains an unknown value deserialized from
31303    /// the string representation of enums.
31304    pub fn value(&self) -> std::option::Option<i32> {
31305        match self {
31306            Self::Unspecified => std::option::Option::Some(0),
31307            Self::Creating => std::option::Option::Some(1),
31308            Self::Active => std::option::Option::Some(2),
31309            Self::Deleting => std::option::Option::Some(3),
31310            Self::Accepting => std::option::Option::Some(8),
31311            Self::Rejecting => std::option::Option::Some(9),
31312            Self::Updating => std::option::Option::Some(6),
31313            Self::Inactive => std::option::Option::Some(7),
31314            Self::Obsolete => std::option::Option::Some(10),
31315            Self::Failed => std::option::Option::Some(11),
31316            Self::UnknownValue(u) => u.0.value(),
31317        }
31318    }
31319
31320    /// Gets the enum value as a string.
31321    ///
31322    /// Returns `None` if the enum contains an unknown value deserialized from
31323    /// the integer representation of enums.
31324    pub fn name(&self) -> std::option::Option<&str> {
31325        match self {
31326            Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
31327            Self::Creating => std::option::Option::Some("CREATING"),
31328            Self::Active => std::option::Option::Some("ACTIVE"),
31329            Self::Deleting => std::option::Option::Some("DELETING"),
31330            Self::Accepting => std::option::Option::Some("ACCEPTING"),
31331            Self::Rejecting => std::option::Option::Some("REJECTING"),
31332            Self::Updating => std::option::Option::Some("UPDATING"),
31333            Self::Inactive => std::option::Option::Some("INACTIVE"),
31334            Self::Obsolete => std::option::Option::Some("OBSOLETE"),
31335            Self::Failed => std::option::Option::Some("FAILED"),
31336            Self::UnknownValue(u) => u.0.name(),
31337        }
31338    }
31339}
31340
31341impl std::default::Default for State {
31342    fn default() -> Self {
31343        use std::convert::From;
31344        Self::from(0)
31345    }
31346}
31347
31348impl std::fmt::Display for State {
31349    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
31350        wkt::internal::display_enum(f, self.name(), self.value())
31351    }
31352}
31353
31354impl std::convert::From<i32> for State {
31355    fn from(value: i32) -> Self {
31356        match value {
31357            0 => Self::Unspecified,
31358            1 => Self::Creating,
31359            2 => Self::Active,
31360            3 => Self::Deleting,
31361            6 => Self::Updating,
31362            7 => Self::Inactive,
31363            8 => Self::Accepting,
31364            9 => Self::Rejecting,
31365            10 => Self::Obsolete,
31366            11 => Self::Failed,
31367            _ => Self::UnknownValue(state::UnknownValue(
31368                wkt::internal::UnknownEnumValue::Integer(value),
31369            )),
31370        }
31371    }
31372}
31373
31374impl std::convert::From<&str> for State {
31375    fn from(value: &str) -> Self {
31376        use std::string::ToString;
31377        match value {
31378            "STATE_UNSPECIFIED" => Self::Unspecified,
31379            "CREATING" => Self::Creating,
31380            "ACTIVE" => Self::Active,
31381            "DELETING" => Self::Deleting,
31382            "ACCEPTING" => Self::Accepting,
31383            "REJECTING" => Self::Rejecting,
31384            "UPDATING" => Self::Updating,
31385            "INACTIVE" => Self::Inactive,
31386            "OBSOLETE" => Self::Obsolete,
31387            "FAILED" => Self::Failed,
31388            _ => Self::UnknownValue(state::UnknownValue(
31389                wkt::internal::UnknownEnumValue::String(value.to_string()),
31390            )),
31391        }
31392    }
31393}
31394
31395impl serde::ser::Serialize for State {
31396    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
31397    where
31398        S: serde::Serializer,
31399    {
31400        match self {
31401            Self::Unspecified => serializer.serialize_i32(0),
31402            Self::Creating => serializer.serialize_i32(1),
31403            Self::Active => serializer.serialize_i32(2),
31404            Self::Deleting => serializer.serialize_i32(3),
31405            Self::Accepting => serializer.serialize_i32(8),
31406            Self::Rejecting => serializer.serialize_i32(9),
31407            Self::Updating => serializer.serialize_i32(6),
31408            Self::Inactive => serializer.serialize_i32(7),
31409            Self::Obsolete => serializer.serialize_i32(10),
31410            Self::Failed => serializer.serialize_i32(11),
31411            Self::UnknownValue(u) => u.0.serialize(serializer),
31412        }
31413    }
31414}
31415
31416impl<'de> serde::de::Deserialize<'de> for State {
31417    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31418    where
31419        D: serde::Deserializer<'de>,
31420    {
31421        deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
31422            ".google.cloud.networkconnectivity.v1.State",
31423        ))
31424    }
31425}
31426
31427/// The SpokeType enum represents the type of spoke. The type
31428/// reflects the kind of resource that a spoke is associated with.
31429///
31430/// # Working with unknown values
31431///
31432/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
31433/// additional enum variants at any time. Adding new variants is not considered
31434/// a breaking change. Applications should write their code in anticipation of:
31435///
31436/// - New values appearing in future releases of the client library, **and**
31437/// - New values received dynamically, without application changes.
31438///
31439/// Please consult the [Working with enums] section in the user guide for some
31440/// guidelines.
31441///
31442/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
31443#[derive(Clone, Debug, PartialEq)]
31444#[non_exhaustive]
31445pub enum SpokeType {
31446    /// Unspecified spoke type.
31447    Unspecified,
31448    /// Spokes associated with VPN tunnels.
31449    VpnTunnel,
31450    /// Spokes associated with VLAN attachments.
31451    InterconnectAttachment,
31452    /// Spokes associated with router appliance instances.
31453    RouterAppliance,
31454    /// Spokes associated with VPC networks.
31455    VpcNetwork,
31456    /// Spokes that are backed by a producer VPC network.
31457    ProducerVpcNetwork,
31458    /// If set, the enum was initialized with an unknown value.
31459    ///
31460    /// Applications can examine the value using [SpokeType::value] or
31461    /// [SpokeType::name].
31462    UnknownValue(spoke_type::UnknownValue),
31463}
31464
31465#[doc(hidden)]
31466pub mod spoke_type {
31467    #[allow(unused_imports)]
31468    use super::*;
31469    #[derive(Clone, Debug, PartialEq)]
31470    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
31471}
31472
31473impl SpokeType {
31474    /// Gets the enum value.
31475    ///
31476    /// Returns `None` if the enum contains an unknown value deserialized from
31477    /// the string representation of enums.
31478    pub fn value(&self) -> std::option::Option<i32> {
31479        match self {
31480            Self::Unspecified => std::option::Option::Some(0),
31481            Self::VpnTunnel => std::option::Option::Some(1),
31482            Self::InterconnectAttachment => std::option::Option::Some(2),
31483            Self::RouterAppliance => std::option::Option::Some(3),
31484            Self::VpcNetwork => std::option::Option::Some(4),
31485            Self::ProducerVpcNetwork => std::option::Option::Some(7),
31486            Self::UnknownValue(u) => u.0.value(),
31487        }
31488    }
31489
31490    /// Gets the enum value as a string.
31491    ///
31492    /// Returns `None` if the enum contains an unknown value deserialized from
31493    /// the integer representation of enums.
31494    pub fn name(&self) -> std::option::Option<&str> {
31495        match self {
31496            Self::Unspecified => std::option::Option::Some("SPOKE_TYPE_UNSPECIFIED"),
31497            Self::VpnTunnel => std::option::Option::Some("VPN_TUNNEL"),
31498            Self::InterconnectAttachment => std::option::Option::Some("INTERCONNECT_ATTACHMENT"),
31499            Self::RouterAppliance => std::option::Option::Some("ROUTER_APPLIANCE"),
31500            Self::VpcNetwork => std::option::Option::Some("VPC_NETWORK"),
31501            Self::ProducerVpcNetwork => std::option::Option::Some("PRODUCER_VPC_NETWORK"),
31502            Self::UnknownValue(u) => u.0.name(),
31503        }
31504    }
31505}
31506
31507impl std::default::Default for SpokeType {
31508    fn default() -> Self {
31509        use std::convert::From;
31510        Self::from(0)
31511    }
31512}
31513
31514impl std::fmt::Display for SpokeType {
31515    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
31516        wkt::internal::display_enum(f, self.name(), self.value())
31517    }
31518}
31519
31520impl std::convert::From<i32> for SpokeType {
31521    fn from(value: i32) -> Self {
31522        match value {
31523            0 => Self::Unspecified,
31524            1 => Self::VpnTunnel,
31525            2 => Self::InterconnectAttachment,
31526            3 => Self::RouterAppliance,
31527            4 => Self::VpcNetwork,
31528            7 => Self::ProducerVpcNetwork,
31529            _ => Self::UnknownValue(spoke_type::UnknownValue(
31530                wkt::internal::UnknownEnumValue::Integer(value),
31531            )),
31532        }
31533    }
31534}
31535
31536impl std::convert::From<&str> for SpokeType {
31537    fn from(value: &str) -> Self {
31538        use std::string::ToString;
31539        match value {
31540            "SPOKE_TYPE_UNSPECIFIED" => Self::Unspecified,
31541            "VPN_TUNNEL" => Self::VpnTunnel,
31542            "INTERCONNECT_ATTACHMENT" => Self::InterconnectAttachment,
31543            "ROUTER_APPLIANCE" => Self::RouterAppliance,
31544            "VPC_NETWORK" => Self::VpcNetwork,
31545            "PRODUCER_VPC_NETWORK" => Self::ProducerVpcNetwork,
31546            _ => Self::UnknownValue(spoke_type::UnknownValue(
31547                wkt::internal::UnknownEnumValue::String(value.to_string()),
31548            )),
31549        }
31550    }
31551}
31552
31553impl serde::ser::Serialize for SpokeType {
31554    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
31555    where
31556        S: serde::Serializer,
31557    {
31558        match self {
31559            Self::Unspecified => serializer.serialize_i32(0),
31560            Self::VpnTunnel => serializer.serialize_i32(1),
31561            Self::InterconnectAttachment => serializer.serialize_i32(2),
31562            Self::RouterAppliance => serializer.serialize_i32(3),
31563            Self::VpcNetwork => serializer.serialize_i32(4),
31564            Self::ProducerVpcNetwork => serializer.serialize_i32(7),
31565            Self::UnknownValue(u) => u.0.serialize(serializer),
31566        }
31567    }
31568}
31569
31570impl<'de> serde::de::Deserialize<'de> for SpokeType {
31571    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31572    where
31573        D: serde::Deserializer<'de>,
31574    {
31575        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SpokeType>::new(
31576            ".google.cloud.networkconnectivity.v1.SpokeType",
31577        ))
31578    }
31579}
31580
31581/// This enum controls the policy mode used in a hub.
31582///
31583/// # Working with unknown values
31584///
31585/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
31586/// additional enum variants at any time. Adding new variants is not considered
31587/// a breaking change. Applications should write their code in anticipation of:
31588///
31589/// - New values appearing in future releases of the client library, **and**
31590/// - New values received dynamically, without application changes.
31591///
31592/// Please consult the [Working with enums] section in the user guide for some
31593/// guidelines.
31594///
31595/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
31596#[derive(Clone, Debug, PartialEq)]
31597#[non_exhaustive]
31598pub enum PolicyMode {
31599    /// Policy mode is unspecified. It defaults to PRESET
31600    /// with preset_topology = MESH.
31601    Unspecified,
31602    /// Hub uses one of the preset topologies.
31603    Preset,
31604    /// If set, the enum was initialized with an unknown value.
31605    ///
31606    /// Applications can examine the value using [PolicyMode::value] or
31607    /// [PolicyMode::name].
31608    UnknownValue(policy_mode::UnknownValue),
31609}
31610
31611#[doc(hidden)]
31612pub mod policy_mode {
31613    #[allow(unused_imports)]
31614    use super::*;
31615    #[derive(Clone, Debug, PartialEq)]
31616    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
31617}
31618
31619impl PolicyMode {
31620    /// Gets the enum value.
31621    ///
31622    /// Returns `None` if the enum contains an unknown value deserialized from
31623    /// the string representation of enums.
31624    pub fn value(&self) -> std::option::Option<i32> {
31625        match self {
31626            Self::Unspecified => std::option::Option::Some(0),
31627            Self::Preset => std::option::Option::Some(1),
31628            Self::UnknownValue(u) => u.0.value(),
31629        }
31630    }
31631
31632    /// Gets the enum value as a string.
31633    ///
31634    /// Returns `None` if the enum contains an unknown value deserialized from
31635    /// the integer representation of enums.
31636    pub fn name(&self) -> std::option::Option<&str> {
31637        match self {
31638            Self::Unspecified => std::option::Option::Some("POLICY_MODE_UNSPECIFIED"),
31639            Self::Preset => std::option::Option::Some("PRESET"),
31640            Self::UnknownValue(u) => u.0.name(),
31641        }
31642    }
31643}
31644
31645impl std::default::Default for PolicyMode {
31646    fn default() -> Self {
31647        use std::convert::From;
31648        Self::from(0)
31649    }
31650}
31651
31652impl std::fmt::Display for PolicyMode {
31653    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
31654        wkt::internal::display_enum(f, self.name(), self.value())
31655    }
31656}
31657
31658impl std::convert::From<i32> for PolicyMode {
31659    fn from(value: i32) -> Self {
31660        match value {
31661            0 => Self::Unspecified,
31662            1 => Self::Preset,
31663            _ => Self::UnknownValue(policy_mode::UnknownValue(
31664                wkt::internal::UnknownEnumValue::Integer(value),
31665            )),
31666        }
31667    }
31668}
31669
31670impl std::convert::From<&str> for PolicyMode {
31671    fn from(value: &str) -> Self {
31672        use std::string::ToString;
31673        match value {
31674            "POLICY_MODE_UNSPECIFIED" => Self::Unspecified,
31675            "PRESET" => Self::Preset,
31676            _ => Self::UnknownValue(policy_mode::UnknownValue(
31677                wkt::internal::UnknownEnumValue::String(value.to_string()),
31678            )),
31679        }
31680    }
31681}
31682
31683impl serde::ser::Serialize for PolicyMode {
31684    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
31685    where
31686        S: serde::Serializer,
31687    {
31688        match self {
31689            Self::Unspecified => serializer.serialize_i32(0),
31690            Self::Preset => serializer.serialize_i32(1),
31691            Self::UnknownValue(u) => u.0.serialize(serializer),
31692        }
31693    }
31694}
31695
31696impl<'de> serde::de::Deserialize<'de> for PolicyMode {
31697    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31698    where
31699        D: serde::Deserializer<'de>,
31700    {
31701        deserializer.deserialize_any(wkt::internal::EnumVisitor::<PolicyMode>::new(
31702            ".google.cloud.networkconnectivity.v1.PolicyMode",
31703        ))
31704    }
31705}
31706
31707/// The list of available preset topologies.
31708///
31709/// # Working with unknown values
31710///
31711/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
31712/// additional enum variants at any time. Adding new variants is not considered
31713/// a breaking change. Applications should write their code in anticipation of:
31714///
31715/// - New values appearing in future releases of the client library, **and**
31716/// - New values received dynamically, without application changes.
31717///
31718/// Please consult the [Working with enums] section in the user guide for some
31719/// guidelines.
31720///
31721/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
31722#[derive(Clone, Debug, PartialEq)]
31723#[non_exhaustive]
31724pub enum PresetTopology {
31725    /// Preset topology is unspecified. When policy_mode = PRESET,
31726    /// it defaults to MESH.
31727    Unspecified,
31728    /// Mesh topology is implemented. Group `default` is automatically created.
31729    /// All spokes in the hub are added to group `default`.
31730    Mesh,
31731    /// Star topology is implemented. Two groups, `center` and `edge`, are
31732    /// automatically created along with hub creation. Spokes have to join one of
31733    /// the groups during creation.
31734    Star,
31735    /// If set, the enum was initialized with an unknown value.
31736    ///
31737    /// Applications can examine the value using [PresetTopology::value] or
31738    /// [PresetTopology::name].
31739    UnknownValue(preset_topology::UnknownValue),
31740}
31741
31742#[doc(hidden)]
31743pub mod preset_topology {
31744    #[allow(unused_imports)]
31745    use super::*;
31746    #[derive(Clone, Debug, PartialEq)]
31747    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
31748}
31749
31750impl PresetTopology {
31751    /// Gets the enum value.
31752    ///
31753    /// Returns `None` if the enum contains an unknown value deserialized from
31754    /// the string representation of enums.
31755    pub fn value(&self) -> std::option::Option<i32> {
31756        match self {
31757            Self::Unspecified => std::option::Option::Some(0),
31758            Self::Mesh => std::option::Option::Some(2),
31759            Self::Star => std::option::Option::Some(3),
31760            Self::UnknownValue(u) => u.0.value(),
31761        }
31762    }
31763
31764    /// Gets the enum value as a string.
31765    ///
31766    /// Returns `None` if the enum contains an unknown value deserialized from
31767    /// the integer representation of enums.
31768    pub fn name(&self) -> std::option::Option<&str> {
31769        match self {
31770            Self::Unspecified => std::option::Option::Some("PRESET_TOPOLOGY_UNSPECIFIED"),
31771            Self::Mesh => std::option::Option::Some("MESH"),
31772            Self::Star => std::option::Option::Some("STAR"),
31773            Self::UnknownValue(u) => u.0.name(),
31774        }
31775    }
31776}
31777
31778impl std::default::Default for PresetTopology {
31779    fn default() -> Self {
31780        use std::convert::From;
31781        Self::from(0)
31782    }
31783}
31784
31785impl std::fmt::Display for PresetTopology {
31786    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
31787        wkt::internal::display_enum(f, self.name(), self.value())
31788    }
31789}
31790
31791impl std::convert::From<i32> for PresetTopology {
31792    fn from(value: i32) -> Self {
31793        match value {
31794            0 => Self::Unspecified,
31795            2 => Self::Mesh,
31796            3 => Self::Star,
31797            _ => Self::UnknownValue(preset_topology::UnknownValue(
31798                wkt::internal::UnknownEnumValue::Integer(value),
31799            )),
31800        }
31801    }
31802}
31803
31804impl std::convert::From<&str> for PresetTopology {
31805    fn from(value: &str) -> Self {
31806        use std::string::ToString;
31807        match value {
31808            "PRESET_TOPOLOGY_UNSPECIFIED" => Self::Unspecified,
31809            "MESH" => Self::Mesh,
31810            "STAR" => Self::Star,
31811            _ => Self::UnknownValue(preset_topology::UnknownValue(
31812                wkt::internal::UnknownEnumValue::String(value.to_string()),
31813            )),
31814        }
31815    }
31816}
31817
31818impl serde::ser::Serialize for PresetTopology {
31819    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
31820    where
31821        S: serde::Serializer,
31822    {
31823        match self {
31824            Self::Unspecified => serializer.serialize_i32(0),
31825            Self::Mesh => serializer.serialize_i32(2),
31826            Self::Star => serializer.serialize_i32(3),
31827            Self::UnknownValue(u) => u.0.serialize(serializer),
31828        }
31829    }
31830}
31831
31832impl<'de> serde::de::Deserialize<'de> for PresetTopology {
31833    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31834    where
31835        D: serde::Deserializer<'de>,
31836    {
31837        deserializer.deserialize_any(wkt::internal::EnumVisitor::<PresetTopology>::new(
31838            ".google.cloud.networkconnectivity.v1.PresetTopology",
31839        ))
31840    }
31841}