Skip to main content

google_cloud_networkservices_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 gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_iam_v1;
25extern crate google_cloud_location;
26extern crate google_cloud_longrunning;
27extern crate google_cloud_lro;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// Represents the metadata of the long-running operation.
40#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct OperationMetadata {
43    /// Output only. The time the operation was created.
44    pub create_time: std::option::Option<wkt::Timestamp>,
45
46    /// Output only. The time the operation finished running.
47    pub end_time: std::option::Option<wkt::Timestamp>,
48
49    /// Output only. Server-defined resource path for the target of the operation.
50    pub target: std::string::String,
51
52    /// Output only. Name of the verb executed by the operation.
53    pub verb: std::string::String,
54
55    /// Output only. Human-readable status of the operation, if any.
56    pub status_message: std::string::String,
57
58    /// Output only. Identifies whether the user has requested cancellation
59    /// of the operation. Operations that have successfully been cancelled
60    /// have [Operation.error][] value with a
61    /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
62    /// `Code.CANCELLED`.
63    ///
64    /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
65    pub requested_cancellation: bool,
66
67    /// Output only. API version used to start the operation.
68    pub api_version: std::string::String,
69
70    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
71}
72
73impl OperationMetadata {
74    pub fn new() -> Self {
75        std::default::Default::default()
76    }
77
78    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
79    ///
80    /// # Example
81    /// ```ignore,no_run
82    /// # use google_cloud_networkservices_v1::model::OperationMetadata;
83    /// use wkt::Timestamp;
84    /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
85    /// ```
86    pub fn set_create_time<T>(mut self, v: T) -> Self
87    where
88        T: std::convert::Into<wkt::Timestamp>,
89    {
90        self.create_time = std::option::Option::Some(v.into());
91        self
92    }
93
94    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
95    ///
96    /// # Example
97    /// ```ignore,no_run
98    /// # use google_cloud_networkservices_v1::model::OperationMetadata;
99    /// use wkt::Timestamp;
100    /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
101    /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
102    /// ```
103    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
104    where
105        T: std::convert::Into<wkt::Timestamp>,
106    {
107        self.create_time = v.map(|x| x.into());
108        self
109    }
110
111    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
112    ///
113    /// # Example
114    /// ```ignore,no_run
115    /// # use google_cloud_networkservices_v1::model::OperationMetadata;
116    /// use wkt::Timestamp;
117    /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
118    /// ```
119    pub fn set_end_time<T>(mut self, v: T) -> Self
120    where
121        T: std::convert::Into<wkt::Timestamp>,
122    {
123        self.end_time = std::option::Option::Some(v.into());
124        self
125    }
126
127    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
128    ///
129    /// # Example
130    /// ```ignore,no_run
131    /// # use google_cloud_networkservices_v1::model::OperationMetadata;
132    /// use wkt::Timestamp;
133    /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
134    /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
135    /// ```
136    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
137    where
138        T: std::convert::Into<wkt::Timestamp>,
139    {
140        self.end_time = v.map(|x| x.into());
141        self
142    }
143
144    /// Sets the value of [target][crate::model::OperationMetadata::target].
145    ///
146    /// # Example
147    /// ```ignore,no_run
148    /// # use google_cloud_networkservices_v1::model::OperationMetadata;
149    /// let x = OperationMetadata::new().set_target("example");
150    /// ```
151    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
152        self.target = v.into();
153        self
154    }
155
156    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
157    ///
158    /// # Example
159    /// ```ignore,no_run
160    /// # use google_cloud_networkservices_v1::model::OperationMetadata;
161    /// let x = OperationMetadata::new().set_verb("example");
162    /// ```
163    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
164        self.verb = v.into();
165        self
166    }
167
168    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
169    ///
170    /// # Example
171    /// ```ignore,no_run
172    /// # use google_cloud_networkservices_v1::model::OperationMetadata;
173    /// let x = OperationMetadata::new().set_status_message("example");
174    /// ```
175    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
176        self.status_message = v.into();
177        self
178    }
179
180    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
181    ///
182    /// # Example
183    /// ```ignore,no_run
184    /// # use google_cloud_networkservices_v1::model::OperationMetadata;
185    /// let x = OperationMetadata::new().set_requested_cancellation(true);
186    /// ```
187    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
188        self.requested_cancellation = v.into();
189        self
190    }
191
192    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
193    ///
194    /// # Example
195    /// ```ignore,no_run
196    /// # use google_cloud_networkservices_v1::model::OperationMetadata;
197    /// let x = OperationMetadata::new().set_api_version("example");
198    /// ```
199    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
200        self.api_version = v.into();
201        self
202    }
203}
204
205impl wkt::message::Message for OperationMetadata {
206    fn typename() -> &'static str {
207        "type.googleapis.com/google.cloud.networkservices.v1.OperationMetadata"
208    }
209}
210
211/// Specification of a port-based selector.
212#[derive(Clone, Default, PartialEq)]
213#[non_exhaustive]
214pub struct TrafficPortSelector {
215    /// Optional. A list of ports. Can be port numbers or port range
216    /// (example, [80-90] specifies all ports from 80 to 90, including
217    /// 80 and 90) or named ports or * to specify all ports. If the
218    /// list is empty, all ports are selected.
219    pub ports: std::vec::Vec<std::string::String>,
220
221    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
222}
223
224impl TrafficPortSelector {
225    pub fn new() -> Self {
226        std::default::Default::default()
227    }
228
229    /// Sets the value of [ports][crate::model::TrafficPortSelector::ports].
230    ///
231    /// # Example
232    /// ```ignore,no_run
233    /// # use google_cloud_networkservices_v1::model::TrafficPortSelector;
234    /// let x = TrafficPortSelector::new().set_ports(["a", "b", "c"]);
235    /// ```
236    pub fn set_ports<T, V>(mut self, v: T) -> Self
237    where
238        T: std::iter::IntoIterator<Item = V>,
239        V: std::convert::Into<std::string::String>,
240    {
241        use std::iter::Iterator;
242        self.ports = v.into_iter().map(|i| i.into()).collect();
243        self
244    }
245}
246
247impl wkt::message::Message for TrafficPortSelector {
248    fn typename() -> &'static str {
249        "type.googleapis.com/google.cloud.networkservices.v1.TrafficPortSelector"
250    }
251}
252
253/// A definition of a matcher that selects endpoints to which the policies
254/// should be applied.
255#[derive(Clone, Default, PartialEq)]
256#[non_exhaustive]
257pub struct EndpointMatcher {
258    /// Specifies type of the matcher used for this endpoint matcher.
259    pub matcher_type: std::option::Option<crate::model::endpoint_matcher::MatcherType>,
260
261    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
262}
263
264impl EndpointMatcher {
265    pub fn new() -> Self {
266        std::default::Default::default()
267    }
268
269    /// Sets the value of [matcher_type][crate::model::EndpointMatcher::matcher_type].
270    ///
271    /// Note that all the setters affecting `matcher_type` are mutually
272    /// exclusive.
273    ///
274    /// # Example
275    /// ```ignore,no_run
276    /// # use google_cloud_networkservices_v1::model::EndpointMatcher;
277    /// use google_cloud_networkservices_v1::model::endpoint_matcher::MetadataLabelMatcher;
278    /// let x = EndpointMatcher::new().set_matcher_type(Some(
279    ///     google_cloud_networkservices_v1::model::endpoint_matcher::MatcherType::MetadataLabelMatcher(MetadataLabelMatcher::default().into())));
280    /// ```
281    pub fn set_matcher_type<
282        T: std::convert::Into<std::option::Option<crate::model::endpoint_matcher::MatcherType>>,
283    >(
284        mut self,
285        v: T,
286    ) -> Self {
287        self.matcher_type = v.into();
288        self
289    }
290
291    /// The value of [matcher_type][crate::model::EndpointMatcher::matcher_type]
292    /// if it holds a `MetadataLabelMatcher`, `None` if the field is not set or
293    /// holds a different branch.
294    pub fn metadata_label_matcher(
295        &self,
296    ) -> std::option::Option<&std::boxed::Box<crate::model::endpoint_matcher::MetadataLabelMatcher>>
297    {
298        #[allow(unreachable_patterns)]
299        self.matcher_type.as_ref().and_then(|v| match v {
300            crate::model::endpoint_matcher::MatcherType::MetadataLabelMatcher(v) => {
301                std::option::Option::Some(v)
302            }
303            _ => std::option::Option::None,
304        })
305    }
306
307    /// Sets the value of [matcher_type][crate::model::EndpointMatcher::matcher_type]
308    /// to hold a `MetadataLabelMatcher`.
309    ///
310    /// Note that all the setters affecting `matcher_type` are
311    /// mutually exclusive.
312    ///
313    /// # Example
314    /// ```ignore,no_run
315    /// # use google_cloud_networkservices_v1::model::EndpointMatcher;
316    /// use google_cloud_networkservices_v1::model::endpoint_matcher::MetadataLabelMatcher;
317    /// let x = EndpointMatcher::new().set_metadata_label_matcher(MetadataLabelMatcher::default()/* use setters */);
318    /// assert!(x.metadata_label_matcher().is_some());
319    /// ```
320    pub fn set_metadata_label_matcher<
321        T: std::convert::Into<std::boxed::Box<crate::model::endpoint_matcher::MetadataLabelMatcher>>,
322    >(
323        mut self,
324        v: T,
325    ) -> Self {
326        self.matcher_type = std::option::Option::Some(
327            crate::model::endpoint_matcher::MatcherType::MetadataLabelMatcher(v.into()),
328        );
329        self
330    }
331}
332
333impl wkt::message::Message for EndpointMatcher {
334    fn typename() -> &'static str {
335        "type.googleapis.com/google.cloud.networkservices.v1.EndpointMatcher"
336    }
337}
338
339/// Defines additional types related to [EndpointMatcher].
340pub mod endpoint_matcher {
341    #[allow(unused_imports)]
342    use super::*;
343
344    /// The matcher that is based on node metadata presented by xDS clients.
345    #[derive(Clone, Default, PartialEq)]
346    #[non_exhaustive]
347    pub struct MetadataLabelMatcher {
348        /// Specifies how matching should be done.
349        ///
350        /// Supported values are:
351        /// MATCH_ANY: At least one of the Labels specified in the
352        /// matcher should match the metadata presented by xDS client.
353        /// MATCH_ALL: The metadata presented by the xDS client should
354        /// contain all of the labels specified here.
355        ///
356        /// The selection is determined based on the best match. For
357        /// example, suppose there are three EndpointPolicy
358        /// resources P1, P2 and P3 and if P1 has a the matcher as
359        /// MATCH_ANY <A:1, B:1>, P2 has MATCH_ALL <A:1,B:1>, and P3 has
360        /// MATCH_ALL <A:1,B:1,C:1>.
361        ///
362        /// If a client with label <A:1> connects, the config from P1
363        /// will be selected.
364        ///
365        /// If a client with label <A:1,B:1> connects, the config from P2
366        /// will be selected.
367        ///
368        /// If a client with label <A:1,B:1,C:1> connects, the config
369        /// from P3 will be selected.
370        ///
371        /// If there is more than one best match, (for example, if a
372        /// config P4 with selector <A:1,D:1> exists and if a client with
373        /// label <A:1,B:1,D:1> connects), pick up the one with older creation time.
374        pub metadata_label_match_criteria:
375            crate::model::endpoint_matcher::metadata_label_matcher::MetadataLabelMatchCriteria,
376
377        /// The list of label value pairs that must match labels in the
378        /// provided metadata based on filterMatchCriteria This list can
379        /// have at most 64 entries. The list can be empty if the match
380        /// criteria is MATCH_ANY, to specify a wildcard match (i.e this
381        /// matches any client).
382        pub metadata_labels:
383            std::vec::Vec<crate::model::endpoint_matcher::metadata_label_matcher::MetadataLabels>,
384
385        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
386    }
387
388    impl MetadataLabelMatcher {
389        pub fn new() -> Self {
390            std::default::Default::default()
391        }
392
393        /// Sets the value of [metadata_label_match_criteria][crate::model::endpoint_matcher::MetadataLabelMatcher::metadata_label_match_criteria].
394        ///
395        /// # Example
396        /// ```ignore,no_run
397        /// # use google_cloud_networkservices_v1::model::endpoint_matcher::MetadataLabelMatcher;
398        /// use google_cloud_networkservices_v1::model::endpoint_matcher::metadata_label_matcher::MetadataLabelMatchCriteria;
399        /// let x0 = MetadataLabelMatcher::new().set_metadata_label_match_criteria(MetadataLabelMatchCriteria::MatchAny);
400        /// let x1 = MetadataLabelMatcher::new().set_metadata_label_match_criteria(MetadataLabelMatchCriteria::MatchAll);
401        /// ```
402        pub fn set_metadata_label_match_criteria<T: std::convert::Into<crate::model::endpoint_matcher::metadata_label_matcher::MetadataLabelMatchCriteria>>(mut self, v: T) -> Self{
403            self.metadata_label_match_criteria = v.into();
404            self
405        }
406
407        /// Sets the value of [metadata_labels][crate::model::endpoint_matcher::MetadataLabelMatcher::metadata_labels].
408        ///
409        /// # Example
410        /// ```ignore,no_run
411        /// # use google_cloud_networkservices_v1::model::endpoint_matcher::MetadataLabelMatcher;
412        /// use google_cloud_networkservices_v1::model::endpoint_matcher::metadata_label_matcher::MetadataLabels;
413        /// let x = MetadataLabelMatcher::new()
414        ///     .set_metadata_labels([
415        ///         MetadataLabels::default()/* use setters */,
416        ///         MetadataLabels::default()/* use (different) setters */,
417        ///     ]);
418        /// ```
419        pub fn set_metadata_labels<T, V>(mut self, v: T) -> Self
420        where
421            T: std::iter::IntoIterator<Item = V>,
422            V: std::convert::Into<
423                    crate::model::endpoint_matcher::metadata_label_matcher::MetadataLabels,
424                >,
425        {
426            use std::iter::Iterator;
427            self.metadata_labels = v.into_iter().map(|i| i.into()).collect();
428            self
429        }
430    }
431
432    impl wkt::message::Message for MetadataLabelMatcher {
433        fn typename() -> &'static str {
434            "type.googleapis.com/google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher"
435        }
436    }
437
438    /// Defines additional types related to [MetadataLabelMatcher].
439    pub mod metadata_label_matcher {
440        #[allow(unused_imports)]
441        use super::*;
442
443        /// Defines a name-pair value for a single label.
444        #[derive(Clone, Default, PartialEq)]
445        #[non_exhaustive]
446        pub struct MetadataLabels {
447            /// Required. Label name presented as key in xDS Node Metadata.
448            pub label_name: std::string::String,
449
450            /// Required. Label value presented as value corresponding to the above
451            /// key, in xDS Node Metadata.
452            pub label_value: std::string::String,
453
454            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
455        }
456
457        impl MetadataLabels {
458            pub fn new() -> Self {
459                std::default::Default::default()
460            }
461
462            /// Sets the value of [label_name][crate::model::endpoint_matcher::metadata_label_matcher::MetadataLabels::label_name].
463            ///
464            /// # Example
465            /// ```ignore,no_run
466            /// # use google_cloud_networkservices_v1::model::endpoint_matcher::metadata_label_matcher::MetadataLabels;
467            /// let x = MetadataLabels::new().set_label_name("example");
468            /// ```
469            pub fn set_label_name<T: std::convert::Into<std::string::String>>(
470                mut self,
471                v: T,
472            ) -> Self {
473                self.label_name = v.into();
474                self
475            }
476
477            /// Sets the value of [label_value][crate::model::endpoint_matcher::metadata_label_matcher::MetadataLabels::label_value].
478            ///
479            /// # Example
480            /// ```ignore,no_run
481            /// # use google_cloud_networkservices_v1::model::endpoint_matcher::metadata_label_matcher::MetadataLabels;
482            /// let x = MetadataLabels::new().set_label_value("example");
483            /// ```
484            pub fn set_label_value<T: std::convert::Into<std::string::String>>(
485                mut self,
486                v: T,
487            ) -> Self {
488                self.label_value = v.into();
489                self
490            }
491        }
492
493        impl wkt::message::Message for MetadataLabels {
494            fn typename() -> &'static str {
495                "type.googleapis.com/google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher.MetadataLabels"
496            }
497        }
498
499        /// Possible criteria values that define logic of how matching is made.
500        ///
501        /// # Working with unknown values
502        ///
503        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
504        /// additional enum variants at any time. Adding new variants is not considered
505        /// a breaking change. Applications should write their code in anticipation of:
506        ///
507        /// - New values appearing in future releases of the client library, **and**
508        /// - New values received dynamically, without application changes.
509        ///
510        /// Please consult the [Working with enums] section in the user guide for some
511        /// guidelines.
512        ///
513        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
514        #[derive(Clone, Debug, PartialEq)]
515        #[non_exhaustive]
516        pub enum MetadataLabelMatchCriteria {
517            /// Default value. Should not be used.
518            Unspecified,
519            /// At least one of the Labels specified in the matcher should match the
520            /// metadata presented by xDS client.
521            MatchAny,
522            /// The metadata presented by the xDS client should contain all of the
523            /// labels specified here.
524            MatchAll,
525            /// If set, the enum was initialized with an unknown value.
526            ///
527            /// Applications can examine the value using [MetadataLabelMatchCriteria::value] or
528            /// [MetadataLabelMatchCriteria::name].
529            UnknownValue(metadata_label_match_criteria::UnknownValue),
530        }
531
532        #[doc(hidden)]
533        pub mod metadata_label_match_criteria {
534            #[allow(unused_imports)]
535            use super::*;
536            #[derive(Clone, Debug, PartialEq)]
537            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
538        }
539
540        impl MetadataLabelMatchCriteria {
541            /// Gets the enum value.
542            ///
543            /// Returns `None` if the enum contains an unknown value deserialized from
544            /// the string representation of enums.
545            pub fn value(&self) -> std::option::Option<i32> {
546                match self {
547                    Self::Unspecified => std::option::Option::Some(0),
548                    Self::MatchAny => std::option::Option::Some(1),
549                    Self::MatchAll => std::option::Option::Some(2),
550                    Self::UnknownValue(u) => u.0.value(),
551                }
552            }
553
554            /// Gets the enum value as a string.
555            ///
556            /// Returns `None` if the enum contains an unknown value deserialized from
557            /// the integer representation of enums.
558            pub fn name(&self) -> std::option::Option<&str> {
559                match self {
560                    Self::Unspecified => {
561                        std::option::Option::Some("METADATA_LABEL_MATCH_CRITERIA_UNSPECIFIED")
562                    }
563                    Self::MatchAny => std::option::Option::Some("MATCH_ANY"),
564                    Self::MatchAll => std::option::Option::Some("MATCH_ALL"),
565                    Self::UnknownValue(u) => u.0.name(),
566                }
567            }
568        }
569
570        impl std::default::Default for MetadataLabelMatchCriteria {
571            fn default() -> Self {
572                use std::convert::From;
573                Self::from(0)
574            }
575        }
576
577        impl std::fmt::Display for MetadataLabelMatchCriteria {
578            fn fmt(
579                &self,
580                f: &mut std::fmt::Formatter<'_>,
581            ) -> std::result::Result<(), std::fmt::Error> {
582                wkt::internal::display_enum(f, self.name(), self.value())
583            }
584        }
585
586        impl std::convert::From<i32> for MetadataLabelMatchCriteria {
587            fn from(value: i32) -> Self {
588                match value {
589                    0 => Self::Unspecified,
590                    1 => Self::MatchAny,
591                    2 => Self::MatchAll,
592                    _ => Self::UnknownValue(metadata_label_match_criteria::UnknownValue(
593                        wkt::internal::UnknownEnumValue::Integer(value),
594                    )),
595                }
596            }
597        }
598
599        impl std::convert::From<&str> for MetadataLabelMatchCriteria {
600            fn from(value: &str) -> Self {
601                use std::string::ToString;
602                match value {
603                    "METADATA_LABEL_MATCH_CRITERIA_UNSPECIFIED" => Self::Unspecified,
604                    "MATCH_ANY" => Self::MatchAny,
605                    "MATCH_ALL" => Self::MatchAll,
606                    _ => Self::UnknownValue(metadata_label_match_criteria::UnknownValue(
607                        wkt::internal::UnknownEnumValue::String(value.to_string()),
608                    )),
609                }
610            }
611        }
612
613        impl serde::ser::Serialize for MetadataLabelMatchCriteria {
614            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
615            where
616                S: serde::Serializer,
617            {
618                match self {
619                    Self::Unspecified => serializer.serialize_i32(0),
620                    Self::MatchAny => serializer.serialize_i32(1),
621                    Self::MatchAll => serializer.serialize_i32(2),
622                    Self::UnknownValue(u) => u.0.serialize(serializer),
623                }
624            }
625        }
626
627        impl<'de> serde::de::Deserialize<'de> for MetadataLabelMatchCriteria {
628            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
629            where
630                D: serde::Deserializer<'de>,
631            {
632                deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetadataLabelMatchCriteria>::new(
633                    ".google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher.MetadataLabelMatchCriteria"))
634            }
635        }
636    }
637
638    /// Specifies type of the matcher used for this endpoint matcher.
639    #[derive(Clone, Debug, PartialEq)]
640    #[non_exhaustive]
641    pub enum MatcherType {
642        /// The matcher is based on node metadata presented by xDS clients.
643        MetadataLabelMatcher(std::boxed::Box<crate::model::endpoint_matcher::MetadataLabelMatcher>),
644    }
645}
646
647/// A single extension chain wrapper that contains the match conditions and
648/// extensions to execute.
649#[derive(Clone, Default, PartialEq)]
650#[non_exhaustive]
651pub struct ExtensionChain {
652    /// Required. The name for this extension chain.
653    /// The name is logged as part of the HTTP request logs.
654    /// The name must conform with RFC-1034, is restricted to lower-cased letters,
655    /// numbers and hyphens, and can have a maximum length of 63 characters.
656    /// Additionally, the first character must be a letter and the last a letter or
657    /// a number.
658    pub name: std::string::String,
659
660    /// Required. Conditions under which this chain is invoked for a request.
661    pub match_condition: std::option::Option<crate::model::extension_chain::MatchCondition>,
662
663    /// Required. A set of extensions to execute for the matching request.
664    /// At least one extension is required.
665    /// Up to 3 extensions can be defined for each extension chain
666    /// for `LbTrafficExtension` resource.
667    /// `LbRouteExtension` and `LbEdgeExtension` chains are limited to 1 extension
668    /// per extension chain.
669    pub extensions: std::vec::Vec<crate::model::extension_chain::Extension>,
670
671    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
672}
673
674impl ExtensionChain {
675    pub fn new() -> Self {
676        std::default::Default::default()
677    }
678
679    /// Sets the value of [name][crate::model::ExtensionChain::name].
680    ///
681    /// # Example
682    /// ```ignore,no_run
683    /// # use google_cloud_networkservices_v1::model::ExtensionChain;
684    /// let x = ExtensionChain::new().set_name("example");
685    /// ```
686    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
687        self.name = v.into();
688        self
689    }
690
691    /// Sets the value of [match_condition][crate::model::ExtensionChain::match_condition].
692    ///
693    /// # Example
694    /// ```ignore,no_run
695    /// # use google_cloud_networkservices_v1::model::ExtensionChain;
696    /// use google_cloud_networkservices_v1::model::extension_chain::MatchCondition;
697    /// let x = ExtensionChain::new().set_match_condition(MatchCondition::default()/* use setters */);
698    /// ```
699    pub fn set_match_condition<T>(mut self, v: T) -> Self
700    where
701        T: std::convert::Into<crate::model::extension_chain::MatchCondition>,
702    {
703        self.match_condition = std::option::Option::Some(v.into());
704        self
705    }
706
707    /// Sets or clears the value of [match_condition][crate::model::ExtensionChain::match_condition].
708    ///
709    /// # Example
710    /// ```ignore,no_run
711    /// # use google_cloud_networkservices_v1::model::ExtensionChain;
712    /// use google_cloud_networkservices_v1::model::extension_chain::MatchCondition;
713    /// let x = ExtensionChain::new().set_or_clear_match_condition(Some(MatchCondition::default()/* use setters */));
714    /// let x = ExtensionChain::new().set_or_clear_match_condition(None::<MatchCondition>);
715    /// ```
716    pub fn set_or_clear_match_condition<T>(mut self, v: std::option::Option<T>) -> Self
717    where
718        T: std::convert::Into<crate::model::extension_chain::MatchCondition>,
719    {
720        self.match_condition = v.map(|x| x.into());
721        self
722    }
723
724    /// Sets the value of [extensions][crate::model::ExtensionChain::extensions].
725    ///
726    /// # Example
727    /// ```ignore,no_run
728    /// # use google_cloud_networkservices_v1::model::ExtensionChain;
729    /// use google_cloud_networkservices_v1::model::extension_chain::Extension;
730    /// let x = ExtensionChain::new()
731    ///     .set_extensions([
732    ///         Extension::default()/* use setters */,
733    ///         Extension::default()/* use (different) setters */,
734    ///     ]);
735    /// ```
736    pub fn set_extensions<T, V>(mut self, v: T) -> Self
737    where
738        T: std::iter::IntoIterator<Item = V>,
739        V: std::convert::Into<crate::model::extension_chain::Extension>,
740    {
741        use std::iter::Iterator;
742        self.extensions = v.into_iter().map(|i| i.into()).collect();
743        self
744    }
745}
746
747impl wkt::message::Message for ExtensionChain {
748    fn typename() -> &'static str {
749        "type.googleapis.com/google.cloud.networkservices.v1.ExtensionChain"
750    }
751}
752
753/// Defines additional types related to [ExtensionChain].
754pub mod extension_chain {
755    #[allow(unused_imports)]
756    use super::*;
757
758    /// Conditions under which this chain is invoked for a request.
759    #[derive(Clone, Default, PartialEq)]
760    #[non_exhaustive]
761    pub struct MatchCondition {
762        /// Required. A Common Expression Language (CEL) expression that is used to
763        /// match requests for which the extension chain is executed.
764        ///
765        /// For more information, see [CEL matcher language
766        /// reference](https://cloud.google.com/service-extensions/docs/cel-matcher-language-reference).
767        pub cel_expression: std::string::String,
768
769        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
770    }
771
772    impl MatchCondition {
773        pub fn new() -> Self {
774            std::default::Default::default()
775        }
776
777        /// Sets the value of [cel_expression][crate::model::extension_chain::MatchCondition::cel_expression].
778        ///
779        /// # Example
780        /// ```ignore,no_run
781        /// # use google_cloud_networkservices_v1::model::extension_chain::MatchCondition;
782        /// let x = MatchCondition::new().set_cel_expression("example");
783        /// ```
784        pub fn set_cel_expression<T: std::convert::Into<std::string::String>>(
785            mut self,
786            v: T,
787        ) -> Self {
788            self.cel_expression = v.into();
789            self
790        }
791    }
792
793    impl wkt::message::Message for MatchCondition {
794        fn typename() -> &'static str {
795            "type.googleapis.com/google.cloud.networkservices.v1.ExtensionChain.MatchCondition"
796        }
797    }
798
799    /// A single extension in the chain to execute for the matching request.
800    #[derive(Clone, Default, PartialEq)]
801    #[non_exhaustive]
802    pub struct Extension {
803        /// Required. The name for this extension.
804        /// The name is logged as part of the HTTP request logs.
805        /// The name must conform with RFC-1034, is restricted to lower-cased
806        /// letters, numbers and hyphens, and can have a maximum length of 63
807        /// characters. Additionally, the first character must be a letter and the
808        /// last a letter or a number.
809        pub name: std::string::String,
810
811        /// Optional. The `:authority` header in the gRPC request sent from Envoy
812        /// to the extension service.
813        /// Required for Callout extensions.
814        ///
815        /// This field is not supported for plugin extensions. Setting it results in
816        /// a validation error.
817        pub authority: std::string::String,
818
819        /// Required. The reference to the service that runs the extension.
820        ///
821        /// To configure a callout extension, `service` must be a fully-qualified
822        /// reference
823        /// to a [backend
824        /// service](https://cloud.google.com/compute/docs/reference/rest/v1/backendServices)
825        /// in the format:
826        /// `<https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/backendServices/{backendService}>`
827        /// or
828        /// `<https://www.googleapis.com/compute/v1/projects/{project}/global/backendServices/{backendService}>`.
829        ///
830        /// To configure a plugin extension, `service` must be a reference
831        /// to a [`WasmPlugin`
832        /// resource](https://cloud.google.com/service-extensions/docs/reference/rest/v1beta1/projects.locations.wasmPlugins)
833        /// in the format:
834        /// `projects/{project}/locations/{location}/wasmPlugins/{plugin}`
835        /// or
836        /// `//networkservices.googleapis.com/projects/{project}/locations/{location}/wasmPlugins/{wasmPlugin}`.
837        ///
838        /// Plugin extensions are currently supported for the
839        /// `LbTrafficExtension`, the `LbRouteExtension`, and the `LbEdgeExtension`
840        /// resources.
841        pub service: std::string::String,
842
843        /// Optional. A set of events during request or response processing for which
844        /// this extension is called.
845        ///
846        /// For the `LbTrafficExtension` resource, this field is required.
847        ///
848        /// For the `LbRouteExtension` resource, this field is optional. If
849        /// unspecified, `REQUEST_HEADERS` event is assumed as supported.
850        ///
851        /// For the `LbEdgeExtension` resource, this field is required and must only
852        /// contain `REQUEST_HEADERS` event.
853        pub supported_events: std::vec::Vec<crate::model::EventType>,
854
855        /// Optional. Specifies the timeout for each individual message on the
856        /// stream. The timeout must be between `10`-`10000` milliseconds. Required
857        /// for callout extensions.
858        ///
859        /// This field is not supported for plugin extensions. Setting it results in
860        /// a validation error.
861        pub timeout: std::option::Option<wkt::Duration>,
862
863        /// Optional. Determines how the proxy behaves if the call to the extension
864        /// fails or times out.
865        ///
866        /// When set to `TRUE`, request or response processing continues without
867        /// error. Any subsequent extensions in the extension chain are also
868        /// executed. When set to `FALSE` or the default setting of `FALSE` is used,
869        /// one of the following happens:
870        ///
871        /// * If response headers have not been delivered to the downstream client,
872        ///   a generic 500 error is returned to the client. The error response can be
873        ///   tailored by configuring a custom error response in the load balancer.
874        ///
875        /// * If response headers have been delivered, then the HTTP stream to the
876        ///   downstream client is reset.
877        ///
878        pub fail_open: bool,
879
880        /// Optional. List of the HTTP headers to forward to the extension
881        /// (from the client or backend). If omitted, all headers are sent.
882        /// Each element is a string indicating the header name.
883        pub forward_headers: std::vec::Vec<std::string::String>,
884
885        /// Optional. The metadata provided here is included as part of the
886        /// `metadata_context` (of type `google.protobuf.Struct`) in the
887        /// `ProcessingRequest` message sent to the extension server.
888        ///
889        /// The metadata is available under the namespace
890        /// `com.google.<extension_type>.<resource_name>.<extension_chain_name>.<extension_name>`.
891        /// For example:
892        /// `com.google.lb_traffic_extension.lbtrafficextension1.chain1.ext1`.
893        ///
894        /// The following variables are supported in the metadata:
895        ///
896        /// `{forwarding_rule_id}` - substituted with the forwarding rule's fully
897        /// qualified resource name.
898        ///
899        /// This field must not be set for plugin extensions. Setting it results in
900        /// a validation error.
901        ///
902        /// You can set metadata at either the resource level or the extension level.
903        /// The extension level metadata is recommended because you can pass a
904        /// different set of metadata through each extension to the backend.
905        ///
906        /// This field is subject to following limitations:
907        ///
908        /// * The total size of the metadata must be less than 1KiB.
909        /// * The total number of keys in the metadata must be less than 16.
910        /// * The length of each key must be less than 64 characters.
911        /// * The length of each value must be less than 1024 characters.
912        /// * All values must be strings.
913        pub metadata: std::option::Option<wkt::Struct>,
914
915        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
916    }
917
918    impl Extension {
919        pub fn new() -> Self {
920            std::default::Default::default()
921        }
922
923        /// Sets the value of [name][crate::model::extension_chain::Extension::name].
924        ///
925        /// # Example
926        /// ```ignore,no_run
927        /// # use google_cloud_networkservices_v1::model::extension_chain::Extension;
928        /// let x = Extension::new().set_name("example");
929        /// ```
930        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
931            self.name = v.into();
932            self
933        }
934
935        /// Sets the value of [authority][crate::model::extension_chain::Extension::authority].
936        ///
937        /// # Example
938        /// ```ignore,no_run
939        /// # use google_cloud_networkservices_v1::model::extension_chain::Extension;
940        /// let x = Extension::new().set_authority("example");
941        /// ```
942        pub fn set_authority<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
943            self.authority = v.into();
944            self
945        }
946
947        /// Sets the value of [service][crate::model::extension_chain::Extension::service].
948        ///
949        /// # Example
950        /// ```ignore,no_run
951        /// # use google_cloud_networkservices_v1::model::extension_chain::Extension;
952        /// let x = Extension::new().set_service("example");
953        /// ```
954        pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
955            self.service = v.into();
956            self
957        }
958
959        /// Sets the value of [supported_events][crate::model::extension_chain::Extension::supported_events].
960        ///
961        /// # Example
962        /// ```ignore,no_run
963        /// # use google_cloud_networkservices_v1::model::extension_chain::Extension;
964        /// use google_cloud_networkservices_v1::model::EventType;
965        /// let x = Extension::new().set_supported_events([
966        ///     EventType::RequestHeaders,
967        ///     EventType::RequestBody,
968        ///     EventType::ResponseHeaders,
969        /// ]);
970        /// ```
971        pub fn set_supported_events<T, V>(mut self, v: T) -> Self
972        where
973            T: std::iter::IntoIterator<Item = V>,
974            V: std::convert::Into<crate::model::EventType>,
975        {
976            use std::iter::Iterator;
977            self.supported_events = v.into_iter().map(|i| i.into()).collect();
978            self
979        }
980
981        /// Sets the value of [timeout][crate::model::extension_chain::Extension::timeout].
982        ///
983        /// # Example
984        /// ```ignore,no_run
985        /// # use google_cloud_networkservices_v1::model::extension_chain::Extension;
986        /// use wkt::Duration;
987        /// let x = Extension::new().set_timeout(Duration::default()/* use setters */);
988        /// ```
989        pub fn set_timeout<T>(mut self, v: T) -> Self
990        where
991            T: std::convert::Into<wkt::Duration>,
992        {
993            self.timeout = std::option::Option::Some(v.into());
994            self
995        }
996
997        /// Sets or clears the value of [timeout][crate::model::extension_chain::Extension::timeout].
998        ///
999        /// # Example
1000        /// ```ignore,no_run
1001        /// # use google_cloud_networkservices_v1::model::extension_chain::Extension;
1002        /// use wkt::Duration;
1003        /// let x = Extension::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
1004        /// let x = Extension::new().set_or_clear_timeout(None::<Duration>);
1005        /// ```
1006        pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
1007        where
1008            T: std::convert::Into<wkt::Duration>,
1009        {
1010            self.timeout = v.map(|x| x.into());
1011            self
1012        }
1013
1014        /// Sets the value of [fail_open][crate::model::extension_chain::Extension::fail_open].
1015        ///
1016        /// # Example
1017        /// ```ignore,no_run
1018        /// # use google_cloud_networkservices_v1::model::extension_chain::Extension;
1019        /// let x = Extension::new().set_fail_open(true);
1020        /// ```
1021        pub fn set_fail_open<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1022            self.fail_open = v.into();
1023            self
1024        }
1025
1026        /// Sets the value of [forward_headers][crate::model::extension_chain::Extension::forward_headers].
1027        ///
1028        /// # Example
1029        /// ```ignore,no_run
1030        /// # use google_cloud_networkservices_v1::model::extension_chain::Extension;
1031        /// let x = Extension::new().set_forward_headers(["a", "b", "c"]);
1032        /// ```
1033        pub fn set_forward_headers<T, V>(mut self, v: T) -> Self
1034        where
1035            T: std::iter::IntoIterator<Item = V>,
1036            V: std::convert::Into<std::string::String>,
1037        {
1038            use std::iter::Iterator;
1039            self.forward_headers = v.into_iter().map(|i| i.into()).collect();
1040            self
1041        }
1042
1043        /// Sets the value of [metadata][crate::model::extension_chain::Extension::metadata].
1044        ///
1045        /// # Example
1046        /// ```ignore,no_run
1047        /// # use google_cloud_networkservices_v1::model::extension_chain::Extension;
1048        /// use wkt::Struct;
1049        /// let x = Extension::new().set_metadata(Struct::default()/* use setters */);
1050        /// ```
1051        pub fn set_metadata<T>(mut self, v: T) -> Self
1052        where
1053            T: std::convert::Into<wkt::Struct>,
1054        {
1055            self.metadata = std::option::Option::Some(v.into());
1056            self
1057        }
1058
1059        /// Sets or clears the value of [metadata][crate::model::extension_chain::Extension::metadata].
1060        ///
1061        /// # Example
1062        /// ```ignore,no_run
1063        /// # use google_cloud_networkservices_v1::model::extension_chain::Extension;
1064        /// use wkt::Struct;
1065        /// let x = Extension::new().set_or_clear_metadata(Some(Struct::default()/* use setters */));
1066        /// let x = Extension::new().set_or_clear_metadata(None::<Struct>);
1067        /// ```
1068        pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
1069        where
1070            T: std::convert::Into<wkt::Struct>,
1071        {
1072            self.metadata = v.map(|x| x.into());
1073            self
1074        }
1075    }
1076
1077    impl wkt::message::Message for Extension {
1078        fn typename() -> &'static str {
1079            "type.googleapis.com/google.cloud.networkservices.v1.ExtensionChain.Extension"
1080        }
1081    }
1082}
1083
1084/// `LbTrafficExtension` is a resource that lets the extension service modify the
1085/// headers and payloads of both requests and responses without impacting the
1086/// choice of backend services or any other security policies associated with the
1087/// backend service.
1088#[derive(Clone, Default, PartialEq)]
1089#[non_exhaustive]
1090pub struct LbTrafficExtension {
1091    /// Required. Identifier. Name of the `LbTrafficExtension` resource in the
1092    /// following format:
1093    /// `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`.
1094    pub name: std::string::String,
1095
1096    /// Output only. The timestamp when the resource was created.
1097    pub create_time: std::option::Option<wkt::Timestamp>,
1098
1099    /// Output only. The timestamp when the resource was updated.
1100    pub update_time: std::option::Option<wkt::Timestamp>,
1101
1102    /// Optional. A human-readable description of the resource.
1103    pub description: std::string::String,
1104
1105    /// Optional. Set of labels associated with the `LbTrafficExtension` resource.
1106    ///
1107    /// The format must comply with [the requirements for
1108    /// labels](https://cloud.google.com/compute/docs/labeling-resources#requirements)
1109    /// for Google Cloud resources.
1110    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1111
1112    /// Optional. A list of references to the forwarding rules to which this
1113    /// service extension is attached. At least one forwarding rule is required.
1114    /// Only one `LbTrafficExtension` resource can be associated with a forwarding
1115    /// rule.
1116    pub forwarding_rules: std::vec::Vec<std::string::String>,
1117
1118    /// Required. A set of ordered extension chains that contain the match
1119    /// conditions and extensions to execute. Match conditions for each extension
1120    /// chain are evaluated in sequence for a given request. The first extension
1121    /// chain that has a condition that matches the request is executed.
1122    /// Any subsequent extension chains do not execute.
1123    /// Limited to 5 extension chains per resource.
1124    pub extension_chains: std::vec::Vec<crate::model::ExtensionChain>,
1125
1126    /// Required. All backend services and forwarding rules referenced by this
1127    /// extension must share the same load balancing scheme. Supported values:
1128    /// `INTERNAL_MANAGED` and `EXTERNAL_MANAGED`. For more information, refer to
1129    /// [Backend services
1130    /// overview](https://cloud.google.com/load-balancing/docs/backend-service).
1131    pub load_balancing_scheme: crate::model::LoadBalancingScheme,
1132
1133    /// Optional. The metadata provided here is included as part of the
1134    /// `metadata_context` (of type `google.protobuf.Struct`) in the
1135    /// `ProcessingRequest` message sent to the extension server.
1136    ///
1137    /// The metadata applies to all extensions in all extensions chains in this
1138    /// resource.
1139    ///
1140    /// The metadata is available under the key
1141    /// `com.google.lb_traffic_extension.<resource_name>`.
1142    ///
1143    /// The following variables are supported in the metadata:
1144    ///
1145    /// `{forwarding_rule_id}` - substituted with the forwarding rule's fully
1146    /// qualified resource name.
1147    ///
1148    /// This field must not be set if at least one of the extension chains
1149    /// contains plugin extensions. Setting it results in a validation error.
1150    ///
1151    /// You can set metadata at either the resource level or the extension level.
1152    /// The extension level metadata is recommended because you can pass a
1153    /// different set of metadata through each extension to the backend.
1154    pub metadata: std::option::Option<wkt::Struct>,
1155
1156    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1157}
1158
1159impl LbTrafficExtension {
1160    pub fn new() -> Self {
1161        std::default::Default::default()
1162    }
1163
1164    /// Sets the value of [name][crate::model::LbTrafficExtension::name].
1165    ///
1166    /// # Example
1167    /// ```ignore,no_run
1168    /// # use google_cloud_networkservices_v1::model::LbTrafficExtension;
1169    /// let x = LbTrafficExtension::new().set_name("example");
1170    /// ```
1171    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1172        self.name = v.into();
1173        self
1174    }
1175
1176    /// Sets the value of [create_time][crate::model::LbTrafficExtension::create_time].
1177    ///
1178    /// # Example
1179    /// ```ignore,no_run
1180    /// # use google_cloud_networkservices_v1::model::LbTrafficExtension;
1181    /// use wkt::Timestamp;
1182    /// let x = LbTrafficExtension::new().set_create_time(Timestamp::default()/* use setters */);
1183    /// ```
1184    pub fn set_create_time<T>(mut self, v: T) -> Self
1185    where
1186        T: std::convert::Into<wkt::Timestamp>,
1187    {
1188        self.create_time = std::option::Option::Some(v.into());
1189        self
1190    }
1191
1192    /// Sets or clears the value of [create_time][crate::model::LbTrafficExtension::create_time].
1193    ///
1194    /// # Example
1195    /// ```ignore,no_run
1196    /// # use google_cloud_networkservices_v1::model::LbTrafficExtension;
1197    /// use wkt::Timestamp;
1198    /// let x = LbTrafficExtension::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1199    /// let x = LbTrafficExtension::new().set_or_clear_create_time(None::<Timestamp>);
1200    /// ```
1201    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1202    where
1203        T: std::convert::Into<wkt::Timestamp>,
1204    {
1205        self.create_time = v.map(|x| x.into());
1206        self
1207    }
1208
1209    /// Sets the value of [update_time][crate::model::LbTrafficExtension::update_time].
1210    ///
1211    /// # Example
1212    /// ```ignore,no_run
1213    /// # use google_cloud_networkservices_v1::model::LbTrafficExtension;
1214    /// use wkt::Timestamp;
1215    /// let x = LbTrafficExtension::new().set_update_time(Timestamp::default()/* use setters */);
1216    /// ```
1217    pub fn set_update_time<T>(mut self, v: T) -> Self
1218    where
1219        T: std::convert::Into<wkt::Timestamp>,
1220    {
1221        self.update_time = std::option::Option::Some(v.into());
1222        self
1223    }
1224
1225    /// Sets or clears the value of [update_time][crate::model::LbTrafficExtension::update_time].
1226    ///
1227    /// # Example
1228    /// ```ignore,no_run
1229    /// # use google_cloud_networkservices_v1::model::LbTrafficExtension;
1230    /// use wkt::Timestamp;
1231    /// let x = LbTrafficExtension::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1232    /// let x = LbTrafficExtension::new().set_or_clear_update_time(None::<Timestamp>);
1233    /// ```
1234    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1235    where
1236        T: std::convert::Into<wkt::Timestamp>,
1237    {
1238        self.update_time = v.map(|x| x.into());
1239        self
1240    }
1241
1242    /// Sets the value of [description][crate::model::LbTrafficExtension::description].
1243    ///
1244    /// # Example
1245    /// ```ignore,no_run
1246    /// # use google_cloud_networkservices_v1::model::LbTrafficExtension;
1247    /// let x = LbTrafficExtension::new().set_description("example");
1248    /// ```
1249    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1250        self.description = v.into();
1251        self
1252    }
1253
1254    /// Sets the value of [labels][crate::model::LbTrafficExtension::labels].
1255    ///
1256    /// # Example
1257    /// ```ignore,no_run
1258    /// # use google_cloud_networkservices_v1::model::LbTrafficExtension;
1259    /// let x = LbTrafficExtension::new().set_labels([
1260    ///     ("key0", "abc"),
1261    ///     ("key1", "xyz"),
1262    /// ]);
1263    /// ```
1264    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1265    where
1266        T: std::iter::IntoIterator<Item = (K, V)>,
1267        K: std::convert::Into<std::string::String>,
1268        V: std::convert::Into<std::string::String>,
1269    {
1270        use std::iter::Iterator;
1271        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1272        self
1273    }
1274
1275    /// Sets the value of [forwarding_rules][crate::model::LbTrafficExtension::forwarding_rules].
1276    ///
1277    /// # Example
1278    /// ```ignore,no_run
1279    /// # use google_cloud_networkservices_v1::model::LbTrafficExtension;
1280    /// let x = LbTrafficExtension::new().set_forwarding_rules(["a", "b", "c"]);
1281    /// ```
1282    pub fn set_forwarding_rules<T, V>(mut self, v: T) -> Self
1283    where
1284        T: std::iter::IntoIterator<Item = V>,
1285        V: std::convert::Into<std::string::String>,
1286    {
1287        use std::iter::Iterator;
1288        self.forwarding_rules = v.into_iter().map(|i| i.into()).collect();
1289        self
1290    }
1291
1292    /// Sets the value of [extension_chains][crate::model::LbTrafficExtension::extension_chains].
1293    ///
1294    /// # Example
1295    /// ```ignore,no_run
1296    /// # use google_cloud_networkservices_v1::model::LbTrafficExtension;
1297    /// use google_cloud_networkservices_v1::model::ExtensionChain;
1298    /// let x = LbTrafficExtension::new()
1299    ///     .set_extension_chains([
1300    ///         ExtensionChain::default()/* use setters */,
1301    ///         ExtensionChain::default()/* use (different) setters */,
1302    ///     ]);
1303    /// ```
1304    pub fn set_extension_chains<T, V>(mut self, v: T) -> Self
1305    where
1306        T: std::iter::IntoIterator<Item = V>,
1307        V: std::convert::Into<crate::model::ExtensionChain>,
1308    {
1309        use std::iter::Iterator;
1310        self.extension_chains = v.into_iter().map(|i| i.into()).collect();
1311        self
1312    }
1313
1314    /// Sets the value of [load_balancing_scheme][crate::model::LbTrafficExtension::load_balancing_scheme].
1315    ///
1316    /// # Example
1317    /// ```ignore,no_run
1318    /// # use google_cloud_networkservices_v1::model::LbTrafficExtension;
1319    /// use google_cloud_networkservices_v1::model::LoadBalancingScheme;
1320    /// let x0 = LbTrafficExtension::new().set_load_balancing_scheme(LoadBalancingScheme::InternalManaged);
1321    /// let x1 = LbTrafficExtension::new().set_load_balancing_scheme(LoadBalancingScheme::ExternalManaged);
1322    /// ```
1323    pub fn set_load_balancing_scheme<T: std::convert::Into<crate::model::LoadBalancingScheme>>(
1324        mut self,
1325        v: T,
1326    ) -> Self {
1327        self.load_balancing_scheme = v.into();
1328        self
1329    }
1330
1331    /// Sets the value of [metadata][crate::model::LbTrafficExtension::metadata].
1332    ///
1333    /// # Example
1334    /// ```ignore,no_run
1335    /// # use google_cloud_networkservices_v1::model::LbTrafficExtension;
1336    /// use wkt::Struct;
1337    /// let x = LbTrafficExtension::new().set_metadata(Struct::default()/* use setters */);
1338    /// ```
1339    pub fn set_metadata<T>(mut self, v: T) -> Self
1340    where
1341        T: std::convert::Into<wkt::Struct>,
1342    {
1343        self.metadata = std::option::Option::Some(v.into());
1344        self
1345    }
1346
1347    /// Sets or clears the value of [metadata][crate::model::LbTrafficExtension::metadata].
1348    ///
1349    /// # Example
1350    /// ```ignore,no_run
1351    /// # use google_cloud_networkservices_v1::model::LbTrafficExtension;
1352    /// use wkt::Struct;
1353    /// let x = LbTrafficExtension::new().set_or_clear_metadata(Some(Struct::default()/* use setters */));
1354    /// let x = LbTrafficExtension::new().set_or_clear_metadata(None::<Struct>);
1355    /// ```
1356    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
1357    where
1358        T: std::convert::Into<wkt::Struct>,
1359    {
1360        self.metadata = v.map(|x| x.into());
1361        self
1362    }
1363}
1364
1365impl wkt::message::Message for LbTrafficExtension {
1366    fn typename() -> &'static str {
1367        "type.googleapis.com/google.cloud.networkservices.v1.LbTrafficExtension"
1368    }
1369}
1370
1371/// Message for requesting list of `LbTrafficExtension` resources.
1372#[derive(Clone, Default, PartialEq)]
1373#[non_exhaustive]
1374pub struct ListLbTrafficExtensionsRequest {
1375    /// Required. The project and location from which the `LbTrafficExtension`
1376    /// resources are listed. These values are specified in the following format:
1377    /// `projects/{project}/locations/{location}`.
1378    pub parent: std::string::String,
1379
1380    /// Optional. Requested page size. The server might return fewer items than
1381    /// requested. If unspecified, the server picks an appropriate default.
1382    pub page_size: i32,
1383
1384    /// Optional. A token identifying a page of results that the server returns.
1385    pub page_token: std::string::String,
1386
1387    /// Optional. Filtering results.
1388    pub filter: std::string::String,
1389
1390    /// Optional. Hint about how to order the results.
1391    pub order_by: std::string::String,
1392
1393    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1394}
1395
1396impl ListLbTrafficExtensionsRequest {
1397    pub fn new() -> Self {
1398        std::default::Default::default()
1399    }
1400
1401    /// Sets the value of [parent][crate::model::ListLbTrafficExtensionsRequest::parent].
1402    ///
1403    /// # Example
1404    /// ```ignore,no_run
1405    /// # use google_cloud_networkservices_v1::model::ListLbTrafficExtensionsRequest;
1406    /// let x = ListLbTrafficExtensionsRequest::new().set_parent("example");
1407    /// ```
1408    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1409        self.parent = v.into();
1410        self
1411    }
1412
1413    /// Sets the value of [page_size][crate::model::ListLbTrafficExtensionsRequest::page_size].
1414    ///
1415    /// # Example
1416    /// ```ignore,no_run
1417    /// # use google_cloud_networkservices_v1::model::ListLbTrafficExtensionsRequest;
1418    /// let x = ListLbTrafficExtensionsRequest::new().set_page_size(42);
1419    /// ```
1420    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1421        self.page_size = v.into();
1422        self
1423    }
1424
1425    /// Sets the value of [page_token][crate::model::ListLbTrafficExtensionsRequest::page_token].
1426    ///
1427    /// # Example
1428    /// ```ignore,no_run
1429    /// # use google_cloud_networkservices_v1::model::ListLbTrafficExtensionsRequest;
1430    /// let x = ListLbTrafficExtensionsRequest::new().set_page_token("example");
1431    /// ```
1432    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1433        self.page_token = v.into();
1434        self
1435    }
1436
1437    /// Sets the value of [filter][crate::model::ListLbTrafficExtensionsRequest::filter].
1438    ///
1439    /// # Example
1440    /// ```ignore,no_run
1441    /// # use google_cloud_networkservices_v1::model::ListLbTrafficExtensionsRequest;
1442    /// let x = ListLbTrafficExtensionsRequest::new().set_filter("example");
1443    /// ```
1444    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1445        self.filter = v.into();
1446        self
1447    }
1448
1449    /// Sets the value of [order_by][crate::model::ListLbTrafficExtensionsRequest::order_by].
1450    ///
1451    /// # Example
1452    /// ```ignore,no_run
1453    /// # use google_cloud_networkservices_v1::model::ListLbTrafficExtensionsRequest;
1454    /// let x = ListLbTrafficExtensionsRequest::new().set_order_by("example");
1455    /// ```
1456    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1457        self.order_by = v.into();
1458        self
1459    }
1460}
1461
1462impl wkt::message::Message for ListLbTrafficExtensionsRequest {
1463    fn typename() -> &'static str {
1464        "type.googleapis.com/google.cloud.networkservices.v1.ListLbTrafficExtensionsRequest"
1465    }
1466}
1467
1468/// Message for response to listing `LbTrafficExtension` resources.
1469#[derive(Clone, Default, PartialEq)]
1470#[non_exhaustive]
1471pub struct ListLbTrafficExtensionsResponse {
1472    /// The list of `LbTrafficExtension` resources.
1473    pub lb_traffic_extensions: std::vec::Vec<crate::model::LbTrafficExtension>,
1474
1475    /// A token identifying a page of results that the server returns.
1476    pub next_page_token: std::string::String,
1477
1478    /// Locations that could not be reached.
1479    pub unreachable: std::vec::Vec<std::string::String>,
1480
1481    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1482}
1483
1484impl ListLbTrafficExtensionsResponse {
1485    pub fn new() -> Self {
1486        std::default::Default::default()
1487    }
1488
1489    /// Sets the value of [lb_traffic_extensions][crate::model::ListLbTrafficExtensionsResponse::lb_traffic_extensions].
1490    ///
1491    /// # Example
1492    /// ```ignore,no_run
1493    /// # use google_cloud_networkservices_v1::model::ListLbTrafficExtensionsResponse;
1494    /// use google_cloud_networkservices_v1::model::LbTrafficExtension;
1495    /// let x = ListLbTrafficExtensionsResponse::new()
1496    ///     .set_lb_traffic_extensions([
1497    ///         LbTrafficExtension::default()/* use setters */,
1498    ///         LbTrafficExtension::default()/* use (different) setters */,
1499    ///     ]);
1500    /// ```
1501    pub fn set_lb_traffic_extensions<T, V>(mut self, v: T) -> Self
1502    where
1503        T: std::iter::IntoIterator<Item = V>,
1504        V: std::convert::Into<crate::model::LbTrafficExtension>,
1505    {
1506        use std::iter::Iterator;
1507        self.lb_traffic_extensions = v.into_iter().map(|i| i.into()).collect();
1508        self
1509    }
1510
1511    /// Sets the value of [next_page_token][crate::model::ListLbTrafficExtensionsResponse::next_page_token].
1512    ///
1513    /// # Example
1514    /// ```ignore,no_run
1515    /// # use google_cloud_networkservices_v1::model::ListLbTrafficExtensionsResponse;
1516    /// let x = ListLbTrafficExtensionsResponse::new().set_next_page_token("example");
1517    /// ```
1518    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1519        self.next_page_token = v.into();
1520        self
1521    }
1522
1523    /// Sets the value of [unreachable][crate::model::ListLbTrafficExtensionsResponse::unreachable].
1524    ///
1525    /// # Example
1526    /// ```ignore,no_run
1527    /// # use google_cloud_networkservices_v1::model::ListLbTrafficExtensionsResponse;
1528    /// let x = ListLbTrafficExtensionsResponse::new().set_unreachable(["a", "b", "c"]);
1529    /// ```
1530    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1531    where
1532        T: std::iter::IntoIterator<Item = V>,
1533        V: std::convert::Into<std::string::String>,
1534    {
1535        use std::iter::Iterator;
1536        self.unreachable = v.into_iter().map(|i| i.into()).collect();
1537        self
1538    }
1539}
1540
1541impl wkt::message::Message for ListLbTrafficExtensionsResponse {
1542    fn typename() -> &'static str {
1543        "type.googleapis.com/google.cloud.networkservices.v1.ListLbTrafficExtensionsResponse"
1544    }
1545}
1546
1547#[doc(hidden)]
1548impl google_cloud_gax::paginator::internal::PageableResponse for ListLbTrafficExtensionsResponse {
1549    type PageItem = crate::model::LbTrafficExtension;
1550
1551    fn items(self) -> std::vec::Vec<Self::PageItem> {
1552        self.lb_traffic_extensions
1553    }
1554
1555    fn next_page_token(&self) -> std::string::String {
1556        use std::clone::Clone;
1557        self.next_page_token.clone()
1558    }
1559}
1560
1561/// Message for getting a `LbTrafficExtension` resource.
1562#[derive(Clone, Default, PartialEq)]
1563#[non_exhaustive]
1564pub struct GetLbTrafficExtensionRequest {
1565    /// Required. A name of the `LbTrafficExtension` resource to get. Must be in
1566    /// the format
1567    /// `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`.
1568    pub name: std::string::String,
1569
1570    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1571}
1572
1573impl GetLbTrafficExtensionRequest {
1574    pub fn new() -> Self {
1575        std::default::Default::default()
1576    }
1577
1578    /// Sets the value of [name][crate::model::GetLbTrafficExtensionRequest::name].
1579    ///
1580    /// # Example
1581    /// ```ignore,no_run
1582    /// # use google_cloud_networkservices_v1::model::GetLbTrafficExtensionRequest;
1583    /// let x = GetLbTrafficExtensionRequest::new().set_name("example");
1584    /// ```
1585    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1586        self.name = v.into();
1587        self
1588    }
1589}
1590
1591impl wkt::message::Message for GetLbTrafficExtensionRequest {
1592    fn typename() -> &'static str {
1593        "type.googleapis.com/google.cloud.networkservices.v1.GetLbTrafficExtensionRequest"
1594    }
1595}
1596
1597/// Message for creating a `LbTrafficExtension` resource.
1598#[derive(Clone, Default, PartialEq)]
1599#[non_exhaustive]
1600pub struct CreateLbTrafficExtensionRequest {
1601    /// Required. The parent resource of the `LbTrafficExtension` resource. Must be
1602    /// in the format `projects/{project}/locations/{location}`.
1603    pub parent: std::string::String,
1604
1605    /// Required. User-provided ID of the `LbTrafficExtension` resource to be
1606    /// created.
1607    pub lb_traffic_extension_id: std::string::String,
1608
1609    /// Required. `LbTrafficExtension` resource to be created.
1610    pub lb_traffic_extension: std::option::Option<crate::model::LbTrafficExtension>,
1611
1612    /// Optional. An optional request ID to identify requests. Specify a unique
1613    /// request ID so that if you must retry your request, the server can ignore
1614    /// the request if it has already been completed. The server guarantees
1615    /// that for 60 minutes since the first request.
1616    ///
1617    /// For example, consider a situation where you make an initial request and the
1618    /// request times out. If you make the request again with the same request
1619    /// ID, the server ignores the second request This prevents
1620    /// clients from accidentally creating duplicate commitments.
1621    ///
1622    /// The request ID must be a valid UUID with the exception that zero UUID is
1623    /// not supported (00000000-0000-0000-0000-000000000000).
1624    pub request_id: std::string::String,
1625
1626    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1627}
1628
1629impl CreateLbTrafficExtensionRequest {
1630    pub fn new() -> Self {
1631        std::default::Default::default()
1632    }
1633
1634    /// Sets the value of [parent][crate::model::CreateLbTrafficExtensionRequest::parent].
1635    ///
1636    /// # Example
1637    /// ```ignore,no_run
1638    /// # use google_cloud_networkservices_v1::model::CreateLbTrafficExtensionRequest;
1639    /// let x = CreateLbTrafficExtensionRequest::new().set_parent("example");
1640    /// ```
1641    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1642        self.parent = v.into();
1643        self
1644    }
1645
1646    /// Sets the value of [lb_traffic_extension_id][crate::model::CreateLbTrafficExtensionRequest::lb_traffic_extension_id].
1647    ///
1648    /// # Example
1649    /// ```ignore,no_run
1650    /// # use google_cloud_networkservices_v1::model::CreateLbTrafficExtensionRequest;
1651    /// let x = CreateLbTrafficExtensionRequest::new().set_lb_traffic_extension_id("example");
1652    /// ```
1653    pub fn set_lb_traffic_extension_id<T: std::convert::Into<std::string::String>>(
1654        mut self,
1655        v: T,
1656    ) -> Self {
1657        self.lb_traffic_extension_id = v.into();
1658        self
1659    }
1660
1661    /// Sets the value of [lb_traffic_extension][crate::model::CreateLbTrafficExtensionRequest::lb_traffic_extension].
1662    ///
1663    /// # Example
1664    /// ```ignore,no_run
1665    /// # use google_cloud_networkservices_v1::model::CreateLbTrafficExtensionRequest;
1666    /// use google_cloud_networkservices_v1::model::LbTrafficExtension;
1667    /// let x = CreateLbTrafficExtensionRequest::new().set_lb_traffic_extension(LbTrafficExtension::default()/* use setters */);
1668    /// ```
1669    pub fn set_lb_traffic_extension<T>(mut self, v: T) -> Self
1670    where
1671        T: std::convert::Into<crate::model::LbTrafficExtension>,
1672    {
1673        self.lb_traffic_extension = std::option::Option::Some(v.into());
1674        self
1675    }
1676
1677    /// Sets or clears the value of [lb_traffic_extension][crate::model::CreateLbTrafficExtensionRequest::lb_traffic_extension].
1678    ///
1679    /// # Example
1680    /// ```ignore,no_run
1681    /// # use google_cloud_networkservices_v1::model::CreateLbTrafficExtensionRequest;
1682    /// use google_cloud_networkservices_v1::model::LbTrafficExtension;
1683    /// let x = CreateLbTrafficExtensionRequest::new().set_or_clear_lb_traffic_extension(Some(LbTrafficExtension::default()/* use setters */));
1684    /// let x = CreateLbTrafficExtensionRequest::new().set_or_clear_lb_traffic_extension(None::<LbTrafficExtension>);
1685    /// ```
1686    pub fn set_or_clear_lb_traffic_extension<T>(mut self, v: std::option::Option<T>) -> Self
1687    where
1688        T: std::convert::Into<crate::model::LbTrafficExtension>,
1689    {
1690        self.lb_traffic_extension = v.map(|x| x.into());
1691        self
1692    }
1693
1694    /// Sets the value of [request_id][crate::model::CreateLbTrafficExtensionRequest::request_id].
1695    ///
1696    /// # Example
1697    /// ```ignore,no_run
1698    /// # use google_cloud_networkservices_v1::model::CreateLbTrafficExtensionRequest;
1699    /// let x = CreateLbTrafficExtensionRequest::new().set_request_id("example");
1700    /// ```
1701    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1702        self.request_id = v.into();
1703        self
1704    }
1705}
1706
1707impl wkt::message::Message for CreateLbTrafficExtensionRequest {
1708    fn typename() -> &'static str {
1709        "type.googleapis.com/google.cloud.networkservices.v1.CreateLbTrafficExtensionRequest"
1710    }
1711}
1712
1713/// Message for updating a `LbTrafficExtension` resource.
1714#[derive(Clone, Default, PartialEq)]
1715#[non_exhaustive]
1716pub struct UpdateLbTrafficExtensionRequest {
1717    /// Optional. Used to specify the fields to be overwritten in the
1718    /// `LbTrafficExtension` resource by the update.
1719    /// The fields specified in the `update_mask` are relative to the resource, not
1720    /// the full request. A field is overwritten if it is in the mask. If the
1721    /// user does not specify a mask, then all fields are overwritten.
1722    pub update_mask: std::option::Option<wkt::FieldMask>,
1723
1724    /// Required. `LbTrafficExtension` resource being updated.
1725    pub lb_traffic_extension: std::option::Option<crate::model::LbTrafficExtension>,
1726
1727    /// Optional. An optional request ID to identify requests. Specify a unique
1728    /// request ID so that if you must retry your request, the server can ignore
1729    /// the request if it has already been completed. The server guarantees
1730    /// that for 60 minutes since the first request.
1731    ///
1732    /// For example, consider a situation where you make an initial request and the
1733    /// request times out. If you make the request again with the same request
1734    /// ID, the server ignores the second request This prevents
1735    /// clients from accidentally creating duplicate commitments.
1736    ///
1737    /// The request ID must be a valid UUID with the exception that zero UUID is
1738    /// not supported (00000000-0000-0000-0000-000000000000).
1739    pub request_id: std::string::String,
1740
1741    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1742}
1743
1744impl UpdateLbTrafficExtensionRequest {
1745    pub fn new() -> Self {
1746        std::default::Default::default()
1747    }
1748
1749    /// Sets the value of [update_mask][crate::model::UpdateLbTrafficExtensionRequest::update_mask].
1750    ///
1751    /// # Example
1752    /// ```ignore,no_run
1753    /// # use google_cloud_networkservices_v1::model::UpdateLbTrafficExtensionRequest;
1754    /// use wkt::FieldMask;
1755    /// let x = UpdateLbTrafficExtensionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1756    /// ```
1757    pub fn set_update_mask<T>(mut self, v: T) -> Self
1758    where
1759        T: std::convert::Into<wkt::FieldMask>,
1760    {
1761        self.update_mask = std::option::Option::Some(v.into());
1762        self
1763    }
1764
1765    /// Sets or clears the value of [update_mask][crate::model::UpdateLbTrafficExtensionRequest::update_mask].
1766    ///
1767    /// # Example
1768    /// ```ignore,no_run
1769    /// # use google_cloud_networkservices_v1::model::UpdateLbTrafficExtensionRequest;
1770    /// use wkt::FieldMask;
1771    /// let x = UpdateLbTrafficExtensionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1772    /// let x = UpdateLbTrafficExtensionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1773    /// ```
1774    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1775    where
1776        T: std::convert::Into<wkt::FieldMask>,
1777    {
1778        self.update_mask = v.map(|x| x.into());
1779        self
1780    }
1781
1782    /// Sets the value of [lb_traffic_extension][crate::model::UpdateLbTrafficExtensionRequest::lb_traffic_extension].
1783    ///
1784    /// # Example
1785    /// ```ignore,no_run
1786    /// # use google_cloud_networkservices_v1::model::UpdateLbTrafficExtensionRequest;
1787    /// use google_cloud_networkservices_v1::model::LbTrafficExtension;
1788    /// let x = UpdateLbTrafficExtensionRequest::new().set_lb_traffic_extension(LbTrafficExtension::default()/* use setters */);
1789    /// ```
1790    pub fn set_lb_traffic_extension<T>(mut self, v: T) -> Self
1791    where
1792        T: std::convert::Into<crate::model::LbTrafficExtension>,
1793    {
1794        self.lb_traffic_extension = std::option::Option::Some(v.into());
1795        self
1796    }
1797
1798    /// Sets or clears the value of [lb_traffic_extension][crate::model::UpdateLbTrafficExtensionRequest::lb_traffic_extension].
1799    ///
1800    /// # Example
1801    /// ```ignore,no_run
1802    /// # use google_cloud_networkservices_v1::model::UpdateLbTrafficExtensionRequest;
1803    /// use google_cloud_networkservices_v1::model::LbTrafficExtension;
1804    /// let x = UpdateLbTrafficExtensionRequest::new().set_or_clear_lb_traffic_extension(Some(LbTrafficExtension::default()/* use setters */));
1805    /// let x = UpdateLbTrafficExtensionRequest::new().set_or_clear_lb_traffic_extension(None::<LbTrafficExtension>);
1806    /// ```
1807    pub fn set_or_clear_lb_traffic_extension<T>(mut self, v: std::option::Option<T>) -> Self
1808    where
1809        T: std::convert::Into<crate::model::LbTrafficExtension>,
1810    {
1811        self.lb_traffic_extension = v.map(|x| x.into());
1812        self
1813    }
1814
1815    /// Sets the value of [request_id][crate::model::UpdateLbTrafficExtensionRequest::request_id].
1816    ///
1817    /// # Example
1818    /// ```ignore,no_run
1819    /// # use google_cloud_networkservices_v1::model::UpdateLbTrafficExtensionRequest;
1820    /// let x = UpdateLbTrafficExtensionRequest::new().set_request_id("example");
1821    /// ```
1822    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1823        self.request_id = v.into();
1824        self
1825    }
1826}
1827
1828impl wkt::message::Message for UpdateLbTrafficExtensionRequest {
1829    fn typename() -> &'static str {
1830        "type.googleapis.com/google.cloud.networkservices.v1.UpdateLbTrafficExtensionRequest"
1831    }
1832}
1833
1834/// Message for deleting a `LbTrafficExtension` resource.
1835#[derive(Clone, Default, PartialEq)]
1836#[non_exhaustive]
1837pub struct DeleteLbTrafficExtensionRequest {
1838    /// Required. The name of the `LbTrafficExtension` resource to delete. Must be
1839    /// in the format
1840    /// `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`.
1841    pub name: std::string::String,
1842
1843    /// Optional. An optional request ID to identify requests. Specify a unique
1844    /// request ID so that if you must retry your request, the server can ignore
1845    /// the request if it has already been completed. The server guarantees
1846    /// that for 60 minutes after the first request.
1847    ///
1848    /// For example, consider a situation where you make an initial request and the
1849    /// request times out. If you make the request again with the same request
1850    /// ID, the server ignores the second request This prevents
1851    /// clients from accidentally creating duplicate commitments.
1852    ///
1853    /// The request ID must be a valid UUID with the exception that zero UUID is
1854    /// not supported (00000000-0000-0000-0000-000000000000).
1855    pub request_id: std::string::String,
1856
1857    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1858}
1859
1860impl DeleteLbTrafficExtensionRequest {
1861    pub fn new() -> Self {
1862        std::default::Default::default()
1863    }
1864
1865    /// Sets the value of [name][crate::model::DeleteLbTrafficExtensionRequest::name].
1866    ///
1867    /// # Example
1868    /// ```ignore,no_run
1869    /// # use google_cloud_networkservices_v1::model::DeleteLbTrafficExtensionRequest;
1870    /// let x = DeleteLbTrafficExtensionRequest::new().set_name("example");
1871    /// ```
1872    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1873        self.name = v.into();
1874        self
1875    }
1876
1877    /// Sets the value of [request_id][crate::model::DeleteLbTrafficExtensionRequest::request_id].
1878    ///
1879    /// # Example
1880    /// ```ignore,no_run
1881    /// # use google_cloud_networkservices_v1::model::DeleteLbTrafficExtensionRequest;
1882    /// let x = DeleteLbTrafficExtensionRequest::new().set_request_id("example");
1883    /// ```
1884    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1885        self.request_id = v.into();
1886        self
1887    }
1888}
1889
1890impl wkt::message::Message for DeleteLbTrafficExtensionRequest {
1891    fn typename() -> &'static str {
1892        "type.googleapis.com/google.cloud.networkservices.v1.DeleteLbTrafficExtensionRequest"
1893    }
1894}
1895
1896/// `LbRouteExtension` is a resource that lets you control where traffic is
1897/// routed to for a given request.
1898#[derive(Clone, Default, PartialEq)]
1899#[non_exhaustive]
1900pub struct LbRouteExtension {
1901    /// Required. Identifier. Name of the `LbRouteExtension` resource in the
1902    /// following format:
1903    /// `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`.
1904    pub name: std::string::String,
1905
1906    /// Output only. The timestamp when the resource was created.
1907    pub create_time: std::option::Option<wkt::Timestamp>,
1908
1909    /// Output only. The timestamp when the resource was updated.
1910    pub update_time: std::option::Option<wkt::Timestamp>,
1911
1912    /// Optional. A human-readable description of the resource.
1913    pub description: std::string::String,
1914
1915    /// Optional. Set of labels associated with the `LbRouteExtension` resource.
1916    ///
1917    /// The format must comply with [the requirements for
1918    /// labels](https://cloud.google.com/compute/docs/labeling-resources#requirements)
1919    /// for Google Cloud resources.
1920    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1921
1922    /// Required. A list of references to the forwarding rules to which this
1923    /// service extension is attached. At least one forwarding rule is required.
1924    /// Only one `LbRouteExtension` resource can be associated with a forwarding
1925    /// rule.
1926    pub forwarding_rules: std::vec::Vec<std::string::String>,
1927
1928    /// Required. A set of ordered extension chains that contain the match
1929    /// conditions and extensions to execute. Match conditions for each extension
1930    /// chain are evaluated in sequence for a given request. The first extension
1931    /// chain that has a condition that matches the request is executed.
1932    /// Any subsequent extension chains do not execute.
1933    /// Limited to 5 extension chains per resource.
1934    pub extension_chains: std::vec::Vec<crate::model::ExtensionChain>,
1935
1936    /// Required. All backend services and forwarding rules referenced by this
1937    /// extension must share the same load balancing scheme. Supported values:
1938    /// `INTERNAL_MANAGED`, `EXTERNAL_MANAGED`. For more information, refer to
1939    /// [Backend services
1940    /// overview](https://cloud.google.com/load-balancing/docs/backend-service).
1941    pub load_balancing_scheme: crate::model::LoadBalancingScheme,
1942
1943    /// Optional. The metadata provided here is included as part of the
1944    /// `metadata_context` (of type `google.protobuf.Struct`) in the
1945    /// `ProcessingRequest` message sent to the extension server.
1946    ///
1947    /// The metadata applies to all extensions in all extensions chains in this
1948    /// resource.
1949    ///
1950    /// The metadata is available under the key
1951    /// `com.google.lb_route_extension.<resource_name>`.
1952    ///
1953    /// The following variables are supported in the metadata:
1954    ///
1955    /// `{forwarding_rule_id}` - substituted with the forwarding rule's fully
1956    /// qualified resource name.
1957    ///
1958    /// This field must not be set if at least one of the extension chains
1959    /// contains plugin extensions. Setting it results in a validation error.
1960    ///
1961    /// You can set metadata at either the resource level or the extension level.
1962    /// The extension level metadata is recommended because you can pass a
1963    /// different set of metadata through each extension to the backend.
1964    pub metadata: std::option::Option<wkt::Struct>,
1965
1966    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1967}
1968
1969impl LbRouteExtension {
1970    pub fn new() -> Self {
1971        std::default::Default::default()
1972    }
1973
1974    /// Sets the value of [name][crate::model::LbRouteExtension::name].
1975    ///
1976    /// # Example
1977    /// ```ignore,no_run
1978    /// # use google_cloud_networkservices_v1::model::LbRouteExtension;
1979    /// let x = LbRouteExtension::new().set_name("example");
1980    /// ```
1981    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1982        self.name = v.into();
1983        self
1984    }
1985
1986    /// Sets the value of [create_time][crate::model::LbRouteExtension::create_time].
1987    ///
1988    /// # Example
1989    /// ```ignore,no_run
1990    /// # use google_cloud_networkservices_v1::model::LbRouteExtension;
1991    /// use wkt::Timestamp;
1992    /// let x = LbRouteExtension::new().set_create_time(Timestamp::default()/* use setters */);
1993    /// ```
1994    pub fn set_create_time<T>(mut self, v: T) -> Self
1995    where
1996        T: std::convert::Into<wkt::Timestamp>,
1997    {
1998        self.create_time = std::option::Option::Some(v.into());
1999        self
2000    }
2001
2002    /// Sets or clears the value of [create_time][crate::model::LbRouteExtension::create_time].
2003    ///
2004    /// # Example
2005    /// ```ignore,no_run
2006    /// # use google_cloud_networkservices_v1::model::LbRouteExtension;
2007    /// use wkt::Timestamp;
2008    /// let x = LbRouteExtension::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2009    /// let x = LbRouteExtension::new().set_or_clear_create_time(None::<Timestamp>);
2010    /// ```
2011    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2012    where
2013        T: std::convert::Into<wkt::Timestamp>,
2014    {
2015        self.create_time = v.map(|x| x.into());
2016        self
2017    }
2018
2019    /// Sets the value of [update_time][crate::model::LbRouteExtension::update_time].
2020    ///
2021    /// # Example
2022    /// ```ignore,no_run
2023    /// # use google_cloud_networkservices_v1::model::LbRouteExtension;
2024    /// use wkt::Timestamp;
2025    /// let x = LbRouteExtension::new().set_update_time(Timestamp::default()/* use setters */);
2026    /// ```
2027    pub fn set_update_time<T>(mut self, v: T) -> Self
2028    where
2029        T: std::convert::Into<wkt::Timestamp>,
2030    {
2031        self.update_time = std::option::Option::Some(v.into());
2032        self
2033    }
2034
2035    /// Sets or clears the value of [update_time][crate::model::LbRouteExtension::update_time].
2036    ///
2037    /// # Example
2038    /// ```ignore,no_run
2039    /// # use google_cloud_networkservices_v1::model::LbRouteExtension;
2040    /// use wkt::Timestamp;
2041    /// let x = LbRouteExtension::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2042    /// let x = LbRouteExtension::new().set_or_clear_update_time(None::<Timestamp>);
2043    /// ```
2044    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2045    where
2046        T: std::convert::Into<wkt::Timestamp>,
2047    {
2048        self.update_time = v.map(|x| x.into());
2049        self
2050    }
2051
2052    /// Sets the value of [description][crate::model::LbRouteExtension::description].
2053    ///
2054    /// # Example
2055    /// ```ignore,no_run
2056    /// # use google_cloud_networkservices_v1::model::LbRouteExtension;
2057    /// let x = LbRouteExtension::new().set_description("example");
2058    /// ```
2059    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2060        self.description = v.into();
2061        self
2062    }
2063
2064    /// Sets the value of [labels][crate::model::LbRouteExtension::labels].
2065    ///
2066    /// # Example
2067    /// ```ignore,no_run
2068    /// # use google_cloud_networkservices_v1::model::LbRouteExtension;
2069    /// let x = LbRouteExtension::new().set_labels([
2070    ///     ("key0", "abc"),
2071    ///     ("key1", "xyz"),
2072    /// ]);
2073    /// ```
2074    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2075    where
2076        T: std::iter::IntoIterator<Item = (K, V)>,
2077        K: std::convert::Into<std::string::String>,
2078        V: std::convert::Into<std::string::String>,
2079    {
2080        use std::iter::Iterator;
2081        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2082        self
2083    }
2084
2085    /// Sets the value of [forwarding_rules][crate::model::LbRouteExtension::forwarding_rules].
2086    ///
2087    /// # Example
2088    /// ```ignore,no_run
2089    /// # use google_cloud_networkservices_v1::model::LbRouteExtension;
2090    /// let x = LbRouteExtension::new().set_forwarding_rules(["a", "b", "c"]);
2091    /// ```
2092    pub fn set_forwarding_rules<T, V>(mut self, v: T) -> Self
2093    where
2094        T: std::iter::IntoIterator<Item = V>,
2095        V: std::convert::Into<std::string::String>,
2096    {
2097        use std::iter::Iterator;
2098        self.forwarding_rules = v.into_iter().map(|i| i.into()).collect();
2099        self
2100    }
2101
2102    /// Sets the value of [extension_chains][crate::model::LbRouteExtension::extension_chains].
2103    ///
2104    /// # Example
2105    /// ```ignore,no_run
2106    /// # use google_cloud_networkservices_v1::model::LbRouteExtension;
2107    /// use google_cloud_networkservices_v1::model::ExtensionChain;
2108    /// let x = LbRouteExtension::new()
2109    ///     .set_extension_chains([
2110    ///         ExtensionChain::default()/* use setters */,
2111    ///         ExtensionChain::default()/* use (different) setters */,
2112    ///     ]);
2113    /// ```
2114    pub fn set_extension_chains<T, V>(mut self, v: T) -> Self
2115    where
2116        T: std::iter::IntoIterator<Item = V>,
2117        V: std::convert::Into<crate::model::ExtensionChain>,
2118    {
2119        use std::iter::Iterator;
2120        self.extension_chains = v.into_iter().map(|i| i.into()).collect();
2121        self
2122    }
2123
2124    /// Sets the value of [load_balancing_scheme][crate::model::LbRouteExtension::load_balancing_scheme].
2125    ///
2126    /// # Example
2127    /// ```ignore,no_run
2128    /// # use google_cloud_networkservices_v1::model::LbRouteExtension;
2129    /// use google_cloud_networkservices_v1::model::LoadBalancingScheme;
2130    /// let x0 = LbRouteExtension::new().set_load_balancing_scheme(LoadBalancingScheme::InternalManaged);
2131    /// let x1 = LbRouteExtension::new().set_load_balancing_scheme(LoadBalancingScheme::ExternalManaged);
2132    /// ```
2133    pub fn set_load_balancing_scheme<T: std::convert::Into<crate::model::LoadBalancingScheme>>(
2134        mut self,
2135        v: T,
2136    ) -> Self {
2137        self.load_balancing_scheme = v.into();
2138        self
2139    }
2140
2141    /// Sets the value of [metadata][crate::model::LbRouteExtension::metadata].
2142    ///
2143    /// # Example
2144    /// ```ignore,no_run
2145    /// # use google_cloud_networkservices_v1::model::LbRouteExtension;
2146    /// use wkt::Struct;
2147    /// let x = LbRouteExtension::new().set_metadata(Struct::default()/* use setters */);
2148    /// ```
2149    pub fn set_metadata<T>(mut self, v: T) -> Self
2150    where
2151        T: std::convert::Into<wkt::Struct>,
2152    {
2153        self.metadata = std::option::Option::Some(v.into());
2154        self
2155    }
2156
2157    /// Sets or clears the value of [metadata][crate::model::LbRouteExtension::metadata].
2158    ///
2159    /// # Example
2160    /// ```ignore,no_run
2161    /// # use google_cloud_networkservices_v1::model::LbRouteExtension;
2162    /// use wkt::Struct;
2163    /// let x = LbRouteExtension::new().set_or_clear_metadata(Some(Struct::default()/* use setters */));
2164    /// let x = LbRouteExtension::new().set_or_clear_metadata(None::<Struct>);
2165    /// ```
2166    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
2167    where
2168        T: std::convert::Into<wkt::Struct>,
2169    {
2170        self.metadata = v.map(|x| x.into());
2171        self
2172    }
2173}
2174
2175impl wkt::message::Message for LbRouteExtension {
2176    fn typename() -> &'static str {
2177        "type.googleapis.com/google.cloud.networkservices.v1.LbRouteExtension"
2178    }
2179}
2180
2181/// Message for requesting list of `LbRouteExtension` resources.
2182#[derive(Clone, Default, PartialEq)]
2183#[non_exhaustive]
2184pub struct ListLbRouteExtensionsRequest {
2185    /// Required. The project and location from which the `LbRouteExtension`
2186    /// resources are listed. These values are specified in the following format:
2187    /// `projects/{project}/locations/{location}`.
2188    pub parent: std::string::String,
2189
2190    /// Optional. Requested page size. The server might return fewer items than
2191    /// requested. If unspecified, the server picks an appropriate default.
2192    pub page_size: i32,
2193
2194    /// Optional. A token identifying a page of results that the server returns.
2195    pub page_token: std::string::String,
2196
2197    /// Optional. Filtering results.
2198    pub filter: std::string::String,
2199
2200    /// Optional. Hint about how to order the results.
2201    pub order_by: std::string::String,
2202
2203    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2204}
2205
2206impl ListLbRouteExtensionsRequest {
2207    pub fn new() -> Self {
2208        std::default::Default::default()
2209    }
2210
2211    /// Sets the value of [parent][crate::model::ListLbRouteExtensionsRequest::parent].
2212    ///
2213    /// # Example
2214    /// ```ignore,no_run
2215    /// # use google_cloud_networkservices_v1::model::ListLbRouteExtensionsRequest;
2216    /// let x = ListLbRouteExtensionsRequest::new().set_parent("example");
2217    /// ```
2218    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2219        self.parent = v.into();
2220        self
2221    }
2222
2223    /// Sets the value of [page_size][crate::model::ListLbRouteExtensionsRequest::page_size].
2224    ///
2225    /// # Example
2226    /// ```ignore,no_run
2227    /// # use google_cloud_networkservices_v1::model::ListLbRouteExtensionsRequest;
2228    /// let x = ListLbRouteExtensionsRequest::new().set_page_size(42);
2229    /// ```
2230    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2231        self.page_size = v.into();
2232        self
2233    }
2234
2235    /// Sets the value of [page_token][crate::model::ListLbRouteExtensionsRequest::page_token].
2236    ///
2237    /// # Example
2238    /// ```ignore,no_run
2239    /// # use google_cloud_networkservices_v1::model::ListLbRouteExtensionsRequest;
2240    /// let x = ListLbRouteExtensionsRequest::new().set_page_token("example");
2241    /// ```
2242    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2243        self.page_token = v.into();
2244        self
2245    }
2246
2247    /// Sets the value of [filter][crate::model::ListLbRouteExtensionsRequest::filter].
2248    ///
2249    /// # Example
2250    /// ```ignore,no_run
2251    /// # use google_cloud_networkservices_v1::model::ListLbRouteExtensionsRequest;
2252    /// let x = ListLbRouteExtensionsRequest::new().set_filter("example");
2253    /// ```
2254    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2255        self.filter = v.into();
2256        self
2257    }
2258
2259    /// Sets the value of [order_by][crate::model::ListLbRouteExtensionsRequest::order_by].
2260    ///
2261    /// # Example
2262    /// ```ignore,no_run
2263    /// # use google_cloud_networkservices_v1::model::ListLbRouteExtensionsRequest;
2264    /// let x = ListLbRouteExtensionsRequest::new().set_order_by("example");
2265    /// ```
2266    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2267        self.order_by = v.into();
2268        self
2269    }
2270}
2271
2272impl wkt::message::Message for ListLbRouteExtensionsRequest {
2273    fn typename() -> &'static str {
2274        "type.googleapis.com/google.cloud.networkservices.v1.ListLbRouteExtensionsRequest"
2275    }
2276}
2277
2278/// Message for response to listing `LbRouteExtension` resources.
2279#[derive(Clone, Default, PartialEq)]
2280#[non_exhaustive]
2281pub struct ListLbRouteExtensionsResponse {
2282    /// The list of `LbRouteExtension` resources.
2283    pub lb_route_extensions: std::vec::Vec<crate::model::LbRouteExtension>,
2284
2285    /// A token identifying a page of results that the server returns.
2286    pub next_page_token: std::string::String,
2287
2288    /// Locations that could not be reached.
2289    pub unreachable: std::vec::Vec<std::string::String>,
2290
2291    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2292}
2293
2294impl ListLbRouteExtensionsResponse {
2295    pub fn new() -> Self {
2296        std::default::Default::default()
2297    }
2298
2299    /// Sets the value of [lb_route_extensions][crate::model::ListLbRouteExtensionsResponse::lb_route_extensions].
2300    ///
2301    /// # Example
2302    /// ```ignore,no_run
2303    /// # use google_cloud_networkservices_v1::model::ListLbRouteExtensionsResponse;
2304    /// use google_cloud_networkservices_v1::model::LbRouteExtension;
2305    /// let x = ListLbRouteExtensionsResponse::new()
2306    ///     .set_lb_route_extensions([
2307    ///         LbRouteExtension::default()/* use setters */,
2308    ///         LbRouteExtension::default()/* use (different) setters */,
2309    ///     ]);
2310    /// ```
2311    pub fn set_lb_route_extensions<T, V>(mut self, v: T) -> Self
2312    where
2313        T: std::iter::IntoIterator<Item = V>,
2314        V: std::convert::Into<crate::model::LbRouteExtension>,
2315    {
2316        use std::iter::Iterator;
2317        self.lb_route_extensions = v.into_iter().map(|i| i.into()).collect();
2318        self
2319    }
2320
2321    /// Sets the value of [next_page_token][crate::model::ListLbRouteExtensionsResponse::next_page_token].
2322    ///
2323    /// # Example
2324    /// ```ignore,no_run
2325    /// # use google_cloud_networkservices_v1::model::ListLbRouteExtensionsResponse;
2326    /// let x = ListLbRouteExtensionsResponse::new().set_next_page_token("example");
2327    /// ```
2328    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2329        self.next_page_token = v.into();
2330        self
2331    }
2332
2333    /// Sets the value of [unreachable][crate::model::ListLbRouteExtensionsResponse::unreachable].
2334    ///
2335    /// # Example
2336    /// ```ignore,no_run
2337    /// # use google_cloud_networkservices_v1::model::ListLbRouteExtensionsResponse;
2338    /// let x = ListLbRouteExtensionsResponse::new().set_unreachable(["a", "b", "c"]);
2339    /// ```
2340    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
2341    where
2342        T: std::iter::IntoIterator<Item = V>,
2343        V: std::convert::Into<std::string::String>,
2344    {
2345        use std::iter::Iterator;
2346        self.unreachable = v.into_iter().map(|i| i.into()).collect();
2347        self
2348    }
2349}
2350
2351impl wkt::message::Message for ListLbRouteExtensionsResponse {
2352    fn typename() -> &'static str {
2353        "type.googleapis.com/google.cloud.networkservices.v1.ListLbRouteExtensionsResponse"
2354    }
2355}
2356
2357#[doc(hidden)]
2358impl google_cloud_gax::paginator::internal::PageableResponse for ListLbRouteExtensionsResponse {
2359    type PageItem = crate::model::LbRouteExtension;
2360
2361    fn items(self) -> std::vec::Vec<Self::PageItem> {
2362        self.lb_route_extensions
2363    }
2364
2365    fn next_page_token(&self) -> std::string::String {
2366        use std::clone::Clone;
2367        self.next_page_token.clone()
2368    }
2369}
2370
2371/// Message for getting a `LbRouteExtension` resource.
2372#[derive(Clone, Default, PartialEq)]
2373#[non_exhaustive]
2374pub struct GetLbRouteExtensionRequest {
2375    /// Required. A name of the `LbRouteExtension` resource to get. Must be in the
2376    /// format
2377    /// `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`.
2378    pub name: std::string::String,
2379
2380    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2381}
2382
2383impl GetLbRouteExtensionRequest {
2384    pub fn new() -> Self {
2385        std::default::Default::default()
2386    }
2387
2388    /// Sets the value of [name][crate::model::GetLbRouteExtensionRequest::name].
2389    ///
2390    /// # Example
2391    /// ```ignore,no_run
2392    /// # use google_cloud_networkservices_v1::model::GetLbRouteExtensionRequest;
2393    /// let x = GetLbRouteExtensionRequest::new().set_name("example");
2394    /// ```
2395    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2396        self.name = v.into();
2397        self
2398    }
2399}
2400
2401impl wkt::message::Message for GetLbRouteExtensionRequest {
2402    fn typename() -> &'static str {
2403        "type.googleapis.com/google.cloud.networkservices.v1.GetLbRouteExtensionRequest"
2404    }
2405}
2406
2407/// Message for creating a `LbRouteExtension` resource.
2408#[derive(Clone, Default, PartialEq)]
2409#[non_exhaustive]
2410pub struct CreateLbRouteExtensionRequest {
2411    /// Required. The parent resource of the `LbRouteExtension` resource. Must be
2412    /// in the format `projects/{project}/locations/{location}`.
2413    pub parent: std::string::String,
2414
2415    /// Required. User-provided ID of the `LbRouteExtension` resource to be
2416    /// created.
2417    pub lb_route_extension_id: std::string::String,
2418
2419    /// Required. `LbRouteExtension` resource to be created.
2420    pub lb_route_extension: std::option::Option<crate::model::LbRouteExtension>,
2421
2422    /// Optional. An optional request ID to identify requests. Specify a unique
2423    /// request ID so that if you must retry your request, the server can ignore
2424    /// the request if it has already been completed. The server guarantees
2425    /// that for 60 minutes since the first request.
2426    ///
2427    /// For example, consider a situation where you make an initial request and the
2428    /// request times out. If you make the request again with the same request
2429    /// ID, the server ignores the second request This prevents
2430    /// clients from accidentally creating duplicate commitments.
2431    ///
2432    /// The request ID must be a valid UUID with the exception that zero UUID is
2433    /// not supported (00000000-0000-0000-0000-000000000000).
2434    pub request_id: std::string::String,
2435
2436    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2437}
2438
2439impl CreateLbRouteExtensionRequest {
2440    pub fn new() -> Self {
2441        std::default::Default::default()
2442    }
2443
2444    /// Sets the value of [parent][crate::model::CreateLbRouteExtensionRequest::parent].
2445    ///
2446    /// # Example
2447    /// ```ignore,no_run
2448    /// # use google_cloud_networkservices_v1::model::CreateLbRouteExtensionRequest;
2449    /// let x = CreateLbRouteExtensionRequest::new().set_parent("example");
2450    /// ```
2451    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2452        self.parent = v.into();
2453        self
2454    }
2455
2456    /// Sets the value of [lb_route_extension_id][crate::model::CreateLbRouteExtensionRequest::lb_route_extension_id].
2457    ///
2458    /// # Example
2459    /// ```ignore,no_run
2460    /// # use google_cloud_networkservices_v1::model::CreateLbRouteExtensionRequest;
2461    /// let x = CreateLbRouteExtensionRequest::new().set_lb_route_extension_id("example");
2462    /// ```
2463    pub fn set_lb_route_extension_id<T: std::convert::Into<std::string::String>>(
2464        mut self,
2465        v: T,
2466    ) -> Self {
2467        self.lb_route_extension_id = v.into();
2468        self
2469    }
2470
2471    /// Sets the value of [lb_route_extension][crate::model::CreateLbRouteExtensionRequest::lb_route_extension].
2472    ///
2473    /// # Example
2474    /// ```ignore,no_run
2475    /// # use google_cloud_networkservices_v1::model::CreateLbRouteExtensionRequest;
2476    /// use google_cloud_networkservices_v1::model::LbRouteExtension;
2477    /// let x = CreateLbRouteExtensionRequest::new().set_lb_route_extension(LbRouteExtension::default()/* use setters */);
2478    /// ```
2479    pub fn set_lb_route_extension<T>(mut self, v: T) -> Self
2480    where
2481        T: std::convert::Into<crate::model::LbRouteExtension>,
2482    {
2483        self.lb_route_extension = std::option::Option::Some(v.into());
2484        self
2485    }
2486
2487    /// Sets or clears the value of [lb_route_extension][crate::model::CreateLbRouteExtensionRequest::lb_route_extension].
2488    ///
2489    /// # Example
2490    /// ```ignore,no_run
2491    /// # use google_cloud_networkservices_v1::model::CreateLbRouteExtensionRequest;
2492    /// use google_cloud_networkservices_v1::model::LbRouteExtension;
2493    /// let x = CreateLbRouteExtensionRequest::new().set_or_clear_lb_route_extension(Some(LbRouteExtension::default()/* use setters */));
2494    /// let x = CreateLbRouteExtensionRequest::new().set_or_clear_lb_route_extension(None::<LbRouteExtension>);
2495    /// ```
2496    pub fn set_or_clear_lb_route_extension<T>(mut self, v: std::option::Option<T>) -> Self
2497    where
2498        T: std::convert::Into<crate::model::LbRouteExtension>,
2499    {
2500        self.lb_route_extension = v.map(|x| x.into());
2501        self
2502    }
2503
2504    /// Sets the value of [request_id][crate::model::CreateLbRouteExtensionRequest::request_id].
2505    ///
2506    /// # Example
2507    /// ```ignore,no_run
2508    /// # use google_cloud_networkservices_v1::model::CreateLbRouteExtensionRequest;
2509    /// let x = CreateLbRouteExtensionRequest::new().set_request_id("example");
2510    /// ```
2511    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2512        self.request_id = v.into();
2513        self
2514    }
2515}
2516
2517impl wkt::message::Message for CreateLbRouteExtensionRequest {
2518    fn typename() -> &'static str {
2519        "type.googleapis.com/google.cloud.networkservices.v1.CreateLbRouteExtensionRequest"
2520    }
2521}
2522
2523/// Message for updating a `LbRouteExtension` resource.
2524#[derive(Clone, Default, PartialEq)]
2525#[non_exhaustive]
2526pub struct UpdateLbRouteExtensionRequest {
2527    /// Optional. Used to specify the fields to be overwritten in the
2528    /// `LbRouteExtension` resource by the update.
2529    /// The fields specified in the `update_mask` are relative to the resource, not
2530    /// the full request. A field is overwritten if it is in the mask. If the
2531    /// user does not specify a mask, then all fields are overwritten.
2532    pub update_mask: std::option::Option<wkt::FieldMask>,
2533
2534    /// Required. `LbRouteExtension` resource being updated.
2535    pub lb_route_extension: std::option::Option<crate::model::LbRouteExtension>,
2536
2537    /// Optional. An optional request ID to identify requests. Specify a unique
2538    /// request ID so that if you must retry your request, the server can ignore
2539    /// the request if it has already been completed. The server guarantees
2540    /// that for 60 minutes since the first request.
2541    ///
2542    /// For example, consider a situation where you make an initial request and the
2543    /// request times out. If you make the request again with the same request
2544    /// ID, the server ignores the second request This prevents
2545    /// clients from accidentally creating duplicate commitments.
2546    ///
2547    /// The request ID must be a valid UUID with the exception that zero UUID is
2548    /// not supported (00000000-0000-0000-0000-000000000000).
2549    pub request_id: std::string::String,
2550
2551    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2552}
2553
2554impl UpdateLbRouteExtensionRequest {
2555    pub fn new() -> Self {
2556        std::default::Default::default()
2557    }
2558
2559    /// Sets the value of [update_mask][crate::model::UpdateLbRouteExtensionRequest::update_mask].
2560    ///
2561    /// # Example
2562    /// ```ignore,no_run
2563    /// # use google_cloud_networkservices_v1::model::UpdateLbRouteExtensionRequest;
2564    /// use wkt::FieldMask;
2565    /// let x = UpdateLbRouteExtensionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2566    /// ```
2567    pub fn set_update_mask<T>(mut self, v: T) -> Self
2568    where
2569        T: std::convert::Into<wkt::FieldMask>,
2570    {
2571        self.update_mask = std::option::Option::Some(v.into());
2572        self
2573    }
2574
2575    /// Sets or clears the value of [update_mask][crate::model::UpdateLbRouteExtensionRequest::update_mask].
2576    ///
2577    /// # Example
2578    /// ```ignore,no_run
2579    /// # use google_cloud_networkservices_v1::model::UpdateLbRouteExtensionRequest;
2580    /// use wkt::FieldMask;
2581    /// let x = UpdateLbRouteExtensionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2582    /// let x = UpdateLbRouteExtensionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2583    /// ```
2584    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2585    where
2586        T: std::convert::Into<wkt::FieldMask>,
2587    {
2588        self.update_mask = v.map(|x| x.into());
2589        self
2590    }
2591
2592    /// Sets the value of [lb_route_extension][crate::model::UpdateLbRouteExtensionRequest::lb_route_extension].
2593    ///
2594    /// # Example
2595    /// ```ignore,no_run
2596    /// # use google_cloud_networkservices_v1::model::UpdateLbRouteExtensionRequest;
2597    /// use google_cloud_networkservices_v1::model::LbRouteExtension;
2598    /// let x = UpdateLbRouteExtensionRequest::new().set_lb_route_extension(LbRouteExtension::default()/* use setters */);
2599    /// ```
2600    pub fn set_lb_route_extension<T>(mut self, v: T) -> Self
2601    where
2602        T: std::convert::Into<crate::model::LbRouteExtension>,
2603    {
2604        self.lb_route_extension = std::option::Option::Some(v.into());
2605        self
2606    }
2607
2608    /// Sets or clears the value of [lb_route_extension][crate::model::UpdateLbRouteExtensionRequest::lb_route_extension].
2609    ///
2610    /// # Example
2611    /// ```ignore,no_run
2612    /// # use google_cloud_networkservices_v1::model::UpdateLbRouteExtensionRequest;
2613    /// use google_cloud_networkservices_v1::model::LbRouteExtension;
2614    /// let x = UpdateLbRouteExtensionRequest::new().set_or_clear_lb_route_extension(Some(LbRouteExtension::default()/* use setters */));
2615    /// let x = UpdateLbRouteExtensionRequest::new().set_or_clear_lb_route_extension(None::<LbRouteExtension>);
2616    /// ```
2617    pub fn set_or_clear_lb_route_extension<T>(mut self, v: std::option::Option<T>) -> Self
2618    where
2619        T: std::convert::Into<crate::model::LbRouteExtension>,
2620    {
2621        self.lb_route_extension = v.map(|x| x.into());
2622        self
2623    }
2624
2625    /// Sets the value of [request_id][crate::model::UpdateLbRouteExtensionRequest::request_id].
2626    ///
2627    /// # Example
2628    /// ```ignore,no_run
2629    /// # use google_cloud_networkservices_v1::model::UpdateLbRouteExtensionRequest;
2630    /// let x = UpdateLbRouteExtensionRequest::new().set_request_id("example");
2631    /// ```
2632    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2633        self.request_id = v.into();
2634        self
2635    }
2636}
2637
2638impl wkt::message::Message for UpdateLbRouteExtensionRequest {
2639    fn typename() -> &'static str {
2640        "type.googleapis.com/google.cloud.networkservices.v1.UpdateLbRouteExtensionRequest"
2641    }
2642}
2643
2644/// Message for deleting a `LbRouteExtension` resource.
2645#[derive(Clone, Default, PartialEq)]
2646#[non_exhaustive]
2647pub struct DeleteLbRouteExtensionRequest {
2648    /// Required. The name of the `LbRouteExtension` resource to delete. Must be in
2649    /// the format
2650    /// `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`.
2651    pub name: std::string::String,
2652
2653    /// Optional. An optional request ID to identify requests. Specify a unique
2654    /// request ID so that if you must retry your request, the server can ignore
2655    /// the request if it has already been completed. The server guarantees
2656    /// that for 60 minutes after the first request.
2657    ///
2658    /// For example, consider a situation where you make an initial request and the
2659    /// request times out. If you make the request again with the same request
2660    /// ID, the server ignores the second request This prevents
2661    /// clients from accidentally creating duplicate commitments.
2662    ///
2663    /// The request ID must be a valid UUID with the exception that zero UUID is
2664    /// not supported (00000000-0000-0000-0000-000000000000).
2665    pub request_id: std::string::String,
2666
2667    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2668}
2669
2670impl DeleteLbRouteExtensionRequest {
2671    pub fn new() -> Self {
2672        std::default::Default::default()
2673    }
2674
2675    /// Sets the value of [name][crate::model::DeleteLbRouteExtensionRequest::name].
2676    ///
2677    /// # Example
2678    /// ```ignore,no_run
2679    /// # use google_cloud_networkservices_v1::model::DeleteLbRouteExtensionRequest;
2680    /// let x = DeleteLbRouteExtensionRequest::new().set_name("example");
2681    /// ```
2682    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2683        self.name = v.into();
2684        self
2685    }
2686
2687    /// Sets the value of [request_id][crate::model::DeleteLbRouteExtensionRequest::request_id].
2688    ///
2689    /// # Example
2690    /// ```ignore,no_run
2691    /// # use google_cloud_networkservices_v1::model::DeleteLbRouteExtensionRequest;
2692    /// let x = DeleteLbRouteExtensionRequest::new().set_request_id("example");
2693    /// ```
2694    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2695        self.request_id = v.into();
2696        self
2697    }
2698}
2699
2700impl wkt::message::Message for DeleteLbRouteExtensionRequest {
2701    fn typename() -> &'static str {
2702        "type.googleapis.com/google.cloud.networkservices.v1.DeleteLbRouteExtensionRequest"
2703    }
2704}
2705
2706/// `LbEdgeExtension` is a resource that lets the extension service influence
2707/// the selection of backend services and Cloud CDN cache keys by modifying
2708/// request headers.
2709#[derive(Clone, Default, PartialEq)]
2710#[non_exhaustive]
2711pub struct LbEdgeExtension {
2712    /// Required. Identifier. Name of the `LbEdgeExtension` resource in the
2713    /// following format:
2714    /// `projects/{project}/locations/{location}/lbEdgeExtensions/{lb_edge_extension}`.
2715    pub name: std::string::String,
2716
2717    /// Output only. The timestamp when the resource was created.
2718    pub create_time: std::option::Option<wkt::Timestamp>,
2719
2720    /// Output only. The timestamp when the resource was updated.
2721    pub update_time: std::option::Option<wkt::Timestamp>,
2722
2723    /// Optional. A human-readable description of the resource.
2724    pub description: std::string::String,
2725
2726    /// Optional. Set of labels associated with the `LbEdgeExtension` resource.
2727    ///
2728    /// The format must comply with [the requirements for
2729    /// labels](https://cloud.google.com/compute/docs/labeling-resources#requirements)
2730    /// for Google Cloud resources.
2731    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2732
2733    /// Required. A list of references to the forwarding rules to which this
2734    /// service extension is attached. At least one forwarding rule is required.
2735    /// Only one `LbEdgeExtension` resource can be associated with a forwarding
2736    /// rule.
2737    pub forwarding_rules: std::vec::Vec<std::string::String>,
2738
2739    /// Required. A set of ordered extension chains that contain the match
2740    /// conditions and extensions to execute. Match conditions for each extension
2741    /// chain are evaluated in sequence for a given request. The first extension
2742    /// chain that has a condition that matches the request is executed.
2743    /// Any subsequent extension chains do not execute.
2744    /// Limited to 5 extension chains per resource.
2745    pub extension_chains: std::vec::Vec<crate::model::ExtensionChain>,
2746
2747    /// Required. All forwarding rules referenced by this extension must
2748    /// share the same load balancing scheme.
2749    /// Supported values: `EXTERNAL_MANAGED`.
2750    pub load_balancing_scheme: crate::model::LoadBalancingScheme,
2751
2752    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2753}
2754
2755impl LbEdgeExtension {
2756    pub fn new() -> Self {
2757        std::default::Default::default()
2758    }
2759
2760    /// Sets the value of [name][crate::model::LbEdgeExtension::name].
2761    ///
2762    /// # Example
2763    /// ```ignore,no_run
2764    /// # use google_cloud_networkservices_v1::model::LbEdgeExtension;
2765    /// let x = LbEdgeExtension::new().set_name("example");
2766    /// ```
2767    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2768        self.name = v.into();
2769        self
2770    }
2771
2772    /// Sets the value of [create_time][crate::model::LbEdgeExtension::create_time].
2773    ///
2774    /// # Example
2775    /// ```ignore,no_run
2776    /// # use google_cloud_networkservices_v1::model::LbEdgeExtension;
2777    /// use wkt::Timestamp;
2778    /// let x = LbEdgeExtension::new().set_create_time(Timestamp::default()/* use setters */);
2779    /// ```
2780    pub fn set_create_time<T>(mut self, v: T) -> Self
2781    where
2782        T: std::convert::Into<wkt::Timestamp>,
2783    {
2784        self.create_time = std::option::Option::Some(v.into());
2785        self
2786    }
2787
2788    /// Sets or clears the value of [create_time][crate::model::LbEdgeExtension::create_time].
2789    ///
2790    /// # Example
2791    /// ```ignore,no_run
2792    /// # use google_cloud_networkservices_v1::model::LbEdgeExtension;
2793    /// use wkt::Timestamp;
2794    /// let x = LbEdgeExtension::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2795    /// let x = LbEdgeExtension::new().set_or_clear_create_time(None::<Timestamp>);
2796    /// ```
2797    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2798    where
2799        T: std::convert::Into<wkt::Timestamp>,
2800    {
2801        self.create_time = v.map(|x| x.into());
2802        self
2803    }
2804
2805    /// Sets the value of [update_time][crate::model::LbEdgeExtension::update_time].
2806    ///
2807    /// # Example
2808    /// ```ignore,no_run
2809    /// # use google_cloud_networkservices_v1::model::LbEdgeExtension;
2810    /// use wkt::Timestamp;
2811    /// let x = LbEdgeExtension::new().set_update_time(Timestamp::default()/* use setters */);
2812    /// ```
2813    pub fn set_update_time<T>(mut self, v: T) -> Self
2814    where
2815        T: std::convert::Into<wkt::Timestamp>,
2816    {
2817        self.update_time = std::option::Option::Some(v.into());
2818        self
2819    }
2820
2821    /// Sets or clears the value of [update_time][crate::model::LbEdgeExtension::update_time].
2822    ///
2823    /// # Example
2824    /// ```ignore,no_run
2825    /// # use google_cloud_networkservices_v1::model::LbEdgeExtension;
2826    /// use wkt::Timestamp;
2827    /// let x = LbEdgeExtension::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2828    /// let x = LbEdgeExtension::new().set_or_clear_update_time(None::<Timestamp>);
2829    /// ```
2830    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2831    where
2832        T: std::convert::Into<wkt::Timestamp>,
2833    {
2834        self.update_time = v.map(|x| x.into());
2835        self
2836    }
2837
2838    /// Sets the value of [description][crate::model::LbEdgeExtension::description].
2839    ///
2840    /// # Example
2841    /// ```ignore,no_run
2842    /// # use google_cloud_networkservices_v1::model::LbEdgeExtension;
2843    /// let x = LbEdgeExtension::new().set_description("example");
2844    /// ```
2845    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2846        self.description = v.into();
2847        self
2848    }
2849
2850    /// Sets the value of [labels][crate::model::LbEdgeExtension::labels].
2851    ///
2852    /// # Example
2853    /// ```ignore,no_run
2854    /// # use google_cloud_networkservices_v1::model::LbEdgeExtension;
2855    /// let x = LbEdgeExtension::new().set_labels([
2856    ///     ("key0", "abc"),
2857    ///     ("key1", "xyz"),
2858    /// ]);
2859    /// ```
2860    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2861    where
2862        T: std::iter::IntoIterator<Item = (K, V)>,
2863        K: std::convert::Into<std::string::String>,
2864        V: std::convert::Into<std::string::String>,
2865    {
2866        use std::iter::Iterator;
2867        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2868        self
2869    }
2870
2871    /// Sets the value of [forwarding_rules][crate::model::LbEdgeExtension::forwarding_rules].
2872    ///
2873    /// # Example
2874    /// ```ignore,no_run
2875    /// # use google_cloud_networkservices_v1::model::LbEdgeExtension;
2876    /// let x = LbEdgeExtension::new().set_forwarding_rules(["a", "b", "c"]);
2877    /// ```
2878    pub fn set_forwarding_rules<T, V>(mut self, v: T) -> Self
2879    where
2880        T: std::iter::IntoIterator<Item = V>,
2881        V: std::convert::Into<std::string::String>,
2882    {
2883        use std::iter::Iterator;
2884        self.forwarding_rules = v.into_iter().map(|i| i.into()).collect();
2885        self
2886    }
2887
2888    /// Sets the value of [extension_chains][crate::model::LbEdgeExtension::extension_chains].
2889    ///
2890    /// # Example
2891    /// ```ignore,no_run
2892    /// # use google_cloud_networkservices_v1::model::LbEdgeExtension;
2893    /// use google_cloud_networkservices_v1::model::ExtensionChain;
2894    /// let x = LbEdgeExtension::new()
2895    ///     .set_extension_chains([
2896    ///         ExtensionChain::default()/* use setters */,
2897    ///         ExtensionChain::default()/* use (different) setters */,
2898    ///     ]);
2899    /// ```
2900    pub fn set_extension_chains<T, V>(mut self, v: T) -> Self
2901    where
2902        T: std::iter::IntoIterator<Item = V>,
2903        V: std::convert::Into<crate::model::ExtensionChain>,
2904    {
2905        use std::iter::Iterator;
2906        self.extension_chains = v.into_iter().map(|i| i.into()).collect();
2907        self
2908    }
2909
2910    /// Sets the value of [load_balancing_scheme][crate::model::LbEdgeExtension::load_balancing_scheme].
2911    ///
2912    /// # Example
2913    /// ```ignore,no_run
2914    /// # use google_cloud_networkservices_v1::model::LbEdgeExtension;
2915    /// use google_cloud_networkservices_v1::model::LoadBalancingScheme;
2916    /// let x0 = LbEdgeExtension::new().set_load_balancing_scheme(LoadBalancingScheme::InternalManaged);
2917    /// let x1 = LbEdgeExtension::new().set_load_balancing_scheme(LoadBalancingScheme::ExternalManaged);
2918    /// ```
2919    pub fn set_load_balancing_scheme<T: std::convert::Into<crate::model::LoadBalancingScheme>>(
2920        mut self,
2921        v: T,
2922    ) -> Self {
2923        self.load_balancing_scheme = v.into();
2924        self
2925    }
2926}
2927
2928impl wkt::message::Message for LbEdgeExtension {
2929    fn typename() -> &'static str {
2930        "type.googleapis.com/google.cloud.networkservices.v1.LbEdgeExtension"
2931    }
2932}
2933
2934/// Message for requesting list of `LbEdgeExtension` resources.
2935#[derive(Clone, Default, PartialEq)]
2936#[non_exhaustive]
2937pub struct ListLbEdgeExtensionsRequest {
2938    /// Required. The project and location from which the `LbEdgeExtension`
2939    /// resources are listed. These values are specified in the following format:
2940    /// `projects/{project}/locations/{location}`.
2941    pub parent: std::string::String,
2942
2943    /// Optional. Requested page size. The server might return fewer items than
2944    /// requested. If unspecified, the server picks an appropriate default.
2945    pub page_size: i32,
2946
2947    /// Optional. A token identifying a page of results that the server returns.
2948    pub page_token: std::string::String,
2949
2950    /// Optional. Filtering results.
2951    pub filter: std::string::String,
2952
2953    /// Optional. Hint about how to order the results.
2954    pub order_by: std::string::String,
2955
2956    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2957}
2958
2959impl ListLbEdgeExtensionsRequest {
2960    pub fn new() -> Self {
2961        std::default::Default::default()
2962    }
2963
2964    /// Sets the value of [parent][crate::model::ListLbEdgeExtensionsRequest::parent].
2965    ///
2966    /// # Example
2967    /// ```ignore,no_run
2968    /// # use google_cloud_networkservices_v1::model::ListLbEdgeExtensionsRequest;
2969    /// let x = ListLbEdgeExtensionsRequest::new().set_parent("example");
2970    /// ```
2971    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2972        self.parent = v.into();
2973        self
2974    }
2975
2976    /// Sets the value of [page_size][crate::model::ListLbEdgeExtensionsRequest::page_size].
2977    ///
2978    /// # Example
2979    /// ```ignore,no_run
2980    /// # use google_cloud_networkservices_v1::model::ListLbEdgeExtensionsRequest;
2981    /// let x = ListLbEdgeExtensionsRequest::new().set_page_size(42);
2982    /// ```
2983    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2984        self.page_size = v.into();
2985        self
2986    }
2987
2988    /// Sets the value of [page_token][crate::model::ListLbEdgeExtensionsRequest::page_token].
2989    ///
2990    /// # Example
2991    /// ```ignore,no_run
2992    /// # use google_cloud_networkservices_v1::model::ListLbEdgeExtensionsRequest;
2993    /// let x = ListLbEdgeExtensionsRequest::new().set_page_token("example");
2994    /// ```
2995    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2996        self.page_token = v.into();
2997        self
2998    }
2999
3000    /// Sets the value of [filter][crate::model::ListLbEdgeExtensionsRequest::filter].
3001    ///
3002    /// # Example
3003    /// ```ignore,no_run
3004    /// # use google_cloud_networkservices_v1::model::ListLbEdgeExtensionsRequest;
3005    /// let x = ListLbEdgeExtensionsRequest::new().set_filter("example");
3006    /// ```
3007    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3008        self.filter = v.into();
3009        self
3010    }
3011
3012    /// Sets the value of [order_by][crate::model::ListLbEdgeExtensionsRequest::order_by].
3013    ///
3014    /// # Example
3015    /// ```ignore,no_run
3016    /// # use google_cloud_networkservices_v1::model::ListLbEdgeExtensionsRequest;
3017    /// let x = ListLbEdgeExtensionsRequest::new().set_order_by("example");
3018    /// ```
3019    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3020        self.order_by = v.into();
3021        self
3022    }
3023}
3024
3025impl wkt::message::Message for ListLbEdgeExtensionsRequest {
3026    fn typename() -> &'static str {
3027        "type.googleapis.com/google.cloud.networkservices.v1.ListLbEdgeExtensionsRequest"
3028    }
3029}
3030
3031/// Message for response to listing `LbEdgeExtension` resources.
3032#[derive(Clone, Default, PartialEq)]
3033#[non_exhaustive]
3034pub struct ListLbEdgeExtensionsResponse {
3035    /// The list of `LbEdgeExtension` resources.
3036    pub lb_edge_extensions: std::vec::Vec<crate::model::LbEdgeExtension>,
3037
3038    /// A token identifying a page of results that the server returns.
3039    pub next_page_token: std::string::String,
3040
3041    /// Locations that could not be reached.
3042    pub unreachable: std::vec::Vec<std::string::String>,
3043
3044    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3045}
3046
3047impl ListLbEdgeExtensionsResponse {
3048    pub fn new() -> Self {
3049        std::default::Default::default()
3050    }
3051
3052    /// Sets the value of [lb_edge_extensions][crate::model::ListLbEdgeExtensionsResponse::lb_edge_extensions].
3053    ///
3054    /// # Example
3055    /// ```ignore,no_run
3056    /// # use google_cloud_networkservices_v1::model::ListLbEdgeExtensionsResponse;
3057    /// use google_cloud_networkservices_v1::model::LbEdgeExtension;
3058    /// let x = ListLbEdgeExtensionsResponse::new()
3059    ///     .set_lb_edge_extensions([
3060    ///         LbEdgeExtension::default()/* use setters */,
3061    ///         LbEdgeExtension::default()/* use (different) setters */,
3062    ///     ]);
3063    /// ```
3064    pub fn set_lb_edge_extensions<T, V>(mut self, v: T) -> Self
3065    where
3066        T: std::iter::IntoIterator<Item = V>,
3067        V: std::convert::Into<crate::model::LbEdgeExtension>,
3068    {
3069        use std::iter::Iterator;
3070        self.lb_edge_extensions = v.into_iter().map(|i| i.into()).collect();
3071        self
3072    }
3073
3074    /// Sets the value of [next_page_token][crate::model::ListLbEdgeExtensionsResponse::next_page_token].
3075    ///
3076    /// # Example
3077    /// ```ignore,no_run
3078    /// # use google_cloud_networkservices_v1::model::ListLbEdgeExtensionsResponse;
3079    /// let x = ListLbEdgeExtensionsResponse::new().set_next_page_token("example");
3080    /// ```
3081    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3082        self.next_page_token = v.into();
3083        self
3084    }
3085
3086    /// Sets the value of [unreachable][crate::model::ListLbEdgeExtensionsResponse::unreachable].
3087    ///
3088    /// # Example
3089    /// ```ignore,no_run
3090    /// # use google_cloud_networkservices_v1::model::ListLbEdgeExtensionsResponse;
3091    /// let x = ListLbEdgeExtensionsResponse::new().set_unreachable(["a", "b", "c"]);
3092    /// ```
3093    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
3094    where
3095        T: std::iter::IntoIterator<Item = V>,
3096        V: std::convert::Into<std::string::String>,
3097    {
3098        use std::iter::Iterator;
3099        self.unreachable = v.into_iter().map(|i| i.into()).collect();
3100        self
3101    }
3102}
3103
3104impl wkt::message::Message for ListLbEdgeExtensionsResponse {
3105    fn typename() -> &'static str {
3106        "type.googleapis.com/google.cloud.networkservices.v1.ListLbEdgeExtensionsResponse"
3107    }
3108}
3109
3110#[doc(hidden)]
3111impl google_cloud_gax::paginator::internal::PageableResponse for ListLbEdgeExtensionsResponse {
3112    type PageItem = crate::model::LbEdgeExtension;
3113
3114    fn items(self) -> std::vec::Vec<Self::PageItem> {
3115        self.lb_edge_extensions
3116    }
3117
3118    fn next_page_token(&self) -> std::string::String {
3119        use std::clone::Clone;
3120        self.next_page_token.clone()
3121    }
3122}
3123
3124/// Message for getting a `LbEdgeExtension` resource.
3125#[derive(Clone, Default, PartialEq)]
3126#[non_exhaustive]
3127pub struct GetLbEdgeExtensionRequest {
3128    /// Required. A name of the `LbEdgeExtension` resource to get. Must be in the
3129    /// format
3130    /// `projects/{project}/locations/{location}/lbEdgeExtensions/{lb_edge_extension}`.
3131    pub name: std::string::String,
3132
3133    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3134}
3135
3136impl GetLbEdgeExtensionRequest {
3137    pub fn new() -> Self {
3138        std::default::Default::default()
3139    }
3140
3141    /// Sets the value of [name][crate::model::GetLbEdgeExtensionRequest::name].
3142    ///
3143    /// # Example
3144    /// ```ignore,no_run
3145    /// # use google_cloud_networkservices_v1::model::GetLbEdgeExtensionRequest;
3146    /// let x = GetLbEdgeExtensionRequest::new().set_name("example");
3147    /// ```
3148    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3149        self.name = v.into();
3150        self
3151    }
3152}
3153
3154impl wkt::message::Message for GetLbEdgeExtensionRequest {
3155    fn typename() -> &'static str {
3156        "type.googleapis.com/google.cloud.networkservices.v1.GetLbEdgeExtensionRequest"
3157    }
3158}
3159
3160/// Message for creating a `LbEdgeExtension` resource.
3161#[derive(Clone, Default, PartialEq)]
3162#[non_exhaustive]
3163pub struct CreateLbEdgeExtensionRequest {
3164    /// Required. The parent resource of the `LbEdgeExtension` resource. Must be in
3165    /// the format `projects/{project}/locations/{location}`.
3166    pub parent: std::string::String,
3167
3168    /// Required. User-provided ID of the `LbEdgeExtension` resource to be created.
3169    pub lb_edge_extension_id: std::string::String,
3170
3171    /// Required. `LbEdgeExtension` resource to be created.
3172    pub lb_edge_extension: std::option::Option<crate::model::LbEdgeExtension>,
3173
3174    /// Optional. An optional request ID to identify requests. Specify a unique
3175    /// request ID so that if you must retry your request, the server can ignore
3176    /// the request if it has already been completed. The server guarantees
3177    /// that for 60 minutes since the first request.
3178    ///
3179    /// For example, consider a situation where you make an initial request and the
3180    /// request times out. If you make the request again with the same request
3181    /// ID, the server ignores the second request This prevents
3182    /// clients from accidentally creating duplicate commitments.
3183    ///
3184    /// The request ID must be a valid UUID with the exception that zero UUID is
3185    /// not supported (00000000-0000-0000-0000-000000000000).
3186    pub request_id: std::string::String,
3187
3188    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3189}
3190
3191impl CreateLbEdgeExtensionRequest {
3192    pub fn new() -> Self {
3193        std::default::Default::default()
3194    }
3195
3196    /// Sets the value of [parent][crate::model::CreateLbEdgeExtensionRequest::parent].
3197    ///
3198    /// # Example
3199    /// ```ignore,no_run
3200    /// # use google_cloud_networkservices_v1::model::CreateLbEdgeExtensionRequest;
3201    /// let x = CreateLbEdgeExtensionRequest::new().set_parent("example");
3202    /// ```
3203    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3204        self.parent = v.into();
3205        self
3206    }
3207
3208    /// Sets the value of [lb_edge_extension_id][crate::model::CreateLbEdgeExtensionRequest::lb_edge_extension_id].
3209    ///
3210    /// # Example
3211    /// ```ignore,no_run
3212    /// # use google_cloud_networkservices_v1::model::CreateLbEdgeExtensionRequest;
3213    /// let x = CreateLbEdgeExtensionRequest::new().set_lb_edge_extension_id("example");
3214    /// ```
3215    pub fn set_lb_edge_extension_id<T: std::convert::Into<std::string::String>>(
3216        mut self,
3217        v: T,
3218    ) -> Self {
3219        self.lb_edge_extension_id = v.into();
3220        self
3221    }
3222
3223    /// Sets the value of [lb_edge_extension][crate::model::CreateLbEdgeExtensionRequest::lb_edge_extension].
3224    ///
3225    /// # Example
3226    /// ```ignore,no_run
3227    /// # use google_cloud_networkservices_v1::model::CreateLbEdgeExtensionRequest;
3228    /// use google_cloud_networkservices_v1::model::LbEdgeExtension;
3229    /// let x = CreateLbEdgeExtensionRequest::new().set_lb_edge_extension(LbEdgeExtension::default()/* use setters */);
3230    /// ```
3231    pub fn set_lb_edge_extension<T>(mut self, v: T) -> Self
3232    where
3233        T: std::convert::Into<crate::model::LbEdgeExtension>,
3234    {
3235        self.lb_edge_extension = std::option::Option::Some(v.into());
3236        self
3237    }
3238
3239    /// Sets or clears the value of [lb_edge_extension][crate::model::CreateLbEdgeExtensionRequest::lb_edge_extension].
3240    ///
3241    /// # Example
3242    /// ```ignore,no_run
3243    /// # use google_cloud_networkservices_v1::model::CreateLbEdgeExtensionRequest;
3244    /// use google_cloud_networkservices_v1::model::LbEdgeExtension;
3245    /// let x = CreateLbEdgeExtensionRequest::new().set_or_clear_lb_edge_extension(Some(LbEdgeExtension::default()/* use setters */));
3246    /// let x = CreateLbEdgeExtensionRequest::new().set_or_clear_lb_edge_extension(None::<LbEdgeExtension>);
3247    /// ```
3248    pub fn set_or_clear_lb_edge_extension<T>(mut self, v: std::option::Option<T>) -> Self
3249    where
3250        T: std::convert::Into<crate::model::LbEdgeExtension>,
3251    {
3252        self.lb_edge_extension = v.map(|x| x.into());
3253        self
3254    }
3255
3256    /// Sets the value of [request_id][crate::model::CreateLbEdgeExtensionRequest::request_id].
3257    ///
3258    /// # Example
3259    /// ```ignore,no_run
3260    /// # use google_cloud_networkservices_v1::model::CreateLbEdgeExtensionRequest;
3261    /// let x = CreateLbEdgeExtensionRequest::new().set_request_id("example");
3262    /// ```
3263    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3264        self.request_id = v.into();
3265        self
3266    }
3267}
3268
3269impl wkt::message::Message for CreateLbEdgeExtensionRequest {
3270    fn typename() -> &'static str {
3271        "type.googleapis.com/google.cloud.networkservices.v1.CreateLbEdgeExtensionRequest"
3272    }
3273}
3274
3275/// Message for updating a `LbEdgeExtension` resource.
3276#[derive(Clone, Default, PartialEq)]
3277#[non_exhaustive]
3278pub struct UpdateLbEdgeExtensionRequest {
3279    /// Optional. Used to specify the fields to be overwritten in the
3280    /// `LbEdgeExtension` resource by the update.
3281    /// The fields specified in the `update_mask` are relative to the resource, not
3282    /// the full request. A field is overwritten if it is in the mask. If the
3283    /// user does not specify a mask, then all fields are overwritten.
3284    pub update_mask: std::option::Option<wkt::FieldMask>,
3285
3286    /// Required. `LbEdgeExtension` resource being updated.
3287    pub lb_edge_extension: std::option::Option<crate::model::LbEdgeExtension>,
3288
3289    /// Optional. An optional request ID to identify requests. Specify a unique
3290    /// request ID so that if you must retry your request, the server can ignore
3291    /// the request if it has already been completed. The server guarantees
3292    /// that for 60 minutes since the first request.
3293    ///
3294    /// For example, consider a situation where you make an initial request and the
3295    /// request times out. If you make the request again with the same request
3296    /// ID, the server ignores the second request This prevents
3297    /// clients from accidentally creating duplicate commitments.
3298    ///
3299    /// The request ID must be a valid UUID with the exception that zero UUID is
3300    /// not supported (00000000-0000-0000-0000-000000000000).
3301    pub request_id: std::string::String,
3302
3303    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3304}
3305
3306impl UpdateLbEdgeExtensionRequest {
3307    pub fn new() -> Self {
3308        std::default::Default::default()
3309    }
3310
3311    /// Sets the value of [update_mask][crate::model::UpdateLbEdgeExtensionRequest::update_mask].
3312    ///
3313    /// # Example
3314    /// ```ignore,no_run
3315    /// # use google_cloud_networkservices_v1::model::UpdateLbEdgeExtensionRequest;
3316    /// use wkt::FieldMask;
3317    /// let x = UpdateLbEdgeExtensionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3318    /// ```
3319    pub fn set_update_mask<T>(mut self, v: T) -> Self
3320    where
3321        T: std::convert::Into<wkt::FieldMask>,
3322    {
3323        self.update_mask = std::option::Option::Some(v.into());
3324        self
3325    }
3326
3327    /// Sets or clears the value of [update_mask][crate::model::UpdateLbEdgeExtensionRequest::update_mask].
3328    ///
3329    /// # Example
3330    /// ```ignore,no_run
3331    /// # use google_cloud_networkservices_v1::model::UpdateLbEdgeExtensionRequest;
3332    /// use wkt::FieldMask;
3333    /// let x = UpdateLbEdgeExtensionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3334    /// let x = UpdateLbEdgeExtensionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3335    /// ```
3336    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3337    where
3338        T: std::convert::Into<wkt::FieldMask>,
3339    {
3340        self.update_mask = v.map(|x| x.into());
3341        self
3342    }
3343
3344    /// Sets the value of [lb_edge_extension][crate::model::UpdateLbEdgeExtensionRequest::lb_edge_extension].
3345    ///
3346    /// # Example
3347    /// ```ignore,no_run
3348    /// # use google_cloud_networkservices_v1::model::UpdateLbEdgeExtensionRequest;
3349    /// use google_cloud_networkservices_v1::model::LbEdgeExtension;
3350    /// let x = UpdateLbEdgeExtensionRequest::new().set_lb_edge_extension(LbEdgeExtension::default()/* use setters */);
3351    /// ```
3352    pub fn set_lb_edge_extension<T>(mut self, v: T) -> Self
3353    where
3354        T: std::convert::Into<crate::model::LbEdgeExtension>,
3355    {
3356        self.lb_edge_extension = std::option::Option::Some(v.into());
3357        self
3358    }
3359
3360    /// Sets or clears the value of [lb_edge_extension][crate::model::UpdateLbEdgeExtensionRequest::lb_edge_extension].
3361    ///
3362    /// # Example
3363    /// ```ignore,no_run
3364    /// # use google_cloud_networkservices_v1::model::UpdateLbEdgeExtensionRequest;
3365    /// use google_cloud_networkservices_v1::model::LbEdgeExtension;
3366    /// let x = UpdateLbEdgeExtensionRequest::new().set_or_clear_lb_edge_extension(Some(LbEdgeExtension::default()/* use setters */));
3367    /// let x = UpdateLbEdgeExtensionRequest::new().set_or_clear_lb_edge_extension(None::<LbEdgeExtension>);
3368    /// ```
3369    pub fn set_or_clear_lb_edge_extension<T>(mut self, v: std::option::Option<T>) -> Self
3370    where
3371        T: std::convert::Into<crate::model::LbEdgeExtension>,
3372    {
3373        self.lb_edge_extension = v.map(|x| x.into());
3374        self
3375    }
3376
3377    /// Sets the value of [request_id][crate::model::UpdateLbEdgeExtensionRequest::request_id].
3378    ///
3379    /// # Example
3380    /// ```ignore,no_run
3381    /// # use google_cloud_networkservices_v1::model::UpdateLbEdgeExtensionRequest;
3382    /// let x = UpdateLbEdgeExtensionRequest::new().set_request_id("example");
3383    /// ```
3384    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3385        self.request_id = v.into();
3386        self
3387    }
3388}
3389
3390impl wkt::message::Message for UpdateLbEdgeExtensionRequest {
3391    fn typename() -> &'static str {
3392        "type.googleapis.com/google.cloud.networkservices.v1.UpdateLbEdgeExtensionRequest"
3393    }
3394}
3395
3396/// Message for deleting a `LbEdgeExtension` resource.
3397#[derive(Clone, Default, PartialEq)]
3398#[non_exhaustive]
3399pub struct DeleteLbEdgeExtensionRequest {
3400    /// Required. The name of the `LbEdgeExtension` resource to delete. Must be in
3401    /// the format
3402    /// `projects/{project}/locations/{location}/lbEdgeExtensions/{lb_edge_extension}`.
3403    pub name: std::string::String,
3404
3405    /// Optional. An optional request ID to identify requests. Specify a unique
3406    /// request ID so that if you must retry your request, the server can ignore
3407    /// the request if it has already been completed. The server guarantees
3408    /// that for 60 minutes after the first request.
3409    ///
3410    /// For example, consider a situation where you make an initial request and the
3411    /// request times out. If you make the request again with the same request
3412    /// ID, the server ignores the second request This prevents
3413    /// clients from accidentally creating duplicate commitments.
3414    ///
3415    /// The request ID must be a valid UUID with the exception that zero UUID is
3416    /// not supported (00000000-0000-0000-0000-000000000000).
3417    pub request_id: std::string::String,
3418
3419    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3420}
3421
3422impl DeleteLbEdgeExtensionRequest {
3423    pub fn new() -> Self {
3424        std::default::Default::default()
3425    }
3426
3427    /// Sets the value of [name][crate::model::DeleteLbEdgeExtensionRequest::name].
3428    ///
3429    /// # Example
3430    /// ```ignore,no_run
3431    /// # use google_cloud_networkservices_v1::model::DeleteLbEdgeExtensionRequest;
3432    /// let x = DeleteLbEdgeExtensionRequest::new().set_name("example");
3433    /// ```
3434    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3435        self.name = v.into();
3436        self
3437    }
3438
3439    /// Sets the value of [request_id][crate::model::DeleteLbEdgeExtensionRequest::request_id].
3440    ///
3441    /// # Example
3442    /// ```ignore,no_run
3443    /// # use google_cloud_networkservices_v1::model::DeleteLbEdgeExtensionRequest;
3444    /// let x = DeleteLbEdgeExtensionRequest::new().set_request_id("example");
3445    /// ```
3446    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3447        self.request_id = v.into();
3448        self
3449    }
3450}
3451
3452impl wkt::message::Message for DeleteLbEdgeExtensionRequest {
3453    fn typename() -> &'static str {
3454        "type.googleapis.com/google.cloud.networkservices.v1.DeleteLbEdgeExtensionRequest"
3455    }
3456}
3457
3458/// `AuthzExtension` is a resource that allows traffic forwarding
3459/// to a callout backend service to make an authorization decision.
3460#[derive(Clone, Default, PartialEq)]
3461#[non_exhaustive]
3462pub struct AuthzExtension {
3463    /// Required. Identifier. Name of the `AuthzExtension` resource in the
3464    /// following format:
3465    /// `projects/{project}/locations/{location}/authzExtensions/{authz_extension}`.
3466    pub name: std::string::String,
3467
3468    /// Output only. The timestamp when the resource was created.
3469    pub create_time: std::option::Option<wkt::Timestamp>,
3470
3471    /// Output only. The timestamp when the resource was updated.
3472    pub update_time: std::option::Option<wkt::Timestamp>,
3473
3474    /// Optional. A human-readable description of the resource.
3475    pub description: std::string::String,
3476
3477    /// Optional. Set of labels associated with the `AuthzExtension`
3478    /// resource.
3479    ///
3480    /// The format must comply with [the requirements for
3481    /// labels](/compute/docs/labeling-resources#requirements) for Google Cloud
3482    /// resources.
3483    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3484
3485    /// Required. All backend services and forwarding rules referenced by this
3486    /// extension must share the same load balancing scheme. Supported values:
3487    /// `INTERNAL_MANAGED`, `EXTERNAL_MANAGED`. For more information, refer to
3488    /// [Backend services
3489    /// overview](https://cloud.google.com/load-balancing/docs/backend-service).
3490    pub load_balancing_scheme: crate::model::LoadBalancingScheme,
3491
3492    /// Required. The `:authority` header in the gRPC request sent from Envoy
3493    /// to the extension service.
3494    pub authority: std::string::String,
3495
3496    /// Required. The reference to the service that runs the extension.
3497    ///
3498    /// To configure a callout extension, `service` must be a fully-qualified
3499    /// reference
3500    /// to a [backend
3501    /// service](https://cloud.google.com/compute/docs/reference/rest/v1/backendServices)
3502    /// in the format:
3503    /// `<https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/backendServices/{backendService}>`
3504    /// or
3505    /// `<https://www.googleapis.com/compute/v1/projects/{project}/global/backendServices/{backendService}>`.
3506    pub service: std::string::String,
3507
3508    /// Required. Specifies the timeout for each individual message on the stream.
3509    /// The timeout must be between 10-10000 milliseconds.
3510    pub timeout: std::option::Option<wkt::Duration>,
3511
3512    /// Optional. Determines how the proxy behaves if the call to the extension
3513    /// fails or times out.
3514    ///
3515    /// When set to `TRUE`, request or response processing continues without
3516    /// error. Any subsequent extensions in the extension chain are also
3517    /// executed. When set to `FALSE` or the default setting of `FALSE` is used,
3518    /// one of the following happens:
3519    ///
3520    /// * If response headers have not been delivered to the downstream client,
3521    ///   a generic 500 error is returned to the client. The error response can be
3522    ///   tailored by configuring a custom error response in the load balancer.
3523    ///
3524    /// * If response headers have been delivered, then the HTTP stream to the
3525    ///   downstream client is reset.
3526    ///
3527    pub fail_open: bool,
3528
3529    /// Optional. The metadata provided here is included as part of the
3530    /// `metadata_context` (of type `google.protobuf.Struct`) in the
3531    /// `ProcessingRequest` message sent to the extension
3532    /// server. The metadata is available under the namespace
3533    /// `com.google.authz_extension.<resource_name>`.
3534    /// The following variables are supported in the metadata Struct:
3535    ///
3536    /// `{forwarding_rule_id}` - substituted with the forwarding rule's fully
3537    /// qualified resource name.
3538    pub metadata: std::option::Option<wkt::Struct>,
3539
3540    /// Optional. List of the HTTP headers to forward to the extension
3541    /// (from the client). If omitted, all headers are sent.
3542    /// Each element is a string indicating the header name.
3543    pub forward_headers: std::vec::Vec<std::string::String>,
3544
3545    /// Optional. The format of communication supported by the callout extension.
3546    /// If not specified, the default value `EXT_PROC_GRPC` is used.
3547    pub wire_format: crate::model::WireFormat,
3548
3549    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3550}
3551
3552impl AuthzExtension {
3553    pub fn new() -> Self {
3554        std::default::Default::default()
3555    }
3556
3557    /// Sets the value of [name][crate::model::AuthzExtension::name].
3558    ///
3559    /// # Example
3560    /// ```ignore,no_run
3561    /// # use google_cloud_networkservices_v1::model::AuthzExtension;
3562    /// let x = AuthzExtension::new().set_name("example");
3563    /// ```
3564    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3565        self.name = v.into();
3566        self
3567    }
3568
3569    /// Sets the value of [create_time][crate::model::AuthzExtension::create_time].
3570    ///
3571    /// # Example
3572    /// ```ignore,no_run
3573    /// # use google_cloud_networkservices_v1::model::AuthzExtension;
3574    /// use wkt::Timestamp;
3575    /// let x = AuthzExtension::new().set_create_time(Timestamp::default()/* use setters */);
3576    /// ```
3577    pub fn set_create_time<T>(mut self, v: T) -> Self
3578    where
3579        T: std::convert::Into<wkt::Timestamp>,
3580    {
3581        self.create_time = std::option::Option::Some(v.into());
3582        self
3583    }
3584
3585    /// Sets or clears the value of [create_time][crate::model::AuthzExtension::create_time].
3586    ///
3587    /// # Example
3588    /// ```ignore,no_run
3589    /// # use google_cloud_networkservices_v1::model::AuthzExtension;
3590    /// use wkt::Timestamp;
3591    /// let x = AuthzExtension::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3592    /// let x = AuthzExtension::new().set_or_clear_create_time(None::<Timestamp>);
3593    /// ```
3594    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3595    where
3596        T: std::convert::Into<wkt::Timestamp>,
3597    {
3598        self.create_time = v.map(|x| x.into());
3599        self
3600    }
3601
3602    /// Sets the value of [update_time][crate::model::AuthzExtension::update_time].
3603    ///
3604    /// # Example
3605    /// ```ignore,no_run
3606    /// # use google_cloud_networkservices_v1::model::AuthzExtension;
3607    /// use wkt::Timestamp;
3608    /// let x = AuthzExtension::new().set_update_time(Timestamp::default()/* use setters */);
3609    /// ```
3610    pub fn set_update_time<T>(mut self, v: T) -> Self
3611    where
3612        T: std::convert::Into<wkt::Timestamp>,
3613    {
3614        self.update_time = std::option::Option::Some(v.into());
3615        self
3616    }
3617
3618    /// Sets or clears the value of [update_time][crate::model::AuthzExtension::update_time].
3619    ///
3620    /// # Example
3621    /// ```ignore,no_run
3622    /// # use google_cloud_networkservices_v1::model::AuthzExtension;
3623    /// use wkt::Timestamp;
3624    /// let x = AuthzExtension::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
3625    /// let x = AuthzExtension::new().set_or_clear_update_time(None::<Timestamp>);
3626    /// ```
3627    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3628    where
3629        T: std::convert::Into<wkt::Timestamp>,
3630    {
3631        self.update_time = v.map(|x| x.into());
3632        self
3633    }
3634
3635    /// Sets the value of [description][crate::model::AuthzExtension::description].
3636    ///
3637    /// # Example
3638    /// ```ignore,no_run
3639    /// # use google_cloud_networkservices_v1::model::AuthzExtension;
3640    /// let x = AuthzExtension::new().set_description("example");
3641    /// ```
3642    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3643        self.description = v.into();
3644        self
3645    }
3646
3647    /// Sets the value of [labels][crate::model::AuthzExtension::labels].
3648    ///
3649    /// # Example
3650    /// ```ignore,no_run
3651    /// # use google_cloud_networkservices_v1::model::AuthzExtension;
3652    /// let x = AuthzExtension::new().set_labels([
3653    ///     ("key0", "abc"),
3654    ///     ("key1", "xyz"),
3655    /// ]);
3656    /// ```
3657    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3658    where
3659        T: std::iter::IntoIterator<Item = (K, V)>,
3660        K: std::convert::Into<std::string::String>,
3661        V: std::convert::Into<std::string::String>,
3662    {
3663        use std::iter::Iterator;
3664        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3665        self
3666    }
3667
3668    /// Sets the value of [load_balancing_scheme][crate::model::AuthzExtension::load_balancing_scheme].
3669    ///
3670    /// # Example
3671    /// ```ignore,no_run
3672    /// # use google_cloud_networkservices_v1::model::AuthzExtension;
3673    /// use google_cloud_networkservices_v1::model::LoadBalancingScheme;
3674    /// let x0 = AuthzExtension::new().set_load_balancing_scheme(LoadBalancingScheme::InternalManaged);
3675    /// let x1 = AuthzExtension::new().set_load_balancing_scheme(LoadBalancingScheme::ExternalManaged);
3676    /// ```
3677    pub fn set_load_balancing_scheme<T: std::convert::Into<crate::model::LoadBalancingScheme>>(
3678        mut self,
3679        v: T,
3680    ) -> Self {
3681        self.load_balancing_scheme = v.into();
3682        self
3683    }
3684
3685    /// Sets the value of [authority][crate::model::AuthzExtension::authority].
3686    ///
3687    /// # Example
3688    /// ```ignore,no_run
3689    /// # use google_cloud_networkservices_v1::model::AuthzExtension;
3690    /// let x = AuthzExtension::new().set_authority("example");
3691    /// ```
3692    pub fn set_authority<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3693        self.authority = v.into();
3694        self
3695    }
3696
3697    /// Sets the value of [service][crate::model::AuthzExtension::service].
3698    ///
3699    /// # Example
3700    /// ```ignore,no_run
3701    /// # use google_cloud_networkservices_v1::model::AuthzExtension;
3702    /// let x = AuthzExtension::new().set_service("example");
3703    /// ```
3704    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3705        self.service = v.into();
3706        self
3707    }
3708
3709    /// Sets the value of [timeout][crate::model::AuthzExtension::timeout].
3710    ///
3711    /// # Example
3712    /// ```ignore,no_run
3713    /// # use google_cloud_networkservices_v1::model::AuthzExtension;
3714    /// use wkt::Duration;
3715    /// let x = AuthzExtension::new().set_timeout(Duration::default()/* use setters */);
3716    /// ```
3717    pub fn set_timeout<T>(mut self, v: T) -> Self
3718    where
3719        T: std::convert::Into<wkt::Duration>,
3720    {
3721        self.timeout = std::option::Option::Some(v.into());
3722        self
3723    }
3724
3725    /// Sets or clears the value of [timeout][crate::model::AuthzExtension::timeout].
3726    ///
3727    /// # Example
3728    /// ```ignore,no_run
3729    /// # use google_cloud_networkservices_v1::model::AuthzExtension;
3730    /// use wkt::Duration;
3731    /// let x = AuthzExtension::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
3732    /// let x = AuthzExtension::new().set_or_clear_timeout(None::<Duration>);
3733    /// ```
3734    pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3735    where
3736        T: std::convert::Into<wkt::Duration>,
3737    {
3738        self.timeout = v.map(|x| x.into());
3739        self
3740    }
3741
3742    /// Sets the value of [fail_open][crate::model::AuthzExtension::fail_open].
3743    ///
3744    /// # Example
3745    /// ```ignore,no_run
3746    /// # use google_cloud_networkservices_v1::model::AuthzExtension;
3747    /// let x = AuthzExtension::new().set_fail_open(true);
3748    /// ```
3749    pub fn set_fail_open<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3750        self.fail_open = v.into();
3751        self
3752    }
3753
3754    /// Sets the value of [metadata][crate::model::AuthzExtension::metadata].
3755    ///
3756    /// # Example
3757    /// ```ignore,no_run
3758    /// # use google_cloud_networkservices_v1::model::AuthzExtension;
3759    /// use wkt::Struct;
3760    /// let x = AuthzExtension::new().set_metadata(Struct::default()/* use setters */);
3761    /// ```
3762    pub fn set_metadata<T>(mut self, v: T) -> Self
3763    where
3764        T: std::convert::Into<wkt::Struct>,
3765    {
3766        self.metadata = std::option::Option::Some(v.into());
3767        self
3768    }
3769
3770    /// Sets or clears the value of [metadata][crate::model::AuthzExtension::metadata].
3771    ///
3772    /// # Example
3773    /// ```ignore,no_run
3774    /// # use google_cloud_networkservices_v1::model::AuthzExtension;
3775    /// use wkt::Struct;
3776    /// let x = AuthzExtension::new().set_or_clear_metadata(Some(Struct::default()/* use setters */));
3777    /// let x = AuthzExtension::new().set_or_clear_metadata(None::<Struct>);
3778    /// ```
3779    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
3780    where
3781        T: std::convert::Into<wkt::Struct>,
3782    {
3783        self.metadata = v.map(|x| x.into());
3784        self
3785    }
3786
3787    /// Sets the value of [forward_headers][crate::model::AuthzExtension::forward_headers].
3788    ///
3789    /// # Example
3790    /// ```ignore,no_run
3791    /// # use google_cloud_networkservices_v1::model::AuthzExtension;
3792    /// let x = AuthzExtension::new().set_forward_headers(["a", "b", "c"]);
3793    /// ```
3794    pub fn set_forward_headers<T, V>(mut self, v: T) -> Self
3795    where
3796        T: std::iter::IntoIterator<Item = V>,
3797        V: std::convert::Into<std::string::String>,
3798    {
3799        use std::iter::Iterator;
3800        self.forward_headers = v.into_iter().map(|i| i.into()).collect();
3801        self
3802    }
3803
3804    /// Sets the value of [wire_format][crate::model::AuthzExtension::wire_format].
3805    ///
3806    /// # Example
3807    /// ```ignore,no_run
3808    /// # use google_cloud_networkservices_v1::model::AuthzExtension;
3809    /// use google_cloud_networkservices_v1::model::WireFormat;
3810    /// let x0 = AuthzExtension::new().set_wire_format(WireFormat::ExtProcGrpc);
3811    /// ```
3812    pub fn set_wire_format<T: std::convert::Into<crate::model::WireFormat>>(
3813        mut self,
3814        v: T,
3815    ) -> Self {
3816        self.wire_format = v.into();
3817        self
3818    }
3819}
3820
3821impl wkt::message::Message for AuthzExtension {
3822    fn typename() -> &'static str {
3823        "type.googleapis.com/google.cloud.networkservices.v1.AuthzExtension"
3824    }
3825}
3826
3827/// Message for requesting list of `AuthzExtension` resources.
3828#[derive(Clone, Default, PartialEq)]
3829#[non_exhaustive]
3830pub struct ListAuthzExtensionsRequest {
3831    /// Required. The project and location from which the `AuthzExtension`
3832    /// resources are listed. These values are specified in the following format:
3833    /// `projects/{project}/locations/{location}`.
3834    pub parent: std::string::String,
3835
3836    /// Optional. Requested page size. The server might return fewer items than
3837    /// requested. If unspecified, the server picks an appropriate default.
3838    pub page_size: i32,
3839
3840    /// Optional. A token identifying a page of results that the server returns.
3841    pub page_token: std::string::String,
3842
3843    /// Optional. Filtering results.
3844    pub filter: std::string::String,
3845
3846    /// Optional. Hint about how to order the results.
3847    pub order_by: std::string::String,
3848
3849    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3850}
3851
3852impl ListAuthzExtensionsRequest {
3853    pub fn new() -> Self {
3854        std::default::Default::default()
3855    }
3856
3857    /// Sets the value of [parent][crate::model::ListAuthzExtensionsRequest::parent].
3858    ///
3859    /// # Example
3860    /// ```ignore,no_run
3861    /// # use google_cloud_networkservices_v1::model::ListAuthzExtensionsRequest;
3862    /// let x = ListAuthzExtensionsRequest::new().set_parent("example");
3863    /// ```
3864    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3865        self.parent = v.into();
3866        self
3867    }
3868
3869    /// Sets the value of [page_size][crate::model::ListAuthzExtensionsRequest::page_size].
3870    ///
3871    /// # Example
3872    /// ```ignore,no_run
3873    /// # use google_cloud_networkservices_v1::model::ListAuthzExtensionsRequest;
3874    /// let x = ListAuthzExtensionsRequest::new().set_page_size(42);
3875    /// ```
3876    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3877        self.page_size = v.into();
3878        self
3879    }
3880
3881    /// Sets the value of [page_token][crate::model::ListAuthzExtensionsRequest::page_token].
3882    ///
3883    /// # Example
3884    /// ```ignore,no_run
3885    /// # use google_cloud_networkservices_v1::model::ListAuthzExtensionsRequest;
3886    /// let x = ListAuthzExtensionsRequest::new().set_page_token("example");
3887    /// ```
3888    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3889        self.page_token = v.into();
3890        self
3891    }
3892
3893    /// Sets the value of [filter][crate::model::ListAuthzExtensionsRequest::filter].
3894    ///
3895    /// # Example
3896    /// ```ignore,no_run
3897    /// # use google_cloud_networkservices_v1::model::ListAuthzExtensionsRequest;
3898    /// let x = ListAuthzExtensionsRequest::new().set_filter("example");
3899    /// ```
3900    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3901        self.filter = v.into();
3902        self
3903    }
3904
3905    /// Sets the value of [order_by][crate::model::ListAuthzExtensionsRequest::order_by].
3906    ///
3907    /// # Example
3908    /// ```ignore,no_run
3909    /// # use google_cloud_networkservices_v1::model::ListAuthzExtensionsRequest;
3910    /// let x = ListAuthzExtensionsRequest::new().set_order_by("example");
3911    /// ```
3912    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3913        self.order_by = v.into();
3914        self
3915    }
3916}
3917
3918impl wkt::message::Message for ListAuthzExtensionsRequest {
3919    fn typename() -> &'static str {
3920        "type.googleapis.com/google.cloud.networkservices.v1.ListAuthzExtensionsRequest"
3921    }
3922}
3923
3924/// Message for response to listing `AuthzExtension` resources.
3925#[derive(Clone, Default, PartialEq)]
3926#[non_exhaustive]
3927pub struct ListAuthzExtensionsResponse {
3928    /// The list of `AuthzExtension` resources.
3929    pub authz_extensions: std::vec::Vec<crate::model::AuthzExtension>,
3930
3931    /// A token identifying a page of results that the server returns.
3932    pub next_page_token: std::string::String,
3933
3934    /// Locations that could not be reached.
3935    pub unreachable: std::vec::Vec<std::string::String>,
3936
3937    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3938}
3939
3940impl ListAuthzExtensionsResponse {
3941    pub fn new() -> Self {
3942        std::default::Default::default()
3943    }
3944
3945    /// Sets the value of [authz_extensions][crate::model::ListAuthzExtensionsResponse::authz_extensions].
3946    ///
3947    /// # Example
3948    /// ```ignore,no_run
3949    /// # use google_cloud_networkservices_v1::model::ListAuthzExtensionsResponse;
3950    /// use google_cloud_networkservices_v1::model::AuthzExtension;
3951    /// let x = ListAuthzExtensionsResponse::new()
3952    ///     .set_authz_extensions([
3953    ///         AuthzExtension::default()/* use setters */,
3954    ///         AuthzExtension::default()/* use (different) setters */,
3955    ///     ]);
3956    /// ```
3957    pub fn set_authz_extensions<T, V>(mut self, v: T) -> Self
3958    where
3959        T: std::iter::IntoIterator<Item = V>,
3960        V: std::convert::Into<crate::model::AuthzExtension>,
3961    {
3962        use std::iter::Iterator;
3963        self.authz_extensions = v.into_iter().map(|i| i.into()).collect();
3964        self
3965    }
3966
3967    /// Sets the value of [next_page_token][crate::model::ListAuthzExtensionsResponse::next_page_token].
3968    ///
3969    /// # Example
3970    /// ```ignore,no_run
3971    /// # use google_cloud_networkservices_v1::model::ListAuthzExtensionsResponse;
3972    /// let x = ListAuthzExtensionsResponse::new().set_next_page_token("example");
3973    /// ```
3974    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3975        self.next_page_token = v.into();
3976        self
3977    }
3978
3979    /// Sets the value of [unreachable][crate::model::ListAuthzExtensionsResponse::unreachable].
3980    ///
3981    /// # Example
3982    /// ```ignore,no_run
3983    /// # use google_cloud_networkservices_v1::model::ListAuthzExtensionsResponse;
3984    /// let x = ListAuthzExtensionsResponse::new().set_unreachable(["a", "b", "c"]);
3985    /// ```
3986    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
3987    where
3988        T: std::iter::IntoIterator<Item = V>,
3989        V: std::convert::Into<std::string::String>,
3990    {
3991        use std::iter::Iterator;
3992        self.unreachable = v.into_iter().map(|i| i.into()).collect();
3993        self
3994    }
3995}
3996
3997impl wkt::message::Message for ListAuthzExtensionsResponse {
3998    fn typename() -> &'static str {
3999        "type.googleapis.com/google.cloud.networkservices.v1.ListAuthzExtensionsResponse"
4000    }
4001}
4002
4003#[doc(hidden)]
4004impl google_cloud_gax::paginator::internal::PageableResponse for ListAuthzExtensionsResponse {
4005    type PageItem = crate::model::AuthzExtension;
4006
4007    fn items(self) -> std::vec::Vec<Self::PageItem> {
4008        self.authz_extensions
4009    }
4010
4011    fn next_page_token(&self) -> std::string::String {
4012        use std::clone::Clone;
4013        self.next_page_token.clone()
4014    }
4015}
4016
4017/// Message for getting a `AuthzExtension` resource.
4018#[derive(Clone, Default, PartialEq)]
4019#[non_exhaustive]
4020pub struct GetAuthzExtensionRequest {
4021    /// Required. A name of the `AuthzExtension` resource to get. Must be in
4022    /// the format
4023    /// `projects/{project}/locations/{location}/authzExtensions/{authz_extension}`.
4024    pub name: std::string::String,
4025
4026    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4027}
4028
4029impl GetAuthzExtensionRequest {
4030    pub fn new() -> Self {
4031        std::default::Default::default()
4032    }
4033
4034    /// Sets the value of [name][crate::model::GetAuthzExtensionRequest::name].
4035    ///
4036    /// # Example
4037    /// ```ignore,no_run
4038    /// # use google_cloud_networkservices_v1::model::GetAuthzExtensionRequest;
4039    /// let x = GetAuthzExtensionRequest::new().set_name("example");
4040    /// ```
4041    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4042        self.name = v.into();
4043        self
4044    }
4045}
4046
4047impl wkt::message::Message for GetAuthzExtensionRequest {
4048    fn typename() -> &'static str {
4049        "type.googleapis.com/google.cloud.networkservices.v1.GetAuthzExtensionRequest"
4050    }
4051}
4052
4053/// Message for creating a `AuthzExtension` resource.
4054#[derive(Clone, Default, PartialEq)]
4055#[non_exhaustive]
4056pub struct CreateAuthzExtensionRequest {
4057    /// Required. The parent resource of the `AuthzExtension` resource. Must
4058    /// be in the format `projects/{project}/locations/{location}`.
4059    pub parent: std::string::String,
4060
4061    /// Required. User-provided ID of the `AuthzExtension` resource to be
4062    /// created.
4063    pub authz_extension_id: std::string::String,
4064
4065    /// Required. `AuthzExtension` resource to be created.
4066    pub authz_extension: std::option::Option<crate::model::AuthzExtension>,
4067
4068    /// Optional. An optional request ID to identify requests. Specify a unique
4069    /// request ID so that if you must retry your request, the server can ignore
4070    /// the request if it has already been completed. The server guarantees
4071    /// that for 60 minutes since the first request.
4072    ///
4073    /// For example, consider a situation where you make an initial request and the
4074    /// request times out. If you make the request again with the same request
4075    /// ID, the server ignores the second request This prevents
4076    /// clients from accidentally creating duplicate commitments.
4077    ///
4078    /// The request ID must be a valid UUID with the exception that zero UUID is
4079    /// not supported (00000000-0000-0000-0000-000000000000).
4080    pub request_id: std::string::String,
4081
4082    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4083}
4084
4085impl CreateAuthzExtensionRequest {
4086    pub fn new() -> Self {
4087        std::default::Default::default()
4088    }
4089
4090    /// Sets the value of [parent][crate::model::CreateAuthzExtensionRequest::parent].
4091    ///
4092    /// # Example
4093    /// ```ignore,no_run
4094    /// # use google_cloud_networkservices_v1::model::CreateAuthzExtensionRequest;
4095    /// let x = CreateAuthzExtensionRequest::new().set_parent("example");
4096    /// ```
4097    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4098        self.parent = v.into();
4099        self
4100    }
4101
4102    /// Sets the value of [authz_extension_id][crate::model::CreateAuthzExtensionRequest::authz_extension_id].
4103    ///
4104    /// # Example
4105    /// ```ignore,no_run
4106    /// # use google_cloud_networkservices_v1::model::CreateAuthzExtensionRequest;
4107    /// let x = CreateAuthzExtensionRequest::new().set_authz_extension_id("example");
4108    /// ```
4109    pub fn set_authz_extension_id<T: std::convert::Into<std::string::String>>(
4110        mut self,
4111        v: T,
4112    ) -> Self {
4113        self.authz_extension_id = v.into();
4114        self
4115    }
4116
4117    /// Sets the value of [authz_extension][crate::model::CreateAuthzExtensionRequest::authz_extension].
4118    ///
4119    /// # Example
4120    /// ```ignore,no_run
4121    /// # use google_cloud_networkservices_v1::model::CreateAuthzExtensionRequest;
4122    /// use google_cloud_networkservices_v1::model::AuthzExtension;
4123    /// let x = CreateAuthzExtensionRequest::new().set_authz_extension(AuthzExtension::default()/* use setters */);
4124    /// ```
4125    pub fn set_authz_extension<T>(mut self, v: T) -> Self
4126    where
4127        T: std::convert::Into<crate::model::AuthzExtension>,
4128    {
4129        self.authz_extension = std::option::Option::Some(v.into());
4130        self
4131    }
4132
4133    /// Sets or clears the value of [authz_extension][crate::model::CreateAuthzExtensionRequest::authz_extension].
4134    ///
4135    /// # Example
4136    /// ```ignore,no_run
4137    /// # use google_cloud_networkservices_v1::model::CreateAuthzExtensionRequest;
4138    /// use google_cloud_networkservices_v1::model::AuthzExtension;
4139    /// let x = CreateAuthzExtensionRequest::new().set_or_clear_authz_extension(Some(AuthzExtension::default()/* use setters */));
4140    /// let x = CreateAuthzExtensionRequest::new().set_or_clear_authz_extension(None::<AuthzExtension>);
4141    /// ```
4142    pub fn set_or_clear_authz_extension<T>(mut self, v: std::option::Option<T>) -> Self
4143    where
4144        T: std::convert::Into<crate::model::AuthzExtension>,
4145    {
4146        self.authz_extension = v.map(|x| x.into());
4147        self
4148    }
4149
4150    /// Sets the value of [request_id][crate::model::CreateAuthzExtensionRequest::request_id].
4151    ///
4152    /// # Example
4153    /// ```ignore,no_run
4154    /// # use google_cloud_networkservices_v1::model::CreateAuthzExtensionRequest;
4155    /// let x = CreateAuthzExtensionRequest::new().set_request_id("example");
4156    /// ```
4157    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4158        self.request_id = v.into();
4159        self
4160    }
4161}
4162
4163impl wkt::message::Message for CreateAuthzExtensionRequest {
4164    fn typename() -> &'static str {
4165        "type.googleapis.com/google.cloud.networkservices.v1.CreateAuthzExtensionRequest"
4166    }
4167}
4168
4169/// Message for updating a `AuthzExtension` resource.
4170#[derive(Clone, Default, PartialEq)]
4171#[non_exhaustive]
4172pub struct UpdateAuthzExtensionRequest {
4173    /// Required. Used to specify the fields to be overwritten in the
4174    /// `AuthzExtension` resource by the update.
4175    /// The fields specified in the `update_mask` are relative to the resource, not
4176    /// the full request. A field is overwritten if it is in the mask. If the
4177    /// user does not specify a mask, then all fields are overwritten.
4178    pub update_mask: std::option::Option<wkt::FieldMask>,
4179
4180    /// Required. `AuthzExtension` resource being updated.
4181    pub authz_extension: std::option::Option<crate::model::AuthzExtension>,
4182
4183    /// Optional. An optional request ID to identify requests. Specify a unique
4184    /// request ID so that if you must retry your request, the server can ignore
4185    /// the request if it has already been completed. The server guarantees
4186    /// that for 60 minutes since the first request.
4187    ///
4188    /// For example, consider a situation where you make an initial request and the
4189    /// request times out. If you make the request again with the same request
4190    /// ID, the server ignores the second request This prevents
4191    /// clients from accidentally creating duplicate commitments.
4192    ///
4193    /// The request ID must be a valid UUID with the exception that zero UUID is
4194    /// not supported (00000000-0000-0000-0000-000000000000).
4195    pub request_id: std::string::String,
4196
4197    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4198}
4199
4200impl UpdateAuthzExtensionRequest {
4201    pub fn new() -> Self {
4202        std::default::Default::default()
4203    }
4204
4205    /// Sets the value of [update_mask][crate::model::UpdateAuthzExtensionRequest::update_mask].
4206    ///
4207    /// # Example
4208    /// ```ignore,no_run
4209    /// # use google_cloud_networkservices_v1::model::UpdateAuthzExtensionRequest;
4210    /// use wkt::FieldMask;
4211    /// let x = UpdateAuthzExtensionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4212    /// ```
4213    pub fn set_update_mask<T>(mut self, v: T) -> Self
4214    where
4215        T: std::convert::Into<wkt::FieldMask>,
4216    {
4217        self.update_mask = std::option::Option::Some(v.into());
4218        self
4219    }
4220
4221    /// Sets or clears the value of [update_mask][crate::model::UpdateAuthzExtensionRequest::update_mask].
4222    ///
4223    /// # Example
4224    /// ```ignore,no_run
4225    /// # use google_cloud_networkservices_v1::model::UpdateAuthzExtensionRequest;
4226    /// use wkt::FieldMask;
4227    /// let x = UpdateAuthzExtensionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4228    /// let x = UpdateAuthzExtensionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4229    /// ```
4230    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4231    where
4232        T: std::convert::Into<wkt::FieldMask>,
4233    {
4234        self.update_mask = v.map(|x| x.into());
4235        self
4236    }
4237
4238    /// Sets the value of [authz_extension][crate::model::UpdateAuthzExtensionRequest::authz_extension].
4239    ///
4240    /// # Example
4241    /// ```ignore,no_run
4242    /// # use google_cloud_networkservices_v1::model::UpdateAuthzExtensionRequest;
4243    /// use google_cloud_networkservices_v1::model::AuthzExtension;
4244    /// let x = UpdateAuthzExtensionRequest::new().set_authz_extension(AuthzExtension::default()/* use setters */);
4245    /// ```
4246    pub fn set_authz_extension<T>(mut self, v: T) -> Self
4247    where
4248        T: std::convert::Into<crate::model::AuthzExtension>,
4249    {
4250        self.authz_extension = std::option::Option::Some(v.into());
4251        self
4252    }
4253
4254    /// Sets or clears the value of [authz_extension][crate::model::UpdateAuthzExtensionRequest::authz_extension].
4255    ///
4256    /// # Example
4257    /// ```ignore,no_run
4258    /// # use google_cloud_networkservices_v1::model::UpdateAuthzExtensionRequest;
4259    /// use google_cloud_networkservices_v1::model::AuthzExtension;
4260    /// let x = UpdateAuthzExtensionRequest::new().set_or_clear_authz_extension(Some(AuthzExtension::default()/* use setters */));
4261    /// let x = UpdateAuthzExtensionRequest::new().set_or_clear_authz_extension(None::<AuthzExtension>);
4262    /// ```
4263    pub fn set_or_clear_authz_extension<T>(mut self, v: std::option::Option<T>) -> Self
4264    where
4265        T: std::convert::Into<crate::model::AuthzExtension>,
4266    {
4267        self.authz_extension = v.map(|x| x.into());
4268        self
4269    }
4270
4271    /// Sets the value of [request_id][crate::model::UpdateAuthzExtensionRequest::request_id].
4272    ///
4273    /// # Example
4274    /// ```ignore,no_run
4275    /// # use google_cloud_networkservices_v1::model::UpdateAuthzExtensionRequest;
4276    /// let x = UpdateAuthzExtensionRequest::new().set_request_id("example");
4277    /// ```
4278    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4279        self.request_id = v.into();
4280        self
4281    }
4282}
4283
4284impl wkt::message::Message for UpdateAuthzExtensionRequest {
4285    fn typename() -> &'static str {
4286        "type.googleapis.com/google.cloud.networkservices.v1.UpdateAuthzExtensionRequest"
4287    }
4288}
4289
4290/// Message for deleting a `AuthzExtension` resource.
4291#[derive(Clone, Default, PartialEq)]
4292#[non_exhaustive]
4293pub struct DeleteAuthzExtensionRequest {
4294    /// Required. The name of the `AuthzExtension` resource to delete. Must
4295    /// be in the format
4296    /// `projects/{project}/locations/{location}/authzExtensions/{authz_extension}`.
4297    pub name: std::string::String,
4298
4299    /// Optional. An optional request ID to identify requests. Specify a unique
4300    /// request ID so that if you must retry your request, the server can ignore
4301    /// the request if it has already been completed. The server guarantees
4302    /// that for 60 minutes after the first request.
4303    ///
4304    /// For example, consider a situation where you make an initial request and the
4305    /// request times out. If you make the request again with the same request
4306    /// ID, the server ignores the second request This prevents
4307    /// clients from accidentally creating duplicate commitments.
4308    ///
4309    /// The request ID must be a valid UUID with the exception that zero UUID is
4310    /// not supported (00000000-0000-0000-0000-000000000000).
4311    pub request_id: std::string::String,
4312
4313    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4314}
4315
4316impl DeleteAuthzExtensionRequest {
4317    pub fn new() -> Self {
4318        std::default::Default::default()
4319    }
4320
4321    /// Sets the value of [name][crate::model::DeleteAuthzExtensionRequest::name].
4322    ///
4323    /// # Example
4324    /// ```ignore,no_run
4325    /// # use google_cloud_networkservices_v1::model::DeleteAuthzExtensionRequest;
4326    /// let x = DeleteAuthzExtensionRequest::new().set_name("example");
4327    /// ```
4328    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4329        self.name = v.into();
4330        self
4331    }
4332
4333    /// Sets the value of [request_id][crate::model::DeleteAuthzExtensionRequest::request_id].
4334    ///
4335    /// # Example
4336    /// ```ignore,no_run
4337    /// # use google_cloud_networkservices_v1::model::DeleteAuthzExtensionRequest;
4338    /// let x = DeleteAuthzExtensionRequest::new().set_request_id("example");
4339    /// ```
4340    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4341        self.request_id = v.into();
4342        self
4343    }
4344}
4345
4346impl wkt::message::Message for DeleteAuthzExtensionRequest {
4347    fn typename() -> &'static str {
4348        "type.googleapis.com/google.cloud.networkservices.v1.DeleteAuthzExtensionRequest"
4349    }
4350}
4351
4352/// EndpointPolicy is a resource that helps apply desired configuration
4353/// on the endpoints that match specific criteria.
4354/// For example, this resource can be used to apply "authentication config"
4355/// an all endpoints that serve on port 8080.
4356#[derive(Clone, Default, PartialEq)]
4357#[non_exhaustive]
4358pub struct EndpointPolicy {
4359    /// Identifier. Name of the EndpointPolicy resource. It matches pattern
4360    /// `projects/{project}/locations/global/endpointPolicies/{endpoint_policy}`.
4361    pub name: std::string::String,
4362
4363    /// Output only. The timestamp when the resource was created.
4364    pub create_time: std::option::Option<wkt::Timestamp>,
4365
4366    /// Output only. The timestamp when the resource was updated.
4367    pub update_time: std::option::Option<wkt::Timestamp>,
4368
4369    /// Optional. Set of label tags associated with the EndpointPolicy resource.
4370    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
4371
4372    /// Required. The type of endpoint policy. This is primarily used to validate
4373    /// the configuration.
4374    pub r#type: crate::model::endpoint_policy::EndpointPolicyType,
4375
4376    /// Optional. This field specifies the URL of AuthorizationPolicy resource that
4377    /// applies authorization policies to the inbound traffic at the
4378    /// matched endpoints. Refer to Authorization. If this field is not
4379    /// specified, authorization is disabled(no authz checks) for this
4380    /// endpoint.
4381    pub authorization_policy: std::string::String,
4382
4383    /// Required. A matcher that selects endpoints to which the policies should be
4384    /// applied.
4385    pub endpoint_matcher: std::option::Option<crate::model::EndpointMatcher>,
4386
4387    /// Optional. Port selector for the (matched) endpoints. If no port selector is
4388    /// provided, the matched config is applied to all ports.
4389    pub traffic_port_selector: std::option::Option<crate::model::TrafficPortSelector>,
4390
4391    /// Optional. A free-text description of the resource. Max length 1024
4392    /// characters.
4393    pub description: std::string::String,
4394
4395    /// Optional. A URL referring to ServerTlsPolicy resource. ServerTlsPolicy is
4396    /// used to determine the authentication policy to be applied to terminate the
4397    /// inbound traffic at the identified backends. If this field is not set,
4398    /// authentication is disabled(open) for this endpoint.
4399    pub server_tls_policy: std::string::String,
4400
4401    /// Optional. A URL referring to a ClientTlsPolicy resource. ClientTlsPolicy
4402    /// can be set to specify the authentication for traffic from the proxy to the
4403    /// actual endpoints. More specifically, it is applied to the outgoing traffic
4404    /// from the proxy to the endpoint. This is typically used for sidecar model
4405    /// where the proxy identifies itself as endpoint to the control plane, with
4406    /// the connection between sidecar and endpoint requiring authentication. If
4407    /// this field is not set, authentication is disabled(open). Applicable only
4408    /// when EndpointPolicyType is SIDECAR_PROXY.
4409    pub client_tls_policy: std::string::String,
4410
4411    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4412}
4413
4414impl EndpointPolicy {
4415    pub fn new() -> Self {
4416        std::default::Default::default()
4417    }
4418
4419    /// Sets the value of [name][crate::model::EndpointPolicy::name].
4420    ///
4421    /// # Example
4422    /// ```ignore,no_run
4423    /// # use google_cloud_networkservices_v1::model::EndpointPolicy;
4424    /// let x = EndpointPolicy::new().set_name("example");
4425    /// ```
4426    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4427        self.name = v.into();
4428        self
4429    }
4430
4431    /// Sets the value of [create_time][crate::model::EndpointPolicy::create_time].
4432    ///
4433    /// # Example
4434    /// ```ignore,no_run
4435    /// # use google_cloud_networkservices_v1::model::EndpointPolicy;
4436    /// use wkt::Timestamp;
4437    /// let x = EndpointPolicy::new().set_create_time(Timestamp::default()/* use setters */);
4438    /// ```
4439    pub fn set_create_time<T>(mut self, v: T) -> Self
4440    where
4441        T: std::convert::Into<wkt::Timestamp>,
4442    {
4443        self.create_time = std::option::Option::Some(v.into());
4444        self
4445    }
4446
4447    /// Sets or clears the value of [create_time][crate::model::EndpointPolicy::create_time].
4448    ///
4449    /// # Example
4450    /// ```ignore,no_run
4451    /// # use google_cloud_networkservices_v1::model::EndpointPolicy;
4452    /// use wkt::Timestamp;
4453    /// let x = EndpointPolicy::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4454    /// let x = EndpointPolicy::new().set_or_clear_create_time(None::<Timestamp>);
4455    /// ```
4456    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4457    where
4458        T: std::convert::Into<wkt::Timestamp>,
4459    {
4460        self.create_time = v.map(|x| x.into());
4461        self
4462    }
4463
4464    /// Sets the value of [update_time][crate::model::EndpointPolicy::update_time].
4465    ///
4466    /// # Example
4467    /// ```ignore,no_run
4468    /// # use google_cloud_networkservices_v1::model::EndpointPolicy;
4469    /// use wkt::Timestamp;
4470    /// let x = EndpointPolicy::new().set_update_time(Timestamp::default()/* use setters */);
4471    /// ```
4472    pub fn set_update_time<T>(mut self, v: T) -> Self
4473    where
4474        T: std::convert::Into<wkt::Timestamp>,
4475    {
4476        self.update_time = std::option::Option::Some(v.into());
4477        self
4478    }
4479
4480    /// Sets or clears the value of [update_time][crate::model::EndpointPolicy::update_time].
4481    ///
4482    /// # Example
4483    /// ```ignore,no_run
4484    /// # use google_cloud_networkservices_v1::model::EndpointPolicy;
4485    /// use wkt::Timestamp;
4486    /// let x = EndpointPolicy::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
4487    /// let x = EndpointPolicy::new().set_or_clear_update_time(None::<Timestamp>);
4488    /// ```
4489    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
4490    where
4491        T: std::convert::Into<wkt::Timestamp>,
4492    {
4493        self.update_time = v.map(|x| x.into());
4494        self
4495    }
4496
4497    /// Sets the value of [labels][crate::model::EndpointPolicy::labels].
4498    ///
4499    /// # Example
4500    /// ```ignore,no_run
4501    /// # use google_cloud_networkservices_v1::model::EndpointPolicy;
4502    /// let x = EndpointPolicy::new().set_labels([
4503    ///     ("key0", "abc"),
4504    ///     ("key1", "xyz"),
4505    /// ]);
4506    /// ```
4507    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
4508    where
4509        T: std::iter::IntoIterator<Item = (K, V)>,
4510        K: std::convert::Into<std::string::String>,
4511        V: std::convert::Into<std::string::String>,
4512    {
4513        use std::iter::Iterator;
4514        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4515        self
4516    }
4517
4518    /// Sets the value of [r#type][crate::model::EndpointPolicy::type].
4519    ///
4520    /// # Example
4521    /// ```ignore,no_run
4522    /// # use google_cloud_networkservices_v1::model::EndpointPolicy;
4523    /// use google_cloud_networkservices_v1::model::endpoint_policy::EndpointPolicyType;
4524    /// let x0 = EndpointPolicy::new().set_type(EndpointPolicyType::SidecarProxy);
4525    /// let x1 = EndpointPolicy::new().set_type(EndpointPolicyType::GrpcServer);
4526    /// ```
4527    pub fn set_type<T: std::convert::Into<crate::model::endpoint_policy::EndpointPolicyType>>(
4528        mut self,
4529        v: T,
4530    ) -> Self {
4531        self.r#type = v.into();
4532        self
4533    }
4534
4535    /// Sets the value of [authorization_policy][crate::model::EndpointPolicy::authorization_policy].
4536    ///
4537    /// # Example
4538    /// ```ignore,no_run
4539    /// # use google_cloud_networkservices_v1::model::EndpointPolicy;
4540    /// let x = EndpointPolicy::new().set_authorization_policy("example");
4541    /// ```
4542    pub fn set_authorization_policy<T: std::convert::Into<std::string::String>>(
4543        mut self,
4544        v: T,
4545    ) -> Self {
4546        self.authorization_policy = v.into();
4547        self
4548    }
4549
4550    /// Sets the value of [endpoint_matcher][crate::model::EndpointPolicy::endpoint_matcher].
4551    ///
4552    /// # Example
4553    /// ```ignore,no_run
4554    /// # use google_cloud_networkservices_v1::model::EndpointPolicy;
4555    /// use google_cloud_networkservices_v1::model::EndpointMatcher;
4556    /// let x = EndpointPolicy::new().set_endpoint_matcher(EndpointMatcher::default()/* use setters */);
4557    /// ```
4558    pub fn set_endpoint_matcher<T>(mut self, v: T) -> Self
4559    where
4560        T: std::convert::Into<crate::model::EndpointMatcher>,
4561    {
4562        self.endpoint_matcher = std::option::Option::Some(v.into());
4563        self
4564    }
4565
4566    /// Sets or clears the value of [endpoint_matcher][crate::model::EndpointPolicy::endpoint_matcher].
4567    ///
4568    /// # Example
4569    /// ```ignore,no_run
4570    /// # use google_cloud_networkservices_v1::model::EndpointPolicy;
4571    /// use google_cloud_networkservices_v1::model::EndpointMatcher;
4572    /// let x = EndpointPolicy::new().set_or_clear_endpoint_matcher(Some(EndpointMatcher::default()/* use setters */));
4573    /// let x = EndpointPolicy::new().set_or_clear_endpoint_matcher(None::<EndpointMatcher>);
4574    /// ```
4575    pub fn set_or_clear_endpoint_matcher<T>(mut self, v: std::option::Option<T>) -> Self
4576    where
4577        T: std::convert::Into<crate::model::EndpointMatcher>,
4578    {
4579        self.endpoint_matcher = v.map(|x| x.into());
4580        self
4581    }
4582
4583    /// Sets the value of [traffic_port_selector][crate::model::EndpointPolicy::traffic_port_selector].
4584    ///
4585    /// # Example
4586    /// ```ignore,no_run
4587    /// # use google_cloud_networkservices_v1::model::EndpointPolicy;
4588    /// use google_cloud_networkservices_v1::model::TrafficPortSelector;
4589    /// let x = EndpointPolicy::new().set_traffic_port_selector(TrafficPortSelector::default()/* use setters */);
4590    /// ```
4591    pub fn set_traffic_port_selector<T>(mut self, v: T) -> Self
4592    where
4593        T: std::convert::Into<crate::model::TrafficPortSelector>,
4594    {
4595        self.traffic_port_selector = std::option::Option::Some(v.into());
4596        self
4597    }
4598
4599    /// Sets or clears the value of [traffic_port_selector][crate::model::EndpointPolicy::traffic_port_selector].
4600    ///
4601    /// # Example
4602    /// ```ignore,no_run
4603    /// # use google_cloud_networkservices_v1::model::EndpointPolicy;
4604    /// use google_cloud_networkservices_v1::model::TrafficPortSelector;
4605    /// let x = EndpointPolicy::new().set_or_clear_traffic_port_selector(Some(TrafficPortSelector::default()/* use setters */));
4606    /// let x = EndpointPolicy::new().set_or_clear_traffic_port_selector(None::<TrafficPortSelector>);
4607    /// ```
4608    pub fn set_or_clear_traffic_port_selector<T>(mut self, v: std::option::Option<T>) -> Self
4609    where
4610        T: std::convert::Into<crate::model::TrafficPortSelector>,
4611    {
4612        self.traffic_port_selector = v.map(|x| x.into());
4613        self
4614    }
4615
4616    /// Sets the value of [description][crate::model::EndpointPolicy::description].
4617    ///
4618    /// # Example
4619    /// ```ignore,no_run
4620    /// # use google_cloud_networkservices_v1::model::EndpointPolicy;
4621    /// let x = EndpointPolicy::new().set_description("example");
4622    /// ```
4623    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4624        self.description = v.into();
4625        self
4626    }
4627
4628    /// Sets the value of [server_tls_policy][crate::model::EndpointPolicy::server_tls_policy].
4629    ///
4630    /// # Example
4631    /// ```ignore,no_run
4632    /// # use google_cloud_networkservices_v1::model::EndpointPolicy;
4633    /// let x = EndpointPolicy::new().set_server_tls_policy("example");
4634    /// ```
4635    pub fn set_server_tls_policy<T: std::convert::Into<std::string::String>>(
4636        mut self,
4637        v: T,
4638    ) -> Self {
4639        self.server_tls_policy = v.into();
4640        self
4641    }
4642
4643    /// Sets the value of [client_tls_policy][crate::model::EndpointPolicy::client_tls_policy].
4644    ///
4645    /// # Example
4646    /// ```ignore,no_run
4647    /// # use google_cloud_networkservices_v1::model::EndpointPolicy;
4648    /// let x = EndpointPolicy::new().set_client_tls_policy("example");
4649    /// ```
4650    pub fn set_client_tls_policy<T: std::convert::Into<std::string::String>>(
4651        mut self,
4652        v: T,
4653    ) -> Self {
4654        self.client_tls_policy = v.into();
4655        self
4656    }
4657}
4658
4659impl wkt::message::Message for EndpointPolicy {
4660    fn typename() -> &'static str {
4661        "type.googleapis.com/google.cloud.networkservices.v1.EndpointPolicy"
4662    }
4663}
4664
4665/// Defines additional types related to [EndpointPolicy].
4666pub mod endpoint_policy {
4667    #[allow(unused_imports)]
4668    use super::*;
4669
4670    /// The type of endpoint policy.
4671    ///
4672    /// # Working with unknown values
4673    ///
4674    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4675    /// additional enum variants at any time. Adding new variants is not considered
4676    /// a breaking change. Applications should write their code in anticipation of:
4677    ///
4678    /// - New values appearing in future releases of the client library, **and**
4679    /// - New values received dynamically, without application changes.
4680    ///
4681    /// Please consult the [Working with enums] section in the user guide for some
4682    /// guidelines.
4683    ///
4684    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4685    #[derive(Clone, Debug, PartialEq)]
4686    #[non_exhaustive]
4687    pub enum EndpointPolicyType {
4688        /// Default value. Must not be used.
4689        Unspecified,
4690        /// Represents a proxy deployed as a sidecar.
4691        SidecarProxy,
4692        /// Represents a proxyless gRPC backend.
4693        GrpcServer,
4694        /// If set, the enum was initialized with an unknown value.
4695        ///
4696        /// Applications can examine the value using [EndpointPolicyType::value] or
4697        /// [EndpointPolicyType::name].
4698        UnknownValue(endpoint_policy_type::UnknownValue),
4699    }
4700
4701    #[doc(hidden)]
4702    pub mod endpoint_policy_type {
4703        #[allow(unused_imports)]
4704        use super::*;
4705        #[derive(Clone, Debug, PartialEq)]
4706        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4707    }
4708
4709    impl EndpointPolicyType {
4710        /// Gets the enum value.
4711        ///
4712        /// Returns `None` if the enum contains an unknown value deserialized from
4713        /// the string representation of enums.
4714        pub fn value(&self) -> std::option::Option<i32> {
4715            match self {
4716                Self::Unspecified => std::option::Option::Some(0),
4717                Self::SidecarProxy => std::option::Option::Some(1),
4718                Self::GrpcServer => std::option::Option::Some(2),
4719                Self::UnknownValue(u) => u.0.value(),
4720            }
4721        }
4722
4723        /// Gets the enum value as a string.
4724        ///
4725        /// Returns `None` if the enum contains an unknown value deserialized from
4726        /// the integer representation of enums.
4727        pub fn name(&self) -> std::option::Option<&str> {
4728            match self {
4729                Self::Unspecified => std::option::Option::Some("ENDPOINT_POLICY_TYPE_UNSPECIFIED"),
4730                Self::SidecarProxy => std::option::Option::Some("SIDECAR_PROXY"),
4731                Self::GrpcServer => std::option::Option::Some("GRPC_SERVER"),
4732                Self::UnknownValue(u) => u.0.name(),
4733            }
4734        }
4735    }
4736
4737    impl std::default::Default for EndpointPolicyType {
4738        fn default() -> Self {
4739            use std::convert::From;
4740            Self::from(0)
4741        }
4742    }
4743
4744    impl std::fmt::Display for EndpointPolicyType {
4745        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4746            wkt::internal::display_enum(f, self.name(), self.value())
4747        }
4748    }
4749
4750    impl std::convert::From<i32> for EndpointPolicyType {
4751        fn from(value: i32) -> Self {
4752            match value {
4753                0 => Self::Unspecified,
4754                1 => Self::SidecarProxy,
4755                2 => Self::GrpcServer,
4756                _ => Self::UnknownValue(endpoint_policy_type::UnknownValue(
4757                    wkt::internal::UnknownEnumValue::Integer(value),
4758                )),
4759            }
4760        }
4761    }
4762
4763    impl std::convert::From<&str> for EndpointPolicyType {
4764        fn from(value: &str) -> Self {
4765            use std::string::ToString;
4766            match value {
4767                "ENDPOINT_POLICY_TYPE_UNSPECIFIED" => Self::Unspecified,
4768                "SIDECAR_PROXY" => Self::SidecarProxy,
4769                "GRPC_SERVER" => Self::GrpcServer,
4770                _ => Self::UnknownValue(endpoint_policy_type::UnknownValue(
4771                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4772                )),
4773            }
4774        }
4775    }
4776
4777    impl serde::ser::Serialize for EndpointPolicyType {
4778        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4779        where
4780            S: serde::Serializer,
4781        {
4782            match self {
4783                Self::Unspecified => serializer.serialize_i32(0),
4784                Self::SidecarProxy => serializer.serialize_i32(1),
4785                Self::GrpcServer => serializer.serialize_i32(2),
4786                Self::UnknownValue(u) => u.0.serialize(serializer),
4787            }
4788        }
4789    }
4790
4791    impl<'de> serde::de::Deserialize<'de> for EndpointPolicyType {
4792        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4793        where
4794            D: serde::Deserializer<'de>,
4795        {
4796            deserializer.deserialize_any(wkt::internal::EnumVisitor::<EndpointPolicyType>::new(
4797                ".google.cloud.networkservices.v1.EndpointPolicy.EndpointPolicyType",
4798            ))
4799        }
4800    }
4801}
4802
4803/// Request used with the ListEndpointPolicies method.
4804#[derive(Clone, Default, PartialEq)]
4805#[non_exhaustive]
4806pub struct ListEndpointPoliciesRequest {
4807    /// Required. The project and location from which the EndpointPolicies should
4808    /// be listed, specified in the format `projects/*/locations/global`.
4809    pub parent: std::string::String,
4810
4811    /// Maximum number of EndpointPolicies to return per call.
4812    pub page_size: i32,
4813
4814    /// The value returned by the last `ListEndpointPoliciesResponse`
4815    /// Indicates that this is a continuation of a prior
4816    /// `ListEndpointPolicies` call, and that the system should return the
4817    /// next page of data.
4818    pub page_token: std::string::String,
4819
4820    /// Optional. If true, allow partial responses for multi-regional Aggregated
4821    /// List requests. Otherwise if one of the locations is down or unreachable,
4822    /// the Aggregated List request will fail.
4823    pub return_partial_success: bool,
4824
4825    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4826}
4827
4828impl ListEndpointPoliciesRequest {
4829    pub fn new() -> Self {
4830        std::default::Default::default()
4831    }
4832
4833    /// Sets the value of [parent][crate::model::ListEndpointPoliciesRequest::parent].
4834    ///
4835    /// # Example
4836    /// ```ignore,no_run
4837    /// # use google_cloud_networkservices_v1::model::ListEndpointPoliciesRequest;
4838    /// let x = ListEndpointPoliciesRequest::new().set_parent("example");
4839    /// ```
4840    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4841        self.parent = v.into();
4842        self
4843    }
4844
4845    /// Sets the value of [page_size][crate::model::ListEndpointPoliciesRequest::page_size].
4846    ///
4847    /// # Example
4848    /// ```ignore,no_run
4849    /// # use google_cloud_networkservices_v1::model::ListEndpointPoliciesRequest;
4850    /// let x = ListEndpointPoliciesRequest::new().set_page_size(42);
4851    /// ```
4852    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4853        self.page_size = v.into();
4854        self
4855    }
4856
4857    /// Sets the value of [page_token][crate::model::ListEndpointPoliciesRequest::page_token].
4858    ///
4859    /// # Example
4860    /// ```ignore,no_run
4861    /// # use google_cloud_networkservices_v1::model::ListEndpointPoliciesRequest;
4862    /// let x = ListEndpointPoliciesRequest::new().set_page_token("example");
4863    /// ```
4864    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4865        self.page_token = v.into();
4866        self
4867    }
4868
4869    /// Sets the value of [return_partial_success][crate::model::ListEndpointPoliciesRequest::return_partial_success].
4870    ///
4871    /// # Example
4872    /// ```ignore,no_run
4873    /// # use google_cloud_networkservices_v1::model::ListEndpointPoliciesRequest;
4874    /// let x = ListEndpointPoliciesRequest::new().set_return_partial_success(true);
4875    /// ```
4876    pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4877        self.return_partial_success = v.into();
4878        self
4879    }
4880}
4881
4882impl wkt::message::Message for ListEndpointPoliciesRequest {
4883    fn typename() -> &'static str {
4884        "type.googleapis.com/google.cloud.networkservices.v1.ListEndpointPoliciesRequest"
4885    }
4886}
4887
4888/// Response returned by the ListEndpointPolicies method.
4889#[derive(Clone, Default, PartialEq)]
4890#[non_exhaustive]
4891pub struct ListEndpointPoliciesResponse {
4892    /// List of EndpointPolicy resources.
4893    pub endpoint_policies: std::vec::Vec<crate::model::EndpointPolicy>,
4894
4895    /// If there might be more results than those appearing in this response, then
4896    /// `next_page_token` is included. To get the next set of results, call this
4897    /// method again using the value of `next_page_token` as `page_token`.
4898    pub next_page_token: std::string::String,
4899
4900    /// Unreachable resources. Populated when the request opts into
4901    /// [return_partial_success][google.cloud.networkservices.v1.ListEndpointPoliciesRequest.return_partial_success]
4902    /// and reading across collections e.g. when
4903    /// attempting to list all resources across all supported locations.
4904    ///
4905    /// [google.cloud.networkservices.v1.ListEndpointPoliciesRequest.return_partial_success]: crate::model::ListEndpointPoliciesRequest::return_partial_success
4906    pub unreachable: std::vec::Vec<std::string::String>,
4907
4908    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4909}
4910
4911impl ListEndpointPoliciesResponse {
4912    pub fn new() -> Self {
4913        std::default::Default::default()
4914    }
4915
4916    /// Sets the value of [endpoint_policies][crate::model::ListEndpointPoliciesResponse::endpoint_policies].
4917    ///
4918    /// # Example
4919    /// ```ignore,no_run
4920    /// # use google_cloud_networkservices_v1::model::ListEndpointPoliciesResponse;
4921    /// use google_cloud_networkservices_v1::model::EndpointPolicy;
4922    /// let x = ListEndpointPoliciesResponse::new()
4923    ///     .set_endpoint_policies([
4924    ///         EndpointPolicy::default()/* use setters */,
4925    ///         EndpointPolicy::default()/* use (different) setters */,
4926    ///     ]);
4927    /// ```
4928    pub fn set_endpoint_policies<T, V>(mut self, v: T) -> Self
4929    where
4930        T: std::iter::IntoIterator<Item = V>,
4931        V: std::convert::Into<crate::model::EndpointPolicy>,
4932    {
4933        use std::iter::Iterator;
4934        self.endpoint_policies = v.into_iter().map(|i| i.into()).collect();
4935        self
4936    }
4937
4938    /// Sets the value of [next_page_token][crate::model::ListEndpointPoliciesResponse::next_page_token].
4939    ///
4940    /// # Example
4941    /// ```ignore,no_run
4942    /// # use google_cloud_networkservices_v1::model::ListEndpointPoliciesResponse;
4943    /// let x = ListEndpointPoliciesResponse::new().set_next_page_token("example");
4944    /// ```
4945    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4946        self.next_page_token = v.into();
4947        self
4948    }
4949
4950    /// Sets the value of [unreachable][crate::model::ListEndpointPoliciesResponse::unreachable].
4951    ///
4952    /// # Example
4953    /// ```ignore,no_run
4954    /// # use google_cloud_networkservices_v1::model::ListEndpointPoliciesResponse;
4955    /// let x = ListEndpointPoliciesResponse::new().set_unreachable(["a", "b", "c"]);
4956    /// ```
4957    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
4958    where
4959        T: std::iter::IntoIterator<Item = V>,
4960        V: std::convert::Into<std::string::String>,
4961    {
4962        use std::iter::Iterator;
4963        self.unreachable = v.into_iter().map(|i| i.into()).collect();
4964        self
4965    }
4966}
4967
4968impl wkt::message::Message for ListEndpointPoliciesResponse {
4969    fn typename() -> &'static str {
4970        "type.googleapis.com/google.cloud.networkservices.v1.ListEndpointPoliciesResponse"
4971    }
4972}
4973
4974#[doc(hidden)]
4975impl google_cloud_gax::paginator::internal::PageableResponse for ListEndpointPoliciesResponse {
4976    type PageItem = crate::model::EndpointPolicy;
4977
4978    fn items(self) -> std::vec::Vec<Self::PageItem> {
4979        self.endpoint_policies
4980    }
4981
4982    fn next_page_token(&self) -> std::string::String {
4983        use std::clone::Clone;
4984        self.next_page_token.clone()
4985    }
4986}
4987
4988/// Request used with the GetEndpointPolicy method.
4989#[derive(Clone, Default, PartialEq)]
4990#[non_exhaustive]
4991pub struct GetEndpointPolicyRequest {
4992    /// Required. A name of the EndpointPolicy to get. Must be in the format
4993    /// `projects/*/locations/global/endpointPolicies/*`.
4994    pub name: std::string::String,
4995
4996    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4997}
4998
4999impl GetEndpointPolicyRequest {
5000    pub fn new() -> Self {
5001        std::default::Default::default()
5002    }
5003
5004    /// Sets the value of [name][crate::model::GetEndpointPolicyRequest::name].
5005    ///
5006    /// # Example
5007    /// ```ignore,no_run
5008    /// # use google_cloud_networkservices_v1::model::GetEndpointPolicyRequest;
5009    /// let x = GetEndpointPolicyRequest::new().set_name("example");
5010    /// ```
5011    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5012        self.name = v.into();
5013        self
5014    }
5015}
5016
5017impl wkt::message::Message for GetEndpointPolicyRequest {
5018    fn typename() -> &'static str {
5019        "type.googleapis.com/google.cloud.networkservices.v1.GetEndpointPolicyRequest"
5020    }
5021}
5022
5023/// Request used with the CreateEndpointPolicy method.
5024#[derive(Clone, Default, PartialEq)]
5025#[non_exhaustive]
5026pub struct CreateEndpointPolicyRequest {
5027    /// Required. The parent resource of the EndpointPolicy. Must be in the
5028    /// format `projects/*/locations/global`.
5029    pub parent: std::string::String,
5030
5031    /// Required. Short name of the EndpointPolicy resource to be created.
5032    /// E.g. "CustomECS".
5033    pub endpoint_policy_id: std::string::String,
5034
5035    /// Required. EndpointPolicy resource to be created.
5036    pub endpoint_policy: std::option::Option<crate::model::EndpointPolicy>,
5037
5038    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5039}
5040
5041impl CreateEndpointPolicyRequest {
5042    pub fn new() -> Self {
5043        std::default::Default::default()
5044    }
5045
5046    /// Sets the value of [parent][crate::model::CreateEndpointPolicyRequest::parent].
5047    ///
5048    /// # Example
5049    /// ```ignore,no_run
5050    /// # use google_cloud_networkservices_v1::model::CreateEndpointPolicyRequest;
5051    /// let x = CreateEndpointPolicyRequest::new().set_parent("example");
5052    /// ```
5053    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5054        self.parent = v.into();
5055        self
5056    }
5057
5058    /// Sets the value of [endpoint_policy_id][crate::model::CreateEndpointPolicyRequest::endpoint_policy_id].
5059    ///
5060    /// # Example
5061    /// ```ignore,no_run
5062    /// # use google_cloud_networkservices_v1::model::CreateEndpointPolicyRequest;
5063    /// let x = CreateEndpointPolicyRequest::new().set_endpoint_policy_id("example");
5064    /// ```
5065    pub fn set_endpoint_policy_id<T: std::convert::Into<std::string::String>>(
5066        mut self,
5067        v: T,
5068    ) -> Self {
5069        self.endpoint_policy_id = v.into();
5070        self
5071    }
5072
5073    /// Sets the value of [endpoint_policy][crate::model::CreateEndpointPolicyRequest::endpoint_policy].
5074    ///
5075    /// # Example
5076    /// ```ignore,no_run
5077    /// # use google_cloud_networkservices_v1::model::CreateEndpointPolicyRequest;
5078    /// use google_cloud_networkservices_v1::model::EndpointPolicy;
5079    /// let x = CreateEndpointPolicyRequest::new().set_endpoint_policy(EndpointPolicy::default()/* use setters */);
5080    /// ```
5081    pub fn set_endpoint_policy<T>(mut self, v: T) -> Self
5082    where
5083        T: std::convert::Into<crate::model::EndpointPolicy>,
5084    {
5085        self.endpoint_policy = std::option::Option::Some(v.into());
5086        self
5087    }
5088
5089    /// Sets or clears the value of [endpoint_policy][crate::model::CreateEndpointPolicyRequest::endpoint_policy].
5090    ///
5091    /// # Example
5092    /// ```ignore,no_run
5093    /// # use google_cloud_networkservices_v1::model::CreateEndpointPolicyRequest;
5094    /// use google_cloud_networkservices_v1::model::EndpointPolicy;
5095    /// let x = CreateEndpointPolicyRequest::new().set_or_clear_endpoint_policy(Some(EndpointPolicy::default()/* use setters */));
5096    /// let x = CreateEndpointPolicyRequest::new().set_or_clear_endpoint_policy(None::<EndpointPolicy>);
5097    /// ```
5098    pub fn set_or_clear_endpoint_policy<T>(mut self, v: std::option::Option<T>) -> Self
5099    where
5100        T: std::convert::Into<crate::model::EndpointPolicy>,
5101    {
5102        self.endpoint_policy = v.map(|x| x.into());
5103        self
5104    }
5105}
5106
5107impl wkt::message::Message for CreateEndpointPolicyRequest {
5108    fn typename() -> &'static str {
5109        "type.googleapis.com/google.cloud.networkservices.v1.CreateEndpointPolicyRequest"
5110    }
5111}
5112
5113/// Request used with the UpdateEndpointPolicy method.
5114#[derive(Clone, Default, PartialEq)]
5115#[non_exhaustive]
5116pub struct UpdateEndpointPolicyRequest {
5117    /// Optional. Field mask is used to specify the fields to be overwritten in the
5118    /// EndpointPolicy resource by the update.
5119    /// The fields specified in the update_mask are relative to the resource, not
5120    /// the full request. A field will be overwritten if it is in the mask. If the
5121    /// user does not provide a mask then all fields will be overwritten.
5122    pub update_mask: std::option::Option<wkt::FieldMask>,
5123
5124    /// Required. Updated EndpointPolicy resource.
5125    pub endpoint_policy: std::option::Option<crate::model::EndpointPolicy>,
5126
5127    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5128}
5129
5130impl UpdateEndpointPolicyRequest {
5131    pub fn new() -> Self {
5132        std::default::Default::default()
5133    }
5134
5135    /// Sets the value of [update_mask][crate::model::UpdateEndpointPolicyRequest::update_mask].
5136    ///
5137    /// # Example
5138    /// ```ignore,no_run
5139    /// # use google_cloud_networkservices_v1::model::UpdateEndpointPolicyRequest;
5140    /// use wkt::FieldMask;
5141    /// let x = UpdateEndpointPolicyRequest::new().set_update_mask(FieldMask::default()/* use setters */);
5142    /// ```
5143    pub fn set_update_mask<T>(mut self, v: T) -> Self
5144    where
5145        T: std::convert::Into<wkt::FieldMask>,
5146    {
5147        self.update_mask = std::option::Option::Some(v.into());
5148        self
5149    }
5150
5151    /// Sets or clears the value of [update_mask][crate::model::UpdateEndpointPolicyRequest::update_mask].
5152    ///
5153    /// # Example
5154    /// ```ignore,no_run
5155    /// # use google_cloud_networkservices_v1::model::UpdateEndpointPolicyRequest;
5156    /// use wkt::FieldMask;
5157    /// let x = UpdateEndpointPolicyRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
5158    /// let x = UpdateEndpointPolicyRequest::new().set_or_clear_update_mask(None::<FieldMask>);
5159    /// ```
5160    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5161    where
5162        T: std::convert::Into<wkt::FieldMask>,
5163    {
5164        self.update_mask = v.map(|x| x.into());
5165        self
5166    }
5167
5168    /// Sets the value of [endpoint_policy][crate::model::UpdateEndpointPolicyRequest::endpoint_policy].
5169    ///
5170    /// # Example
5171    /// ```ignore,no_run
5172    /// # use google_cloud_networkservices_v1::model::UpdateEndpointPolicyRequest;
5173    /// use google_cloud_networkservices_v1::model::EndpointPolicy;
5174    /// let x = UpdateEndpointPolicyRequest::new().set_endpoint_policy(EndpointPolicy::default()/* use setters */);
5175    /// ```
5176    pub fn set_endpoint_policy<T>(mut self, v: T) -> Self
5177    where
5178        T: std::convert::Into<crate::model::EndpointPolicy>,
5179    {
5180        self.endpoint_policy = std::option::Option::Some(v.into());
5181        self
5182    }
5183
5184    /// Sets or clears the value of [endpoint_policy][crate::model::UpdateEndpointPolicyRequest::endpoint_policy].
5185    ///
5186    /// # Example
5187    /// ```ignore,no_run
5188    /// # use google_cloud_networkservices_v1::model::UpdateEndpointPolicyRequest;
5189    /// use google_cloud_networkservices_v1::model::EndpointPolicy;
5190    /// let x = UpdateEndpointPolicyRequest::new().set_or_clear_endpoint_policy(Some(EndpointPolicy::default()/* use setters */));
5191    /// let x = UpdateEndpointPolicyRequest::new().set_or_clear_endpoint_policy(None::<EndpointPolicy>);
5192    /// ```
5193    pub fn set_or_clear_endpoint_policy<T>(mut self, v: std::option::Option<T>) -> Self
5194    where
5195        T: std::convert::Into<crate::model::EndpointPolicy>,
5196    {
5197        self.endpoint_policy = v.map(|x| x.into());
5198        self
5199    }
5200}
5201
5202impl wkt::message::Message for UpdateEndpointPolicyRequest {
5203    fn typename() -> &'static str {
5204        "type.googleapis.com/google.cloud.networkservices.v1.UpdateEndpointPolicyRequest"
5205    }
5206}
5207
5208/// Request used with the DeleteEndpointPolicy method.
5209#[derive(Clone, Default, PartialEq)]
5210#[non_exhaustive]
5211pub struct DeleteEndpointPolicyRequest {
5212    /// Required. A name of the EndpointPolicy to delete. Must be in the format
5213    /// `projects/*/locations/global/endpointPolicies/*`.
5214    pub name: std::string::String,
5215
5216    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5217}
5218
5219impl DeleteEndpointPolicyRequest {
5220    pub fn new() -> Self {
5221        std::default::Default::default()
5222    }
5223
5224    /// Sets the value of [name][crate::model::DeleteEndpointPolicyRequest::name].
5225    ///
5226    /// # Example
5227    /// ```ignore,no_run
5228    /// # use google_cloud_networkservices_v1::model::DeleteEndpointPolicyRequest;
5229    /// let x = DeleteEndpointPolicyRequest::new().set_name("example");
5230    /// ```
5231    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5232        self.name = v.into();
5233        self
5234    }
5235}
5236
5237impl wkt::message::Message for DeleteEndpointPolicyRequest {
5238    fn typename() -> &'static str {
5239        "type.googleapis.com/google.cloud.networkservices.v1.DeleteEndpointPolicyRequest"
5240    }
5241}
5242
5243/// `WasmPlugin` is a resource representing a service executing
5244/// a customer-provided Wasm module.
5245#[derive(Clone, Default, PartialEq)]
5246#[non_exhaustive]
5247pub struct WasmPlugin {
5248    /// Identifier. Name of the `WasmPlugin` resource in the following format:
5249    /// `projects/{project}/locations/{location}/wasmPlugins/{wasm_plugin}`.
5250    pub name: std::string::String,
5251
5252    /// Output only. The timestamp when the resource was created.
5253    pub create_time: std::option::Option<wkt::Timestamp>,
5254
5255    /// Output only. The timestamp when the resource was updated.
5256    pub update_time: std::option::Option<wkt::Timestamp>,
5257
5258    /// Optional. A human-readable description of the resource.
5259    pub description: std::string::String,
5260
5261    /// Optional. Set of labels associated with the `WasmPlugin` resource.
5262    ///
5263    /// The format must comply with [the following
5264    /// requirements](/compute/docs/labeling-resources#requirements).
5265    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
5266
5267    /// Optional. The ID of the `WasmPluginVersion` resource that is the
5268    /// currently serving one. The version referred to must be a child of this
5269    /// `WasmPlugin` resource.
5270    pub main_version_id: std::string::String,
5271
5272    /// Optional. Specifies the logging options for the activity performed by this
5273    /// plugin. If logging is enabled, plugin logs are exported to
5274    /// Cloud Logging.
5275    /// Note that the settings relate to the logs generated by using
5276    /// logging statements in your Wasm code.
5277    pub log_config: std::option::Option<crate::model::wasm_plugin::LogConfig>,
5278
5279    /// Optional. All versions of this `WasmPlugin` resource in the key-value
5280    /// format. The key is the resource ID, and the value is the `VersionDetails`
5281    /// object.
5282    ///
5283    /// Lets you create or update a `WasmPlugin` resource and its versions in a
5284    /// single request. When the `main_version_id` field is not empty, it must
5285    /// point to one of the `VersionDetails` objects in the map.
5286    ///
5287    /// If provided in a `PATCH` request, the new versions replace the
5288    /// previous set. Any version omitted from the `versions` field is removed.
5289    /// Because the `WasmPluginVersion` resource is immutable, if a
5290    /// `WasmPluginVersion` resource with the same name already exists and differs,
5291    /// the request fails.
5292    ///
5293    /// Note: In a `GET` request, this field is populated only if the field
5294    /// `GetWasmPluginRequest.view` is set to `WASM_PLUGIN_VIEW_FULL`.
5295    pub versions:
5296        std::collections::HashMap<std::string::String, crate::model::wasm_plugin::VersionDetails>,
5297
5298    /// Output only. List of all
5299    /// [extensions](https://cloud.google.com/service-extensions/docs/overview)
5300    /// that use this `WasmPlugin` resource.
5301    pub used_by: std::vec::Vec<crate::model::wasm_plugin::UsedBy>,
5302
5303    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5304}
5305
5306impl WasmPlugin {
5307    pub fn new() -> Self {
5308        std::default::Default::default()
5309    }
5310
5311    /// Sets the value of [name][crate::model::WasmPlugin::name].
5312    ///
5313    /// # Example
5314    /// ```ignore,no_run
5315    /// # use google_cloud_networkservices_v1::model::WasmPlugin;
5316    /// let x = WasmPlugin::new().set_name("example");
5317    /// ```
5318    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5319        self.name = v.into();
5320        self
5321    }
5322
5323    /// Sets the value of [create_time][crate::model::WasmPlugin::create_time].
5324    ///
5325    /// # Example
5326    /// ```ignore,no_run
5327    /// # use google_cloud_networkservices_v1::model::WasmPlugin;
5328    /// use wkt::Timestamp;
5329    /// let x = WasmPlugin::new().set_create_time(Timestamp::default()/* use setters */);
5330    /// ```
5331    pub fn set_create_time<T>(mut self, v: T) -> Self
5332    where
5333        T: std::convert::Into<wkt::Timestamp>,
5334    {
5335        self.create_time = std::option::Option::Some(v.into());
5336        self
5337    }
5338
5339    /// Sets or clears the value of [create_time][crate::model::WasmPlugin::create_time].
5340    ///
5341    /// # Example
5342    /// ```ignore,no_run
5343    /// # use google_cloud_networkservices_v1::model::WasmPlugin;
5344    /// use wkt::Timestamp;
5345    /// let x = WasmPlugin::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5346    /// let x = WasmPlugin::new().set_or_clear_create_time(None::<Timestamp>);
5347    /// ```
5348    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5349    where
5350        T: std::convert::Into<wkt::Timestamp>,
5351    {
5352        self.create_time = v.map(|x| x.into());
5353        self
5354    }
5355
5356    /// Sets the value of [update_time][crate::model::WasmPlugin::update_time].
5357    ///
5358    /// # Example
5359    /// ```ignore,no_run
5360    /// # use google_cloud_networkservices_v1::model::WasmPlugin;
5361    /// use wkt::Timestamp;
5362    /// let x = WasmPlugin::new().set_update_time(Timestamp::default()/* use setters */);
5363    /// ```
5364    pub fn set_update_time<T>(mut self, v: T) -> Self
5365    where
5366        T: std::convert::Into<wkt::Timestamp>,
5367    {
5368        self.update_time = std::option::Option::Some(v.into());
5369        self
5370    }
5371
5372    /// Sets or clears the value of [update_time][crate::model::WasmPlugin::update_time].
5373    ///
5374    /// # Example
5375    /// ```ignore,no_run
5376    /// # use google_cloud_networkservices_v1::model::WasmPlugin;
5377    /// use wkt::Timestamp;
5378    /// let x = WasmPlugin::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5379    /// let x = WasmPlugin::new().set_or_clear_update_time(None::<Timestamp>);
5380    /// ```
5381    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5382    where
5383        T: std::convert::Into<wkt::Timestamp>,
5384    {
5385        self.update_time = v.map(|x| x.into());
5386        self
5387    }
5388
5389    /// Sets the value of [description][crate::model::WasmPlugin::description].
5390    ///
5391    /// # Example
5392    /// ```ignore,no_run
5393    /// # use google_cloud_networkservices_v1::model::WasmPlugin;
5394    /// let x = WasmPlugin::new().set_description("example");
5395    /// ```
5396    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5397        self.description = v.into();
5398        self
5399    }
5400
5401    /// Sets the value of [labels][crate::model::WasmPlugin::labels].
5402    ///
5403    /// # Example
5404    /// ```ignore,no_run
5405    /// # use google_cloud_networkservices_v1::model::WasmPlugin;
5406    /// let x = WasmPlugin::new().set_labels([
5407    ///     ("key0", "abc"),
5408    ///     ("key1", "xyz"),
5409    /// ]);
5410    /// ```
5411    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
5412    where
5413        T: std::iter::IntoIterator<Item = (K, V)>,
5414        K: std::convert::Into<std::string::String>,
5415        V: std::convert::Into<std::string::String>,
5416    {
5417        use std::iter::Iterator;
5418        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5419        self
5420    }
5421
5422    /// Sets the value of [main_version_id][crate::model::WasmPlugin::main_version_id].
5423    ///
5424    /// # Example
5425    /// ```ignore,no_run
5426    /// # use google_cloud_networkservices_v1::model::WasmPlugin;
5427    /// let x = WasmPlugin::new().set_main_version_id("example");
5428    /// ```
5429    pub fn set_main_version_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5430        self.main_version_id = v.into();
5431        self
5432    }
5433
5434    /// Sets the value of [log_config][crate::model::WasmPlugin::log_config].
5435    ///
5436    /// # Example
5437    /// ```ignore,no_run
5438    /// # use google_cloud_networkservices_v1::model::WasmPlugin;
5439    /// use google_cloud_networkservices_v1::model::wasm_plugin::LogConfig;
5440    /// let x = WasmPlugin::new().set_log_config(LogConfig::default()/* use setters */);
5441    /// ```
5442    pub fn set_log_config<T>(mut self, v: T) -> Self
5443    where
5444        T: std::convert::Into<crate::model::wasm_plugin::LogConfig>,
5445    {
5446        self.log_config = std::option::Option::Some(v.into());
5447        self
5448    }
5449
5450    /// Sets or clears the value of [log_config][crate::model::WasmPlugin::log_config].
5451    ///
5452    /// # Example
5453    /// ```ignore,no_run
5454    /// # use google_cloud_networkservices_v1::model::WasmPlugin;
5455    /// use google_cloud_networkservices_v1::model::wasm_plugin::LogConfig;
5456    /// let x = WasmPlugin::new().set_or_clear_log_config(Some(LogConfig::default()/* use setters */));
5457    /// let x = WasmPlugin::new().set_or_clear_log_config(None::<LogConfig>);
5458    /// ```
5459    pub fn set_or_clear_log_config<T>(mut self, v: std::option::Option<T>) -> Self
5460    where
5461        T: std::convert::Into<crate::model::wasm_plugin::LogConfig>,
5462    {
5463        self.log_config = v.map(|x| x.into());
5464        self
5465    }
5466
5467    /// Sets the value of [versions][crate::model::WasmPlugin::versions].
5468    ///
5469    /// # Example
5470    /// ```ignore,no_run
5471    /// # use google_cloud_networkservices_v1::model::WasmPlugin;
5472    /// use google_cloud_networkservices_v1::model::wasm_plugin::VersionDetails;
5473    /// let x = WasmPlugin::new().set_versions([
5474    ///     ("key0", VersionDetails::default()/* use setters */),
5475    ///     ("key1", VersionDetails::default()/* use (different) setters */),
5476    /// ]);
5477    /// ```
5478    pub fn set_versions<T, K, V>(mut self, v: T) -> Self
5479    where
5480        T: std::iter::IntoIterator<Item = (K, V)>,
5481        K: std::convert::Into<std::string::String>,
5482        V: std::convert::Into<crate::model::wasm_plugin::VersionDetails>,
5483    {
5484        use std::iter::Iterator;
5485        self.versions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5486        self
5487    }
5488
5489    /// Sets the value of [used_by][crate::model::WasmPlugin::used_by].
5490    ///
5491    /// # Example
5492    /// ```ignore,no_run
5493    /// # use google_cloud_networkservices_v1::model::WasmPlugin;
5494    /// use google_cloud_networkservices_v1::model::wasm_plugin::UsedBy;
5495    /// let x = WasmPlugin::new()
5496    ///     .set_used_by([
5497    ///         UsedBy::default()/* use setters */,
5498    ///         UsedBy::default()/* use (different) setters */,
5499    ///     ]);
5500    /// ```
5501    pub fn set_used_by<T, V>(mut self, v: T) -> Self
5502    where
5503        T: std::iter::IntoIterator<Item = V>,
5504        V: std::convert::Into<crate::model::wasm_plugin::UsedBy>,
5505    {
5506        use std::iter::Iterator;
5507        self.used_by = v.into_iter().map(|i| i.into()).collect();
5508        self
5509    }
5510}
5511
5512impl wkt::message::Message for WasmPlugin {
5513    fn typename() -> &'static str {
5514        "type.googleapis.com/google.cloud.networkservices.v1.WasmPlugin"
5515    }
5516}
5517
5518/// Defines additional types related to [WasmPlugin].
5519pub mod wasm_plugin {
5520    #[allow(unused_imports)]
5521    use super::*;
5522
5523    /// Details of a `WasmPluginVersion` resource to be inlined in the
5524    /// `WasmPlugin` resource.
5525    #[derive(Clone, Default, PartialEq)]
5526    #[non_exhaustive]
5527    pub struct VersionDetails {
5528        /// Output only. The timestamp when the resource was created.
5529        pub create_time: std::option::Option<wkt::Timestamp>,
5530
5531        /// Output only. The timestamp when the resource was updated.
5532        pub update_time: std::option::Option<wkt::Timestamp>,
5533
5534        /// Optional. A human-readable description of the resource.
5535        pub description: std::string::String,
5536
5537        /// Optional. Set of labels associated with the `WasmPluginVersion`
5538        /// resource.
5539        pub labels: std::collections::HashMap<std::string::String, std::string::String>,
5540
5541        /// Optional. URI of the container image containing the Wasm module, stored
5542        /// in the Artifact Registry. The container image must contain only a single
5543        /// file with the name `plugin.wasm`. When a new `WasmPluginVersion` resource
5544        /// is created, the URI gets resolved to an image digest and saved in the
5545        /// `image_digest` field.
5546        pub image_uri: std::string::String,
5547
5548        /// Output only. The resolved digest for the image specified in `image`.
5549        /// The digest is resolved during the creation of a
5550        /// `WasmPluginVersion` resource.
5551        /// This field holds the digest value regardless of whether a tag or
5552        /// digest was originally specified in the `image` field.
5553        pub image_digest: std::string::String,
5554
5555        /// Output only. This field holds the digest (usually checksum) value for the
5556        /// plugin configuration. The value is calculated based on the contents of
5557        /// the `plugin_config_data` field or the container image defined by the
5558        /// `plugin_config_uri` field.
5559        pub plugin_config_digest: std::string::String,
5560
5561        pub plugin_config_source:
5562            std::option::Option<crate::model::wasm_plugin::version_details::PluginConfigSource>,
5563
5564        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5565    }
5566
5567    impl VersionDetails {
5568        pub fn new() -> Self {
5569            std::default::Default::default()
5570        }
5571
5572        /// Sets the value of [create_time][crate::model::wasm_plugin::VersionDetails::create_time].
5573        ///
5574        /// # Example
5575        /// ```ignore,no_run
5576        /// # use google_cloud_networkservices_v1::model::wasm_plugin::VersionDetails;
5577        /// use wkt::Timestamp;
5578        /// let x = VersionDetails::new().set_create_time(Timestamp::default()/* use setters */);
5579        /// ```
5580        pub fn set_create_time<T>(mut self, v: T) -> Self
5581        where
5582            T: std::convert::Into<wkt::Timestamp>,
5583        {
5584            self.create_time = std::option::Option::Some(v.into());
5585            self
5586        }
5587
5588        /// Sets or clears the value of [create_time][crate::model::wasm_plugin::VersionDetails::create_time].
5589        ///
5590        /// # Example
5591        /// ```ignore,no_run
5592        /// # use google_cloud_networkservices_v1::model::wasm_plugin::VersionDetails;
5593        /// use wkt::Timestamp;
5594        /// let x = VersionDetails::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5595        /// let x = VersionDetails::new().set_or_clear_create_time(None::<Timestamp>);
5596        /// ```
5597        pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5598        where
5599            T: std::convert::Into<wkt::Timestamp>,
5600        {
5601            self.create_time = v.map(|x| x.into());
5602            self
5603        }
5604
5605        /// Sets the value of [update_time][crate::model::wasm_plugin::VersionDetails::update_time].
5606        ///
5607        /// # Example
5608        /// ```ignore,no_run
5609        /// # use google_cloud_networkservices_v1::model::wasm_plugin::VersionDetails;
5610        /// use wkt::Timestamp;
5611        /// let x = VersionDetails::new().set_update_time(Timestamp::default()/* use setters */);
5612        /// ```
5613        pub fn set_update_time<T>(mut self, v: T) -> Self
5614        where
5615            T: std::convert::Into<wkt::Timestamp>,
5616        {
5617            self.update_time = std::option::Option::Some(v.into());
5618            self
5619        }
5620
5621        /// Sets or clears the value of [update_time][crate::model::wasm_plugin::VersionDetails::update_time].
5622        ///
5623        /// # Example
5624        /// ```ignore,no_run
5625        /// # use google_cloud_networkservices_v1::model::wasm_plugin::VersionDetails;
5626        /// use wkt::Timestamp;
5627        /// let x = VersionDetails::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5628        /// let x = VersionDetails::new().set_or_clear_update_time(None::<Timestamp>);
5629        /// ```
5630        pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5631        where
5632            T: std::convert::Into<wkt::Timestamp>,
5633        {
5634            self.update_time = v.map(|x| x.into());
5635            self
5636        }
5637
5638        /// Sets the value of [description][crate::model::wasm_plugin::VersionDetails::description].
5639        ///
5640        /// # Example
5641        /// ```ignore,no_run
5642        /// # use google_cloud_networkservices_v1::model::wasm_plugin::VersionDetails;
5643        /// let x = VersionDetails::new().set_description("example");
5644        /// ```
5645        pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5646            self.description = v.into();
5647            self
5648        }
5649
5650        /// Sets the value of [labels][crate::model::wasm_plugin::VersionDetails::labels].
5651        ///
5652        /// # Example
5653        /// ```ignore,no_run
5654        /// # use google_cloud_networkservices_v1::model::wasm_plugin::VersionDetails;
5655        /// let x = VersionDetails::new().set_labels([
5656        ///     ("key0", "abc"),
5657        ///     ("key1", "xyz"),
5658        /// ]);
5659        /// ```
5660        pub fn set_labels<T, K, V>(mut self, v: T) -> Self
5661        where
5662            T: std::iter::IntoIterator<Item = (K, V)>,
5663            K: std::convert::Into<std::string::String>,
5664            V: std::convert::Into<std::string::String>,
5665        {
5666            use std::iter::Iterator;
5667            self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5668            self
5669        }
5670
5671        /// Sets the value of [image_uri][crate::model::wasm_plugin::VersionDetails::image_uri].
5672        ///
5673        /// # Example
5674        /// ```ignore,no_run
5675        /// # use google_cloud_networkservices_v1::model::wasm_plugin::VersionDetails;
5676        /// let x = VersionDetails::new().set_image_uri("example");
5677        /// ```
5678        pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5679            self.image_uri = v.into();
5680            self
5681        }
5682
5683        /// Sets the value of [image_digest][crate::model::wasm_plugin::VersionDetails::image_digest].
5684        ///
5685        /// # Example
5686        /// ```ignore,no_run
5687        /// # use google_cloud_networkservices_v1::model::wasm_plugin::VersionDetails;
5688        /// let x = VersionDetails::new().set_image_digest("example");
5689        /// ```
5690        pub fn set_image_digest<T: std::convert::Into<std::string::String>>(
5691            mut self,
5692            v: T,
5693        ) -> Self {
5694            self.image_digest = v.into();
5695            self
5696        }
5697
5698        /// Sets the value of [plugin_config_digest][crate::model::wasm_plugin::VersionDetails::plugin_config_digest].
5699        ///
5700        /// # Example
5701        /// ```ignore,no_run
5702        /// # use google_cloud_networkservices_v1::model::wasm_plugin::VersionDetails;
5703        /// let x = VersionDetails::new().set_plugin_config_digest("example");
5704        /// ```
5705        pub fn set_plugin_config_digest<T: std::convert::Into<std::string::String>>(
5706            mut self,
5707            v: T,
5708        ) -> Self {
5709            self.plugin_config_digest = v.into();
5710            self
5711        }
5712
5713        /// Sets the value of [plugin_config_source][crate::model::wasm_plugin::VersionDetails::plugin_config_source].
5714        ///
5715        /// Note that all the setters affecting `plugin_config_source` are mutually
5716        /// exclusive.
5717        ///
5718        /// # Example
5719        /// ```ignore,no_run
5720        /// # use google_cloud_networkservices_v1::model::wasm_plugin::VersionDetails;
5721        /// use google_cloud_networkservices_v1::model::wasm_plugin::version_details::PluginConfigSource;
5722        /// let x = VersionDetails::new().set_plugin_config_source(Some(PluginConfigSource::PluginConfigData(bytes::Bytes::from_static(b"example"))));
5723        /// ```
5724        pub fn set_plugin_config_source<
5725            T: std::convert::Into<
5726                    std::option::Option<
5727                        crate::model::wasm_plugin::version_details::PluginConfigSource,
5728                    >,
5729                >,
5730        >(
5731            mut self,
5732            v: T,
5733        ) -> Self {
5734            self.plugin_config_source = v.into();
5735            self
5736        }
5737
5738        /// The value of [plugin_config_source][crate::model::wasm_plugin::VersionDetails::plugin_config_source]
5739        /// if it holds a `PluginConfigData`, `None` if the field is not set or
5740        /// holds a different branch.
5741        pub fn plugin_config_data(&self) -> std::option::Option<&::bytes::Bytes> {
5742            #[allow(unreachable_patterns)]
5743            self.plugin_config_source.as_ref().and_then(|v| match v {
5744                crate::model::wasm_plugin::version_details::PluginConfigSource::PluginConfigData(v) => std::option::Option::Some(v),
5745                _ => std::option::Option::None,
5746            })
5747        }
5748
5749        /// Sets the value of [plugin_config_source][crate::model::wasm_plugin::VersionDetails::plugin_config_source]
5750        /// to hold a `PluginConfigData`.
5751        ///
5752        /// Note that all the setters affecting `plugin_config_source` are
5753        /// mutually exclusive.
5754        ///
5755        /// # Example
5756        /// ```ignore,no_run
5757        /// # use google_cloud_networkservices_v1::model::wasm_plugin::VersionDetails;
5758        /// let x = VersionDetails::new().set_plugin_config_data(bytes::Bytes::from_static(b"example"));
5759        /// assert!(x.plugin_config_data().is_some());
5760        /// assert!(x.plugin_config_uri().is_none());
5761        /// ```
5762        pub fn set_plugin_config_data<T: std::convert::Into<::bytes::Bytes>>(
5763            mut self,
5764            v: T,
5765        ) -> Self {
5766            self.plugin_config_source = std::option::Option::Some(
5767                crate::model::wasm_plugin::version_details::PluginConfigSource::PluginConfigData(
5768                    v.into(),
5769                ),
5770            );
5771            self
5772        }
5773
5774        /// The value of [plugin_config_source][crate::model::wasm_plugin::VersionDetails::plugin_config_source]
5775        /// if it holds a `PluginConfigUri`, `None` if the field is not set or
5776        /// holds a different branch.
5777        pub fn plugin_config_uri(&self) -> std::option::Option<&std::string::String> {
5778            #[allow(unreachable_patterns)]
5779            self.plugin_config_source.as_ref().and_then(|v| match v {
5780                crate::model::wasm_plugin::version_details::PluginConfigSource::PluginConfigUri(
5781                    v,
5782                ) => std::option::Option::Some(v),
5783                _ => std::option::Option::None,
5784            })
5785        }
5786
5787        /// Sets the value of [plugin_config_source][crate::model::wasm_plugin::VersionDetails::plugin_config_source]
5788        /// to hold a `PluginConfigUri`.
5789        ///
5790        /// Note that all the setters affecting `plugin_config_source` are
5791        /// mutually exclusive.
5792        ///
5793        /// # Example
5794        /// ```ignore,no_run
5795        /// # use google_cloud_networkservices_v1::model::wasm_plugin::VersionDetails;
5796        /// let x = VersionDetails::new().set_plugin_config_uri("example");
5797        /// assert!(x.plugin_config_uri().is_some());
5798        /// assert!(x.plugin_config_data().is_none());
5799        /// ```
5800        pub fn set_plugin_config_uri<T: std::convert::Into<std::string::String>>(
5801            mut self,
5802            v: T,
5803        ) -> Self {
5804            self.plugin_config_source = std::option::Option::Some(
5805                crate::model::wasm_plugin::version_details::PluginConfigSource::PluginConfigUri(
5806                    v.into(),
5807                ),
5808            );
5809            self
5810        }
5811    }
5812
5813    impl wkt::message::Message for VersionDetails {
5814        fn typename() -> &'static str {
5815            "type.googleapis.com/google.cloud.networkservices.v1.WasmPlugin.VersionDetails"
5816        }
5817    }
5818
5819    /// Defines additional types related to [VersionDetails].
5820    pub mod version_details {
5821        #[allow(unused_imports)]
5822        use super::*;
5823
5824        #[derive(Clone, Debug, PartialEq)]
5825        #[non_exhaustive]
5826        pub enum PluginConfigSource {
5827            /// Configuration for the plugin.
5828            /// The configuration is provided to the plugin at runtime through
5829            /// the `ON_CONFIGURE` callback. When a new
5830            /// `WasmPluginVersion` version is created, the digest of the
5831            /// contents is saved in the `plugin_config_digest` field.
5832            PluginConfigData(::bytes::Bytes),
5833            /// URI of the plugin configuration stored in the Artifact Registry.
5834            /// The configuration is provided to the plugin at runtime through
5835            /// the `ON_CONFIGURE` callback. The container image must
5836            /// contain only a single file with the name
5837            /// `plugin.config`. When a new `WasmPluginVersion`
5838            /// resource is created, the digest of the container image is saved in the
5839            /// `plugin_config_digest` field.
5840            PluginConfigUri(std::string::String),
5841        }
5842    }
5843
5844    /// Specifies the logging options for the activity performed by this
5845    /// plugin. If logging is enabled, plugin logs are exported to
5846    /// Cloud Logging.
5847    #[derive(Clone, Default, PartialEq)]
5848    #[non_exhaustive]
5849    pub struct LogConfig {
5850        /// Optional. Specifies whether to enable logging for activity by this
5851        /// plugin.
5852        ///
5853        /// Defaults to `false`.
5854        pub enable: bool,
5855
5856        /// Non-empty default. Configures the sampling rate of activity logs, where
5857        /// `1.0` means all logged activity is reported and `0.0` means no activity
5858        /// is reported. A floating point value between `0.0` and `1.0` indicates
5859        /// that a percentage of log messages is stored.
5860        ///
5861        /// The default value when logging is enabled is `1.0`. The value of the
5862        /// field must be between `0` and `1` (inclusive).
5863        ///
5864        /// This field can be specified only if logging is enabled for this plugin.
5865        pub sample_rate: f32,
5866
5867        /// Non-empty default. Specifies the lowest level of the plugin logs that
5868        /// are exported to Cloud Logging. This setting relates to the logs generated
5869        /// by using logging statements in your Wasm code.
5870        ///
5871        /// This field is can be set only if logging is enabled for the plugin.
5872        ///
5873        /// If the field is not provided when logging is enabled, it is set to
5874        /// `INFO` by default.
5875        pub min_log_level: crate::model::wasm_plugin::log_config::LogLevel,
5876
5877        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5878    }
5879
5880    impl LogConfig {
5881        pub fn new() -> Self {
5882            std::default::Default::default()
5883        }
5884
5885        /// Sets the value of [enable][crate::model::wasm_plugin::LogConfig::enable].
5886        ///
5887        /// # Example
5888        /// ```ignore,no_run
5889        /// # use google_cloud_networkservices_v1::model::wasm_plugin::LogConfig;
5890        /// let x = LogConfig::new().set_enable(true);
5891        /// ```
5892        pub fn set_enable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5893            self.enable = v.into();
5894            self
5895        }
5896
5897        /// Sets the value of [sample_rate][crate::model::wasm_plugin::LogConfig::sample_rate].
5898        ///
5899        /// # Example
5900        /// ```ignore,no_run
5901        /// # use google_cloud_networkservices_v1::model::wasm_plugin::LogConfig;
5902        /// let x = LogConfig::new().set_sample_rate(42.0);
5903        /// ```
5904        pub fn set_sample_rate<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5905            self.sample_rate = v.into();
5906            self
5907        }
5908
5909        /// Sets the value of [min_log_level][crate::model::wasm_plugin::LogConfig::min_log_level].
5910        ///
5911        /// # Example
5912        /// ```ignore,no_run
5913        /// # use google_cloud_networkservices_v1::model::wasm_plugin::LogConfig;
5914        /// use google_cloud_networkservices_v1::model::wasm_plugin::log_config::LogLevel;
5915        /// let x0 = LogConfig::new().set_min_log_level(LogLevel::Trace);
5916        /// let x1 = LogConfig::new().set_min_log_level(LogLevel::Debug);
5917        /// let x2 = LogConfig::new().set_min_log_level(LogLevel::Info);
5918        /// ```
5919        pub fn set_min_log_level<
5920            T: std::convert::Into<crate::model::wasm_plugin::log_config::LogLevel>,
5921        >(
5922            mut self,
5923            v: T,
5924        ) -> Self {
5925            self.min_log_level = v.into();
5926            self
5927        }
5928    }
5929
5930    impl wkt::message::Message for LogConfig {
5931        fn typename() -> &'static str {
5932            "type.googleapis.com/google.cloud.networkservices.v1.WasmPlugin.LogConfig"
5933        }
5934    }
5935
5936    /// Defines additional types related to [LogConfig].
5937    pub mod log_config {
5938        #[allow(unused_imports)]
5939        use super::*;
5940
5941        /// Possible values to specify the lowest level of logs to be exported to
5942        /// Cloud Logging.
5943        ///
5944        /// # Working with unknown values
5945        ///
5946        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5947        /// additional enum variants at any time. Adding new variants is not considered
5948        /// a breaking change. Applications should write their code in anticipation of:
5949        ///
5950        /// - New values appearing in future releases of the client library, **and**
5951        /// - New values received dynamically, without application changes.
5952        ///
5953        /// Please consult the [Working with enums] section in the user guide for some
5954        /// guidelines.
5955        ///
5956        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5957        #[derive(Clone, Debug, PartialEq)]
5958        #[non_exhaustive]
5959        pub enum LogLevel {
5960            /// Unspecified value. Defaults to `LogLevel.INFO`.
5961            Unspecified,
5962            /// Report logs with TRACE level and above.
5963            Trace,
5964            /// Report logs with DEBUG level and above.
5965            Debug,
5966            /// Report logs with INFO level and above.
5967            Info,
5968            /// Report logs with WARN level and above.
5969            Warn,
5970            /// Report logs with ERROR level and above.
5971            Error,
5972            /// Report logs with CRITICAL level only.
5973            Critical,
5974            /// If set, the enum was initialized with an unknown value.
5975            ///
5976            /// Applications can examine the value using [LogLevel::value] or
5977            /// [LogLevel::name].
5978            UnknownValue(log_level::UnknownValue),
5979        }
5980
5981        #[doc(hidden)]
5982        pub mod log_level {
5983            #[allow(unused_imports)]
5984            use super::*;
5985            #[derive(Clone, Debug, PartialEq)]
5986            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5987        }
5988
5989        impl LogLevel {
5990            /// Gets the enum value.
5991            ///
5992            /// Returns `None` if the enum contains an unknown value deserialized from
5993            /// the string representation of enums.
5994            pub fn value(&self) -> std::option::Option<i32> {
5995                match self {
5996                    Self::Unspecified => std::option::Option::Some(0),
5997                    Self::Trace => std::option::Option::Some(1),
5998                    Self::Debug => std::option::Option::Some(2),
5999                    Self::Info => std::option::Option::Some(3),
6000                    Self::Warn => std::option::Option::Some(4),
6001                    Self::Error => std::option::Option::Some(5),
6002                    Self::Critical => std::option::Option::Some(6),
6003                    Self::UnknownValue(u) => u.0.value(),
6004                }
6005            }
6006
6007            /// Gets the enum value as a string.
6008            ///
6009            /// Returns `None` if the enum contains an unknown value deserialized from
6010            /// the integer representation of enums.
6011            pub fn name(&self) -> std::option::Option<&str> {
6012                match self {
6013                    Self::Unspecified => std::option::Option::Some("LOG_LEVEL_UNSPECIFIED"),
6014                    Self::Trace => std::option::Option::Some("TRACE"),
6015                    Self::Debug => std::option::Option::Some("DEBUG"),
6016                    Self::Info => std::option::Option::Some("INFO"),
6017                    Self::Warn => std::option::Option::Some("WARN"),
6018                    Self::Error => std::option::Option::Some("ERROR"),
6019                    Self::Critical => std::option::Option::Some("CRITICAL"),
6020                    Self::UnknownValue(u) => u.0.name(),
6021                }
6022            }
6023        }
6024
6025        impl std::default::Default for LogLevel {
6026            fn default() -> Self {
6027                use std::convert::From;
6028                Self::from(0)
6029            }
6030        }
6031
6032        impl std::fmt::Display for LogLevel {
6033            fn fmt(
6034                &self,
6035                f: &mut std::fmt::Formatter<'_>,
6036            ) -> std::result::Result<(), std::fmt::Error> {
6037                wkt::internal::display_enum(f, self.name(), self.value())
6038            }
6039        }
6040
6041        impl std::convert::From<i32> for LogLevel {
6042            fn from(value: i32) -> Self {
6043                match value {
6044                    0 => Self::Unspecified,
6045                    1 => Self::Trace,
6046                    2 => Self::Debug,
6047                    3 => Self::Info,
6048                    4 => Self::Warn,
6049                    5 => Self::Error,
6050                    6 => Self::Critical,
6051                    _ => Self::UnknownValue(log_level::UnknownValue(
6052                        wkt::internal::UnknownEnumValue::Integer(value),
6053                    )),
6054                }
6055            }
6056        }
6057
6058        impl std::convert::From<&str> for LogLevel {
6059            fn from(value: &str) -> Self {
6060                use std::string::ToString;
6061                match value {
6062                    "LOG_LEVEL_UNSPECIFIED" => Self::Unspecified,
6063                    "TRACE" => Self::Trace,
6064                    "DEBUG" => Self::Debug,
6065                    "INFO" => Self::Info,
6066                    "WARN" => Self::Warn,
6067                    "ERROR" => Self::Error,
6068                    "CRITICAL" => Self::Critical,
6069                    _ => Self::UnknownValue(log_level::UnknownValue(
6070                        wkt::internal::UnknownEnumValue::String(value.to_string()),
6071                    )),
6072                }
6073            }
6074        }
6075
6076        impl serde::ser::Serialize for LogLevel {
6077            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6078            where
6079                S: serde::Serializer,
6080            {
6081                match self {
6082                    Self::Unspecified => serializer.serialize_i32(0),
6083                    Self::Trace => serializer.serialize_i32(1),
6084                    Self::Debug => serializer.serialize_i32(2),
6085                    Self::Info => serializer.serialize_i32(3),
6086                    Self::Warn => serializer.serialize_i32(4),
6087                    Self::Error => serializer.serialize_i32(5),
6088                    Self::Critical => serializer.serialize_i32(6),
6089                    Self::UnknownValue(u) => u.0.serialize(serializer),
6090                }
6091            }
6092        }
6093
6094        impl<'de> serde::de::Deserialize<'de> for LogLevel {
6095            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6096            where
6097                D: serde::Deserializer<'de>,
6098            {
6099                deserializer.deserialize_any(wkt::internal::EnumVisitor::<LogLevel>::new(
6100                    ".google.cloud.networkservices.v1.WasmPlugin.LogConfig.LogLevel",
6101                ))
6102            }
6103        }
6104    }
6105
6106    /// Defines a resource that uses the `WasmPlugin` resource.
6107    #[derive(Clone, Default, PartialEq)]
6108    #[non_exhaustive]
6109    pub struct UsedBy {
6110        /// Output only. Full name of the resource
6111        /// <https://google.aip.dev/122#full-resource-names>, for example
6112        /// `//networkservices.googleapis.com/projects/{project}/locations/{location}/lbRouteExtensions/{extension}`
6113        pub name: std::string::String,
6114
6115        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6116    }
6117
6118    impl UsedBy {
6119        pub fn new() -> Self {
6120            std::default::Default::default()
6121        }
6122
6123        /// Sets the value of [name][crate::model::wasm_plugin::UsedBy::name].
6124        ///
6125        /// # Example
6126        /// ```ignore,no_run
6127        /// # use google_cloud_networkservices_v1::model::wasm_plugin::UsedBy;
6128        /// let x = UsedBy::new().set_name("example");
6129        /// ```
6130        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6131            self.name = v.into();
6132            self
6133        }
6134    }
6135
6136    impl wkt::message::Message for UsedBy {
6137        fn typename() -> &'static str {
6138            "type.googleapis.com/google.cloud.networkservices.v1.WasmPlugin.UsedBy"
6139        }
6140    }
6141}
6142
6143/// A single immutable version of a `WasmPlugin` resource.
6144/// Defines the Wasm module used and optionally its runtime config.
6145#[derive(Clone, Default, PartialEq)]
6146#[non_exhaustive]
6147pub struct WasmPluginVersion {
6148    /// Identifier. Name of the `WasmPluginVersion` resource in the following
6149    /// format: `projects/{project}/locations/{location}/wasmPlugins/{wasm_plugin}/
6150    /// versions/{wasm_plugin_version}`.
6151    pub name: std::string::String,
6152
6153    /// Output only. The timestamp when the resource was created.
6154    pub create_time: std::option::Option<wkt::Timestamp>,
6155
6156    /// Output only. The timestamp when the resource was updated.
6157    pub update_time: std::option::Option<wkt::Timestamp>,
6158
6159    /// Optional. A human-readable description of the resource.
6160    pub description: std::string::String,
6161
6162    /// Optional. Set of labels associated with the `WasmPluginVersion`
6163    /// resource.
6164    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6165
6166    /// Optional. URI of the container image containing the plugin, stored in the
6167    /// Artifact Registry.
6168    /// When a new `WasmPluginVersion` resource is created, the digest
6169    /// of the container image is saved in the `image_digest` field.
6170    /// When downloading an image, the digest value is used instead of an
6171    /// image tag.
6172    pub image_uri: std::string::String,
6173
6174    /// Output only. The resolved digest for the image specified in the `image`
6175    /// field. The digest is resolved during the creation of `WasmPluginVersion`
6176    /// resource. This field holds the digest value, regardless of whether a tag or
6177    /// digest was originally specified in the `image` field.
6178    pub image_digest: std::string::String,
6179
6180    /// Output only. This field holds the digest (usually checksum) value for the
6181    /// plugin configuration. The value is calculated based on the contents of
6182    /// `plugin_config_data` or the container image defined by
6183    /// the `plugin_config_uri` field.
6184    pub plugin_config_digest: std::string::String,
6185
6186    pub plugin_config_source:
6187        std::option::Option<crate::model::wasm_plugin_version::PluginConfigSource>,
6188
6189    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6190}
6191
6192impl WasmPluginVersion {
6193    pub fn new() -> Self {
6194        std::default::Default::default()
6195    }
6196
6197    /// Sets the value of [name][crate::model::WasmPluginVersion::name].
6198    ///
6199    /// # Example
6200    /// ```ignore,no_run
6201    /// # use google_cloud_networkservices_v1::model::WasmPluginVersion;
6202    /// let x = WasmPluginVersion::new().set_name("example");
6203    /// ```
6204    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6205        self.name = v.into();
6206        self
6207    }
6208
6209    /// Sets the value of [create_time][crate::model::WasmPluginVersion::create_time].
6210    ///
6211    /// # Example
6212    /// ```ignore,no_run
6213    /// # use google_cloud_networkservices_v1::model::WasmPluginVersion;
6214    /// use wkt::Timestamp;
6215    /// let x = WasmPluginVersion::new().set_create_time(Timestamp::default()/* use setters */);
6216    /// ```
6217    pub fn set_create_time<T>(mut self, v: T) -> Self
6218    where
6219        T: std::convert::Into<wkt::Timestamp>,
6220    {
6221        self.create_time = std::option::Option::Some(v.into());
6222        self
6223    }
6224
6225    /// Sets or clears the value of [create_time][crate::model::WasmPluginVersion::create_time].
6226    ///
6227    /// # Example
6228    /// ```ignore,no_run
6229    /// # use google_cloud_networkservices_v1::model::WasmPluginVersion;
6230    /// use wkt::Timestamp;
6231    /// let x = WasmPluginVersion::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6232    /// let x = WasmPluginVersion::new().set_or_clear_create_time(None::<Timestamp>);
6233    /// ```
6234    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6235    where
6236        T: std::convert::Into<wkt::Timestamp>,
6237    {
6238        self.create_time = v.map(|x| x.into());
6239        self
6240    }
6241
6242    /// Sets the value of [update_time][crate::model::WasmPluginVersion::update_time].
6243    ///
6244    /// # Example
6245    /// ```ignore,no_run
6246    /// # use google_cloud_networkservices_v1::model::WasmPluginVersion;
6247    /// use wkt::Timestamp;
6248    /// let x = WasmPluginVersion::new().set_update_time(Timestamp::default()/* use setters */);
6249    /// ```
6250    pub fn set_update_time<T>(mut self, v: T) -> Self
6251    where
6252        T: std::convert::Into<wkt::Timestamp>,
6253    {
6254        self.update_time = std::option::Option::Some(v.into());
6255        self
6256    }
6257
6258    /// Sets or clears the value of [update_time][crate::model::WasmPluginVersion::update_time].
6259    ///
6260    /// # Example
6261    /// ```ignore,no_run
6262    /// # use google_cloud_networkservices_v1::model::WasmPluginVersion;
6263    /// use wkt::Timestamp;
6264    /// let x = WasmPluginVersion::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
6265    /// let x = WasmPluginVersion::new().set_or_clear_update_time(None::<Timestamp>);
6266    /// ```
6267    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
6268    where
6269        T: std::convert::Into<wkt::Timestamp>,
6270    {
6271        self.update_time = v.map(|x| x.into());
6272        self
6273    }
6274
6275    /// Sets the value of [description][crate::model::WasmPluginVersion::description].
6276    ///
6277    /// # Example
6278    /// ```ignore,no_run
6279    /// # use google_cloud_networkservices_v1::model::WasmPluginVersion;
6280    /// let x = WasmPluginVersion::new().set_description("example");
6281    /// ```
6282    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6283        self.description = v.into();
6284        self
6285    }
6286
6287    /// Sets the value of [labels][crate::model::WasmPluginVersion::labels].
6288    ///
6289    /// # Example
6290    /// ```ignore,no_run
6291    /// # use google_cloud_networkservices_v1::model::WasmPluginVersion;
6292    /// let x = WasmPluginVersion::new().set_labels([
6293    ///     ("key0", "abc"),
6294    ///     ("key1", "xyz"),
6295    /// ]);
6296    /// ```
6297    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6298    where
6299        T: std::iter::IntoIterator<Item = (K, V)>,
6300        K: std::convert::Into<std::string::String>,
6301        V: std::convert::Into<std::string::String>,
6302    {
6303        use std::iter::Iterator;
6304        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6305        self
6306    }
6307
6308    /// Sets the value of [image_uri][crate::model::WasmPluginVersion::image_uri].
6309    ///
6310    /// # Example
6311    /// ```ignore,no_run
6312    /// # use google_cloud_networkservices_v1::model::WasmPluginVersion;
6313    /// let x = WasmPluginVersion::new().set_image_uri("example");
6314    /// ```
6315    pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6316        self.image_uri = v.into();
6317        self
6318    }
6319
6320    /// Sets the value of [image_digest][crate::model::WasmPluginVersion::image_digest].
6321    ///
6322    /// # Example
6323    /// ```ignore,no_run
6324    /// # use google_cloud_networkservices_v1::model::WasmPluginVersion;
6325    /// let x = WasmPluginVersion::new().set_image_digest("example");
6326    /// ```
6327    pub fn set_image_digest<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6328        self.image_digest = v.into();
6329        self
6330    }
6331
6332    /// Sets the value of [plugin_config_digest][crate::model::WasmPluginVersion::plugin_config_digest].
6333    ///
6334    /// # Example
6335    /// ```ignore,no_run
6336    /// # use google_cloud_networkservices_v1::model::WasmPluginVersion;
6337    /// let x = WasmPluginVersion::new().set_plugin_config_digest("example");
6338    /// ```
6339    pub fn set_plugin_config_digest<T: std::convert::Into<std::string::String>>(
6340        mut self,
6341        v: T,
6342    ) -> Self {
6343        self.plugin_config_digest = v.into();
6344        self
6345    }
6346
6347    /// Sets the value of [plugin_config_source][crate::model::WasmPluginVersion::plugin_config_source].
6348    ///
6349    /// Note that all the setters affecting `plugin_config_source` are mutually
6350    /// exclusive.
6351    ///
6352    /// # Example
6353    /// ```ignore,no_run
6354    /// # use google_cloud_networkservices_v1::model::WasmPluginVersion;
6355    /// use google_cloud_networkservices_v1::model::wasm_plugin_version::PluginConfigSource;
6356    /// let x = WasmPluginVersion::new().set_plugin_config_source(Some(PluginConfigSource::PluginConfigData(bytes::Bytes::from_static(b"example"))));
6357    /// ```
6358    pub fn set_plugin_config_source<
6359        T: std::convert::Into<
6360                std::option::Option<crate::model::wasm_plugin_version::PluginConfigSource>,
6361            >,
6362    >(
6363        mut self,
6364        v: T,
6365    ) -> Self {
6366        self.plugin_config_source = v.into();
6367        self
6368    }
6369
6370    /// The value of [plugin_config_source][crate::model::WasmPluginVersion::plugin_config_source]
6371    /// if it holds a `PluginConfigData`, `None` if the field is not set or
6372    /// holds a different branch.
6373    pub fn plugin_config_data(&self) -> std::option::Option<&::bytes::Bytes> {
6374        #[allow(unreachable_patterns)]
6375        self.plugin_config_source.as_ref().and_then(|v| match v {
6376            crate::model::wasm_plugin_version::PluginConfigSource::PluginConfigData(v) => {
6377                std::option::Option::Some(v)
6378            }
6379            _ => std::option::Option::None,
6380        })
6381    }
6382
6383    /// Sets the value of [plugin_config_source][crate::model::WasmPluginVersion::plugin_config_source]
6384    /// to hold a `PluginConfigData`.
6385    ///
6386    /// Note that all the setters affecting `plugin_config_source` are
6387    /// mutually exclusive.
6388    ///
6389    /// # Example
6390    /// ```ignore,no_run
6391    /// # use google_cloud_networkservices_v1::model::WasmPluginVersion;
6392    /// let x = WasmPluginVersion::new().set_plugin_config_data(bytes::Bytes::from_static(b"example"));
6393    /// assert!(x.plugin_config_data().is_some());
6394    /// assert!(x.plugin_config_uri().is_none());
6395    /// ```
6396    pub fn set_plugin_config_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6397        self.plugin_config_source = std::option::Option::Some(
6398            crate::model::wasm_plugin_version::PluginConfigSource::PluginConfigData(v.into()),
6399        );
6400        self
6401    }
6402
6403    /// The value of [plugin_config_source][crate::model::WasmPluginVersion::plugin_config_source]
6404    /// if it holds a `PluginConfigUri`, `None` if the field is not set or
6405    /// holds a different branch.
6406    pub fn plugin_config_uri(&self) -> std::option::Option<&std::string::String> {
6407        #[allow(unreachable_patterns)]
6408        self.plugin_config_source.as_ref().and_then(|v| match v {
6409            crate::model::wasm_plugin_version::PluginConfigSource::PluginConfigUri(v) => {
6410                std::option::Option::Some(v)
6411            }
6412            _ => std::option::Option::None,
6413        })
6414    }
6415
6416    /// Sets the value of [plugin_config_source][crate::model::WasmPluginVersion::plugin_config_source]
6417    /// to hold a `PluginConfigUri`.
6418    ///
6419    /// Note that all the setters affecting `plugin_config_source` are
6420    /// mutually exclusive.
6421    ///
6422    /// # Example
6423    /// ```ignore,no_run
6424    /// # use google_cloud_networkservices_v1::model::WasmPluginVersion;
6425    /// let x = WasmPluginVersion::new().set_plugin_config_uri("example");
6426    /// assert!(x.plugin_config_uri().is_some());
6427    /// assert!(x.plugin_config_data().is_none());
6428    /// ```
6429    pub fn set_plugin_config_uri<T: std::convert::Into<std::string::String>>(
6430        mut self,
6431        v: T,
6432    ) -> Self {
6433        self.plugin_config_source = std::option::Option::Some(
6434            crate::model::wasm_plugin_version::PluginConfigSource::PluginConfigUri(v.into()),
6435        );
6436        self
6437    }
6438}
6439
6440impl wkt::message::Message for WasmPluginVersion {
6441    fn typename() -> &'static str {
6442        "type.googleapis.com/google.cloud.networkservices.v1.WasmPluginVersion"
6443    }
6444}
6445
6446/// Defines additional types related to [WasmPluginVersion].
6447pub mod wasm_plugin_version {
6448    #[allow(unused_imports)]
6449    use super::*;
6450
6451    #[derive(Clone, Debug, PartialEq)]
6452    #[non_exhaustive]
6453    pub enum PluginConfigSource {
6454        /// Configuration for the plugin.
6455        /// The configuration is provided to the plugin at runtime through
6456        /// the `ON_CONFIGURE` callback. When a new
6457        /// `WasmPluginVersion` resource is created, the digest of the
6458        /// contents is saved in the `plugin_config_digest` field.
6459        PluginConfigData(::bytes::Bytes),
6460        /// URI of the plugin configuration stored in the Artifact Registry.
6461        /// The configuration is provided to the plugin at runtime through
6462        /// the `ON_CONFIGURE` callback. The container image must contain
6463        /// only a single file with the name `plugin.config`. When a
6464        /// new `WasmPluginVersion` resource is created, the digest of the
6465        /// container image is saved in the `plugin_config_digest` field.
6466        PluginConfigUri(std::string::String),
6467    }
6468}
6469
6470/// Request used with the `ListWasmPlugins` method.
6471#[derive(Clone, Default, PartialEq)]
6472#[non_exhaustive]
6473pub struct ListWasmPluginsRequest {
6474    /// Required. The project and location from which the `WasmPlugin` resources
6475    /// are listed, specified in the following format:
6476    /// `projects/{project}/locations/global`.
6477    pub parent: std::string::String,
6478
6479    /// Maximum number of `WasmPlugin` resources to return per call.
6480    /// If not specified, at most 50 `WasmPlugin` resources are returned.
6481    /// The maximum value is 1000; values above 1000 are coerced to 1000.
6482    pub page_size: i32,
6483
6484    /// The value returned by the last `ListWasmPluginsResponse` call.
6485    /// Indicates that this is a continuation of a prior
6486    /// `ListWasmPlugins` call, and that the
6487    /// next page of data is to be returned.
6488    pub page_token: std::string::String,
6489
6490    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6491}
6492
6493impl ListWasmPluginsRequest {
6494    pub fn new() -> Self {
6495        std::default::Default::default()
6496    }
6497
6498    /// Sets the value of [parent][crate::model::ListWasmPluginsRequest::parent].
6499    ///
6500    /// # Example
6501    /// ```ignore,no_run
6502    /// # use google_cloud_networkservices_v1::model::ListWasmPluginsRequest;
6503    /// let x = ListWasmPluginsRequest::new().set_parent("example");
6504    /// ```
6505    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6506        self.parent = v.into();
6507        self
6508    }
6509
6510    /// Sets the value of [page_size][crate::model::ListWasmPluginsRequest::page_size].
6511    ///
6512    /// # Example
6513    /// ```ignore,no_run
6514    /// # use google_cloud_networkservices_v1::model::ListWasmPluginsRequest;
6515    /// let x = ListWasmPluginsRequest::new().set_page_size(42);
6516    /// ```
6517    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6518        self.page_size = v.into();
6519        self
6520    }
6521
6522    /// Sets the value of [page_token][crate::model::ListWasmPluginsRequest::page_token].
6523    ///
6524    /// # Example
6525    /// ```ignore,no_run
6526    /// # use google_cloud_networkservices_v1::model::ListWasmPluginsRequest;
6527    /// let x = ListWasmPluginsRequest::new().set_page_token("example");
6528    /// ```
6529    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6530        self.page_token = v.into();
6531        self
6532    }
6533}
6534
6535impl wkt::message::Message for ListWasmPluginsRequest {
6536    fn typename() -> &'static str {
6537        "type.googleapis.com/google.cloud.networkservices.v1.ListWasmPluginsRequest"
6538    }
6539}
6540
6541/// Response returned by the `ListWasmPlugins` method.
6542#[derive(Clone, Default, PartialEq)]
6543#[non_exhaustive]
6544pub struct ListWasmPluginsResponse {
6545    /// List of `WasmPlugin` resources.
6546    pub wasm_plugins: std::vec::Vec<crate::model::WasmPlugin>,
6547
6548    /// If there might be more results than those appearing in this response, then
6549    /// `next_page_token` is included. To get the next set of results,
6550    /// call this method again using the value of `next_page_token` as
6551    /// `page_token`.
6552    pub next_page_token: std::string::String,
6553
6554    /// Unreachable resources. Populated when the request attempts to list all
6555    /// resources across all supported locations, while some locations are
6556    /// temporarily unavailable.
6557    pub unreachable: std::vec::Vec<std::string::String>,
6558
6559    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6560}
6561
6562impl ListWasmPluginsResponse {
6563    pub fn new() -> Self {
6564        std::default::Default::default()
6565    }
6566
6567    /// Sets the value of [wasm_plugins][crate::model::ListWasmPluginsResponse::wasm_plugins].
6568    ///
6569    /// # Example
6570    /// ```ignore,no_run
6571    /// # use google_cloud_networkservices_v1::model::ListWasmPluginsResponse;
6572    /// use google_cloud_networkservices_v1::model::WasmPlugin;
6573    /// let x = ListWasmPluginsResponse::new()
6574    ///     .set_wasm_plugins([
6575    ///         WasmPlugin::default()/* use setters */,
6576    ///         WasmPlugin::default()/* use (different) setters */,
6577    ///     ]);
6578    /// ```
6579    pub fn set_wasm_plugins<T, V>(mut self, v: T) -> Self
6580    where
6581        T: std::iter::IntoIterator<Item = V>,
6582        V: std::convert::Into<crate::model::WasmPlugin>,
6583    {
6584        use std::iter::Iterator;
6585        self.wasm_plugins = v.into_iter().map(|i| i.into()).collect();
6586        self
6587    }
6588
6589    /// Sets the value of [next_page_token][crate::model::ListWasmPluginsResponse::next_page_token].
6590    ///
6591    /// # Example
6592    /// ```ignore,no_run
6593    /// # use google_cloud_networkservices_v1::model::ListWasmPluginsResponse;
6594    /// let x = ListWasmPluginsResponse::new().set_next_page_token("example");
6595    /// ```
6596    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6597        self.next_page_token = v.into();
6598        self
6599    }
6600
6601    /// Sets the value of [unreachable][crate::model::ListWasmPluginsResponse::unreachable].
6602    ///
6603    /// # Example
6604    /// ```ignore,no_run
6605    /// # use google_cloud_networkservices_v1::model::ListWasmPluginsResponse;
6606    /// let x = ListWasmPluginsResponse::new().set_unreachable(["a", "b", "c"]);
6607    /// ```
6608    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
6609    where
6610        T: std::iter::IntoIterator<Item = V>,
6611        V: std::convert::Into<std::string::String>,
6612    {
6613        use std::iter::Iterator;
6614        self.unreachable = v.into_iter().map(|i| i.into()).collect();
6615        self
6616    }
6617}
6618
6619impl wkt::message::Message for ListWasmPluginsResponse {
6620    fn typename() -> &'static str {
6621        "type.googleapis.com/google.cloud.networkservices.v1.ListWasmPluginsResponse"
6622    }
6623}
6624
6625#[doc(hidden)]
6626impl google_cloud_gax::paginator::internal::PageableResponse for ListWasmPluginsResponse {
6627    type PageItem = crate::model::WasmPlugin;
6628
6629    fn items(self) -> std::vec::Vec<Self::PageItem> {
6630        self.wasm_plugins
6631    }
6632
6633    fn next_page_token(&self) -> std::string::String {
6634        use std::clone::Clone;
6635        self.next_page_token.clone()
6636    }
6637}
6638
6639/// Request used by the `GetWasmPlugin` method.
6640#[derive(Clone, Default, PartialEq)]
6641#[non_exhaustive]
6642pub struct GetWasmPluginRequest {
6643    /// Required. A name of the `WasmPlugin` resource to get. Must be in the
6644    /// format `projects/{project}/locations/global/wasmPlugins/{wasm_plugin}`.
6645    pub name: std::string::String,
6646
6647    /// Determines how much data must be returned in the response. See
6648    /// [AIP-157](https://google.aip.dev/157).
6649    pub view: crate::model::WasmPluginView,
6650
6651    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6652}
6653
6654impl GetWasmPluginRequest {
6655    pub fn new() -> Self {
6656        std::default::Default::default()
6657    }
6658
6659    /// Sets the value of [name][crate::model::GetWasmPluginRequest::name].
6660    ///
6661    /// # Example
6662    /// ```ignore,no_run
6663    /// # use google_cloud_networkservices_v1::model::GetWasmPluginRequest;
6664    /// let x = GetWasmPluginRequest::new().set_name("example");
6665    /// ```
6666    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6667        self.name = v.into();
6668        self
6669    }
6670
6671    /// Sets the value of [view][crate::model::GetWasmPluginRequest::view].
6672    ///
6673    /// # Example
6674    /// ```ignore,no_run
6675    /// # use google_cloud_networkservices_v1::model::GetWasmPluginRequest;
6676    /// use google_cloud_networkservices_v1::model::WasmPluginView;
6677    /// let x0 = GetWasmPluginRequest::new().set_view(WasmPluginView::Basic);
6678    /// let x1 = GetWasmPluginRequest::new().set_view(WasmPluginView::Full);
6679    /// ```
6680    pub fn set_view<T: std::convert::Into<crate::model::WasmPluginView>>(mut self, v: T) -> Self {
6681        self.view = v.into();
6682        self
6683    }
6684}
6685
6686impl wkt::message::Message for GetWasmPluginRequest {
6687    fn typename() -> &'static str {
6688        "type.googleapis.com/google.cloud.networkservices.v1.GetWasmPluginRequest"
6689    }
6690}
6691
6692/// Request used by the `CreateWasmPlugin` method.
6693#[derive(Clone, Default, PartialEq)]
6694#[non_exhaustive]
6695pub struct CreateWasmPluginRequest {
6696    /// Required. The parent resource of the `WasmPlugin` resource. Must be in the
6697    /// format `projects/{project}/locations/global`.
6698    pub parent: std::string::String,
6699
6700    /// Required. User-provided ID of the `WasmPlugin` resource to be created.
6701    pub wasm_plugin_id: std::string::String,
6702
6703    /// Required. `WasmPlugin` resource to be created.
6704    pub wasm_plugin: std::option::Option<crate::model::WasmPlugin>,
6705
6706    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6707}
6708
6709impl CreateWasmPluginRequest {
6710    pub fn new() -> Self {
6711        std::default::Default::default()
6712    }
6713
6714    /// Sets the value of [parent][crate::model::CreateWasmPluginRequest::parent].
6715    ///
6716    /// # Example
6717    /// ```ignore,no_run
6718    /// # use google_cloud_networkservices_v1::model::CreateWasmPluginRequest;
6719    /// let x = CreateWasmPluginRequest::new().set_parent("example");
6720    /// ```
6721    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6722        self.parent = v.into();
6723        self
6724    }
6725
6726    /// Sets the value of [wasm_plugin_id][crate::model::CreateWasmPluginRequest::wasm_plugin_id].
6727    ///
6728    /// # Example
6729    /// ```ignore,no_run
6730    /// # use google_cloud_networkservices_v1::model::CreateWasmPluginRequest;
6731    /// let x = CreateWasmPluginRequest::new().set_wasm_plugin_id("example");
6732    /// ```
6733    pub fn set_wasm_plugin_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6734        self.wasm_plugin_id = v.into();
6735        self
6736    }
6737
6738    /// Sets the value of [wasm_plugin][crate::model::CreateWasmPluginRequest::wasm_plugin].
6739    ///
6740    /// # Example
6741    /// ```ignore,no_run
6742    /// # use google_cloud_networkservices_v1::model::CreateWasmPluginRequest;
6743    /// use google_cloud_networkservices_v1::model::WasmPlugin;
6744    /// let x = CreateWasmPluginRequest::new().set_wasm_plugin(WasmPlugin::default()/* use setters */);
6745    /// ```
6746    pub fn set_wasm_plugin<T>(mut self, v: T) -> Self
6747    where
6748        T: std::convert::Into<crate::model::WasmPlugin>,
6749    {
6750        self.wasm_plugin = std::option::Option::Some(v.into());
6751        self
6752    }
6753
6754    /// Sets or clears the value of [wasm_plugin][crate::model::CreateWasmPluginRequest::wasm_plugin].
6755    ///
6756    /// # Example
6757    /// ```ignore,no_run
6758    /// # use google_cloud_networkservices_v1::model::CreateWasmPluginRequest;
6759    /// use google_cloud_networkservices_v1::model::WasmPlugin;
6760    /// let x = CreateWasmPluginRequest::new().set_or_clear_wasm_plugin(Some(WasmPlugin::default()/* use setters */));
6761    /// let x = CreateWasmPluginRequest::new().set_or_clear_wasm_plugin(None::<WasmPlugin>);
6762    /// ```
6763    pub fn set_or_clear_wasm_plugin<T>(mut self, v: std::option::Option<T>) -> Self
6764    where
6765        T: std::convert::Into<crate::model::WasmPlugin>,
6766    {
6767        self.wasm_plugin = v.map(|x| x.into());
6768        self
6769    }
6770}
6771
6772impl wkt::message::Message for CreateWasmPluginRequest {
6773    fn typename() -> &'static str {
6774        "type.googleapis.com/google.cloud.networkservices.v1.CreateWasmPluginRequest"
6775    }
6776}
6777
6778/// Request used by the `UpdateWasmPlugin` method.
6779#[derive(Clone, Default, PartialEq)]
6780#[non_exhaustive]
6781pub struct UpdateWasmPluginRequest {
6782    /// Optional. Used to specify the fields to be overwritten in the
6783    /// `WasmPlugin` resource by the update.
6784    /// The fields specified in the `update_mask` field are relative to the
6785    /// resource, not the full request.
6786    /// An omitted `update_mask` field is treated as an implied `update_mask`
6787    /// field equivalent to all fields that are populated (that have a non-empty
6788    /// value).
6789    /// The `update_mask` field supports a special value `*`, which means that
6790    /// each field in the given `WasmPlugin` resource (including the empty ones)
6791    /// replaces the current value.
6792    pub update_mask: std::option::Option<wkt::FieldMask>,
6793
6794    /// Required. Updated `WasmPlugin` resource.
6795    pub wasm_plugin: std::option::Option<crate::model::WasmPlugin>,
6796
6797    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6798}
6799
6800impl UpdateWasmPluginRequest {
6801    pub fn new() -> Self {
6802        std::default::Default::default()
6803    }
6804
6805    /// Sets the value of [update_mask][crate::model::UpdateWasmPluginRequest::update_mask].
6806    ///
6807    /// # Example
6808    /// ```ignore,no_run
6809    /// # use google_cloud_networkservices_v1::model::UpdateWasmPluginRequest;
6810    /// use wkt::FieldMask;
6811    /// let x = UpdateWasmPluginRequest::new().set_update_mask(FieldMask::default()/* use setters */);
6812    /// ```
6813    pub fn set_update_mask<T>(mut self, v: T) -> Self
6814    where
6815        T: std::convert::Into<wkt::FieldMask>,
6816    {
6817        self.update_mask = std::option::Option::Some(v.into());
6818        self
6819    }
6820
6821    /// Sets or clears the value of [update_mask][crate::model::UpdateWasmPluginRequest::update_mask].
6822    ///
6823    /// # Example
6824    /// ```ignore,no_run
6825    /// # use google_cloud_networkservices_v1::model::UpdateWasmPluginRequest;
6826    /// use wkt::FieldMask;
6827    /// let x = UpdateWasmPluginRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
6828    /// let x = UpdateWasmPluginRequest::new().set_or_clear_update_mask(None::<FieldMask>);
6829    /// ```
6830    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6831    where
6832        T: std::convert::Into<wkt::FieldMask>,
6833    {
6834        self.update_mask = v.map(|x| x.into());
6835        self
6836    }
6837
6838    /// Sets the value of [wasm_plugin][crate::model::UpdateWasmPluginRequest::wasm_plugin].
6839    ///
6840    /// # Example
6841    /// ```ignore,no_run
6842    /// # use google_cloud_networkservices_v1::model::UpdateWasmPluginRequest;
6843    /// use google_cloud_networkservices_v1::model::WasmPlugin;
6844    /// let x = UpdateWasmPluginRequest::new().set_wasm_plugin(WasmPlugin::default()/* use setters */);
6845    /// ```
6846    pub fn set_wasm_plugin<T>(mut self, v: T) -> Self
6847    where
6848        T: std::convert::Into<crate::model::WasmPlugin>,
6849    {
6850        self.wasm_plugin = std::option::Option::Some(v.into());
6851        self
6852    }
6853
6854    /// Sets or clears the value of [wasm_plugin][crate::model::UpdateWasmPluginRequest::wasm_plugin].
6855    ///
6856    /// # Example
6857    /// ```ignore,no_run
6858    /// # use google_cloud_networkservices_v1::model::UpdateWasmPluginRequest;
6859    /// use google_cloud_networkservices_v1::model::WasmPlugin;
6860    /// let x = UpdateWasmPluginRequest::new().set_or_clear_wasm_plugin(Some(WasmPlugin::default()/* use setters */));
6861    /// let x = UpdateWasmPluginRequest::new().set_or_clear_wasm_plugin(None::<WasmPlugin>);
6862    /// ```
6863    pub fn set_or_clear_wasm_plugin<T>(mut self, v: std::option::Option<T>) -> Self
6864    where
6865        T: std::convert::Into<crate::model::WasmPlugin>,
6866    {
6867        self.wasm_plugin = v.map(|x| x.into());
6868        self
6869    }
6870}
6871
6872impl wkt::message::Message for UpdateWasmPluginRequest {
6873    fn typename() -> &'static str {
6874        "type.googleapis.com/google.cloud.networkservices.v1.UpdateWasmPluginRequest"
6875    }
6876}
6877
6878/// Request used by the `DeleteWasmPlugin` method.
6879#[derive(Clone, Default, PartialEq)]
6880#[non_exhaustive]
6881pub struct DeleteWasmPluginRequest {
6882    /// Required. A name of the `WasmPlugin` resource to delete. Must be in the
6883    /// format `projects/{project}/locations/global/wasmPlugins/{wasm_plugin}`.
6884    pub name: std::string::String,
6885
6886    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6887}
6888
6889impl DeleteWasmPluginRequest {
6890    pub fn new() -> Self {
6891        std::default::Default::default()
6892    }
6893
6894    /// Sets the value of [name][crate::model::DeleteWasmPluginRequest::name].
6895    ///
6896    /// # Example
6897    /// ```ignore,no_run
6898    /// # use google_cloud_networkservices_v1::model::DeleteWasmPluginRequest;
6899    /// let x = DeleteWasmPluginRequest::new().set_name("example");
6900    /// ```
6901    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6902        self.name = v.into();
6903        self
6904    }
6905}
6906
6907impl wkt::message::Message for DeleteWasmPluginRequest {
6908    fn typename() -> &'static str {
6909        "type.googleapis.com/google.cloud.networkservices.v1.DeleteWasmPluginRequest"
6910    }
6911}
6912
6913/// Request used with the `ListWasmPluginVersions` method.
6914#[derive(Clone, Default, PartialEq)]
6915#[non_exhaustive]
6916pub struct ListWasmPluginVersionsRequest {
6917    /// Required. The `WasmPlugin` resource whose `WasmPluginVersion`s
6918    /// are listed, specified in the following format:
6919    /// `projects/{project}/locations/global/wasmPlugins/{wasm_plugin}`.
6920    pub parent: std::string::String,
6921
6922    /// Maximum number of `WasmPluginVersion` resources to return per
6923    /// call. If not specified, at most 50 `WasmPluginVersion` resources are
6924    /// returned. The maximum value is 1000; values above 1000 are coerced to
6925    /// 1000.
6926    pub page_size: i32,
6927
6928    /// The value returned by the last `ListWasmPluginVersionsResponse` call.
6929    /// Indicates that this is a continuation of a prior
6930    /// `ListWasmPluginVersions` call, and that the
6931    /// next page of data is to be returned.
6932    pub page_token: std::string::String,
6933
6934    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6935}
6936
6937impl ListWasmPluginVersionsRequest {
6938    pub fn new() -> Self {
6939        std::default::Default::default()
6940    }
6941
6942    /// Sets the value of [parent][crate::model::ListWasmPluginVersionsRequest::parent].
6943    ///
6944    /// # Example
6945    /// ```ignore,no_run
6946    /// # use google_cloud_networkservices_v1::model::ListWasmPluginVersionsRequest;
6947    /// let x = ListWasmPluginVersionsRequest::new().set_parent("example");
6948    /// ```
6949    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6950        self.parent = v.into();
6951        self
6952    }
6953
6954    /// Sets the value of [page_size][crate::model::ListWasmPluginVersionsRequest::page_size].
6955    ///
6956    /// # Example
6957    /// ```ignore,no_run
6958    /// # use google_cloud_networkservices_v1::model::ListWasmPluginVersionsRequest;
6959    /// let x = ListWasmPluginVersionsRequest::new().set_page_size(42);
6960    /// ```
6961    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6962        self.page_size = v.into();
6963        self
6964    }
6965
6966    /// Sets the value of [page_token][crate::model::ListWasmPluginVersionsRequest::page_token].
6967    ///
6968    /// # Example
6969    /// ```ignore,no_run
6970    /// # use google_cloud_networkservices_v1::model::ListWasmPluginVersionsRequest;
6971    /// let x = ListWasmPluginVersionsRequest::new().set_page_token("example");
6972    /// ```
6973    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6974        self.page_token = v.into();
6975        self
6976    }
6977}
6978
6979impl wkt::message::Message for ListWasmPluginVersionsRequest {
6980    fn typename() -> &'static str {
6981        "type.googleapis.com/google.cloud.networkservices.v1.ListWasmPluginVersionsRequest"
6982    }
6983}
6984
6985/// Response returned by the `ListWasmPluginVersions` method.
6986#[derive(Clone, Default, PartialEq)]
6987#[non_exhaustive]
6988pub struct ListWasmPluginVersionsResponse {
6989    /// List of `WasmPluginVersion` resources.
6990    pub wasm_plugin_versions: std::vec::Vec<crate::model::WasmPluginVersion>,
6991
6992    /// If there might be more results than those appearing in this response, then
6993    /// `next_page_token` is included. To get the next set of results,
6994    /// call this method again using the value of `next_page_token` as
6995    /// `page_token`.
6996    pub next_page_token: std::string::String,
6997
6998    /// Unreachable resources. Populated when the request attempts to list all
6999    /// resources across all supported locations, while some locations are
7000    /// temporarily unavailable.
7001    pub unreachable: std::vec::Vec<std::string::String>,
7002
7003    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7004}
7005
7006impl ListWasmPluginVersionsResponse {
7007    pub fn new() -> Self {
7008        std::default::Default::default()
7009    }
7010
7011    /// Sets the value of [wasm_plugin_versions][crate::model::ListWasmPluginVersionsResponse::wasm_plugin_versions].
7012    ///
7013    /// # Example
7014    /// ```ignore,no_run
7015    /// # use google_cloud_networkservices_v1::model::ListWasmPluginVersionsResponse;
7016    /// use google_cloud_networkservices_v1::model::WasmPluginVersion;
7017    /// let x = ListWasmPluginVersionsResponse::new()
7018    ///     .set_wasm_plugin_versions([
7019    ///         WasmPluginVersion::default()/* use setters */,
7020    ///         WasmPluginVersion::default()/* use (different) setters */,
7021    ///     ]);
7022    /// ```
7023    pub fn set_wasm_plugin_versions<T, V>(mut self, v: T) -> Self
7024    where
7025        T: std::iter::IntoIterator<Item = V>,
7026        V: std::convert::Into<crate::model::WasmPluginVersion>,
7027    {
7028        use std::iter::Iterator;
7029        self.wasm_plugin_versions = v.into_iter().map(|i| i.into()).collect();
7030        self
7031    }
7032
7033    /// Sets the value of [next_page_token][crate::model::ListWasmPluginVersionsResponse::next_page_token].
7034    ///
7035    /// # Example
7036    /// ```ignore,no_run
7037    /// # use google_cloud_networkservices_v1::model::ListWasmPluginVersionsResponse;
7038    /// let x = ListWasmPluginVersionsResponse::new().set_next_page_token("example");
7039    /// ```
7040    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7041        self.next_page_token = v.into();
7042        self
7043    }
7044
7045    /// Sets the value of [unreachable][crate::model::ListWasmPluginVersionsResponse::unreachable].
7046    ///
7047    /// # Example
7048    /// ```ignore,no_run
7049    /// # use google_cloud_networkservices_v1::model::ListWasmPluginVersionsResponse;
7050    /// let x = ListWasmPluginVersionsResponse::new().set_unreachable(["a", "b", "c"]);
7051    /// ```
7052    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
7053    where
7054        T: std::iter::IntoIterator<Item = V>,
7055        V: std::convert::Into<std::string::String>,
7056    {
7057        use std::iter::Iterator;
7058        self.unreachable = v.into_iter().map(|i| i.into()).collect();
7059        self
7060    }
7061}
7062
7063impl wkt::message::Message for ListWasmPluginVersionsResponse {
7064    fn typename() -> &'static str {
7065        "type.googleapis.com/google.cloud.networkservices.v1.ListWasmPluginVersionsResponse"
7066    }
7067}
7068
7069#[doc(hidden)]
7070impl google_cloud_gax::paginator::internal::PageableResponse for ListWasmPluginVersionsResponse {
7071    type PageItem = crate::model::WasmPluginVersion;
7072
7073    fn items(self) -> std::vec::Vec<Self::PageItem> {
7074        self.wasm_plugin_versions
7075    }
7076
7077    fn next_page_token(&self) -> std::string::String {
7078        use std::clone::Clone;
7079        self.next_page_token.clone()
7080    }
7081}
7082
7083/// Request used by the `GetWasmPluginVersion` method.
7084#[derive(Clone, Default, PartialEq)]
7085#[non_exhaustive]
7086pub struct GetWasmPluginVersionRequest {
7087    /// Required. A name of the `WasmPluginVersion` resource to get. Must be in
7088    /// the format
7089    /// `projects/{project}/locations/global/wasmPlugins/{wasm_plugin}/versions/{wasm_plugin_version}`.
7090    pub name: std::string::String,
7091
7092    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7093}
7094
7095impl GetWasmPluginVersionRequest {
7096    pub fn new() -> Self {
7097        std::default::Default::default()
7098    }
7099
7100    /// Sets the value of [name][crate::model::GetWasmPluginVersionRequest::name].
7101    ///
7102    /// # Example
7103    /// ```ignore,no_run
7104    /// # use google_cloud_networkservices_v1::model::GetWasmPluginVersionRequest;
7105    /// let x = GetWasmPluginVersionRequest::new().set_name("example");
7106    /// ```
7107    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7108        self.name = v.into();
7109        self
7110    }
7111}
7112
7113impl wkt::message::Message for GetWasmPluginVersionRequest {
7114    fn typename() -> &'static str {
7115        "type.googleapis.com/google.cloud.networkservices.v1.GetWasmPluginVersionRequest"
7116    }
7117}
7118
7119/// Request used by the `CreateWasmPluginVersion` method.
7120#[derive(Clone, Default, PartialEq)]
7121#[non_exhaustive]
7122pub struct CreateWasmPluginVersionRequest {
7123    /// Required. The parent resource of the `WasmPluginVersion` resource. Must be
7124    /// in the format
7125    /// `projects/{project}/locations/global/wasmPlugins/{wasm_plugin}`.
7126    pub parent: std::string::String,
7127
7128    /// Required. User-provided ID of the `WasmPluginVersion` resource to be
7129    /// created.
7130    pub wasm_plugin_version_id: std::string::String,
7131
7132    /// Required. `WasmPluginVersion` resource to be created.
7133    pub wasm_plugin_version: std::option::Option<crate::model::WasmPluginVersion>,
7134
7135    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7136}
7137
7138impl CreateWasmPluginVersionRequest {
7139    pub fn new() -> Self {
7140        std::default::Default::default()
7141    }
7142
7143    /// Sets the value of [parent][crate::model::CreateWasmPluginVersionRequest::parent].
7144    ///
7145    /// # Example
7146    /// ```ignore,no_run
7147    /// # use google_cloud_networkservices_v1::model::CreateWasmPluginVersionRequest;
7148    /// let x = CreateWasmPluginVersionRequest::new().set_parent("example");
7149    /// ```
7150    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7151        self.parent = v.into();
7152        self
7153    }
7154
7155    /// Sets the value of [wasm_plugin_version_id][crate::model::CreateWasmPluginVersionRequest::wasm_plugin_version_id].
7156    ///
7157    /// # Example
7158    /// ```ignore,no_run
7159    /// # use google_cloud_networkservices_v1::model::CreateWasmPluginVersionRequest;
7160    /// let x = CreateWasmPluginVersionRequest::new().set_wasm_plugin_version_id("example");
7161    /// ```
7162    pub fn set_wasm_plugin_version_id<T: std::convert::Into<std::string::String>>(
7163        mut self,
7164        v: T,
7165    ) -> Self {
7166        self.wasm_plugin_version_id = v.into();
7167        self
7168    }
7169
7170    /// Sets the value of [wasm_plugin_version][crate::model::CreateWasmPluginVersionRequest::wasm_plugin_version].
7171    ///
7172    /// # Example
7173    /// ```ignore,no_run
7174    /// # use google_cloud_networkservices_v1::model::CreateWasmPluginVersionRequest;
7175    /// use google_cloud_networkservices_v1::model::WasmPluginVersion;
7176    /// let x = CreateWasmPluginVersionRequest::new().set_wasm_plugin_version(WasmPluginVersion::default()/* use setters */);
7177    /// ```
7178    pub fn set_wasm_plugin_version<T>(mut self, v: T) -> Self
7179    where
7180        T: std::convert::Into<crate::model::WasmPluginVersion>,
7181    {
7182        self.wasm_plugin_version = std::option::Option::Some(v.into());
7183        self
7184    }
7185
7186    /// Sets or clears the value of [wasm_plugin_version][crate::model::CreateWasmPluginVersionRequest::wasm_plugin_version].
7187    ///
7188    /// # Example
7189    /// ```ignore,no_run
7190    /// # use google_cloud_networkservices_v1::model::CreateWasmPluginVersionRequest;
7191    /// use google_cloud_networkservices_v1::model::WasmPluginVersion;
7192    /// let x = CreateWasmPluginVersionRequest::new().set_or_clear_wasm_plugin_version(Some(WasmPluginVersion::default()/* use setters */));
7193    /// let x = CreateWasmPluginVersionRequest::new().set_or_clear_wasm_plugin_version(None::<WasmPluginVersion>);
7194    /// ```
7195    pub fn set_or_clear_wasm_plugin_version<T>(mut self, v: std::option::Option<T>) -> Self
7196    where
7197        T: std::convert::Into<crate::model::WasmPluginVersion>,
7198    {
7199        self.wasm_plugin_version = v.map(|x| x.into());
7200        self
7201    }
7202}
7203
7204impl wkt::message::Message for CreateWasmPluginVersionRequest {
7205    fn typename() -> &'static str {
7206        "type.googleapis.com/google.cloud.networkservices.v1.CreateWasmPluginVersionRequest"
7207    }
7208}
7209
7210/// Request used by the `DeleteWasmPluginVersion` method.
7211#[derive(Clone, Default, PartialEq)]
7212#[non_exhaustive]
7213pub struct DeleteWasmPluginVersionRequest {
7214    /// Required. A name of the `WasmPluginVersion` resource to delete. Must be in
7215    /// the format
7216    /// `projects/{project}/locations/global/wasmPlugins/{wasm_plugin}/versions/{wasm_plugin_version}`.
7217    pub name: std::string::String,
7218
7219    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7220}
7221
7222impl DeleteWasmPluginVersionRequest {
7223    pub fn new() -> Self {
7224        std::default::Default::default()
7225    }
7226
7227    /// Sets the value of [name][crate::model::DeleteWasmPluginVersionRequest::name].
7228    ///
7229    /// # Example
7230    /// ```ignore,no_run
7231    /// # use google_cloud_networkservices_v1::model::DeleteWasmPluginVersionRequest;
7232    /// let x = DeleteWasmPluginVersionRequest::new().set_name("example");
7233    /// ```
7234    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7235        self.name = v.into();
7236        self
7237    }
7238}
7239
7240impl wkt::message::Message for DeleteWasmPluginVersionRequest {
7241    fn typename() -> &'static str {
7242        "type.googleapis.com/google.cloud.networkservices.v1.DeleteWasmPluginVersionRequest"
7243    }
7244}
7245
7246/// Gateway represents the configuration for a proxy, typically a load balancer.
7247/// It captures the ip:port over which the services are exposed by the proxy,
7248/// along with any policy configurations. Routes have reference to to Gateways to
7249/// dictate how requests should be routed by this Gateway.
7250#[derive(Clone, Default, PartialEq)]
7251#[non_exhaustive]
7252pub struct Gateway {
7253    /// Identifier. Name of the Gateway resource. It matches pattern
7254    /// `projects/*/locations/*/gateways/<gateway_name>`.
7255    pub name: std::string::String,
7256
7257    /// Output only. Server-defined URL of this resource
7258    pub self_link: std::string::String,
7259
7260    /// Output only. The timestamp when the resource was created.
7261    pub create_time: std::option::Option<wkt::Timestamp>,
7262
7263    /// Output only. The timestamp when the resource was updated.
7264    pub update_time: std::option::Option<wkt::Timestamp>,
7265
7266    /// Optional. Set of label tags associated with the Gateway resource.
7267    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
7268
7269    /// Optional. A free-text description of the resource. Max length 1024
7270    /// characters.
7271    pub description: std::string::String,
7272
7273    /// Immutable. The type of the customer managed gateway.
7274    /// This field is required. If unspecified, an error is returned.
7275    pub r#type: crate::model::gateway::Type,
7276
7277    /// Optional. Zero or one IPv4 or IPv6 address on which the Gateway will
7278    /// receive the traffic. When no address is provided, an IP from the subnetwork
7279    /// is allocated
7280    ///
7281    /// This field only applies to gateways of type 'SECURE_WEB_GATEWAY'.
7282    /// Gateways of type 'OPEN_MESH' listen on 0.0.0.0 for IPv4 and :: for IPv6.
7283    pub addresses: std::vec::Vec<std::string::String>,
7284
7285    /// Required. One or more port numbers (1-65535), on which the Gateway will
7286    /// receive traffic. The proxy binds to the specified ports.
7287    /// Gateways of type 'SECURE_WEB_GATEWAY' are limited to 1 port.
7288    /// Gateways of type 'OPEN_MESH' listen on 0.0.0.0 for IPv4 and :: for IPv6 and
7289    /// support multiple ports.
7290    pub ports: std::vec::Vec<i32>,
7291
7292    /// Optional. Scope determines how configuration across multiple Gateway
7293    /// instances are merged. The configuration for multiple Gateway instances with
7294    /// the same scope will be merged as presented as a single configuration to the
7295    /// proxy/load balancer.
7296    ///
7297    /// Max length 64 characters.
7298    /// Scope should start with a letter and can only have letters, numbers,
7299    /// hyphens.
7300    pub scope: std::string::String,
7301
7302    /// Optional. A fully-qualified ServerTLSPolicy URL reference. Specifies how
7303    /// TLS traffic is terminated. If empty, TLS termination is disabled.
7304    pub server_tls_policy: std::string::String,
7305
7306    /// Optional. A fully-qualified Certificates URL reference. The proxy presents
7307    /// a Certificate (selected based on SNI) when establishing a TLS connection.
7308    /// This feature only applies to gateways of type 'SECURE_WEB_GATEWAY'.
7309    pub certificate_urls: std::vec::Vec<std::string::String>,
7310
7311    /// Optional. A fully-qualified GatewaySecurityPolicy URL reference.
7312    /// Defines how a server should apply security policy to inbound
7313    /// (VM to Proxy) initiated connections.
7314    ///
7315    /// For example:
7316    /// `projects/*/locations/*/gatewaySecurityPolicies/swg-policy`.
7317    ///
7318    /// This policy is specific to gateways of type 'SECURE_WEB_GATEWAY'.
7319    pub gateway_security_policy: std::string::String,
7320
7321    /// Optional. The relative resource name identifying the VPC network that is
7322    /// using this configuration. For example:
7323    /// `projects/*/global/networks/network-1`.
7324    ///
7325    /// Currently, this field is specific to gateways of type 'SECURE_WEB_GATEWAY'.
7326    pub network: std::string::String,
7327
7328    /// Optional. The relative resource name identifying  the subnetwork in which
7329    /// this SWG is allocated. For example:
7330    /// `projects/*/regions/us-central1/subnetworks/network-1`
7331    ///
7332    /// Currently, this field is specific to gateways of type 'SECURE_WEB_GATEWAY".
7333    pub subnetwork: std::string::String,
7334
7335    /// Optional. The IP Version that will be used by this gateway. Valid options
7336    /// are IPV4 or IPV6. Default is IPV4.
7337    pub ip_version: crate::model::gateway::IpVersion,
7338
7339    /// Optional. Determines if envoy will insert internal debug headers into
7340    /// upstream requests. Other Envoy headers may still be injected. By default,
7341    /// envoy will not insert any debug headers.
7342    pub envoy_headers: std::option::Option<crate::model::EnvoyHeaders>,
7343
7344    /// Optional. The routing mode of the Gateway.
7345    /// This field is configurable only for gateways of type SECURE_WEB_GATEWAY.
7346    /// This field is required for gateways of type SECURE_WEB_GATEWAY.
7347    pub routing_mode: crate::model::gateway::RoutingMode,
7348
7349    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7350}
7351
7352impl Gateway {
7353    pub fn new() -> Self {
7354        std::default::Default::default()
7355    }
7356
7357    /// Sets the value of [name][crate::model::Gateway::name].
7358    ///
7359    /// # Example
7360    /// ```ignore,no_run
7361    /// # use google_cloud_networkservices_v1::model::Gateway;
7362    /// let x = Gateway::new().set_name("example");
7363    /// ```
7364    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7365        self.name = v.into();
7366        self
7367    }
7368
7369    /// Sets the value of [self_link][crate::model::Gateway::self_link].
7370    ///
7371    /// # Example
7372    /// ```ignore,no_run
7373    /// # use google_cloud_networkservices_v1::model::Gateway;
7374    /// let x = Gateway::new().set_self_link("example");
7375    /// ```
7376    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7377        self.self_link = v.into();
7378        self
7379    }
7380
7381    /// Sets the value of [create_time][crate::model::Gateway::create_time].
7382    ///
7383    /// # Example
7384    /// ```ignore,no_run
7385    /// # use google_cloud_networkservices_v1::model::Gateway;
7386    /// use wkt::Timestamp;
7387    /// let x = Gateway::new().set_create_time(Timestamp::default()/* use setters */);
7388    /// ```
7389    pub fn set_create_time<T>(mut self, v: T) -> Self
7390    where
7391        T: std::convert::Into<wkt::Timestamp>,
7392    {
7393        self.create_time = std::option::Option::Some(v.into());
7394        self
7395    }
7396
7397    /// Sets or clears the value of [create_time][crate::model::Gateway::create_time].
7398    ///
7399    /// # Example
7400    /// ```ignore,no_run
7401    /// # use google_cloud_networkservices_v1::model::Gateway;
7402    /// use wkt::Timestamp;
7403    /// let x = Gateway::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
7404    /// let x = Gateway::new().set_or_clear_create_time(None::<Timestamp>);
7405    /// ```
7406    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7407    where
7408        T: std::convert::Into<wkt::Timestamp>,
7409    {
7410        self.create_time = v.map(|x| x.into());
7411        self
7412    }
7413
7414    /// Sets the value of [update_time][crate::model::Gateway::update_time].
7415    ///
7416    /// # Example
7417    /// ```ignore,no_run
7418    /// # use google_cloud_networkservices_v1::model::Gateway;
7419    /// use wkt::Timestamp;
7420    /// let x = Gateway::new().set_update_time(Timestamp::default()/* use setters */);
7421    /// ```
7422    pub fn set_update_time<T>(mut self, v: T) -> Self
7423    where
7424        T: std::convert::Into<wkt::Timestamp>,
7425    {
7426        self.update_time = std::option::Option::Some(v.into());
7427        self
7428    }
7429
7430    /// Sets or clears the value of [update_time][crate::model::Gateway::update_time].
7431    ///
7432    /// # Example
7433    /// ```ignore,no_run
7434    /// # use google_cloud_networkservices_v1::model::Gateway;
7435    /// use wkt::Timestamp;
7436    /// let x = Gateway::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
7437    /// let x = Gateway::new().set_or_clear_update_time(None::<Timestamp>);
7438    /// ```
7439    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
7440    where
7441        T: std::convert::Into<wkt::Timestamp>,
7442    {
7443        self.update_time = v.map(|x| x.into());
7444        self
7445    }
7446
7447    /// Sets the value of [labels][crate::model::Gateway::labels].
7448    ///
7449    /// # Example
7450    /// ```ignore,no_run
7451    /// # use google_cloud_networkservices_v1::model::Gateway;
7452    /// let x = Gateway::new().set_labels([
7453    ///     ("key0", "abc"),
7454    ///     ("key1", "xyz"),
7455    /// ]);
7456    /// ```
7457    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7458    where
7459        T: std::iter::IntoIterator<Item = (K, V)>,
7460        K: std::convert::Into<std::string::String>,
7461        V: std::convert::Into<std::string::String>,
7462    {
7463        use std::iter::Iterator;
7464        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7465        self
7466    }
7467
7468    /// Sets the value of [description][crate::model::Gateway::description].
7469    ///
7470    /// # Example
7471    /// ```ignore,no_run
7472    /// # use google_cloud_networkservices_v1::model::Gateway;
7473    /// let x = Gateway::new().set_description("example");
7474    /// ```
7475    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7476        self.description = v.into();
7477        self
7478    }
7479
7480    /// Sets the value of [r#type][crate::model::Gateway::type].
7481    ///
7482    /// # Example
7483    /// ```ignore,no_run
7484    /// # use google_cloud_networkservices_v1::model::Gateway;
7485    /// use google_cloud_networkservices_v1::model::gateway::Type;
7486    /// let x0 = Gateway::new().set_type(Type::OpenMesh);
7487    /// let x1 = Gateway::new().set_type(Type::SecureWebGateway);
7488    /// ```
7489    pub fn set_type<T: std::convert::Into<crate::model::gateway::Type>>(mut self, v: T) -> Self {
7490        self.r#type = v.into();
7491        self
7492    }
7493
7494    /// Sets the value of [addresses][crate::model::Gateway::addresses].
7495    ///
7496    /// # Example
7497    /// ```ignore,no_run
7498    /// # use google_cloud_networkservices_v1::model::Gateway;
7499    /// let x = Gateway::new().set_addresses(["a", "b", "c"]);
7500    /// ```
7501    pub fn set_addresses<T, V>(mut self, v: T) -> Self
7502    where
7503        T: std::iter::IntoIterator<Item = V>,
7504        V: std::convert::Into<std::string::String>,
7505    {
7506        use std::iter::Iterator;
7507        self.addresses = v.into_iter().map(|i| i.into()).collect();
7508        self
7509    }
7510
7511    /// Sets the value of [ports][crate::model::Gateway::ports].
7512    ///
7513    /// # Example
7514    /// ```ignore,no_run
7515    /// # use google_cloud_networkservices_v1::model::Gateway;
7516    /// let x = Gateway::new().set_ports([1, 2, 3]);
7517    /// ```
7518    pub fn set_ports<T, V>(mut self, v: T) -> Self
7519    where
7520        T: std::iter::IntoIterator<Item = V>,
7521        V: std::convert::Into<i32>,
7522    {
7523        use std::iter::Iterator;
7524        self.ports = v.into_iter().map(|i| i.into()).collect();
7525        self
7526    }
7527
7528    /// Sets the value of [scope][crate::model::Gateway::scope].
7529    ///
7530    /// # Example
7531    /// ```ignore,no_run
7532    /// # use google_cloud_networkservices_v1::model::Gateway;
7533    /// let x = Gateway::new().set_scope("example");
7534    /// ```
7535    pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7536        self.scope = v.into();
7537        self
7538    }
7539
7540    /// Sets the value of [server_tls_policy][crate::model::Gateway::server_tls_policy].
7541    ///
7542    /// # Example
7543    /// ```ignore,no_run
7544    /// # use google_cloud_networkservices_v1::model::Gateway;
7545    /// let x = Gateway::new().set_server_tls_policy("example");
7546    /// ```
7547    pub fn set_server_tls_policy<T: std::convert::Into<std::string::String>>(
7548        mut self,
7549        v: T,
7550    ) -> Self {
7551        self.server_tls_policy = v.into();
7552        self
7553    }
7554
7555    /// Sets the value of [certificate_urls][crate::model::Gateway::certificate_urls].
7556    ///
7557    /// # Example
7558    /// ```ignore,no_run
7559    /// # use google_cloud_networkservices_v1::model::Gateway;
7560    /// let x = Gateway::new().set_certificate_urls(["a", "b", "c"]);
7561    /// ```
7562    pub fn set_certificate_urls<T, V>(mut self, v: T) -> Self
7563    where
7564        T: std::iter::IntoIterator<Item = V>,
7565        V: std::convert::Into<std::string::String>,
7566    {
7567        use std::iter::Iterator;
7568        self.certificate_urls = v.into_iter().map(|i| i.into()).collect();
7569        self
7570    }
7571
7572    /// Sets the value of [gateway_security_policy][crate::model::Gateway::gateway_security_policy].
7573    ///
7574    /// # Example
7575    /// ```ignore,no_run
7576    /// # use google_cloud_networkservices_v1::model::Gateway;
7577    /// let x = Gateway::new().set_gateway_security_policy("example");
7578    /// ```
7579    pub fn set_gateway_security_policy<T: std::convert::Into<std::string::String>>(
7580        mut self,
7581        v: T,
7582    ) -> Self {
7583        self.gateway_security_policy = v.into();
7584        self
7585    }
7586
7587    /// Sets the value of [network][crate::model::Gateway::network].
7588    ///
7589    /// # Example
7590    /// ```ignore,no_run
7591    /// # use google_cloud_networkservices_v1::model::Gateway;
7592    /// let x = Gateway::new().set_network("example");
7593    /// ```
7594    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7595        self.network = v.into();
7596        self
7597    }
7598
7599    /// Sets the value of [subnetwork][crate::model::Gateway::subnetwork].
7600    ///
7601    /// # Example
7602    /// ```ignore,no_run
7603    /// # use google_cloud_networkservices_v1::model::Gateway;
7604    /// let x = Gateway::new().set_subnetwork("example");
7605    /// ```
7606    pub fn set_subnetwork<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7607        self.subnetwork = v.into();
7608        self
7609    }
7610
7611    /// Sets the value of [ip_version][crate::model::Gateway::ip_version].
7612    ///
7613    /// # Example
7614    /// ```ignore,no_run
7615    /// # use google_cloud_networkservices_v1::model::Gateway;
7616    /// use google_cloud_networkservices_v1::model::gateway::IpVersion;
7617    /// let x0 = Gateway::new().set_ip_version(IpVersion::Ipv4);
7618    /// let x1 = Gateway::new().set_ip_version(IpVersion::Ipv6);
7619    /// ```
7620    pub fn set_ip_version<T: std::convert::Into<crate::model::gateway::IpVersion>>(
7621        mut self,
7622        v: T,
7623    ) -> Self {
7624        self.ip_version = v.into();
7625        self
7626    }
7627
7628    /// Sets the value of [envoy_headers][crate::model::Gateway::envoy_headers].
7629    ///
7630    /// # Example
7631    /// ```ignore,no_run
7632    /// # use google_cloud_networkservices_v1::model::Gateway;
7633    /// use google_cloud_networkservices_v1::model::EnvoyHeaders;
7634    /// let x0 = Gateway::new().set_envoy_headers(EnvoyHeaders::None);
7635    /// let x1 = Gateway::new().set_envoy_headers(EnvoyHeaders::DebugHeaders);
7636    /// ```
7637    pub fn set_envoy_headers<T>(mut self, v: T) -> Self
7638    where
7639        T: std::convert::Into<crate::model::EnvoyHeaders>,
7640    {
7641        self.envoy_headers = std::option::Option::Some(v.into());
7642        self
7643    }
7644
7645    /// Sets or clears the value of [envoy_headers][crate::model::Gateway::envoy_headers].
7646    ///
7647    /// # Example
7648    /// ```ignore,no_run
7649    /// # use google_cloud_networkservices_v1::model::Gateway;
7650    /// use google_cloud_networkservices_v1::model::EnvoyHeaders;
7651    /// let x0 = Gateway::new().set_or_clear_envoy_headers(Some(EnvoyHeaders::None));
7652    /// let x1 = Gateway::new().set_or_clear_envoy_headers(Some(EnvoyHeaders::DebugHeaders));
7653    /// let x_none = Gateway::new().set_or_clear_envoy_headers(None::<EnvoyHeaders>);
7654    /// ```
7655    pub fn set_or_clear_envoy_headers<T>(mut self, v: std::option::Option<T>) -> Self
7656    where
7657        T: std::convert::Into<crate::model::EnvoyHeaders>,
7658    {
7659        self.envoy_headers = v.map(|x| x.into());
7660        self
7661    }
7662
7663    /// Sets the value of [routing_mode][crate::model::Gateway::routing_mode].
7664    ///
7665    /// # Example
7666    /// ```ignore,no_run
7667    /// # use google_cloud_networkservices_v1::model::Gateway;
7668    /// use google_cloud_networkservices_v1::model::gateway::RoutingMode;
7669    /// let x0 = Gateway::new().set_routing_mode(RoutingMode::NextHopRoutingMode);
7670    /// ```
7671    pub fn set_routing_mode<T: std::convert::Into<crate::model::gateway::RoutingMode>>(
7672        mut self,
7673        v: T,
7674    ) -> Self {
7675        self.routing_mode = v.into();
7676        self
7677    }
7678}
7679
7680impl wkt::message::Message for Gateway {
7681    fn typename() -> &'static str {
7682        "type.googleapis.com/google.cloud.networkservices.v1.Gateway"
7683    }
7684}
7685
7686/// Defines additional types related to [Gateway].
7687pub mod gateway {
7688    #[allow(unused_imports)]
7689    use super::*;
7690
7691    /// The type of the customer-managed gateway.
7692    /// Possible values are:
7693    ///
7694    /// * OPEN_MESH
7695    /// * SECURE_WEB_GATEWAY
7696    ///
7697    /// # Working with unknown values
7698    ///
7699    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7700    /// additional enum variants at any time. Adding new variants is not considered
7701    /// a breaking change. Applications should write their code in anticipation of:
7702    ///
7703    /// - New values appearing in future releases of the client library, **and**
7704    /// - New values received dynamically, without application changes.
7705    ///
7706    /// Please consult the [Working with enums] section in the user guide for some
7707    /// guidelines.
7708    ///
7709    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7710    #[derive(Clone, Debug, PartialEq)]
7711    #[non_exhaustive]
7712    pub enum Type {
7713        /// The type of the customer managed gateway is unspecified.
7714        Unspecified,
7715        /// The type of the customer managed gateway is TrafficDirector Open
7716        /// Mesh.
7717        OpenMesh,
7718        /// The type of the customer managed gateway is SecureWebGateway (SWG).
7719        SecureWebGateway,
7720        /// If set, the enum was initialized with an unknown value.
7721        ///
7722        /// Applications can examine the value using [Type::value] or
7723        /// [Type::name].
7724        UnknownValue(r#type::UnknownValue),
7725    }
7726
7727    #[doc(hidden)]
7728    pub mod r#type {
7729        #[allow(unused_imports)]
7730        use super::*;
7731        #[derive(Clone, Debug, PartialEq)]
7732        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7733    }
7734
7735    impl Type {
7736        /// Gets the enum value.
7737        ///
7738        /// Returns `None` if the enum contains an unknown value deserialized from
7739        /// the string representation of enums.
7740        pub fn value(&self) -> std::option::Option<i32> {
7741            match self {
7742                Self::Unspecified => std::option::Option::Some(0),
7743                Self::OpenMesh => std::option::Option::Some(1),
7744                Self::SecureWebGateway => std::option::Option::Some(2),
7745                Self::UnknownValue(u) => u.0.value(),
7746            }
7747        }
7748
7749        /// Gets the enum value as a string.
7750        ///
7751        /// Returns `None` if the enum contains an unknown value deserialized from
7752        /// the integer representation of enums.
7753        pub fn name(&self) -> std::option::Option<&str> {
7754            match self {
7755                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
7756                Self::OpenMesh => std::option::Option::Some("OPEN_MESH"),
7757                Self::SecureWebGateway => std::option::Option::Some("SECURE_WEB_GATEWAY"),
7758                Self::UnknownValue(u) => u.0.name(),
7759            }
7760        }
7761    }
7762
7763    impl std::default::Default for Type {
7764        fn default() -> Self {
7765            use std::convert::From;
7766            Self::from(0)
7767        }
7768    }
7769
7770    impl std::fmt::Display for Type {
7771        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7772            wkt::internal::display_enum(f, self.name(), self.value())
7773        }
7774    }
7775
7776    impl std::convert::From<i32> for Type {
7777        fn from(value: i32) -> Self {
7778            match value {
7779                0 => Self::Unspecified,
7780                1 => Self::OpenMesh,
7781                2 => Self::SecureWebGateway,
7782                _ => Self::UnknownValue(r#type::UnknownValue(
7783                    wkt::internal::UnknownEnumValue::Integer(value),
7784                )),
7785            }
7786        }
7787    }
7788
7789    impl std::convert::From<&str> for Type {
7790        fn from(value: &str) -> Self {
7791            use std::string::ToString;
7792            match value {
7793                "TYPE_UNSPECIFIED" => Self::Unspecified,
7794                "OPEN_MESH" => Self::OpenMesh,
7795                "SECURE_WEB_GATEWAY" => Self::SecureWebGateway,
7796                _ => Self::UnknownValue(r#type::UnknownValue(
7797                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7798                )),
7799            }
7800        }
7801    }
7802
7803    impl serde::ser::Serialize for Type {
7804        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7805        where
7806            S: serde::Serializer,
7807        {
7808            match self {
7809                Self::Unspecified => serializer.serialize_i32(0),
7810                Self::OpenMesh => serializer.serialize_i32(1),
7811                Self::SecureWebGateway => serializer.serialize_i32(2),
7812                Self::UnknownValue(u) => u.0.serialize(serializer),
7813            }
7814        }
7815    }
7816
7817    impl<'de> serde::de::Deserialize<'de> for Type {
7818        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7819        where
7820            D: serde::Deserializer<'de>,
7821        {
7822            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
7823                ".google.cloud.networkservices.v1.Gateway.Type",
7824            ))
7825        }
7826    }
7827
7828    /// The types of IP version for the gateway.
7829    /// Possible values are:
7830    ///
7831    /// * IPV4
7832    /// * IPV6
7833    ///
7834    /// # Working with unknown values
7835    ///
7836    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7837    /// additional enum variants at any time. Adding new variants is not considered
7838    /// a breaking change. Applications should write their code in anticipation of:
7839    ///
7840    /// - New values appearing in future releases of the client library, **and**
7841    /// - New values received dynamically, without application changes.
7842    ///
7843    /// Please consult the [Working with enums] section in the user guide for some
7844    /// guidelines.
7845    ///
7846    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7847    #[derive(Clone, Debug, PartialEq)]
7848    #[non_exhaustive]
7849    pub enum IpVersion {
7850        /// The type when IP version is not specified. Defaults to IPV4.
7851        Unspecified,
7852        /// The type for IP version 4.
7853        Ipv4,
7854        /// The type for IP version 6.
7855        Ipv6,
7856        /// If set, the enum was initialized with an unknown value.
7857        ///
7858        /// Applications can examine the value using [IpVersion::value] or
7859        /// [IpVersion::name].
7860        UnknownValue(ip_version::UnknownValue),
7861    }
7862
7863    #[doc(hidden)]
7864    pub mod ip_version {
7865        #[allow(unused_imports)]
7866        use super::*;
7867        #[derive(Clone, Debug, PartialEq)]
7868        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7869    }
7870
7871    impl IpVersion {
7872        /// Gets the enum value.
7873        ///
7874        /// Returns `None` if the enum contains an unknown value deserialized from
7875        /// the string representation of enums.
7876        pub fn value(&self) -> std::option::Option<i32> {
7877            match self {
7878                Self::Unspecified => std::option::Option::Some(0),
7879                Self::Ipv4 => std::option::Option::Some(1),
7880                Self::Ipv6 => std::option::Option::Some(2),
7881                Self::UnknownValue(u) => u.0.value(),
7882            }
7883        }
7884
7885        /// Gets the enum value as a string.
7886        ///
7887        /// Returns `None` if the enum contains an unknown value deserialized from
7888        /// the integer representation of enums.
7889        pub fn name(&self) -> std::option::Option<&str> {
7890            match self {
7891                Self::Unspecified => std::option::Option::Some("IP_VERSION_UNSPECIFIED"),
7892                Self::Ipv4 => std::option::Option::Some("IPV4"),
7893                Self::Ipv6 => std::option::Option::Some("IPV6"),
7894                Self::UnknownValue(u) => u.0.name(),
7895            }
7896        }
7897    }
7898
7899    impl std::default::Default for IpVersion {
7900        fn default() -> Self {
7901            use std::convert::From;
7902            Self::from(0)
7903        }
7904    }
7905
7906    impl std::fmt::Display for IpVersion {
7907        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7908            wkt::internal::display_enum(f, self.name(), self.value())
7909        }
7910    }
7911
7912    impl std::convert::From<i32> for IpVersion {
7913        fn from(value: i32) -> Self {
7914            match value {
7915                0 => Self::Unspecified,
7916                1 => Self::Ipv4,
7917                2 => Self::Ipv6,
7918                _ => Self::UnknownValue(ip_version::UnknownValue(
7919                    wkt::internal::UnknownEnumValue::Integer(value),
7920                )),
7921            }
7922        }
7923    }
7924
7925    impl std::convert::From<&str> for IpVersion {
7926        fn from(value: &str) -> Self {
7927            use std::string::ToString;
7928            match value {
7929                "IP_VERSION_UNSPECIFIED" => Self::Unspecified,
7930                "IPV4" => Self::Ipv4,
7931                "IPV6" => Self::Ipv6,
7932                _ => Self::UnknownValue(ip_version::UnknownValue(
7933                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7934                )),
7935            }
7936        }
7937    }
7938
7939    impl serde::ser::Serialize for IpVersion {
7940        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7941        where
7942            S: serde::Serializer,
7943        {
7944            match self {
7945                Self::Unspecified => serializer.serialize_i32(0),
7946                Self::Ipv4 => serializer.serialize_i32(1),
7947                Self::Ipv6 => serializer.serialize_i32(2),
7948                Self::UnknownValue(u) => u.0.serialize(serializer),
7949            }
7950        }
7951    }
7952
7953    impl<'de> serde::de::Deserialize<'de> for IpVersion {
7954        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7955        where
7956            D: serde::Deserializer<'de>,
7957        {
7958            deserializer.deserialize_any(wkt::internal::EnumVisitor::<IpVersion>::new(
7959                ".google.cloud.networkservices.v1.Gateway.IpVersion",
7960            ))
7961        }
7962    }
7963
7964    /// The routing mode of the Gateway, to determine how the Gateway routes
7965    /// traffic. Today, this field only applies to Gateways of type
7966    /// SECURE_WEB_GATEWAY. Possible values are:
7967    ///
7968    /// * EXPLICIT_ROUTING_MODE
7969    /// * NEXT_HOP_ROUTING_MODE
7970    ///
7971    /// # Working with unknown values
7972    ///
7973    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7974    /// additional enum variants at any time. Adding new variants is not considered
7975    /// a breaking change. Applications should write their code in anticipation of:
7976    ///
7977    /// - New values appearing in future releases of the client library, **and**
7978    /// - New values received dynamically, without application changes.
7979    ///
7980    /// Please consult the [Working with enums] section in the user guide for some
7981    /// guidelines.
7982    ///
7983    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7984    #[derive(Clone, Debug, PartialEq)]
7985    #[non_exhaustive]
7986    pub enum RoutingMode {
7987        /// The routing mode is explicit; clients are configured to send
7988        /// traffic through the gateway. This is the default routing mode.
7989        ExplicitRoutingMode,
7990        /// The routing mode is next-hop. Clients are unaware of the gateway,
7991        /// and a route (advanced route or other route type)
7992        /// can be configured to direct traffic from client to gateway.
7993        /// The gateway then acts as a next-hop to the destination.
7994        NextHopRoutingMode,
7995        /// If set, the enum was initialized with an unknown value.
7996        ///
7997        /// Applications can examine the value using [RoutingMode::value] or
7998        /// [RoutingMode::name].
7999        UnknownValue(routing_mode::UnknownValue),
8000    }
8001
8002    #[doc(hidden)]
8003    pub mod routing_mode {
8004        #[allow(unused_imports)]
8005        use super::*;
8006        #[derive(Clone, Debug, PartialEq)]
8007        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8008    }
8009
8010    impl RoutingMode {
8011        /// Gets the enum value.
8012        ///
8013        /// Returns `None` if the enum contains an unknown value deserialized from
8014        /// the string representation of enums.
8015        pub fn value(&self) -> std::option::Option<i32> {
8016            match self {
8017                Self::ExplicitRoutingMode => std::option::Option::Some(0),
8018                Self::NextHopRoutingMode => std::option::Option::Some(1),
8019                Self::UnknownValue(u) => u.0.value(),
8020            }
8021        }
8022
8023        /// Gets the enum value as a string.
8024        ///
8025        /// Returns `None` if the enum contains an unknown value deserialized from
8026        /// the integer representation of enums.
8027        pub fn name(&self) -> std::option::Option<&str> {
8028            match self {
8029                Self::ExplicitRoutingMode => std::option::Option::Some("EXPLICIT_ROUTING_MODE"),
8030                Self::NextHopRoutingMode => std::option::Option::Some("NEXT_HOP_ROUTING_MODE"),
8031                Self::UnknownValue(u) => u.0.name(),
8032            }
8033        }
8034    }
8035
8036    impl std::default::Default for RoutingMode {
8037        fn default() -> Self {
8038            use std::convert::From;
8039            Self::from(0)
8040        }
8041    }
8042
8043    impl std::fmt::Display for RoutingMode {
8044        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8045            wkt::internal::display_enum(f, self.name(), self.value())
8046        }
8047    }
8048
8049    impl std::convert::From<i32> for RoutingMode {
8050        fn from(value: i32) -> Self {
8051            match value {
8052                0 => Self::ExplicitRoutingMode,
8053                1 => Self::NextHopRoutingMode,
8054                _ => Self::UnknownValue(routing_mode::UnknownValue(
8055                    wkt::internal::UnknownEnumValue::Integer(value),
8056                )),
8057            }
8058        }
8059    }
8060
8061    impl std::convert::From<&str> for RoutingMode {
8062        fn from(value: &str) -> Self {
8063            use std::string::ToString;
8064            match value {
8065                "EXPLICIT_ROUTING_MODE" => Self::ExplicitRoutingMode,
8066                "NEXT_HOP_ROUTING_MODE" => Self::NextHopRoutingMode,
8067                _ => Self::UnknownValue(routing_mode::UnknownValue(
8068                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8069                )),
8070            }
8071        }
8072    }
8073
8074    impl serde::ser::Serialize for RoutingMode {
8075        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8076        where
8077            S: serde::Serializer,
8078        {
8079            match self {
8080                Self::ExplicitRoutingMode => serializer.serialize_i32(0),
8081                Self::NextHopRoutingMode => serializer.serialize_i32(1),
8082                Self::UnknownValue(u) => u.0.serialize(serializer),
8083            }
8084        }
8085    }
8086
8087    impl<'de> serde::de::Deserialize<'de> for RoutingMode {
8088        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8089        where
8090            D: serde::Deserializer<'de>,
8091        {
8092            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RoutingMode>::new(
8093                ".google.cloud.networkservices.v1.Gateway.RoutingMode",
8094            ))
8095        }
8096    }
8097}
8098
8099/// Request used with the ListGateways method.
8100#[derive(Clone, Default, PartialEq)]
8101#[non_exhaustive]
8102pub struct ListGatewaysRequest {
8103    /// Required. The project and location from which the Gateways should be
8104    /// listed, specified in the format `projects/*/locations/*`.
8105    pub parent: std::string::String,
8106
8107    /// Maximum number of Gateways to return per call.
8108    pub page_size: i32,
8109
8110    /// The value returned by the last `ListGatewaysResponse`
8111    /// Indicates that this is a continuation of a prior `ListGateways` call,
8112    /// and that the system should return the next page of data.
8113    pub page_token: std::string::String,
8114
8115    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8116}
8117
8118impl ListGatewaysRequest {
8119    pub fn new() -> Self {
8120        std::default::Default::default()
8121    }
8122
8123    /// Sets the value of [parent][crate::model::ListGatewaysRequest::parent].
8124    ///
8125    /// # Example
8126    /// ```ignore,no_run
8127    /// # use google_cloud_networkservices_v1::model::ListGatewaysRequest;
8128    /// let x = ListGatewaysRequest::new().set_parent("example");
8129    /// ```
8130    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8131        self.parent = v.into();
8132        self
8133    }
8134
8135    /// Sets the value of [page_size][crate::model::ListGatewaysRequest::page_size].
8136    ///
8137    /// # Example
8138    /// ```ignore,no_run
8139    /// # use google_cloud_networkservices_v1::model::ListGatewaysRequest;
8140    /// let x = ListGatewaysRequest::new().set_page_size(42);
8141    /// ```
8142    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8143        self.page_size = v.into();
8144        self
8145    }
8146
8147    /// Sets the value of [page_token][crate::model::ListGatewaysRequest::page_token].
8148    ///
8149    /// # Example
8150    /// ```ignore,no_run
8151    /// # use google_cloud_networkservices_v1::model::ListGatewaysRequest;
8152    /// let x = ListGatewaysRequest::new().set_page_token("example");
8153    /// ```
8154    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8155        self.page_token = v.into();
8156        self
8157    }
8158}
8159
8160impl wkt::message::Message for ListGatewaysRequest {
8161    fn typename() -> &'static str {
8162        "type.googleapis.com/google.cloud.networkservices.v1.ListGatewaysRequest"
8163    }
8164}
8165
8166/// Response returned by the ListGateways method.
8167#[derive(Clone, Default, PartialEq)]
8168#[non_exhaustive]
8169pub struct ListGatewaysResponse {
8170    /// List of Gateway resources.
8171    pub gateways: std::vec::Vec<crate::model::Gateway>,
8172
8173    /// If there might be more results than those appearing in this response, then
8174    /// `next_page_token` is included. To get the next set of results, call this
8175    /// method again using the value of `next_page_token` as `page_token`.
8176    pub next_page_token: std::string::String,
8177
8178    /// Locations that could not be reached.
8179    pub unreachable: std::vec::Vec<std::string::String>,
8180
8181    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8182}
8183
8184impl ListGatewaysResponse {
8185    pub fn new() -> Self {
8186        std::default::Default::default()
8187    }
8188
8189    /// Sets the value of [gateways][crate::model::ListGatewaysResponse::gateways].
8190    ///
8191    /// # Example
8192    /// ```ignore,no_run
8193    /// # use google_cloud_networkservices_v1::model::ListGatewaysResponse;
8194    /// use google_cloud_networkservices_v1::model::Gateway;
8195    /// let x = ListGatewaysResponse::new()
8196    ///     .set_gateways([
8197    ///         Gateway::default()/* use setters */,
8198    ///         Gateway::default()/* use (different) setters */,
8199    ///     ]);
8200    /// ```
8201    pub fn set_gateways<T, V>(mut self, v: T) -> Self
8202    where
8203        T: std::iter::IntoIterator<Item = V>,
8204        V: std::convert::Into<crate::model::Gateway>,
8205    {
8206        use std::iter::Iterator;
8207        self.gateways = v.into_iter().map(|i| i.into()).collect();
8208        self
8209    }
8210
8211    /// Sets the value of [next_page_token][crate::model::ListGatewaysResponse::next_page_token].
8212    ///
8213    /// # Example
8214    /// ```ignore,no_run
8215    /// # use google_cloud_networkservices_v1::model::ListGatewaysResponse;
8216    /// let x = ListGatewaysResponse::new().set_next_page_token("example");
8217    /// ```
8218    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8219        self.next_page_token = v.into();
8220        self
8221    }
8222
8223    /// Sets the value of [unreachable][crate::model::ListGatewaysResponse::unreachable].
8224    ///
8225    /// # Example
8226    /// ```ignore,no_run
8227    /// # use google_cloud_networkservices_v1::model::ListGatewaysResponse;
8228    /// let x = ListGatewaysResponse::new().set_unreachable(["a", "b", "c"]);
8229    /// ```
8230    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
8231    where
8232        T: std::iter::IntoIterator<Item = V>,
8233        V: std::convert::Into<std::string::String>,
8234    {
8235        use std::iter::Iterator;
8236        self.unreachable = v.into_iter().map(|i| i.into()).collect();
8237        self
8238    }
8239}
8240
8241impl wkt::message::Message for ListGatewaysResponse {
8242    fn typename() -> &'static str {
8243        "type.googleapis.com/google.cloud.networkservices.v1.ListGatewaysResponse"
8244    }
8245}
8246
8247#[doc(hidden)]
8248impl google_cloud_gax::paginator::internal::PageableResponse for ListGatewaysResponse {
8249    type PageItem = crate::model::Gateway;
8250
8251    fn items(self) -> std::vec::Vec<Self::PageItem> {
8252        self.gateways
8253    }
8254
8255    fn next_page_token(&self) -> std::string::String {
8256        use std::clone::Clone;
8257        self.next_page_token.clone()
8258    }
8259}
8260
8261/// Request used by the GetGateway method.
8262#[derive(Clone, Default, PartialEq)]
8263#[non_exhaustive]
8264pub struct GetGatewayRequest {
8265    /// Required. A name of the Gateway to get. Must be in the format
8266    /// `projects/*/locations/*/gateways/*`.
8267    pub name: std::string::String,
8268
8269    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8270}
8271
8272impl GetGatewayRequest {
8273    pub fn new() -> Self {
8274        std::default::Default::default()
8275    }
8276
8277    /// Sets the value of [name][crate::model::GetGatewayRequest::name].
8278    ///
8279    /// # Example
8280    /// ```ignore,no_run
8281    /// # use google_cloud_networkservices_v1::model::GetGatewayRequest;
8282    /// let x = GetGatewayRequest::new().set_name("example");
8283    /// ```
8284    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8285        self.name = v.into();
8286        self
8287    }
8288}
8289
8290impl wkt::message::Message for GetGatewayRequest {
8291    fn typename() -> &'static str {
8292        "type.googleapis.com/google.cloud.networkservices.v1.GetGatewayRequest"
8293    }
8294}
8295
8296/// Request used by the CreateGateway method.
8297#[derive(Clone, Default, PartialEq)]
8298#[non_exhaustive]
8299pub struct CreateGatewayRequest {
8300    /// Required. The parent resource of the Gateway. Must be in the
8301    /// format `projects/*/locations/*`.
8302    pub parent: std::string::String,
8303
8304    /// Required. Short name of the Gateway resource to be created.
8305    pub gateway_id: std::string::String,
8306
8307    /// Required. Gateway resource to be created.
8308    pub gateway: std::option::Option<crate::model::Gateway>,
8309
8310    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8311}
8312
8313impl CreateGatewayRequest {
8314    pub fn new() -> Self {
8315        std::default::Default::default()
8316    }
8317
8318    /// Sets the value of [parent][crate::model::CreateGatewayRequest::parent].
8319    ///
8320    /// # Example
8321    /// ```ignore,no_run
8322    /// # use google_cloud_networkservices_v1::model::CreateGatewayRequest;
8323    /// let x = CreateGatewayRequest::new().set_parent("example");
8324    /// ```
8325    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8326        self.parent = v.into();
8327        self
8328    }
8329
8330    /// Sets the value of [gateway_id][crate::model::CreateGatewayRequest::gateway_id].
8331    ///
8332    /// # Example
8333    /// ```ignore,no_run
8334    /// # use google_cloud_networkservices_v1::model::CreateGatewayRequest;
8335    /// let x = CreateGatewayRequest::new().set_gateway_id("example");
8336    /// ```
8337    pub fn set_gateway_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8338        self.gateway_id = v.into();
8339        self
8340    }
8341
8342    /// Sets the value of [gateway][crate::model::CreateGatewayRequest::gateway].
8343    ///
8344    /// # Example
8345    /// ```ignore,no_run
8346    /// # use google_cloud_networkservices_v1::model::CreateGatewayRequest;
8347    /// use google_cloud_networkservices_v1::model::Gateway;
8348    /// let x = CreateGatewayRequest::new().set_gateway(Gateway::default()/* use setters */);
8349    /// ```
8350    pub fn set_gateway<T>(mut self, v: T) -> Self
8351    where
8352        T: std::convert::Into<crate::model::Gateway>,
8353    {
8354        self.gateway = std::option::Option::Some(v.into());
8355        self
8356    }
8357
8358    /// Sets or clears the value of [gateway][crate::model::CreateGatewayRequest::gateway].
8359    ///
8360    /// # Example
8361    /// ```ignore,no_run
8362    /// # use google_cloud_networkservices_v1::model::CreateGatewayRequest;
8363    /// use google_cloud_networkservices_v1::model::Gateway;
8364    /// let x = CreateGatewayRequest::new().set_or_clear_gateway(Some(Gateway::default()/* use setters */));
8365    /// let x = CreateGatewayRequest::new().set_or_clear_gateway(None::<Gateway>);
8366    /// ```
8367    pub fn set_or_clear_gateway<T>(mut self, v: std::option::Option<T>) -> Self
8368    where
8369        T: std::convert::Into<crate::model::Gateway>,
8370    {
8371        self.gateway = v.map(|x| x.into());
8372        self
8373    }
8374}
8375
8376impl wkt::message::Message for CreateGatewayRequest {
8377    fn typename() -> &'static str {
8378        "type.googleapis.com/google.cloud.networkservices.v1.CreateGatewayRequest"
8379    }
8380}
8381
8382/// Request used by the UpdateGateway method.
8383#[derive(Clone, Default, PartialEq)]
8384#[non_exhaustive]
8385pub struct UpdateGatewayRequest {
8386    /// Optional. Field mask is used to specify the fields to be overwritten in the
8387    /// Gateway resource by the update.
8388    /// The fields specified in the update_mask are relative to the resource, not
8389    /// the full request. A field will be overwritten if it is in the mask. If the
8390    /// user does not provide a mask then all fields will be overwritten.
8391    pub update_mask: std::option::Option<wkt::FieldMask>,
8392
8393    /// Required. Updated Gateway resource.
8394    pub gateway: std::option::Option<crate::model::Gateway>,
8395
8396    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8397}
8398
8399impl UpdateGatewayRequest {
8400    pub fn new() -> Self {
8401        std::default::Default::default()
8402    }
8403
8404    /// Sets the value of [update_mask][crate::model::UpdateGatewayRequest::update_mask].
8405    ///
8406    /// # Example
8407    /// ```ignore,no_run
8408    /// # use google_cloud_networkservices_v1::model::UpdateGatewayRequest;
8409    /// use wkt::FieldMask;
8410    /// let x = UpdateGatewayRequest::new().set_update_mask(FieldMask::default()/* use setters */);
8411    /// ```
8412    pub fn set_update_mask<T>(mut self, v: T) -> Self
8413    where
8414        T: std::convert::Into<wkt::FieldMask>,
8415    {
8416        self.update_mask = std::option::Option::Some(v.into());
8417        self
8418    }
8419
8420    /// Sets or clears the value of [update_mask][crate::model::UpdateGatewayRequest::update_mask].
8421    ///
8422    /// # Example
8423    /// ```ignore,no_run
8424    /// # use google_cloud_networkservices_v1::model::UpdateGatewayRequest;
8425    /// use wkt::FieldMask;
8426    /// let x = UpdateGatewayRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
8427    /// let x = UpdateGatewayRequest::new().set_or_clear_update_mask(None::<FieldMask>);
8428    /// ```
8429    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8430    where
8431        T: std::convert::Into<wkt::FieldMask>,
8432    {
8433        self.update_mask = v.map(|x| x.into());
8434        self
8435    }
8436
8437    /// Sets the value of [gateway][crate::model::UpdateGatewayRequest::gateway].
8438    ///
8439    /// # Example
8440    /// ```ignore,no_run
8441    /// # use google_cloud_networkservices_v1::model::UpdateGatewayRequest;
8442    /// use google_cloud_networkservices_v1::model::Gateway;
8443    /// let x = UpdateGatewayRequest::new().set_gateway(Gateway::default()/* use setters */);
8444    /// ```
8445    pub fn set_gateway<T>(mut self, v: T) -> Self
8446    where
8447        T: std::convert::Into<crate::model::Gateway>,
8448    {
8449        self.gateway = std::option::Option::Some(v.into());
8450        self
8451    }
8452
8453    /// Sets or clears the value of [gateway][crate::model::UpdateGatewayRequest::gateway].
8454    ///
8455    /// # Example
8456    /// ```ignore,no_run
8457    /// # use google_cloud_networkservices_v1::model::UpdateGatewayRequest;
8458    /// use google_cloud_networkservices_v1::model::Gateway;
8459    /// let x = UpdateGatewayRequest::new().set_or_clear_gateway(Some(Gateway::default()/* use setters */));
8460    /// let x = UpdateGatewayRequest::new().set_or_clear_gateway(None::<Gateway>);
8461    /// ```
8462    pub fn set_or_clear_gateway<T>(mut self, v: std::option::Option<T>) -> Self
8463    where
8464        T: std::convert::Into<crate::model::Gateway>,
8465    {
8466        self.gateway = v.map(|x| x.into());
8467        self
8468    }
8469}
8470
8471impl wkt::message::Message for UpdateGatewayRequest {
8472    fn typename() -> &'static str {
8473        "type.googleapis.com/google.cloud.networkservices.v1.UpdateGatewayRequest"
8474    }
8475}
8476
8477/// Request used by the DeleteGateway method.
8478#[derive(Clone, Default, PartialEq)]
8479#[non_exhaustive]
8480pub struct DeleteGatewayRequest {
8481    /// Required. A name of the Gateway to delete. Must be in the format
8482    /// `projects/*/locations/*/gateways/*`.
8483    pub name: std::string::String,
8484
8485    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8486}
8487
8488impl DeleteGatewayRequest {
8489    pub fn new() -> Self {
8490        std::default::Default::default()
8491    }
8492
8493    /// Sets the value of [name][crate::model::DeleteGatewayRequest::name].
8494    ///
8495    /// # Example
8496    /// ```ignore,no_run
8497    /// # use google_cloud_networkservices_v1::model::DeleteGatewayRequest;
8498    /// let x = DeleteGatewayRequest::new().set_name("example");
8499    /// ```
8500    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8501        self.name = v.into();
8502        self
8503    }
8504}
8505
8506impl wkt::message::Message for DeleteGatewayRequest {
8507    fn typename() -> &'static str {
8508        "type.googleapis.com/google.cloud.networkservices.v1.DeleteGatewayRequest"
8509    }
8510}
8511
8512/// GrpcRoute is the resource defining how gRPC traffic routed by a Mesh
8513/// or Gateway resource is routed.
8514#[derive(Clone, Default, PartialEq)]
8515#[non_exhaustive]
8516pub struct GrpcRoute {
8517    /// Identifier. Name of the GrpcRoute resource. It matches pattern
8518    /// `projects/*/locations/global/grpcRoutes/<grpc_route_name>`
8519    pub name: std::string::String,
8520
8521    /// Output only. Server-defined URL of this resource
8522    pub self_link: std::string::String,
8523
8524    /// Output only. The timestamp when the resource was created.
8525    pub create_time: std::option::Option<wkt::Timestamp>,
8526
8527    /// Output only. The timestamp when the resource was updated.
8528    pub update_time: std::option::Option<wkt::Timestamp>,
8529
8530    /// Optional. Set of label tags associated with the GrpcRoute resource.
8531    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
8532
8533    /// Optional. A free-text description of the resource. Max length 1024
8534    /// characters.
8535    pub description: std::string::String,
8536
8537    /// Required. Service hostnames with an optional port for which this route
8538    /// describes traffic.
8539    ///
8540    /// Format: \<hostname\>[:\<port\>]
8541    ///
8542    /// Hostname is the fully qualified domain name of a network host. This matches
8543    /// the RFC 1123 definition of a hostname with 2 notable exceptions:
8544    ///
8545    /// - IPs are not allowed.
8546    /// - A hostname may be prefixed with a wildcard label (`*.`). The wildcard
8547    ///   label must appear by itself as the first label.
8548    ///
8549    /// Hostname can be "precise" which is a domain name without the terminating
8550    /// dot of a network host (e.g. `foo.example.com`) or "wildcard", which is a
8551    /// domain name prefixed with a single wildcard label (e.g. `*.example.com`).
8552    ///
8553    /// Note that as per RFC1035 and RFC1123, a label must consist of lower case
8554    /// alphanumeric characters or '-', and must start and end with an alphanumeric
8555    /// character. No other punctuation is allowed.
8556    ///
8557    /// The routes associated with a Mesh or Gateway must have unique hostnames. If
8558    /// you attempt to attach multiple routes with conflicting hostnames, the
8559    /// configuration will be rejected.
8560    ///
8561    /// For example, while it is acceptable for routes for the hostnames
8562    /// `*.foo.bar.com` and `*.bar.com` to be associated with the same route, it is
8563    /// not possible to associate two routes both with `*.bar.com` or both with
8564    /// `bar.com`.
8565    ///
8566    /// If a port is specified, then gRPC clients must use the channel URI with the
8567    /// port to match this rule (i.e. "xds:///service:123"), otherwise they must
8568    /// supply the URI without a port (i.e. "xds:///service").
8569    pub hostnames: std::vec::Vec<std::string::String>,
8570
8571    /// Optional. Meshes defines a list of meshes this GrpcRoute is attached to, as
8572    /// one of the routing rules to route the requests served by the mesh.
8573    ///
8574    /// Each mesh reference should match the pattern:
8575    /// `projects/*/locations/global/meshes/<mesh_name>`
8576    pub meshes: std::vec::Vec<std::string::String>,
8577
8578    /// Optional. Gateways defines a list of gateways this GrpcRoute is attached
8579    /// to, as one of the routing rules to route the requests served by the
8580    /// gateway.
8581    ///
8582    /// Each gateway reference should match the pattern:
8583    /// `projects/*/locations/global/gateways/<gateway_name>`
8584    pub gateways: std::vec::Vec<std::string::String>,
8585
8586    /// Required. A list of detailed rules defining how to route traffic.
8587    ///
8588    /// Within a single GrpcRoute, the GrpcRoute.RouteAction associated with the
8589    /// first matching GrpcRoute.RouteRule will be executed. At least one rule
8590    /// must be supplied.
8591    pub rules: std::vec::Vec<crate::model::grpc_route::RouteRule>,
8592
8593    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8594}
8595
8596impl GrpcRoute {
8597    pub fn new() -> Self {
8598        std::default::Default::default()
8599    }
8600
8601    /// Sets the value of [name][crate::model::GrpcRoute::name].
8602    ///
8603    /// # Example
8604    /// ```ignore,no_run
8605    /// # use google_cloud_networkservices_v1::model::GrpcRoute;
8606    /// let x = GrpcRoute::new().set_name("example");
8607    /// ```
8608    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8609        self.name = v.into();
8610        self
8611    }
8612
8613    /// Sets the value of [self_link][crate::model::GrpcRoute::self_link].
8614    ///
8615    /// # Example
8616    /// ```ignore,no_run
8617    /// # use google_cloud_networkservices_v1::model::GrpcRoute;
8618    /// let x = GrpcRoute::new().set_self_link("example");
8619    /// ```
8620    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8621        self.self_link = v.into();
8622        self
8623    }
8624
8625    /// Sets the value of [create_time][crate::model::GrpcRoute::create_time].
8626    ///
8627    /// # Example
8628    /// ```ignore,no_run
8629    /// # use google_cloud_networkservices_v1::model::GrpcRoute;
8630    /// use wkt::Timestamp;
8631    /// let x = GrpcRoute::new().set_create_time(Timestamp::default()/* use setters */);
8632    /// ```
8633    pub fn set_create_time<T>(mut self, v: T) -> Self
8634    where
8635        T: std::convert::Into<wkt::Timestamp>,
8636    {
8637        self.create_time = std::option::Option::Some(v.into());
8638        self
8639    }
8640
8641    /// Sets or clears the value of [create_time][crate::model::GrpcRoute::create_time].
8642    ///
8643    /// # Example
8644    /// ```ignore,no_run
8645    /// # use google_cloud_networkservices_v1::model::GrpcRoute;
8646    /// use wkt::Timestamp;
8647    /// let x = GrpcRoute::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
8648    /// let x = GrpcRoute::new().set_or_clear_create_time(None::<Timestamp>);
8649    /// ```
8650    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8651    where
8652        T: std::convert::Into<wkt::Timestamp>,
8653    {
8654        self.create_time = v.map(|x| x.into());
8655        self
8656    }
8657
8658    /// Sets the value of [update_time][crate::model::GrpcRoute::update_time].
8659    ///
8660    /// # Example
8661    /// ```ignore,no_run
8662    /// # use google_cloud_networkservices_v1::model::GrpcRoute;
8663    /// use wkt::Timestamp;
8664    /// let x = GrpcRoute::new().set_update_time(Timestamp::default()/* use setters */);
8665    /// ```
8666    pub fn set_update_time<T>(mut self, v: T) -> Self
8667    where
8668        T: std::convert::Into<wkt::Timestamp>,
8669    {
8670        self.update_time = std::option::Option::Some(v.into());
8671        self
8672    }
8673
8674    /// Sets or clears the value of [update_time][crate::model::GrpcRoute::update_time].
8675    ///
8676    /// # Example
8677    /// ```ignore,no_run
8678    /// # use google_cloud_networkservices_v1::model::GrpcRoute;
8679    /// use wkt::Timestamp;
8680    /// let x = GrpcRoute::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
8681    /// let x = GrpcRoute::new().set_or_clear_update_time(None::<Timestamp>);
8682    /// ```
8683    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
8684    where
8685        T: std::convert::Into<wkt::Timestamp>,
8686    {
8687        self.update_time = v.map(|x| x.into());
8688        self
8689    }
8690
8691    /// Sets the value of [labels][crate::model::GrpcRoute::labels].
8692    ///
8693    /// # Example
8694    /// ```ignore,no_run
8695    /// # use google_cloud_networkservices_v1::model::GrpcRoute;
8696    /// let x = GrpcRoute::new().set_labels([
8697    ///     ("key0", "abc"),
8698    ///     ("key1", "xyz"),
8699    /// ]);
8700    /// ```
8701    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
8702    where
8703        T: std::iter::IntoIterator<Item = (K, V)>,
8704        K: std::convert::Into<std::string::String>,
8705        V: std::convert::Into<std::string::String>,
8706    {
8707        use std::iter::Iterator;
8708        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8709        self
8710    }
8711
8712    /// Sets the value of [description][crate::model::GrpcRoute::description].
8713    ///
8714    /// # Example
8715    /// ```ignore,no_run
8716    /// # use google_cloud_networkservices_v1::model::GrpcRoute;
8717    /// let x = GrpcRoute::new().set_description("example");
8718    /// ```
8719    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8720        self.description = v.into();
8721        self
8722    }
8723
8724    /// Sets the value of [hostnames][crate::model::GrpcRoute::hostnames].
8725    ///
8726    /// # Example
8727    /// ```ignore,no_run
8728    /// # use google_cloud_networkservices_v1::model::GrpcRoute;
8729    /// let x = GrpcRoute::new().set_hostnames(["a", "b", "c"]);
8730    /// ```
8731    pub fn set_hostnames<T, V>(mut self, v: T) -> Self
8732    where
8733        T: std::iter::IntoIterator<Item = V>,
8734        V: std::convert::Into<std::string::String>,
8735    {
8736        use std::iter::Iterator;
8737        self.hostnames = v.into_iter().map(|i| i.into()).collect();
8738        self
8739    }
8740
8741    /// Sets the value of [meshes][crate::model::GrpcRoute::meshes].
8742    ///
8743    /// # Example
8744    /// ```ignore,no_run
8745    /// # use google_cloud_networkservices_v1::model::GrpcRoute;
8746    /// let x = GrpcRoute::new().set_meshes(["a", "b", "c"]);
8747    /// ```
8748    pub fn set_meshes<T, V>(mut self, v: T) -> Self
8749    where
8750        T: std::iter::IntoIterator<Item = V>,
8751        V: std::convert::Into<std::string::String>,
8752    {
8753        use std::iter::Iterator;
8754        self.meshes = v.into_iter().map(|i| i.into()).collect();
8755        self
8756    }
8757
8758    /// Sets the value of [gateways][crate::model::GrpcRoute::gateways].
8759    ///
8760    /// # Example
8761    /// ```ignore,no_run
8762    /// # use google_cloud_networkservices_v1::model::GrpcRoute;
8763    /// let x = GrpcRoute::new().set_gateways(["a", "b", "c"]);
8764    /// ```
8765    pub fn set_gateways<T, V>(mut self, v: T) -> Self
8766    where
8767        T: std::iter::IntoIterator<Item = V>,
8768        V: std::convert::Into<std::string::String>,
8769    {
8770        use std::iter::Iterator;
8771        self.gateways = v.into_iter().map(|i| i.into()).collect();
8772        self
8773    }
8774
8775    /// Sets the value of [rules][crate::model::GrpcRoute::rules].
8776    ///
8777    /// # Example
8778    /// ```ignore,no_run
8779    /// # use google_cloud_networkservices_v1::model::GrpcRoute;
8780    /// use google_cloud_networkservices_v1::model::grpc_route::RouteRule;
8781    /// let x = GrpcRoute::new()
8782    ///     .set_rules([
8783    ///         RouteRule::default()/* use setters */,
8784    ///         RouteRule::default()/* use (different) setters */,
8785    ///     ]);
8786    /// ```
8787    pub fn set_rules<T, V>(mut self, v: T) -> Self
8788    where
8789        T: std::iter::IntoIterator<Item = V>,
8790        V: std::convert::Into<crate::model::grpc_route::RouteRule>,
8791    {
8792        use std::iter::Iterator;
8793        self.rules = v.into_iter().map(|i| i.into()).collect();
8794        self
8795    }
8796}
8797
8798impl wkt::message::Message for GrpcRoute {
8799    fn typename() -> &'static str {
8800        "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute"
8801    }
8802}
8803
8804/// Defines additional types related to [GrpcRoute].
8805pub mod grpc_route {
8806    #[allow(unused_imports)]
8807    use super::*;
8808
8809    /// Specifies a match against a method.
8810    #[derive(Clone, Default, PartialEq)]
8811    #[non_exhaustive]
8812    pub struct MethodMatch {
8813        /// Optional. Specifies how to match against the name. If not specified, a
8814        /// default value of "EXACT" is used.
8815        pub r#type: crate::model::grpc_route::method_match::Type,
8816
8817        /// Required. Name of the service to match against. If unspecified, will
8818        /// match all services.
8819        pub grpc_service: std::string::String,
8820
8821        /// Required. Name of the method to match against. If unspecified, will match
8822        /// all methods.
8823        pub grpc_method: std::string::String,
8824
8825        /// Optional. Specifies that matches are case sensitive.  The default value
8826        /// is true. case_sensitive must not be used with a type of
8827        /// REGULAR_EXPRESSION.
8828        pub case_sensitive: std::option::Option<bool>,
8829
8830        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8831    }
8832
8833    impl MethodMatch {
8834        pub fn new() -> Self {
8835            std::default::Default::default()
8836        }
8837
8838        /// Sets the value of [r#type][crate::model::grpc_route::MethodMatch::type].
8839        ///
8840        /// # Example
8841        /// ```ignore,no_run
8842        /// # use google_cloud_networkservices_v1::model::grpc_route::MethodMatch;
8843        /// use google_cloud_networkservices_v1::model::grpc_route::method_match::Type;
8844        /// let x0 = MethodMatch::new().set_type(Type::Exact);
8845        /// let x1 = MethodMatch::new().set_type(Type::RegularExpression);
8846        /// ```
8847        pub fn set_type<T: std::convert::Into<crate::model::grpc_route::method_match::Type>>(
8848            mut self,
8849            v: T,
8850        ) -> Self {
8851            self.r#type = v.into();
8852            self
8853        }
8854
8855        /// Sets the value of [grpc_service][crate::model::grpc_route::MethodMatch::grpc_service].
8856        ///
8857        /// # Example
8858        /// ```ignore,no_run
8859        /// # use google_cloud_networkservices_v1::model::grpc_route::MethodMatch;
8860        /// let x = MethodMatch::new().set_grpc_service("example");
8861        /// ```
8862        pub fn set_grpc_service<T: std::convert::Into<std::string::String>>(
8863            mut self,
8864            v: T,
8865        ) -> Self {
8866            self.grpc_service = v.into();
8867            self
8868        }
8869
8870        /// Sets the value of [grpc_method][crate::model::grpc_route::MethodMatch::grpc_method].
8871        ///
8872        /// # Example
8873        /// ```ignore,no_run
8874        /// # use google_cloud_networkservices_v1::model::grpc_route::MethodMatch;
8875        /// let x = MethodMatch::new().set_grpc_method("example");
8876        /// ```
8877        pub fn set_grpc_method<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8878            self.grpc_method = v.into();
8879            self
8880        }
8881
8882        /// Sets the value of [case_sensitive][crate::model::grpc_route::MethodMatch::case_sensitive].
8883        ///
8884        /// # Example
8885        /// ```ignore,no_run
8886        /// # use google_cloud_networkservices_v1::model::grpc_route::MethodMatch;
8887        /// let x = MethodMatch::new().set_case_sensitive(true);
8888        /// ```
8889        pub fn set_case_sensitive<T>(mut self, v: T) -> Self
8890        where
8891            T: std::convert::Into<bool>,
8892        {
8893            self.case_sensitive = std::option::Option::Some(v.into());
8894            self
8895        }
8896
8897        /// Sets or clears the value of [case_sensitive][crate::model::grpc_route::MethodMatch::case_sensitive].
8898        ///
8899        /// # Example
8900        /// ```ignore,no_run
8901        /// # use google_cloud_networkservices_v1::model::grpc_route::MethodMatch;
8902        /// let x = MethodMatch::new().set_or_clear_case_sensitive(Some(false));
8903        /// let x = MethodMatch::new().set_or_clear_case_sensitive(None::<bool>);
8904        /// ```
8905        pub fn set_or_clear_case_sensitive<T>(mut self, v: std::option::Option<T>) -> Self
8906        where
8907            T: std::convert::Into<bool>,
8908        {
8909            self.case_sensitive = v.map(|x| x.into());
8910            self
8911        }
8912    }
8913
8914    impl wkt::message::Message for MethodMatch {
8915        fn typename() -> &'static str {
8916            "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.MethodMatch"
8917        }
8918    }
8919
8920    /// Defines additional types related to [MethodMatch].
8921    pub mod method_match {
8922        #[allow(unused_imports)]
8923        use super::*;
8924
8925        /// The type of the match.
8926        ///
8927        /// # Working with unknown values
8928        ///
8929        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8930        /// additional enum variants at any time. Adding new variants is not considered
8931        /// a breaking change. Applications should write their code in anticipation of:
8932        ///
8933        /// - New values appearing in future releases of the client library, **and**
8934        /// - New values received dynamically, without application changes.
8935        ///
8936        /// Please consult the [Working with enums] section in the user guide for some
8937        /// guidelines.
8938        ///
8939        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8940        #[derive(Clone, Debug, PartialEq)]
8941        #[non_exhaustive]
8942        pub enum Type {
8943            /// Unspecified.
8944            Unspecified,
8945            /// Will only match the exact name provided.
8946            Exact,
8947            /// Will interpret grpc_method and grpc_service as regexes. RE2 syntax is
8948            /// supported.
8949            RegularExpression,
8950            /// If set, the enum was initialized with an unknown value.
8951            ///
8952            /// Applications can examine the value using [Type::value] or
8953            /// [Type::name].
8954            UnknownValue(r#type::UnknownValue),
8955        }
8956
8957        #[doc(hidden)]
8958        pub mod r#type {
8959            #[allow(unused_imports)]
8960            use super::*;
8961            #[derive(Clone, Debug, PartialEq)]
8962            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8963        }
8964
8965        impl Type {
8966            /// Gets the enum value.
8967            ///
8968            /// Returns `None` if the enum contains an unknown value deserialized from
8969            /// the string representation of enums.
8970            pub fn value(&self) -> std::option::Option<i32> {
8971                match self {
8972                    Self::Unspecified => std::option::Option::Some(0),
8973                    Self::Exact => std::option::Option::Some(1),
8974                    Self::RegularExpression => std::option::Option::Some(2),
8975                    Self::UnknownValue(u) => u.0.value(),
8976                }
8977            }
8978
8979            /// Gets the enum value as a string.
8980            ///
8981            /// Returns `None` if the enum contains an unknown value deserialized from
8982            /// the integer representation of enums.
8983            pub fn name(&self) -> std::option::Option<&str> {
8984                match self {
8985                    Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
8986                    Self::Exact => std::option::Option::Some("EXACT"),
8987                    Self::RegularExpression => std::option::Option::Some("REGULAR_EXPRESSION"),
8988                    Self::UnknownValue(u) => u.0.name(),
8989                }
8990            }
8991        }
8992
8993        impl std::default::Default for Type {
8994            fn default() -> Self {
8995                use std::convert::From;
8996                Self::from(0)
8997            }
8998        }
8999
9000        impl std::fmt::Display for Type {
9001            fn fmt(
9002                &self,
9003                f: &mut std::fmt::Formatter<'_>,
9004            ) -> std::result::Result<(), std::fmt::Error> {
9005                wkt::internal::display_enum(f, self.name(), self.value())
9006            }
9007        }
9008
9009        impl std::convert::From<i32> for Type {
9010            fn from(value: i32) -> Self {
9011                match value {
9012                    0 => Self::Unspecified,
9013                    1 => Self::Exact,
9014                    2 => Self::RegularExpression,
9015                    _ => Self::UnknownValue(r#type::UnknownValue(
9016                        wkt::internal::UnknownEnumValue::Integer(value),
9017                    )),
9018                }
9019            }
9020        }
9021
9022        impl std::convert::From<&str> for Type {
9023            fn from(value: &str) -> Self {
9024                use std::string::ToString;
9025                match value {
9026                    "TYPE_UNSPECIFIED" => Self::Unspecified,
9027                    "EXACT" => Self::Exact,
9028                    "REGULAR_EXPRESSION" => Self::RegularExpression,
9029                    _ => Self::UnknownValue(r#type::UnknownValue(
9030                        wkt::internal::UnknownEnumValue::String(value.to_string()),
9031                    )),
9032                }
9033            }
9034        }
9035
9036        impl serde::ser::Serialize for Type {
9037            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9038            where
9039                S: serde::Serializer,
9040            {
9041                match self {
9042                    Self::Unspecified => serializer.serialize_i32(0),
9043                    Self::Exact => serializer.serialize_i32(1),
9044                    Self::RegularExpression => serializer.serialize_i32(2),
9045                    Self::UnknownValue(u) => u.0.serialize(serializer),
9046                }
9047            }
9048        }
9049
9050        impl<'de> serde::de::Deserialize<'de> for Type {
9051            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9052            where
9053                D: serde::Deserializer<'de>,
9054            {
9055                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
9056                    ".google.cloud.networkservices.v1.GrpcRoute.MethodMatch.Type",
9057                ))
9058            }
9059        }
9060    }
9061
9062    /// A match against a collection of headers.
9063    #[derive(Clone, Default, PartialEq)]
9064    #[non_exhaustive]
9065    pub struct HeaderMatch {
9066        /// Optional. Specifies how to match against the value of the header. If not
9067        /// specified, a default value of EXACT is used.
9068        pub r#type: crate::model::grpc_route::header_match::Type,
9069
9070        /// Required. The key of the header.
9071        pub key: std::string::String,
9072
9073        /// Required. The value of the header.
9074        pub value: std::string::String,
9075
9076        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9077    }
9078
9079    impl HeaderMatch {
9080        pub fn new() -> Self {
9081            std::default::Default::default()
9082        }
9083
9084        /// Sets the value of [r#type][crate::model::grpc_route::HeaderMatch::type].
9085        ///
9086        /// # Example
9087        /// ```ignore,no_run
9088        /// # use google_cloud_networkservices_v1::model::grpc_route::HeaderMatch;
9089        /// use google_cloud_networkservices_v1::model::grpc_route::header_match::Type;
9090        /// let x0 = HeaderMatch::new().set_type(Type::Exact);
9091        /// let x1 = HeaderMatch::new().set_type(Type::RegularExpression);
9092        /// ```
9093        pub fn set_type<T: std::convert::Into<crate::model::grpc_route::header_match::Type>>(
9094            mut self,
9095            v: T,
9096        ) -> Self {
9097            self.r#type = v.into();
9098            self
9099        }
9100
9101        /// Sets the value of [key][crate::model::grpc_route::HeaderMatch::key].
9102        ///
9103        /// # Example
9104        /// ```ignore,no_run
9105        /// # use google_cloud_networkservices_v1::model::grpc_route::HeaderMatch;
9106        /// let x = HeaderMatch::new().set_key("example");
9107        /// ```
9108        pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9109            self.key = v.into();
9110            self
9111        }
9112
9113        /// Sets the value of [value][crate::model::grpc_route::HeaderMatch::value].
9114        ///
9115        /// # Example
9116        /// ```ignore,no_run
9117        /// # use google_cloud_networkservices_v1::model::grpc_route::HeaderMatch;
9118        /// let x = HeaderMatch::new().set_value("example");
9119        /// ```
9120        pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9121            self.value = v.into();
9122            self
9123        }
9124    }
9125
9126    impl wkt::message::Message for HeaderMatch {
9127        fn typename() -> &'static str {
9128            "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.HeaderMatch"
9129        }
9130    }
9131
9132    /// Defines additional types related to [HeaderMatch].
9133    pub mod header_match {
9134        #[allow(unused_imports)]
9135        use super::*;
9136
9137        /// The type of match.
9138        ///
9139        /// # Working with unknown values
9140        ///
9141        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9142        /// additional enum variants at any time. Adding new variants is not considered
9143        /// a breaking change. Applications should write their code in anticipation of:
9144        ///
9145        /// - New values appearing in future releases of the client library, **and**
9146        /// - New values received dynamically, without application changes.
9147        ///
9148        /// Please consult the [Working with enums] section in the user guide for some
9149        /// guidelines.
9150        ///
9151        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9152        #[derive(Clone, Debug, PartialEq)]
9153        #[non_exhaustive]
9154        pub enum Type {
9155            /// Unspecified.
9156            Unspecified,
9157            /// Will only match the exact value provided.
9158            Exact,
9159            /// Will match paths conforming to the prefix specified by value. RE2
9160            /// syntax is supported.
9161            RegularExpression,
9162            /// If set, the enum was initialized with an unknown value.
9163            ///
9164            /// Applications can examine the value using [Type::value] or
9165            /// [Type::name].
9166            UnknownValue(r#type::UnknownValue),
9167        }
9168
9169        #[doc(hidden)]
9170        pub mod r#type {
9171            #[allow(unused_imports)]
9172            use super::*;
9173            #[derive(Clone, Debug, PartialEq)]
9174            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9175        }
9176
9177        impl Type {
9178            /// Gets the enum value.
9179            ///
9180            /// Returns `None` if the enum contains an unknown value deserialized from
9181            /// the string representation of enums.
9182            pub fn value(&self) -> std::option::Option<i32> {
9183                match self {
9184                    Self::Unspecified => std::option::Option::Some(0),
9185                    Self::Exact => std::option::Option::Some(1),
9186                    Self::RegularExpression => std::option::Option::Some(2),
9187                    Self::UnknownValue(u) => u.0.value(),
9188                }
9189            }
9190
9191            /// Gets the enum value as a string.
9192            ///
9193            /// Returns `None` if the enum contains an unknown value deserialized from
9194            /// the integer representation of enums.
9195            pub fn name(&self) -> std::option::Option<&str> {
9196                match self {
9197                    Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
9198                    Self::Exact => std::option::Option::Some("EXACT"),
9199                    Self::RegularExpression => std::option::Option::Some("REGULAR_EXPRESSION"),
9200                    Self::UnknownValue(u) => u.0.name(),
9201                }
9202            }
9203        }
9204
9205        impl std::default::Default for Type {
9206            fn default() -> Self {
9207                use std::convert::From;
9208                Self::from(0)
9209            }
9210        }
9211
9212        impl std::fmt::Display for Type {
9213            fn fmt(
9214                &self,
9215                f: &mut std::fmt::Formatter<'_>,
9216            ) -> std::result::Result<(), std::fmt::Error> {
9217                wkt::internal::display_enum(f, self.name(), self.value())
9218            }
9219        }
9220
9221        impl std::convert::From<i32> for Type {
9222            fn from(value: i32) -> Self {
9223                match value {
9224                    0 => Self::Unspecified,
9225                    1 => Self::Exact,
9226                    2 => Self::RegularExpression,
9227                    _ => Self::UnknownValue(r#type::UnknownValue(
9228                        wkt::internal::UnknownEnumValue::Integer(value),
9229                    )),
9230                }
9231            }
9232        }
9233
9234        impl std::convert::From<&str> for Type {
9235            fn from(value: &str) -> Self {
9236                use std::string::ToString;
9237                match value {
9238                    "TYPE_UNSPECIFIED" => Self::Unspecified,
9239                    "EXACT" => Self::Exact,
9240                    "REGULAR_EXPRESSION" => Self::RegularExpression,
9241                    _ => Self::UnknownValue(r#type::UnknownValue(
9242                        wkt::internal::UnknownEnumValue::String(value.to_string()),
9243                    )),
9244                }
9245            }
9246        }
9247
9248        impl serde::ser::Serialize for Type {
9249            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9250            where
9251                S: serde::Serializer,
9252            {
9253                match self {
9254                    Self::Unspecified => serializer.serialize_i32(0),
9255                    Self::Exact => serializer.serialize_i32(1),
9256                    Self::RegularExpression => serializer.serialize_i32(2),
9257                    Self::UnknownValue(u) => u.0.serialize(serializer),
9258                }
9259            }
9260        }
9261
9262        impl<'de> serde::de::Deserialize<'de> for Type {
9263            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9264            where
9265                D: serde::Deserializer<'de>,
9266            {
9267                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
9268                    ".google.cloud.networkservices.v1.GrpcRoute.HeaderMatch.Type",
9269                ))
9270            }
9271        }
9272    }
9273
9274    /// Criteria for matching traffic. A RouteMatch will be considered to match
9275    /// when all supplied fields match.
9276    #[derive(Clone, Default, PartialEq)]
9277    #[non_exhaustive]
9278    pub struct RouteMatch {
9279        /// Optional. A gRPC method to match against. If this field is empty or
9280        /// omitted, will match all methods.
9281        pub method: std::option::Option<crate::model::grpc_route::MethodMatch>,
9282
9283        /// Optional. Specifies a collection of headers to match.
9284        pub headers: std::vec::Vec<crate::model::grpc_route::HeaderMatch>,
9285
9286        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9287    }
9288
9289    impl RouteMatch {
9290        pub fn new() -> Self {
9291            std::default::Default::default()
9292        }
9293
9294        /// Sets the value of [method][crate::model::grpc_route::RouteMatch::method].
9295        ///
9296        /// # Example
9297        /// ```ignore,no_run
9298        /// # use google_cloud_networkservices_v1::model::grpc_route::RouteMatch;
9299        /// use google_cloud_networkservices_v1::model::grpc_route::MethodMatch;
9300        /// let x = RouteMatch::new().set_method(MethodMatch::default()/* use setters */);
9301        /// ```
9302        pub fn set_method<T>(mut self, v: T) -> Self
9303        where
9304            T: std::convert::Into<crate::model::grpc_route::MethodMatch>,
9305        {
9306            self.method = std::option::Option::Some(v.into());
9307            self
9308        }
9309
9310        /// Sets or clears the value of [method][crate::model::grpc_route::RouteMatch::method].
9311        ///
9312        /// # Example
9313        /// ```ignore,no_run
9314        /// # use google_cloud_networkservices_v1::model::grpc_route::RouteMatch;
9315        /// use google_cloud_networkservices_v1::model::grpc_route::MethodMatch;
9316        /// let x = RouteMatch::new().set_or_clear_method(Some(MethodMatch::default()/* use setters */));
9317        /// let x = RouteMatch::new().set_or_clear_method(None::<MethodMatch>);
9318        /// ```
9319        pub fn set_or_clear_method<T>(mut self, v: std::option::Option<T>) -> Self
9320        where
9321            T: std::convert::Into<crate::model::grpc_route::MethodMatch>,
9322        {
9323            self.method = v.map(|x| x.into());
9324            self
9325        }
9326
9327        /// Sets the value of [headers][crate::model::grpc_route::RouteMatch::headers].
9328        ///
9329        /// # Example
9330        /// ```ignore,no_run
9331        /// # use google_cloud_networkservices_v1::model::grpc_route::RouteMatch;
9332        /// use google_cloud_networkservices_v1::model::grpc_route::HeaderMatch;
9333        /// let x = RouteMatch::new()
9334        ///     .set_headers([
9335        ///         HeaderMatch::default()/* use setters */,
9336        ///         HeaderMatch::default()/* use (different) setters */,
9337        ///     ]);
9338        /// ```
9339        pub fn set_headers<T, V>(mut self, v: T) -> Self
9340        where
9341            T: std::iter::IntoIterator<Item = V>,
9342            V: std::convert::Into<crate::model::grpc_route::HeaderMatch>,
9343        {
9344            use std::iter::Iterator;
9345            self.headers = v.into_iter().map(|i| i.into()).collect();
9346            self
9347        }
9348    }
9349
9350    impl wkt::message::Message for RouteMatch {
9351        fn typename() -> &'static str {
9352            "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.RouteMatch"
9353        }
9354    }
9355
9356    /// The destination to which traffic will be routed.
9357    #[derive(Clone, Default, PartialEq)]
9358    #[non_exhaustive]
9359    pub struct Destination {
9360        /// Optional. Specifies the proportion of requests forwarded to the backend
9361        /// referenced by the serviceName field. This is computed as:
9362        ///
9363        /// - weight/Sum(weights in this destination list).
9364        ///   For non-zero values, there may be some epsilon from the exact proportion
9365        ///   defined here depending on the precision an implementation supports.
9366        ///
9367        /// If only one serviceName is specified and it has a weight greater than 0,
9368        /// 100% of the traffic is forwarded to that backend.
9369        ///
9370        /// If weights are specified for any one service name, they need to be
9371        /// specified for all of them.
9372        ///
9373        /// If weights are unspecified for all services, then, traffic is distributed
9374        /// in equal proportions to all of them.
9375        pub weight: std::option::Option<i32>,
9376
9377        /// Specifies the kind of destination to which traffic will be routed.
9378        pub destination_type:
9379            std::option::Option<crate::model::grpc_route::destination::DestinationType>,
9380
9381        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9382    }
9383
9384    impl Destination {
9385        pub fn new() -> Self {
9386            std::default::Default::default()
9387        }
9388
9389        /// Sets the value of [weight][crate::model::grpc_route::Destination::weight].
9390        ///
9391        /// # Example
9392        /// ```ignore,no_run
9393        /// # use google_cloud_networkservices_v1::model::grpc_route::Destination;
9394        /// let x = Destination::new().set_weight(42);
9395        /// ```
9396        pub fn set_weight<T>(mut self, v: T) -> Self
9397        where
9398            T: std::convert::Into<i32>,
9399        {
9400            self.weight = std::option::Option::Some(v.into());
9401            self
9402        }
9403
9404        /// Sets or clears the value of [weight][crate::model::grpc_route::Destination::weight].
9405        ///
9406        /// # Example
9407        /// ```ignore,no_run
9408        /// # use google_cloud_networkservices_v1::model::grpc_route::Destination;
9409        /// let x = Destination::new().set_or_clear_weight(Some(42));
9410        /// let x = Destination::new().set_or_clear_weight(None::<i32>);
9411        /// ```
9412        pub fn set_or_clear_weight<T>(mut self, v: std::option::Option<T>) -> Self
9413        where
9414            T: std::convert::Into<i32>,
9415        {
9416            self.weight = v.map(|x| x.into());
9417            self
9418        }
9419
9420        /// Sets the value of [destination_type][crate::model::grpc_route::Destination::destination_type].
9421        ///
9422        /// Note that all the setters affecting `destination_type` are mutually
9423        /// exclusive.
9424        ///
9425        /// # Example
9426        /// ```ignore,no_run
9427        /// # use google_cloud_networkservices_v1::model::grpc_route::Destination;
9428        /// use google_cloud_networkservices_v1::model::grpc_route::destination::DestinationType;
9429        /// let x = Destination::new().set_destination_type(Some(DestinationType::ServiceName("example".to_string())));
9430        /// ```
9431        pub fn set_destination_type<
9432            T: std::convert::Into<
9433                    std::option::Option<crate::model::grpc_route::destination::DestinationType>,
9434                >,
9435        >(
9436            mut self,
9437            v: T,
9438        ) -> Self {
9439            self.destination_type = v.into();
9440            self
9441        }
9442
9443        /// The value of [destination_type][crate::model::grpc_route::Destination::destination_type]
9444        /// if it holds a `ServiceName`, `None` if the field is not set or
9445        /// holds a different branch.
9446        pub fn service_name(&self) -> std::option::Option<&std::string::String> {
9447            #[allow(unreachable_patterns)]
9448            self.destination_type.as_ref().and_then(|v| match v {
9449                crate::model::grpc_route::destination::DestinationType::ServiceName(v) => {
9450                    std::option::Option::Some(v)
9451                }
9452                _ => std::option::Option::None,
9453            })
9454        }
9455
9456        /// Sets the value of [destination_type][crate::model::grpc_route::Destination::destination_type]
9457        /// to hold a `ServiceName`.
9458        ///
9459        /// Note that all the setters affecting `destination_type` are
9460        /// mutually exclusive.
9461        ///
9462        /// # Example
9463        /// ```ignore,no_run
9464        /// # use google_cloud_networkservices_v1::model::grpc_route::Destination;
9465        /// let x = Destination::new().set_service_name("example");
9466        /// assert!(x.service_name().is_some());
9467        /// ```
9468        pub fn set_service_name<T: std::convert::Into<std::string::String>>(
9469            mut self,
9470            v: T,
9471        ) -> Self {
9472            self.destination_type = std::option::Option::Some(
9473                crate::model::grpc_route::destination::DestinationType::ServiceName(v.into()),
9474            );
9475            self
9476        }
9477    }
9478
9479    impl wkt::message::Message for Destination {
9480        fn typename() -> &'static str {
9481            "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.Destination"
9482        }
9483    }
9484
9485    /// Defines additional types related to [Destination].
9486    pub mod destination {
9487        #[allow(unused_imports)]
9488        use super::*;
9489
9490        /// Specifies the kind of destination to which traffic will be routed.
9491        #[derive(Clone, Debug, PartialEq)]
9492        #[non_exhaustive]
9493        pub enum DestinationType {
9494            /// Required. The URL of a destination service to which to route traffic.
9495            /// Must refer to either a BackendService or ServiceDirectoryService.
9496            ServiceName(std::string::String),
9497        }
9498    }
9499
9500    /// The specification for fault injection introduced into traffic to test the
9501    /// resiliency of clients to destination service failure. As part of fault
9502    /// injection, when clients send requests to a destination, delays can be
9503    /// introduced on a percentage of requests before sending those requests to the
9504    /// destination service. Similarly requests from clients can be aborted by for
9505    /// a percentage of requests.
9506    #[derive(Clone, Default, PartialEq)]
9507    #[non_exhaustive]
9508    pub struct FaultInjectionPolicy {
9509        /// The specification for injecting delay to client requests.
9510        pub delay: std::option::Option<crate::model::grpc_route::fault_injection_policy::Delay>,
9511
9512        /// The specification for aborting to client requests.
9513        pub abort: std::option::Option<crate::model::grpc_route::fault_injection_policy::Abort>,
9514
9515        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9516    }
9517
9518    impl FaultInjectionPolicy {
9519        pub fn new() -> Self {
9520            std::default::Default::default()
9521        }
9522
9523        /// Sets the value of [delay][crate::model::grpc_route::FaultInjectionPolicy::delay].
9524        ///
9525        /// # Example
9526        /// ```ignore,no_run
9527        /// # use google_cloud_networkservices_v1::model::grpc_route::FaultInjectionPolicy;
9528        /// use google_cloud_networkservices_v1::model::grpc_route::fault_injection_policy::Delay;
9529        /// let x = FaultInjectionPolicy::new().set_delay(Delay::default()/* use setters */);
9530        /// ```
9531        pub fn set_delay<T>(mut self, v: T) -> Self
9532        where
9533            T: std::convert::Into<crate::model::grpc_route::fault_injection_policy::Delay>,
9534        {
9535            self.delay = std::option::Option::Some(v.into());
9536            self
9537        }
9538
9539        /// Sets or clears the value of [delay][crate::model::grpc_route::FaultInjectionPolicy::delay].
9540        ///
9541        /// # Example
9542        /// ```ignore,no_run
9543        /// # use google_cloud_networkservices_v1::model::grpc_route::FaultInjectionPolicy;
9544        /// use google_cloud_networkservices_v1::model::grpc_route::fault_injection_policy::Delay;
9545        /// let x = FaultInjectionPolicy::new().set_or_clear_delay(Some(Delay::default()/* use setters */));
9546        /// let x = FaultInjectionPolicy::new().set_or_clear_delay(None::<Delay>);
9547        /// ```
9548        pub fn set_or_clear_delay<T>(mut self, v: std::option::Option<T>) -> Self
9549        where
9550            T: std::convert::Into<crate::model::grpc_route::fault_injection_policy::Delay>,
9551        {
9552            self.delay = v.map(|x| x.into());
9553            self
9554        }
9555
9556        /// Sets the value of [abort][crate::model::grpc_route::FaultInjectionPolicy::abort].
9557        ///
9558        /// # Example
9559        /// ```ignore,no_run
9560        /// # use google_cloud_networkservices_v1::model::grpc_route::FaultInjectionPolicy;
9561        /// use google_cloud_networkservices_v1::model::grpc_route::fault_injection_policy::Abort;
9562        /// let x = FaultInjectionPolicy::new().set_abort(Abort::default()/* use setters */);
9563        /// ```
9564        pub fn set_abort<T>(mut self, v: T) -> Self
9565        where
9566            T: std::convert::Into<crate::model::grpc_route::fault_injection_policy::Abort>,
9567        {
9568            self.abort = std::option::Option::Some(v.into());
9569            self
9570        }
9571
9572        /// Sets or clears the value of [abort][crate::model::grpc_route::FaultInjectionPolicy::abort].
9573        ///
9574        /// # Example
9575        /// ```ignore,no_run
9576        /// # use google_cloud_networkservices_v1::model::grpc_route::FaultInjectionPolicy;
9577        /// use google_cloud_networkservices_v1::model::grpc_route::fault_injection_policy::Abort;
9578        /// let x = FaultInjectionPolicy::new().set_or_clear_abort(Some(Abort::default()/* use setters */));
9579        /// let x = FaultInjectionPolicy::new().set_or_clear_abort(None::<Abort>);
9580        /// ```
9581        pub fn set_or_clear_abort<T>(mut self, v: std::option::Option<T>) -> Self
9582        where
9583            T: std::convert::Into<crate::model::grpc_route::fault_injection_policy::Abort>,
9584        {
9585            self.abort = v.map(|x| x.into());
9586            self
9587        }
9588    }
9589
9590    impl wkt::message::Message for FaultInjectionPolicy {
9591        fn typename() -> &'static str {
9592            "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.FaultInjectionPolicy"
9593        }
9594    }
9595
9596    /// Defines additional types related to [FaultInjectionPolicy].
9597    pub mod fault_injection_policy {
9598        #[allow(unused_imports)]
9599        use super::*;
9600
9601        /// Specification of how client requests are delayed as part of fault
9602        /// injection before being sent to a destination.
9603        #[derive(Clone, Default, PartialEq)]
9604        #[non_exhaustive]
9605        pub struct Delay {
9606            /// Specify a fixed delay before forwarding the request.
9607            pub fixed_delay: std::option::Option<wkt::Duration>,
9608
9609            /// The percentage of traffic on which delay will be injected.
9610            ///
9611            /// The value must be between [0, 100]
9612            pub percentage: std::option::Option<i32>,
9613
9614            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9615        }
9616
9617        impl Delay {
9618            pub fn new() -> Self {
9619                std::default::Default::default()
9620            }
9621
9622            /// Sets the value of [fixed_delay][crate::model::grpc_route::fault_injection_policy::Delay::fixed_delay].
9623            ///
9624            /// # Example
9625            /// ```ignore,no_run
9626            /// # use google_cloud_networkservices_v1::model::grpc_route::fault_injection_policy::Delay;
9627            /// use wkt::Duration;
9628            /// let x = Delay::new().set_fixed_delay(Duration::default()/* use setters */);
9629            /// ```
9630            pub fn set_fixed_delay<T>(mut self, v: T) -> Self
9631            where
9632                T: std::convert::Into<wkt::Duration>,
9633            {
9634                self.fixed_delay = std::option::Option::Some(v.into());
9635                self
9636            }
9637
9638            /// Sets or clears the value of [fixed_delay][crate::model::grpc_route::fault_injection_policy::Delay::fixed_delay].
9639            ///
9640            /// # Example
9641            /// ```ignore,no_run
9642            /// # use google_cloud_networkservices_v1::model::grpc_route::fault_injection_policy::Delay;
9643            /// use wkt::Duration;
9644            /// let x = Delay::new().set_or_clear_fixed_delay(Some(Duration::default()/* use setters */));
9645            /// let x = Delay::new().set_or_clear_fixed_delay(None::<Duration>);
9646            /// ```
9647            pub fn set_or_clear_fixed_delay<T>(mut self, v: std::option::Option<T>) -> Self
9648            where
9649                T: std::convert::Into<wkt::Duration>,
9650            {
9651                self.fixed_delay = v.map(|x| x.into());
9652                self
9653            }
9654
9655            /// Sets the value of [percentage][crate::model::grpc_route::fault_injection_policy::Delay::percentage].
9656            ///
9657            /// # Example
9658            /// ```ignore,no_run
9659            /// # use google_cloud_networkservices_v1::model::grpc_route::fault_injection_policy::Delay;
9660            /// let x = Delay::new().set_percentage(42);
9661            /// ```
9662            pub fn set_percentage<T>(mut self, v: T) -> Self
9663            where
9664                T: std::convert::Into<i32>,
9665            {
9666                self.percentage = std::option::Option::Some(v.into());
9667                self
9668            }
9669
9670            /// Sets or clears the value of [percentage][crate::model::grpc_route::fault_injection_policy::Delay::percentage].
9671            ///
9672            /// # Example
9673            /// ```ignore,no_run
9674            /// # use google_cloud_networkservices_v1::model::grpc_route::fault_injection_policy::Delay;
9675            /// let x = Delay::new().set_or_clear_percentage(Some(42));
9676            /// let x = Delay::new().set_or_clear_percentage(None::<i32>);
9677            /// ```
9678            pub fn set_or_clear_percentage<T>(mut self, v: std::option::Option<T>) -> Self
9679            where
9680                T: std::convert::Into<i32>,
9681            {
9682                self.percentage = v.map(|x| x.into());
9683                self
9684            }
9685        }
9686
9687        impl wkt::message::Message for Delay {
9688            fn typename() -> &'static str {
9689                "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.FaultInjectionPolicy.Delay"
9690            }
9691        }
9692
9693        /// Specification of how client requests are aborted as part of fault
9694        /// injection before being sent to a destination.
9695        #[derive(Clone, Default, PartialEq)]
9696        #[non_exhaustive]
9697        pub struct Abort {
9698            /// The HTTP status code used to abort the request.
9699            ///
9700            /// The value must be between 200 and 599 inclusive.
9701            pub http_status: std::option::Option<i32>,
9702
9703            /// The percentage of traffic which will be aborted.
9704            ///
9705            /// The value must be between [0, 100]
9706            pub percentage: std::option::Option<i32>,
9707
9708            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9709        }
9710
9711        impl Abort {
9712            pub fn new() -> Self {
9713                std::default::Default::default()
9714            }
9715
9716            /// Sets the value of [http_status][crate::model::grpc_route::fault_injection_policy::Abort::http_status].
9717            ///
9718            /// # Example
9719            /// ```ignore,no_run
9720            /// # use google_cloud_networkservices_v1::model::grpc_route::fault_injection_policy::Abort;
9721            /// let x = Abort::new().set_http_status(42);
9722            /// ```
9723            pub fn set_http_status<T>(mut self, v: T) -> Self
9724            where
9725                T: std::convert::Into<i32>,
9726            {
9727                self.http_status = std::option::Option::Some(v.into());
9728                self
9729            }
9730
9731            /// Sets or clears the value of [http_status][crate::model::grpc_route::fault_injection_policy::Abort::http_status].
9732            ///
9733            /// # Example
9734            /// ```ignore,no_run
9735            /// # use google_cloud_networkservices_v1::model::grpc_route::fault_injection_policy::Abort;
9736            /// let x = Abort::new().set_or_clear_http_status(Some(42));
9737            /// let x = Abort::new().set_or_clear_http_status(None::<i32>);
9738            /// ```
9739            pub fn set_or_clear_http_status<T>(mut self, v: std::option::Option<T>) -> Self
9740            where
9741                T: std::convert::Into<i32>,
9742            {
9743                self.http_status = v.map(|x| x.into());
9744                self
9745            }
9746
9747            /// Sets the value of [percentage][crate::model::grpc_route::fault_injection_policy::Abort::percentage].
9748            ///
9749            /// # Example
9750            /// ```ignore,no_run
9751            /// # use google_cloud_networkservices_v1::model::grpc_route::fault_injection_policy::Abort;
9752            /// let x = Abort::new().set_percentage(42);
9753            /// ```
9754            pub fn set_percentage<T>(mut self, v: T) -> Self
9755            where
9756                T: std::convert::Into<i32>,
9757            {
9758                self.percentage = std::option::Option::Some(v.into());
9759                self
9760            }
9761
9762            /// Sets or clears the value of [percentage][crate::model::grpc_route::fault_injection_policy::Abort::percentage].
9763            ///
9764            /// # Example
9765            /// ```ignore,no_run
9766            /// # use google_cloud_networkservices_v1::model::grpc_route::fault_injection_policy::Abort;
9767            /// let x = Abort::new().set_or_clear_percentage(Some(42));
9768            /// let x = Abort::new().set_or_clear_percentage(None::<i32>);
9769            /// ```
9770            pub fn set_or_clear_percentage<T>(mut self, v: std::option::Option<T>) -> Self
9771            where
9772                T: std::convert::Into<i32>,
9773            {
9774                self.percentage = v.map(|x| x.into());
9775                self
9776            }
9777        }
9778
9779        impl wkt::message::Message for Abort {
9780            fn typename() -> &'static str {
9781                "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.FaultInjectionPolicy.Abort"
9782            }
9783        }
9784    }
9785
9786    /// The specification for cookie-based stateful session affinity where the
9787    /// date plane supplies a “session cookie”  with the name "GSSA" which encodes
9788    /// a specific destination host and each request containing that cookie will
9789    /// be directed to that host as long as the destination host remains up and
9790    /// healthy.
9791    ///
9792    /// The gRPC proxyless mesh library or sidecar proxy will manage the session
9793    /// cookie but the client application code is responsible for copying the
9794    /// cookie from each RPC in the session to the next.
9795    #[derive(Clone, Default, PartialEq)]
9796    #[non_exhaustive]
9797    pub struct StatefulSessionAffinityPolicy {
9798        /// Required. The cookie TTL value for the Set-Cookie header generated by the
9799        /// data plane. The lifetime of the cookie may be set to a value from 0 to
9800        /// 86400 seconds (24 hours) inclusive.
9801        ///
9802        /// Set this to 0s to use a session cookie and disable cookie expiration.
9803        pub cookie_ttl: std::option::Option<wkt::Duration>,
9804
9805        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9806    }
9807
9808    impl StatefulSessionAffinityPolicy {
9809        pub fn new() -> Self {
9810            std::default::Default::default()
9811        }
9812
9813        /// Sets the value of [cookie_ttl][crate::model::grpc_route::StatefulSessionAffinityPolicy::cookie_ttl].
9814        ///
9815        /// # Example
9816        /// ```ignore,no_run
9817        /// # use google_cloud_networkservices_v1::model::grpc_route::StatefulSessionAffinityPolicy;
9818        /// use wkt::Duration;
9819        /// let x = StatefulSessionAffinityPolicy::new().set_cookie_ttl(Duration::default()/* use setters */);
9820        /// ```
9821        pub fn set_cookie_ttl<T>(mut self, v: T) -> Self
9822        where
9823            T: std::convert::Into<wkt::Duration>,
9824        {
9825            self.cookie_ttl = std::option::Option::Some(v.into());
9826            self
9827        }
9828
9829        /// Sets or clears the value of [cookie_ttl][crate::model::grpc_route::StatefulSessionAffinityPolicy::cookie_ttl].
9830        ///
9831        /// # Example
9832        /// ```ignore,no_run
9833        /// # use google_cloud_networkservices_v1::model::grpc_route::StatefulSessionAffinityPolicy;
9834        /// use wkt::Duration;
9835        /// let x = StatefulSessionAffinityPolicy::new().set_or_clear_cookie_ttl(Some(Duration::default()/* use setters */));
9836        /// let x = StatefulSessionAffinityPolicy::new().set_or_clear_cookie_ttl(None::<Duration>);
9837        /// ```
9838        pub fn set_or_clear_cookie_ttl<T>(mut self, v: std::option::Option<T>) -> Self
9839        where
9840            T: std::convert::Into<wkt::Duration>,
9841        {
9842            self.cookie_ttl = v.map(|x| x.into());
9843            self
9844        }
9845    }
9846
9847    impl wkt::message::Message for StatefulSessionAffinityPolicy {
9848        fn typename() -> &'static str {
9849            "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.StatefulSessionAffinityPolicy"
9850        }
9851    }
9852
9853    /// The specifications for retries.
9854    /// Specifies one or more conditions for which this retry rule applies. Valid
9855    /// values are:
9856    #[derive(Clone, Default, PartialEq)]
9857    #[non_exhaustive]
9858    pub struct RetryPolicy {
9859        /// - connect-failure: Router will retry on failures connecting to Backend
9860        ///   Services, for example due to connection timeouts.
9861        /// - refused-stream: Router will retry if the backend service resets the
9862        ///   stream
9863        ///   with a REFUSED_STREAM error code. This reset type indicates that it is
9864        ///   safe to retry.
9865        /// - cancelled: Router will retry if the gRPC status code in the response
9866        ///   header
9867        ///   is set to cancelled
9868        /// - deadline-exceeded: Router will retry if the gRPC status code in the
9869        ///   response
9870        ///   header is set to deadline-exceeded
9871        /// - resource-exhausted: Router will retry if the gRPC status code in the
9872        ///   response header is set to resource-exhausted
9873        /// - unavailable: Router will retry if the gRPC status code in the response
9874        ///   header is set to unavailable
9875        pub retry_conditions: std::vec::Vec<std::string::String>,
9876
9877        /// Specifies the allowed number of retries. This number must be > 0. If not
9878        /// specified, default to 1.
9879        pub num_retries: u32,
9880
9881        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9882    }
9883
9884    impl RetryPolicy {
9885        pub fn new() -> Self {
9886            std::default::Default::default()
9887        }
9888
9889        /// Sets the value of [retry_conditions][crate::model::grpc_route::RetryPolicy::retry_conditions].
9890        ///
9891        /// # Example
9892        /// ```ignore,no_run
9893        /// # use google_cloud_networkservices_v1::model::grpc_route::RetryPolicy;
9894        /// let x = RetryPolicy::new().set_retry_conditions(["a", "b", "c"]);
9895        /// ```
9896        pub fn set_retry_conditions<T, V>(mut self, v: T) -> Self
9897        where
9898            T: std::iter::IntoIterator<Item = V>,
9899            V: std::convert::Into<std::string::String>,
9900        {
9901            use std::iter::Iterator;
9902            self.retry_conditions = v.into_iter().map(|i| i.into()).collect();
9903            self
9904        }
9905
9906        /// Sets the value of [num_retries][crate::model::grpc_route::RetryPolicy::num_retries].
9907        ///
9908        /// # Example
9909        /// ```ignore,no_run
9910        /// # use google_cloud_networkservices_v1::model::grpc_route::RetryPolicy;
9911        /// let x = RetryPolicy::new().set_num_retries(42_u32);
9912        /// ```
9913        pub fn set_num_retries<T: std::convert::Into<u32>>(mut self, v: T) -> Self {
9914            self.num_retries = v.into();
9915            self
9916        }
9917    }
9918
9919    impl wkt::message::Message for RetryPolicy {
9920        fn typename() -> &'static str {
9921            "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.RetryPolicy"
9922        }
9923    }
9924
9925    /// Specifies how to route matched traffic.
9926    #[derive(Clone, Default, PartialEq)]
9927    #[non_exhaustive]
9928    pub struct RouteAction {
9929        /// Optional. The destination services to which traffic should be forwarded.
9930        /// If multiple destinations are specified, traffic will be split between
9931        /// Backend Service(s) according to the weight field of these destinations.
9932        pub destinations: std::vec::Vec<crate::model::grpc_route::Destination>,
9933
9934        /// Optional. The specification for fault injection introduced into traffic
9935        /// to test the resiliency of clients to destination service failure. As part
9936        /// of fault injection, when clients send requests to a destination, delays
9937        /// can be introduced on a percentage of requests before sending those
9938        /// requests to the destination service. Similarly requests from clients can
9939        /// be aborted by for a percentage of requests.
9940        ///
9941        /// timeout and retry_policy will be ignored by clients that are configured
9942        /// with a fault_injection_policy
9943        pub fault_injection_policy:
9944            std::option::Option<crate::model::grpc_route::FaultInjectionPolicy>,
9945
9946        /// Optional. Specifies the timeout for selected route. Timeout is computed
9947        /// from the time the request has been fully processed (i.e. end of stream)
9948        /// up until the response has been completely processed. Timeout includes all
9949        /// retries.
9950        pub timeout: std::option::Option<wkt::Duration>,
9951
9952        /// Optional. Specifies the retry policy associated with this route.
9953        pub retry_policy: std::option::Option<crate::model::grpc_route::RetryPolicy>,
9954
9955        /// Optional. Specifies cookie-based stateful session affinity.
9956        pub stateful_session_affinity:
9957            std::option::Option<crate::model::grpc_route::StatefulSessionAffinityPolicy>,
9958
9959        /// Optional. Specifies the idle timeout for the selected route. The idle
9960        /// timeout is defined as the period in which there are no bytes sent or
9961        /// received on either the upstream or downstream connection. If not set, the
9962        /// default idle timeout is 1 hour. If set to 0s, the timeout will be
9963        /// disabled.
9964        pub idle_timeout: std::option::Option<wkt::Duration>,
9965
9966        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9967    }
9968
9969    impl RouteAction {
9970        pub fn new() -> Self {
9971            std::default::Default::default()
9972        }
9973
9974        /// Sets the value of [destinations][crate::model::grpc_route::RouteAction::destinations].
9975        ///
9976        /// # Example
9977        /// ```ignore,no_run
9978        /// # use google_cloud_networkservices_v1::model::grpc_route::RouteAction;
9979        /// use google_cloud_networkservices_v1::model::grpc_route::Destination;
9980        /// let x = RouteAction::new()
9981        ///     .set_destinations([
9982        ///         Destination::default()/* use setters */,
9983        ///         Destination::default()/* use (different) setters */,
9984        ///     ]);
9985        /// ```
9986        pub fn set_destinations<T, V>(mut self, v: T) -> Self
9987        where
9988            T: std::iter::IntoIterator<Item = V>,
9989            V: std::convert::Into<crate::model::grpc_route::Destination>,
9990        {
9991            use std::iter::Iterator;
9992            self.destinations = v.into_iter().map(|i| i.into()).collect();
9993            self
9994        }
9995
9996        /// Sets the value of [fault_injection_policy][crate::model::grpc_route::RouteAction::fault_injection_policy].
9997        ///
9998        /// # Example
9999        /// ```ignore,no_run
10000        /// # use google_cloud_networkservices_v1::model::grpc_route::RouteAction;
10001        /// use google_cloud_networkservices_v1::model::grpc_route::FaultInjectionPolicy;
10002        /// let x = RouteAction::new().set_fault_injection_policy(FaultInjectionPolicy::default()/* use setters */);
10003        /// ```
10004        pub fn set_fault_injection_policy<T>(mut self, v: T) -> Self
10005        where
10006            T: std::convert::Into<crate::model::grpc_route::FaultInjectionPolicy>,
10007        {
10008            self.fault_injection_policy = std::option::Option::Some(v.into());
10009            self
10010        }
10011
10012        /// Sets or clears the value of [fault_injection_policy][crate::model::grpc_route::RouteAction::fault_injection_policy].
10013        ///
10014        /// # Example
10015        /// ```ignore,no_run
10016        /// # use google_cloud_networkservices_v1::model::grpc_route::RouteAction;
10017        /// use google_cloud_networkservices_v1::model::grpc_route::FaultInjectionPolicy;
10018        /// let x = RouteAction::new().set_or_clear_fault_injection_policy(Some(FaultInjectionPolicy::default()/* use setters */));
10019        /// let x = RouteAction::new().set_or_clear_fault_injection_policy(None::<FaultInjectionPolicy>);
10020        /// ```
10021        pub fn set_or_clear_fault_injection_policy<T>(mut self, v: std::option::Option<T>) -> Self
10022        where
10023            T: std::convert::Into<crate::model::grpc_route::FaultInjectionPolicy>,
10024        {
10025            self.fault_injection_policy = v.map(|x| x.into());
10026            self
10027        }
10028
10029        /// Sets the value of [timeout][crate::model::grpc_route::RouteAction::timeout].
10030        ///
10031        /// # Example
10032        /// ```ignore,no_run
10033        /// # use google_cloud_networkservices_v1::model::grpc_route::RouteAction;
10034        /// use wkt::Duration;
10035        /// let x = RouteAction::new().set_timeout(Duration::default()/* use setters */);
10036        /// ```
10037        pub fn set_timeout<T>(mut self, v: T) -> Self
10038        where
10039            T: std::convert::Into<wkt::Duration>,
10040        {
10041            self.timeout = std::option::Option::Some(v.into());
10042            self
10043        }
10044
10045        /// Sets or clears the value of [timeout][crate::model::grpc_route::RouteAction::timeout].
10046        ///
10047        /// # Example
10048        /// ```ignore,no_run
10049        /// # use google_cloud_networkservices_v1::model::grpc_route::RouteAction;
10050        /// use wkt::Duration;
10051        /// let x = RouteAction::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
10052        /// let x = RouteAction::new().set_or_clear_timeout(None::<Duration>);
10053        /// ```
10054        pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
10055        where
10056            T: std::convert::Into<wkt::Duration>,
10057        {
10058            self.timeout = v.map(|x| x.into());
10059            self
10060        }
10061
10062        /// Sets the value of [retry_policy][crate::model::grpc_route::RouteAction::retry_policy].
10063        ///
10064        /// # Example
10065        /// ```ignore,no_run
10066        /// # use google_cloud_networkservices_v1::model::grpc_route::RouteAction;
10067        /// use google_cloud_networkservices_v1::model::grpc_route::RetryPolicy;
10068        /// let x = RouteAction::new().set_retry_policy(RetryPolicy::default()/* use setters */);
10069        /// ```
10070        pub fn set_retry_policy<T>(mut self, v: T) -> Self
10071        where
10072            T: std::convert::Into<crate::model::grpc_route::RetryPolicy>,
10073        {
10074            self.retry_policy = std::option::Option::Some(v.into());
10075            self
10076        }
10077
10078        /// Sets or clears the value of [retry_policy][crate::model::grpc_route::RouteAction::retry_policy].
10079        ///
10080        /// # Example
10081        /// ```ignore,no_run
10082        /// # use google_cloud_networkservices_v1::model::grpc_route::RouteAction;
10083        /// use google_cloud_networkservices_v1::model::grpc_route::RetryPolicy;
10084        /// let x = RouteAction::new().set_or_clear_retry_policy(Some(RetryPolicy::default()/* use setters */));
10085        /// let x = RouteAction::new().set_or_clear_retry_policy(None::<RetryPolicy>);
10086        /// ```
10087        pub fn set_or_clear_retry_policy<T>(mut self, v: std::option::Option<T>) -> Self
10088        where
10089            T: std::convert::Into<crate::model::grpc_route::RetryPolicy>,
10090        {
10091            self.retry_policy = v.map(|x| x.into());
10092            self
10093        }
10094
10095        /// Sets the value of [stateful_session_affinity][crate::model::grpc_route::RouteAction::stateful_session_affinity].
10096        ///
10097        /// # Example
10098        /// ```ignore,no_run
10099        /// # use google_cloud_networkservices_v1::model::grpc_route::RouteAction;
10100        /// use google_cloud_networkservices_v1::model::grpc_route::StatefulSessionAffinityPolicy;
10101        /// let x = RouteAction::new().set_stateful_session_affinity(StatefulSessionAffinityPolicy::default()/* use setters */);
10102        /// ```
10103        pub fn set_stateful_session_affinity<T>(mut self, v: T) -> Self
10104        where
10105            T: std::convert::Into<crate::model::grpc_route::StatefulSessionAffinityPolicy>,
10106        {
10107            self.stateful_session_affinity = std::option::Option::Some(v.into());
10108            self
10109        }
10110
10111        /// Sets or clears the value of [stateful_session_affinity][crate::model::grpc_route::RouteAction::stateful_session_affinity].
10112        ///
10113        /// # Example
10114        /// ```ignore,no_run
10115        /// # use google_cloud_networkservices_v1::model::grpc_route::RouteAction;
10116        /// use google_cloud_networkservices_v1::model::grpc_route::StatefulSessionAffinityPolicy;
10117        /// let x = RouteAction::new().set_or_clear_stateful_session_affinity(Some(StatefulSessionAffinityPolicy::default()/* use setters */));
10118        /// let x = RouteAction::new().set_or_clear_stateful_session_affinity(None::<StatefulSessionAffinityPolicy>);
10119        /// ```
10120        pub fn set_or_clear_stateful_session_affinity<T>(
10121            mut self,
10122            v: std::option::Option<T>,
10123        ) -> Self
10124        where
10125            T: std::convert::Into<crate::model::grpc_route::StatefulSessionAffinityPolicy>,
10126        {
10127            self.stateful_session_affinity = v.map(|x| x.into());
10128            self
10129        }
10130
10131        /// Sets the value of [idle_timeout][crate::model::grpc_route::RouteAction::idle_timeout].
10132        ///
10133        /// # Example
10134        /// ```ignore,no_run
10135        /// # use google_cloud_networkservices_v1::model::grpc_route::RouteAction;
10136        /// use wkt::Duration;
10137        /// let x = RouteAction::new().set_idle_timeout(Duration::default()/* use setters */);
10138        /// ```
10139        pub fn set_idle_timeout<T>(mut self, v: T) -> Self
10140        where
10141            T: std::convert::Into<wkt::Duration>,
10142        {
10143            self.idle_timeout = std::option::Option::Some(v.into());
10144            self
10145        }
10146
10147        /// Sets or clears the value of [idle_timeout][crate::model::grpc_route::RouteAction::idle_timeout].
10148        ///
10149        /// # Example
10150        /// ```ignore,no_run
10151        /// # use google_cloud_networkservices_v1::model::grpc_route::RouteAction;
10152        /// use wkt::Duration;
10153        /// let x = RouteAction::new().set_or_clear_idle_timeout(Some(Duration::default()/* use setters */));
10154        /// let x = RouteAction::new().set_or_clear_idle_timeout(None::<Duration>);
10155        /// ```
10156        pub fn set_or_clear_idle_timeout<T>(mut self, v: std::option::Option<T>) -> Self
10157        where
10158            T: std::convert::Into<wkt::Duration>,
10159        {
10160            self.idle_timeout = v.map(|x| x.into());
10161            self
10162        }
10163    }
10164
10165    impl wkt::message::Message for RouteAction {
10166        fn typename() -> &'static str {
10167            "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.RouteAction"
10168        }
10169    }
10170
10171    /// Describes how to route traffic.
10172    #[derive(Clone, Default, PartialEq)]
10173    #[non_exhaustive]
10174    pub struct RouteRule {
10175        /// Optional. Matches define conditions used for matching the rule against
10176        /// incoming gRPC requests. Each match is independent, i.e. this rule will be
10177        /// matched if ANY one of the matches is satisfied.  If no matches field is
10178        /// specified, this rule will unconditionally match traffic.
10179        pub matches: std::vec::Vec<crate::model::grpc_route::RouteMatch>,
10180
10181        /// Required. A detailed rule defining how to route traffic. This field is
10182        /// required.
10183        pub action: std::option::Option<crate::model::grpc_route::RouteAction>,
10184
10185        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10186    }
10187
10188    impl RouteRule {
10189        pub fn new() -> Self {
10190            std::default::Default::default()
10191        }
10192
10193        /// Sets the value of [matches][crate::model::grpc_route::RouteRule::matches].
10194        ///
10195        /// # Example
10196        /// ```ignore,no_run
10197        /// # use google_cloud_networkservices_v1::model::grpc_route::RouteRule;
10198        /// use google_cloud_networkservices_v1::model::grpc_route::RouteMatch;
10199        /// let x = RouteRule::new()
10200        ///     .set_matches([
10201        ///         RouteMatch::default()/* use setters */,
10202        ///         RouteMatch::default()/* use (different) setters */,
10203        ///     ]);
10204        /// ```
10205        pub fn set_matches<T, V>(mut self, v: T) -> Self
10206        where
10207            T: std::iter::IntoIterator<Item = V>,
10208            V: std::convert::Into<crate::model::grpc_route::RouteMatch>,
10209        {
10210            use std::iter::Iterator;
10211            self.matches = v.into_iter().map(|i| i.into()).collect();
10212            self
10213        }
10214
10215        /// Sets the value of [action][crate::model::grpc_route::RouteRule::action].
10216        ///
10217        /// # Example
10218        /// ```ignore,no_run
10219        /// # use google_cloud_networkservices_v1::model::grpc_route::RouteRule;
10220        /// use google_cloud_networkservices_v1::model::grpc_route::RouteAction;
10221        /// let x = RouteRule::new().set_action(RouteAction::default()/* use setters */);
10222        /// ```
10223        pub fn set_action<T>(mut self, v: T) -> Self
10224        where
10225            T: std::convert::Into<crate::model::grpc_route::RouteAction>,
10226        {
10227            self.action = std::option::Option::Some(v.into());
10228            self
10229        }
10230
10231        /// Sets or clears the value of [action][crate::model::grpc_route::RouteRule::action].
10232        ///
10233        /// # Example
10234        /// ```ignore,no_run
10235        /// # use google_cloud_networkservices_v1::model::grpc_route::RouteRule;
10236        /// use google_cloud_networkservices_v1::model::grpc_route::RouteAction;
10237        /// let x = RouteRule::new().set_or_clear_action(Some(RouteAction::default()/* use setters */));
10238        /// let x = RouteRule::new().set_or_clear_action(None::<RouteAction>);
10239        /// ```
10240        pub fn set_or_clear_action<T>(mut self, v: std::option::Option<T>) -> Self
10241        where
10242            T: std::convert::Into<crate::model::grpc_route::RouteAction>,
10243        {
10244            self.action = v.map(|x| x.into());
10245            self
10246        }
10247    }
10248
10249    impl wkt::message::Message for RouteRule {
10250        fn typename() -> &'static str {
10251            "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.RouteRule"
10252        }
10253    }
10254}
10255
10256/// Request used with the ListGrpcRoutes method.
10257#[derive(Clone, Default, PartialEq)]
10258#[non_exhaustive]
10259pub struct ListGrpcRoutesRequest {
10260    /// Required. The project and location from which the GrpcRoutes should be
10261    /// listed, specified in the format `projects/*/locations/global`.
10262    pub parent: std::string::String,
10263
10264    /// Maximum number of GrpcRoutes to return per call.
10265    pub page_size: i32,
10266
10267    /// The value returned by the last `ListGrpcRoutesResponse`
10268    /// Indicates that this is a continuation of a prior `ListGrpcRoutes` call,
10269    /// and that the system should return the next page of data.
10270    pub page_token: std::string::String,
10271
10272    /// Optional. If true, allow partial responses for multi-regional Aggregated
10273    /// List requests. Otherwise if one of the locations is down or unreachable,
10274    /// the Aggregated List request will fail.
10275    pub return_partial_success: bool,
10276
10277    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10278}
10279
10280impl ListGrpcRoutesRequest {
10281    pub fn new() -> Self {
10282        std::default::Default::default()
10283    }
10284
10285    /// Sets the value of [parent][crate::model::ListGrpcRoutesRequest::parent].
10286    ///
10287    /// # Example
10288    /// ```ignore,no_run
10289    /// # use google_cloud_networkservices_v1::model::ListGrpcRoutesRequest;
10290    /// let x = ListGrpcRoutesRequest::new().set_parent("example");
10291    /// ```
10292    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10293        self.parent = v.into();
10294        self
10295    }
10296
10297    /// Sets the value of [page_size][crate::model::ListGrpcRoutesRequest::page_size].
10298    ///
10299    /// # Example
10300    /// ```ignore,no_run
10301    /// # use google_cloud_networkservices_v1::model::ListGrpcRoutesRequest;
10302    /// let x = ListGrpcRoutesRequest::new().set_page_size(42);
10303    /// ```
10304    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10305        self.page_size = v.into();
10306        self
10307    }
10308
10309    /// Sets the value of [page_token][crate::model::ListGrpcRoutesRequest::page_token].
10310    ///
10311    /// # Example
10312    /// ```ignore,no_run
10313    /// # use google_cloud_networkservices_v1::model::ListGrpcRoutesRequest;
10314    /// let x = ListGrpcRoutesRequest::new().set_page_token("example");
10315    /// ```
10316    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10317        self.page_token = v.into();
10318        self
10319    }
10320
10321    /// Sets the value of [return_partial_success][crate::model::ListGrpcRoutesRequest::return_partial_success].
10322    ///
10323    /// # Example
10324    /// ```ignore,no_run
10325    /// # use google_cloud_networkservices_v1::model::ListGrpcRoutesRequest;
10326    /// let x = ListGrpcRoutesRequest::new().set_return_partial_success(true);
10327    /// ```
10328    pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10329        self.return_partial_success = v.into();
10330        self
10331    }
10332}
10333
10334impl wkt::message::Message for ListGrpcRoutesRequest {
10335    fn typename() -> &'static str {
10336        "type.googleapis.com/google.cloud.networkservices.v1.ListGrpcRoutesRequest"
10337    }
10338}
10339
10340/// Response returned by the ListGrpcRoutes method.
10341#[derive(Clone, Default, PartialEq)]
10342#[non_exhaustive]
10343pub struct ListGrpcRoutesResponse {
10344    /// List of GrpcRoute resources.
10345    pub grpc_routes: std::vec::Vec<crate::model::GrpcRoute>,
10346
10347    /// If there might be more results than those appearing in this response, then
10348    /// `next_page_token` is included. To get the next set of results, call this
10349    /// method again using the value of `next_page_token` as `page_token`.
10350    pub next_page_token: std::string::String,
10351
10352    /// Unreachable resources. Populated when the request opts into
10353    /// [return_partial_success][google.cloud.networkservices.v1.ListGrpcRoutesRequest.return_partial_success]
10354    /// and reading across collections e.g. when attempting to list all resources
10355    /// across all supported locations.
10356    ///
10357    /// [google.cloud.networkservices.v1.ListGrpcRoutesRequest.return_partial_success]: crate::model::ListGrpcRoutesRequest::return_partial_success
10358    pub unreachable: std::vec::Vec<std::string::String>,
10359
10360    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10361}
10362
10363impl ListGrpcRoutesResponse {
10364    pub fn new() -> Self {
10365        std::default::Default::default()
10366    }
10367
10368    /// Sets the value of [grpc_routes][crate::model::ListGrpcRoutesResponse::grpc_routes].
10369    ///
10370    /// # Example
10371    /// ```ignore,no_run
10372    /// # use google_cloud_networkservices_v1::model::ListGrpcRoutesResponse;
10373    /// use google_cloud_networkservices_v1::model::GrpcRoute;
10374    /// let x = ListGrpcRoutesResponse::new()
10375    ///     .set_grpc_routes([
10376    ///         GrpcRoute::default()/* use setters */,
10377    ///         GrpcRoute::default()/* use (different) setters */,
10378    ///     ]);
10379    /// ```
10380    pub fn set_grpc_routes<T, V>(mut self, v: T) -> Self
10381    where
10382        T: std::iter::IntoIterator<Item = V>,
10383        V: std::convert::Into<crate::model::GrpcRoute>,
10384    {
10385        use std::iter::Iterator;
10386        self.grpc_routes = v.into_iter().map(|i| i.into()).collect();
10387        self
10388    }
10389
10390    /// Sets the value of [next_page_token][crate::model::ListGrpcRoutesResponse::next_page_token].
10391    ///
10392    /// # Example
10393    /// ```ignore,no_run
10394    /// # use google_cloud_networkservices_v1::model::ListGrpcRoutesResponse;
10395    /// let x = ListGrpcRoutesResponse::new().set_next_page_token("example");
10396    /// ```
10397    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10398        self.next_page_token = v.into();
10399        self
10400    }
10401
10402    /// Sets the value of [unreachable][crate::model::ListGrpcRoutesResponse::unreachable].
10403    ///
10404    /// # Example
10405    /// ```ignore,no_run
10406    /// # use google_cloud_networkservices_v1::model::ListGrpcRoutesResponse;
10407    /// let x = ListGrpcRoutesResponse::new().set_unreachable(["a", "b", "c"]);
10408    /// ```
10409    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
10410    where
10411        T: std::iter::IntoIterator<Item = V>,
10412        V: std::convert::Into<std::string::String>,
10413    {
10414        use std::iter::Iterator;
10415        self.unreachable = v.into_iter().map(|i| i.into()).collect();
10416        self
10417    }
10418}
10419
10420impl wkt::message::Message for ListGrpcRoutesResponse {
10421    fn typename() -> &'static str {
10422        "type.googleapis.com/google.cloud.networkservices.v1.ListGrpcRoutesResponse"
10423    }
10424}
10425
10426#[doc(hidden)]
10427impl google_cloud_gax::paginator::internal::PageableResponse for ListGrpcRoutesResponse {
10428    type PageItem = crate::model::GrpcRoute;
10429
10430    fn items(self) -> std::vec::Vec<Self::PageItem> {
10431        self.grpc_routes
10432    }
10433
10434    fn next_page_token(&self) -> std::string::String {
10435        use std::clone::Clone;
10436        self.next_page_token.clone()
10437    }
10438}
10439
10440/// Request used by the GetGrpcRoute method.
10441#[derive(Clone, Default, PartialEq)]
10442#[non_exhaustive]
10443pub struct GetGrpcRouteRequest {
10444    /// Required. A name of the GrpcRoute to get. Must be in the format
10445    /// `projects/*/locations/global/grpcRoutes/*`.
10446    pub name: std::string::String,
10447
10448    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10449}
10450
10451impl GetGrpcRouteRequest {
10452    pub fn new() -> Self {
10453        std::default::Default::default()
10454    }
10455
10456    /// Sets the value of [name][crate::model::GetGrpcRouteRequest::name].
10457    ///
10458    /// # Example
10459    /// ```ignore,no_run
10460    /// # use google_cloud_networkservices_v1::model::GetGrpcRouteRequest;
10461    /// let x = GetGrpcRouteRequest::new().set_name("example");
10462    /// ```
10463    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10464        self.name = v.into();
10465        self
10466    }
10467}
10468
10469impl wkt::message::Message for GetGrpcRouteRequest {
10470    fn typename() -> &'static str {
10471        "type.googleapis.com/google.cloud.networkservices.v1.GetGrpcRouteRequest"
10472    }
10473}
10474
10475/// Request used by the CreateGrpcRoute method.
10476#[derive(Clone, Default, PartialEq)]
10477#[non_exhaustive]
10478pub struct CreateGrpcRouteRequest {
10479    /// Required. The parent resource of the GrpcRoute. Must be in the
10480    /// format `projects/*/locations/global`.
10481    pub parent: std::string::String,
10482
10483    /// Required. Short name of the GrpcRoute resource to be created.
10484    pub grpc_route_id: std::string::String,
10485
10486    /// Required. GrpcRoute resource to be created.
10487    pub grpc_route: std::option::Option<crate::model::GrpcRoute>,
10488
10489    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10490}
10491
10492impl CreateGrpcRouteRequest {
10493    pub fn new() -> Self {
10494        std::default::Default::default()
10495    }
10496
10497    /// Sets the value of [parent][crate::model::CreateGrpcRouteRequest::parent].
10498    ///
10499    /// # Example
10500    /// ```ignore,no_run
10501    /// # use google_cloud_networkservices_v1::model::CreateGrpcRouteRequest;
10502    /// let x = CreateGrpcRouteRequest::new().set_parent("example");
10503    /// ```
10504    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10505        self.parent = v.into();
10506        self
10507    }
10508
10509    /// Sets the value of [grpc_route_id][crate::model::CreateGrpcRouteRequest::grpc_route_id].
10510    ///
10511    /// # Example
10512    /// ```ignore,no_run
10513    /// # use google_cloud_networkservices_v1::model::CreateGrpcRouteRequest;
10514    /// let x = CreateGrpcRouteRequest::new().set_grpc_route_id("example");
10515    /// ```
10516    pub fn set_grpc_route_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10517        self.grpc_route_id = v.into();
10518        self
10519    }
10520
10521    /// Sets the value of [grpc_route][crate::model::CreateGrpcRouteRequest::grpc_route].
10522    ///
10523    /// # Example
10524    /// ```ignore,no_run
10525    /// # use google_cloud_networkservices_v1::model::CreateGrpcRouteRequest;
10526    /// use google_cloud_networkservices_v1::model::GrpcRoute;
10527    /// let x = CreateGrpcRouteRequest::new().set_grpc_route(GrpcRoute::default()/* use setters */);
10528    /// ```
10529    pub fn set_grpc_route<T>(mut self, v: T) -> Self
10530    where
10531        T: std::convert::Into<crate::model::GrpcRoute>,
10532    {
10533        self.grpc_route = std::option::Option::Some(v.into());
10534        self
10535    }
10536
10537    /// Sets or clears the value of [grpc_route][crate::model::CreateGrpcRouteRequest::grpc_route].
10538    ///
10539    /// # Example
10540    /// ```ignore,no_run
10541    /// # use google_cloud_networkservices_v1::model::CreateGrpcRouteRequest;
10542    /// use google_cloud_networkservices_v1::model::GrpcRoute;
10543    /// let x = CreateGrpcRouteRequest::new().set_or_clear_grpc_route(Some(GrpcRoute::default()/* use setters */));
10544    /// let x = CreateGrpcRouteRequest::new().set_or_clear_grpc_route(None::<GrpcRoute>);
10545    /// ```
10546    pub fn set_or_clear_grpc_route<T>(mut self, v: std::option::Option<T>) -> Self
10547    where
10548        T: std::convert::Into<crate::model::GrpcRoute>,
10549    {
10550        self.grpc_route = v.map(|x| x.into());
10551        self
10552    }
10553}
10554
10555impl wkt::message::Message for CreateGrpcRouteRequest {
10556    fn typename() -> &'static str {
10557        "type.googleapis.com/google.cloud.networkservices.v1.CreateGrpcRouteRequest"
10558    }
10559}
10560
10561/// Request used by the UpdateGrpcRoute method.
10562#[derive(Clone, Default, PartialEq)]
10563#[non_exhaustive]
10564pub struct UpdateGrpcRouteRequest {
10565    /// Optional. Field mask is used to specify the fields to be overwritten in the
10566    /// GrpcRoute resource by the update.
10567    /// The fields specified in the update_mask are relative to the resource, not
10568    /// the full request. A field will be overwritten if it is in the mask. If the
10569    /// user does not provide a mask then all fields will be overwritten.
10570    pub update_mask: std::option::Option<wkt::FieldMask>,
10571
10572    /// Required. Updated GrpcRoute resource.
10573    pub grpc_route: std::option::Option<crate::model::GrpcRoute>,
10574
10575    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10576}
10577
10578impl UpdateGrpcRouteRequest {
10579    pub fn new() -> Self {
10580        std::default::Default::default()
10581    }
10582
10583    /// Sets the value of [update_mask][crate::model::UpdateGrpcRouteRequest::update_mask].
10584    ///
10585    /// # Example
10586    /// ```ignore,no_run
10587    /// # use google_cloud_networkservices_v1::model::UpdateGrpcRouteRequest;
10588    /// use wkt::FieldMask;
10589    /// let x = UpdateGrpcRouteRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10590    /// ```
10591    pub fn set_update_mask<T>(mut self, v: T) -> Self
10592    where
10593        T: std::convert::Into<wkt::FieldMask>,
10594    {
10595        self.update_mask = std::option::Option::Some(v.into());
10596        self
10597    }
10598
10599    /// Sets or clears the value of [update_mask][crate::model::UpdateGrpcRouteRequest::update_mask].
10600    ///
10601    /// # Example
10602    /// ```ignore,no_run
10603    /// # use google_cloud_networkservices_v1::model::UpdateGrpcRouteRequest;
10604    /// use wkt::FieldMask;
10605    /// let x = UpdateGrpcRouteRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10606    /// let x = UpdateGrpcRouteRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10607    /// ```
10608    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10609    where
10610        T: std::convert::Into<wkt::FieldMask>,
10611    {
10612        self.update_mask = v.map(|x| x.into());
10613        self
10614    }
10615
10616    /// Sets the value of [grpc_route][crate::model::UpdateGrpcRouteRequest::grpc_route].
10617    ///
10618    /// # Example
10619    /// ```ignore,no_run
10620    /// # use google_cloud_networkservices_v1::model::UpdateGrpcRouteRequest;
10621    /// use google_cloud_networkservices_v1::model::GrpcRoute;
10622    /// let x = UpdateGrpcRouteRequest::new().set_grpc_route(GrpcRoute::default()/* use setters */);
10623    /// ```
10624    pub fn set_grpc_route<T>(mut self, v: T) -> Self
10625    where
10626        T: std::convert::Into<crate::model::GrpcRoute>,
10627    {
10628        self.grpc_route = std::option::Option::Some(v.into());
10629        self
10630    }
10631
10632    /// Sets or clears the value of [grpc_route][crate::model::UpdateGrpcRouteRequest::grpc_route].
10633    ///
10634    /// # Example
10635    /// ```ignore,no_run
10636    /// # use google_cloud_networkservices_v1::model::UpdateGrpcRouteRequest;
10637    /// use google_cloud_networkservices_v1::model::GrpcRoute;
10638    /// let x = UpdateGrpcRouteRequest::new().set_or_clear_grpc_route(Some(GrpcRoute::default()/* use setters */));
10639    /// let x = UpdateGrpcRouteRequest::new().set_or_clear_grpc_route(None::<GrpcRoute>);
10640    /// ```
10641    pub fn set_or_clear_grpc_route<T>(mut self, v: std::option::Option<T>) -> Self
10642    where
10643        T: std::convert::Into<crate::model::GrpcRoute>,
10644    {
10645        self.grpc_route = v.map(|x| x.into());
10646        self
10647    }
10648}
10649
10650impl wkt::message::Message for UpdateGrpcRouteRequest {
10651    fn typename() -> &'static str {
10652        "type.googleapis.com/google.cloud.networkservices.v1.UpdateGrpcRouteRequest"
10653    }
10654}
10655
10656/// Request used by the DeleteGrpcRoute method.
10657#[derive(Clone, Default, PartialEq)]
10658#[non_exhaustive]
10659pub struct DeleteGrpcRouteRequest {
10660    /// Required. A name of the GrpcRoute to delete. Must be in the format
10661    /// `projects/*/locations/global/grpcRoutes/*`.
10662    pub name: std::string::String,
10663
10664    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10665}
10666
10667impl DeleteGrpcRouteRequest {
10668    pub fn new() -> Self {
10669        std::default::Default::default()
10670    }
10671
10672    /// Sets the value of [name][crate::model::DeleteGrpcRouteRequest::name].
10673    ///
10674    /// # Example
10675    /// ```ignore,no_run
10676    /// # use google_cloud_networkservices_v1::model::DeleteGrpcRouteRequest;
10677    /// let x = DeleteGrpcRouteRequest::new().set_name("example");
10678    /// ```
10679    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10680        self.name = v.into();
10681        self
10682    }
10683}
10684
10685impl wkt::message::Message for DeleteGrpcRouteRequest {
10686    fn typename() -> &'static str {
10687        "type.googleapis.com/google.cloud.networkservices.v1.DeleteGrpcRouteRequest"
10688    }
10689}
10690
10691/// HttpRoute is the resource defining how HTTP traffic should be routed by a
10692/// Mesh or Gateway resource.
10693#[derive(Clone, Default, PartialEq)]
10694#[non_exhaustive]
10695pub struct HttpRoute {
10696    /// Identifier. Name of the HttpRoute resource. It matches pattern
10697    /// `projects/*/locations/global/httpRoutes/http_route_name>`.
10698    pub name: std::string::String,
10699
10700    /// Output only. Server-defined URL of this resource
10701    pub self_link: std::string::String,
10702
10703    /// Optional. A free-text description of the resource. Max length 1024
10704    /// characters.
10705    pub description: std::string::String,
10706
10707    /// Output only. The timestamp when the resource was created.
10708    pub create_time: std::option::Option<wkt::Timestamp>,
10709
10710    /// Output only. The timestamp when the resource was updated.
10711    pub update_time: std::option::Option<wkt::Timestamp>,
10712
10713    /// Required. Hostnames define a set of hosts that should match against the
10714    /// HTTP host header to select a HttpRoute to process the request. Hostname is
10715    /// the fully qualified domain name of a network host, as defined by RFC 1123
10716    /// with the exception that:
10717    ///
10718    /// - IPs are not allowed.
10719    /// - A hostname may be prefixed with a wildcard label (`*.`). The wildcard
10720    ///   label must appear by itself as the first label.
10721    ///
10722    /// Hostname can be "precise" which is a domain name without the terminating
10723    /// dot of a network host (e.g. `foo.example.com`) or "wildcard", which is a
10724    /// domain name prefixed with a single wildcard label (e.g. `*.example.com`).
10725    ///
10726    /// Note that as per RFC1035 and RFC1123, a label must consist of lower case
10727    /// alphanumeric characters or '-', and must start and end with an alphanumeric
10728    /// character. No other punctuation is allowed.
10729    ///
10730    /// The routes associated with a Mesh or Gateways  must have unique hostnames.
10731    /// If you attempt to attach multiple routes with conflicting hostnames,
10732    /// the configuration will be rejected.
10733    ///
10734    /// For example, while it is acceptable for routes for the hostnames
10735    /// `*.foo.bar.com` and `*.bar.com` to be associated with the same Mesh (or
10736    /// Gateways under the same scope), it is not possible to associate two routes
10737    /// both with `*.bar.com` or both with `bar.com`.
10738    pub hostnames: std::vec::Vec<std::string::String>,
10739
10740    /// Optional. Meshes defines a list of meshes this HttpRoute is attached to, as
10741    /// one of the routing rules to route the requests served by the mesh.
10742    ///
10743    /// Each mesh reference should match the pattern:
10744    /// `projects/*/locations/global/meshes/<mesh_name>`
10745    ///
10746    /// The attached Mesh should be of a type SIDECAR
10747    pub meshes: std::vec::Vec<std::string::String>,
10748
10749    /// Optional. Gateways defines a list of gateways this HttpRoute is attached
10750    /// to, as one of the routing rules to route the requests served by the
10751    /// gateway.
10752    ///
10753    /// Each gateway reference should match the pattern:
10754    /// `projects/*/locations/global/gateways/<gateway_name>`
10755    pub gateways: std::vec::Vec<std::string::String>,
10756
10757    /// Optional. Set of label tags associated with the HttpRoute resource.
10758    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10759
10760    /// Required. Rules that define how traffic is routed and handled.
10761    /// Rules will be matched sequentially based on the RouteMatch specified for
10762    /// the rule.
10763    pub rules: std::vec::Vec<crate::model::http_route::RouteRule>,
10764
10765    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10766}
10767
10768impl HttpRoute {
10769    pub fn new() -> Self {
10770        std::default::Default::default()
10771    }
10772
10773    /// Sets the value of [name][crate::model::HttpRoute::name].
10774    ///
10775    /// # Example
10776    /// ```ignore,no_run
10777    /// # use google_cloud_networkservices_v1::model::HttpRoute;
10778    /// let x = HttpRoute::new().set_name("example");
10779    /// ```
10780    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10781        self.name = v.into();
10782        self
10783    }
10784
10785    /// Sets the value of [self_link][crate::model::HttpRoute::self_link].
10786    ///
10787    /// # Example
10788    /// ```ignore,no_run
10789    /// # use google_cloud_networkservices_v1::model::HttpRoute;
10790    /// let x = HttpRoute::new().set_self_link("example");
10791    /// ```
10792    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10793        self.self_link = v.into();
10794        self
10795    }
10796
10797    /// Sets the value of [description][crate::model::HttpRoute::description].
10798    ///
10799    /// # Example
10800    /// ```ignore,no_run
10801    /// # use google_cloud_networkservices_v1::model::HttpRoute;
10802    /// let x = HttpRoute::new().set_description("example");
10803    /// ```
10804    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10805        self.description = v.into();
10806        self
10807    }
10808
10809    /// Sets the value of [create_time][crate::model::HttpRoute::create_time].
10810    ///
10811    /// # Example
10812    /// ```ignore,no_run
10813    /// # use google_cloud_networkservices_v1::model::HttpRoute;
10814    /// use wkt::Timestamp;
10815    /// let x = HttpRoute::new().set_create_time(Timestamp::default()/* use setters */);
10816    /// ```
10817    pub fn set_create_time<T>(mut self, v: T) -> Self
10818    where
10819        T: std::convert::Into<wkt::Timestamp>,
10820    {
10821        self.create_time = std::option::Option::Some(v.into());
10822        self
10823    }
10824
10825    /// Sets or clears the value of [create_time][crate::model::HttpRoute::create_time].
10826    ///
10827    /// # Example
10828    /// ```ignore,no_run
10829    /// # use google_cloud_networkservices_v1::model::HttpRoute;
10830    /// use wkt::Timestamp;
10831    /// let x = HttpRoute::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
10832    /// let x = HttpRoute::new().set_or_clear_create_time(None::<Timestamp>);
10833    /// ```
10834    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10835    where
10836        T: std::convert::Into<wkt::Timestamp>,
10837    {
10838        self.create_time = v.map(|x| x.into());
10839        self
10840    }
10841
10842    /// Sets the value of [update_time][crate::model::HttpRoute::update_time].
10843    ///
10844    /// # Example
10845    /// ```ignore,no_run
10846    /// # use google_cloud_networkservices_v1::model::HttpRoute;
10847    /// use wkt::Timestamp;
10848    /// let x = HttpRoute::new().set_update_time(Timestamp::default()/* use setters */);
10849    /// ```
10850    pub fn set_update_time<T>(mut self, v: T) -> Self
10851    where
10852        T: std::convert::Into<wkt::Timestamp>,
10853    {
10854        self.update_time = std::option::Option::Some(v.into());
10855        self
10856    }
10857
10858    /// Sets or clears the value of [update_time][crate::model::HttpRoute::update_time].
10859    ///
10860    /// # Example
10861    /// ```ignore,no_run
10862    /// # use google_cloud_networkservices_v1::model::HttpRoute;
10863    /// use wkt::Timestamp;
10864    /// let x = HttpRoute::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
10865    /// let x = HttpRoute::new().set_or_clear_update_time(None::<Timestamp>);
10866    /// ```
10867    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
10868    where
10869        T: std::convert::Into<wkt::Timestamp>,
10870    {
10871        self.update_time = v.map(|x| x.into());
10872        self
10873    }
10874
10875    /// Sets the value of [hostnames][crate::model::HttpRoute::hostnames].
10876    ///
10877    /// # Example
10878    /// ```ignore,no_run
10879    /// # use google_cloud_networkservices_v1::model::HttpRoute;
10880    /// let x = HttpRoute::new().set_hostnames(["a", "b", "c"]);
10881    /// ```
10882    pub fn set_hostnames<T, V>(mut self, v: T) -> Self
10883    where
10884        T: std::iter::IntoIterator<Item = V>,
10885        V: std::convert::Into<std::string::String>,
10886    {
10887        use std::iter::Iterator;
10888        self.hostnames = v.into_iter().map(|i| i.into()).collect();
10889        self
10890    }
10891
10892    /// Sets the value of [meshes][crate::model::HttpRoute::meshes].
10893    ///
10894    /// # Example
10895    /// ```ignore,no_run
10896    /// # use google_cloud_networkservices_v1::model::HttpRoute;
10897    /// let x = HttpRoute::new().set_meshes(["a", "b", "c"]);
10898    /// ```
10899    pub fn set_meshes<T, V>(mut self, v: T) -> Self
10900    where
10901        T: std::iter::IntoIterator<Item = V>,
10902        V: std::convert::Into<std::string::String>,
10903    {
10904        use std::iter::Iterator;
10905        self.meshes = v.into_iter().map(|i| i.into()).collect();
10906        self
10907    }
10908
10909    /// Sets the value of [gateways][crate::model::HttpRoute::gateways].
10910    ///
10911    /// # Example
10912    /// ```ignore,no_run
10913    /// # use google_cloud_networkservices_v1::model::HttpRoute;
10914    /// let x = HttpRoute::new().set_gateways(["a", "b", "c"]);
10915    /// ```
10916    pub fn set_gateways<T, V>(mut self, v: T) -> Self
10917    where
10918        T: std::iter::IntoIterator<Item = V>,
10919        V: std::convert::Into<std::string::String>,
10920    {
10921        use std::iter::Iterator;
10922        self.gateways = v.into_iter().map(|i| i.into()).collect();
10923        self
10924    }
10925
10926    /// Sets the value of [labels][crate::model::HttpRoute::labels].
10927    ///
10928    /// # Example
10929    /// ```ignore,no_run
10930    /// # use google_cloud_networkservices_v1::model::HttpRoute;
10931    /// let x = HttpRoute::new().set_labels([
10932    ///     ("key0", "abc"),
10933    ///     ("key1", "xyz"),
10934    /// ]);
10935    /// ```
10936    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10937    where
10938        T: std::iter::IntoIterator<Item = (K, V)>,
10939        K: std::convert::Into<std::string::String>,
10940        V: std::convert::Into<std::string::String>,
10941    {
10942        use std::iter::Iterator;
10943        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10944        self
10945    }
10946
10947    /// Sets the value of [rules][crate::model::HttpRoute::rules].
10948    ///
10949    /// # Example
10950    /// ```ignore,no_run
10951    /// # use google_cloud_networkservices_v1::model::HttpRoute;
10952    /// use google_cloud_networkservices_v1::model::http_route::RouteRule;
10953    /// let x = HttpRoute::new()
10954    ///     .set_rules([
10955    ///         RouteRule::default()/* use setters */,
10956    ///         RouteRule::default()/* use (different) setters */,
10957    ///     ]);
10958    /// ```
10959    pub fn set_rules<T, V>(mut self, v: T) -> Self
10960    where
10961        T: std::iter::IntoIterator<Item = V>,
10962        V: std::convert::Into<crate::model::http_route::RouteRule>,
10963    {
10964        use std::iter::Iterator;
10965        self.rules = v.into_iter().map(|i| i.into()).collect();
10966        self
10967    }
10968}
10969
10970impl wkt::message::Message for HttpRoute {
10971    fn typename() -> &'static str {
10972        "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute"
10973    }
10974}
10975
10976/// Defines additional types related to [HttpRoute].
10977pub mod http_route {
10978    #[allow(unused_imports)]
10979    use super::*;
10980
10981    /// Specifies how to select a route rule based on HTTP request headers.
10982    #[derive(Clone, Default, PartialEq)]
10983    #[non_exhaustive]
10984    pub struct HeaderMatch {
10985        /// The name of the HTTP header to match against.
10986        pub header: std::string::String,
10987
10988        /// If specified, the match result will be inverted before checking. Default
10989        /// value is set to false.
10990        pub invert_match: bool,
10991
10992        pub match_type: std::option::Option<crate::model::http_route::header_match::MatchType>,
10993
10994        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10995    }
10996
10997    impl HeaderMatch {
10998        pub fn new() -> Self {
10999            std::default::Default::default()
11000        }
11001
11002        /// Sets the value of [header][crate::model::http_route::HeaderMatch::header].
11003        ///
11004        /// # Example
11005        /// ```ignore,no_run
11006        /// # use google_cloud_networkservices_v1::model::http_route::HeaderMatch;
11007        /// let x = HeaderMatch::new().set_header("example");
11008        /// ```
11009        pub fn set_header<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11010            self.header = v.into();
11011            self
11012        }
11013
11014        /// Sets the value of [invert_match][crate::model::http_route::HeaderMatch::invert_match].
11015        ///
11016        /// # Example
11017        /// ```ignore,no_run
11018        /// # use google_cloud_networkservices_v1::model::http_route::HeaderMatch;
11019        /// let x = HeaderMatch::new().set_invert_match(true);
11020        /// ```
11021        pub fn set_invert_match<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11022            self.invert_match = v.into();
11023            self
11024        }
11025
11026        /// Sets the value of [match_type][crate::model::http_route::HeaderMatch::match_type].
11027        ///
11028        /// Note that all the setters affecting `match_type` are mutually
11029        /// exclusive.
11030        ///
11031        /// # Example
11032        /// ```ignore,no_run
11033        /// # use google_cloud_networkservices_v1::model::http_route::HeaderMatch;
11034        /// use google_cloud_networkservices_v1::model::http_route::header_match::MatchType;
11035        /// let x = HeaderMatch::new().set_match_type(Some(MatchType::ExactMatch("example".to_string())));
11036        /// ```
11037        pub fn set_match_type<
11038            T: std::convert::Into<
11039                    std::option::Option<crate::model::http_route::header_match::MatchType>,
11040                >,
11041        >(
11042            mut self,
11043            v: T,
11044        ) -> Self {
11045            self.match_type = v.into();
11046            self
11047        }
11048
11049        /// The value of [match_type][crate::model::http_route::HeaderMatch::match_type]
11050        /// if it holds a `ExactMatch`, `None` if the field is not set or
11051        /// holds a different branch.
11052        pub fn exact_match(&self) -> std::option::Option<&std::string::String> {
11053            #[allow(unreachable_patterns)]
11054            self.match_type.as_ref().and_then(|v| match v {
11055                crate::model::http_route::header_match::MatchType::ExactMatch(v) => {
11056                    std::option::Option::Some(v)
11057                }
11058                _ => std::option::Option::None,
11059            })
11060        }
11061
11062        /// Sets the value of [match_type][crate::model::http_route::HeaderMatch::match_type]
11063        /// to hold a `ExactMatch`.
11064        ///
11065        /// Note that all the setters affecting `match_type` are
11066        /// mutually exclusive.
11067        ///
11068        /// # Example
11069        /// ```ignore,no_run
11070        /// # use google_cloud_networkservices_v1::model::http_route::HeaderMatch;
11071        /// let x = HeaderMatch::new().set_exact_match("example");
11072        /// assert!(x.exact_match().is_some());
11073        /// assert!(x.regex_match().is_none());
11074        /// assert!(x.prefix_match().is_none());
11075        /// assert!(x.present_match().is_none());
11076        /// assert!(x.suffix_match().is_none());
11077        /// assert!(x.range_match().is_none());
11078        /// ```
11079        pub fn set_exact_match<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11080            self.match_type = std::option::Option::Some(
11081                crate::model::http_route::header_match::MatchType::ExactMatch(v.into()),
11082            );
11083            self
11084        }
11085
11086        /// The value of [match_type][crate::model::http_route::HeaderMatch::match_type]
11087        /// if it holds a `RegexMatch`, `None` if the field is not set or
11088        /// holds a different branch.
11089        pub fn regex_match(&self) -> std::option::Option<&std::string::String> {
11090            #[allow(unreachable_patterns)]
11091            self.match_type.as_ref().and_then(|v| match v {
11092                crate::model::http_route::header_match::MatchType::RegexMatch(v) => {
11093                    std::option::Option::Some(v)
11094                }
11095                _ => std::option::Option::None,
11096            })
11097        }
11098
11099        /// Sets the value of [match_type][crate::model::http_route::HeaderMatch::match_type]
11100        /// to hold a `RegexMatch`.
11101        ///
11102        /// Note that all the setters affecting `match_type` are
11103        /// mutually exclusive.
11104        ///
11105        /// # Example
11106        /// ```ignore,no_run
11107        /// # use google_cloud_networkservices_v1::model::http_route::HeaderMatch;
11108        /// let x = HeaderMatch::new().set_regex_match("example");
11109        /// assert!(x.regex_match().is_some());
11110        /// assert!(x.exact_match().is_none());
11111        /// assert!(x.prefix_match().is_none());
11112        /// assert!(x.present_match().is_none());
11113        /// assert!(x.suffix_match().is_none());
11114        /// assert!(x.range_match().is_none());
11115        /// ```
11116        pub fn set_regex_match<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11117            self.match_type = std::option::Option::Some(
11118                crate::model::http_route::header_match::MatchType::RegexMatch(v.into()),
11119            );
11120            self
11121        }
11122
11123        /// The value of [match_type][crate::model::http_route::HeaderMatch::match_type]
11124        /// if it holds a `PrefixMatch`, `None` if the field is not set or
11125        /// holds a different branch.
11126        pub fn prefix_match(&self) -> std::option::Option<&std::string::String> {
11127            #[allow(unreachable_patterns)]
11128            self.match_type.as_ref().and_then(|v| match v {
11129                crate::model::http_route::header_match::MatchType::PrefixMatch(v) => {
11130                    std::option::Option::Some(v)
11131                }
11132                _ => std::option::Option::None,
11133            })
11134        }
11135
11136        /// Sets the value of [match_type][crate::model::http_route::HeaderMatch::match_type]
11137        /// to hold a `PrefixMatch`.
11138        ///
11139        /// Note that all the setters affecting `match_type` are
11140        /// mutually exclusive.
11141        ///
11142        /// # Example
11143        /// ```ignore,no_run
11144        /// # use google_cloud_networkservices_v1::model::http_route::HeaderMatch;
11145        /// let x = HeaderMatch::new().set_prefix_match("example");
11146        /// assert!(x.prefix_match().is_some());
11147        /// assert!(x.exact_match().is_none());
11148        /// assert!(x.regex_match().is_none());
11149        /// assert!(x.present_match().is_none());
11150        /// assert!(x.suffix_match().is_none());
11151        /// assert!(x.range_match().is_none());
11152        /// ```
11153        pub fn set_prefix_match<T: std::convert::Into<std::string::String>>(
11154            mut self,
11155            v: T,
11156        ) -> Self {
11157            self.match_type = std::option::Option::Some(
11158                crate::model::http_route::header_match::MatchType::PrefixMatch(v.into()),
11159            );
11160            self
11161        }
11162
11163        /// The value of [match_type][crate::model::http_route::HeaderMatch::match_type]
11164        /// if it holds a `PresentMatch`, `None` if the field is not set or
11165        /// holds a different branch.
11166        pub fn present_match(&self) -> std::option::Option<&bool> {
11167            #[allow(unreachable_patterns)]
11168            self.match_type.as_ref().and_then(|v| match v {
11169                crate::model::http_route::header_match::MatchType::PresentMatch(v) => {
11170                    std::option::Option::Some(v)
11171                }
11172                _ => std::option::Option::None,
11173            })
11174        }
11175
11176        /// Sets the value of [match_type][crate::model::http_route::HeaderMatch::match_type]
11177        /// to hold a `PresentMatch`.
11178        ///
11179        /// Note that all the setters affecting `match_type` are
11180        /// mutually exclusive.
11181        ///
11182        /// # Example
11183        /// ```ignore,no_run
11184        /// # use google_cloud_networkservices_v1::model::http_route::HeaderMatch;
11185        /// let x = HeaderMatch::new().set_present_match(true);
11186        /// assert!(x.present_match().is_some());
11187        /// assert!(x.exact_match().is_none());
11188        /// assert!(x.regex_match().is_none());
11189        /// assert!(x.prefix_match().is_none());
11190        /// assert!(x.suffix_match().is_none());
11191        /// assert!(x.range_match().is_none());
11192        /// ```
11193        pub fn set_present_match<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11194            self.match_type = std::option::Option::Some(
11195                crate::model::http_route::header_match::MatchType::PresentMatch(v.into()),
11196            );
11197            self
11198        }
11199
11200        /// The value of [match_type][crate::model::http_route::HeaderMatch::match_type]
11201        /// if it holds a `SuffixMatch`, `None` if the field is not set or
11202        /// holds a different branch.
11203        pub fn suffix_match(&self) -> std::option::Option<&std::string::String> {
11204            #[allow(unreachable_patterns)]
11205            self.match_type.as_ref().and_then(|v| match v {
11206                crate::model::http_route::header_match::MatchType::SuffixMatch(v) => {
11207                    std::option::Option::Some(v)
11208                }
11209                _ => std::option::Option::None,
11210            })
11211        }
11212
11213        /// Sets the value of [match_type][crate::model::http_route::HeaderMatch::match_type]
11214        /// to hold a `SuffixMatch`.
11215        ///
11216        /// Note that all the setters affecting `match_type` are
11217        /// mutually exclusive.
11218        ///
11219        /// # Example
11220        /// ```ignore,no_run
11221        /// # use google_cloud_networkservices_v1::model::http_route::HeaderMatch;
11222        /// let x = HeaderMatch::new().set_suffix_match("example");
11223        /// assert!(x.suffix_match().is_some());
11224        /// assert!(x.exact_match().is_none());
11225        /// assert!(x.regex_match().is_none());
11226        /// assert!(x.prefix_match().is_none());
11227        /// assert!(x.present_match().is_none());
11228        /// assert!(x.range_match().is_none());
11229        /// ```
11230        pub fn set_suffix_match<T: std::convert::Into<std::string::String>>(
11231            mut self,
11232            v: T,
11233        ) -> Self {
11234            self.match_type = std::option::Option::Some(
11235                crate::model::http_route::header_match::MatchType::SuffixMatch(v.into()),
11236            );
11237            self
11238        }
11239
11240        /// The value of [match_type][crate::model::http_route::HeaderMatch::match_type]
11241        /// if it holds a `RangeMatch`, `None` if the field is not set or
11242        /// holds a different branch.
11243        pub fn range_match(
11244            &self,
11245        ) -> std::option::Option<
11246            &std::boxed::Box<crate::model::http_route::header_match::IntegerRange>,
11247        > {
11248            #[allow(unreachable_patterns)]
11249            self.match_type.as_ref().and_then(|v| match v {
11250                crate::model::http_route::header_match::MatchType::RangeMatch(v) => {
11251                    std::option::Option::Some(v)
11252                }
11253                _ => std::option::Option::None,
11254            })
11255        }
11256
11257        /// Sets the value of [match_type][crate::model::http_route::HeaderMatch::match_type]
11258        /// to hold a `RangeMatch`.
11259        ///
11260        /// Note that all the setters affecting `match_type` are
11261        /// mutually exclusive.
11262        ///
11263        /// # Example
11264        /// ```ignore,no_run
11265        /// # use google_cloud_networkservices_v1::model::http_route::HeaderMatch;
11266        /// use google_cloud_networkservices_v1::model::http_route::header_match::IntegerRange;
11267        /// let x = HeaderMatch::new().set_range_match(IntegerRange::default()/* use setters */);
11268        /// assert!(x.range_match().is_some());
11269        /// assert!(x.exact_match().is_none());
11270        /// assert!(x.regex_match().is_none());
11271        /// assert!(x.prefix_match().is_none());
11272        /// assert!(x.present_match().is_none());
11273        /// assert!(x.suffix_match().is_none());
11274        /// ```
11275        pub fn set_range_match<
11276            T: std::convert::Into<
11277                    std::boxed::Box<crate::model::http_route::header_match::IntegerRange>,
11278                >,
11279        >(
11280            mut self,
11281            v: T,
11282        ) -> Self {
11283            self.match_type = std::option::Option::Some(
11284                crate::model::http_route::header_match::MatchType::RangeMatch(v.into()),
11285            );
11286            self
11287        }
11288    }
11289
11290    impl wkt::message::Message for HeaderMatch {
11291        fn typename() -> &'static str {
11292            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.HeaderMatch"
11293        }
11294    }
11295
11296    /// Defines additional types related to [HeaderMatch].
11297    pub mod header_match {
11298        #[allow(unused_imports)]
11299        use super::*;
11300
11301        /// Represents an integer value range.
11302        #[derive(Clone, Default, PartialEq)]
11303        #[non_exhaustive]
11304        pub struct IntegerRange {
11305            /// Start of the range (inclusive)
11306            pub start: i32,
11307
11308            /// End of the range (exclusive)
11309            pub end: i32,
11310
11311            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11312        }
11313
11314        impl IntegerRange {
11315            pub fn new() -> Self {
11316                std::default::Default::default()
11317            }
11318
11319            /// Sets the value of [start][crate::model::http_route::header_match::IntegerRange::start].
11320            ///
11321            /// # Example
11322            /// ```ignore,no_run
11323            /// # use google_cloud_networkservices_v1::model::http_route::header_match::IntegerRange;
11324            /// let x = IntegerRange::new().set_start(42);
11325            /// ```
11326            pub fn set_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11327                self.start = v.into();
11328                self
11329            }
11330
11331            /// Sets the value of [end][crate::model::http_route::header_match::IntegerRange::end].
11332            ///
11333            /// # Example
11334            /// ```ignore,no_run
11335            /// # use google_cloud_networkservices_v1::model::http_route::header_match::IntegerRange;
11336            /// let x = IntegerRange::new().set_end(42);
11337            /// ```
11338            pub fn set_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11339                self.end = v.into();
11340                self
11341            }
11342        }
11343
11344        impl wkt::message::Message for IntegerRange {
11345            fn typename() -> &'static str {
11346                "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.HeaderMatch.IntegerRange"
11347            }
11348        }
11349
11350        #[derive(Clone, Debug, PartialEq)]
11351        #[non_exhaustive]
11352        pub enum MatchType {
11353            /// The value of the header should match exactly the content of
11354            /// exact_match.
11355            ExactMatch(std::string::String),
11356            /// The value of the header must match the regular expression specified in
11357            /// regex_match. For regular expression grammar, please see:
11358            /// <https://github.com/google/re2/wiki/Syntax>
11359            RegexMatch(std::string::String),
11360            /// The value of the header must start with the contents of prefix_match.
11361            PrefixMatch(std::string::String),
11362            /// A header with header_name must exist. The match takes place whether or
11363            /// not the header has a value.
11364            PresentMatch(bool),
11365            /// The value of the header must end with the contents of suffix_match.
11366            SuffixMatch(std::string::String),
11367            /// If specified, the rule will match if the request header value is within
11368            /// the range.
11369            RangeMatch(std::boxed::Box<crate::model::http_route::header_match::IntegerRange>),
11370        }
11371    }
11372
11373    /// Specifications to match a query parameter in the request.
11374    #[derive(Clone, Default, PartialEq)]
11375    #[non_exhaustive]
11376    pub struct QueryParameterMatch {
11377        /// The name of the query parameter to match.
11378        pub query_parameter: std::string::String,
11379
11380        pub match_type:
11381            std::option::Option<crate::model::http_route::query_parameter_match::MatchType>,
11382
11383        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11384    }
11385
11386    impl QueryParameterMatch {
11387        pub fn new() -> Self {
11388            std::default::Default::default()
11389        }
11390
11391        /// Sets the value of [query_parameter][crate::model::http_route::QueryParameterMatch::query_parameter].
11392        ///
11393        /// # Example
11394        /// ```ignore,no_run
11395        /// # use google_cloud_networkservices_v1::model::http_route::QueryParameterMatch;
11396        /// let x = QueryParameterMatch::new().set_query_parameter("example");
11397        /// ```
11398        pub fn set_query_parameter<T: std::convert::Into<std::string::String>>(
11399            mut self,
11400            v: T,
11401        ) -> Self {
11402            self.query_parameter = v.into();
11403            self
11404        }
11405
11406        /// Sets the value of [match_type][crate::model::http_route::QueryParameterMatch::match_type].
11407        ///
11408        /// Note that all the setters affecting `match_type` are mutually
11409        /// exclusive.
11410        ///
11411        /// # Example
11412        /// ```ignore,no_run
11413        /// # use google_cloud_networkservices_v1::model::http_route::QueryParameterMatch;
11414        /// use google_cloud_networkservices_v1::model::http_route::query_parameter_match::MatchType;
11415        /// let x = QueryParameterMatch::new().set_match_type(Some(MatchType::ExactMatch("example".to_string())));
11416        /// ```
11417        pub fn set_match_type<
11418            T: std::convert::Into<
11419                    std::option::Option<crate::model::http_route::query_parameter_match::MatchType>,
11420                >,
11421        >(
11422            mut self,
11423            v: T,
11424        ) -> Self {
11425            self.match_type = v.into();
11426            self
11427        }
11428
11429        /// The value of [match_type][crate::model::http_route::QueryParameterMatch::match_type]
11430        /// if it holds a `ExactMatch`, `None` if the field is not set or
11431        /// holds a different branch.
11432        pub fn exact_match(&self) -> std::option::Option<&std::string::String> {
11433            #[allow(unreachable_patterns)]
11434            self.match_type.as_ref().and_then(|v| match v {
11435                crate::model::http_route::query_parameter_match::MatchType::ExactMatch(v) => {
11436                    std::option::Option::Some(v)
11437                }
11438                _ => std::option::Option::None,
11439            })
11440        }
11441
11442        /// Sets the value of [match_type][crate::model::http_route::QueryParameterMatch::match_type]
11443        /// to hold a `ExactMatch`.
11444        ///
11445        /// Note that all the setters affecting `match_type` are
11446        /// mutually exclusive.
11447        ///
11448        /// # Example
11449        /// ```ignore,no_run
11450        /// # use google_cloud_networkservices_v1::model::http_route::QueryParameterMatch;
11451        /// let x = QueryParameterMatch::new().set_exact_match("example");
11452        /// assert!(x.exact_match().is_some());
11453        /// assert!(x.regex_match().is_none());
11454        /// assert!(x.present_match().is_none());
11455        /// ```
11456        pub fn set_exact_match<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11457            self.match_type = std::option::Option::Some(
11458                crate::model::http_route::query_parameter_match::MatchType::ExactMatch(v.into()),
11459            );
11460            self
11461        }
11462
11463        /// The value of [match_type][crate::model::http_route::QueryParameterMatch::match_type]
11464        /// if it holds a `RegexMatch`, `None` if the field is not set or
11465        /// holds a different branch.
11466        pub fn regex_match(&self) -> std::option::Option<&std::string::String> {
11467            #[allow(unreachable_patterns)]
11468            self.match_type.as_ref().and_then(|v| match v {
11469                crate::model::http_route::query_parameter_match::MatchType::RegexMatch(v) => {
11470                    std::option::Option::Some(v)
11471                }
11472                _ => std::option::Option::None,
11473            })
11474        }
11475
11476        /// Sets the value of [match_type][crate::model::http_route::QueryParameterMatch::match_type]
11477        /// to hold a `RegexMatch`.
11478        ///
11479        /// Note that all the setters affecting `match_type` are
11480        /// mutually exclusive.
11481        ///
11482        /// # Example
11483        /// ```ignore,no_run
11484        /// # use google_cloud_networkservices_v1::model::http_route::QueryParameterMatch;
11485        /// let x = QueryParameterMatch::new().set_regex_match("example");
11486        /// assert!(x.regex_match().is_some());
11487        /// assert!(x.exact_match().is_none());
11488        /// assert!(x.present_match().is_none());
11489        /// ```
11490        pub fn set_regex_match<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11491            self.match_type = std::option::Option::Some(
11492                crate::model::http_route::query_parameter_match::MatchType::RegexMatch(v.into()),
11493            );
11494            self
11495        }
11496
11497        /// The value of [match_type][crate::model::http_route::QueryParameterMatch::match_type]
11498        /// if it holds a `PresentMatch`, `None` if the field is not set or
11499        /// holds a different branch.
11500        pub fn present_match(&self) -> std::option::Option<&bool> {
11501            #[allow(unreachable_patterns)]
11502            self.match_type.as_ref().and_then(|v| match v {
11503                crate::model::http_route::query_parameter_match::MatchType::PresentMatch(v) => {
11504                    std::option::Option::Some(v)
11505                }
11506                _ => std::option::Option::None,
11507            })
11508        }
11509
11510        /// Sets the value of [match_type][crate::model::http_route::QueryParameterMatch::match_type]
11511        /// to hold a `PresentMatch`.
11512        ///
11513        /// Note that all the setters affecting `match_type` are
11514        /// mutually exclusive.
11515        ///
11516        /// # Example
11517        /// ```ignore,no_run
11518        /// # use google_cloud_networkservices_v1::model::http_route::QueryParameterMatch;
11519        /// let x = QueryParameterMatch::new().set_present_match(true);
11520        /// assert!(x.present_match().is_some());
11521        /// assert!(x.exact_match().is_none());
11522        /// assert!(x.regex_match().is_none());
11523        /// ```
11524        pub fn set_present_match<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11525            self.match_type = std::option::Option::Some(
11526                crate::model::http_route::query_parameter_match::MatchType::PresentMatch(v.into()),
11527            );
11528            self
11529        }
11530    }
11531
11532    impl wkt::message::Message for QueryParameterMatch {
11533        fn typename() -> &'static str {
11534            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.QueryParameterMatch"
11535        }
11536    }
11537
11538    /// Defines additional types related to [QueryParameterMatch].
11539    pub mod query_parameter_match {
11540        #[allow(unused_imports)]
11541        use super::*;
11542
11543        #[derive(Clone, Debug, PartialEq)]
11544        #[non_exhaustive]
11545        pub enum MatchType {
11546            /// The value of the query parameter must exactly match the contents of
11547            /// exact_match.
11548            ///
11549            /// Only one of exact_match, regex_match, or present_match must be set.
11550            ExactMatch(std::string::String),
11551            /// The value of the query parameter must match the regular expression
11552            /// specified by regex_match. For regular expression grammar, please see
11553            /// <https://github.com/google/re2/wiki/Syntax>
11554            ///
11555            /// Only one of exact_match, regex_match, or present_match must be set.
11556            RegexMatch(std::string::String),
11557            /// Specifies that the QueryParameterMatcher matches if request contains
11558            /// query parameter, irrespective of whether the parameter has a value or
11559            /// not.
11560            ///
11561            /// Only one of exact_match, regex_match, or present_match must be set.
11562            PresentMatch(bool),
11563        }
11564    }
11565
11566    /// RouteMatch defines specifications used to match requests. If multiple match
11567    /// types are set, this RouteMatch will match if ALL type of matches are
11568    /// matched.
11569    #[derive(Clone, Default, PartialEq)]
11570    #[non_exhaustive]
11571    pub struct RouteMatch {
11572        /// Specifies if prefix_match and full_path_match matches are case sensitive.
11573        /// The default value is false.
11574        pub ignore_case: bool,
11575
11576        /// Specifies a list of HTTP request headers to match against. ALL of the
11577        /// supplied headers must be matched.
11578        pub headers: std::vec::Vec<crate::model::http_route::HeaderMatch>,
11579
11580        /// Specifies a list of query parameters to match against. ALL of the query
11581        /// parameters must be matched.
11582        pub query_parameters: std::vec::Vec<crate::model::http_route::QueryParameterMatch>,
11583
11584        pub path_match: std::option::Option<crate::model::http_route::route_match::PathMatch>,
11585
11586        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11587    }
11588
11589    impl RouteMatch {
11590        pub fn new() -> Self {
11591            std::default::Default::default()
11592        }
11593
11594        /// Sets the value of [ignore_case][crate::model::http_route::RouteMatch::ignore_case].
11595        ///
11596        /// # Example
11597        /// ```ignore,no_run
11598        /// # use google_cloud_networkservices_v1::model::http_route::RouteMatch;
11599        /// let x = RouteMatch::new().set_ignore_case(true);
11600        /// ```
11601        pub fn set_ignore_case<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11602            self.ignore_case = v.into();
11603            self
11604        }
11605
11606        /// Sets the value of [headers][crate::model::http_route::RouteMatch::headers].
11607        ///
11608        /// # Example
11609        /// ```ignore,no_run
11610        /// # use google_cloud_networkservices_v1::model::http_route::RouteMatch;
11611        /// use google_cloud_networkservices_v1::model::http_route::HeaderMatch;
11612        /// let x = RouteMatch::new()
11613        ///     .set_headers([
11614        ///         HeaderMatch::default()/* use setters */,
11615        ///         HeaderMatch::default()/* use (different) setters */,
11616        ///     ]);
11617        /// ```
11618        pub fn set_headers<T, V>(mut self, v: T) -> Self
11619        where
11620            T: std::iter::IntoIterator<Item = V>,
11621            V: std::convert::Into<crate::model::http_route::HeaderMatch>,
11622        {
11623            use std::iter::Iterator;
11624            self.headers = v.into_iter().map(|i| i.into()).collect();
11625            self
11626        }
11627
11628        /// Sets the value of [query_parameters][crate::model::http_route::RouteMatch::query_parameters].
11629        ///
11630        /// # Example
11631        /// ```ignore,no_run
11632        /// # use google_cloud_networkservices_v1::model::http_route::RouteMatch;
11633        /// use google_cloud_networkservices_v1::model::http_route::QueryParameterMatch;
11634        /// let x = RouteMatch::new()
11635        ///     .set_query_parameters([
11636        ///         QueryParameterMatch::default()/* use setters */,
11637        ///         QueryParameterMatch::default()/* use (different) setters */,
11638        ///     ]);
11639        /// ```
11640        pub fn set_query_parameters<T, V>(mut self, v: T) -> Self
11641        where
11642            T: std::iter::IntoIterator<Item = V>,
11643            V: std::convert::Into<crate::model::http_route::QueryParameterMatch>,
11644        {
11645            use std::iter::Iterator;
11646            self.query_parameters = v.into_iter().map(|i| i.into()).collect();
11647            self
11648        }
11649
11650        /// Sets the value of [path_match][crate::model::http_route::RouteMatch::path_match].
11651        ///
11652        /// Note that all the setters affecting `path_match` are mutually
11653        /// exclusive.
11654        ///
11655        /// # Example
11656        /// ```ignore,no_run
11657        /// # use google_cloud_networkservices_v1::model::http_route::RouteMatch;
11658        /// use google_cloud_networkservices_v1::model::http_route::route_match::PathMatch;
11659        /// let x = RouteMatch::new().set_path_match(Some(PathMatch::FullPathMatch("example".to_string())));
11660        /// ```
11661        pub fn set_path_match<
11662            T: std::convert::Into<
11663                    std::option::Option<crate::model::http_route::route_match::PathMatch>,
11664                >,
11665        >(
11666            mut self,
11667            v: T,
11668        ) -> Self {
11669            self.path_match = v.into();
11670            self
11671        }
11672
11673        /// The value of [path_match][crate::model::http_route::RouteMatch::path_match]
11674        /// if it holds a `FullPathMatch`, `None` if the field is not set or
11675        /// holds a different branch.
11676        pub fn full_path_match(&self) -> std::option::Option<&std::string::String> {
11677            #[allow(unreachable_patterns)]
11678            self.path_match.as_ref().and_then(|v| match v {
11679                crate::model::http_route::route_match::PathMatch::FullPathMatch(v) => {
11680                    std::option::Option::Some(v)
11681                }
11682                _ => std::option::Option::None,
11683            })
11684        }
11685
11686        /// Sets the value of [path_match][crate::model::http_route::RouteMatch::path_match]
11687        /// to hold a `FullPathMatch`.
11688        ///
11689        /// Note that all the setters affecting `path_match` are
11690        /// mutually exclusive.
11691        ///
11692        /// # Example
11693        /// ```ignore,no_run
11694        /// # use google_cloud_networkservices_v1::model::http_route::RouteMatch;
11695        /// let x = RouteMatch::new().set_full_path_match("example");
11696        /// assert!(x.full_path_match().is_some());
11697        /// assert!(x.prefix_match().is_none());
11698        /// assert!(x.regex_match().is_none());
11699        /// ```
11700        pub fn set_full_path_match<T: std::convert::Into<std::string::String>>(
11701            mut self,
11702            v: T,
11703        ) -> Self {
11704            self.path_match = std::option::Option::Some(
11705                crate::model::http_route::route_match::PathMatch::FullPathMatch(v.into()),
11706            );
11707            self
11708        }
11709
11710        /// The value of [path_match][crate::model::http_route::RouteMatch::path_match]
11711        /// if it holds a `PrefixMatch`, `None` if the field is not set or
11712        /// holds a different branch.
11713        pub fn prefix_match(&self) -> std::option::Option<&std::string::String> {
11714            #[allow(unreachable_patterns)]
11715            self.path_match.as_ref().and_then(|v| match v {
11716                crate::model::http_route::route_match::PathMatch::PrefixMatch(v) => {
11717                    std::option::Option::Some(v)
11718                }
11719                _ => std::option::Option::None,
11720            })
11721        }
11722
11723        /// Sets the value of [path_match][crate::model::http_route::RouteMatch::path_match]
11724        /// to hold a `PrefixMatch`.
11725        ///
11726        /// Note that all the setters affecting `path_match` are
11727        /// mutually exclusive.
11728        ///
11729        /// # Example
11730        /// ```ignore,no_run
11731        /// # use google_cloud_networkservices_v1::model::http_route::RouteMatch;
11732        /// let x = RouteMatch::new().set_prefix_match("example");
11733        /// assert!(x.prefix_match().is_some());
11734        /// assert!(x.full_path_match().is_none());
11735        /// assert!(x.regex_match().is_none());
11736        /// ```
11737        pub fn set_prefix_match<T: std::convert::Into<std::string::String>>(
11738            mut self,
11739            v: T,
11740        ) -> Self {
11741            self.path_match = std::option::Option::Some(
11742                crate::model::http_route::route_match::PathMatch::PrefixMatch(v.into()),
11743            );
11744            self
11745        }
11746
11747        /// The value of [path_match][crate::model::http_route::RouteMatch::path_match]
11748        /// if it holds a `RegexMatch`, `None` if the field is not set or
11749        /// holds a different branch.
11750        pub fn regex_match(&self) -> std::option::Option<&std::string::String> {
11751            #[allow(unreachable_patterns)]
11752            self.path_match.as_ref().and_then(|v| match v {
11753                crate::model::http_route::route_match::PathMatch::RegexMatch(v) => {
11754                    std::option::Option::Some(v)
11755                }
11756                _ => std::option::Option::None,
11757            })
11758        }
11759
11760        /// Sets the value of [path_match][crate::model::http_route::RouteMatch::path_match]
11761        /// to hold a `RegexMatch`.
11762        ///
11763        /// Note that all the setters affecting `path_match` are
11764        /// mutually exclusive.
11765        ///
11766        /// # Example
11767        /// ```ignore,no_run
11768        /// # use google_cloud_networkservices_v1::model::http_route::RouteMatch;
11769        /// let x = RouteMatch::new().set_regex_match("example");
11770        /// assert!(x.regex_match().is_some());
11771        /// assert!(x.full_path_match().is_none());
11772        /// assert!(x.prefix_match().is_none());
11773        /// ```
11774        pub fn set_regex_match<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11775            self.path_match = std::option::Option::Some(
11776                crate::model::http_route::route_match::PathMatch::RegexMatch(v.into()),
11777            );
11778            self
11779        }
11780    }
11781
11782    impl wkt::message::Message for RouteMatch {
11783        fn typename() -> &'static str {
11784            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.RouteMatch"
11785        }
11786    }
11787
11788    /// Defines additional types related to [RouteMatch].
11789    pub mod route_match {
11790        #[allow(unused_imports)]
11791        use super::*;
11792
11793        #[derive(Clone, Debug, PartialEq)]
11794        #[non_exhaustive]
11795        pub enum PathMatch {
11796            /// The HTTP request path value should exactly match this value.
11797            ///
11798            /// Only one of full_path_match, prefix_match, or regex_match should be
11799            /// used.
11800            FullPathMatch(std::string::String),
11801            /// The HTTP request path value must begin with specified prefix_match.
11802            /// prefix_match must begin with a /.
11803            ///
11804            /// Only one of full_path_match, prefix_match, or regex_match should be
11805            /// used.
11806            PrefixMatch(std::string::String),
11807            /// The HTTP request path value must satisfy the regular expression
11808            /// specified by regex_match after removing any query parameters and anchor
11809            /// supplied with the original URL. For regular expression grammar, please
11810            /// see <https://github.com/google/re2/wiki/Syntax>
11811            ///
11812            /// Only one of full_path_match, prefix_match, or regex_match should be
11813            /// used.
11814            RegexMatch(std::string::String),
11815        }
11816    }
11817
11818    /// Specifications of a destination to which the request should be routed to.
11819    #[derive(Clone, Default, PartialEq)]
11820    #[non_exhaustive]
11821    pub struct Destination {
11822        /// The URL of a BackendService to route traffic to.
11823        pub service_name: std::string::String,
11824
11825        /// Specifies the proportion of requests forwarded to the backend referenced
11826        /// by the serviceName field. This is computed as:
11827        ///
11828        /// - weight/Sum(weights in this destination list).
11829        ///   For non-zero values, there may be some epsilon from the exact proportion
11830        ///   defined here depending on the precision an implementation supports.
11831        ///
11832        /// If only one serviceName is specified and it has a weight greater than 0,
11833        /// 100% of the traffic is forwarded to that backend.
11834        ///
11835        /// If weights are specified for any one service name, they need to be
11836        /// specified for all of them.
11837        ///
11838        /// If weights are unspecified for all services, then, traffic is distributed
11839        /// in equal proportions to all of them.
11840        pub weight: i32,
11841
11842        /// Optional. The specification for modifying the headers of a matching
11843        /// request prior to delivery of the request to the destination. If
11844        /// HeaderModifiers are set on both the Destination and the RouteAction, they
11845        /// will be merged. Conflicts between the two will not be resolved on the
11846        /// configuration.
11847        pub request_header_modifier: std::option::Option<crate::model::http_route::HeaderModifier>,
11848
11849        /// Optional. The specification for modifying the headers of a response prior
11850        /// to sending the response back to the client. If HeaderModifiers are set on
11851        /// both the Destination and the RouteAction, they will be merged. Conflicts
11852        /// between the two will not be resolved on the configuration.
11853        pub response_header_modifier: std::option::Option<crate::model::http_route::HeaderModifier>,
11854
11855        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11856    }
11857
11858    impl Destination {
11859        pub fn new() -> Self {
11860            std::default::Default::default()
11861        }
11862
11863        /// Sets the value of [service_name][crate::model::http_route::Destination::service_name].
11864        ///
11865        /// # Example
11866        /// ```ignore,no_run
11867        /// # use google_cloud_networkservices_v1::model::http_route::Destination;
11868        /// let x = Destination::new().set_service_name("example");
11869        /// ```
11870        pub fn set_service_name<T: std::convert::Into<std::string::String>>(
11871            mut self,
11872            v: T,
11873        ) -> Self {
11874            self.service_name = v.into();
11875            self
11876        }
11877
11878        /// Sets the value of [weight][crate::model::http_route::Destination::weight].
11879        ///
11880        /// # Example
11881        /// ```ignore,no_run
11882        /// # use google_cloud_networkservices_v1::model::http_route::Destination;
11883        /// let x = Destination::new().set_weight(42);
11884        /// ```
11885        pub fn set_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11886            self.weight = v.into();
11887            self
11888        }
11889
11890        /// Sets the value of [request_header_modifier][crate::model::http_route::Destination::request_header_modifier].
11891        ///
11892        /// # Example
11893        /// ```ignore,no_run
11894        /// # use google_cloud_networkservices_v1::model::http_route::Destination;
11895        /// use google_cloud_networkservices_v1::model::http_route::HeaderModifier;
11896        /// let x = Destination::new().set_request_header_modifier(HeaderModifier::default()/* use setters */);
11897        /// ```
11898        pub fn set_request_header_modifier<T>(mut self, v: T) -> Self
11899        where
11900            T: std::convert::Into<crate::model::http_route::HeaderModifier>,
11901        {
11902            self.request_header_modifier = std::option::Option::Some(v.into());
11903            self
11904        }
11905
11906        /// Sets or clears the value of [request_header_modifier][crate::model::http_route::Destination::request_header_modifier].
11907        ///
11908        /// # Example
11909        /// ```ignore,no_run
11910        /// # use google_cloud_networkservices_v1::model::http_route::Destination;
11911        /// use google_cloud_networkservices_v1::model::http_route::HeaderModifier;
11912        /// let x = Destination::new().set_or_clear_request_header_modifier(Some(HeaderModifier::default()/* use setters */));
11913        /// let x = Destination::new().set_or_clear_request_header_modifier(None::<HeaderModifier>);
11914        /// ```
11915        pub fn set_or_clear_request_header_modifier<T>(mut self, v: std::option::Option<T>) -> Self
11916        where
11917            T: std::convert::Into<crate::model::http_route::HeaderModifier>,
11918        {
11919            self.request_header_modifier = v.map(|x| x.into());
11920            self
11921        }
11922
11923        /// Sets the value of [response_header_modifier][crate::model::http_route::Destination::response_header_modifier].
11924        ///
11925        /// # Example
11926        /// ```ignore,no_run
11927        /// # use google_cloud_networkservices_v1::model::http_route::Destination;
11928        /// use google_cloud_networkservices_v1::model::http_route::HeaderModifier;
11929        /// let x = Destination::new().set_response_header_modifier(HeaderModifier::default()/* use setters */);
11930        /// ```
11931        pub fn set_response_header_modifier<T>(mut self, v: T) -> Self
11932        where
11933            T: std::convert::Into<crate::model::http_route::HeaderModifier>,
11934        {
11935            self.response_header_modifier = std::option::Option::Some(v.into());
11936            self
11937        }
11938
11939        /// Sets or clears the value of [response_header_modifier][crate::model::http_route::Destination::response_header_modifier].
11940        ///
11941        /// # Example
11942        /// ```ignore,no_run
11943        /// # use google_cloud_networkservices_v1::model::http_route::Destination;
11944        /// use google_cloud_networkservices_v1::model::http_route::HeaderModifier;
11945        /// let x = Destination::new().set_or_clear_response_header_modifier(Some(HeaderModifier::default()/* use setters */));
11946        /// let x = Destination::new().set_or_clear_response_header_modifier(None::<HeaderModifier>);
11947        /// ```
11948        pub fn set_or_clear_response_header_modifier<T>(mut self, v: std::option::Option<T>) -> Self
11949        where
11950            T: std::convert::Into<crate::model::http_route::HeaderModifier>,
11951        {
11952            self.response_header_modifier = v.map(|x| x.into());
11953            self
11954        }
11955    }
11956
11957    impl wkt::message::Message for Destination {
11958        fn typename() -> &'static str {
11959            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.Destination"
11960        }
11961    }
11962
11963    /// The specification for redirecting traffic.
11964    #[derive(Clone, Default, PartialEq)]
11965    #[non_exhaustive]
11966    pub struct Redirect {
11967        /// The host that will be used in the redirect response instead of the one
11968        /// that was supplied in the request.
11969        pub host_redirect: std::string::String,
11970
11971        /// The path that will be used in the redirect response instead of the one
11972        /// that was supplied in the request.
11973        /// path_redirect can not be supplied together with prefix_redirect. Supply
11974        /// one alone or neither. If neither is supplied, the path of the original
11975        /// request will be used for the redirect.
11976        pub path_redirect: std::string::String,
11977
11978        /// Indicates that during redirection, the matched prefix (or path) should be
11979        /// swapped with this value. This option allows URLs be dynamically created
11980        /// based on the request.
11981        pub prefix_rewrite: std::string::String,
11982
11983        /// The HTTP Status code to use for the redirect.
11984        pub response_code: crate::model::http_route::redirect::ResponseCode,
11985
11986        /// If set to true, the URL scheme in the redirected request is set to https.
11987        /// If set to false, the URL scheme of the redirected request will remain the
11988        /// same as that of the request.
11989        ///
11990        /// The default is set to false.
11991        pub https_redirect: bool,
11992
11993        /// if set to true, any accompanying query portion of the original URL is
11994        /// removed prior to redirecting the request. If set to false, the query
11995        /// portion of the original URL is retained.
11996        ///
11997        /// The default is set to false.
11998        pub strip_query: bool,
11999
12000        /// The port that will be used in the redirected request instead of the one
12001        /// that was supplied in the request.
12002        pub port_redirect: i32,
12003
12004        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12005    }
12006
12007    impl Redirect {
12008        pub fn new() -> Self {
12009            std::default::Default::default()
12010        }
12011
12012        /// Sets the value of [host_redirect][crate::model::http_route::Redirect::host_redirect].
12013        ///
12014        /// # Example
12015        /// ```ignore,no_run
12016        /// # use google_cloud_networkservices_v1::model::http_route::Redirect;
12017        /// let x = Redirect::new().set_host_redirect("example");
12018        /// ```
12019        pub fn set_host_redirect<T: std::convert::Into<std::string::String>>(
12020            mut self,
12021            v: T,
12022        ) -> Self {
12023            self.host_redirect = v.into();
12024            self
12025        }
12026
12027        /// Sets the value of [path_redirect][crate::model::http_route::Redirect::path_redirect].
12028        ///
12029        /// # Example
12030        /// ```ignore,no_run
12031        /// # use google_cloud_networkservices_v1::model::http_route::Redirect;
12032        /// let x = Redirect::new().set_path_redirect("example");
12033        /// ```
12034        pub fn set_path_redirect<T: std::convert::Into<std::string::String>>(
12035            mut self,
12036            v: T,
12037        ) -> Self {
12038            self.path_redirect = v.into();
12039            self
12040        }
12041
12042        /// Sets the value of [prefix_rewrite][crate::model::http_route::Redirect::prefix_rewrite].
12043        ///
12044        /// # Example
12045        /// ```ignore,no_run
12046        /// # use google_cloud_networkservices_v1::model::http_route::Redirect;
12047        /// let x = Redirect::new().set_prefix_rewrite("example");
12048        /// ```
12049        pub fn set_prefix_rewrite<T: std::convert::Into<std::string::String>>(
12050            mut self,
12051            v: T,
12052        ) -> Self {
12053            self.prefix_rewrite = v.into();
12054            self
12055        }
12056
12057        /// Sets the value of [response_code][crate::model::http_route::Redirect::response_code].
12058        ///
12059        /// # Example
12060        /// ```ignore,no_run
12061        /// # use google_cloud_networkservices_v1::model::http_route::Redirect;
12062        /// use google_cloud_networkservices_v1::model::http_route::redirect::ResponseCode;
12063        /// let x0 = Redirect::new().set_response_code(ResponseCode::MovedPermanentlyDefault);
12064        /// let x1 = Redirect::new().set_response_code(ResponseCode::Found);
12065        /// let x2 = Redirect::new().set_response_code(ResponseCode::SeeOther);
12066        /// ```
12067        pub fn set_response_code<
12068            T: std::convert::Into<crate::model::http_route::redirect::ResponseCode>,
12069        >(
12070            mut self,
12071            v: T,
12072        ) -> Self {
12073            self.response_code = v.into();
12074            self
12075        }
12076
12077        /// Sets the value of [https_redirect][crate::model::http_route::Redirect::https_redirect].
12078        ///
12079        /// # Example
12080        /// ```ignore,no_run
12081        /// # use google_cloud_networkservices_v1::model::http_route::Redirect;
12082        /// let x = Redirect::new().set_https_redirect(true);
12083        /// ```
12084        pub fn set_https_redirect<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12085            self.https_redirect = v.into();
12086            self
12087        }
12088
12089        /// Sets the value of [strip_query][crate::model::http_route::Redirect::strip_query].
12090        ///
12091        /// # Example
12092        /// ```ignore,no_run
12093        /// # use google_cloud_networkservices_v1::model::http_route::Redirect;
12094        /// let x = Redirect::new().set_strip_query(true);
12095        /// ```
12096        pub fn set_strip_query<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12097            self.strip_query = v.into();
12098            self
12099        }
12100
12101        /// Sets the value of [port_redirect][crate::model::http_route::Redirect::port_redirect].
12102        ///
12103        /// # Example
12104        /// ```ignore,no_run
12105        /// # use google_cloud_networkservices_v1::model::http_route::Redirect;
12106        /// let x = Redirect::new().set_port_redirect(42);
12107        /// ```
12108        pub fn set_port_redirect<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12109            self.port_redirect = v.into();
12110            self
12111        }
12112    }
12113
12114    impl wkt::message::Message for Redirect {
12115        fn typename() -> &'static str {
12116            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.Redirect"
12117        }
12118    }
12119
12120    /// Defines additional types related to [Redirect].
12121    pub mod redirect {
12122        #[allow(unused_imports)]
12123        use super::*;
12124
12125        /// Supported HTTP response code.
12126        ///
12127        /// # Working with unknown values
12128        ///
12129        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12130        /// additional enum variants at any time. Adding new variants is not considered
12131        /// a breaking change. Applications should write their code in anticipation of:
12132        ///
12133        /// - New values appearing in future releases of the client library, **and**
12134        /// - New values received dynamically, without application changes.
12135        ///
12136        /// Please consult the [Working with enums] section in the user guide for some
12137        /// guidelines.
12138        ///
12139        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12140        #[derive(Clone, Debug, PartialEq)]
12141        #[non_exhaustive]
12142        pub enum ResponseCode {
12143            /// Default value
12144            Unspecified,
12145            /// Corresponds to 301.
12146            MovedPermanentlyDefault,
12147            /// Corresponds to 302.
12148            Found,
12149            /// Corresponds to 303.
12150            SeeOther,
12151            /// Corresponds to 307. In this case, the request method will be retained.
12152            TemporaryRedirect,
12153            /// Corresponds to 308. In this case, the request method will be retained.
12154            PermanentRedirect,
12155            /// If set, the enum was initialized with an unknown value.
12156            ///
12157            /// Applications can examine the value using [ResponseCode::value] or
12158            /// [ResponseCode::name].
12159            UnknownValue(response_code::UnknownValue),
12160        }
12161
12162        #[doc(hidden)]
12163        pub mod response_code {
12164            #[allow(unused_imports)]
12165            use super::*;
12166            #[derive(Clone, Debug, PartialEq)]
12167            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12168        }
12169
12170        impl ResponseCode {
12171            /// Gets the enum value.
12172            ///
12173            /// Returns `None` if the enum contains an unknown value deserialized from
12174            /// the string representation of enums.
12175            pub fn value(&self) -> std::option::Option<i32> {
12176                match self {
12177                    Self::Unspecified => std::option::Option::Some(0),
12178                    Self::MovedPermanentlyDefault => std::option::Option::Some(1),
12179                    Self::Found => std::option::Option::Some(2),
12180                    Self::SeeOther => std::option::Option::Some(3),
12181                    Self::TemporaryRedirect => std::option::Option::Some(4),
12182                    Self::PermanentRedirect => std::option::Option::Some(5),
12183                    Self::UnknownValue(u) => u.0.value(),
12184                }
12185            }
12186
12187            /// Gets the enum value as a string.
12188            ///
12189            /// Returns `None` if the enum contains an unknown value deserialized from
12190            /// the integer representation of enums.
12191            pub fn name(&self) -> std::option::Option<&str> {
12192                match self {
12193                    Self::Unspecified => std::option::Option::Some("RESPONSE_CODE_UNSPECIFIED"),
12194                    Self::MovedPermanentlyDefault => {
12195                        std::option::Option::Some("MOVED_PERMANENTLY_DEFAULT")
12196                    }
12197                    Self::Found => std::option::Option::Some("FOUND"),
12198                    Self::SeeOther => std::option::Option::Some("SEE_OTHER"),
12199                    Self::TemporaryRedirect => std::option::Option::Some("TEMPORARY_REDIRECT"),
12200                    Self::PermanentRedirect => std::option::Option::Some("PERMANENT_REDIRECT"),
12201                    Self::UnknownValue(u) => u.0.name(),
12202                }
12203            }
12204        }
12205
12206        impl std::default::Default for ResponseCode {
12207            fn default() -> Self {
12208                use std::convert::From;
12209                Self::from(0)
12210            }
12211        }
12212
12213        impl std::fmt::Display for ResponseCode {
12214            fn fmt(
12215                &self,
12216                f: &mut std::fmt::Formatter<'_>,
12217            ) -> std::result::Result<(), std::fmt::Error> {
12218                wkt::internal::display_enum(f, self.name(), self.value())
12219            }
12220        }
12221
12222        impl std::convert::From<i32> for ResponseCode {
12223            fn from(value: i32) -> Self {
12224                match value {
12225                    0 => Self::Unspecified,
12226                    1 => Self::MovedPermanentlyDefault,
12227                    2 => Self::Found,
12228                    3 => Self::SeeOther,
12229                    4 => Self::TemporaryRedirect,
12230                    5 => Self::PermanentRedirect,
12231                    _ => Self::UnknownValue(response_code::UnknownValue(
12232                        wkt::internal::UnknownEnumValue::Integer(value),
12233                    )),
12234                }
12235            }
12236        }
12237
12238        impl std::convert::From<&str> for ResponseCode {
12239            fn from(value: &str) -> Self {
12240                use std::string::ToString;
12241                match value {
12242                    "RESPONSE_CODE_UNSPECIFIED" => Self::Unspecified,
12243                    "MOVED_PERMANENTLY_DEFAULT" => Self::MovedPermanentlyDefault,
12244                    "FOUND" => Self::Found,
12245                    "SEE_OTHER" => Self::SeeOther,
12246                    "TEMPORARY_REDIRECT" => Self::TemporaryRedirect,
12247                    "PERMANENT_REDIRECT" => Self::PermanentRedirect,
12248                    _ => Self::UnknownValue(response_code::UnknownValue(
12249                        wkt::internal::UnknownEnumValue::String(value.to_string()),
12250                    )),
12251                }
12252            }
12253        }
12254
12255        impl serde::ser::Serialize for ResponseCode {
12256            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12257            where
12258                S: serde::Serializer,
12259            {
12260                match self {
12261                    Self::Unspecified => serializer.serialize_i32(0),
12262                    Self::MovedPermanentlyDefault => serializer.serialize_i32(1),
12263                    Self::Found => serializer.serialize_i32(2),
12264                    Self::SeeOther => serializer.serialize_i32(3),
12265                    Self::TemporaryRedirect => serializer.serialize_i32(4),
12266                    Self::PermanentRedirect => serializer.serialize_i32(5),
12267                    Self::UnknownValue(u) => u.0.serialize(serializer),
12268                }
12269            }
12270        }
12271
12272        impl<'de> serde::de::Deserialize<'de> for ResponseCode {
12273            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12274            where
12275                D: serde::Deserializer<'de>,
12276            {
12277                deserializer.deserialize_any(wkt::internal::EnumVisitor::<ResponseCode>::new(
12278                    ".google.cloud.networkservices.v1.HttpRoute.Redirect.ResponseCode",
12279                ))
12280            }
12281        }
12282    }
12283
12284    /// The specification for fault injection introduced into traffic to test the
12285    /// resiliency of clients to destination service failure. As part of fault
12286    /// injection, when clients send requests to a destination, delays can be
12287    /// introduced by client proxy on a percentage of requests before sending those
12288    /// requests to the destination service. Similarly requests can be aborted by
12289    /// client proxy for a percentage of requests.
12290    #[derive(Clone, Default, PartialEq)]
12291    #[non_exhaustive]
12292    pub struct FaultInjectionPolicy {
12293        /// The specification for injecting delay to client requests.
12294        pub delay: std::option::Option<crate::model::http_route::fault_injection_policy::Delay>,
12295
12296        /// The specification for aborting to client requests.
12297        pub abort: std::option::Option<crate::model::http_route::fault_injection_policy::Abort>,
12298
12299        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12300    }
12301
12302    impl FaultInjectionPolicy {
12303        pub fn new() -> Self {
12304            std::default::Default::default()
12305        }
12306
12307        /// Sets the value of [delay][crate::model::http_route::FaultInjectionPolicy::delay].
12308        ///
12309        /// # Example
12310        /// ```ignore,no_run
12311        /// # use google_cloud_networkservices_v1::model::http_route::FaultInjectionPolicy;
12312        /// use google_cloud_networkservices_v1::model::http_route::fault_injection_policy::Delay;
12313        /// let x = FaultInjectionPolicy::new().set_delay(Delay::default()/* use setters */);
12314        /// ```
12315        pub fn set_delay<T>(mut self, v: T) -> Self
12316        where
12317            T: std::convert::Into<crate::model::http_route::fault_injection_policy::Delay>,
12318        {
12319            self.delay = std::option::Option::Some(v.into());
12320            self
12321        }
12322
12323        /// Sets or clears the value of [delay][crate::model::http_route::FaultInjectionPolicy::delay].
12324        ///
12325        /// # Example
12326        /// ```ignore,no_run
12327        /// # use google_cloud_networkservices_v1::model::http_route::FaultInjectionPolicy;
12328        /// use google_cloud_networkservices_v1::model::http_route::fault_injection_policy::Delay;
12329        /// let x = FaultInjectionPolicy::new().set_or_clear_delay(Some(Delay::default()/* use setters */));
12330        /// let x = FaultInjectionPolicy::new().set_or_clear_delay(None::<Delay>);
12331        /// ```
12332        pub fn set_or_clear_delay<T>(mut self, v: std::option::Option<T>) -> Self
12333        where
12334            T: std::convert::Into<crate::model::http_route::fault_injection_policy::Delay>,
12335        {
12336            self.delay = v.map(|x| x.into());
12337            self
12338        }
12339
12340        /// Sets the value of [abort][crate::model::http_route::FaultInjectionPolicy::abort].
12341        ///
12342        /// # Example
12343        /// ```ignore,no_run
12344        /// # use google_cloud_networkservices_v1::model::http_route::FaultInjectionPolicy;
12345        /// use google_cloud_networkservices_v1::model::http_route::fault_injection_policy::Abort;
12346        /// let x = FaultInjectionPolicy::new().set_abort(Abort::default()/* use setters */);
12347        /// ```
12348        pub fn set_abort<T>(mut self, v: T) -> Self
12349        where
12350            T: std::convert::Into<crate::model::http_route::fault_injection_policy::Abort>,
12351        {
12352            self.abort = std::option::Option::Some(v.into());
12353            self
12354        }
12355
12356        /// Sets or clears the value of [abort][crate::model::http_route::FaultInjectionPolicy::abort].
12357        ///
12358        /// # Example
12359        /// ```ignore,no_run
12360        /// # use google_cloud_networkservices_v1::model::http_route::FaultInjectionPolicy;
12361        /// use google_cloud_networkservices_v1::model::http_route::fault_injection_policy::Abort;
12362        /// let x = FaultInjectionPolicy::new().set_or_clear_abort(Some(Abort::default()/* use setters */));
12363        /// let x = FaultInjectionPolicy::new().set_or_clear_abort(None::<Abort>);
12364        /// ```
12365        pub fn set_or_clear_abort<T>(mut self, v: std::option::Option<T>) -> Self
12366        where
12367            T: std::convert::Into<crate::model::http_route::fault_injection_policy::Abort>,
12368        {
12369            self.abort = v.map(|x| x.into());
12370            self
12371        }
12372    }
12373
12374    impl wkt::message::Message for FaultInjectionPolicy {
12375        fn typename() -> &'static str {
12376            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy"
12377        }
12378    }
12379
12380    /// Defines additional types related to [FaultInjectionPolicy].
12381    pub mod fault_injection_policy {
12382        #[allow(unused_imports)]
12383        use super::*;
12384
12385        /// Specification of how client requests are delayed as part of fault
12386        /// injection before being sent to a destination.
12387        #[derive(Clone, Default, PartialEq)]
12388        #[non_exhaustive]
12389        pub struct Delay {
12390            /// Specify a fixed delay before forwarding the request.
12391            pub fixed_delay: std::option::Option<wkt::Duration>,
12392
12393            /// The percentage of traffic on which delay will be injected.
12394            ///
12395            /// The value must be between [0, 100]
12396            pub percentage: i32,
12397
12398            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12399        }
12400
12401        impl Delay {
12402            pub fn new() -> Self {
12403                std::default::Default::default()
12404            }
12405
12406            /// Sets the value of [fixed_delay][crate::model::http_route::fault_injection_policy::Delay::fixed_delay].
12407            ///
12408            /// # Example
12409            /// ```ignore,no_run
12410            /// # use google_cloud_networkservices_v1::model::http_route::fault_injection_policy::Delay;
12411            /// use wkt::Duration;
12412            /// let x = Delay::new().set_fixed_delay(Duration::default()/* use setters */);
12413            /// ```
12414            pub fn set_fixed_delay<T>(mut self, v: T) -> Self
12415            where
12416                T: std::convert::Into<wkt::Duration>,
12417            {
12418                self.fixed_delay = std::option::Option::Some(v.into());
12419                self
12420            }
12421
12422            /// Sets or clears the value of [fixed_delay][crate::model::http_route::fault_injection_policy::Delay::fixed_delay].
12423            ///
12424            /// # Example
12425            /// ```ignore,no_run
12426            /// # use google_cloud_networkservices_v1::model::http_route::fault_injection_policy::Delay;
12427            /// use wkt::Duration;
12428            /// let x = Delay::new().set_or_clear_fixed_delay(Some(Duration::default()/* use setters */));
12429            /// let x = Delay::new().set_or_clear_fixed_delay(None::<Duration>);
12430            /// ```
12431            pub fn set_or_clear_fixed_delay<T>(mut self, v: std::option::Option<T>) -> Self
12432            where
12433                T: std::convert::Into<wkt::Duration>,
12434            {
12435                self.fixed_delay = v.map(|x| x.into());
12436                self
12437            }
12438
12439            /// Sets the value of [percentage][crate::model::http_route::fault_injection_policy::Delay::percentage].
12440            ///
12441            /// # Example
12442            /// ```ignore,no_run
12443            /// # use google_cloud_networkservices_v1::model::http_route::fault_injection_policy::Delay;
12444            /// let x = Delay::new().set_percentage(42);
12445            /// ```
12446            pub fn set_percentage<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12447                self.percentage = v.into();
12448                self
12449            }
12450        }
12451
12452        impl wkt::message::Message for Delay {
12453            fn typename() -> &'static str {
12454                "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy.Delay"
12455            }
12456        }
12457
12458        /// Specification of how client requests are aborted as part of fault
12459        /// injection before being sent to a destination.
12460        #[derive(Clone, Default, PartialEq)]
12461        #[non_exhaustive]
12462        pub struct Abort {
12463            /// The HTTP status code used to abort the request.
12464            ///
12465            /// The value must be between 200 and 599 inclusive.
12466            pub http_status: i32,
12467
12468            /// The percentage of traffic which will be aborted.
12469            ///
12470            /// The value must be between [0, 100]
12471            pub percentage: i32,
12472
12473            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12474        }
12475
12476        impl Abort {
12477            pub fn new() -> Self {
12478                std::default::Default::default()
12479            }
12480
12481            /// Sets the value of [http_status][crate::model::http_route::fault_injection_policy::Abort::http_status].
12482            ///
12483            /// # Example
12484            /// ```ignore,no_run
12485            /// # use google_cloud_networkservices_v1::model::http_route::fault_injection_policy::Abort;
12486            /// let x = Abort::new().set_http_status(42);
12487            /// ```
12488            pub fn set_http_status<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12489                self.http_status = v.into();
12490                self
12491            }
12492
12493            /// Sets the value of [percentage][crate::model::http_route::fault_injection_policy::Abort::percentage].
12494            ///
12495            /// # Example
12496            /// ```ignore,no_run
12497            /// # use google_cloud_networkservices_v1::model::http_route::fault_injection_policy::Abort;
12498            /// let x = Abort::new().set_percentage(42);
12499            /// ```
12500            pub fn set_percentage<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12501                self.percentage = v.into();
12502                self
12503            }
12504        }
12505
12506        impl wkt::message::Message for Abort {
12507            fn typename() -> &'static str {
12508                "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy.Abort"
12509            }
12510        }
12511    }
12512
12513    /// The specification for cookie-based stateful session affinity where the
12514    /// date plane supplies a “session cookie”  with the name "GSSA" which encodes
12515    /// a specific destination host and each request containing that cookie will
12516    /// be directed to that host as long as the destination host remains up and
12517    /// healthy.
12518    ///
12519    /// The gRPC proxyless mesh library or sidecar proxy will manage the session
12520    /// cookie but the client application code is responsible for copying the
12521    /// cookie from each RPC in the session to the next.
12522    #[derive(Clone, Default, PartialEq)]
12523    #[non_exhaustive]
12524    pub struct StatefulSessionAffinityPolicy {
12525        /// Required. The cookie TTL value for the Set-Cookie header generated by
12526        /// the data plane. The lifetime of the cookie may be set to a value from 0
12527        /// to 86400 seconds (24 hours) inclusive.
12528        ///
12529        /// Set this to 0s to use a session cookie and disable cookie expiration.
12530        pub cookie_ttl: std::option::Option<wkt::Duration>,
12531
12532        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12533    }
12534
12535    impl StatefulSessionAffinityPolicy {
12536        pub fn new() -> Self {
12537            std::default::Default::default()
12538        }
12539
12540        /// Sets the value of [cookie_ttl][crate::model::http_route::StatefulSessionAffinityPolicy::cookie_ttl].
12541        ///
12542        /// # Example
12543        /// ```ignore,no_run
12544        /// # use google_cloud_networkservices_v1::model::http_route::StatefulSessionAffinityPolicy;
12545        /// use wkt::Duration;
12546        /// let x = StatefulSessionAffinityPolicy::new().set_cookie_ttl(Duration::default()/* use setters */);
12547        /// ```
12548        pub fn set_cookie_ttl<T>(mut self, v: T) -> Self
12549        where
12550            T: std::convert::Into<wkt::Duration>,
12551        {
12552            self.cookie_ttl = std::option::Option::Some(v.into());
12553            self
12554        }
12555
12556        /// Sets or clears the value of [cookie_ttl][crate::model::http_route::StatefulSessionAffinityPolicy::cookie_ttl].
12557        ///
12558        /// # Example
12559        /// ```ignore,no_run
12560        /// # use google_cloud_networkservices_v1::model::http_route::StatefulSessionAffinityPolicy;
12561        /// use wkt::Duration;
12562        /// let x = StatefulSessionAffinityPolicy::new().set_or_clear_cookie_ttl(Some(Duration::default()/* use setters */));
12563        /// let x = StatefulSessionAffinityPolicy::new().set_or_clear_cookie_ttl(None::<Duration>);
12564        /// ```
12565        pub fn set_or_clear_cookie_ttl<T>(mut self, v: std::option::Option<T>) -> Self
12566        where
12567            T: std::convert::Into<wkt::Duration>,
12568        {
12569            self.cookie_ttl = v.map(|x| x.into());
12570            self
12571        }
12572    }
12573
12574    impl wkt::message::Message for StatefulSessionAffinityPolicy {
12575        fn typename() -> &'static str {
12576            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.StatefulSessionAffinityPolicy"
12577        }
12578    }
12579
12580    /// The specification for modifying HTTP header in HTTP request and HTTP
12581    /// response.
12582    #[derive(Clone, Default, PartialEq)]
12583    #[non_exhaustive]
12584    pub struct HeaderModifier {
12585        /// Completely overwrite/replace the headers with given map where key is the
12586        /// name of the header, value is the value of the header.
12587        pub set: std::collections::HashMap<std::string::String, std::string::String>,
12588
12589        /// Add the headers with given map where key is the name of the header, value
12590        /// is the value of the header.
12591        pub add: std::collections::HashMap<std::string::String, std::string::String>,
12592
12593        /// Remove headers (matching by header names) specified in the list.
12594        pub remove: std::vec::Vec<std::string::String>,
12595
12596        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12597    }
12598
12599    impl HeaderModifier {
12600        pub fn new() -> Self {
12601            std::default::Default::default()
12602        }
12603
12604        /// Sets the value of [set][crate::model::http_route::HeaderModifier::set].
12605        ///
12606        /// # Example
12607        /// ```ignore,no_run
12608        /// # use google_cloud_networkservices_v1::model::http_route::HeaderModifier;
12609        /// let x = HeaderModifier::new().set_set([
12610        ///     ("key0", "abc"),
12611        ///     ("key1", "xyz"),
12612        /// ]);
12613        /// ```
12614        pub fn set_set<T, K, V>(mut self, v: T) -> Self
12615        where
12616            T: std::iter::IntoIterator<Item = (K, V)>,
12617            K: std::convert::Into<std::string::String>,
12618            V: std::convert::Into<std::string::String>,
12619        {
12620            use std::iter::Iterator;
12621            self.set = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12622            self
12623        }
12624
12625        /// Sets the value of [add][crate::model::http_route::HeaderModifier::add].
12626        ///
12627        /// # Example
12628        /// ```ignore,no_run
12629        /// # use google_cloud_networkservices_v1::model::http_route::HeaderModifier;
12630        /// let x = HeaderModifier::new().set_add([
12631        ///     ("key0", "abc"),
12632        ///     ("key1", "xyz"),
12633        /// ]);
12634        /// ```
12635        pub fn set_add<T, K, V>(mut self, v: T) -> Self
12636        where
12637            T: std::iter::IntoIterator<Item = (K, V)>,
12638            K: std::convert::Into<std::string::String>,
12639            V: std::convert::Into<std::string::String>,
12640        {
12641            use std::iter::Iterator;
12642            self.add = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12643            self
12644        }
12645
12646        /// Sets the value of [remove][crate::model::http_route::HeaderModifier::remove].
12647        ///
12648        /// # Example
12649        /// ```ignore,no_run
12650        /// # use google_cloud_networkservices_v1::model::http_route::HeaderModifier;
12651        /// let x = HeaderModifier::new().set_remove(["a", "b", "c"]);
12652        /// ```
12653        pub fn set_remove<T, V>(mut self, v: T) -> Self
12654        where
12655            T: std::iter::IntoIterator<Item = V>,
12656            V: std::convert::Into<std::string::String>,
12657        {
12658            use std::iter::Iterator;
12659            self.remove = v.into_iter().map(|i| i.into()).collect();
12660            self
12661        }
12662    }
12663
12664    impl wkt::message::Message for HeaderModifier {
12665        fn typename() -> &'static str {
12666            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.HeaderModifier"
12667        }
12668    }
12669
12670    /// The specification for modifying the URL of the request, prior to forwarding
12671    /// the request to the destination.
12672    #[derive(Clone, Default, PartialEq)]
12673    #[non_exhaustive]
12674    pub struct URLRewrite {
12675        /// Prior to forwarding the request to the selected destination, the matching
12676        /// portion of the requests path is replaced by this value.
12677        pub path_prefix_rewrite: std::string::String,
12678
12679        /// Prior to forwarding the request to the selected destination, the requests
12680        /// host header is replaced by this value.
12681        pub host_rewrite: std::string::String,
12682
12683        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12684    }
12685
12686    impl URLRewrite {
12687        pub fn new() -> Self {
12688            std::default::Default::default()
12689        }
12690
12691        /// Sets the value of [path_prefix_rewrite][crate::model::http_route::URLRewrite::path_prefix_rewrite].
12692        ///
12693        /// # Example
12694        /// ```ignore,no_run
12695        /// # use google_cloud_networkservices_v1::model::http_route::URLRewrite;
12696        /// let x = URLRewrite::new().set_path_prefix_rewrite("example");
12697        /// ```
12698        pub fn set_path_prefix_rewrite<T: std::convert::Into<std::string::String>>(
12699            mut self,
12700            v: T,
12701        ) -> Self {
12702            self.path_prefix_rewrite = v.into();
12703            self
12704        }
12705
12706        /// Sets the value of [host_rewrite][crate::model::http_route::URLRewrite::host_rewrite].
12707        ///
12708        /// # Example
12709        /// ```ignore,no_run
12710        /// # use google_cloud_networkservices_v1::model::http_route::URLRewrite;
12711        /// let x = URLRewrite::new().set_host_rewrite("example");
12712        /// ```
12713        pub fn set_host_rewrite<T: std::convert::Into<std::string::String>>(
12714            mut self,
12715            v: T,
12716        ) -> Self {
12717            self.host_rewrite = v.into();
12718            self
12719        }
12720    }
12721
12722    impl wkt::message::Message for URLRewrite {
12723        fn typename() -> &'static str {
12724            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.URLRewrite"
12725        }
12726    }
12727
12728    /// The specifications for retries.
12729    #[derive(Clone, Default, PartialEq)]
12730    #[non_exhaustive]
12731    pub struct RetryPolicy {
12732        /// Specifies one or more conditions when this retry policy applies. Valid
12733        /// values are:
12734        /// 5xx: Proxy will attempt a retry if the destination service responds
12735        /// with any 5xx response code, of if the destination service does not
12736        /// respond at all, example: disconnect, reset, read timeout, connection
12737        /// failure and refused streams.
12738        ///
12739        /// gateway-error: Similar to 5xx, but only applies to response codes 502,
12740        /// 503, 504.
12741        ///
12742        /// reset: Proxy will attempt a retry if the destination service does not
12743        /// respond at all (disconnect/reset/read timeout)
12744        ///
12745        /// connect-failure: Proxy will retry on failures connecting to destination
12746        /// for example due to connection timeouts.
12747        ///
12748        /// retriable-4xx: Proxy will retry fro retriable 4xx response codes.
12749        /// Currently the only retriable error supported is 409.
12750        ///
12751        /// refused-stream: Proxy will retry if the destination resets the stream
12752        /// with a REFUSED_STREAM error code. This reset type indicates that it
12753        /// is safe to retry.
12754        pub retry_conditions: std::vec::Vec<std::string::String>,
12755
12756        /// Specifies the allowed number of retries. This number must be > 0. If not
12757        /// specified, default to 1.
12758        pub num_retries: i32,
12759
12760        /// Specifies a non-zero timeout per retry attempt.
12761        pub per_try_timeout: std::option::Option<wkt::Duration>,
12762
12763        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12764    }
12765
12766    impl RetryPolicy {
12767        pub fn new() -> Self {
12768            std::default::Default::default()
12769        }
12770
12771        /// Sets the value of [retry_conditions][crate::model::http_route::RetryPolicy::retry_conditions].
12772        ///
12773        /// # Example
12774        /// ```ignore,no_run
12775        /// # use google_cloud_networkservices_v1::model::http_route::RetryPolicy;
12776        /// let x = RetryPolicy::new().set_retry_conditions(["a", "b", "c"]);
12777        /// ```
12778        pub fn set_retry_conditions<T, V>(mut self, v: T) -> Self
12779        where
12780            T: std::iter::IntoIterator<Item = V>,
12781            V: std::convert::Into<std::string::String>,
12782        {
12783            use std::iter::Iterator;
12784            self.retry_conditions = v.into_iter().map(|i| i.into()).collect();
12785            self
12786        }
12787
12788        /// Sets the value of [num_retries][crate::model::http_route::RetryPolicy::num_retries].
12789        ///
12790        /// # Example
12791        /// ```ignore,no_run
12792        /// # use google_cloud_networkservices_v1::model::http_route::RetryPolicy;
12793        /// let x = RetryPolicy::new().set_num_retries(42);
12794        /// ```
12795        pub fn set_num_retries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12796            self.num_retries = v.into();
12797            self
12798        }
12799
12800        /// Sets the value of [per_try_timeout][crate::model::http_route::RetryPolicy::per_try_timeout].
12801        ///
12802        /// # Example
12803        /// ```ignore,no_run
12804        /// # use google_cloud_networkservices_v1::model::http_route::RetryPolicy;
12805        /// use wkt::Duration;
12806        /// let x = RetryPolicy::new().set_per_try_timeout(Duration::default()/* use setters */);
12807        /// ```
12808        pub fn set_per_try_timeout<T>(mut self, v: T) -> Self
12809        where
12810            T: std::convert::Into<wkt::Duration>,
12811        {
12812            self.per_try_timeout = std::option::Option::Some(v.into());
12813            self
12814        }
12815
12816        /// Sets or clears the value of [per_try_timeout][crate::model::http_route::RetryPolicy::per_try_timeout].
12817        ///
12818        /// # Example
12819        /// ```ignore,no_run
12820        /// # use google_cloud_networkservices_v1::model::http_route::RetryPolicy;
12821        /// use wkt::Duration;
12822        /// let x = RetryPolicy::new().set_or_clear_per_try_timeout(Some(Duration::default()/* use setters */));
12823        /// let x = RetryPolicy::new().set_or_clear_per_try_timeout(None::<Duration>);
12824        /// ```
12825        pub fn set_or_clear_per_try_timeout<T>(mut self, v: std::option::Option<T>) -> Self
12826        where
12827            T: std::convert::Into<wkt::Duration>,
12828        {
12829            self.per_try_timeout = v.map(|x| x.into());
12830            self
12831        }
12832    }
12833
12834    impl wkt::message::Message for RetryPolicy {
12835        fn typename() -> &'static str {
12836            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.RetryPolicy"
12837        }
12838    }
12839
12840    /// Specifies the policy on how requests are shadowed to a separate mirrored
12841    /// destination service. The proxy does not wait for responses from the
12842    /// shadow service. Prior to sending traffic to the shadow service, the
12843    /// host/authority header is suffixed with -shadow.
12844    /// Mirroring is currently not supported for Cloud Run destinations.
12845    #[derive(Clone, Default, PartialEq)]
12846    #[non_exhaustive]
12847    pub struct RequestMirrorPolicy {
12848        /// The destination the requests will be mirrored to. The weight of the
12849        /// destination will be ignored.
12850        pub destination: std::option::Option<crate::model::http_route::Destination>,
12851
12852        /// Optional. The percentage of requests to get mirrored to the desired
12853        /// destination.
12854        pub mirror_percent: f32,
12855
12856        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12857    }
12858
12859    impl RequestMirrorPolicy {
12860        pub fn new() -> Self {
12861            std::default::Default::default()
12862        }
12863
12864        /// Sets the value of [destination][crate::model::http_route::RequestMirrorPolicy::destination].
12865        ///
12866        /// # Example
12867        /// ```ignore,no_run
12868        /// # use google_cloud_networkservices_v1::model::http_route::RequestMirrorPolicy;
12869        /// use google_cloud_networkservices_v1::model::http_route::Destination;
12870        /// let x = RequestMirrorPolicy::new().set_destination(Destination::default()/* use setters */);
12871        /// ```
12872        pub fn set_destination<T>(mut self, v: T) -> Self
12873        where
12874            T: std::convert::Into<crate::model::http_route::Destination>,
12875        {
12876            self.destination = std::option::Option::Some(v.into());
12877            self
12878        }
12879
12880        /// Sets or clears the value of [destination][crate::model::http_route::RequestMirrorPolicy::destination].
12881        ///
12882        /// # Example
12883        /// ```ignore,no_run
12884        /// # use google_cloud_networkservices_v1::model::http_route::RequestMirrorPolicy;
12885        /// use google_cloud_networkservices_v1::model::http_route::Destination;
12886        /// let x = RequestMirrorPolicy::new().set_or_clear_destination(Some(Destination::default()/* use setters */));
12887        /// let x = RequestMirrorPolicy::new().set_or_clear_destination(None::<Destination>);
12888        /// ```
12889        pub fn set_or_clear_destination<T>(mut self, v: std::option::Option<T>) -> Self
12890        where
12891            T: std::convert::Into<crate::model::http_route::Destination>,
12892        {
12893            self.destination = v.map(|x| x.into());
12894            self
12895        }
12896
12897        /// Sets the value of [mirror_percent][crate::model::http_route::RequestMirrorPolicy::mirror_percent].
12898        ///
12899        /// # Example
12900        /// ```ignore,no_run
12901        /// # use google_cloud_networkservices_v1::model::http_route::RequestMirrorPolicy;
12902        /// let x = RequestMirrorPolicy::new().set_mirror_percent(42.0);
12903        /// ```
12904        pub fn set_mirror_percent<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
12905            self.mirror_percent = v.into();
12906            self
12907        }
12908    }
12909
12910    impl wkt::message::Message for RequestMirrorPolicy {
12911        fn typename() -> &'static str {
12912            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.RequestMirrorPolicy"
12913        }
12914    }
12915
12916    /// The Specification for allowing client side cross-origin requests.
12917    #[derive(Clone, Default, PartialEq)]
12918    #[non_exhaustive]
12919    pub struct CorsPolicy {
12920        /// Specifies the list of origins that will be allowed to do CORS requests.
12921        /// An origin is allowed if it matches either an item in allow_origins or
12922        /// an item in allow_origin_regexes.
12923        pub allow_origins: std::vec::Vec<std::string::String>,
12924
12925        /// Specifies the regular expression patterns that match allowed origins. For
12926        /// regular expression grammar, please see
12927        /// <https://github.com/google/re2/wiki/Syntax>.
12928        pub allow_origin_regexes: std::vec::Vec<std::string::String>,
12929
12930        /// Specifies the content for Access-Control-Allow-Methods header.
12931        pub allow_methods: std::vec::Vec<std::string::String>,
12932
12933        /// Specifies the content for Access-Control-Allow-Headers header.
12934        pub allow_headers: std::vec::Vec<std::string::String>,
12935
12936        /// Specifies the content for Access-Control-Expose-Headers header.
12937        pub expose_headers: std::vec::Vec<std::string::String>,
12938
12939        /// Specifies how long result of a preflight request can be cached in
12940        /// seconds. This translates to the Access-Control-Max-Age header.
12941        pub max_age: std::string::String,
12942
12943        /// In response to a preflight request, setting this to true indicates that
12944        /// the actual request can include user credentials. This translates to the
12945        /// Access-Control-Allow-Credentials header.
12946        ///
12947        /// Default value is false.
12948        pub allow_credentials: bool,
12949
12950        /// If true, the CORS policy is disabled. The default value is false, which
12951        /// indicates that the CORS policy is in effect.
12952        pub disabled: bool,
12953
12954        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12955    }
12956
12957    impl CorsPolicy {
12958        pub fn new() -> Self {
12959            std::default::Default::default()
12960        }
12961
12962        /// Sets the value of [allow_origins][crate::model::http_route::CorsPolicy::allow_origins].
12963        ///
12964        /// # Example
12965        /// ```ignore,no_run
12966        /// # use google_cloud_networkservices_v1::model::http_route::CorsPolicy;
12967        /// let x = CorsPolicy::new().set_allow_origins(["a", "b", "c"]);
12968        /// ```
12969        pub fn set_allow_origins<T, V>(mut self, v: T) -> Self
12970        where
12971            T: std::iter::IntoIterator<Item = V>,
12972            V: std::convert::Into<std::string::String>,
12973        {
12974            use std::iter::Iterator;
12975            self.allow_origins = v.into_iter().map(|i| i.into()).collect();
12976            self
12977        }
12978
12979        /// Sets the value of [allow_origin_regexes][crate::model::http_route::CorsPolicy::allow_origin_regexes].
12980        ///
12981        /// # Example
12982        /// ```ignore,no_run
12983        /// # use google_cloud_networkservices_v1::model::http_route::CorsPolicy;
12984        /// let x = CorsPolicy::new().set_allow_origin_regexes(["a", "b", "c"]);
12985        /// ```
12986        pub fn set_allow_origin_regexes<T, V>(mut self, v: T) -> Self
12987        where
12988            T: std::iter::IntoIterator<Item = V>,
12989            V: std::convert::Into<std::string::String>,
12990        {
12991            use std::iter::Iterator;
12992            self.allow_origin_regexes = v.into_iter().map(|i| i.into()).collect();
12993            self
12994        }
12995
12996        /// Sets the value of [allow_methods][crate::model::http_route::CorsPolicy::allow_methods].
12997        ///
12998        /// # Example
12999        /// ```ignore,no_run
13000        /// # use google_cloud_networkservices_v1::model::http_route::CorsPolicy;
13001        /// let x = CorsPolicy::new().set_allow_methods(["a", "b", "c"]);
13002        /// ```
13003        pub fn set_allow_methods<T, V>(mut self, v: T) -> Self
13004        where
13005            T: std::iter::IntoIterator<Item = V>,
13006            V: std::convert::Into<std::string::String>,
13007        {
13008            use std::iter::Iterator;
13009            self.allow_methods = v.into_iter().map(|i| i.into()).collect();
13010            self
13011        }
13012
13013        /// Sets the value of [allow_headers][crate::model::http_route::CorsPolicy::allow_headers].
13014        ///
13015        /// # Example
13016        /// ```ignore,no_run
13017        /// # use google_cloud_networkservices_v1::model::http_route::CorsPolicy;
13018        /// let x = CorsPolicy::new().set_allow_headers(["a", "b", "c"]);
13019        /// ```
13020        pub fn set_allow_headers<T, V>(mut self, v: T) -> Self
13021        where
13022            T: std::iter::IntoIterator<Item = V>,
13023            V: std::convert::Into<std::string::String>,
13024        {
13025            use std::iter::Iterator;
13026            self.allow_headers = v.into_iter().map(|i| i.into()).collect();
13027            self
13028        }
13029
13030        /// Sets the value of [expose_headers][crate::model::http_route::CorsPolicy::expose_headers].
13031        ///
13032        /// # Example
13033        /// ```ignore,no_run
13034        /// # use google_cloud_networkservices_v1::model::http_route::CorsPolicy;
13035        /// let x = CorsPolicy::new().set_expose_headers(["a", "b", "c"]);
13036        /// ```
13037        pub fn set_expose_headers<T, V>(mut self, v: T) -> Self
13038        where
13039            T: std::iter::IntoIterator<Item = V>,
13040            V: std::convert::Into<std::string::String>,
13041        {
13042            use std::iter::Iterator;
13043            self.expose_headers = v.into_iter().map(|i| i.into()).collect();
13044            self
13045        }
13046
13047        /// Sets the value of [max_age][crate::model::http_route::CorsPolicy::max_age].
13048        ///
13049        /// # Example
13050        /// ```ignore,no_run
13051        /// # use google_cloud_networkservices_v1::model::http_route::CorsPolicy;
13052        /// let x = CorsPolicy::new().set_max_age("example");
13053        /// ```
13054        pub fn set_max_age<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13055            self.max_age = v.into();
13056            self
13057        }
13058
13059        /// Sets the value of [allow_credentials][crate::model::http_route::CorsPolicy::allow_credentials].
13060        ///
13061        /// # Example
13062        /// ```ignore,no_run
13063        /// # use google_cloud_networkservices_v1::model::http_route::CorsPolicy;
13064        /// let x = CorsPolicy::new().set_allow_credentials(true);
13065        /// ```
13066        pub fn set_allow_credentials<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13067            self.allow_credentials = v.into();
13068            self
13069        }
13070
13071        /// Sets the value of [disabled][crate::model::http_route::CorsPolicy::disabled].
13072        ///
13073        /// # Example
13074        /// ```ignore,no_run
13075        /// # use google_cloud_networkservices_v1::model::http_route::CorsPolicy;
13076        /// let x = CorsPolicy::new().set_disabled(true);
13077        /// ```
13078        pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13079            self.disabled = v.into();
13080            self
13081        }
13082    }
13083
13084    impl wkt::message::Message for CorsPolicy {
13085        fn typename() -> &'static str {
13086            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.CorsPolicy"
13087        }
13088    }
13089
13090    /// Static HTTP response object to be returned.
13091    #[derive(Clone, Default, PartialEq)]
13092    #[non_exhaustive]
13093    pub struct HttpDirectResponse {
13094        /// Required. Status to return as part of HTTP Response. Must be a positive
13095        /// integer.
13096        pub status: i32,
13097
13098        /// Body to return as part of HTTP Response.
13099        pub http_body:
13100            std::option::Option<crate::model::http_route::http_direct_response::HttpBody>,
13101
13102        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13103    }
13104
13105    impl HttpDirectResponse {
13106        pub fn new() -> Self {
13107            std::default::Default::default()
13108        }
13109
13110        /// Sets the value of [status][crate::model::http_route::HttpDirectResponse::status].
13111        ///
13112        /// # Example
13113        /// ```ignore,no_run
13114        /// # use google_cloud_networkservices_v1::model::http_route::HttpDirectResponse;
13115        /// let x = HttpDirectResponse::new().set_status(42);
13116        /// ```
13117        pub fn set_status<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13118            self.status = v.into();
13119            self
13120        }
13121
13122        /// Sets the value of [http_body][crate::model::http_route::HttpDirectResponse::http_body].
13123        ///
13124        /// Note that all the setters affecting `http_body` are mutually
13125        /// exclusive.
13126        ///
13127        /// # Example
13128        /// ```ignore,no_run
13129        /// # use google_cloud_networkservices_v1::model::http_route::HttpDirectResponse;
13130        /// use google_cloud_networkservices_v1::model::http_route::http_direct_response::HttpBody;
13131        /// let x = HttpDirectResponse::new().set_http_body(Some(HttpBody::StringBody("example".to_string())));
13132        /// ```
13133        pub fn set_http_body<
13134            T: std::convert::Into<
13135                    std::option::Option<crate::model::http_route::http_direct_response::HttpBody>,
13136                >,
13137        >(
13138            mut self,
13139            v: T,
13140        ) -> Self {
13141            self.http_body = v.into();
13142            self
13143        }
13144
13145        /// The value of [http_body][crate::model::http_route::HttpDirectResponse::http_body]
13146        /// if it holds a `StringBody`, `None` if the field is not set or
13147        /// holds a different branch.
13148        pub fn string_body(&self) -> std::option::Option<&std::string::String> {
13149            #[allow(unreachable_patterns)]
13150            self.http_body.as_ref().and_then(|v| match v {
13151                crate::model::http_route::http_direct_response::HttpBody::StringBody(v) => {
13152                    std::option::Option::Some(v)
13153                }
13154                _ => std::option::Option::None,
13155            })
13156        }
13157
13158        /// Sets the value of [http_body][crate::model::http_route::HttpDirectResponse::http_body]
13159        /// to hold a `StringBody`.
13160        ///
13161        /// Note that all the setters affecting `http_body` are
13162        /// mutually exclusive.
13163        ///
13164        /// # Example
13165        /// ```ignore,no_run
13166        /// # use google_cloud_networkservices_v1::model::http_route::HttpDirectResponse;
13167        /// let x = HttpDirectResponse::new().set_string_body("example");
13168        /// assert!(x.string_body().is_some());
13169        /// assert!(x.bytes_body().is_none());
13170        /// ```
13171        pub fn set_string_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13172            self.http_body = std::option::Option::Some(
13173                crate::model::http_route::http_direct_response::HttpBody::StringBody(v.into()),
13174            );
13175            self
13176        }
13177
13178        /// The value of [http_body][crate::model::http_route::HttpDirectResponse::http_body]
13179        /// if it holds a `BytesBody`, `None` if the field is not set or
13180        /// holds a different branch.
13181        pub fn bytes_body(&self) -> std::option::Option<&::bytes::Bytes> {
13182            #[allow(unreachable_patterns)]
13183            self.http_body.as_ref().and_then(|v| match v {
13184                crate::model::http_route::http_direct_response::HttpBody::BytesBody(v) => {
13185                    std::option::Option::Some(v)
13186                }
13187                _ => std::option::Option::None,
13188            })
13189        }
13190
13191        /// Sets the value of [http_body][crate::model::http_route::HttpDirectResponse::http_body]
13192        /// to hold a `BytesBody`.
13193        ///
13194        /// Note that all the setters affecting `http_body` are
13195        /// mutually exclusive.
13196        ///
13197        /// # Example
13198        /// ```ignore,no_run
13199        /// # use google_cloud_networkservices_v1::model::http_route::HttpDirectResponse;
13200        /// let x = HttpDirectResponse::new().set_bytes_body(bytes::Bytes::from_static(b"example"));
13201        /// assert!(x.bytes_body().is_some());
13202        /// assert!(x.string_body().is_none());
13203        /// ```
13204        pub fn set_bytes_body<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13205            self.http_body = std::option::Option::Some(
13206                crate::model::http_route::http_direct_response::HttpBody::BytesBody(v.into()),
13207            );
13208            self
13209        }
13210    }
13211
13212    impl wkt::message::Message for HttpDirectResponse {
13213        fn typename() -> &'static str {
13214            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.HttpDirectResponse"
13215        }
13216    }
13217
13218    /// Defines additional types related to [HttpDirectResponse].
13219    pub mod http_direct_response {
13220        #[allow(unused_imports)]
13221        use super::*;
13222
13223        /// Body to return as part of HTTP Response.
13224        #[derive(Clone, Debug, PartialEq)]
13225        #[non_exhaustive]
13226        pub enum HttpBody {
13227            /// Optional. Response body as a string. Maximum body length is 1024
13228            /// characters.
13229            StringBody(std::string::String),
13230            /// Optional. Response body as bytes. Maximum body size is 4096B.
13231            BytesBody(::bytes::Bytes),
13232        }
13233    }
13234
13235    /// The specifications for routing traffic and applying associated policies.
13236    #[derive(Clone, Default, PartialEq)]
13237    #[non_exhaustive]
13238    pub struct RouteAction {
13239        /// The destination to which traffic should be forwarded.
13240        pub destinations: std::vec::Vec<crate::model::http_route::Destination>,
13241
13242        /// If set, the request is directed as configured by this field.
13243        pub redirect: std::option::Option<crate::model::http_route::Redirect>,
13244
13245        /// The specification for fault injection introduced into traffic to test the
13246        /// resiliency of clients to backend service failure. As part of fault
13247        /// injection, when clients send requests to a backend service, delays can be
13248        /// introduced  on a percentage of requests before sending those requests to
13249        /// the backend service. Similarly requests from clients can be aborted for a
13250        /// percentage of requests.
13251        ///
13252        /// timeout and retry_policy will be ignored by clients that are configured
13253        /// with a fault_injection_policy
13254        pub fault_injection_policy:
13255            std::option::Option<crate::model::http_route::FaultInjectionPolicy>,
13256
13257        /// The specification for modifying the headers of a matching request prior
13258        /// to delivery of the request to the destination. If HeaderModifiers are set
13259        /// on both the Destination and the RouteAction, they will be merged.
13260        /// Conflicts between the two will not be resolved on the configuration.
13261        pub request_header_modifier: std::option::Option<crate::model::http_route::HeaderModifier>,
13262
13263        /// The specification for modifying the headers of a response prior to
13264        /// sending the response back to the client. If HeaderModifiers are set
13265        /// on both the Destination and the RouteAction, they will be merged.
13266        /// Conflicts between the two will not be resolved on the configuration.
13267        pub response_header_modifier: std::option::Option<crate::model::http_route::HeaderModifier>,
13268
13269        /// The specification for rewrite URL before forwarding requests to the
13270        /// destination.
13271        pub url_rewrite: std::option::Option<crate::model::http_route::URLRewrite>,
13272
13273        /// Specifies the timeout for selected route. Timeout is computed from the
13274        /// time the request has been fully processed (i.e. end of stream) up until
13275        /// the response has been completely processed. Timeout includes all retries.
13276        pub timeout: std::option::Option<wkt::Duration>,
13277
13278        /// Specifies the retry policy associated with this route.
13279        pub retry_policy: std::option::Option<crate::model::http_route::RetryPolicy>,
13280
13281        /// Specifies the policy on how requests intended for the routes destination
13282        /// are shadowed to a separate mirrored destination. Proxy will not wait for
13283        /// the shadow destination to respond before returning the response. Prior to
13284        /// sending traffic to the shadow service, the host/authority header is
13285        /// suffixed with -shadow.
13286        pub request_mirror_policy:
13287            std::option::Option<crate::model::http_route::RequestMirrorPolicy>,
13288
13289        /// The specification for allowing client side cross-origin requests.
13290        pub cors_policy: std::option::Option<crate::model::http_route::CorsPolicy>,
13291
13292        /// Optional. Specifies cookie-based stateful session affinity.
13293        pub stateful_session_affinity:
13294            std::option::Option<crate::model::http_route::StatefulSessionAffinityPolicy>,
13295
13296        /// Optional. Static HTTP Response object to be returned regardless of the
13297        /// request.
13298        pub direct_response: std::option::Option<crate::model::http_route::HttpDirectResponse>,
13299
13300        /// Optional. Specifies the idle timeout for the selected route. The idle
13301        /// timeout is defined as the period in which there are no bytes sent or
13302        /// received on either the upstream or downstream connection. If not set, the
13303        /// default idle timeout is 1 hour. If set to 0s, the timeout will be
13304        /// disabled.
13305        pub idle_timeout: std::option::Option<wkt::Duration>,
13306
13307        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13308    }
13309
13310    impl RouteAction {
13311        pub fn new() -> Self {
13312            std::default::Default::default()
13313        }
13314
13315        /// Sets the value of [destinations][crate::model::http_route::RouteAction::destinations].
13316        ///
13317        /// # Example
13318        /// ```ignore,no_run
13319        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13320        /// use google_cloud_networkservices_v1::model::http_route::Destination;
13321        /// let x = RouteAction::new()
13322        ///     .set_destinations([
13323        ///         Destination::default()/* use setters */,
13324        ///         Destination::default()/* use (different) setters */,
13325        ///     ]);
13326        /// ```
13327        pub fn set_destinations<T, V>(mut self, v: T) -> Self
13328        where
13329            T: std::iter::IntoIterator<Item = V>,
13330            V: std::convert::Into<crate::model::http_route::Destination>,
13331        {
13332            use std::iter::Iterator;
13333            self.destinations = v.into_iter().map(|i| i.into()).collect();
13334            self
13335        }
13336
13337        /// Sets the value of [redirect][crate::model::http_route::RouteAction::redirect].
13338        ///
13339        /// # Example
13340        /// ```ignore,no_run
13341        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13342        /// use google_cloud_networkservices_v1::model::http_route::Redirect;
13343        /// let x = RouteAction::new().set_redirect(Redirect::default()/* use setters */);
13344        /// ```
13345        pub fn set_redirect<T>(mut self, v: T) -> Self
13346        where
13347            T: std::convert::Into<crate::model::http_route::Redirect>,
13348        {
13349            self.redirect = std::option::Option::Some(v.into());
13350            self
13351        }
13352
13353        /// Sets or clears the value of [redirect][crate::model::http_route::RouteAction::redirect].
13354        ///
13355        /// # Example
13356        /// ```ignore,no_run
13357        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13358        /// use google_cloud_networkservices_v1::model::http_route::Redirect;
13359        /// let x = RouteAction::new().set_or_clear_redirect(Some(Redirect::default()/* use setters */));
13360        /// let x = RouteAction::new().set_or_clear_redirect(None::<Redirect>);
13361        /// ```
13362        pub fn set_or_clear_redirect<T>(mut self, v: std::option::Option<T>) -> Self
13363        where
13364            T: std::convert::Into<crate::model::http_route::Redirect>,
13365        {
13366            self.redirect = v.map(|x| x.into());
13367            self
13368        }
13369
13370        /// Sets the value of [fault_injection_policy][crate::model::http_route::RouteAction::fault_injection_policy].
13371        ///
13372        /// # Example
13373        /// ```ignore,no_run
13374        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13375        /// use google_cloud_networkservices_v1::model::http_route::FaultInjectionPolicy;
13376        /// let x = RouteAction::new().set_fault_injection_policy(FaultInjectionPolicy::default()/* use setters */);
13377        /// ```
13378        pub fn set_fault_injection_policy<T>(mut self, v: T) -> Self
13379        where
13380            T: std::convert::Into<crate::model::http_route::FaultInjectionPolicy>,
13381        {
13382            self.fault_injection_policy = std::option::Option::Some(v.into());
13383            self
13384        }
13385
13386        /// Sets or clears the value of [fault_injection_policy][crate::model::http_route::RouteAction::fault_injection_policy].
13387        ///
13388        /// # Example
13389        /// ```ignore,no_run
13390        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13391        /// use google_cloud_networkservices_v1::model::http_route::FaultInjectionPolicy;
13392        /// let x = RouteAction::new().set_or_clear_fault_injection_policy(Some(FaultInjectionPolicy::default()/* use setters */));
13393        /// let x = RouteAction::new().set_or_clear_fault_injection_policy(None::<FaultInjectionPolicy>);
13394        /// ```
13395        pub fn set_or_clear_fault_injection_policy<T>(mut self, v: std::option::Option<T>) -> Self
13396        where
13397            T: std::convert::Into<crate::model::http_route::FaultInjectionPolicy>,
13398        {
13399            self.fault_injection_policy = v.map(|x| x.into());
13400            self
13401        }
13402
13403        /// Sets the value of [request_header_modifier][crate::model::http_route::RouteAction::request_header_modifier].
13404        ///
13405        /// # Example
13406        /// ```ignore,no_run
13407        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13408        /// use google_cloud_networkservices_v1::model::http_route::HeaderModifier;
13409        /// let x = RouteAction::new().set_request_header_modifier(HeaderModifier::default()/* use setters */);
13410        /// ```
13411        pub fn set_request_header_modifier<T>(mut self, v: T) -> Self
13412        where
13413            T: std::convert::Into<crate::model::http_route::HeaderModifier>,
13414        {
13415            self.request_header_modifier = std::option::Option::Some(v.into());
13416            self
13417        }
13418
13419        /// Sets or clears the value of [request_header_modifier][crate::model::http_route::RouteAction::request_header_modifier].
13420        ///
13421        /// # Example
13422        /// ```ignore,no_run
13423        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13424        /// use google_cloud_networkservices_v1::model::http_route::HeaderModifier;
13425        /// let x = RouteAction::new().set_or_clear_request_header_modifier(Some(HeaderModifier::default()/* use setters */));
13426        /// let x = RouteAction::new().set_or_clear_request_header_modifier(None::<HeaderModifier>);
13427        /// ```
13428        pub fn set_or_clear_request_header_modifier<T>(mut self, v: std::option::Option<T>) -> Self
13429        where
13430            T: std::convert::Into<crate::model::http_route::HeaderModifier>,
13431        {
13432            self.request_header_modifier = v.map(|x| x.into());
13433            self
13434        }
13435
13436        /// Sets the value of [response_header_modifier][crate::model::http_route::RouteAction::response_header_modifier].
13437        ///
13438        /// # Example
13439        /// ```ignore,no_run
13440        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13441        /// use google_cloud_networkservices_v1::model::http_route::HeaderModifier;
13442        /// let x = RouteAction::new().set_response_header_modifier(HeaderModifier::default()/* use setters */);
13443        /// ```
13444        pub fn set_response_header_modifier<T>(mut self, v: T) -> Self
13445        where
13446            T: std::convert::Into<crate::model::http_route::HeaderModifier>,
13447        {
13448            self.response_header_modifier = std::option::Option::Some(v.into());
13449            self
13450        }
13451
13452        /// Sets or clears the value of [response_header_modifier][crate::model::http_route::RouteAction::response_header_modifier].
13453        ///
13454        /// # Example
13455        /// ```ignore,no_run
13456        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13457        /// use google_cloud_networkservices_v1::model::http_route::HeaderModifier;
13458        /// let x = RouteAction::new().set_or_clear_response_header_modifier(Some(HeaderModifier::default()/* use setters */));
13459        /// let x = RouteAction::new().set_or_clear_response_header_modifier(None::<HeaderModifier>);
13460        /// ```
13461        pub fn set_or_clear_response_header_modifier<T>(mut self, v: std::option::Option<T>) -> Self
13462        where
13463            T: std::convert::Into<crate::model::http_route::HeaderModifier>,
13464        {
13465            self.response_header_modifier = v.map(|x| x.into());
13466            self
13467        }
13468
13469        /// Sets the value of [url_rewrite][crate::model::http_route::RouteAction::url_rewrite].
13470        ///
13471        /// # Example
13472        /// ```ignore,no_run
13473        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13474        /// use google_cloud_networkservices_v1::model::http_route::URLRewrite;
13475        /// let x = RouteAction::new().set_url_rewrite(URLRewrite::default()/* use setters */);
13476        /// ```
13477        pub fn set_url_rewrite<T>(mut self, v: T) -> Self
13478        where
13479            T: std::convert::Into<crate::model::http_route::URLRewrite>,
13480        {
13481            self.url_rewrite = std::option::Option::Some(v.into());
13482            self
13483        }
13484
13485        /// Sets or clears the value of [url_rewrite][crate::model::http_route::RouteAction::url_rewrite].
13486        ///
13487        /// # Example
13488        /// ```ignore,no_run
13489        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13490        /// use google_cloud_networkservices_v1::model::http_route::URLRewrite;
13491        /// let x = RouteAction::new().set_or_clear_url_rewrite(Some(URLRewrite::default()/* use setters */));
13492        /// let x = RouteAction::new().set_or_clear_url_rewrite(None::<URLRewrite>);
13493        /// ```
13494        pub fn set_or_clear_url_rewrite<T>(mut self, v: std::option::Option<T>) -> Self
13495        where
13496            T: std::convert::Into<crate::model::http_route::URLRewrite>,
13497        {
13498            self.url_rewrite = v.map(|x| x.into());
13499            self
13500        }
13501
13502        /// Sets the value of [timeout][crate::model::http_route::RouteAction::timeout].
13503        ///
13504        /// # Example
13505        /// ```ignore,no_run
13506        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13507        /// use wkt::Duration;
13508        /// let x = RouteAction::new().set_timeout(Duration::default()/* use setters */);
13509        /// ```
13510        pub fn set_timeout<T>(mut self, v: T) -> Self
13511        where
13512            T: std::convert::Into<wkt::Duration>,
13513        {
13514            self.timeout = std::option::Option::Some(v.into());
13515            self
13516        }
13517
13518        /// Sets or clears the value of [timeout][crate::model::http_route::RouteAction::timeout].
13519        ///
13520        /// # Example
13521        /// ```ignore,no_run
13522        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13523        /// use wkt::Duration;
13524        /// let x = RouteAction::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
13525        /// let x = RouteAction::new().set_or_clear_timeout(None::<Duration>);
13526        /// ```
13527        pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
13528        where
13529            T: std::convert::Into<wkt::Duration>,
13530        {
13531            self.timeout = v.map(|x| x.into());
13532            self
13533        }
13534
13535        /// Sets the value of [retry_policy][crate::model::http_route::RouteAction::retry_policy].
13536        ///
13537        /// # Example
13538        /// ```ignore,no_run
13539        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13540        /// use google_cloud_networkservices_v1::model::http_route::RetryPolicy;
13541        /// let x = RouteAction::new().set_retry_policy(RetryPolicy::default()/* use setters */);
13542        /// ```
13543        pub fn set_retry_policy<T>(mut self, v: T) -> Self
13544        where
13545            T: std::convert::Into<crate::model::http_route::RetryPolicy>,
13546        {
13547            self.retry_policy = std::option::Option::Some(v.into());
13548            self
13549        }
13550
13551        /// Sets or clears the value of [retry_policy][crate::model::http_route::RouteAction::retry_policy].
13552        ///
13553        /// # Example
13554        /// ```ignore,no_run
13555        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13556        /// use google_cloud_networkservices_v1::model::http_route::RetryPolicy;
13557        /// let x = RouteAction::new().set_or_clear_retry_policy(Some(RetryPolicy::default()/* use setters */));
13558        /// let x = RouteAction::new().set_or_clear_retry_policy(None::<RetryPolicy>);
13559        /// ```
13560        pub fn set_or_clear_retry_policy<T>(mut self, v: std::option::Option<T>) -> Self
13561        where
13562            T: std::convert::Into<crate::model::http_route::RetryPolicy>,
13563        {
13564            self.retry_policy = v.map(|x| x.into());
13565            self
13566        }
13567
13568        /// Sets the value of [request_mirror_policy][crate::model::http_route::RouteAction::request_mirror_policy].
13569        ///
13570        /// # Example
13571        /// ```ignore,no_run
13572        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13573        /// use google_cloud_networkservices_v1::model::http_route::RequestMirrorPolicy;
13574        /// let x = RouteAction::new().set_request_mirror_policy(RequestMirrorPolicy::default()/* use setters */);
13575        /// ```
13576        pub fn set_request_mirror_policy<T>(mut self, v: T) -> Self
13577        where
13578            T: std::convert::Into<crate::model::http_route::RequestMirrorPolicy>,
13579        {
13580            self.request_mirror_policy = std::option::Option::Some(v.into());
13581            self
13582        }
13583
13584        /// Sets or clears the value of [request_mirror_policy][crate::model::http_route::RouteAction::request_mirror_policy].
13585        ///
13586        /// # Example
13587        /// ```ignore,no_run
13588        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13589        /// use google_cloud_networkservices_v1::model::http_route::RequestMirrorPolicy;
13590        /// let x = RouteAction::new().set_or_clear_request_mirror_policy(Some(RequestMirrorPolicy::default()/* use setters */));
13591        /// let x = RouteAction::new().set_or_clear_request_mirror_policy(None::<RequestMirrorPolicy>);
13592        /// ```
13593        pub fn set_or_clear_request_mirror_policy<T>(mut self, v: std::option::Option<T>) -> Self
13594        where
13595            T: std::convert::Into<crate::model::http_route::RequestMirrorPolicy>,
13596        {
13597            self.request_mirror_policy = v.map(|x| x.into());
13598            self
13599        }
13600
13601        /// Sets the value of [cors_policy][crate::model::http_route::RouteAction::cors_policy].
13602        ///
13603        /// # Example
13604        /// ```ignore,no_run
13605        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13606        /// use google_cloud_networkservices_v1::model::http_route::CorsPolicy;
13607        /// let x = RouteAction::new().set_cors_policy(CorsPolicy::default()/* use setters */);
13608        /// ```
13609        pub fn set_cors_policy<T>(mut self, v: T) -> Self
13610        where
13611            T: std::convert::Into<crate::model::http_route::CorsPolicy>,
13612        {
13613            self.cors_policy = std::option::Option::Some(v.into());
13614            self
13615        }
13616
13617        /// Sets or clears the value of [cors_policy][crate::model::http_route::RouteAction::cors_policy].
13618        ///
13619        /// # Example
13620        /// ```ignore,no_run
13621        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13622        /// use google_cloud_networkservices_v1::model::http_route::CorsPolicy;
13623        /// let x = RouteAction::new().set_or_clear_cors_policy(Some(CorsPolicy::default()/* use setters */));
13624        /// let x = RouteAction::new().set_or_clear_cors_policy(None::<CorsPolicy>);
13625        /// ```
13626        pub fn set_or_clear_cors_policy<T>(mut self, v: std::option::Option<T>) -> Self
13627        where
13628            T: std::convert::Into<crate::model::http_route::CorsPolicy>,
13629        {
13630            self.cors_policy = v.map(|x| x.into());
13631            self
13632        }
13633
13634        /// Sets the value of [stateful_session_affinity][crate::model::http_route::RouteAction::stateful_session_affinity].
13635        ///
13636        /// # Example
13637        /// ```ignore,no_run
13638        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13639        /// use google_cloud_networkservices_v1::model::http_route::StatefulSessionAffinityPolicy;
13640        /// let x = RouteAction::new().set_stateful_session_affinity(StatefulSessionAffinityPolicy::default()/* use setters */);
13641        /// ```
13642        pub fn set_stateful_session_affinity<T>(mut self, v: T) -> Self
13643        where
13644            T: std::convert::Into<crate::model::http_route::StatefulSessionAffinityPolicy>,
13645        {
13646            self.stateful_session_affinity = std::option::Option::Some(v.into());
13647            self
13648        }
13649
13650        /// Sets or clears the value of [stateful_session_affinity][crate::model::http_route::RouteAction::stateful_session_affinity].
13651        ///
13652        /// # Example
13653        /// ```ignore,no_run
13654        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13655        /// use google_cloud_networkservices_v1::model::http_route::StatefulSessionAffinityPolicy;
13656        /// let x = RouteAction::new().set_or_clear_stateful_session_affinity(Some(StatefulSessionAffinityPolicy::default()/* use setters */));
13657        /// let x = RouteAction::new().set_or_clear_stateful_session_affinity(None::<StatefulSessionAffinityPolicy>);
13658        /// ```
13659        pub fn set_or_clear_stateful_session_affinity<T>(
13660            mut self,
13661            v: std::option::Option<T>,
13662        ) -> Self
13663        where
13664            T: std::convert::Into<crate::model::http_route::StatefulSessionAffinityPolicy>,
13665        {
13666            self.stateful_session_affinity = v.map(|x| x.into());
13667            self
13668        }
13669
13670        /// Sets the value of [direct_response][crate::model::http_route::RouteAction::direct_response].
13671        ///
13672        /// # Example
13673        /// ```ignore,no_run
13674        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13675        /// use google_cloud_networkservices_v1::model::http_route::HttpDirectResponse;
13676        /// let x = RouteAction::new().set_direct_response(HttpDirectResponse::default()/* use setters */);
13677        /// ```
13678        pub fn set_direct_response<T>(mut self, v: T) -> Self
13679        where
13680            T: std::convert::Into<crate::model::http_route::HttpDirectResponse>,
13681        {
13682            self.direct_response = std::option::Option::Some(v.into());
13683            self
13684        }
13685
13686        /// Sets or clears the value of [direct_response][crate::model::http_route::RouteAction::direct_response].
13687        ///
13688        /// # Example
13689        /// ```ignore,no_run
13690        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13691        /// use google_cloud_networkservices_v1::model::http_route::HttpDirectResponse;
13692        /// let x = RouteAction::new().set_or_clear_direct_response(Some(HttpDirectResponse::default()/* use setters */));
13693        /// let x = RouteAction::new().set_or_clear_direct_response(None::<HttpDirectResponse>);
13694        /// ```
13695        pub fn set_or_clear_direct_response<T>(mut self, v: std::option::Option<T>) -> Self
13696        where
13697            T: std::convert::Into<crate::model::http_route::HttpDirectResponse>,
13698        {
13699            self.direct_response = v.map(|x| x.into());
13700            self
13701        }
13702
13703        /// Sets the value of [idle_timeout][crate::model::http_route::RouteAction::idle_timeout].
13704        ///
13705        /// # Example
13706        /// ```ignore,no_run
13707        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13708        /// use wkt::Duration;
13709        /// let x = RouteAction::new().set_idle_timeout(Duration::default()/* use setters */);
13710        /// ```
13711        pub fn set_idle_timeout<T>(mut self, v: T) -> Self
13712        where
13713            T: std::convert::Into<wkt::Duration>,
13714        {
13715            self.idle_timeout = std::option::Option::Some(v.into());
13716            self
13717        }
13718
13719        /// Sets or clears the value of [idle_timeout][crate::model::http_route::RouteAction::idle_timeout].
13720        ///
13721        /// # Example
13722        /// ```ignore,no_run
13723        /// # use google_cloud_networkservices_v1::model::http_route::RouteAction;
13724        /// use wkt::Duration;
13725        /// let x = RouteAction::new().set_or_clear_idle_timeout(Some(Duration::default()/* use setters */));
13726        /// let x = RouteAction::new().set_or_clear_idle_timeout(None::<Duration>);
13727        /// ```
13728        pub fn set_or_clear_idle_timeout<T>(mut self, v: std::option::Option<T>) -> Self
13729        where
13730            T: std::convert::Into<wkt::Duration>,
13731        {
13732            self.idle_timeout = v.map(|x| x.into());
13733            self
13734        }
13735    }
13736
13737    impl wkt::message::Message for RouteAction {
13738        fn typename() -> &'static str {
13739            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.RouteAction"
13740        }
13741    }
13742
13743    /// Specifies how to match traffic and how to route traffic when traffic is
13744    /// matched.
13745    #[derive(Clone, Default, PartialEq)]
13746    #[non_exhaustive]
13747    pub struct RouteRule {
13748        /// A list of matches define conditions used for matching the rule against
13749        /// incoming HTTP requests. Each match is independent, i.e. this rule will be
13750        /// matched if ANY one of the matches is satisfied.
13751        ///
13752        /// If no matches field is specified, this rule will unconditionally match
13753        /// traffic.
13754        ///
13755        /// If a default rule is desired to be configured, add a rule with no matches
13756        /// specified to the end of the rules list.
13757        pub matches: std::vec::Vec<crate::model::http_route::RouteMatch>,
13758
13759        /// The detailed rule defining how to route matched traffic.
13760        pub action: std::option::Option<crate::model::http_route::RouteAction>,
13761
13762        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13763    }
13764
13765    impl RouteRule {
13766        pub fn new() -> Self {
13767            std::default::Default::default()
13768        }
13769
13770        /// Sets the value of [matches][crate::model::http_route::RouteRule::matches].
13771        ///
13772        /// # Example
13773        /// ```ignore,no_run
13774        /// # use google_cloud_networkservices_v1::model::http_route::RouteRule;
13775        /// use google_cloud_networkservices_v1::model::http_route::RouteMatch;
13776        /// let x = RouteRule::new()
13777        ///     .set_matches([
13778        ///         RouteMatch::default()/* use setters */,
13779        ///         RouteMatch::default()/* use (different) setters */,
13780        ///     ]);
13781        /// ```
13782        pub fn set_matches<T, V>(mut self, v: T) -> Self
13783        where
13784            T: std::iter::IntoIterator<Item = V>,
13785            V: std::convert::Into<crate::model::http_route::RouteMatch>,
13786        {
13787            use std::iter::Iterator;
13788            self.matches = v.into_iter().map(|i| i.into()).collect();
13789            self
13790        }
13791
13792        /// Sets the value of [action][crate::model::http_route::RouteRule::action].
13793        ///
13794        /// # Example
13795        /// ```ignore,no_run
13796        /// # use google_cloud_networkservices_v1::model::http_route::RouteRule;
13797        /// use google_cloud_networkservices_v1::model::http_route::RouteAction;
13798        /// let x = RouteRule::new().set_action(RouteAction::default()/* use setters */);
13799        /// ```
13800        pub fn set_action<T>(mut self, v: T) -> Self
13801        where
13802            T: std::convert::Into<crate::model::http_route::RouteAction>,
13803        {
13804            self.action = std::option::Option::Some(v.into());
13805            self
13806        }
13807
13808        /// Sets or clears the value of [action][crate::model::http_route::RouteRule::action].
13809        ///
13810        /// # Example
13811        /// ```ignore,no_run
13812        /// # use google_cloud_networkservices_v1::model::http_route::RouteRule;
13813        /// use google_cloud_networkservices_v1::model::http_route::RouteAction;
13814        /// let x = RouteRule::new().set_or_clear_action(Some(RouteAction::default()/* use setters */));
13815        /// let x = RouteRule::new().set_or_clear_action(None::<RouteAction>);
13816        /// ```
13817        pub fn set_or_clear_action<T>(mut self, v: std::option::Option<T>) -> Self
13818        where
13819            T: std::convert::Into<crate::model::http_route::RouteAction>,
13820        {
13821            self.action = v.map(|x| x.into());
13822            self
13823        }
13824    }
13825
13826    impl wkt::message::Message for RouteRule {
13827        fn typename() -> &'static str {
13828            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.RouteRule"
13829        }
13830    }
13831}
13832
13833/// Request used with the ListHttpRoutes method.
13834#[derive(Clone, Default, PartialEq)]
13835#[non_exhaustive]
13836pub struct ListHttpRoutesRequest {
13837    /// Required. The project and location from which the HttpRoutes should be
13838    /// listed, specified in the format `projects/*/locations/global`.
13839    pub parent: std::string::String,
13840
13841    /// Maximum number of HttpRoutes to return per call.
13842    pub page_size: i32,
13843
13844    /// The value returned by the last `ListHttpRoutesResponse`
13845    /// Indicates that this is a continuation of a prior `ListHttpRoutes` call,
13846    /// and that the system should return the next page of data.
13847    pub page_token: std::string::String,
13848
13849    /// Optional. If true, allow partial responses for multi-regional Aggregated
13850    /// List requests. Otherwise if one of the locations is down or unreachable,
13851    /// the Aggregated List request will fail.
13852    pub return_partial_success: bool,
13853
13854    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13855}
13856
13857impl ListHttpRoutesRequest {
13858    pub fn new() -> Self {
13859        std::default::Default::default()
13860    }
13861
13862    /// Sets the value of [parent][crate::model::ListHttpRoutesRequest::parent].
13863    ///
13864    /// # Example
13865    /// ```ignore,no_run
13866    /// # use google_cloud_networkservices_v1::model::ListHttpRoutesRequest;
13867    /// let x = ListHttpRoutesRequest::new().set_parent("example");
13868    /// ```
13869    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13870        self.parent = v.into();
13871        self
13872    }
13873
13874    /// Sets the value of [page_size][crate::model::ListHttpRoutesRequest::page_size].
13875    ///
13876    /// # Example
13877    /// ```ignore,no_run
13878    /// # use google_cloud_networkservices_v1::model::ListHttpRoutesRequest;
13879    /// let x = ListHttpRoutesRequest::new().set_page_size(42);
13880    /// ```
13881    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13882        self.page_size = v.into();
13883        self
13884    }
13885
13886    /// Sets the value of [page_token][crate::model::ListHttpRoutesRequest::page_token].
13887    ///
13888    /// # Example
13889    /// ```ignore,no_run
13890    /// # use google_cloud_networkservices_v1::model::ListHttpRoutesRequest;
13891    /// let x = ListHttpRoutesRequest::new().set_page_token("example");
13892    /// ```
13893    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13894        self.page_token = v.into();
13895        self
13896    }
13897
13898    /// Sets the value of [return_partial_success][crate::model::ListHttpRoutesRequest::return_partial_success].
13899    ///
13900    /// # Example
13901    /// ```ignore,no_run
13902    /// # use google_cloud_networkservices_v1::model::ListHttpRoutesRequest;
13903    /// let x = ListHttpRoutesRequest::new().set_return_partial_success(true);
13904    /// ```
13905    pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13906        self.return_partial_success = v.into();
13907        self
13908    }
13909}
13910
13911impl wkt::message::Message for ListHttpRoutesRequest {
13912    fn typename() -> &'static str {
13913        "type.googleapis.com/google.cloud.networkservices.v1.ListHttpRoutesRequest"
13914    }
13915}
13916
13917/// Response returned by the ListHttpRoutes method.
13918#[derive(Clone, Default, PartialEq)]
13919#[non_exhaustive]
13920pub struct ListHttpRoutesResponse {
13921    /// List of HttpRoute resources.
13922    pub http_routes: std::vec::Vec<crate::model::HttpRoute>,
13923
13924    /// If there might be more results than those appearing in this response, then
13925    /// `next_page_token` is included. To get the next set of results, call this
13926    /// method again using the value of `next_page_token` as `page_token`.
13927    pub next_page_token: std::string::String,
13928
13929    /// Unreachable resources. Populated when the request opts into
13930    /// [return_partial_success][google.cloud.networkservices.v1.ListHttpRoutesRequest.return_partial_success]
13931    /// and reading across collections e.g. when attempting to list all resources
13932    /// across all supported locations.
13933    ///
13934    /// [google.cloud.networkservices.v1.ListHttpRoutesRequest.return_partial_success]: crate::model::ListHttpRoutesRequest::return_partial_success
13935    pub unreachable: std::vec::Vec<std::string::String>,
13936
13937    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13938}
13939
13940impl ListHttpRoutesResponse {
13941    pub fn new() -> Self {
13942        std::default::Default::default()
13943    }
13944
13945    /// Sets the value of [http_routes][crate::model::ListHttpRoutesResponse::http_routes].
13946    ///
13947    /// # Example
13948    /// ```ignore,no_run
13949    /// # use google_cloud_networkservices_v1::model::ListHttpRoutesResponse;
13950    /// use google_cloud_networkservices_v1::model::HttpRoute;
13951    /// let x = ListHttpRoutesResponse::new()
13952    ///     .set_http_routes([
13953    ///         HttpRoute::default()/* use setters */,
13954    ///         HttpRoute::default()/* use (different) setters */,
13955    ///     ]);
13956    /// ```
13957    pub fn set_http_routes<T, V>(mut self, v: T) -> Self
13958    where
13959        T: std::iter::IntoIterator<Item = V>,
13960        V: std::convert::Into<crate::model::HttpRoute>,
13961    {
13962        use std::iter::Iterator;
13963        self.http_routes = v.into_iter().map(|i| i.into()).collect();
13964        self
13965    }
13966
13967    /// Sets the value of [next_page_token][crate::model::ListHttpRoutesResponse::next_page_token].
13968    ///
13969    /// # Example
13970    /// ```ignore,no_run
13971    /// # use google_cloud_networkservices_v1::model::ListHttpRoutesResponse;
13972    /// let x = ListHttpRoutesResponse::new().set_next_page_token("example");
13973    /// ```
13974    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13975        self.next_page_token = v.into();
13976        self
13977    }
13978
13979    /// Sets the value of [unreachable][crate::model::ListHttpRoutesResponse::unreachable].
13980    ///
13981    /// # Example
13982    /// ```ignore,no_run
13983    /// # use google_cloud_networkservices_v1::model::ListHttpRoutesResponse;
13984    /// let x = ListHttpRoutesResponse::new().set_unreachable(["a", "b", "c"]);
13985    /// ```
13986    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
13987    where
13988        T: std::iter::IntoIterator<Item = V>,
13989        V: std::convert::Into<std::string::String>,
13990    {
13991        use std::iter::Iterator;
13992        self.unreachable = v.into_iter().map(|i| i.into()).collect();
13993        self
13994    }
13995}
13996
13997impl wkt::message::Message for ListHttpRoutesResponse {
13998    fn typename() -> &'static str {
13999        "type.googleapis.com/google.cloud.networkservices.v1.ListHttpRoutesResponse"
14000    }
14001}
14002
14003#[doc(hidden)]
14004impl google_cloud_gax::paginator::internal::PageableResponse for ListHttpRoutesResponse {
14005    type PageItem = crate::model::HttpRoute;
14006
14007    fn items(self) -> std::vec::Vec<Self::PageItem> {
14008        self.http_routes
14009    }
14010
14011    fn next_page_token(&self) -> std::string::String {
14012        use std::clone::Clone;
14013        self.next_page_token.clone()
14014    }
14015}
14016
14017/// Request used by the GetHttpRoute method.
14018#[derive(Clone, Default, PartialEq)]
14019#[non_exhaustive]
14020pub struct GetHttpRouteRequest {
14021    /// Required. A name of the HttpRoute to get. Must be in the format
14022    /// `projects/*/locations/global/httpRoutes/*`.
14023    pub name: std::string::String,
14024
14025    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14026}
14027
14028impl GetHttpRouteRequest {
14029    pub fn new() -> Self {
14030        std::default::Default::default()
14031    }
14032
14033    /// Sets the value of [name][crate::model::GetHttpRouteRequest::name].
14034    ///
14035    /// # Example
14036    /// ```ignore,no_run
14037    /// # use google_cloud_networkservices_v1::model::GetHttpRouteRequest;
14038    /// let x = GetHttpRouteRequest::new().set_name("example");
14039    /// ```
14040    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14041        self.name = v.into();
14042        self
14043    }
14044}
14045
14046impl wkt::message::Message for GetHttpRouteRequest {
14047    fn typename() -> &'static str {
14048        "type.googleapis.com/google.cloud.networkservices.v1.GetHttpRouteRequest"
14049    }
14050}
14051
14052/// Request used by the HttpRoute method.
14053#[derive(Clone, Default, PartialEq)]
14054#[non_exhaustive]
14055pub struct CreateHttpRouteRequest {
14056    /// Required. The parent resource of the HttpRoute. Must be in the
14057    /// format `projects/*/locations/global`.
14058    pub parent: std::string::String,
14059
14060    /// Required. Short name of the HttpRoute resource to be created.
14061    pub http_route_id: std::string::String,
14062
14063    /// Required. HttpRoute resource to be created.
14064    pub http_route: std::option::Option<crate::model::HttpRoute>,
14065
14066    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14067}
14068
14069impl CreateHttpRouteRequest {
14070    pub fn new() -> Self {
14071        std::default::Default::default()
14072    }
14073
14074    /// Sets the value of [parent][crate::model::CreateHttpRouteRequest::parent].
14075    ///
14076    /// # Example
14077    /// ```ignore,no_run
14078    /// # use google_cloud_networkservices_v1::model::CreateHttpRouteRequest;
14079    /// let x = CreateHttpRouteRequest::new().set_parent("example");
14080    /// ```
14081    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14082        self.parent = v.into();
14083        self
14084    }
14085
14086    /// Sets the value of [http_route_id][crate::model::CreateHttpRouteRequest::http_route_id].
14087    ///
14088    /// # Example
14089    /// ```ignore,no_run
14090    /// # use google_cloud_networkservices_v1::model::CreateHttpRouteRequest;
14091    /// let x = CreateHttpRouteRequest::new().set_http_route_id("example");
14092    /// ```
14093    pub fn set_http_route_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14094        self.http_route_id = v.into();
14095        self
14096    }
14097
14098    /// Sets the value of [http_route][crate::model::CreateHttpRouteRequest::http_route].
14099    ///
14100    /// # Example
14101    /// ```ignore,no_run
14102    /// # use google_cloud_networkservices_v1::model::CreateHttpRouteRequest;
14103    /// use google_cloud_networkservices_v1::model::HttpRoute;
14104    /// let x = CreateHttpRouteRequest::new().set_http_route(HttpRoute::default()/* use setters */);
14105    /// ```
14106    pub fn set_http_route<T>(mut self, v: T) -> Self
14107    where
14108        T: std::convert::Into<crate::model::HttpRoute>,
14109    {
14110        self.http_route = std::option::Option::Some(v.into());
14111        self
14112    }
14113
14114    /// Sets or clears the value of [http_route][crate::model::CreateHttpRouteRequest::http_route].
14115    ///
14116    /// # Example
14117    /// ```ignore,no_run
14118    /// # use google_cloud_networkservices_v1::model::CreateHttpRouteRequest;
14119    /// use google_cloud_networkservices_v1::model::HttpRoute;
14120    /// let x = CreateHttpRouteRequest::new().set_or_clear_http_route(Some(HttpRoute::default()/* use setters */));
14121    /// let x = CreateHttpRouteRequest::new().set_or_clear_http_route(None::<HttpRoute>);
14122    /// ```
14123    pub fn set_or_clear_http_route<T>(mut self, v: std::option::Option<T>) -> Self
14124    where
14125        T: std::convert::Into<crate::model::HttpRoute>,
14126    {
14127        self.http_route = v.map(|x| x.into());
14128        self
14129    }
14130}
14131
14132impl wkt::message::Message for CreateHttpRouteRequest {
14133    fn typename() -> &'static str {
14134        "type.googleapis.com/google.cloud.networkservices.v1.CreateHttpRouteRequest"
14135    }
14136}
14137
14138/// Request used by the UpdateHttpRoute method.
14139#[derive(Clone, Default, PartialEq)]
14140#[non_exhaustive]
14141pub struct UpdateHttpRouteRequest {
14142    /// Optional. Field mask is used to specify the fields to be overwritten in the
14143    /// HttpRoute resource by the update.
14144    /// The fields specified in the update_mask are relative to the resource, not
14145    /// the full request. A field will be overwritten if it is in the mask. If the
14146    /// user does not provide a mask then all fields will be overwritten.
14147    pub update_mask: std::option::Option<wkt::FieldMask>,
14148
14149    /// Required. Updated HttpRoute resource.
14150    pub http_route: std::option::Option<crate::model::HttpRoute>,
14151
14152    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14153}
14154
14155impl UpdateHttpRouteRequest {
14156    pub fn new() -> Self {
14157        std::default::Default::default()
14158    }
14159
14160    /// Sets the value of [update_mask][crate::model::UpdateHttpRouteRequest::update_mask].
14161    ///
14162    /// # Example
14163    /// ```ignore,no_run
14164    /// # use google_cloud_networkservices_v1::model::UpdateHttpRouteRequest;
14165    /// use wkt::FieldMask;
14166    /// let x = UpdateHttpRouteRequest::new().set_update_mask(FieldMask::default()/* use setters */);
14167    /// ```
14168    pub fn set_update_mask<T>(mut self, v: T) -> Self
14169    where
14170        T: std::convert::Into<wkt::FieldMask>,
14171    {
14172        self.update_mask = std::option::Option::Some(v.into());
14173        self
14174    }
14175
14176    /// Sets or clears the value of [update_mask][crate::model::UpdateHttpRouteRequest::update_mask].
14177    ///
14178    /// # Example
14179    /// ```ignore,no_run
14180    /// # use google_cloud_networkservices_v1::model::UpdateHttpRouteRequest;
14181    /// use wkt::FieldMask;
14182    /// let x = UpdateHttpRouteRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
14183    /// let x = UpdateHttpRouteRequest::new().set_or_clear_update_mask(None::<FieldMask>);
14184    /// ```
14185    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
14186    where
14187        T: std::convert::Into<wkt::FieldMask>,
14188    {
14189        self.update_mask = v.map(|x| x.into());
14190        self
14191    }
14192
14193    /// Sets the value of [http_route][crate::model::UpdateHttpRouteRequest::http_route].
14194    ///
14195    /// # Example
14196    /// ```ignore,no_run
14197    /// # use google_cloud_networkservices_v1::model::UpdateHttpRouteRequest;
14198    /// use google_cloud_networkservices_v1::model::HttpRoute;
14199    /// let x = UpdateHttpRouteRequest::new().set_http_route(HttpRoute::default()/* use setters */);
14200    /// ```
14201    pub fn set_http_route<T>(mut self, v: T) -> Self
14202    where
14203        T: std::convert::Into<crate::model::HttpRoute>,
14204    {
14205        self.http_route = std::option::Option::Some(v.into());
14206        self
14207    }
14208
14209    /// Sets or clears the value of [http_route][crate::model::UpdateHttpRouteRequest::http_route].
14210    ///
14211    /// # Example
14212    /// ```ignore,no_run
14213    /// # use google_cloud_networkservices_v1::model::UpdateHttpRouteRequest;
14214    /// use google_cloud_networkservices_v1::model::HttpRoute;
14215    /// let x = UpdateHttpRouteRequest::new().set_or_clear_http_route(Some(HttpRoute::default()/* use setters */));
14216    /// let x = UpdateHttpRouteRequest::new().set_or_clear_http_route(None::<HttpRoute>);
14217    /// ```
14218    pub fn set_or_clear_http_route<T>(mut self, v: std::option::Option<T>) -> Self
14219    where
14220        T: std::convert::Into<crate::model::HttpRoute>,
14221    {
14222        self.http_route = v.map(|x| x.into());
14223        self
14224    }
14225}
14226
14227impl wkt::message::Message for UpdateHttpRouteRequest {
14228    fn typename() -> &'static str {
14229        "type.googleapis.com/google.cloud.networkservices.v1.UpdateHttpRouteRequest"
14230    }
14231}
14232
14233/// Request used by the DeleteHttpRoute method.
14234#[derive(Clone, Default, PartialEq)]
14235#[non_exhaustive]
14236pub struct DeleteHttpRouteRequest {
14237    /// Required. A name of the HttpRoute to delete. Must be in the format
14238    /// `projects/*/locations/global/httpRoutes/*`.
14239    pub name: std::string::String,
14240
14241    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14242}
14243
14244impl DeleteHttpRouteRequest {
14245    pub fn new() -> Self {
14246        std::default::Default::default()
14247    }
14248
14249    /// Sets the value of [name][crate::model::DeleteHttpRouteRequest::name].
14250    ///
14251    /// # Example
14252    /// ```ignore,no_run
14253    /// # use google_cloud_networkservices_v1::model::DeleteHttpRouteRequest;
14254    /// let x = DeleteHttpRouteRequest::new().set_name("example");
14255    /// ```
14256    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14257        self.name = v.into();
14258        self
14259    }
14260}
14261
14262impl wkt::message::Message for DeleteHttpRouteRequest {
14263    fn typename() -> &'static str {
14264        "type.googleapis.com/google.cloud.networkservices.v1.DeleteHttpRouteRequest"
14265    }
14266}
14267
14268/// Mesh represents a logical configuration grouping for workload to workload
14269/// communication within a service mesh. Routes that point to mesh dictate how
14270/// requests are routed within this logical mesh boundary.
14271#[derive(Clone, Default, PartialEq)]
14272#[non_exhaustive]
14273pub struct Mesh {
14274    /// Identifier. Name of the Mesh resource. It matches pattern
14275    /// `projects/*/locations/global/meshes/<mesh_name>`.
14276    pub name: std::string::String,
14277
14278    /// Output only. Server-defined URL of this resource
14279    pub self_link: std::string::String,
14280
14281    /// Output only. The timestamp when the resource was created.
14282    pub create_time: std::option::Option<wkt::Timestamp>,
14283
14284    /// Output only. The timestamp when the resource was updated.
14285    pub update_time: std::option::Option<wkt::Timestamp>,
14286
14287    /// Optional. Set of label tags associated with the Mesh resource.
14288    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
14289
14290    /// Optional. A free-text description of the resource. Max length 1024
14291    /// characters.
14292    pub description: std::string::String,
14293
14294    /// Optional. If set to a valid TCP port (1-65535), instructs the SIDECAR proxy
14295    /// to listen on the specified port of localhost (127.0.0.1) address. The
14296    /// SIDECAR proxy will expect all traffic to be redirected to this port
14297    /// regardless of its actual ip:port destination. If unset, a port '15001' is
14298    /// used as the interception port. This is applicable only for sidecar proxy
14299    /// deployments.
14300    pub interception_port: i32,
14301
14302    /// Optional. Determines if envoy will insert internal debug headers into
14303    /// upstream requests. Other Envoy headers may still be injected. By default,
14304    /// envoy will not insert any debug headers.
14305    pub envoy_headers: std::option::Option<crate::model::EnvoyHeaders>,
14306
14307    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14308}
14309
14310impl Mesh {
14311    pub fn new() -> Self {
14312        std::default::Default::default()
14313    }
14314
14315    /// Sets the value of [name][crate::model::Mesh::name].
14316    ///
14317    /// # Example
14318    /// ```ignore,no_run
14319    /// # use google_cloud_networkservices_v1::model::Mesh;
14320    /// let x = Mesh::new().set_name("example");
14321    /// ```
14322    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14323        self.name = v.into();
14324        self
14325    }
14326
14327    /// Sets the value of [self_link][crate::model::Mesh::self_link].
14328    ///
14329    /// # Example
14330    /// ```ignore,no_run
14331    /// # use google_cloud_networkservices_v1::model::Mesh;
14332    /// let x = Mesh::new().set_self_link("example");
14333    /// ```
14334    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14335        self.self_link = v.into();
14336        self
14337    }
14338
14339    /// Sets the value of [create_time][crate::model::Mesh::create_time].
14340    ///
14341    /// # Example
14342    /// ```ignore,no_run
14343    /// # use google_cloud_networkservices_v1::model::Mesh;
14344    /// use wkt::Timestamp;
14345    /// let x = Mesh::new().set_create_time(Timestamp::default()/* use setters */);
14346    /// ```
14347    pub fn set_create_time<T>(mut self, v: T) -> Self
14348    where
14349        T: std::convert::Into<wkt::Timestamp>,
14350    {
14351        self.create_time = std::option::Option::Some(v.into());
14352        self
14353    }
14354
14355    /// Sets or clears the value of [create_time][crate::model::Mesh::create_time].
14356    ///
14357    /// # Example
14358    /// ```ignore,no_run
14359    /// # use google_cloud_networkservices_v1::model::Mesh;
14360    /// use wkt::Timestamp;
14361    /// let x = Mesh::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
14362    /// let x = Mesh::new().set_or_clear_create_time(None::<Timestamp>);
14363    /// ```
14364    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
14365    where
14366        T: std::convert::Into<wkt::Timestamp>,
14367    {
14368        self.create_time = v.map(|x| x.into());
14369        self
14370    }
14371
14372    /// Sets the value of [update_time][crate::model::Mesh::update_time].
14373    ///
14374    /// # Example
14375    /// ```ignore,no_run
14376    /// # use google_cloud_networkservices_v1::model::Mesh;
14377    /// use wkt::Timestamp;
14378    /// let x = Mesh::new().set_update_time(Timestamp::default()/* use setters */);
14379    /// ```
14380    pub fn set_update_time<T>(mut self, v: T) -> Self
14381    where
14382        T: std::convert::Into<wkt::Timestamp>,
14383    {
14384        self.update_time = std::option::Option::Some(v.into());
14385        self
14386    }
14387
14388    /// Sets or clears the value of [update_time][crate::model::Mesh::update_time].
14389    ///
14390    /// # Example
14391    /// ```ignore,no_run
14392    /// # use google_cloud_networkservices_v1::model::Mesh;
14393    /// use wkt::Timestamp;
14394    /// let x = Mesh::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
14395    /// let x = Mesh::new().set_or_clear_update_time(None::<Timestamp>);
14396    /// ```
14397    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
14398    where
14399        T: std::convert::Into<wkt::Timestamp>,
14400    {
14401        self.update_time = v.map(|x| x.into());
14402        self
14403    }
14404
14405    /// Sets the value of [labels][crate::model::Mesh::labels].
14406    ///
14407    /// # Example
14408    /// ```ignore,no_run
14409    /// # use google_cloud_networkservices_v1::model::Mesh;
14410    /// let x = Mesh::new().set_labels([
14411    ///     ("key0", "abc"),
14412    ///     ("key1", "xyz"),
14413    /// ]);
14414    /// ```
14415    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
14416    where
14417        T: std::iter::IntoIterator<Item = (K, V)>,
14418        K: std::convert::Into<std::string::String>,
14419        V: std::convert::Into<std::string::String>,
14420    {
14421        use std::iter::Iterator;
14422        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14423        self
14424    }
14425
14426    /// Sets the value of [description][crate::model::Mesh::description].
14427    ///
14428    /// # Example
14429    /// ```ignore,no_run
14430    /// # use google_cloud_networkservices_v1::model::Mesh;
14431    /// let x = Mesh::new().set_description("example");
14432    /// ```
14433    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14434        self.description = v.into();
14435        self
14436    }
14437
14438    /// Sets the value of [interception_port][crate::model::Mesh::interception_port].
14439    ///
14440    /// # Example
14441    /// ```ignore,no_run
14442    /// # use google_cloud_networkservices_v1::model::Mesh;
14443    /// let x = Mesh::new().set_interception_port(42);
14444    /// ```
14445    pub fn set_interception_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14446        self.interception_port = v.into();
14447        self
14448    }
14449
14450    /// Sets the value of [envoy_headers][crate::model::Mesh::envoy_headers].
14451    ///
14452    /// # Example
14453    /// ```ignore,no_run
14454    /// # use google_cloud_networkservices_v1::model::Mesh;
14455    /// use google_cloud_networkservices_v1::model::EnvoyHeaders;
14456    /// let x0 = Mesh::new().set_envoy_headers(EnvoyHeaders::None);
14457    /// let x1 = Mesh::new().set_envoy_headers(EnvoyHeaders::DebugHeaders);
14458    /// ```
14459    pub fn set_envoy_headers<T>(mut self, v: T) -> Self
14460    where
14461        T: std::convert::Into<crate::model::EnvoyHeaders>,
14462    {
14463        self.envoy_headers = std::option::Option::Some(v.into());
14464        self
14465    }
14466
14467    /// Sets or clears the value of [envoy_headers][crate::model::Mesh::envoy_headers].
14468    ///
14469    /// # Example
14470    /// ```ignore,no_run
14471    /// # use google_cloud_networkservices_v1::model::Mesh;
14472    /// use google_cloud_networkservices_v1::model::EnvoyHeaders;
14473    /// let x0 = Mesh::new().set_or_clear_envoy_headers(Some(EnvoyHeaders::None));
14474    /// let x1 = Mesh::new().set_or_clear_envoy_headers(Some(EnvoyHeaders::DebugHeaders));
14475    /// let x_none = Mesh::new().set_or_clear_envoy_headers(None::<EnvoyHeaders>);
14476    /// ```
14477    pub fn set_or_clear_envoy_headers<T>(mut self, v: std::option::Option<T>) -> Self
14478    where
14479        T: std::convert::Into<crate::model::EnvoyHeaders>,
14480    {
14481        self.envoy_headers = v.map(|x| x.into());
14482        self
14483    }
14484}
14485
14486impl wkt::message::Message for Mesh {
14487    fn typename() -> &'static str {
14488        "type.googleapis.com/google.cloud.networkservices.v1.Mesh"
14489    }
14490}
14491
14492/// Request used with the ListMeshes method.
14493#[derive(Clone, Default, PartialEq)]
14494#[non_exhaustive]
14495pub struct ListMeshesRequest {
14496    /// Required. The project and location from which the Meshes should be
14497    /// listed, specified in the format `projects/*/locations/global`.
14498    pub parent: std::string::String,
14499
14500    /// Maximum number of Meshes to return per call.
14501    pub page_size: i32,
14502
14503    /// The value returned by the last `ListMeshesResponse`
14504    /// Indicates that this is a continuation of a prior `ListMeshes` call,
14505    /// and that the system should return the next page of data.
14506    pub page_token: std::string::String,
14507
14508    /// Optional. If true, allow partial responses for multi-regional Aggregated
14509    /// List requests. Otherwise if one of the locations is down or unreachable,
14510    /// the Aggregated List request will fail.
14511    pub return_partial_success: bool,
14512
14513    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14514}
14515
14516impl ListMeshesRequest {
14517    pub fn new() -> Self {
14518        std::default::Default::default()
14519    }
14520
14521    /// Sets the value of [parent][crate::model::ListMeshesRequest::parent].
14522    ///
14523    /// # Example
14524    /// ```ignore,no_run
14525    /// # use google_cloud_networkservices_v1::model::ListMeshesRequest;
14526    /// let x = ListMeshesRequest::new().set_parent("example");
14527    /// ```
14528    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14529        self.parent = v.into();
14530        self
14531    }
14532
14533    /// Sets the value of [page_size][crate::model::ListMeshesRequest::page_size].
14534    ///
14535    /// # Example
14536    /// ```ignore,no_run
14537    /// # use google_cloud_networkservices_v1::model::ListMeshesRequest;
14538    /// let x = ListMeshesRequest::new().set_page_size(42);
14539    /// ```
14540    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14541        self.page_size = v.into();
14542        self
14543    }
14544
14545    /// Sets the value of [page_token][crate::model::ListMeshesRequest::page_token].
14546    ///
14547    /// # Example
14548    /// ```ignore,no_run
14549    /// # use google_cloud_networkservices_v1::model::ListMeshesRequest;
14550    /// let x = ListMeshesRequest::new().set_page_token("example");
14551    /// ```
14552    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14553        self.page_token = v.into();
14554        self
14555    }
14556
14557    /// Sets the value of [return_partial_success][crate::model::ListMeshesRequest::return_partial_success].
14558    ///
14559    /// # Example
14560    /// ```ignore,no_run
14561    /// # use google_cloud_networkservices_v1::model::ListMeshesRequest;
14562    /// let x = ListMeshesRequest::new().set_return_partial_success(true);
14563    /// ```
14564    pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14565        self.return_partial_success = v.into();
14566        self
14567    }
14568}
14569
14570impl wkt::message::Message for ListMeshesRequest {
14571    fn typename() -> &'static str {
14572        "type.googleapis.com/google.cloud.networkservices.v1.ListMeshesRequest"
14573    }
14574}
14575
14576/// Response returned by the ListMeshes method.
14577#[derive(Clone, Default, PartialEq)]
14578#[non_exhaustive]
14579pub struct ListMeshesResponse {
14580    /// List of Mesh resources.
14581    pub meshes: std::vec::Vec<crate::model::Mesh>,
14582
14583    /// If there might be more results than those appearing in this response, then
14584    /// `next_page_token` is included. To get the next set of results, call this
14585    /// method again using the value of `next_page_token` as `page_token`.
14586    pub next_page_token: std::string::String,
14587
14588    /// Unreachable resources. Populated when the request opts into
14589    /// `return_partial_success` and reading across collections e.g. when
14590    /// attempting to list all resources across all supported locations.
14591    pub unreachable: std::vec::Vec<std::string::String>,
14592
14593    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14594}
14595
14596impl ListMeshesResponse {
14597    pub fn new() -> Self {
14598        std::default::Default::default()
14599    }
14600
14601    /// Sets the value of [meshes][crate::model::ListMeshesResponse::meshes].
14602    ///
14603    /// # Example
14604    /// ```ignore,no_run
14605    /// # use google_cloud_networkservices_v1::model::ListMeshesResponse;
14606    /// use google_cloud_networkservices_v1::model::Mesh;
14607    /// let x = ListMeshesResponse::new()
14608    ///     .set_meshes([
14609    ///         Mesh::default()/* use setters */,
14610    ///         Mesh::default()/* use (different) setters */,
14611    ///     ]);
14612    /// ```
14613    pub fn set_meshes<T, V>(mut self, v: T) -> Self
14614    where
14615        T: std::iter::IntoIterator<Item = V>,
14616        V: std::convert::Into<crate::model::Mesh>,
14617    {
14618        use std::iter::Iterator;
14619        self.meshes = v.into_iter().map(|i| i.into()).collect();
14620        self
14621    }
14622
14623    /// Sets the value of [next_page_token][crate::model::ListMeshesResponse::next_page_token].
14624    ///
14625    /// # Example
14626    /// ```ignore,no_run
14627    /// # use google_cloud_networkservices_v1::model::ListMeshesResponse;
14628    /// let x = ListMeshesResponse::new().set_next_page_token("example");
14629    /// ```
14630    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14631        self.next_page_token = v.into();
14632        self
14633    }
14634
14635    /// Sets the value of [unreachable][crate::model::ListMeshesResponse::unreachable].
14636    ///
14637    /// # Example
14638    /// ```ignore,no_run
14639    /// # use google_cloud_networkservices_v1::model::ListMeshesResponse;
14640    /// let x = ListMeshesResponse::new().set_unreachable(["a", "b", "c"]);
14641    /// ```
14642    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
14643    where
14644        T: std::iter::IntoIterator<Item = V>,
14645        V: std::convert::Into<std::string::String>,
14646    {
14647        use std::iter::Iterator;
14648        self.unreachable = v.into_iter().map(|i| i.into()).collect();
14649        self
14650    }
14651}
14652
14653impl wkt::message::Message for ListMeshesResponse {
14654    fn typename() -> &'static str {
14655        "type.googleapis.com/google.cloud.networkservices.v1.ListMeshesResponse"
14656    }
14657}
14658
14659#[doc(hidden)]
14660impl google_cloud_gax::paginator::internal::PageableResponse for ListMeshesResponse {
14661    type PageItem = crate::model::Mesh;
14662
14663    fn items(self) -> std::vec::Vec<Self::PageItem> {
14664        self.meshes
14665    }
14666
14667    fn next_page_token(&self) -> std::string::String {
14668        use std::clone::Clone;
14669        self.next_page_token.clone()
14670    }
14671}
14672
14673/// Request used by the GetMesh method.
14674#[derive(Clone, Default, PartialEq)]
14675#[non_exhaustive]
14676pub struct GetMeshRequest {
14677    /// Required. A name of the Mesh to get. Must be in the format
14678    /// `projects/*/locations/global/meshes/*`.
14679    pub name: std::string::String,
14680
14681    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14682}
14683
14684impl GetMeshRequest {
14685    pub fn new() -> Self {
14686        std::default::Default::default()
14687    }
14688
14689    /// Sets the value of [name][crate::model::GetMeshRequest::name].
14690    ///
14691    /// # Example
14692    /// ```ignore,no_run
14693    /// # use google_cloud_networkservices_v1::model::GetMeshRequest;
14694    /// let x = GetMeshRequest::new().set_name("example");
14695    /// ```
14696    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14697        self.name = v.into();
14698        self
14699    }
14700}
14701
14702impl wkt::message::Message for GetMeshRequest {
14703    fn typename() -> &'static str {
14704        "type.googleapis.com/google.cloud.networkservices.v1.GetMeshRequest"
14705    }
14706}
14707
14708/// Request used by the CreateMesh method.
14709#[derive(Clone, Default, PartialEq)]
14710#[non_exhaustive]
14711pub struct CreateMeshRequest {
14712    /// Required. The parent resource of the Mesh. Must be in the
14713    /// format `projects/*/locations/global`.
14714    pub parent: std::string::String,
14715
14716    /// Required. Short name of the Mesh resource to be created.
14717    pub mesh_id: std::string::String,
14718
14719    /// Required. Mesh resource to be created.
14720    pub mesh: std::option::Option<crate::model::Mesh>,
14721
14722    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14723}
14724
14725impl CreateMeshRequest {
14726    pub fn new() -> Self {
14727        std::default::Default::default()
14728    }
14729
14730    /// Sets the value of [parent][crate::model::CreateMeshRequest::parent].
14731    ///
14732    /// # Example
14733    /// ```ignore,no_run
14734    /// # use google_cloud_networkservices_v1::model::CreateMeshRequest;
14735    /// let x = CreateMeshRequest::new().set_parent("example");
14736    /// ```
14737    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14738        self.parent = v.into();
14739        self
14740    }
14741
14742    /// Sets the value of [mesh_id][crate::model::CreateMeshRequest::mesh_id].
14743    ///
14744    /// # Example
14745    /// ```ignore,no_run
14746    /// # use google_cloud_networkservices_v1::model::CreateMeshRequest;
14747    /// let x = CreateMeshRequest::new().set_mesh_id("example");
14748    /// ```
14749    pub fn set_mesh_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14750        self.mesh_id = v.into();
14751        self
14752    }
14753
14754    /// Sets the value of [mesh][crate::model::CreateMeshRequest::mesh].
14755    ///
14756    /// # Example
14757    /// ```ignore,no_run
14758    /// # use google_cloud_networkservices_v1::model::CreateMeshRequest;
14759    /// use google_cloud_networkservices_v1::model::Mesh;
14760    /// let x = CreateMeshRequest::new().set_mesh(Mesh::default()/* use setters */);
14761    /// ```
14762    pub fn set_mesh<T>(mut self, v: T) -> Self
14763    where
14764        T: std::convert::Into<crate::model::Mesh>,
14765    {
14766        self.mesh = std::option::Option::Some(v.into());
14767        self
14768    }
14769
14770    /// Sets or clears the value of [mesh][crate::model::CreateMeshRequest::mesh].
14771    ///
14772    /// # Example
14773    /// ```ignore,no_run
14774    /// # use google_cloud_networkservices_v1::model::CreateMeshRequest;
14775    /// use google_cloud_networkservices_v1::model::Mesh;
14776    /// let x = CreateMeshRequest::new().set_or_clear_mesh(Some(Mesh::default()/* use setters */));
14777    /// let x = CreateMeshRequest::new().set_or_clear_mesh(None::<Mesh>);
14778    /// ```
14779    pub fn set_or_clear_mesh<T>(mut self, v: std::option::Option<T>) -> Self
14780    where
14781        T: std::convert::Into<crate::model::Mesh>,
14782    {
14783        self.mesh = v.map(|x| x.into());
14784        self
14785    }
14786}
14787
14788impl wkt::message::Message for CreateMeshRequest {
14789    fn typename() -> &'static str {
14790        "type.googleapis.com/google.cloud.networkservices.v1.CreateMeshRequest"
14791    }
14792}
14793
14794/// Request used by the UpdateMesh method.
14795#[derive(Clone, Default, PartialEq)]
14796#[non_exhaustive]
14797pub struct UpdateMeshRequest {
14798    /// Optional. Field mask is used to specify the fields to be overwritten in the
14799    /// Mesh resource by the update.
14800    /// The fields specified in the update_mask are relative to the resource, not
14801    /// the full request. A field will be overwritten if it is in the mask. If the
14802    /// user does not provide a mask then all fields will be overwritten.
14803    pub update_mask: std::option::Option<wkt::FieldMask>,
14804
14805    /// Required. Updated Mesh resource.
14806    pub mesh: std::option::Option<crate::model::Mesh>,
14807
14808    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14809}
14810
14811impl UpdateMeshRequest {
14812    pub fn new() -> Self {
14813        std::default::Default::default()
14814    }
14815
14816    /// Sets the value of [update_mask][crate::model::UpdateMeshRequest::update_mask].
14817    ///
14818    /// # Example
14819    /// ```ignore,no_run
14820    /// # use google_cloud_networkservices_v1::model::UpdateMeshRequest;
14821    /// use wkt::FieldMask;
14822    /// let x = UpdateMeshRequest::new().set_update_mask(FieldMask::default()/* use setters */);
14823    /// ```
14824    pub fn set_update_mask<T>(mut self, v: T) -> Self
14825    where
14826        T: std::convert::Into<wkt::FieldMask>,
14827    {
14828        self.update_mask = std::option::Option::Some(v.into());
14829        self
14830    }
14831
14832    /// Sets or clears the value of [update_mask][crate::model::UpdateMeshRequest::update_mask].
14833    ///
14834    /// # Example
14835    /// ```ignore,no_run
14836    /// # use google_cloud_networkservices_v1::model::UpdateMeshRequest;
14837    /// use wkt::FieldMask;
14838    /// let x = UpdateMeshRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
14839    /// let x = UpdateMeshRequest::new().set_or_clear_update_mask(None::<FieldMask>);
14840    /// ```
14841    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
14842    where
14843        T: std::convert::Into<wkt::FieldMask>,
14844    {
14845        self.update_mask = v.map(|x| x.into());
14846        self
14847    }
14848
14849    /// Sets the value of [mesh][crate::model::UpdateMeshRequest::mesh].
14850    ///
14851    /// # Example
14852    /// ```ignore,no_run
14853    /// # use google_cloud_networkservices_v1::model::UpdateMeshRequest;
14854    /// use google_cloud_networkservices_v1::model::Mesh;
14855    /// let x = UpdateMeshRequest::new().set_mesh(Mesh::default()/* use setters */);
14856    /// ```
14857    pub fn set_mesh<T>(mut self, v: T) -> Self
14858    where
14859        T: std::convert::Into<crate::model::Mesh>,
14860    {
14861        self.mesh = std::option::Option::Some(v.into());
14862        self
14863    }
14864
14865    /// Sets or clears the value of [mesh][crate::model::UpdateMeshRequest::mesh].
14866    ///
14867    /// # Example
14868    /// ```ignore,no_run
14869    /// # use google_cloud_networkservices_v1::model::UpdateMeshRequest;
14870    /// use google_cloud_networkservices_v1::model::Mesh;
14871    /// let x = UpdateMeshRequest::new().set_or_clear_mesh(Some(Mesh::default()/* use setters */));
14872    /// let x = UpdateMeshRequest::new().set_or_clear_mesh(None::<Mesh>);
14873    /// ```
14874    pub fn set_or_clear_mesh<T>(mut self, v: std::option::Option<T>) -> Self
14875    where
14876        T: std::convert::Into<crate::model::Mesh>,
14877    {
14878        self.mesh = v.map(|x| x.into());
14879        self
14880    }
14881}
14882
14883impl wkt::message::Message for UpdateMeshRequest {
14884    fn typename() -> &'static str {
14885        "type.googleapis.com/google.cloud.networkservices.v1.UpdateMeshRequest"
14886    }
14887}
14888
14889/// Request used by the DeleteMesh method.
14890#[derive(Clone, Default, PartialEq)]
14891#[non_exhaustive]
14892pub struct DeleteMeshRequest {
14893    /// Required. A name of the Mesh to delete. Must be in the format
14894    /// `projects/*/locations/global/meshes/*`.
14895    pub name: std::string::String,
14896
14897    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14898}
14899
14900impl DeleteMeshRequest {
14901    pub fn new() -> Self {
14902        std::default::Default::default()
14903    }
14904
14905    /// Sets the value of [name][crate::model::DeleteMeshRequest::name].
14906    ///
14907    /// # Example
14908    /// ```ignore,no_run
14909    /// # use google_cloud_networkservices_v1::model::DeleteMeshRequest;
14910    /// let x = DeleteMeshRequest::new().set_name("example");
14911    /// ```
14912    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14913        self.name = v.into();
14914        self
14915    }
14916}
14917
14918impl wkt::message::Message for DeleteMeshRequest {
14919    fn typename() -> &'static str {
14920        "type.googleapis.com/google.cloud.networkservices.v1.DeleteMeshRequest"
14921    }
14922}
14923
14924/// GatewayRouteView defines view-only resource for Routes to a Gateway
14925#[derive(Clone, Default, PartialEq)]
14926#[non_exhaustive]
14927pub struct GatewayRouteView {
14928    /// Output only. Identifier. Full path name of the GatewayRouteView resource.
14929    /// Format:
14930    /// projects/{project_number}/locations/{location}/gateways/{gateway}/routeViews/{route_view}
14931    pub name: std::string::String,
14932
14933    /// Output only. Project number where the route exists.
14934    pub route_project_number: i64,
14935
14936    /// Output only. Location where the route exists.
14937    pub route_location: std::string::String,
14938
14939    /// Output only. Type of the route: HttpRoute,GrpcRoute,TcpRoute, or TlsRoute
14940    pub route_type: std::string::String,
14941
14942    /// Output only. The resource id for the route.
14943    pub route_id: std::string::String,
14944
14945    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14946}
14947
14948impl GatewayRouteView {
14949    pub fn new() -> Self {
14950        std::default::Default::default()
14951    }
14952
14953    /// Sets the value of [name][crate::model::GatewayRouteView::name].
14954    ///
14955    /// # Example
14956    /// ```ignore,no_run
14957    /// # use google_cloud_networkservices_v1::model::GatewayRouteView;
14958    /// let x = GatewayRouteView::new().set_name("example");
14959    /// ```
14960    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14961        self.name = v.into();
14962        self
14963    }
14964
14965    /// Sets the value of [route_project_number][crate::model::GatewayRouteView::route_project_number].
14966    ///
14967    /// # Example
14968    /// ```ignore,no_run
14969    /// # use google_cloud_networkservices_v1::model::GatewayRouteView;
14970    /// let x = GatewayRouteView::new().set_route_project_number(42);
14971    /// ```
14972    pub fn set_route_project_number<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
14973        self.route_project_number = v.into();
14974        self
14975    }
14976
14977    /// Sets the value of [route_location][crate::model::GatewayRouteView::route_location].
14978    ///
14979    /// # Example
14980    /// ```ignore,no_run
14981    /// # use google_cloud_networkservices_v1::model::GatewayRouteView;
14982    /// let x = GatewayRouteView::new().set_route_location("example");
14983    /// ```
14984    pub fn set_route_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14985        self.route_location = v.into();
14986        self
14987    }
14988
14989    /// Sets the value of [route_type][crate::model::GatewayRouteView::route_type].
14990    ///
14991    /// # Example
14992    /// ```ignore,no_run
14993    /// # use google_cloud_networkservices_v1::model::GatewayRouteView;
14994    /// let x = GatewayRouteView::new().set_route_type("example");
14995    /// ```
14996    pub fn set_route_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14997        self.route_type = v.into();
14998        self
14999    }
15000
15001    /// Sets the value of [route_id][crate::model::GatewayRouteView::route_id].
15002    ///
15003    /// # Example
15004    /// ```ignore,no_run
15005    /// # use google_cloud_networkservices_v1::model::GatewayRouteView;
15006    /// let x = GatewayRouteView::new().set_route_id("example");
15007    /// ```
15008    pub fn set_route_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15009        self.route_id = v.into();
15010        self
15011    }
15012}
15013
15014impl wkt::message::Message for GatewayRouteView {
15015    fn typename() -> &'static str {
15016        "type.googleapis.com/google.cloud.networkservices.v1.GatewayRouteView"
15017    }
15018}
15019
15020/// MeshRouteView defines view-only resource for Routes to a Mesh
15021#[derive(Clone, Default, PartialEq)]
15022#[non_exhaustive]
15023pub struct MeshRouteView {
15024    /// Output only. Identifier. Full path name of the MeshRouteView resource.
15025    /// Format:
15026    /// projects/{project}/locations/{location}/meshes/{mesh}/routeViews/{route_view}
15027    pub name: std::string::String,
15028
15029    /// Output only. Project number where the route exists.
15030    pub route_project_number: i64,
15031
15032    /// Output only. Location where the route exists.
15033    pub route_location: std::string::String,
15034
15035    /// Output only. Type of the route: HttpRoute,GrpcRoute,TcpRoute, or TlsRoute
15036    pub route_type: std::string::String,
15037
15038    /// Output only. The resource id for the route.
15039    pub route_id: std::string::String,
15040
15041    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15042}
15043
15044impl MeshRouteView {
15045    pub fn new() -> Self {
15046        std::default::Default::default()
15047    }
15048
15049    /// Sets the value of [name][crate::model::MeshRouteView::name].
15050    ///
15051    /// # Example
15052    /// ```ignore,no_run
15053    /// # use google_cloud_networkservices_v1::model::MeshRouteView;
15054    /// let x = MeshRouteView::new().set_name("example");
15055    /// ```
15056    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15057        self.name = v.into();
15058        self
15059    }
15060
15061    /// Sets the value of [route_project_number][crate::model::MeshRouteView::route_project_number].
15062    ///
15063    /// # Example
15064    /// ```ignore,no_run
15065    /// # use google_cloud_networkservices_v1::model::MeshRouteView;
15066    /// let x = MeshRouteView::new().set_route_project_number(42);
15067    /// ```
15068    pub fn set_route_project_number<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
15069        self.route_project_number = v.into();
15070        self
15071    }
15072
15073    /// Sets the value of [route_location][crate::model::MeshRouteView::route_location].
15074    ///
15075    /// # Example
15076    /// ```ignore,no_run
15077    /// # use google_cloud_networkservices_v1::model::MeshRouteView;
15078    /// let x = MeshRouteView::new().set_route_location("example");
15079    /// ```
15080    pub fn set_route_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15081        self.route_location = v.into();
15082        self
15083    }
15084
15085    /// Sets the value of [route_type][crate::model::MeshRouteView::route_type].
15086    ///
15087    /// # Example
15088    /// ```ignore,no_run
15089    /// # use google_cloud_networkservices_v1::model::MeshRouteView;
15090    /// let x = MeshRouteView::new().set_route_type("example");
15091    /// ```
15092    pub fn set_route_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15093        self.route_type = v.into();
15094        self
15095    }
15096
15097    /// Sets the value of [route_id][crate::model::MeshRouteView::route_id].
15098    ///
15099    /// # Example
15100    /// ```ignore,no_run
15101    /// # use google_cloud_networkservices_v1::model::MeshRouteView;
15102    /// let x = MeshRouteView::new().set_route_id("example");
15103    /// ```
15104    pub fn set_route_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15105        self.route_id = v.into();
15106        self
15107    }
15108}
15109
15110impl wkt::message::Message for MeshRouteView {
15111    fn typename() -> &'static str {
15112        "type.googleapis.com/google.cloud.networkservices.v1.MeshRouteView"
15113    }
15114}
15115
15116/// Request used with the GetGatewayRouteView method.
15117#[derive(Clone, Default, PartialEq)]
15118#[non_exhaustive]
15119pub struct GetGatewayRouteViewRequest {
15120    /// Required. Name of the GatewayRouteView resource.
15121    /// Formats:
15122    /// projects/{project}/locations/{location}/gateways/{gateway}/routeViews/{route_view}
15123    pub name: std::string::String,
15124
15125    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15126}
15127
15128impl GetGatewayRouteViewRequest {
15129    pub fn new() -> Self {
15130        std::default::Default::default()
15131    }
15132
15133    /// Sets the value of [name][crate::model::GetGatewayRouteViewRequest::name].
15134    ///
15135    /// # Example
15136    /// ```ignore,no_run
15137    /// # use google_cloud_networkservices_v1::model::GetGatewayRouteViewRequest;
15138    /// let x = GetGatewayRouteViewRequest::new().set_name("example");
15139    /// ```
15140    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15141        self.name = v.into();
15142        self
15143    }
15144}
15145
15146impl wkt::message::Message for GetGatewayRouteViewRequest {
15147    fn typename() -> &'static str {
15148        "type.googleapis.com/google.cloud.networkservices.v1.GetGatewayRouteViewRequest"
15149    }
15150}
15151
15152/// Request used with the GetMeshRouteView method.
15153#[derive(Clone, Default, PartialEq)]
15154#[non_exhaustive]
15155pub struct GetMeshRouteViewRequest {
15156    /// Required. Name of the MeshRouteView resource.
15157    /// Format:
15158    /// projects/{project}/locations/{location}/meshes/{mesh}/routeViews/{route_view}
15159    pub name: std::string::String,
15160
15161    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15162}
15163
15164impl GetMeshRouteViewRequest {
15165    pub fn new() -> Self {
15166        std::default::Default::default()
15167    }
15168
15169    /// Sets the value of [name][crate::model::GetMeshRouteViewRequest::name].
15170    ///
15171    /// # Example
15172    /// ```ignore,no_run
15173    /// # use google_cloud_networkservices_v1::model::GetMeshRouteViewRequest;
15174    /// let x = GetMeshRouteViewRequest::new().set_name("example");
15175    /// ```
15176    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15177        self.name = v.into();
15178        self
15179    }
15180}
15181
15182impl wkt::message::Message for GetMeshRouteViewRequest {
15183    fn typename() -> &'static str {
15184        "type.googleapis.com/google.cloud.networkservices.v1.GetMeshRouteViewRequest"
15185    }
15186}
15187
15188/// Request used with the ListGatewayRouteViews method.
15189#[derive(Clone, Default, PartialEq)]
15190#[non_exhaustive]
15191pub struct ListGatewayRouteViewsRequest {
15192    /// Required. The Gateway to which a Route is associated.
15193    /// Formats:
15194    /// projects/{project}/locations/{location}/gateways/{gateway}
15195    pub parent: std::string::String,
15196
15197    /// Maximum number of GatewayRouteViews to return per call.
15198    pub page_size: i32,
15199
15200    /// The value returned by the last `ListGatewayRouteViewsResponse`
15201    /// Indicates that this is a continuation of a prior `ListGatewayRouteViews`
15202    /// call, and that the system should return the next page of data.
15203    pub page_token: std::string::String,
15204
15205    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15206}
15207
15208impl ListGatewayRouteViewsRequest {
15209    pub fn new() -> Self {
15210        std::default::Default::default()
15211    }
15212
15213    /// Sets the value of [parent][crate::model::ListGatewayRouteViewsRequest::parent].
15214    ///
15215    /// # Example
15216    /// ```ignore,no_run
15217    /// # use google_cloud_networkservices_v1::model::ListGatewayRouteViewsRequest;
15218    /// let x = ListGatewayRouteViewsRequest::new().set_parent("example");
15219    /// ```
15220    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15221        self.parent = v.into();
15222        self
15223    }
15224
15225    /// Sets the value of [page_size][crate::model::ListGatewayRouteViewsRequest::page_size].
15226    ///
15227    /// # Example
15228    /// ```ignore,no_run
15229    /// # use google_cloud_networkservices_v1::model::ListGatewayRouteViewsRequest;
15230    /// let x = ListGatewayRouteViewsRequest::new().set_page_size(42);
15231    /// ```
15232    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15233        self.page_size = v.into();
15234        self
15235    }
15236
15237    /// Sets the value of [page_token][crate::model::ListGatewayRouteViewsRequest::page_token].
15238    ///
15239    /// # Example
15240    /// ```ignore,no_run
15241    /// # use google_cloud_networkservices_v1::model::ListGatewayRouteViewsRequest;
15242    /// let x = ListGatewayRouteViewsRequest::new().set_page_token("example");
15243    /// ```
15244    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15245        self.page_token = v.into();
15246        self
15247    }
15248}
15249
15250impl wkt::message::Message for ListGatewayRouteViewsRequest {
15251    fn typename() -> &'static str {
15252        "type.googleapis.com/google.cloud.networkservices.v1.ListGatewayRouteViewsRequest"
15253    }
15254}
15255
15256/// Request used with the ListMeshRouteViews method.
15257#[derive(Clone, Default, PartialEq)]
15258#[non_exhaustive]
15259pub struct ListMeshRouteViewsRequest {
15260    /// Required. The Mesh to which a Route is associated.
15261    /// Format:
15262    /// projects/{project}/locations/{location}/meshes/{mesh}
15263    pub parent: std::string::String,
15264
15265    /// Maximum number of MeshRouteViews to return per call.
15266    pub page_size: i32,
15267
15268    /// The value returned by the last `ListMeshRouteViewsResponse`
15269    /// Indicates that this is a continuation of a prior `ListMeshRouteViews` call,
15270    /// and that the system should return the next page of data.
15271    pub page_token: std::string::String,
15272
15273    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15274}
15275
15276impl ListMeshRouteViewsRequest {
15277    pub fn new() -> Self {
15278        std::default::Default::default()
15279    }
15280
15281    /// Sets the value of [parent][crate::model::ListMeshRouteViewsRequest::parent].
15282    ///
15283    /// # Example
15284    /// ```ignore,no_run
15285    /// # use google_cloud_networkservices_v1::model::ListMeshRouteViewsRequest;
15286    /// let x = ListMeshRouteViewsRequest::new().set_parent("example");
15287    /// ```
15288    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15289        self.parent = v.into();
15290        self
15291    }
15292
15293    /// Sets the value of [page_size][crate::model::ListMeshRouteViewsRequest::page_size].
15294    ///
15295    /// # Example
15296    /// ```ignore,no_run
15297    /// # use google_cloud_networkservices_v1::model::ListMeshRouteViewsRequest;
15298    /// let x = ListMeshRouteViewsRequest::new().set_page_size(42);
15299    /// ```
15300    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15301        self.page_size = v.into();
15302        self
15303    }
15304
15305    /// Sets the value of [page_token][crate::model::ListMeshRouteViewsRequest::page_token].
15306    ///
15307    /// # Example
15308    /// ```ignore,no_run
15309    /// # use google_cloud_networkservices_v1::model::ListMeshRouteViewsRequest;
15310    /// let x = ListMeshRouteViewsRequest::new().set_page_token("example");
15311    /// ```
15312    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15313        self.page_token = v.into();
15314        self
15315    }
15316}
15317
15318impl wkt::message::Message for ListMeshRouteViewsRequest {
15319    fn typename() -> &'static str {
15320        "type.googleapis.com/google.cloud.networkservices.v1.ListMeshRouteViewsRequest"
15321    }
15322}
15323
15324/// Response returned by the ListGatewayRouteViews method.
15325#[derive(Clone, Default, PartialEq)]
15326#[non_exhaustive]
15327pub struct ListGatewayRouteViewsResponse {
15328    /// List of GatewayRouteView resources.
15329    pub gateway_route_views: std::vec::Vec<crate::model::GatewayRouteView>,
15330
15331    /// A token, which can be sent as `page_token` to retrieve the next page.
15332    /// If this field is omitted, there are no subsequent pages.
15333    pub next_page_token: std::string::String,
15334
15335    /// Unreachable resources. Populated when the request attempts to list all
15336    /// resources across all supported locations, while some locations are
15337    /// temporarily unavailable.
15338    pub unreachable: std::vec::Vec<std::string::String>,
15339
15340    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15341}
15342
15343impl ListGatewayRouteViewsResponse {
15344    pub fn new() -> Self {
15345        std::default::Default::default()
15346    }
15347
15348    /// Sets the value of [gateway_route_views][crate::model::ListGatewayRouteViewsResponse::gateway_route_views].
15349    ///
15350    /// # Example
15351    /// ```ignore,no_run
15352    /// # use google_cloud_networkservices_v1::model::ListGatewayRouteViewsResponse;
15353    /// use google_cloud_networkservices_v1::model::GatewayRouteView;
15354    /// let x = ListGatewayRouteViewsResponse::new()
15355    ///     .set_gateway_route_views([
15356    ///         GatewayRouteView::default()/* use setters */,
15357    ///         GatewayRouteView::default()/* use (different) setters */,
15358    ///     ]);
15359    /// ```
15360    pub fn set_gateway_route_views<T, V>(mut self, v: T) -> Self
15361    where
15362        T: std::iter::IntoIterator<Item = V>,
15363        V: std::convert::Into<crate::model::GatewayRouteView>,
15364    {
15365        use std::iter::Iterator;
15366        self.gateway_route_views = v.into_iter().map(|i| i.into()).collect();
15367        self
15368    }
15369
15370    /// Sets the value of [next_page_token][crate::model::ListGatewayRouteViewsResponse::next_page_token].
15371    ///
15372    /// # Example
15373    /// ```ignore,no_run
15374    /// # use google_cloud_networkservices_v1::model::ListGatewayRouteViewsResponse;
15375    /// let x = ListGatewayRouteViewsResponse::new().set_next_page_token("example");
15376    /// ```
15377    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15378        self.next_page_token = v.into();
15379        self
15380    }
15381
15382    /// Sets the value of [unreachable][crate::model::ListGatewayRouteViewsResponse::unreachable].
15383    ///
15384    /// # Example
15385    /// ```ignore,no_run
15386    /// # use google_cloud_networkservices_v1::model::ListGatewayRouteViewsResponse;
15387    /// let x = ListGatewayRouteViewsResponse::new().set_unreachable(["a", "b", "c"]);
15388    /// ```
15389    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
15390    where
15391        T: std::iter::IntoIterator<Item = V>,
15392        V: std::convert::Into<std::string::String>,
15393    {
15394        use std::iter::Iterator;
15395        self.unreachable = v.into_iter().map(|i| i.into()).collect();
15396        self
15397    }
15398}
15399
15400impl wkt::message::Message for ListGatewayRouteViewsResponse {
15401    fn typename() -> &'static str {
15402        "type.googleapis.com/google.cloud.networkservices.v1.ListGatewayRouteViewsResponse"
15403    }
15404}
15405
15406#[doc(hidden)]
15407impl google_cloud_gax::paginator::internal::PageableResponse for ListGatewayRouteViewsResponse {
15408    type PageItem = crate::model::GatewayRouteView;
15409
15410    fn items(self) -> std::vec::Vec<Self::PageItem> {
15411        self.gateway_route_views
15412    }
15413
15414    fn next_page_token(&self) -> std::string::String {
15415        use std::clone::Clone;
15416        self.next_page_token.clone()
15417    }
15418}
15419
15420/// Response returned by the ListMeshRouteViews method.
15421#[derive(Clone, Default, PartialEq)]
15422#[non_exhaustive]
15423pub struct ListMeshRouteViewsResponse {
15424    /// List of MeshRouteView resources.
15425    pub mesh_route_views: std::vec::Vec<crate::model::MeshRouteView>,
15426
15427    /// A token, which can be sent as `page_token` to retrieve the next page.
15428    /// If this field is omitted, there are no subsequent pages.
15429    pub next_page_token: std::string::String,
15430
15431    /// Unreachable resources. Populated when the request attempts to list all
15432    /// resources across all supported locations, while some locations are
15433    /// temporarily unavailable.
15434    pub unreachable: std::vec::Vec<std::string::String>,
15435
15436    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15437}
15438
15439impl ListMeshRouteViewsResponse {
15440    pub fn new() -> Self {
15441        std::default::Default::default()
15442    }
15443
15444    /// Sets the value of [mesh_route_views][crate::model::ListMeshRouteViewsResponse::mesh_route_views].
15445    ///
15446    /// # Example
15447    /// ```ignore,no_run
15448    /// # use google_cloud_networkservices_v1::model::ListMeshRouteViewsResponse;
15449    /// use google_cloud_networkservices_v1::model::MeshRouteView;
15450    /// let x = ListMeshRouteViewsResponse::new()
15451    ///     .set_mesh_route_views([
15452    ///         MeshRouteView::default()/* use setters */,
15453    ///         MeshRouteView::default()/* use (different) setters */,
15454    ///     ]);
15455    /// ```
15456    pub fn set_mesh_route_views<T, V>(mut self, v: T) -> Self
15457    where
15458        T: std::iter::IntoIterator<Item = V>,
15459        V: std::convert::Into<crate::model::MeshRouteView>,
15460    {
15461        use std::iter::Iterator;
15462        self.mesh_route_views = v.into_iter().map(|i| i.into()).collect();
15463        self
15464    }
15465
15466    /// Sets the value of [next_page_token][crate::model::ListMeshRouteViewsResponse::next_page_token].
15467    ///
15468    /// # Example
15469    /// ```ignore,no_run
15470    /// # use google_cloud_networkservices_v1::model::ListMeshRouteViewsResponse;
15471    /// let x = ListMeshRouteViewsResponse::new().set_next_page_token("example");
15472    /// ```
15473    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15474        self.next_page_token = v.into();
15475        self
15476    }
15477
15478    /// Sets the value of [unreachable][crate::model::ListMeshRouteViewsResponse::unreachable].
15479    ///
15480    /// # Example
15481    /// ```ignore,no_run
15482    /// # use google_cloud_networkservices_v1::model::ListMeshRouteViewsResponse;
15483    /// let x = ListMeshRouteViewsResponse::new().set_unreachable(["a", "b", "c"]);
15484    /// ```
15485    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
15486    where
15487        T: std::iter::IntoIterator<Item = V>,
15488        V: std::convert::Into<std::string::String>,
15489    {
15490        use std::iter::Iterator;
15491        self.unreachable = v.into_iter().map(|i| i.into()).collect();
15492        self
15493    }
15494}
15495
15496impl wkt::message::Message for ListMeshRouteViewsResponse {
15497    fn typename() -> &'static str {
15498        "type.googleapis.com/google.cloud.networkservices.v1.ListMeshRouteViewsResponse"
15499    }
15500}
15501
15502#[doc(hidden)]
15503impl google_cloud_gax::paginator::internal::PageableResponse for ListMeshRouteViewsResponse {
15504    type PageItem = crate::model::MeshRouteView;
15505
15506    fn items(self) -> std::vec::Vec<Self::PageItem> {
15507        self.mesh_route_views
15508    }
15509
15510    fn next_page_token(&self) -> std::string::String {
15511        use std::clone::Clone;
15512        self.next_page_token.clone()
15513    }
15514}
15515
15516/// ServiceBinding can be used to:
15517///
15518/// - Bind a Service Directory Service to be used in a BackendService resource.
15519///   This feature will be deprecated soon.
15520/// - Bind a Private Service Connect producer service to be used in consumer
15521///   Cloud Service Mesh or Application Load Balancers.
15522/// - Bind a Cloud Run service to be used in consumer Cloud Service Mesh or
15523///   Application Load Balancers.
15524#[derive(Clone, Default, PartialEq)]
15525#[non_exhaustive]
15526pub struct ServiceBinding {
15527    /// Identifier. Name of the ServiceBinding resource. It matches pattern
15528    /// `projects/*/locations/*/serviceBindings/<service_binding_name>`.
15529    pub name: std::string::String,
15530
15531    /// Optional. A free-text description of the resource. Max length 1024
15532    /// characters.
15533    pub description: std::string::String,
15534
15535    /// Output only. The timestamp when the resource was created.
15536    pub create_time: std::option::Option<wkt::Timestamp>,
15537
15538    /// Output only. The timestamp when the resource was updated.
15539    pub update_time: std::option::Option<wkt::Timestamp>,
15540
15541    /// Optional. The full Service Directory Service name of the format
15542    /// `projects/*/locations/*/namespaces/*/services/*`.
15543    /// This field is for Service Directory integration which will be deprecated
15544    /// soon.
15545    #[deprecated]
15546    pub service: std::string::String,
15547
15548    /// Output only. The unique identifier of the Service Directory Service against
15549    /// which the ServiceBinding resource is validated. This is populated when the
15550    /// Service Binding resource is used in another resource (like Backend
15551    /// Service). This is of the UUID4 format. This field is for Service Directory
15552    /// integration which will be deprecated soon.
15553    #[deprecated]
15554    pub service_id: std::string::String,
15555
15556    /// Optional. Set of label tags associated with the ServiceBinding resource.
15557    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
15558
15559    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15560}
15561
15562impl ServiceBinding {
15563    pub fn new() -> Self {
15564        std::default::Default::default()
15565    }
15566
15567    /// Sets the value of [name][crate::model::ServiceBinding::name].
15568    ///
15569    /// # Example
15570    /// ```ignore,no_run
15571    /// # use google_cloud_networkservices_v1::model::ServiceBinding;
15572    /// let x = ServiceBinding::new().set_name("example");
15573    /// ```
15574    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15575        self.name = v.into();
15576        self
15577    }
15578
15579    /// Sets the value of [description][crate::model::ServiceBinding::description].
15580    ///
15581    /// # Example
15582    /// ```ignore,no_run
15583    /// # use google_cloud_networkservices_v1::model::ServiceBinding;
15584    /// let x = ServiceBinding::new().set_description("example");
15585    /// ```
15586    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15587        self.description = v.into();
15588        self
15589    }
15590
15591    /// Sets the value of [create_time][crate::model::ServiceBinding::create_time].
15592    ///
15593    /// # Example
15594    /// ```ignore,no_run
15595    /// # use google_cloud_networkservices_v1::model::ServiceBinding;
15596    /// use wkt::Timestamp;
15597    /// let x = ServiceBinding::new().set_create_time(Timestamp::default()/* use setters */);
15598    /// ```
15599    pub fn set_create_time<T>(mut self, v: T) -> Self
15600    where
15601        T: std::convert::Into<wkt::Timestamp>,
15602    {
15603        self.create_time = std::option::Option::Some(v.into());
15604        self
15605    }
15606
15607    /// Sets or clears the value of [create_time][crate::model::ServiceBinding::create_time].
15608    ///
15609    /// # Example
15610    /// ```ignore,no_run
15611    /// # use google_cloud_networkservices_v1::model::ServiceBinding;
15612    /// use wkt::Timestamp;
15613    /// let x = ServiceBinding::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
15614    /// let x = ServiceBinding::new().set_or_clear_create_time(None::<Timestamp>);
15615    /// ```
15616    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
15617    where
15618        T: std::convert::Into<wkt::Timestamp>,
15619    {
15620        self.create_time = v.map(|x| x.into());
15621        self
15622    }
15623
15624    /// Sets the value of [update_time][crate::model::ServiceBinding::update_time].
15625    ///
15626    /// # Example
15627    /// ```ignore,no_run
15628    /// # use google_cloud_networkservices_v1::model::ServiceBinding;
15629    /// use wkt::Timestamp;
15630    /// let x = ServiceBinding::new().set_update_time(Timestamp::default()/* use setters */);
15631    /// ```
15632    pub fn set_update_time<T>(mut self, v: T) -> Self
15633    where
15634        T: std::convert::Into<wkt::Timestamp>,
15635    {
15636        self.update_time = std::option::Option::Some(v.into());
15637        self
15638    }
15639
15640    /// Sets or clears the value of [update_time][crate::model::ServiceBinding::update_time].
15641    ///
15642    /// # Example
15643    /// ```ignore,no_run
15644    /// # use google_cloud_networkservices_v1::model::ServiceBinding;
15645    /// use wkt::Timestamp;
15646    /// let x = ServiceBinding::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
15647    /// let x = ServiceBinding::new().set_or_clear_update_time(None::<Timestamp>);
15648    /// ```
15649    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
15650    where
15651        T: std::convert::Into<wkt::Timestamp>,
15652    {
15653        self.update_time = v.map(|x| x.into());
15654        self
15655    }
15656
15657    /// Sets the value of [service][crate::model::ServiceBinding::service].
15658    ///
15659    /// # Example
15660    /// ```ignore,no_run
15661    /// # use google_cloud_networkservices_v1::model::ServiceBinding;
15662    /// let x = ServiceBinding::new().set_service("example");
15663    /// ```
15664    #[deprecated]
15665    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15666        self.service = v.into();
15667        self
15668    }
15669
15670    /// Sets the value of [service_id][crate::model::ServiceBinding::service_id].
15671    ///
15672    /// # Example
15673    /// ```ignore,no_run
15674    /// # use google_cloud_networkservices_v1::model::ServiceBinding;
15675    /// let x = ServiceBinding::new().set_service_id("example");
15676    /// ```
15677    #[deprecated]
15678    pub fn set_service_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15679        self.service_id = v.into();
15680        self
15681    }
15682
15683    /// Sets the value of [labels][crate::model::ServiceBinding::labels].
15684    ///
15685    /// # Example
15686    /// ```ignore,no_run
15687    /// # use google_cloud_networkservices_v1::model::ServiceBinding;
15688    /// let x = ServiceBinding::new().set_labels([
15689    ///     ("key0", "abc"),
15690    ///     ("key1", "xyz"),
15691    /// ]);
15692    /// ```
15693    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
15694    where
15695        T: std::iter::IntoIterator<Item = (K, V)>,
15696        K: std::convert::Into<std::string::String>,
15697        V: std::convert::Into<std::string::String>,
15698    {
15699        use std::iter::Iterator;
15700        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15701        self
15702    }
15703}
15704
15705impl wkt::message::Message for ServiceBinding {
15706    fn typename() -> &'static str {
15707        "type.googleapis.com/google.cloud.networkservices.v1.ServiceBinding"
15708    }
15709}
15710
15711/// Request used with the ListServiceBindings method.
15712#[derive(Clone, Default, PartialEq)]
15713#[non_exhaustive]
15714pub struct ListServiceBindingsRequest {
15715    /// Required. The project and location from which the ServiceBindings should be
15716    /// listed, specified in the format `projects/*/locations/*`.
15717    pub parent: std::string::String,
15718
15719    /// Maximum number of ServiceBindings to return per call.
15720    pub page_size: i32,
15721
15722    /// The value returned by the last `ListServiceBindingsResponse`
15723    /// Indicates that this is a continuation of a prior `ListRouters` call,
15724    /// and that the system should return the next page of data.
15725    pub page_token: std::string::String,
15726
15727    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15728}
15729
15730impl ListServiceBindingsRequest {
15731    pub fn new() -> Self {
15732        std::default::Default::default()
15733    }
15734
15735    /// Sets the value of [parent][crate::model::ListServiceBindingsRequest::parent].
15736    ///
15737    /// # Example
15738    /// ```ignore,no_run
15739    /// # use google_cloud_networkservices_v1::model::ListServiceBindingsRequest;
15740    /// let x = ListServiceBindingsRequest::new().set_parent("example");
15741    /// ```
15742    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15743        self.parent = v.into();
15744        self
15745    }
15746
15747    /// Sets the value of [page_size][crate::model::ListServiceBindingsRequest::page_size].
15748    ///
15749    /// # Example
15750    /// ```ignore,no_run
15751    /// # use google_cloud_networkservices_v1::model::ListServiceBindingsRequest;
15752    /// let x = ListServiceBindingsRequest::new().set_page_size(42);
15753    /// ```
15754    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15755        self.page_size = v.into();
15756        self
15757    }
15758
15759    /// Sets the value of [page_token][crate::model::ListServiceBindingsRequest::page_token].
15760    ///
15761    /// # Example
15762    /// ```ignore,no_run
15763    /// # use google_cloud_networkservices_v1::model::ListServiceBindingsRequest;
15764    /// let x = ListServiceBindingsRequest::new().set_page_token("example");
15765    /// ```
15766    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15767        self.page_token = v.into();
15768        self
15769    }
15770}
15771
15772impl wkt::message::Message for ListServiceBindingsRequest {
15773    fn typename() -> &'static str {
15774        "type.googleapis.com/google.cloud.networkservices.v1.ListServiceBindingsRequest"
15775    }
15776}
15777
15778/// Response returned by the ListServiceBindings method.
15779#[derive(Clone, Default, PartialEq)]
15780#[non_exhaustive]
15781pub struct ListServiceBindingsResponse {
15782    /// List of ServiceBinding resources.
15783    pub service_bindings: std::vec::Vec<crate::model::ServiceBinding>,
15784
15785    /// If there might be more results than those appearing in this response, then
15786    /// `next_page_token` is included. To get the next set of results, call this
15787    /// method again using the value of `next_page_token` as `page_token`.
15788    pub next_page_token: std::string::String,
15789
15790    /// Unreachable resources. Populated when the request attempts to list all
15791    /// resources across all supported locations, while some locations are
15792    /// temporarily unavailable.
15793    pub unreachable: std::vec::Vec<std::string::String>,
15794
15795    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15796}
15797
15798impl ListServiceBindingsResponse {
15799    pub fn new() -> Self {
15800        std::default::Default::default()
15801    }
15802
15803    /// Sets the value of [service_bindings][crate::model::ListServiceBindingsResponse::service_bindings].
15804    ///
15805    /// # Example
15806    /// ```ignore,no_run
15807    /// # use google_cloud_networkservices_v1::model::ListServiceBindingsResponse;
15808    /// use google_cloud_networkservices_v1::model::ServiceBinding;
15809    /// let x = ListServiceBindingsResponse::new()
15810    ///     .set_service_bindings([
15811    ///         ServiceBinding::default()/* use setters */,
15812    ///         ServiceBinding::default()/* use (different) setters */,
15813    ///     ]);
15814    /// ```
15815    pub fn set_service_bindings<T, V>(mut self, v: T) -> Self
15816    where
15817        T: std::iter::IntoIterator<Item = V>,
15818        V: std::convert::Into<crate::model::ServiceBinding>,
15819    {
15820        use std::iter::Iterator;
15821        self.service_bindings = v.into_iter().map(|i| i.into()).collect();
15822        self
15823    }
15824
15825    /// Sets the value of [next_page_token][crate::model::ListServiceBindingsResponse::next_page_token].
15826    ///
15827    /// # Example
15828    /// ```ignore,no_run
15829    /// # use google_cloud_networkservices_v1::model::ListServiceBindingsResponse;
15830    /// let x = ListServiceBindingsResponse::new().set_next_page_token("example");
15831    /// ```
15832    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15833        self.next_page_token = v.into();
15834        self
15835    }
15836
15837    /// Sets the value of [unreachable][crate::model::ListServiceBindingsResponse::unreachable].
15838    ///
15839    /// # Example
15840    /// ```ignore,no_run
15841    /// # use google_cloud_networkservices_v1::model::ListServiceBindingsResponse;
15842    /// let x = ListServiceBindingsResponse::new().set_unreachable(["a", "b", "c"]);
15843    /// ```
15844    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
15845    where
15846        T: std::iter::IntoIterator<Item = V>,
15847        V: std::convert::Into<std::string::String>,
15848    {
15849        use std::iter::Iterator;
15850        self.unreachable = v.into_iter().map(|i| i.into()).collect();
15851        self
15852    }
15853}
15854
15855impl wkt::message::Message for ListServiceBindingsResponse {
15856    fn typename() -> &'static str {
15857        "type.googleapis.com/google.cloud.networkservices.v1.ListServiceBindingsResponse"
15858    }
15859}
15860
15861#[doc(hidden)]
15862impl google_cloud_gax::paginator::internal::PageableResponse for ListServiceBindingsResponse {
15863    type PageItem = crate::model::ServiceBinding;
15864
15865    fn items(self) -> std::vec::Vec<Self::PageItem> {
15866        self.service_bindings
15867    }
15868
15869    fn next_page_token(&self) -> std::string::String {
15870        use std::clone::Clone;
15871        self.next_page_token.clone()
15872    }
15873}
15874
15875/// Request used by the GetServiceBinding method.
15876#[derive(Clone, Default, PartialEq)]
15877#[non_exhaustive]
15878pub struct GetServiceBindingRequest {
15879    /// Required. A name of the ServiceBinding to get. Must be in the format
15880    /// `projects/*/locations/*/serviceBindings/*`.
15881    pub name: std::string::String,
15882
15883    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15884}
15885
15886impl GetServiceBindingRequest {
15887    pub fn new() -> Self {
15888        std::default::Default::default()
15889    }
15890
15891    /// Sets the value of [name][crate::model::GetServiceBindingRequest::name].
15892    ///
15893    /// # Example
15894    /// ```ignore,no_run
15895    /// # use google_cloud_networkservices_v1::model::GetServiceBindingRequest;
15896    /// let x = GetServiceBindingRequest::new().set_name("example");
15897    /// ```
15898    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15899        self.name = v.into();
15900        self
15901    }
15902}
15903
15904impl wkt::message::Message for GetServiceBindingRequest {
15905    fn typename() -> &'static str {
15906        "type.googleapis.com/google.cloud.networkservices.v1.GetServiceBindingRequest"
15907    }
15908}
15909
15910/// Request used by the ServiceBinding method.
15911#[derive(Clone, Default, PartialEq)]
15912#[non_exhaustive]
15913pub struct CreateServiceBindingRequest {
15914    /// Required. The parent resource of the ServiceBinding. Must be in the
15915    /// format `projects/*/locations/*`.
15916    pub parent: std::string::String,
15917
15918    /// Required. Short name of the ServiceBinding resource to be created.
15919    pub service_binding_id: std::string::String,
15920
15921    /// Required. ServiceBinding resource to be created.
15922    pub service_binding: std::option::Option<crate::model::ServiceBinding>,
15923
15924    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15925}
15926
15927impl CreateServiceBindingRequest {
15928    pub fn new() -> Self {
15929        std::default::Default::default()
15930    }
15931
15932    /// Sets the value of [parent][crate::model::CreateServiceBindingRequest::parent].
15933    ///
15934    /// # Example
15935    /// ```ignore,no_run
15936    /// # use google_cloud_networkservices_v1::model::CreateServiceBindingRequest;
15937    /// let x = CreateServiceBindingRequest::new().set_parent("example");
15938    /// ```
15939    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15940        self.parent = v.into();
15941        self
15942    }
15943
15944    /// Sets the value of [service_binding_id][crate::model::CreateServiceBindingRequest::service_binding_id].
15945    ///
15946    /// # Example
15947    /// ```ignore,no_run
15948    /// # use google_cloud_networkservices_v1::model::CreateServiceBindingRequest;
15949    /// let x = CreateServiceBindingRequest::new().set_service_binding_id("example");
15950    /// ```
15951    pub fn set_service_binding_id<T: std::convert::Into<std::string::String>>(
15952        mut self,
15953        v: T,
15954    ) -> Self {
15955        self.service_binding_id = v.into();
15956        self
15957    }
15958
15959    /// Sets the value of [service_binding][crate::model::CreateServiceBindingRequest::service_binding].
15960    ///
15961    /// # Example
15962    /// ```ignore,no_run
15963    /// # use google_cloud_networkservices_v1::model::CreateServiceBindingRequest;
15964    /// use google_cloud_networkservices_v1::model::ServiceBinding;
15965    /// let x = CreateServiceBindingRequest::new().set_service_binding(ServiceBinding::default()/* use setters */);
15966    /// ```
15967    pub fn set_service_binding<T>(mut self, v: T) -> Self
15968    where
15969        T: std::convert::Into<crate::model::ServiceBinding>,
15970    {
15971        self.service_binding = std::option::Option::Some(v.into());
15972        self
15973    }
15974
15975    /// Sets or clears the value of [service_binding][crate::model::CreateServiceBindingRequest::service_binding].
15976    ///
15977    /// # Example
15978    /// ```ignore,no_run
15979    /// # use google_cloud_networkservices_v1::model::CreateServiceBindingRequest;
15980    /// use google_cloud_networkservices_v1::model::ServiceBinding;
15981    /// let x = CreateServiceBindingRequest::new().set_or_clear_service_binding(Some(ServiceBinding::default()/* use setters */));
15982    /// let x = CreateServiceBindingRequest::new().set_or_clear_service_binding(None::<ServiceBinding>);
15983    /// ```
15984    pub fn set_or_clear_service_binding<T>(mut self, v: std::option::Option<T>) -> Self
15985    where
15986        T: std::convert::Into<crate::model::ServiceBinding>,
15987    {
15988        self.service_binding = v.map(|x| x.into());
15989        self
15990    }
15991}
15992
15993impl wkt::message::Message for CreateServiceBindingRequest {
15994    fn typename() -> &'static str {
15995        "type.googleapis.com/google.cloud.networkservices.v1.CreateServiceBindingRequest"
15996    }
15997}
15998
15999/// Request used by the UpdateServiceBinding method.
16000#[derive(Clone, Default, PartialEq)]
16001#[non_exhaustive]
16002pub struct UpdateServiceBindingRequest {
16003    /// Optional. Field mask is used to specify the fields to be overwritten in the
16004    /// ServiceBinding resource by the update.
16005    /// The fields specified in the update_mask are relative to the resource, not
16006    /// the full request. A field will be overwritten if it is in the mask. If the
16007    /// user does not provide a mask then all fields will be overwritten.
16008    pub update_mask: std::option::Option<wkt::FieldMask>,
16009
16010    /// Required. Updated ServiceBinding resource.
16011    pub service_binding: std::option::Option<crate::model::ServiceBinding>,
16012
16013    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16014}
16015
16016impl UpdateServiceBindingRequest {
16017    pub fn new() -> Self {
16018        std::default::Default::default()
16019    }
16020
16021    /// Sets the value of [update_mask][crate::model::UpdateServiceBindingRequest::update_mask].
16022    ///
16023    /// # Example
16024    /// ```ignore,no_run
16025    /// # use google_cloud_networkservices_v1::model::UpdateServiceBindingRequest;
16026    /// use wkt::FieldMask;
16027    /// let x = UpdateServiceBindingRequest::new().set_update_mask(FieldMask::default()/* use setters */);
16028    /// ```
16029    pub fn set_update_mask<T>(mut self, v: T) -> Self
16030    where
16031        T: std::convert::Into<wkt::FieldMask>,
16032    {
16033        self.update_mask = std::option::Option::Some(v.into());
16034        self
16035    }
16036
16037    /// Sets or clears the value of [update_mask][crate::model::UpdateServiceBindingRequest::update_mask].
16038    ///
16039    /// # Example
16040    /// ```ignore,no_run
16041    /// # use google_cloud_networkservices_v1::model::UpdateServiceBindingRequest;
16042    /// use wkt::FieldMask;
16043    /// let x = UpdateServiceBindingRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
16044    /// let x = UpdateServiceBindingRequest::new().set_or_clear_update_mask(None::<FieldMask>);
16045    /// ```
16046    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
16047    where
16048        T: std::convert::Into<wkt::FieldMask>,
16049    {
16050        self.update_mask = v.map(|x| x.into());
16051        self
16052    }
16053
16054    /// Sets the value of [service_binding][crate::model::UpdateServiceBindingRequest::service_binding].
16055    ///
16056    /// # Example
16057    /// ```ignore,no_run
16058    /// # use google_cloud_networkservices_v1::model::UpdateServiceBindingRequest;
16059    /// use google_cloud_networkservices_v1::model::ServiceBinding;
16060    /// let x = UpdateServiceBindingRequest::new().set_service_binding(ServiceBinding::default()/* use setters */);
16061    /// ```
16062    pub fn set_service_binding<T>(mut self, v: T) -> Self
16063    where
16064        T: std::convert::Into<crate::model::ServiceBinding>,
16065    {
16066        self.service_binding = std::option::Option::Some(v.into());
16067        self
16068    }
16069
16070    /// Sets or clears the value of [service_binding][crate::model::UpdateServiceBindingRequest::service_binding].
16071    ///
16072    /// # Example
16073    /// ```ignore,no_run
16074    /// # use google_cloud_networkservices_v1::model::UpdateServiceBindingRequest;
16075    /// use google_cloud_networkservices_v1::model::ServiceBinding;
16076    /// let x = UpdateServiceBindingRequest::new().set_or_clear_service_binding(Some(ServiceBinding::default()/* use setters */));
16077    /// let x = UpdateServiceBindingRequest::new().set_or_clear_service_binding(None::<ServiceBinding>);
16078    /// ```
16079    pub fn set_or_clear_service_binding<T>(mut self, v: std::option::Option<T>) -> Self
16080    where
16081        T: std::convert::Into<crate::model::ServiceBinding>,
16082    {
16083        self.service_binding = v.map(|x| x.into());
16084        self
16085    }
16086}
16087
16088impl wkt::message::Message for UpdateServiceBindingRequest {
16089    fn typename() -> &'static str {
16090        "type.googleapis.com/google.cloud.networkservices.v1.UpdateServiceBindingRequest"
16091    }
16092}
16093
16094/// Request used by the DeleteServiceBinding method.
16095#[derive(Clone, Default, PartialEq)]
16096#[non_exhaustive]
16097pub struct DeleteServiceBindingRequest {
16098    /// Required. A name of the ServiceBinding to delete. Must be in the format
16099    /// `projects/*/locations/*/serviceBindings/*`.
16100    pub name: std::string::String,
16101
16102    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16103}
16104
16105impl DeleteServiceBindingRequest {
16106    pub fn new() -> Self {
16107        std::default::Default::default()
16108    }
16109
16110    /// Sets the value of [name][crate::model::DeleteServiceBindingRequest::name].
16111    ///
16112    /// # Example
16113    /// ```ignore,no_run
16114    /// # use google_cloud_networkservices_v1::model::DeleteServiceBindingRequest;
16115    /// let x = DeleteServiceBindingRequest::new().set_name("example");
16116    /// ```
16117    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16118        self.name = v.into();
16119        self
16120    }
16121}
16122
16123impl wkt::message::Message for DeleteServiceBindingRequest {
16124    fn typename() -> &'static str {
16125        "type.googleapis.com/google.cloud.networkservices.v1.DeleteServiceBindingRequest"
16126    }
16127}
16128
16129/// ServiceLbPolicy holds global load balancing and traffic distribution
16130/// configuration that can be applied to a BackendService.
16131#[derive(Clone, Default, PartialEq)]
16132#[non_exhaustive]
16133pub struct ServiceLbPolicy {
16134    /// Identifier. Name of the ServiceLbPolicy resource. It matches pattern
16135    /// `projects/{project}/locations/{location}/serviceLbPolicies/{service_lb_policy_name}`.
16136    pub name: std::string::String,
16137
16138    /// Output only. The timestamp when this resource was created.
16139    pub create_time: std::option::Option<wkt::Timestamp>,
16140
16141    /// Output only. The timestamp when this resource was last updated.
16142    pub update_time: std::option::Option<wkt::Timestamp>,
16143
16144    /// Optional. Set of label tags associated with the ServiceLbPolicy resource.
16145    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
16146
16147    /// Optional. A free-text description of the resource. Max length 1024
16148    /// characters.
16149    pub description: std::string::String,
16150
16151    /// Optional. The type of load balancing algorithm to be used. The default
16152    /// behavior is WATERFALL_BY_REGION.
16153    pub load_balancing_algorithm: crate::model::service_lb_policy::LoadBalancingAlgorithm,
16154
16155    /// Optional. Configuration to automatically move traffic away for unhealthy
16156    /// IG/NEG for the associated Backend Service.
16157    pub auto_capacity_drain:
16158        std::option::Option<crate::model::service_lb_policy::AutoCapacityDrain>,
16159
16160    /// Optional. Configuration related to health based failover.
16161    pub failover_config: std::option::Option<crate::model::service_lb_policy::FailoverConfig>,
16162
16163    /// Optional. Configuration to provide isolation support for the associated
16164    /// Backend Service.
16165    pub isolation_config: std::option::Option<crate::model::service_lb_policy::IsolationConfig>,
16166
16167    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16168}
16169
16170impl ServiceLbPolicy {
16171    pub fn new() -> Self {
16172        std::default::Default::default()
16173    }
16174
16175    /// Sets the value of [name][crate::model::ServiceLbPolicy::name].
16176    ///
16177    /// # Example
16178    /// ```ignore,no_run
16179    /// # use google_cloud_networkservices_v1::model::ServiceLbPolicy;
16180    /// let x = ServiceLbPolicy::new().set_name("example");
16181    /// ```
16182    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16183        self.name = v.into();
16184        self
16185    }
16186
16187    /// Sets the value of [create_time][crate::model::ServiceLbPolicy::create_time].
16188    ///
16189    /// # Example
16190    /// ```ignore,no_run
16191    /// # use google_cloud_networkservices_v1::model::ServiceLbPolicy;
16192    /// use wkt::Timestamp;
16193    /// let x = ServiceLbPolicy::new().set_create_time(Timestamp::default()/* use setters */);
16194    /// ```
16195    pub fn set_create_time<T>(mut self, v: T) -> Self
16196    where
16197        T: std::convert::Into<wkt::Timestamp>,
16198    {
16199        self.create_time = std::option::Option::Some(v.into());
16200        self
16201    }
16202
16203    /// Sets or clears the value of [create_time][crate::model::ServiceLbPolicy::create_time].
16204    ///
16205    /// # Example
16206    /// ```ignore,no_run
16207    /// # use google_cloud_networkservices_v1::model::ServiceLbPolicy;
16208    /// use wkt::Timestamp;
16209    /// let x = ServiceLbPolicy::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
16210    /// let x = ServiceLbPolicy::new().set_or_clear_create_time(None::<Timestamp>);
16211    /// ```
16212    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16213    where
16214        T: std::convert::Into<wkt::Timestamp>,
16215    {
16216        self.create_time = v.map(|x| x.into());
16217        self
16218    }
16219
16220    /// Sets the value of [update_time][crate::model::ServiceLbPolicy::update_time].
16221    ///
16222    /// # Example
16223    /// ```ignore,no_run
16224    /// # use google_cloud_networkservices_v1::model::ServiceLbPolicy;
16225    /// use wkt::Timestamp;
16226    /// let x = ServiceLbPolicy::new().set_update_time(Timestamp::default()/* use setters */);
16227    /// ```
16228    pub fn set_update_time<T>(mut self, v: T) -> Self
16229    where
16230        T: std::convert::Into<wkt::Timestamp>,
16231    {
16232        self.update_time = std::option::Option::Some(v.into());
16233        self
16234    }
16235
16236    /// Sets or clears the value of [update_time][crate::model::ServiceLbPolicy::update_time].
16237    ///
16238    /// # Example
16239    /// ```ignore,no_run
16240    /// # use google_cloud_networkservices_v1::model::ServiceLbPolicy;
16241    /// use wkt::Timestamp;
16242    /// let x = ServiceLbPolicy::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
16243    /// let x = ServiceLbPolicy::new().set_or_clear_update_time(None::<Timestamp>);
16244    /// ```
16245    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
16246    where
16247        T: std::convert::Into<wkt::Timestamp>,
16248    {
16249        self.update_time = v.map(|x| x.into());
16250        self
16251    }
16252
16253    /// Sets the value of [labels][crate::model::ServiceLbPolicy::labels].
16254    ///
16255    /// # Example
16256    /// ```ignore,no_run
16257    /// # use google_cloud_networkservices_v1::model::ServiceLbPolicy;
16258    /// let x = ServiceLbPolicy::new().set_labels([
16259    ///     ("key0", "abc"),
16260    ///     ("key1", "xyz"),
16261    /// ]);
16262    /// ```
16263    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
16264    where
16265        T: std::iter::IntoIterator<Item = (K, V)>,
16266        K: std::convert::Into<std::string::String>,
16267        V: std::convert::Into<std::string::String>,
16268    {
16269        use std::iter::Iterator;
16270        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16271        self
16272    }
16273
16274    /// Sets the value of [description][crate::model::ServiceLbPolicy::description].
16275    ///
16276    /// # Example
16277    /// ```ignore,no_run
16278    /// # use google_cloud_networkservices_v1::model::ServiceLbPolicy;
16279    /// let x = ServiceLbPolicy::new().set_description("example");
16280    /// ```
16281    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16282        self.description = v.into();
16283        self
16284    }
16285
16286    /// Sets the value of [load_balancing_algorithm][crate::model::ServiceLbPolicy::load_balancing_algorithm].
16287    ///
16288    /// # Example
16289    /// ```ignore,no_run
16290    /// # use google_cloud_networkservices_v1::model::ServiceLbPolicy;
16291    /// use google_cloud_networkservices_v1::model::service_lb_policy::LoadBalancingAlgorithm;
16292    /// let x0 = ServiceLbPolicy::new().set_load_balancing_algorithm(LoadBalancingAlgorithm::SprayToWorld);
16293    /// let x1 = ServiceLbPolicy::new().set_load_balancing_algorithm(LoadBalancingAlgorithm::SprayToRegion);
16294    /// let x2 = ServiceLbPolicy::new().set_load_balancing_algorithm(LoadBalancingAlgorithm::WaterfallByRegion);
16295    /// ```
16296    pub fn set_load_balancing_algorithm<
16297        T: std::convert::Into<crate::model::service_lb_policy::LoadBalancingAlgorithm>,
16298    >(
16299        mut self,
16300        v: T,
16301    ) -> Self {
16302        self.load_balancing_algorithm = v.into();
16303        self
16304    }
16305
16306    /// Sets the value of [auto_capacity_drain][crate::model::ServiceLbPolicy::auto_capacity_drain].
16307    ///
16308    /// # Example
16309    /// ```ignore,no_run
16310    /// # use google_cloud_networkservices_v1::model::ServiceLbPolicy;
16311    /// use google_cloud_networkservices_v1::model::service_lb_policy::AutoCapacityDrain;
16312    /// let x = ServiceLbPolicy::new().set_auto_capacity_drain(AutoCapacityDrain::default()/* use setters */);
16313    /// ```
16314    pub fn set_auto_capacity_drain<T>(mut self, v: T) -> Self
16315    where
16316        T: std::convert::Into<crate::model::service_lb_policy::AutoCapacityDrain>,
16317    {
16318        self.auto_capacity_drain = std::option::Option::Some(v.into());
16319        self
16320    }
16321
16322    /// Sets or clears the value of [auto_capacity_drain][crate::model::ServiceLbPolicy::auto_capacity_drain].
16323    ///
16324    /// # Example
16325    /// ```ignore,no_run
16326    /// # use google_cloud_networkservices_v1::model::ServiceLbPolicy;
16327    /// use google_cloud_networkservices_v1::model::service_lb_policy::AutoCapacityDrain;
16328    /// let x = ServiceLbPolicy::new().set_or_clear_auto_capacity_drain(Some(AutoCapacityDrain::default()/* use setters */));
16329    /// let x = ServiceLbPolicy::new().set_or_clear_auto_capacity_drain(None::<AutoCapacityDrain>);
16330    /// ```
16331    pub fn set_or_clear_auto_capacity_drain<T>(mut self, v: std::option::Option<T>) -> Self
16332    where
16333        T: std::convert::Into<crate::model::service_lb_policy::AutoCapacityDrain>,
16334    {
16335        self.auto_capacity_drain = v.map(|x| x.into());
16336        self
16337    }
16338
16339    /// Sets the value of [failover_config][crate::model::ServiceLbPolicy::failover_config].
16340    ///
16341    /// # Example
16342    /// ```ignore,no_run
16343    /// # use google_cloud_networkservices_v1::model::ServiceLbPolicy;
16344    /// use google_cloud_networkservices_v1::model::service_lb_policy::FailoverConfig;
16345    /// let x = ServiceLbPolicy::new().set_failover_config(FailoverConfig::default()/* use setters */);
16346    /// ```
16347    pub fn set_failover_config<T>(mut self, v: T) -> Self
16348    where
16349        T: std::convert::Into<crate::model::service_lb_policy::FailoverConfig>,
16350    {
16351        self.failover_config = std::option::Option::Some(v.into());
16352        self
16353    }
16354
16355    /// Sets or clears the value of [failover_config][crate::model::ServiceLbPolicy::failover_config].
16356    ///
16357    /// # Example
16358    /// ```ignore,no_run
16359    /// # use google_cloud_networkservices_v1::model::ServiceLbPolicy;
16360    /// use google_cloud_networkservices_v1::model::service_lb_policy::FailoverConfig;
16361    /// let x = ServiceLbPolicy::new().set_or_clear_failover_config(Some(FailoverConfig::default()/* use setters */));
16362    /// let x = ServiceLbPolicy::new().set_or_clear_failover_config(None::<FailoverConfig>);
16363    /// ```
16364    pub fn set_or_clear_failover_config<T>(mut self, v: std::option::Option<T>) -> Self
16365    where
16366        T: std::convert::Into<crate::model::service_lb_policy::FailoverConfig>,
16367    {
16368        self.failover_config = v.map(|x| x.into());
16369        self
16370    }
16371
16372    /// Sets the value of [isolation_config][crate::model::ServiceLbPolicy::isolation_config].
16373    ///
16374    /// # Example
16375    /// ```ignore,no_run
16376    /// # use google_cloud_networkservices_v1::model::ServiceLbPolicy;
16377    /// use google_cloud_networkservices_v1::model::service_lb_policy::IsolationConfig;
16378    /// let x = ServiceLbPolicy::new().set_isolation_config(IsolationConfig::default()/* use setters */);
16379    /// ```
16380    pub fn set_isolation_config<T>(mut self, v: T) -> Self
16381    where
16382        T: std::convert::Into<crate::model::service_lb_policy::IsolationConfig>,
16383    {
16384        self.isolation_config = std::option::Option::Some(v.into());
16385        self
16386    }
16387
16388    /// Sets or clears the value of [isolation_config][crate::model::ServiceLbPolicy::isolation_config].
16389    ///
16390    /// # Example
16391    /// ```ignore,no_run
16392    /// # use google_cloud_networkservices_v1::model::ServiceLbPolicy;
16393    /// use google_cloud_networkservices_v1::model::service_lb_policy::IsolationConfig;
16394    /// let x = ServiceLbPolicy::new().set_or_clear_isolation_config(Some(IsolationConfig::default()/* use setters */));
16395    /// let x = ServiceLbPolicy::new().set_or_clear_isolation_config(None::<IsolationConfig>);
16396    /// ```
16397    pub fn set_or_clear_isolation_config<T>(mut self, v: std::option::Option<T>) -> Self
16398    where
16399        T: std::convert::Into<crate::model::service_lb_policy::IsolationConfig>,
16400    {
16401        self.isolation_config = v.map(|x| x.into());
16402        self
16403    }
16404}
16405
16406impl wkt::message::Message for ServiceLbPolicy {
16407    fn typename() -> &'static str {
16408        "type.googleapis.com/google.cloud.networkservices.v1.ServiceLbPolicy"
16409    }
16410}
16411
16412/// Defines additional types related to [ServiceLbPolicy].
16413pub mod service_lb_policy {
16414    #[allow(unused_imports)]
16415    use super::*;
16416
16417    /// Option to specify if an unhealthy IG/NEG should be considered for global
16418    /// load balancing and traffic routing.
16419    #[derive(Clone, Default, PartialEq)]
16420    #[non_exhaustive]
16421    pub struct AutoCapacityDrain {
16422        /// Optional. If set to 'True', an unhealthy IG/NEG will be set as drained.
16423        ///
16424        /// - An IG/NEG is considered unhealthy if less than 25% of the
16425        ///   instances/endpoints in the IG/NEG are healthy.
16426        /// - This option will never result in draining more than 50% of the
16427        ///   configured IGs/NEGs for the Backend Service.
16428        pub enable: bool,
16429
16430        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16431    }
16432
16433    impl AutoCapacityDrain {
16434        pub fn new() -> Self {
16435            std::default::Default::default()
16436        }
16437
16438        /// Sets the value of [enable][crate::model::service_lb_policy::AutoCapacityDrain::enable].
16439        ///
16440        /// # Example
16441        /// ```ignore,no_run
16442        /// # use google_cloud_networkservices_v1::model::service_lb_policy::AutoCapacityDrain;
16443        /// let x = AutoCapacityDrain::new().set_enable(true);
16444        /// ```
16445        pub fn set_enable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16446            self.enable = v.into();
16447            self
16448        }
16449    }
16450
16451    impl wkt::message::Message for AutoCapacityDrain {
16452        fn typename() -> &'static str {
16453            "type.googleapis.com/google.cloud.networkservices.v1.ServiceLbPolicy.AutoCapacityDrain"
16454        }
16455    }
16456
16457    /// Option to specify health based failover behavior.
16458    /// This is not related to Network load balancer FailoverPolicy.
16459    #[derive(Clone, Default, PartialEq)]
16460    #[non_exhaustive]
16461    pub struct FailoverConfig {
16462        /// Optional. The percentage threshold that a load balancer will begin to
16463        /// send traffic to failover backends. If the percentage of endpoints in a
16464        /// MIG/NEG is smaller than this value, traffic would be sent to failover
16465        /// backends if possible. This field should be set to a value between 1
16466        /// and 99. The default value is 50 for Global external HTTP(S) load balancer
16467        /// (classic) and Proxyless service mesh, and 70 for others.
16468        pub failover_health_threshold: i32,
16469
16470        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16471    }
16472
16473    impl FailoverConfig {
16474        pub fn new() -> Self {
16475            std::default::Default::default()
16476        }
16477
16478        /// Sets the value of [failover_health_threshold][crate::model::service_lb_policy::FailoverConfig::failover_health_threshold].
16479        ///
16480        /// # Example
16481        /// ```ignore,no_run
16482        /// # use google_cloud_networkservices_v1::model::service_lb_policy::FailoverConfig;
16483        /// let x = FailoverConfig::new().set_failover_health_threshold(42);
16484        /// ```
16485        pub fn set_failover_health_threshold<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16486            self.failover_health_threshold = v.into();
16487            self
16488        }
16489    }
16490
16491    impl wkt::message::Message for FailoverConfig {
16492        fn typename() -> &'static str {
16493            "type.googleapis.com/google.cloud.networkservices.v1.ServiceLbPolicy.FailoverConfig"
16494        }
16495    }
16496
16497    /// Configuration to provide isolation support for the associated Backend
16498    /// Service.
16499    #[derive(Clone, Default, PartialEq)]
16500    #[non_exhaustive]
16501    pub struct IsolationConfig {
16502        /// Optional. The isolation granularity of the load balancer.
16503        pub isolation_granularity: crate::model::service_lb_policy::IsolationGranularity,
16504
16505        /// Optional. The isolation mode of the load balancer.
16506        pub isolation_mode: crate::model::service_lb_policy::IsolationMode,
16507
16508        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16509    }
16510
16511    impl IsolationConfig {
16512        pub fn new() -> Self {
16513            std::default::Default::default()
16514        }
16515
16516        /// Sets the value of [isolation_granularity][crate::model::service_lb_policy::IsolationConfig::isolation_granularity].
16517        ///
16518        /// # Example
16519        /// ```ignore,no_run
16520        /// # use google_cloud_networkservices_v1::model::service_lb_policy::IsolationConfig;
16521        /// use google_cloud_networkservices_v1::model::service_lb_policy::IsolationGranularity;
16522        /// let x0 = IsolationConfig::new().set_isolation_granularity(IsolationGranularity::Region);
16523        /// ```
16524        pub fn set_isolation_granularity<
16525            T: std::convert::Into<crate::model::service_lb_policy::IsolationGranularity>,
16526        >(
16527            mut self,
16528            v: T,
16529        ) -> Self {
16530            self.isolation_granularity = v.into();
16531            self
16532        }
16533
16534        /// Sets the value of [isolation_mode][crate::model::service_lb_policy::IsolationConfig::isolation_mode].
16535        ///
16536        /// # Example
16537        /// ```ignore,no_run
16538        /// # use google_cloud_networkservices_v1::model::service_lb_policy::IsolationConfig;
16539        /// use google_cloud_networkservices_v1::model::service_lb_policy::IsolationMode;
16540        /// let x0 = IsolationConfig::new().set_isolation_mode(IsolationMode::Nearest);
16541        /// let x1 = IsolationConfig::new().set_isolation_mode(IsolationMode::Strict);
16542        /// ```
16543        pub fn set_isolation_mode<
16544            T: std::convert::Into<crate::model::service_lb_policy::IsolationMode>,
16545        >(
16546            mut self,
16547            v: T,
16548        ) -> Self {
16549            self.isolation_mode = v.into();
16550            self
16551        }
16552    }
16553
16554    impl wkt::message::Message for IsolationConfig {
16555        fn typename() -> &'static str {
16556            "type.googleapis.com/google.cloud.networkservices.v1.ServiceLbPolicy.IsolationConfig"
16557        }
16558    }
16559
16560    /// The global load balancing algorithm to be used.
16561    ///
16562    /// # Working with unknown values
16563    ///
16564    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16565    /// additional enum variants at any time. Adding new variants is not considered
16566    /// a breaking change. Applications should write their code in anticipation of:
16567    ///
16568    /// - New values appearing in future releases of the client library, **and**
16569    /// - New values received dynamically, without application changes.
16570    ///
16571    /// Please consult the [Working with enums] section in the user guide for some
16572    /// guidelines.
16573    ///
16574    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16575    #[derive(Clone, Debug, PartialEq)]
16576    #[non_exhaustive]
16577    pub enum LoadBalancingAlgorithm {
16578        /// The type of the loadbalancing algorithm is unspecified.
16579        Unspecified,
16580        /// Balance traffic across all backends across the world proportionally based
16581        /// on capacity.
16582        SprayToWorld,
16583        /// Direct traffic to the nearest region with endpoints and capacity before
16584        /// spilling over to other regions and spread the traffic from each client to
16585        /// all the MIGs/NEGs in a region.
16586        SprayToRegion,
16587        /// Direct traffic to the nearest region with endpoints and capacity before
16588        /// spilling over to other regions. All MIGs/NEGs within a region are evenly
16589        /// loaded but each client might not spread the traffic to all the MIGs/NEGs
16590        /// in the region.
16591        WaterfallByRegion,
16592        /// Attempt to keep traffic in a single zone closest to the client, before
16593        /// spilling over to other zones.
16594        WaterfallByZone,
16595        /// If set, the enum was initialized with an unknown value.
16596        ///
16597        /// Applications can examine the value using [LoadBalancingAlgorithm::value] or
16598        /// [LoadBalancingAlgorithm::name].
16599        UnknownValue(load_balancing_algorithm::UnknownValue),
16600    }
16601
16602    #[doc(hidden)]
16603    pub mod load_balancing_algorithm {
16604        #[allow(unused_imports)]
16605        use super::*;
16606        #[derive(Clone, Debug, PartialEq)]
16607        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16608    }
16609
16610    impl LoadBalancingAlgorithm {
16611        /// Gets the enum value.
16612        ///
16613        /// Returns `None` if the enum contains an unknown value deserialized from
16614        /// the string representation of enums.
16615        pub fn value(&self) -> std::option::Option<i32> {
16616            match self {
16617                Self::Unspecified => std::option::Option::Some(0),
16618                Self::SprayToWorld => std::option::Option::Some(3),
16619                Self::SprayToRegion => std::option::Option::Some(4),
16620                Self::WaterfallByRegion => std::option::Option::Some(5),
16621                Self::WaterfallByZone => std::option::Option::Some(6),
16622                Self::UnknownValue(u) => u.0.value(),
16623            }
16624        }
16625
16626        /// Gets the enum value as a string.
16627        ///
16628        /// Returns `None` if the enum contains an unknown value deserialized from
16629        /// the integer representation of enums.
16630        pub fn name(&self) -> std::option::Option<&str> {
16631            match self {
16632                Self::Unspecified => {
16633                    std::option::Option::Some("LOAD_BALANCING_ALGORITHM_UNSPECIFIED")
16634                }
16635                Self::SprayToWorld => std::option::Option::Some("SPRAY_TO_WORLD"),
16636                Self::SprayToRegion => std::option::Option::Some("SPRAY_TO_REGION"),
16637                Self::WaterfallByRegion => std::option::Option::Some("WATERFALL_BY_REGION"),
16638                Self::WaterfallByZone => std::option::Option::Some("WATERFALL_BY_ZONE"),
16639                Self::UnknownValue(u) => u.0.name(),
16640            }
16641        }
16642    }
16643
16644    impl std::default::Default for LoadBalancingAlgorithm {
16645        fn default() -> Self {
16646            use std::convert::From;
16647            Self::from(0)
16648        }
16649    }
16650
16651    impl std::fmt::Display for LoadBalancingAlgorithm {
16652        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16653            wkt::internal::display_enum(f, self.name(), self.value())
16654        }
16655    }
16656
16657    impl std::convert::From<i32> for LoadBalancingAlgorithm {
16658        fn from(value: i32) -> Self {
16659            match value {
16660                0 => Self::Unspecified,
16661                3 => Self::SprayToWorld,
16662                4 => Self::SprayToRegion,
16663                5 => Self::WaterfallByRegion,
16664                6 => Self::WaterfallByZone,
16665                _ => Self::UnknownValue(load_balancing_algorithm::UnknownValue(
16666                    wkt::internal::UnknownEnumValue::Integer(value),
16667                )),
16668            }
16669        }
16670    }
16671
16672    impl std::convert::From<&str> for LoadBalancingAlgorithm {
16673        fn from(value: &str) -> Self {
16674            use std::string::ToString;
16675            match value {
16676                "LOAD_BALANCING_ALGORITHM_UNSPECIFIED" => Self::Unspecified,
16677                "SPRAY_TO_WORLD" => Self::SprayToWorld,
16678                "SPRAY_TO_REGION" => Self::SprayToRegion,
16679                "WATERFALL_BY_REGION" => Self::WaterfallByRegion,
16680                "WATERFALL_BY_ZONE" => Self::WaterfallByZone,
16681                _ => Self::UnknownValue(load_balancing_algorithm::UnknownValue(
16682                    wkt::internal::UnknownEnumValue::String(value.to_string()),
16683                )),
16684            }
16685        }
16686    }
16687
16688    impl serde::ser::Serialize for LoadBalancingAlgorithm {
16689        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16690        where
16691            S: serde::Serializer,
16692        {
16693            match self {
16694                Self::Unspecified => serializer.serialize_i32(0),
16695                Self::SprayToWorld => serializer.serialize_i32(3),
16696                Self::SprayToRegion => serializer.serialize_i32(4),
16697                Self::WaterfallByRegion => serializer.serialize_i32(5),
16698                Self::WaterfallByZone => serializer.serialize_i32(6),
16699                Self::UnknownValue(u) => u.0.serialize(serializer),
16700            }
16701        }
16702    }
16703
16704    impl<'de> serde::de::Deserialize<'de> for LoadBalancingAlgorithm {
16705        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16706        where
16707            D: serde::Deserializer<'de>,
16708        {
16709            deserializer.deserialize_any(wkt::internal::EnumVisitor::<LoadBalancingAlgorithm>::new(
16710                ".google.cloud.networkservices.v1.ServiceLbPolicy.LoadBalancingAlgorithm",
16711            ))
16712        }
16713    }
16714
16715    /// The granularity of this isolation restriction.
16716    ///
16717    /// # Working with unknown values
16718    ///
16719    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16720    /// additional enum variants at any time. Adding new variants is not considered
16721    /// a breaking change. Applications should write their code in anticipation of:
16722    ///
16723    /// - New values appearing in future releases of the client library, **and**
16724    /// - New values received dynamically, without application changes.
16725    ///
16726    /// Please consult the [Working with enums] section in the user guide for some
16727    /// guidelines.
16728    ///
16729    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16730    #[derive(Clone, Debug, PartialEq)]
16731    #[non_exhaustive]
16732    pub enum IsolationGranularity {
16733        /// No isolation is configured for the backend service. Traffic can overflow
16734        /// based on the load balancing algorithm.
16735        Unspecified,
16736        /// Traffic for this service will be isolated at the cloud region level.
16737        Region,
16738        /// If set, the enum was initialized with an unknown value.
16739        ///
16740        /// Applications can examine the value using [IsolationGranularity::value] or
16741        /// [IsolationGranularity::name].
16742        UnknownValue(isolation_granularity::UnknownValue),
16743    }
16744
16745    #[doc(hidden)]
16746    pub mod isolation_granularity {
16747        #[allow(unused_imports)]
16748        use super::*;
16749        #[derive(Clone, Debug, PartialEq)]
16750        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16751    }
16752
16753    impl IsolationGranularity {
16754        /// Gets the enum value.
16755        ///
16756        /// Returns `None` if the enum contains an unknown value deserialized from
16757        /// the string representation of enums.
16758        pub fn value(&self) -> std::option::Option<i32> {
16759            match self {
16760                Self::Unspecified => std::option::Option::Some(0),
16761                Self::Region => std::option::Option::Some(1),
16762                Self::UnknownValue(u) => u.0.value(),
16763            }
16764        }
16765
16766        /// Gets the enum value as a string.
16767        ///
16768        /// Returns `None` if the enum contains an unknown value deserialized from
16769        /// the integer representation of enums.
16770        pub fn name(&self) -> std::option::Option<&str> {
16771            match self {
16772                Self::Unspecified => std::option::Option::Some("ISOLATION_GRANULARITY_UNSPECIFIED"),
16773                Self::Region => std::option::Option::Some("REGION"),
16774                Self::UnknownValue(u) => u.0.name(),
16775            }
16776        }
16777    }
16778
16779    impl std::default::Default for IsolationGranularity {
16780        fn default() -> Self {
16781            use std::convert::From;
16782            Self::from(0)
16783        }
16784    }
16785
16786    impl std::fmt::Display for IsolationGranularity {
16787        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16788            wkt::internal::display_enum(f, self.name(), self.value())
16789        }
16790    }
16791
16792    impl std::convert::From<i32> for IsolationGranularity {
16793        fn from(value: i32) -> Self {
16794            match value {
16795                0 => Self::Unspecified,
16796                1 => Self::Region,
16797                _ => Self::UnknownValue(isolation_granularity::UnknownValue(
16798                    wkt::internal::UnknownEnumValue::Integer(value),
16799                )),
16800            }
16801        }
16802    }
16803
16804    impl std::convert::From<&str> for IsolationGranularity {
16805        fn from(value: &str) -> Self {
16806            use std::string::ToString;
16807            match value {
16808                "ISOLATION_GRANULARITY_UNSPECIFIED" => Self::Unspecified,
16809                "REGION" => Self::Region,
16810                _ => Self::UnknownValue(isolation_granularity::UnknownValue(
16811                    wkt::internal::UnknownEnumValue::String(value.to_string()),
16812                )),
16813            }
16814        }
16815    }
16816
16817    impl serde::ser::Serialize for IsolationGranularity {
16818        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16819        where
16820            S: serde::Serializer,
16821        {
16822            match self {
16823                Self::Unspecified => serializer.serialize_i32(0),
16824                Self::Region => serializer.serialize_i32(1),
16825                Self::UnknownValue(u) => u.0.serialize(serializer),
16826            }
16827        }
16828    }
16829
16830    impl<'de> serde::de::Deserialize<'de> for IsolationGranularity {
16831        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16832        where
16833            D: serde::Deserializer<'de>,
16834        {
16835            deserializer.deserialize_any(wkt::internal::EnumVisitor::<IsolationGranularity>::new(
16836                ".google.cloud.networkservices.v1.ServiceLbPolicy.IsolationGranularity",
16837            ))
16838        }
16839    }
16840
16841    /// The mode of this isolation restriction, defining whether clients in a given
16842    /// region are allowed to reach out to another region.
16843    ///
16844    /// # Working with unknown values
16845    ///
16846    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16847    /// additional enum variants at any time. Adding new variants is not considered
16848    /// a breaking change. Applications should write their code in anticipation of:
16849    ///
16850    /// - New values appearing in future releases of the client library, **and**
16851    /// - New values received dynamically, without application changes.
16852    ///
16853    /// Please consult the [Working with enums] section in the user guide for some
16854    /// guidelines.
16855    ///
16856    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16857    #[derive(Clone, Debug, PartialEq)]
16858    #[non_exhaustive]
16859    pub enum IsolationMode {
16860        /// No isolation mode is configured for the backend service.
16861        Unspecified,
16862        /// Traffic will be sent to the nearest region.
16863        Nearest,
16864        /// Traffic will fail if no serving backends are available in the same region
16865        /// as the load balancer.
16866        Strict,
16867        /// If set, the enum was initialized with an unknown value.
16868        ///
16869        /// Applications can examine the value using [IsolationMode::value] or
16870        /// [IsolationMode::name].
16871        UnknownValue(isolation_mode::UnknownValue),
16872    }
16873
16874    #[doc(hidden)]
16875    pub mod isolation_mode {
16876        #[allow(unused_imports)]
16877        use super::*;
16878        #[derive(Clone, Debug, PartialEq)]
16879        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16880    }
16881
16882    impl IsolationMode {
16883        /// Gets the enum value.
16884        ///
16885        /// Returns `None` if the enum contains an unknown value deserialized from
16886        /// the string representation of enums.
16887        pub fn value(&self) -> std::option::Option<i32> {
16888            match self {
16889                Self::Unspecified => std::option::Option::Some(0),
16890                Self::Nearest => std::option::Option::Some(1),
16891                Self::Strict => std::option::Option::Some(2),
16892                Self::UnknownValue(u) => u.0.value(),
16893            }
16894        }
16895
16896        /// Gets the enum value as a string.
16897        ///
16898        /// Returns `None` if the enum contains an unknown value deserialized from
16899        /// the integer representation of enums.
16900        pub fn name(&self) -> std::option::Option<&str> {
16901            match self {
16902                Self::Unspecified => std::option::Option::Some("ISOLATION_MODE_UNSPECIFIED"),
16903                Self::Nearest => std::option::Option::Some("NEAREST"),
16904                Self::Strict => std::option::Option::Some("STRICT"),
16905                Self::UnknownValue(u) => u.0.name(),
16906            }
16907        }
16908    }
16909
16910    impl std::default::Default for IsolationMode {
16911        fn default() -> Self {
16912            use std::convert::From;
16913            Self::from(0)
16914        }
16915    }
16916
16917    impl std::fmt::Display for IsolationMode {
16918        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16919            wkt::internal::display_enum(f, self.name(), self.value())
16920        }
16921    }
16922
16923    impl std::convert::From<i32> for IsolationMode {
16924        fn from(value: i32) -> Self {
16925            match value {
16926                0 => Self::Unspecified,
16927                1 => Self::Nearest,
16928                2 => Self::Strict,
16929                _ => Self::UnknownValue(isolation_mode::UnknownValue(
16930                    wkt::internal::UnknownEnumValue::Integer(value),
16931                )),
16932            }
16933        }
16934    }
16935
16936    impl std::convert::From<&str> for IsolationMode {
16937        fn from(value: &str) -> Self {
16938            use std::string::ToString;
16939            match value {
16940                "ISOLATION_MODE_UNSPECIFIED" => Self::Unspecified,
16941                "NEAREST" => Self::Nearest,
16942                "STRICT" => Self::Strict,
16943                _ => Self::UnknownValue(isolation_mode::UnknownValue(
16944                    wkt::internal::UnknownEnumValue::String(value.to_string()),
16945                )),
16946            }
16947        }
16948    }
16949
16950    impl serde::ser::Serialize for IsolationMode {
16951        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16952        where
16953            S: serde::Serializer,
16954        {
16955            match self {
16956                Self::Unspecified => serializer.serialize_i32(0),
16957                Self::Nearest => serializer.serialize_i32(1),
16958                Self::Strict => serializer.serialize_i32(2),
16959                Self::UnknownValue(u) => u.0.serialize(serializer),
16960            }
16961        }
16962    }
16963
16964    impl<'de> serde::de::Deserialize<'de> for IsolationMode {
16965        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16966        where
16967            D: serde::Deserializer<'de>,
16968        {
16969            deserializer.deserialize_any(wkt::internal::EnumVisitor::<IsolationMode>::new(
16970                ".google.cloud.networkservices.v1.ServiceLbPolicy.IsolationMode",
16971            ))
16972        }
16973    }
16974}
16975
16976/// Request used with the ListServiceLbPolicies method.
16977#[derive(Clone, Default, PartialEq)]
16978#[non_exhaustive]
16979pub struct ListServiceLbPoliciesRequest {
16980    /// Required. The project and location from which the ServiceLbPolicies should
16981    /// be listed, specified in the format
16982    /// `projects/{project}/locations/{location}`.
16983    pub parent: std::string::String,
16984
16985    /// Maximum number of ServiceLbPolicies to return per call.
16986    pub page_size: i32,
16987
16988    /// The value returned by the last `ListServiceLbPoliciesResponse`
16989    /// Indicates that this is a continuation of a prior `ListRouters` call,
16990    /// and that the system should return the next page of data.
16991    pub page_token: std::string::String,
16992
16993    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16994}
16995
16996impl ListServiceLbPoliciesRequest {
16997    pub fn new() -> Self {
16998        std::default::Default::default()
16999    }
17000
17001    /// Sets the value of [parent][crate::model::ListServiceLbPoliciesRequest::parent].
17002    ///
17003    /// # Example
17004    /// ```ignore,no_run
17005    /// # use google_cloud_networkservices_v1::model::ListServiceLbPoliciesRequest;
17006    /// let x = ListServiceLbPoliciesRequest::new().set_parent("example");
17007    /// ```
17008    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17009        self.parent = v.into();
17010        self
17011    }
17012
17013    /// Sets the value of [page_size][crate::model::ListServiceLbPoliciesRequest::page_size].
17014    ///
17015    /// # Example
17016    /// ```ignore,no_run
17017    /// # use google_cloud_networkservices_v1::model::ListServiceLbPoliciesRequest;
17018    /// let x = ListServiceLbPoliciesRequest::new().set_page_size(42);
17019    /// ```
17020    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17021        self.page_size = v.into();
17022        self
17023    }
17024
17025    /// Sets the value of [page_token][crate::model::ListServiceLbPoliciesRequest::page_token].
17026    ///
17027    /// # Example
17028    /// ```ignore,no_run
17029    /// # use google_cloud_networkservices_v1::model::ListServiceLbPoliciesRequest;
17030    /// let x = ListServiceLbPoliciesRequest::new().set_page_token("example");
17031    /// ```
17032    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17033        self.page_token = v.into();
17034        self
17035    }
17036}
17037
17038impl wkt::message::Message for ListServiceLbPoliciesRequest {
17039    fn typename() -> &'static str {
17040        "type.googleapis.com/google.cloud.networkservices.v1.ListServiceLbPoliciesRequest"
17041    }
17042}
17043
17044/// Response returned by the ListServiceLbPolicies method.
17045#[derive(Clone, Default, PartialEq)]
17046#[non_exhaustive]
17047pub struct ListServiceLbPoliciesResponse {
17048    /// List of ServiceLbPolicy resources.
17049    pub service_lb_policies: std::vec::Vec<crate::model::ServiceLbPolicy>,
17050
17051    /// If there might be more results than those appearing in this response, then
17052    /// `next_page_token` is included. To get the next set of results, call this
17053    /// method again using the value of `next_page_token` as `page_token`.
17054    pub next_page_token: std::string::String,
17055
17056    /// Unreachable resources. Populated when the request attempts to list all
17057    /// resources across all supported locations, while some locations are
17058    /// temporarily unavailable.
17059    pub unreachable: std::vec::Vec<std::string::String>,
17060
17061    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17062}
17063
17064impl ListServiceLbPoliciesResponse {
17065    pub fn new() -> Self {
17066        std::default::Default::default()
17067    }
17068
17069    /// Sets the value of [service_lb_policies][crate::model::ListServiceLbPoliciesResponse::service_lb_policies].
17070    ///
17071    /// # Example
17072    /// ```ignore,no_run
17073    /// # use google_cloud_networkservices_v1::model::ListServiceLbPoliciesResponse;
17074    /// use google_cloud_networkservices_v1::model::ServiceLbPolicy;
17075    /// let x = ListServiceLbPoliciesResponse::new()
17076    ///     .set_service_lb_policies([
17077    ///         ServiceLbPolicy::default()/* use setters */,
17078    ///         ServiceLbPolicy::default()/* use (different) setters */,
17079    ///     ]);
17080    /// ```
17081    pub fn set_service_lb_policies<T, V>(mut self, v: T) -> Self
17082    where
17083        T: std::iter::IntoIterator<Item = V>,
17084        V: std::convert::Into<crate::model::ServiceLbPolicy>,
17085    {
17086        use std::iter::Iterator;
17087        self.service_lb_policies = v.into_iter().map(|i| i.into()).collect();
17088        self
17089    }
17090
17091    /// Sets the value of [next_page_token][crate::model::ListServiceLbPoliciesResponse::next_page_token].
17092    ///
17093    /// # Example
17094    /// ```ignore,no_run
17095    /// # use google_cloud_networkservices_v1::model::ListServiceLbPoliciesResponse;
17096    /// let x = ListServiceLbPoliciesResponse::new().set_next_page_token("example");
17097    /// ```
17098    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17099        self.next_page_token = v.into();
17100        self
17101    }
17102
17103    /// Sets the value of [unreachable][crate::model::ListServiceLbPoliciesResponse::unreachable].
17104    ///
17105    /// # Example
17106    /// ```ignore,no_run
17107    /// # use google_cloud_networkservices_v1::model::ListServiceLbPoliciesResponse;
17108    /// let x = ListServiceLbPoliciesResponse::new().set_unreachable(["a", "b", "c"]);
17109    /// ```
17110    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
17111    where
17112        T: std::iter::IntoIterator<Item = V>,
17113        V: std::convert::Into<std::string::String>,
17114    {
17115        use std::iter::Iterator;
17116        self.unreachable = v.into_iter().map(|i| i.into()).collect();
17117        self
17118    }
17119}
17120
17121impl wkt::message::Message for ListServiceLbPoliciesResponse {
17122    fn typename() -> &'static str {
17123        "type.googleapis.com/google.cloud.networkservices.v1.ListServiceLbPoliciesResponse"
17124    }
17125}
17126
17127#[doc(hidden)]
17128impl google_cloud_gax::paginator::internal::PageableResponse for ListServiceLbPoliciesResponse {
17129    type PageItem = crate::model::ServiceLbPolicy;
17130
17131    fn items(self) -> std::vec::Vec<Self::PageItem> {
17132        self.service_lb_policies
17133    }
17134
17135    fn next_page_token(&self) -> std::string::String {
17136        use std::clone::Clone;
17137        self.next_page_token.clone()
17138    }
17139}
17140
17141/// Request used by the GetServiceLbPolicy method.
17142#[derive(Clone, Default, PartialEq)]
17143#[non_exhaustive]
17144pub struct GetServiceLbPolicyRequest {
17145    /// Required. A name of the ServiceLbPolicy to get. Must be in the format
17146    /// `projects/{project}/locations/{location}/serviceLbPolicies/*`.
17147    pub name: std::string::String,
17148
17149    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17150}
17151
17152impl GetServiceLbPolicyRequest {
17153    pub fn new() -> Self {
17154        std::default::Default::default()
17155    }
17156
17157    /// Sets the value of [name][crate::model::GetServiceLbPolicyRequest::name].
17158    ///
17159    /// # Example
17160    /// ```ignore,no_run
17161    /// # use google_cloud_networkservices_v1::model::GetServiceLbPolicyRequest;
17162    /// let x = GetServiceLbPolicyRequest::new().set_name("example");
17163    /// ```
17164    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17165        self.name = v.into();
17166        self
17167    }
17168}
17169
17170impl wkt::message::Message for GetServiceLbPolicyRequest {
17171    fn typename() -> &'static str {
17172        "type.googleapis.com/google.cloud.networkservices.v1.GetServiceLbPolicyRequest"
17173    }
17174}
17175
17176/// Request used by the ServiceLbPolicy method.
17177#[derive(Clone, Default, PartialEq)]
17178#[non_exhaustive]
17179pub struct CreateServiceLbPolicyRequest {
17180    /// Required. The parent resource of the ServiceLbPolicy. Must be in the
17181    /// format `projects/{project}/locations/{location}`.
17182    pub parent: std::string::String,
17183
17184    /// Required. Short name of the ServiceLbPolicy resource to be created.
17185    /// E.g. for resource name
17186    /// `projects/{project}/locations/{location}/serviceLbPolicies/{service_lb_policy_name}`.
17187    /// the id is value of {service_lb_policy_name}
17188    pub service_lb_policy_id: std::string::String,
17189
17190    /// Required. ServiceLbPolicy resource to be created.
17191    pub service_lb_policy: std::option::Option<crate::model::ServiceLbPolicy>,
17192
17193    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17194}
17195
17196impl CreateServiceLbPolicyRequest {
17197    pub fn new() -> Self {
17198        std::default::Default::default()
17199    }
17200
17201    /// Sets the value of [parent][crate::model::CreateServiceLbPolicyRequest::parent].
17202    ///
17203    /// # Example
17204    /// ```ignore,no_run
17205    /// # use google_cloud_networkservices_v1::model::CreateServiceLbPolicyRequest;
17206    /// let x = CreateServiceLbPolicyRequest::new().set_parent("example");
17207    /// ```
17208    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17209        self.parent = v.into();
17210        self
17211    }
17212
17213    /// Sets the value of [service_lb_policy_id][crate::model::CreateServiceLbPolicyRequest::service_lb_policy_id].
17214    ///
17215    /// # Example
17216    /// ```ignore,no_run
17217    /// # use google_cloud_networkservices_v1::model::CreateServiceLbPolicyRequest;
17218    /// let x = CreateServiceLbPolicyRequest::new().set_service_lb_policy_id("example");
17219    /// ```
17220    pub fn set_service_lb_policy_id<T: std::convert::Into<std::string::String>>(
17221        mut self,
17222        v: T,
17223    ) -> Self {
17224        self.service_lb_policy_id = v.into();
17225        self
17226    }
17227
17228    /// Sets the value of [service_lb_policy][crate::model::CreateServiceLbPolicyRequest::service_lb_policy].
17229    ///
17230    /// # Example
17231    /// ```ignore,no_run
17232    /// # use google_cloud_networkservices_v1::model::CreateServiceLbPolicyRequest;
17233    /// use google_cloud_networkservices_v1::model::ServiceLbPolicy;
17234    /// let x = CreateServiceLbPolicyRequest::new().set_service_lb_policy(ServiceLbPolicy::default()/* use setters */);
17235    /// ```
17236    pub fn set_service_lb_policy<T>(mut self, v: T) -> Self
17237    where
17238        T: std::convert::Into<crate::model::ServiceLbPolicy>,
17239    {
17240        self.service_lb_policy = std::option::Option::Some(v.into());
17241        self
17242    }
17243
17244    /// Sets or clears the value of [service_lb_policy][crate::model::CreateServiceLbPolicyRequest::service_lb_policy].
17245    ///
17246    /// # Example
17247    /// ```ignore,no_run
17248    /// # use google_cloud_networkservices_v1::model::CreateServiceLbPolicyRequest;
17249    /// use google_cloud_networkservices_v1::model::ServiceLbPolicy;
17250    /// let x = CreateServiceLbPolicyRequest::new().set_or_clear_service_lb_policy(Some(ServiceLbPolicy::default()/* use setters */));
17251    /// let x = CreateServiceLbPolicyRequest::new().set_or_clear_service_lb_policy(None::<ServiceLbPolicy>);
17252    /// ```
17253    pub fn set_or_clear_service_lb_policy<T>(mut self, v: std::option::Option<T>) -> Self
17254    where
17255        T: std::convert::Into<crate::model::ServiceLbPolicy>,
17256    {
17257        self.service_lb_policy = v.map(|x| x.into());
17258        self
17259    }
17260}
17261
17262impl wkt::message::Message for CreateServiceLbPolicyRequest {
17263    fn typename() -> &'static str {
17264        "type.googleapis.com/google.cloud.networkservices.v1.CreateServiceLbPolicyRequest"
17265    }
17266}
17267
17268/// Request used by the UpdateServiceLbPolicy method.
17269#[derive(Clone, Default, PartialEq)]
17270#[non_exhaustive]
17271pub struct UpdateServiceLbPolicyRequest {
17272    /// Optional. Field mask is used to specify the fields to be overwritten in the
17273    /// ServiceLbPolicy resource by the update.
17274    /// The fields specified in the update_mask are relative to the resource, not
17275    /// the full request. A field will be overwritten if it is in the mask. If the
17276    /// user does not provide a mask then all fields will be overwritten.
17277    pub update_mask: std::option::Option<wkt::FieldMask>,
17278
17279    /// Required. Updated ServiceLbPolicy resource.
17280    pub service_lb_policy: std::option::Option<crate::model::ServiceLbPolicy>,
17281
17282    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17283}
17284
17285impl UpdateServiceLbPolicyRequest {
17286    pub fn new() -> Self {
17287        std::default::Default::default()
17288    }
17289
17290    /// Sets the value of [update_mask][crate::model::UpdateServiceLbPolicyRequest::update_mask].
17291    ///
17292    /// # Example
17293    /// ```ignore,no_run
17294    /// # use google_cloud_networkservices_v1::model::UpdateServiceLbPolicyRequest;
17295    /// use wkt::FieldMask;
17296    /// let x = UpdateServiceLbPolicyRequest::new().set_update_mask(FieldMask::default()/* use setters */);
17297    /// ```
17298    pub fn set_update_mask<T>(mut self, v: T) -> Self
17299    where
17300        T: std::convert::Into<wkt::FieldMask>,
17301    {
17302        self.update_mask = std::option::Option::Some(v.into());
17303        self
17304    }
17305
17306    /// Sets or clears the value of [update_mask][crate::model::UpdateServiceLbPolicyRequest::update_mask].
17307    ///
17308    /// # Example
17309    /// ```ignore,no_run
17310    /// # use google_cloud_networkservices_v1::model::UpdateServiceLbPolicyRequest;
17311    /// use wkt::FieldMask;
17312    /// let x = UpdateServiceLbPolicyRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
17313    /// let x = UpdateServiceLbPolicyRequest::new().set_or_clear_update_mask(None::<FieldMask>);
17314    /// ```
17315    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
17316    where
17317        T: std::convert::Into<wkt::FieldMask>,
17318    {
17319        self.update_mask = v.map(|x| x.into());
17320        self
17321    }
17322
17323    /// Sets the value of [service_lb_policy][crate::model::UpdateServiceLbPolicyRequest::service_lb_policy].
17324    ///
17325    /// # Example
17326    /// ```ignore,no_run
17327    /// # use google_cloud_networkservices_v1::model::UpdateServiceLbPolicyRequest;
17328    /// use google_cloud_networkservices_v1::model::ServiceLbPolicy;
17329    /// let x = UpdateServiceLbPolicyRequest::new().set_service_lb_policy(ServiceLbPolicy::default()/* use setters */);
17330    /// ```
17331    pub fn set_service_lb_policy<T>(mut self, v: T) -> Self
17332    where
17333        T: std::convert::Into<crate::model::ServiceLbPolicy>,
17334    {
17335        self.service_lb_policy = std::option::Option::Some(v.into());
17336        self
17337    }
17338
17339    /// Sets or clears the value of [service_lb_policy][crate::model::UpdateServiceLbPolicyRequest::service_lb_policy].
17340    ///
17341    /// # Example
17342    /// ```ignore,no_run
17343    /// # use google_cloud_networkservices_v1::model::UpdateServiceLbPolicyRequest;
17344    /// use google_cloud_networkservices_v1::model::ServiceLbPolicy;
17345    /// let x = UpdateServiceLbPolicyRequest::new().set_or_clear_service_lb_policy(Some(ServiceLbPolicy::default()/* use setters */));
17346    /// let x = UpdateServiceLbPolicyRequest::new().set_or_clear_service_lb_policy(None::<ServiceLbPolicy>);
17347    /// ```
17348    pub fn set_or_clear_service_lb_policy<T>(mut self, v: std::option::Option<T>) -> Self
17349    where
17350        T: std::convert::Into<crate::model::ServiceLbPolicy>,
17351    {
17352        self.service_lb_policy = v.map(|x| x.into());
17353        self
17354    }
17355}
17356
17357impl wkt::message::Message for UpdateServiceLbPolicyRequest {
17358    fn typename() -> &'static str {
17359        "type.googleapis.com/google.cloud.networkservices.v1.UpdateServiceLbPolicyRequest"
17360    }
17361}
17362
17363/// Request used by the DeleteServiceLbPolicy method.
17364#[derive(Clone, Default, PartialEq)]
17365#[non_exhaustive]
17366pub struct DeleteServiceLbPolicyRequest {
17367    /// Required. A name of the ServiceLbPolicy to delete. Must be in the format
17368    /// `projects/{project}/locations/{location}/serviceLbPolicies/*`.
17369    pub name: std::string::String,
17370
17371    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17372}
17373
17374impl DeleteServiceLbPolicyRequest {
17375    pub fn new() -> Self {
17376        std::default::Default::default()
17377    }
17378
17379    /// Sets the value of [name][crate::model::DeleteServiceLbPolicyRequest::name].
17380    ///
17381    /// # Example
17382    /// ```ignore,no_run
17383    /// # use google_cloud_networkservices_v1::model::DeleteServiceLbPolicyRequest;
17384    /// let x = DeleteServiceLbPolicyRequest::new().set_name("example");
17385    /// ```
17386    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17387        self.name = v.into();
17388        self
17389    }
17390}
17391
17392impl wkt::message::Message for DeleteServiceLbPolicyRequest {
17393    fn typename() -> &'static str {
17394        "type.googleapis.com/google.cloud.networkservices.v1.DeleteServiceLbPolicyRequest"
17395    }
17396}
17397
17398/// TcpRoute is the resource defining how TCP traffic should be routed by a
17399/// Mesh/Gateway resource.
17400#[derive(Clone, Default, PartialEq)]
17401#[non_exhaustive]
17402pub struct TcpRoute {
17403    /// Identifier. Name of the TcpRoute resource. It matches pattern
17404    /// `projects/*/locations/global/tcpRoutes/tcp_route_name>`.
17405    pub name: std::string::String,
17406
17407    /// Output only. Server-defined URL of this resource
17408    pub self_link: std::string::String,
17409
17410    /// Output only. The timestamp when the resource was created.
17411    pub create_time: std::option::Option<wkt::Timestamp>,
17412
17413    /// Output only. The timestamp when the resource was updated.
17414    pub update_time: std::option::Option<wkt::Timestamp>,
17415
17416    /// Optional. A free-text description of the resource. Max length 1024
17417    /// characters.
17418    pub description: std::string::String,
17419
17420    /// Required. Rules that define how traffic is routed and handled. At least one
17421    /// RouteRule must be supplied. If there are multiple rules then the action
17422    /// taken will be the first rule to match.
17423    pub rules: std::vec::Vec<crate::model::tcp_route::RouteRule>,
17424
17425    /// Optional. Meshes defines a list of meshes this TcpRoute is attached to, as
17426    /// one of the routing rules to route the requests served by the mesh.
17427    ///
17428    /// Each mesh reference should match the pattern:
17429    /// `projects/*/locations/global/meshes/<mesh_name>`
17430    ///
17431    /// The attached Mesh should be of a type SIDECAR
17432    pub meshes: std::vec::Vec<std::string::String>,
17433
17434    /// Optional. Gateways defines a list of gateways this TcpRoute is attached to,
17435    /// as one of the routing rules to route the requests served by the gateway.
17436    ///
17437    /// Each gateway reference should match the pattern:
17438    /// `projects/*/locations/global/gateways/<gateway_name>`
17439    pub gateways: std::vec::Vec<std::string::String>,
17440
17441    /// Optional. Set of label tags associated with the TcpRoute resource.
17442    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
17443
17444    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17445}
17446
17447impl TcpRoute {
17448    pub fn new() -> Self {
17449        std::default::Default::default()
17450    }
17451
17452    /// Sets the value of [name][crate::model::TcpRoute::name].
17453    ///
17454    /// # Example
17455    /// ```ignore,no_run
17456    /// # use google_cloud_networkservices_v1::model::TcpRoute;
17457    /// let x = TcpRoute::new().set_name("example");
17458    /// ```
17459    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17460        self.name = v.into();
17461        self
17462    }
17463
17464    /// Sets the value of [self_link][crate::model::TcpRoute::self_link].
17465    ///
17466    /// # Example
17467    /// ```ignore,no_run
17468    /// # use google_cloud_networkservices_v1::model::TcpRoute;
17469    /// let x = TcpRoute::new().set_self_link("example");
17470    /// ```
17471    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17472        self.self_link = v.into();
17473        self
17474    }
17475
17476    /// Sets the value of [create_time][crate::model::TcpRoute::create_time].
17477    ///
17478    /// # Example
17479    /// ```ignore,no_run
17480    /// # use google_cloud_networkservices_v1::model::TcpRoute;
17481    /// use wkt::Timestamp;
17482    /// let x = TcpRoute::new().set_create_time(Timestamp::default()/* use setters */);
17483    /// ```
17484    pub fn set_create_time<T>(mut self, v: T) -> Self
17485    where
17486        T: std::convert::Into<wkt::Timestamp>,
17487    {
17488        self.create_time = std::option::Option::Some(v.into());
17489        self
17490    }
17491
17492    /// Sets or clears the value of [create_time][crate::model::TcpRoute::create_time].
17493    ///
17494    /// # Example
17495    /// ```ignore,no_run
17496    /// # use google_cloud_networkservices_v1::model::TcpRoute;
17497    /// use wkt::Timestamp;
17498    /// let x = TcpRoute::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
17499    /// let x = TcpRoute::new().set_or_clear_create_time(None::<Timestamp>);
17500    /// ```
17501    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
17502    where
17503        T: std::convert::Into<wkt::Timestamp>,
17504    {
17505        self.create_time = v.map(|x| x.into());
17506        self
17507    }
17508
17509    /// Sets the value of [update_time][crate::model::TcpRoute::update_time].
17510    ///
17511    /// # Example
17512    /// ```ignore,no_run
17513    /// # use google_cloud_networkservices_v1::model::TcpRoute;
17514    /// use wkt::Timestamp;
17515    /// let x = TcpRoute::new().set_update_time(Timestamp::default()/* use setters */);
17516    /// ```
17517    pub fn set_update_time<T>(mut self, v: T) -> Self
17518    where
17519        T: std::convert::Into<wkt::Timestamp>,
17520    {
17521        self.update_time = std::option::Option::Some(v.into());
17522        self
17523    }
17524
17525    /// Sets or clears the value of [update_time][crate::model::TcpRoute::update_time].
17526    ///
17527    /// # Example
17528    /// ```ignore,no_run
17529    /// # use google_cloud_networkservices_v1::model::TcpRoute;
17530    /// use wkt::Timestamp;
17531    /// let x = TcpRoute::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
17532    /// let x = TcpRoute::new().set_or_clear_update_time(None::<Timestamp>);
17533    /// ```
17534    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
17535    where
17536        T: std::convert::Into<wkt::Timestamp>,
17537    {
17538        self.update_time = v.map(|x| x.into());
17539        self
17540    }
17541
17542    /// Sets the value of [description][crate::model::TcpRoute::description].
17543    ///
17544    /// # Example
17545    /// ```ignore,no_run
17546    /// # use google_cloud_networkservices_v1::model::TcpRoute;
17547    /// let x = TcpRoute::new().set_description("example");
17548    /// ```
17549    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17550        self.description = v.into();
17551        self
17552    }
17553
17554    /// Sets the value of [rules][crate::model::TcpRoute::rules].
17555    ///
17556    /// # Example
17557    /// ```ignore,no_run
17558    /// # use google_cloud_networkservices_v1::model::TcpRoute;
17559    /// use google_cloud_networkservices_v1::model::tcp_route::RouteRule;
17560    /// let x = TcpRoute::new()
17561    ///     .set_rules([
17562    ///         RouteRule::default()/* use setters */,
17563    ///         RouteRule::default()/* use (different) setters */,
17564    ///     ]);
17565    /// ```
17566    pub fn set_rules<T, V>(mut self, v: T) -> Self
17567    where
17568        T: std::iter::IntoIterator<Item = V>,
17569        V: std::convert::Into<crate::model::tcp_route::RouteRule>,
17570    {
17571        use std::iter::Iterator;
17572        self.rules = v.into_iter().map(|i| i.into()).collect();
17573        self
17574    }
17575
17576    /// Sets the value of [meshes][crate::model::TcpRoute::meshes].
17577    ///
17578    /// # Example
17579    /// ```ignore,no_run
17580    /// # use google_cloud_networkservices_v1::model::TcpRoute;
17581    /// let x = TcpRoute::new().set_meshes(["a", "b", "c"]);
17582    /// ```
17583    pub fn set_meshes<T, V>(mut self, v: T) -> Self
17584    where
17585        T: std::iter::IntoIterator<Item = V>,
17586        V: std::convert::Into<std::string::String>,
17587    {
17588        use std::iter::Iterator;
17589        self.meshes = v.into_iter().map(|i| i.into()).collect();
17590        self
17591    }
17592
17593    /// Sets the value of [gateways][crate::model::TcpRoute::gateways].
17594    ///
17595    /// # Example
17596    /// ```ignore,no_run
17597    /// # use google_cloud_networkservices_v1::model::TcpRoute;
17598    /// let x = TcpRoute::new().set_gateways(["a", "b", "c"]);
17599    /// ```
17600    pub fn set_gateways<T, V>(mut self, v: T) -> Self
17601    where
17602        T: std::iter::IntoIterator<Item = V>,
17603        V: std::convert::Into<std::string::String>,
17604    {
17605        use std::iter::Iterator;
17606        self.gateways = v.into_iter().map(|i| i.into()).collect();
17607        self
17608    }
17609
17610    /// Sets the value of [labels][crate::model::TcpRoute::labels].
17611    ///
17612    /// # Example
17613    /// ```ignore,no_run
17614    /// # use google_cloud_networkservices_v1::model::TcpRoute;
17615    /// let x = TcpRoute::new().set_labels([
17616    ///     ("key0", "abc"),
17617    ///     ("key1", "xyz"),
17618    /// ]);
17619    /// ```
17620    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
17621    where
17622        T: std::iter::IntoIterator<Item = (K, V)>,
17623        K: std::convert::Into<std::string::String>,
17624        V: std::convert::Into<std::string::String>,
17625    {
17626        use std::iter::Iterator;
17627        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
17628        self
17629    }
17630}
17631
17632impl wkt::message::Message for TcpRoute {
17633    fn typename() -> &'static str {
17634        "type.googleapis.com/google.cloud.networkservices.v1.TcpRoute"
17635    }
17636}
17637
17638/// Defines additional types related to [TcpRoute].
17639pub mod tcp_route {
17640    #[allow(unused_imports)]
17641    use super::*;
17642
17643    /// Specifies how to match traffic and how to route traffic when traffic is
17644    /// matched.
17645    #[derive(Clone, Default, PartialEq)]
17646    #[non_exhaustive]
17647    pub struct RouteRule {
17648        /// Optional. RouteMatch defines the predicate used to match requests to a
17649        /// given action. Multiple match types are "OR"ed for evaluation. If no
17650        /// routeMatch field is specified, this rule will unconditionally match
17651        /// traffic.
17652        pub matches: std::vec::Vec<crate::model::tcp_route::RouteMatch>,
17653
17654        /// Required. The detailed rule defining how to route matched traffic.
17655        pub action: std::option::Option<crate::model::tcp_route::RouteAction>,
17656
17657        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17658    }
17659
17660    impl RouteRule {
17661        pub fn new() -> Self {
17662            std::default::Default::default()
17663        }
17664
17665        /// Sets the value of [matches][crate::model::tcp_route::RouteRule::matches].
17666        ///
17667        /// # Example
17668        /// ```ignore,no_run
17669        /// # use google_cloud_networkservices_v1::model::tcp_route::RouteRule;
17670        /// use google_cloud_networkservices_v1::model::tcp_route::RouteMatch;
17671        /// let x = RouteRule::new()
17672        ///     .set_matches([
17673        ///         RouteMatch::default()/* use setters */,
17674        ///         RouteMatch::default()/* use (different) setters */,
17675        ///     ]);
17676        /// ```
17677        pub fn set_matches<T, V>(mut self, v: T) -> Self
17678        where
17679            T: std::iter::IntoIterator<Item = V>,
17680            V: std::convert::Into<crate::model::tcp_route::RouteMatch>,
17681        {
17682            use std::iter::Iterator;
17683            self.matches = v.into_iter().map(|i| i.into()).collect();
17684            self
17685        }
17686
17687        /// Sets the value of [action][crate::model::tcp_route::RouteRule::action].
17688        ///
17689        /// # Example
17690        /// ```ignore,no_run
17691        /// # use google_cloud_networkservices_v1::model::tcp_route::RouteRule;
17692        /// use google_cloud_networkservices_v1::model::tcp_route::RouteAction;
17693        /// let x = RouteRule::new().set_action(RouteAction::default()/* use setters */);
17694        /// ```
17695        pub fn set_action<T>(mut self, v: T) -> Self
17696        where
17697            T: std::convert::Into<crate::model::tcp_route::RouteAction>,
17698        {
17699            self.action = std::option::Option::Some(v.into());
17700            self
17701        }
17702
17703        /// Sets or clears the value of [action][crate::model::tcp_route::RouteRule::action].
17704        ///
17705        /// # Example
17706        /// ```ignore,no_run
17707        /// # use google_cloud_networkservices_v1::model::tcp_route::RouteRule;
17708        /// use google_cloud_networkservices_v1::model::tcp_route::RouteAction;
17709        /// let x = RouteRule::new().set_or_clear_action(Some(RouteAction::default()/* use setters */));
17710        /// let x = RouteRule::new().set_or_clear_action(None::<RouteAction>);
17711        /// ```
17712        pub fn set_or_clear_action<T>(mut self, v: std::option::Option<T>) -> Self
17713        where
17714            T: std::convert::Into<crate::model::tcp_route::RouteAction>,
17715        {
17716            self.action = v.map(|x| x.into());
17717            self
17718        }
17719    }
17720
17721    impl wkt::message::Message for RouteRule {
17722        fn typename() -> &'static str {
17723            "type.googleapis.com/google.cloud.networkservices.v1.TcpRoute.RouteRule"
17724        }
17725    }
17726
17727    /// RouteMatch defines the predicate used to match requests to a given action.
17728    /// Multiple match types are "OR"ed for evaluation.
17729    /// If no routeMatch field is specified, this rule will unconditionally match
17730    /// traffic.
17731    #[derive(Clone, Default, PartialEq)]
17732    #[non_exhaustive]
17733    pub struct RouteMatch {
17734        /// Required. Must be specified in the CIDR range format. A CIDR range
17735        /// consists of an IP Address and a prefix length to construct the subnet
17736        /// mask. By default, the prefix length is 32 (i.e. matches a single IP
17737        /// address). Only IPV4 addresses are supported. Examples: "10.0.0.1" -
17738        /// matches against this exact IP address. "10.0.0.0/8" - matches against any
17739        /// IP address within the 10.0.0.0 subnet and 255.255.255.0 mask. "0.0.0.0/0"
17740        ///
17741        /// - matches against any IP address'.
17742        pub address: std::string::String,
17743
17744        /// Required. Specifies the destination port to match against.
17745        pub port: std::string::String,
17746
17747        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17748    }
17749
17750    impl RouteMatch {
17751        pub fn new() -> Self {
17752            std::default::Default::default()
17753        }
17754
17755        /// Sets the value of [address][crate::model::tcp_route::RouteMatch::address].
17756        ///
17757        /// # Example
17758        /// ```ignore,no_run
17759        /// # use google_cloud_networkservices_v1::model::tcp_route::RouteMatch;
17760        /// let x = RouteMatch::new().set_address("example");
17761        /// ```
17762        pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17763            self.address = v.into();
17764            self
17765        }
17766
17767        /// Sets the value of [port][crate::model::tcp_route::RouteMatch::port].
17768        ///
17769        /// # Example
17770        /// ```ignore,no_run
17771        /// # use google_cloud_networkservices_v1::model::tcp_route::RouteMatch;
17772        /// let x = RouteMatch::new().set_port("example");
17773        /// ```
17774        pub fn set_port<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17775            self.port = v.into();
17776            self
17777        }
17778    }
17779
17780    impl wkt::message::Message for RouteMatch {
17781        fn typename() -> &'static str {
17782            "type.googleapis.com/google.cloud.networkservices.v1.TcpRoute.RouteMatch"
17783        }
17784    }
17785
17786    /// The specifications for routing traffic and applying associated policies.
17787    #[derive(Clone, Default, PartialEq)]
17788    #[non_exhaustive]
17789    pub struct RouteAction {
17790        /// Optional. The destination services to which traffic should be forwarded.
17791        /// At least one destination service is required. Only one of route
17792        /// destination or original destination can be set.
17793        pub destinations: std::vec::Vec<crate::model::tcp_route::RouteDestination>,
17794
17795        /// Optional. If true, Router will use the destination IP and port of the
17796        /// original connection as the destination of the request. Default is false.
17797        /// Only one of route destinations or original destination can be set.
17798        pub original_destination: bool,
17799
17800        /// Optional. Specifies the idle timeout for the selected route. The idle
17801        /// timeout is defined as the period in which there are no bytes sent or
17802        /// received on either the upstream or downstream connection. If not set, the
17803        /// default idle timeout is 30 seconds. If set to 0s, the timeout will be
17804        /// disabled.
17805        pub idle_timeout: std::option::Option<wkt::Duration>,
17806
17807        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17808    }
17809
17810    impl RouteAction {
17811        pub fn new() -> Self {
17812            std::default::Default::default()
17813        }
17814
17815        /// Sets the value of [destinations][crate::model::tcp_route::RouteAction::destinations].
17816        ///
17817        /// # Example
17818        /// ```ignore,no_run
17819        /// # use google_cloud_networkservices_v1::model::tcp_route::RouteAction;
17820        /// use google_cloud_networkservices_v1::model::tcp_route::RouteDestination;
17821        /// let x = RouteAction::new()
17822        ///     .set_destinations([
17823        ///         RouteDestination::default()/* use setters */,
17824        ///         RouteDestination::default()/* use (different) setters */,
17825        ///     ]);
17826        /// ```
17827        pub fn set_destinations<T, V>(mut self, v: T) -> Self
17828        where
17829            T: std::iter::IntoIterator<Item = V>,
17830            V: std::convert::Into<crate::model::tcp_route::RouteDestination>,
17831        {
17832            use std::iter::Iterator;
17833            self.destinations = v.into_iter().map(|i| i.into()).collect();
17834            self
17835        }
17836
17837        /// Sets the value of [original_destination][crate::model::tcp_route::RouteAction::original_destination].
17838        ///
17839        /// # Example
17840        /// ```ignore,no_run
17841        /// # use google_cloud_networkservices_v1::model::tcp_route::RouteAction;
17842        /// let x = RouteAction::new().set_original_destination(true);
17843        /// ```
17844        pub fn set_original_destination<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17845            self.original_destination = v.into();
17846            self
17847        }
17848
17849        /// Sets the value of [idle_timeout][crate::model::tcp_route::RouteAction::idle_timeout].
17850        ///
17851        /// # Example
17852        /// ```ignore,no_run
17853        /// # use google_cloud_networkservices_v1::model::tcp_route::RouteAction;
17854        /// use wkt::Duration;
17855        /// let x = RouteAction::new().set_idle_timeout(Duration::default()/* use setters */);
17856        /// ```
17857        pub fn set_idle_timeout<T>(mut self, v: T) -> Self
17858        where
17859            T: std::convert::Into<wkt::Duration>,
17860        {
17861            self.idle_timeout = std::option::Option::Some(v.into());
17862            self
17863        }
17864
17865        /// Sets or clears the value of [idle_timeout][crate::model::tcp_route::RouteAction::idle_timeout].
17866        ///
17867        /// # Example
17868        /// ```ignore,no_run
17869        /// # use google_cloud_networkservices_v1::model::tcp_route::RouteAction;
17870        /// use wkt::Duration;
17871        /// let x = RouteAction::new().set_or_clear_idle_timeout(Some(Duration::default()/* use setters */));
17872        /// let x = RouteAction::new().set_or_clear_idle_timeout(None::<Duration>);
17873        /// ```
17874        pub fn set_or_clear_idle_timeout<T>(mut self, v: std::option::Option<T>) -> Self
17875        where
17876            T: std::convert::Into<wkt::Duration>,
17877        {
17878            self.idle_timeout = v.map(|x| x.into());
17879            self
17880        }
17881    }
17882
17883    impl wkt::message::Message for RouteAction {
17884        fn typename() -> &'static str {
17885            "type.googleapis.com/google.cloud.networkservices.v1.TcpRoute.RouteAction"
17886        }
17887    }
17888
17889    /// Describe the destination for traffic to be routed to.
17890    #[derive(Clone, Default, PartialEq)]
17891    #[non_exhaustive]
17892    pub struct RouteDestination {
17893        /// Required. The URL of a BackendService to route traffic to.
17894        pub service_name: std::string::String,
17895
17896        /// Optional. Specifies the proportion of requests forwarded to the backend
17897        /// referenced by the serviceName field. This is computed as:
17898        ///
17899        /// - weight/Sum(weights in this destination list).
17900        ///   For non-zero values, there may be some epsilon from the exact proportion
17901        ///   defined here depending on the precision an implementation supports.
17902        ///
17903        /// If only one serviceName is specified and it has a weight greater than 0,
17904        /// 100% of the traffic is forwarded to that backend.
17905        ///
17906        /// If weights are specified for any one service name, they need to be
17907        /// specified for all of them.
17908        ///
17909        /// If weights are unspecified for all services, then, traffic is distributed
17910        /// in equal proportions to all of them.
17911        pub weight: i32,
17912
17913        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17914    }
17915
17916    impl RouteDestination {
17917        pub fn new() -> Self {
17918            std::default::Default::default()
17919        }
17920
17921        /// Sets the value of [service_name][crate::model::tcp_route::RouteDestination::service_name].
17922        ///
17923        /// # Example
17924        /// ```ignore,no_run
17925        /// # use google_cloud_networkservices_v1::model::tcp_route::RouteDestination;
17926        /// let x = RouteDestination::new().set_service_name("example");
17927        /// ```
17928        pub fn set_service_name<T: std::convert::Into<std::string::String>>(
17929            mut self,
17930            v: T,
17931        ) -> Self {
17932            self.service_name = v.into();
17933            self
17934        }
17935
17936        /// Sets the value of [weight][crate::model::tcp_route::RouteDestination::weight].
17937        ///
17938        /// # Example
17939        /// ```ignore,no_run
17940        /// # use google_cloud_networkservices_v1::model::tcp_route::RouteDestination;
17941        /// let x = RouteDestination::new().set_weight(42);
17942        /// ```
17943        pub fn set_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17944            self.weight = v.into();
17945            self
17946        }
17947    }
17948
17949    impl wkt::message::Message for RouteDestination {
17950        fn typename() -> &'static str {
17951            "type.googleapis.com/google.cloud.networkservices.v1.TcpRoute.RouteDestination"
17952        }
17953    }
17954}
17955
17956/// Request used with the ListTcpRoutes method.
17957#[derive(Clone, Default, PartialEq)]
17958#[non_exhaustive]
17959pub struct ListTcpRoutesRequest {
17960    /// Required. The project and location from which the TcpRoutes should be
17961    /// listed, specified in the format `projects/*/locations/global`.
17962    pub parent: std::string::String,
17963
17964    /// Maximum number of TcpRoutes to return per call.
17965    pub page_size: i32,
17966
17967    /// The value returned by the last `ListTcpRoutesResponse`
17968    /// Indicates that this is a continuation of a prior `ListTcpRoutes` call,
17969    /// and that the system should return the next page of data.
17970    pub page_token: std::string::String,
17971
17972    /// Optional. If true, allow partial responses for multi-regional Aggregated
17973    /// List requests. Otherwise if one of the locations is down or unreachable,
17974    /// the Aggregated List request will fail.
17975    pub return_partial_success: bool,
17976
17977    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17978}
17979
17980impl ListTcpRoutesRequest {
17981    pub fn new() -> Self {
17982        std::default::Default::default()
17983    }
17984
17985    /// Sets the value of [parent][crate::model::ListTcpRoutesRequest::parent].
17986    ///
17987    /// # Example
17988    /// ```ignore,no_run
17989    /// # use google_cloud_networkservices_v1::model::ListTcpRoutesRequest;
17990    /// let x = ListTcpRoutesRequest::new().set_parent("example");
17991    /// ```
17992    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17993        self.parent = v.into();
17994        self
17995    }
17996
17997    /// Sets the value of [page_size][crate::model::ListTcpRoutesRequest::page_size].
17998    ///
17999    /// # Example
18000    /// ```ignore,no_run
18001    /// # use google_cloud_networkservices_v1::model::ListTcpRoutesRequest;
18002    /// let x = ListTcpRoutesRequest::new().set_page_size(42);
18003    /// ```
18004    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
18005        self.page_size = v.into();
18006        self
18007    }
18008
18009    /// Sets the value of [page_token][crate::model::ListTcpRoutesRequest::page_token].
18010    ///
18011    /// # Example
18012    /// ```ignore,no_run
18013    /// # use google_cloud_networkservices_v1::model::ListTcpRoutesRequest;
18014    /// let x = ListTcpRoutesRequest::new().set_page_token("example");
18015    /// ```
18016    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18017        self.page_token = v.into();
18018        self
18019    }
18020
18021    /// Sets the value of [return_partial_success][crate::model::ListTcpRoutesRequest::return_partial_success].
18022    ///
18023    /// # Example
18024    /// ```ignore,no_run
18025    /// # use google_cloud_networkservices_v1::model::ListTcpRoutesRequest;
18026    /// let x = ListTcpRoutesRequest::new().set_return_partial_success(true);
18027    /// ```
18028    pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18029        self.return_partial_success = v.into();
18030        self
18031    }
18032}
18033
18034impl wkt::message::Message for ListTcpRoutesRequest {
18035    fn typename() -> &'static str {
18036        "type.googleapis.com/google.cloud.networkservices.v1.ListTcpRoutesRequest"
18037    }
18038}
18039
18040/// Response returned by the ListTcpRoutes method.
18041#[derive(Clone, Default, PartialEq)]
18042#[non_exhaustive]
18043pub struct ListTcpRoutesResponse {
18044    /// List of TcpRoute resources.
18045    pub tcp_routes: std::vec::Vec<crate::model::TcpRoute>,
18046
18047    /// If there might be more results than those appearing in this response, then
18048    /// `next_page_token` is included. To get the next set of results, call this
18049    /// method again using the value of `next_page_token` as `page_token`.
18050    pub next_page_token: std::string::String,
18051
18052    /// Unreachable resources. Populated when the request opts into
18053    /// [return_partial_success][google.cloud.networkservices.v1.ListTcpRoutesRequest.return_partial_success]
18054    /// and reading across collections e.g. when attempting to list all resources
18055    /// across all supported locations.
18056    ///
18057    /// [google.cloud.networkservices.v1.ListTcpRoutesRequest.return_partial_success]: crate::model::ListTcpRoutesRequest::return_partial_success
18058    pub unreachable: std::vec::Vec<std::string::String>,
18059
18060    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18061}
18062
18063impl ListTcpRoutesResponse {
18064    pub fn new() -> Self {
18065        std::default::Default::default()
18066    }
18067
18068    /// Sets the value of [tcp_routes][crate::model::ListTcpRoutesResponse::tcp_routes].
18069    ///
18070    /// # Example
18071    /// ```ignore,no_run
18072    /// # use google_cloud_networkservices_v1::model::ListTcpRoutesResponse;
18073    /// use google_cloud_networkservices_v1::model::TcpRoute;
18074    /// let x = ListTcpRoutesResponse::new()
18075    ///     .set_tcp_routes([
18076    ///         TcpRoute::default()/* use setters */,
18077    ///         TcpRoute::default()/* use (different) setters */,
18078    ///     ]);
18079    /// ```
18080    pub fn set_tcp_routes<T, V>(mut self, v: T) -> Self
18081    where
18082        T: std::iter::IntoIterator<Item = V>,
18083        V: std::convert::Into<crate::model::TcpRoute>,
18084    {
18085        use std::iter::Iterator;
18086        self.tcp_routes = v.into_iter().map(|i| i.into()).collect();
18087        self
18088    }
18089
18090    /// Sets the value of [next_page_token][crate::model::ListTcpRoutesResponse::next_page_token].
18091    ///
18092    /// # Example
18093    /// ```ignore,no_run
18094    /// # use google_cloud_networkservices_v1::model::ListTcpRoutesResponse;
18095    /// let x = ListTcpRoutesResponse::new().set_next_page_token("example");
18096    /// ```
18097    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18098        self.next_page_token = v.into();
18099        self
18100    }
18101
18102    /// Sets the value of [unreachable][crate::model::ListTcpRoutesResponse::unreachable].
18103    ///
18104    /// # Example
18105    /// ```ignore,no_run
18106    /// # use google_cloud_networkservices_v1::model::ListTcpRoutesResponse;
18107    /// let x = ListTcpRoutesResponse::new().set_unreachable(["a", "b", "c"]);
18108    /// ```
18109    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
18110    where
18111        T: std::iter::IntoIterator<Item = V>,
18112        V: std::convert::Into<std::string::String>,
18113    {
18114        use std::iter::Iterator;
18115        self.unreachable = v.into_iter().map(|i| i.into()).collect();
18116        self
18117    }
18118}
18119
18120impl wkt::message::Message for ListTcpRoutesResponse {
18121    fn typename() -> &'static str {
18122        "type.googleapis.com/google.cloud.networkservices.v1.ListTcpRoutesResponse"
18123    }
18124}
18125
18126#[doc(hidden)]
18127impl google_cloud_gax::paginator::internal::PageableResponse for ListTcpRoutesResponse {
18128    type PageItem = crate::model::TcpRoute;
18129
18130    fn items(self) -> std::vec::Vec<Self::PageItem> {
18131        self.tcp_routes
18132    }
18133
18134    fn next_page_token(&self) -> std::string::String {
18135        use std::clone::Clone;
18136        self.next_page_token.clone()
18137    }
18138}
18139
18140/// Request used by the GetTcpRoute method.
18141#[derive(Clone, Default, PartialEq)]
18142#[non_exhaustive]
18143pub struct GetTcpRouteRequest {
18144    /// Required. A name of the TcpRoute to get. Must be in the format
18145    /// `projects/*/locations/global/tcpRoutes/*`.
18146    pub name: std::string::String,
18147
18148    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18149}
18150
18151impl GetTcpRouteRequest {
18152    pub fn new() -> Self {
18153        std::default::Default::default()
18154    }
18155
18156    /// Sets the value of [name][crate::model::GetTcpRouteRequest::name].
18157    ///
18158    /// # Example
18159    /// ```ignore,no_run
18160    /// # use google_cloud_networkservices_v1::model::GetTcpRouteRequest;
18161    /// let x = GetTcpRouteRequest::new().set_name("example");
18162    /// ```
18163    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18164        self.name = v.into();
18165        self
18166    }
18167}
18168
18169impl wkt::message::Message for GetTcpRouteRequest {
18170    fn typename() -> &'static str {
18171        "type.googleapis.com/google.cloud.networkservices.v1.GetTcpRouteRequest"
18172    }
18173}
18174
18175/// Request used by the TcpRoute method.
18176#[derive(Clone, Default, PartialEq)]
18177#[non_exhaustive]
18178pub struct CreateTcpRouteRequest {
18179    /// Required. The parent resource of the TcpRoute. Must be in the
18180    /// format `projects/*/locations/global`.
18181    pub parent: std::string::String,
18182
18183    /// Required. Short name of the TcpRoute resource to be created.
18184    pub tcp_route_id: std::string::String,
18185
18186    /// Required. TcpRoute resource to be created.
18187    pub tcp_route: std::option::Option<crate::model::TcpRoute>,
18188
18189    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18190}
18191
18192impl CreateTcpRouteRequest {
18193    pub fn new() -> Self {
18194        std::default::Default::default()
18195    }
18196
18197    /// Sets the value of [parent][crate::model::CreateTcpRouteRequest::parent].
18198    ///
18199    /// # Example
18200    /// ```ignore,no_run
18201    /// # use google_cloud_networkservices_v1::model::CreateTcpRouteRequest;
18202    /// let x = CreateTcpRouteRequest::new().set_parent("example");
18203    /// ```
18204    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18205        self.parent = v.into();
18206        self
18207    }
18208
18209    /// Sets the value of [tcp_route_id][crate::model::CreateTcpRouteRequest::tcp_route_id].
18210    ///
18211    /// # Example
18212    /// ```ignore,no_run
18213    /// # use google_cloud_networkservices_v1::model::CreateTcpRouteRequest;
18214    /// let x = CreateTcpRouteRequest::new().set_tcp_route_id("example");
18215    /// ```
18216    pub fn set_tcp_route_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18217        self.tcp_route_id = v.into();
18218        self
18219    }
18220
18221    /// Sets the value of [tcp_route][crate::model::CreateTcpRouteRequest::tcp_route].
18222    ///
18223    /// # Example
18224    /// ```ignore,no_run
18225    /// # use google_cloud_networkservices_v1::model::CreateTcpRouteRequest;
18226    /// use google_cloud_networkservices_v1::model::TcpRoute;
18227    /// let x = CreateTcpRouteRequest::new().set_tcp_route(TcpRoute::default()/* use setters */);
18228    /// ```
18229    pub fn set_tcp_route<T>(mut self, v: T) -> Self
18230    where
18231        T: std::convert::Into<crate::model::TcpRoute>,
18232    {
18233        self.tcp_route = std::option::Option::Some(v.into());
18234        self
18235    }
18236
18237    /// Sets or clears the value of [tcp_route][crate::model::CreateTcpRouteRequest::tcp_route].
18238    ///
18239    /// # Example
18240    /// ```ignore,no_run
18241    /// # use google_cloud_networkservices_v1::model::CreateTcpRouteRequest;
18242    /// use google_cloud_networkservices_v1::model::TcpRoute;
18243    /// let x = CreateTcpRouteRequest::new().set_or_clear_tcp_route(Some(TcpRoute::default()/* use setters */));
18244    /// let x = CreateTcpRouteRequest::new().set_or_clear_tcp_route(None::<TcpRoute>);
18245    /// ```
18246    pub fn set_or_clear_tcp_route<T>(mut self, v: std::option::Option<T>) -> Self
18247    where
18248        T: std::convert::Into<crate::model::TcpRoute>,
18249    {
18250        self.tcp_route = v.map(|x| x.into());
18251        self
18252    }
18253}
18254
18255impl wkt::message::Message for CreateTcpRouteRequest {
18256    fn typename() -> &'static str {
18257        "type.googleapis.com/google.cloud.networkservices.v1.CreateTcpRouteRequest"
18258    }
18259}
18260
18261/// Request used by the UpdateTcpRoute method.
18262#[derive(Clone, Default, PartialEq)]
18263#[non_exhaustive]
18264pub struct UpdateTcpRouteRequest {
18265    /// Optional. Field mask is used to specify the fields to be overwritten in the
18266    /// TcpRoute resource by the update.
18267    /// The fields specified in the update_mask are relative to the resource, not
18268    /// the full request. A field will be overwritten if it is in the mask. If the
18269    /// user does not provide a mask then all fields will be overwritten.
18270    pub update_mask: std::option::Option<wkt::FieldMask>,
18271
18272    /// Required. Updated TcpRoute resource.
18273    pub tcp_route: std::option::Option<crate::model::TcpRoute>,
18274
18275    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18276}
18277
18278impl UpdateTcpRouteRequest {
18279    pub fn new() -> Self {
18280        std::default::Default::default()
18281    }
18282
18283    /// Sets the value of [update_mask][crate::model::UpdateTcpRouteRequest::update_mask].
18284    ///
18285    /// # Example
18286    /// ```ignore,no_run
18287    /// # use google_cloud_networkservices_v1::model::UpdateTcpRouteRequest;
18288    /// use wkt::FieldMask;
18289    /// let x = UpdateTcpRouteRequest::new().set_update_mask(FieldMask::default()/* use setters */);
18290    /// ```
18291    pub fn set_update_mask<T>(mut self, v: T) -> Self
18292    where
18293        T: std::convert::Into<wkt::FieldMask>,
18294    {
18295        self.update_mask = std::option::Option::Some(v.into());
18296        self
18297    }
18298
18299    /// Sets or clears the value of [update_mask][crate::model::UpdateTcpRouteRequest::update_mask].
18300    ///
18301    /// # Example
18302    /// ```ignore,no_run
18303    /// # use google_cloud_networkservices_v1::model::UpdateTcpRouteRequest;
18304    /// use wkt::FieldMask;
18305    /// let x = UpdateTcpRouteRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
18306    /// let x = UpdateTcpRouteRequest::new().set_or_clear_update_mask(None::<FieldMask>);
18307    /// ```
18308    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
18309    where
18310        T: std::convert::Into<wkt::FieldMask>,
18311    {
18312        self.update_mask = v.map(|x| x.into());
18313        self
18314    }
18315
18316    /// Sets the value of [tcp_route][crate::model::UpdateTcpRouteRequest::tcp_route].
18317    ///
18318    /// # Example
18319    /// ```ignore,no_run
18320    /// # use google_cloud_networkservices_v1::model::UpdateTcpRouteRequest;
18321    /// use google_cloud_networkservices_v1::model::TcpRoute;
18322    /// let x = UpdateTcpRouteRequest::new().set_tcp_route(TcpRoute::default()/* use setters */);
18323    /// ```
18324    pub fn set_tcp_route<T>(mut self, v: T) -> Self
18325    where
18326        T: std::convert::Into<crate::model::TcpRoute>,
18327    {
18328        self.tcp_route = std::option::Option::Some(v.into());
18329        self
18330    }
18331
18332    /// Sets or clears the value of [tcp_route][crate::model::UpdateTcpRouteRequest::tcp_route].
18333    ///
18334    /// # Example
18335    /// ```ignore,no_run
18336    /// # use google_cloud_networkservices_v1::model::UpdateTcpRouteRequest;
18337    /// use google_cloud_networkservices_v1::model::TcpRoute;
18338    /// let x = UpdateTcpRouteRequest::new().set_or_clear_tcp_route(Some(TcpRoute::default()/* use setters */));
18339    /// let x = UpdateTcpRouteRequest::new().set_or_clear_tcp_route(None::<TcpRoute>);
18340    /// ```
18341    pub fn set_or_clear_tcp_route<T>(mut self, v: std::option::Option<T>) -> Self
18342    where
18343        T: std::convert::Into<crate::model::TcpRoute>,
18344    {
18345        self.tcp_route = v.map(|x| x.into());
18346        self
18347    }
18348}
18349
18350impl wkt::message::Message for UpdateTcpRouteRequest {
18351    fn typename() -> &'static str {
18352        "type.googleapis.com/google.cloud.networkservices.v1.UpdateTcpRouteRequest"
18353    }
18354}
18355
18356/// Request used by the DeleteTcpRoute method.
18357#[derive(Clone, Default, PartialEq)]
18358#[non_exhaustive]
18359pub struct DeleteTcpRouteRequest {
18360    /// Required. A name of the TcpRoute to delete. Must be in the format
18361    /// `projects/*/locations/global/tcpRoutes/*`.
18362    pub name: std::string::String,
18363
18364    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18365}
18366
18367impl DeleteTcpRouteRequest {
18368    pub fn new() -> Self {
18369        std::default::Default::default()
18370    }
18371
18372    /// Sets the value of [name][crate::model::DeleteTcpRouteRequest::name].
18373    ///
18374    /// # Example
18375    /// ```ignore,no_run
18376    /// # use google_cloud_networkservices_v1::model::DeleteTcpRouteRequest;
18377    /// let x = DeleteTcpRouteRequest::new().set_name("example");
18378    /// ```
18379    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18380        self.name = v.into();
18381        self
18382    }
18383}
18384
18385impl wkt::message::Message for DeleteTcpRouteRequest {
18386    fn typename() -> &'static str {
18387        "type.googleapis.com/google.cloud.networkservices.v1.DeleteTcpRouteRequest"
18388    }
18389}
18390
18391/// TlsRoute defines how traffic should be routed based on SNI and other matching
18392/// L3 attributes.
18393#[derive(Clone, Default, PartialEq)]
18394#[non_exhaustive]
18395pub struct TlsRoute {
18396    /// Identifier. Name of the TlsRoute resource. It matches pattern
18397    /// `projects/*/locations/global/tlsRoutes/tls_route_name>`.
18398    pub name: std::string::String,
18399
18400    /// Output only. Server-defined URL of this resource
18401    pub self_link: std::string::String,
18402
18403    /// Output only. The timestamp when the resource was created.
18404    pub create_time: std::option::Option<wkt::Timestamp>,
18405
18406    /// Output only. The timestamp when the resource was updated.
18407    pub update_time: std::option::Option<wkt::Timestamp>,
18408
18409    /// Optional. A free-text description of the resource. Max length 1024
18410    /// characters.
18411    pub description: std::string::String,
18412
18413    /// Required. Rules that define how traffic is routed and handled. At least one
18414    /// RouteRule must be supplied. If there are multiple rules then the action
18415    /// taken will be the first rule to match.
18416    pub rules: std::vec::Vec<crate::model::tls_route::RouteRule>,
18417
18418    /// Optional. Meshes defines a list of meshes this TlsRoute is attached to, as
18419    /// one of the routing rules to route the requests served by the mesh.
18420    ///
18421    /// Each mesh reference should match the pattern:
18422    /// `projects/*/locations/global/meshes/<mesh_name>`
18423    ///
18424    /// The attached Mesh should be of a type SIDECAR
18425    pub meshes: std::vec::Vec<std::string::String>,
18426
18427    /// Optional. Gateways defines a list of gateways this TlsRoute is attached to,
18428    /// as one of the routing rules to route the requests served by the gateway.
18429    ///
18430    /// Each gateway reference should match the pattern:
18431    /// `projects/*/locations/global/gateways/<gateway_name>`
18432    pub gateways: std::vec::Vec<std::string::String>,
18433
18434    /// Optional. Set of label tags associated with the TlsRoute resource.
18435    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
18436
18437    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18438}
18439
18440impl TlsRoute {
18441    pub fn new() -> Self {
18442        std::default::Default::default()
18443    }
18444
18445    /// Sets the value of [name][crate::model::TlsRoute::name].
18446    ///
18447    /// # Example
18448    /// ```ignore,no_run
18449    /// # use google_cloud_networkservices_v1::model::TlsRoute;
18450    /// let x = TlsRoute::new().set_name("example");
18451    /// ```
18452    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18453        self.name = v.into();
18454        self
18455    }
18456
18457    /// Sets the value of [self_link][crate::model::TlsRoute::self_link].
18458    ///
18459    /// # Example
18460    /// ```ignore,no_run
18461    /// # use google_cloud_networkservices_v1::model::TlsRoute;
18462    /// let x = TlsRoute::new().set_self_link("example");
18463    /// ```
18464    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18465        self.self_link = v.into();
18466        self
18467    }
18468
18469    /// Sets the value of [create_time][crate::model::TlsRoute::create_time].
18470    ///
18471    /// # Example
18472    /// ```ignore,no_run
18473    /// # use google_cloud_networkservices_v1::model::TlsRoute;
18474    /// use wkt::Timestamp;
18475    /// let x = TlsRoute::new().set_create_time(Timestamp::default()/* use setters */);
18476    /// ```
18477    pub fn set_create_time<T>(mut self, v: T) -> Self
18478    where
18479        T: std::convert::Into<wkt::Timestamp>,
18480    {
18481        self.create_time = std::option::Option::Some(v.into());
18482        self
18483    }
18484
18485    /// Sets or clears the value of [create_time][crate::model::TlsRoute::create_time].
18486    ///
18487    /// # Example
18488    /// ```ignore,no_run
18489    /// # use google_cloud_networkservices_v1::model::TlsRoute;
18490    /// use wkt::Timestamp;
18491    /// let x = TlsRoute::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
18492    /// let x = TlsRoute::new().set_or_clear_create_time(None::<Timestamp>);
18493    /// ```
18494    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
18495    where
18496        T: std::convert::Into<wkt::Timestamp>,
18497    {
18498        self.create_time = v.map(|x| x.into());
18499        self
18500    }
18501
18502    /// Sets the value of [update_time][crate::model::TlsRoute::update_time].
18503    ///
18504    /// # Example
18505    /// ```ignore,no_run
18506    /// # use google_cloud_networkservices_v1::model::TlsRoute;
18507    /// use wkt::Timestamp;
18508    /// let x = TlsRoute::new().set_update_time(Timestamp::default()/* use setters */);
18509    /// ```
18510    pub fn set_update_time<T>(mut self, v: T) -> Self
18511    where
18512        T: std::convert::Into<wkt::Timestamp>,
18513    {
18514        self.update_time = std::option::Option::Some(v.into());
18515        self
18516    }
18517
18518    /// Sets or clears the value of [update_time][crate::model::TlsRoute::update_time].
18519    ///
18520    /// # Example
18521    /// ```ignore,no_run
18522    /// # use google_cloud_networkservices_v1::model::TlsRoute;
18523    /// use wkt::Timestamp;
18524    /// let x = TlsRoute::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
18525    /// let x = TlsRoute::new().set_or_clear_update_time(None::<Timestamp>);
18526    /// ```
18527    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
18528    where
18529        T: std::convert::Into<wkt::Timestamp>,
18530    {
18531        self.update_time = v.map(|x| x.into());
18532        self
18533    }
18534
18535    /// Sets the value of [description][crate::model::TlsRoute::description].
18536    ///
18537    /// # Example
18538    /// ```ignore,no_run
18539    /// # use google_cloud_networkservices_v1::model::TlsRoute;
18540    /// let x = TlsRoute::new().set_description("example");
18541    /// ```
18542    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18543        self.description = v.into();
18544        self
18545    }
18546
18547    /// Sets the value of [rules][crate::model::TlsRoute::rules].
18548    ///
18549    /// # Example
18550    /// ```ignore,no_run
18551    /// # use google_cloud_networkservices_v1::model::TlsRoute;
18552    /// use google_cloud_networkservices_v1::model::tls_route::RouteRule;
18553    /// let x = TlsRoute::new()
18554    ///     .set_rules([
18555    ///         RouteRule::default()/* use setters */,
18556    ///         RouteRule::default()/* use (different) setters */,
18557    ///     ]);
18558    /// ```
18559    pub fn set_rules<T, V>(mut self, v: T) -> Self
18560    where
18561        T: std::iter::IntoIterator<Item = V>,
18562        V: std::convert::Into<crate::model::tls_route::RouteRule>,
18563    {
18564        use std::iter::Iterator;
18565        self.rules = v.into_iter().map(|i| i.into()).collect();
18566        self
18567    }
18568
18569    /// Sets the value of [meshes][crate::model::TlsRoute::meshes].
18570    ///
18571    /// # Example
18572    /// ```ignore,no_run
18573    /// # use google_cloud_networkservices_v1::model::TlsRoute;
18574    /// let x = TlsRoute::new().set_meshes(["a", "b", "c"]);
18575    /// ```
18576    pub fn set_meshes<T, V>(mut self, v: T) -> Self
18577    where
18578        T: std::iter::IntoIterator<Item = V>,
18579        V: std::convert::Into<std::string::String>,
18580    {
18581        use std::iter::Iterator;
18582        self.meshes = v.into_iter().map(|i| i.into()).collect();
18583        self
18584    }
18585
18586    /// Sets the value of [gateways][crate::model::TlsRoute::gateways].
18587    ///
18588    /// # Example
18589    /// ```ignore,no_run
18590    /// # use google_cloud_networkservices_v1::model::TlsRoute;
18591    /// let x = TlsRoute::new().set_gateways(["a", "b", "c"]);
18592    /// ```
18593    pub fn set_gateways<T, V>(mut self, v: T) -> Self
18594    where
18595        T: std::iter::IntoIterator<Item = V>,
18596        V: std::convert::Into<std::string::String>,
18597    {
18598        use std::iter::Iterator;
18599        self.gateways = v.into_iter().map(|i| i.into()).collect();
18600        self
18601    }
18602
18603    /// Sets the value of [labels][crate::model::TlsRoute::labels].
18604    ///
18605    /// # Example
18606    /// ```ignore,no_run
18607    /// # use google_cloud_networkservices_v1::model::TlsRoute;
18608    /// let x = TlsRoute::new().set_labels([
18609    ///     ("key0", "abc"),
18610    ///     ("key1", "xyz"),
18611    /// ]);
18612    /// ```
18613    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
18614    where
18615        T: std::iter::IntoIterator<Item = (K, V)>,
18616        K: std::convert::Into<std::string::String>,
18617        V: std::convert::Into<std::string::String>,
18618    {
18619        use std::iter::Iterator;
18620        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
18621        self
18622    }
18623}
18624
18625impl wkt::message::Message for TlsRoute {
18626    fn typename() -> &'static str {
18627        "type.googleapis.com/google.cloud.networkservices.v1.TlsRoute"
18628    }
18629}
18630
18631/// Defines additional types related to [TlsRoute].
18632pub mod tls_route {
18633    #[allow(unused_imports)]
18634    use super::*;
18635
18636    /// Specifies how to match traffic and how to route traffic when traffic is
18637    /// matched.
18638    #[derive(Clone, Default, PartialEq)]
18639    #[non_exhaustive]
18640    pub struct RouteRule {
18641        /// Required. RouteMatch defines the predicate used to match requests to a
18642        /// given action. Multiple match types are "OR"ed for evaluation. Atleast one
18643        /// RouteMatch must be supplied.
18644        pub matches: std::vec::Vec<crate::model::tls_route::RouteMatch>,
18645
18646        /// Required. The detailed rule defining how to route matched traffic.
18647        pub action: std::option::Option<crate::model::tls_route::RouteAction>,
18648
18649        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18650    }
18651
18652    impl RouteRule {
18653        pub fn new() -> Self {
18654            std::default::Default::default()
18655        }
18656
18657        /// Sets the value of [matches][crate::model::tls_route::RouteRule::matches].
18658        ///
18659        /// # Example
18660        /// ```ignore,no_run
18661        /// # use google_cloud_networkservices_v1::model::tls_route::RouteRule;
18662        /// use google_cloud_networkservices_v1::model::tls_route::RouteMatch;
18663        /// let x = RouteRule::new()
18664        ///     .set_matches([
18665        ///         RouteMatch::default()/* use setters */,
18666        ///         RouteMatch::default()/* use (different) setters */,
18667        ///     ]);
18668        /// ```
18669        pub fn set_matches<T, V>(mut self, v: T) -> Self
18670        where
18671            T: std::iter::IntoIterator<Item = V>,
18672            V: std::convert::Into<crate::model::tls_route::RouteMatch>,
18673        {
18674            use std::iter::Iterator;
18675            self.matches = v.into_iter().map(|i| i.into()).collect();
18676            self
18677        }
18678
18679        /// Sets the value of [action][crate::model::tls_route::RouteRule::action].
18680        ///
18681        /// # Example
18682        /// ```ignore,no_run
18683        /// # use google_cloud_networkservices_v1::model::tls_route::RouteRule;
18684        /// use google_cloud_networkservices_v1::model::tls_route::RouteAction;
18685        /// let x = RouteRule::new().set_action(RouteAction::default()/* use setters */);
18686        /// ```
18687        pub fn set_action<T>(mut self, v: T) -> Self
18688        where
18689            T: std::convert::Into<crate::model::tls_route::RouteAction>,
18690        {
18691            self.action = std::option::Option::Some(v.into());
18692            self
18693        }
18694
18695        /// Sets or clears the value of [action][crate::model::tls_route::RouteRule::action].
18696        ///
18697        /// # Example
18698        /// ```ignore,no_run
18699        /// # use google_cloud_networkservices_v1::model::tls_route::RouteRule;
18700        /// use google_cloud_networkservices_v1::model::tls_route::RouteAction;
18701        /// let x = RouteRule::new().set_or_clear_action(Some(RouteAction::default()/* use setters */));
18702        /// let x = RouteRule::new().set_or_clear_action(None::<RouteAction>);
18703        /// ```
18704        pub fn set_or_clear_action<T>(mut self, v: std::option::Option<T>) -> Self
18705        where
18706            T: std::convert::Into<crate::model::tls_route::RouteAction>,
18707        {
18708            self.action = v.map(|x| x.into());
18709            self
18710        }
18711    }
18712
18713    impl wkt::message::Message for RouteRule {
18714        fn typename() -> &'static str {
18715            "type.googleapis.com/google.cloud.networkservices.v1.TlsRoute.RouteRule"
18716        }
18717    }
18718
18719    /// RouteMatch defines the predicate used to match requests to a given action.
18720    /// Multiple match types are "AND"ed for evaluation.
18721    #[derive(Clone, Default, PartialEq)]
18722    #[non_exhaustive]
18723    pub struct RouteMatch {
18724        /// Optional. SNI (server name indicator) to match against.
18725        /// SNI will be matched against all wildcard domains, i.e. `www.example.com`
18726        /// will be first matched against `www.example.com`, then `*.example.com`,
18727        /// then `*.com.`
18728        /// Partial wildcards are not supported, and values like *w.example.com are
18729        /// invalid.
18730        /// At least one of sni_host and alpn is required.
18731        /// Up to 100 sni hosts across all matches can be set.
18732        pub sni_host: std::vec::Vec<std::string::String>,
18733
18734        /// Optional. ALPN (Application-Layer Protocol Negotiation) to match against.
18735        /// Examples: "http/1.1", "h2".
18736        /// At least one of sni_host and alpn is required.
18737        /// Up to 5 alpns across all matches can be set.
18738        pub alpn: std::vec::Vec<std::string::String>,
18739
18740        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18741    }
18742
18743    impl RouteMatch {
18744        pub fn new() -> Self {
18745            std::default::Default::default()
18746        }
18747
18748        /// Sets the value of [sni_host][crate::model::tls_route::RouteMatch::sni_host].
18749        ///
18750        /// # Example
18751        /// ```ignore,no_run
18752        /// # use google_cloud_networkservices_v1::model::tls_route::RouteMatch;
18753        /// let x = RouteMatch::new().set_sni_host(["a", "b", "c"]);
18754        /// ```
18755        pub fn set_sni_host<T, V>(mut self, v: T) -> Self
18756        where
18757            T: std::iter::IntoIterator<Item = V>,
18758            V: std::convert::Into<std::string::String>,
18759        {
18760            use std::iter::Iterator;
18761            self.sni_host = v.into_iter().map(|i| i.into()).collect();
18762            self
18763        }
18764
18765        /// Sets the value of [alpn][crate::model::tls_route::RouteMatch::alpn].
18766        ///
18767        /// # Example
18768        /// ```ignore,no_run
18769        /// # use google_cloud_networkservices_v1::model::tls_route::RouteMatch;
18770        /// let x = RouteMatch::new().set_alpn(["a", "b", "c"]);
18771        /// ```
18772        pub fn set_alpn<T, V>(mut self, v: T) -> Self
18773        where
18774            T: std::iter::IntoIterator<Item = V>,
18775            V: std::convert::Into<std::string::String>,
18776        {
18777            use std::iter::Iterator;
18778            self.alpn = v.into_iter().map(|i| i.into()).collect();
18779            self
18780        }
18781    }
18782
18783    impl wkt::message::Message for RouteMatch {
18784        fn typename() -> &'static str {
18785            "type.googleapis.com/google.cloud.networkservices.v1.TlsRoute.RouteMatch"
18786        }
18787    }
18788
18789    /// The specifications for routing traffic and applying associated policies.
18790    #[derive(Clone, Default, PartialEq)]
18791    #[non_exhaustive]
18792    pub struct RouteAction {
18793        /// Required. The destination services to which traffic should be forwarded.
18794        /// At least one destination service is required.
18795        pub destinations: std::vec::Vec<crate::model::tls_route::RouteDestination>,
18796
18797        /// Optional. Specifies the idle timeout for the selected route. The idle
18798        /// timeout is defined as the period in which there are no bytes sent or
18799        /// received on either the upstream or downstream connection. If not set, the
18800        /// default idle timeout is 1 hour. If set to 0s, the timeout will be
18801        /// disabled.
18802        pub idle_timeout: std::option::Option<wkt::Duration>,
18803
18804        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18805    }
18806
18807    impl RouteAction {
18808        pub fn new() -> Self {
18809            std::default::Default::default()
18810        }
18811
18812        /// Sets the value of [destinations][crate::model::tls_route::RouteAction::destinations].
18813        ///
18814        /// # Example
18815        /// ```ignore,no_run
18816        /// # use google_cloud_networkservices_v1::model::tls_route::RouteAction;
18817        /// use google_cloud_networkservices_v1::model::tls_route::RouteDestination;
18818        /// let x = RouteAction::new()
18819        ///     .set_destinations([
18820        ///         RouteDestination::default()/* use setters */,
18821        ///         RouteDestination::default()/* use (different) setters */,
18822        ///     ]);
18823        /// ```
18824        pub fn set_destinations<T, V>(mut self, v: T) -> Self
18825        where
18826            T: std::iter::IntoIterator<Item = V>,
18827            V: std::convert::Into<crate::model::tls_route::RouteDestination>,
18828        {
18829            use std::iter::Iterator;
18830            self.destinations = v.into_iter().map(|i| i.into()).collect();
18831            self
18832        }
18833
18834        /// Sets the value of [idle_timeout][crate::model::tls_route::RouteAction::idle_timeout].
18835        ///
18836        /// # Example
18837        /// ```ignore,no_run
18838        /// # use google_cloud_networkservices_v1::model::tls_route::RouteAction;
18839        /// use wkt::Duration;
18840        /// let x = RouteAction::new().set_idle_timeout(Duration::default()/* use setters */);
18841        /// ```
18842        pub fn set_idle_timeout<T>(mut self, v: T) -> Self
18843        where
18844            T: std::convert::Into<wkt::Duration>,
18845        {
18846            self.idle_timeout = std::option::Option::Some(v.into());
18847            self
18848        }
18849
18850        /// Sets or clears the value of [idle_timeout][crate::model::tls_route::RouteAction::idle_timeout].
18851        ///
18852        /// # Example
18853        /// ```ignore,no_run
18854        /// # use google_cloud_networkservices_v1::model::tls_route::RouteAction;
18855        /// use wkt::Duration;
18856        /// let x = RouteAction::new().set_or_clear_idle_timeout(Some(Duration::default()/* use setters */));
18857        /// let x = RouteAction::new().set_or_clear_idle_timeout(None::<Duration>);
18858        /// ```
18859        pub fn set_or_clear_idle_timeout<T>(mut self, v: std::option::Option<T>) -> Self
18860        where
18861            T: std::convert::Into<wkt::Duration>,
18862        {
18863            self.idle_timeout = v.map(|x| x.into());
18864            self
18865        }
18866    }
18867
18868    impl wkt::message::Message for RouteAction {
18869        fn typename() -> &'static str {
18870            "type.googleapis.com/google.cloud.networkservices.v1.TlsRoute.RouteAction"
18871        }
18872    }
18873
18874    /// Describe the destination for traffic to be routed to.
18875    #[derive(Clone, Default, PartialEq)]
18876    #[non_exhaustive]
18877    pub struct RouteDestination {
18878        /// Required. The URL of a BackendService to route traffic to.
18879        pub service_name: std::string::String,
18880
18881        /// Optional. Specifies the proportion of requests forwarded to the backend
18882        /// referenced by the service_name field. This is computed as:
18883        ///
18884        /// - weight/Sum(weights in destinations)
18885        ///   Weights in all destinations does not need to sum up to 100.
18886        pub weight: i32,
18887
18888        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18889    }
18890
18891    impl RouteDestination {
18892        pub fn new() -> Self {
18893            std::default::Default::default()
18894        }
18895
18896        /// Sets the value of [service_name][crate::model::tls_route::RouteDestination::service_name].
18897        ///
18898        /// # Example
18899        /// ```ignore,no_run
18900        /// # use google_cloud_networkservices_v1::model::tls_route::RouteDestination;
18901        /// let x = RouteDestination::new().set_service_name("example");
18902        /// ```
18903        pub fn set_service_name<T: std::convert::Into<std::string::String>>(
18904            mut self,
18905            v: T,
18906        ) -> Self {
18907            self.service_name = v.into();
18908            self
18909        }
18910
18911        /// Sets the value of [weight][crate::model::tls_route::RouteDestination::weight].
18912        ///
18913        /// # Example
18914        /// ```ignore,no_run
18915        /// # use google_cloud_networkservices_v1::model::tls_route::RouteDestination;
18916        /// let x = RouteDestination::new().set_weight(42);
18917        /// ```
18918        pub fn set_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
18919            self.weight = v.into();
18920            self
18921        }
18922    }
18923
18924    impl wkt::message::Message for RouteDestination {
18925        fn typename() -> &'static str {
18926            "type.googleapis.com/google.cloud.networkservices.v1.TlsRoute.RouteDestination"
18927        }
18928    }
18929}
18930
18931/// Request used with the ListTlsRoutes method.
18932#[derive(Clone, Default, PartialEq)]
18933#[non_exhaustive]
18934pub struct ListTlsRoutesRequest {
18935    /// Required. The project and location from which the TlsRoutes should be
18936    /// listed, specified in the format `projects/*/locations/global`.
18937    pub parent: std::string::String,
18938
18939    /// Maximum number of TlsRoutes to return per call.
18940    pub page_size: i32,
18941
18942    /// The value returned by the last `ListTlsRoutesResponse`
18943    /// Indicates that this is a continuation of a prior `ListTlsRoutes` call,
18944    /// and that the system should return the next page of data.
18945    pub page_token: std::string::String,
18946
18947    /// Optional. If true, allow partial responses for multi-regional Aggregated
18948    /// List requests. Otherwise if one of the locations is down or unreachable,
18949    /// the Aggregated List request will fail.
18950    pub return_partial_success: bool,
18951
18952    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18953}
18954
18955impl ListTlsRoutesRequest {
18956    pub fn new() -> Self {
18957        std::default::Default::default()
18958    }
18959
18960    /// Sets the value of [parent][crate::model::ListTlsRoutesRequest::parent].
18961    ///
18962    /// # Example
18963    /// ```ignore,no_run
18964    /// # use google_cloud_networkservices_v1::model::ListTlsRoutesRequest;
18965    /// let x = ListTlsRoutesRequest::new().set_parent("example");
18966    /// ```
18967    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18968        self.parent = v.into();
18969        self
18970    }
18971
18972    /// Sets the value of [page_size][crate::model::ListTlsRoutesRequest::page_size].
18973    ///
18974    /// # Example
18975    /// ```ignore,no_run
18976    /// # use google_cloud_networkservices_v1::model::ListTlsRoutesRequest;
18977    /// let x = ListTlsRoutesRequest::new().set_page_size(42);
18978    /// ```
18979    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
18980        self.page_size = v.into();
18981        self
18982    }
18983
18984    /// Sets the value of [page_token][crate::model::ListTlsRoutesRequest::page_token].
18985    ///
18986    /// # Example
18987    /// ```ignore,no_run
18988    /// # use google_cloud_networkservices_v1::model::ListTlsRoutesRequest;
18989    /// let x = ListTlsRoutesRequest::new().set_page_token("example");
18990    /// ```
18991    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18992        self.page_token = v.into();
18993        self
18994    }
18995
18996    /// Sets the value of [return_partial_success][crate::model::ListTlsRoutesRequest::return_partial_success].
18997    ///
18998    /// # Example
18999    /// ```ignore,no_run
19000    /// # use google_cloud_networkservices_v1::model::ListTlsRoutesRequest;
19001    /// let x = ListTlsRoutesRequest::new().set_return_partial_success(true);
19002    /// ```
19003    pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19004        self.return_partial_success = v.into();
19005        self
19006    }
19007}
19008
19009impl wkt::message::Message for ListTlsRoutesRequest {
19010    fn typename() -> &'static str {
19011        "type.googleapis.com/google.cloud.networkservices.v1.ListTlsRoutesRequest"
19012    }
19013}
19014
19015/// Response returned by the ListTlsRoutes method.
19016#[derive(Clone, Default, PartialEq)]
19017#[non_exhaustive]
19018pub struct ListTlsRoutesResponse {
19019    /// List of TlsRoute resources.
19020    pub tls_routes: std::vec::Vec<crate::model::TlsRoute>,
19021
19022    /// If there might be more results than those appearing in this response, then
19023    /// `next_page_token` is included. To get the next set of results, call this
19024    /// method again using the value of `next_page_token` as `page_token`.
19025    pub next_page_token: std::string::String,
19026
19027    /// Unreachable resources. Populated when the request opts into
19028    /// [return_partial_success][google.cloud.networkservices.v1.ListTlsRoutesRequest.return_partial_success]
19029    /// and reading across collections e.g. when attempting to list all resources
19030    /// across all supported locations.
19031    ///
19032    /// [google.cloud.networkservices.v1.ListTlsRoutesRequest.return_partial_success]: crate::model::ListTlsRoutesRequest::return_partial_success
19033    pub unreachable: std::vec::Vec<std::string::String>,
19034
19035    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19036}
19037
19038impl ListTlsRoutesResponse {
19039    pub fn new() -> Self {
19040        std::default::Default::default()
19041    }
19042
19043    /// Sets the value of [tls_routes][crate::model::ListTlsRoutesResponse::tls_routes].
19044    ///
19045    /// # Example
19046    /// ```ignore,no_run
19047    /// # use google_cloud_networkservices_v1::model::ListTlsRoutesResponse;
19048    /// use google_cloud_networkservices_v1::model::TlsRoute;
19049    /// let x = ListTlsRoutesResponse::new()
19050    ///     .set_tls_routes([
19051    ///         TlsRoute::default()/* use setters */,
19052    ///         TlsRoute::default()/* use (different) setters */,
19053    ///     ]);
19054    /// ```
19055    pub fn set_tls_routes<T, V>(mut self, v: T) -> Self
19056    where
19057        T: std::iter::IntoIterator<Item = V>,
19058        V: std::convert::Into<crate::model::TlsRoute>,
19059    {
19060        use std::iter::Iterator;
19061        self.tls_routes = v.into_iter().map(|i| i.into()).collect();
19062        self
19063    }
19064
19065    /// Sets the value of [next_page_token][crate::model::ListTlsRoutesResponse::next_page_token].
19066    ///
19067    /// # Example
19068    /// ```ignore,no_run
19069    /// # use google_cloud_networkservices_v1::model::ListTlsRoutesResponse;
19070    /// let x = ListTlsRoutesResponse::new().set_next_page_token("example");
19071    /// ```
19072    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19073        self.next_page_token = v.into();
19074        self
19075    }
19076
19077    /// Sets the value of [unreachable][crate::model::ListTlsRoutesResponse::unreachable].
19078    ///
19079    /// # Example
19080    /// ```ignore,no_run
19081    /// # use google_cloud_networkservices_v1::model::ListTlsRoutesResponse;
19082    /// let x = ListTlsRoutesResponse::new().set_unreachable(["a", "b", "c"]);
19083    /// ```
19084    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
19085    where
19086        T: std::iter::IntoIterator<Item = V>,
19087        V: std::convert::Into<std::string::String>,
19088    {
19089        use std::iter::Iterator;
19090        self.unreachable = v.into_iter().map(|i| i.into()).collect();
19091        self
19092    }
19093}
19094
19095impl wkt::message::Message for ListTlsRoutesResponse {
19096    fn typename() -> &'static str {
19097        "type.googleapis.com/google.cloud.networkservices.v1.ListTlsRoutesResponse"
19098    }
19099}
19100
19101#[doc(hidden)]
19102impl google_cloud_gax::paginator::internal::PageableResponse for ListTlsRoutesResponse {
19103    type PageItem = crate::model::TlsRoute;
19104
19105    fn items(self) -> std::vec::Vec<Self::PageItem> {
19106        self.tls_routes
19107    }
19108
19109    fn next_page_token(&self) -> std::string::String {
19110        use std::clone::Clone;
19111        self.next_page_token.clone()
19112    }
19113}
19114
19115/// Request used by the GetTlsRoute method.
19116#[derive(Clone, Default, PartialEq)]
19117#[non_exhaustive]
19118pub struct GetTlsRouteRequest {
19119    /// Required. A name of the TlsRoute to get. Must be in the format
19120    /// `projects/*/locations/global/tlsRoutes/*`.
19121    pub name: std::string::String,
19122
19123    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19124}
19125
19126impl GetTlsRouteRequest {
19127    pub fn new() -> Self {
19128        std::default::Default::default()
19129    }
19130
19131    /// Sets the value of [name][crate::model::GetTlsRouteRequest::name].
19132    ///
19133    /// # Example
19134    /// ```ignore,no_run
19135    /// # use google_cloud_networkservices_v1::model::GetTlsRouteRequest;
19136    /// let x = GetTlsRouteRequest::new().set_name("example");
19137    /// ```
19138    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19139        self.name = v.into();
19140        self
19141    }
19142}
19143
19144impl wkt::message::Message for GetTlsRouteRequest {
19145    fn typename() -> &'static str {
19146        "type.googleapis.com/google.cloud.networkservices.v1.GetTlsRouteRequest"
19147    }
19148}
19149
19150/// Request used by the TlsRoute method.
19151#[derive(Clone, Default, PartialEq)]
19152#[non_exhaustive]
19153pub struct CreateTlsRouteRequest {
19154    /// Required. The parent resource of the TlsRoute. Must be in the
19155    /// format `projects/*/locations/global`.
19156    pub parent: std::string::String,
19157
19158    /// Required. Short name of the TlsRoute resource to be created.
19159    pub tls_route_id: std::string::String,
19160
19161    /// Required. TlsRoute resource to be created.
19162    pub tls_route: std::option::Option<crate::model::TlsRoute>,
19163
19164    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19165}
19166
19167impl CreateTlsRouteRequest {
19168    pub fn new() -> Self {
19169        std::default::Default::default()
19170    }
19171
19172    /// Sets the value of [parent][crate::model::CreateTlsRouteRequest::parent].
19173    ///
19174    /// # Example
19175    /// ```ignore,no_run
19176    /// # use google_cloud_networkservices_v1::model::CreateTlsRouteRequest;
19177    /// let x = CreateTlsRouteRequest::new().set_parent("example");
19178    /// ```
19179    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19180        self.parent = v.into();
19181        self
19182    }
19183
19184    /// Sets the value of [tls_route_id][crate::model::CreateTlsRouteRequest::tls_route_id].
19185    ///
19186    /// # Example
19187    /// ```ignore,no_run
19188    /// # use google_cloud_networkservices_v1::model::CreateTlsRouteRequest;
19189    /// let x = CreateTlsRouteRequest::new().set_tls_route_id("example");
19190    /// ```
19191    pub fn set_tls_route_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19192        self.tls_route_id = v.into();
19193        self
19194    }
19195
19196    /// Sets the value of [tls_route][crate::model::CreateTlsRouteRequest::tls_route].
19197    ///
19198    /// # Example
19199    /// ```ignore,no_run
19200    /// # use google_cloud_networkservices_v1::model::CreateTlsRouteRequest;
19201    /// use google_cloud_networkservices_v1::model::TlsRoute;
19202    /// let x = CreateTlsRouteRequest::new().set_tls_route(TlsRoute::default()/* use setters */);
19203    /// ```
19204    pub fn set_tls_route<T>(mut self, v: T) -> Self
19205    where
19206        T: std::convert::Into<crate::model::TlsRoute>,
19207    {
19208        self.tls_route = std::option::Option::Some(v.into());
19209        self
19210    }
19211
19212    /// Sets or clears the value of [tls_route][crate::model::CreateTlsRouteRequest::tls_route].
19213    ///
19214    /// # Example
19215    /// ```ignore,no_run
19216    /// # use google_cloud_networkservices_v1::model::CreateTlsRouteRequest;
19217    /// use google_cloud_networkservices_v1::model::TlsRoute;
19218    /// let x = CreateTlsRouteRequest::new().set_or_clear_tls_route(Some(TlsRoute::default()/* use setters */));
19219    /// let x = CreateTlsRouteRequest::new().set_or_clear_tls_route(None::<TlsRoute>);
19220    /// ```
19221    pub fn set_or_clear_tls_route<T>(mut self, v: std::option::Option<T>) -> Self
19222    where
19223        T: std::convert::Into<crate::model::TlsRoute>,
19224    {
19225        self.tls_route = v.map(|x| x.into());
19226        self
19227    }
19228}
19229
19230impl wkt::message::Message for CreateTlsRouteRequest {
19231    fn typename() -> &'static str {
19232        "type.googleapis.com/google.cloud.networkservices.v1.CreateTlsRouteRequest"
19233    }
19234}
19235
19236/// Request used by the UpdateTlsRoute method.
19237#[derive(Clone, Default, PartialEq)]
19238#[non_exhaustive]
19239pub struct UpdateTlsRouteRequest {
19240    /// Optional. Field mask is used to specify the fields to be overwritten in the
19241    /// TlsRoute resource by the update.
19242    /// The fields specified in the update_mask are relative to the resource, not
19243    /// the full request. A field will be overwritten if it is in the mask. If the
19244    /// user does not provide a mask then all fields will be overwritten.
19245    pub update_mask: std::option::Option<wkt::FieldMask>,
19246
19247    /// Required. Updated TlsRoute resource.
19248    pub tls_route: std::option::Option<crate::model::TlsRoute>,
19249
19250    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19251}
19252
19253impl UpdateTlsRouteRequest {
19254    pub fn new() -> Self {
19255        std::default::Default::default()
19256    }
19257
19258    /// Sets the value of [update_mask][crate::model::UpdateTlsRouteRequest::update_mask].
19259    ///
19260    /// # Example
19261    /// ```ignore,no_run
19262    /// # use google_cloud_networkservices_v1::model::UpdateTlsRouteRequest;
19263    /// use wkt::FieldMask;
19264    /// let x = UpdateTlsRouteRequest::new().set_update_mask(FieldMask::default()/* use setters */);
19265    /// ```
19266    pub fn set_update_mask<T>(mut self, v: T) -> Self
19267    where
19268        T: std::convert::Into<wkt::FieldMask>,
19269    {
19270        self.update_mask = std::option::Option::Some(v.into());
19271        self
19272    }
19273
19274    /// Sets or clears the value of [update_mask][crate::model::UpdateTlsRouteRequest::update_mask].
19275    ///
19276    /// # Example
19277    /// ```ignore,no_run
19278    /// # use google_cloud_networkservices_v1::model::UpdateTlsRouteRequest;
19279    /// use wkt::FieldMask;
19280    /// let x = UpdateTlsRouteRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
19281    /// let x = UpdateTlsRouteRequest::new().set_or_clear_update_mask(None::<FieldMask>);
19282    /// ```
19283    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
19284    where
19285        T: std::convert::Into<wkt::FieldMask>,
19286    {
19287        self.update_mask = v.map(|x| x.into());
19288        self
19289    }
19290
19291    /// Sets the value of [tls_route][crate::model::UpdateTlsRouteRequest::tls_route].
19292    ///
19293    /// # Example
19294    /// ```ignore,no_run
19295    /// # use google_cloud_networkservices_v1::model::UpdateTlsRouteRequest;
19296    /// use google_cloud_networkservices_v1::model::TlsRoute;
19297    /// let x = UpdateTlsRouteRequest::new().set_tls_route(TlsRoute::default()/* use setters */);
19298    /// ```
19299    pub fn set_tls_route<T>(mut self, v: T) -> Self
19300    where
19301        T: std::convert::Into<crate::model::TlsRoute>,
19302    {
19303        self.tls_route = std::option::Option::Some(v.into());
19304        self
19305    }
19306
19307    /// Sets or clears the value of [tls_route][crate::model::UpdateTlsRouteRequest::tls_route].
19308    ///
19309    /// # Example
19310    /// ```ignore,no_run
19311    /// # use google_cloud_networkservices_v1::model::UpdateTlsRouteRequest;
19312    /// use google_cloud_networkservices_v1::model::TlsRoute;
19313    /// let x = UpdateTlsRouteRequest::new().set_or_clear_tls_route(Some(TlsRoute::default()/* use setters */));
19314    /// let x = UpdateTlsRouteRequest::new().set_or_clear_tls_route(None::<TlsRoute>);
19315    /// ```
19316    pub fn set_or_clear_tls_route<T>(mut self, v: std::option::Option<T>) -> Self
19317    where
19318        T: std::convert::Into<crate::model::TlsRoute>,
19319    {
19320        self.tls_route = v.map(|x| x.into());
19321        self
19322    }
19323}
19324
19325impl wkt::message::Message for UpdateTlsRouteRequest {
19326    fn typename() -> &'static str {
19327        "type.googleapis.com/google.cloud.networkservices.v1.UpdateTlsRouteRequest"
19328    }
19329}
19330
19331/// Request used by the DeleteTlsRoute method.
19332#[derive(Clone, Default, PartialEq)]
19333#[non_exhaustive]
19334pub struct DeleteTlsRouteRequest {
19335    /// Required. A name of the TlsRoute to delete. Must be in the format
19336    /// `projects/*/locations/global/tlsRoutes/*`.
19337    pub name: std::string::String,
19338
19339    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19340}
19341
19342impl DeleteTlsRouteRequest {
19343    pub fn new() -> Self {
19344        std::default::Default::default()
19345    }
19346
19347    /// Sets the value of [name][crate::model::DeleteTlsRouteRequest::name].
19348    ///
19349    /// # Example
19350    /// ```ignore,no_run
19351    /// # use google_cloud_networkservices_v1::model::DeleteTlsRouteRequest;
19352    /// let x = DeleteTlsRouteRequest::new().set_name("example");
19353    /// ```
19354    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19355        self.name = v.into();
19356        self
19357    }
19358}
19359
19360impl wkt::message::Message for DeleteTlsRouteRequest {
19361    fn typename() -> &'static str {
19362        "type.googleapis.com/google.cloud.networkservices.v1.DeleteTlsRouteRequest"
19363    }
19364}
19365
19366/// EnvoyHeader configuration for Mesh and Gateway
19367///
19368/// # Working with unknown values
19369///
19370/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19371/// additional enum variants at any time. Adding new variants is not considered
19372/// a breaking change. Applications should write their code in anticipation of:
19373///
19374/// - New values appearing in future releases of the client library, **and**
19375/// - New values received dynamically, without application changes.
19376///
19377/// Please consult the [Working with enums] section in the user guide for some
19378/// guidelines.
19379///
19380/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19381#[derive(Clone, Debug, PartialEq)]
19382#[non_exhaustive]
19383pub enum EnvoyHeaders {
19384    /// Defaults to NONE.
19385    Unspecified,
19386    /// Suppress envoy debug headers.
19387    None,
19388    /// Envoy will insert default internal debug headers into upstream requests:
19389    /// x-envoy-attempt-count
19390    /// x-envoy-is-timeout-retry
19391    /// x-envoy-expected-rq-timeout-ms
19392    /// x-envoy-original-path
19393    /// x-envoy-upstream-stream-duration-ms
19394    DebugHeaders,
19395    /// If set, the enum was initialized with an unknown value.
19396    ///
19397    /// Applications can examine the value using [EnvoyHeaders::value] or
19398    /// [EnvoyHeaders::name].
19399    UnknownValue(envoy_headers::UnknownValue),
19400}
19401
19402#[doc(hidden)]
19403pub mod envoy_headers {
19404    #[allow(unused_imports)]
19405    use super::*;
19406    #[derive(Clone, Debug, PartialEq)]
19407    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19408}
19409
19410impl EnvoyHeaders {
19411    /// Gets the enum value.
19412    ///
19413    /// Returns `None` if the enum contains an unknown value deserialized from
19414    /// the string representation of enums.
19415    pub fn value(&self) -> std::option::Option<i32> {
19416        match self {
19417            Self::Unspecified => std::option::Option::Some(0),
19418            Self::None => std::option::Option::Some(1),
19419            Self::DebugHeaders => std::option::Option::Some(2),
19420            Self::UnknownValue(u) => u.0.value(),
19421        }
19422    }
19423
19424    /// Gets the enum value as a string.
19425    ///
19426    /// Returns `None` if the enum contains an unknown value deserialized from
19427    /// the integer representation of enums.
19428    pub fn name(&self) -> std::option::Option<&str> {
19429        match self {
19430            Self::Unspecified => std::option::Option::Some("ENVOY_HEADERS_UNSPECIFIED"),
19431            Self::None => std::option::Option::Some("NONE"),
19432            Self::DebugHeaders => std::option::Option::Some("DEBUG_HEADERS"),
19433            Self::UnknownValue(u) => u.0.name(),
19434        }
19435    }
19436}
19437
19438impl std::default::Default for EnvoyHeaders {
19439    fn default() -> Self {
19440        use std::convert::From;
19441        Self::from(0)
19442    }
19443}
19444
19445impl std::fmt::Display for EnvoyHeaders {
19446    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19447        wkt::internal::display_enum(f, self.name(), self.value())
19448    }
19449}
19450
19451impl std::convert::From<i32> for EnvoyHeaders {
19452    fn from(value: i32) -> Self {
19453        match value {
19454            0 => Self::Unspecified,
19455            1 => Self::None,
19456            2 => Self::DebugHeaders,
19457            _ => Self::UnknownValue(envoy_headers::UnknownValue(
19458                wkt::internal::UnknownEnumValue::Integer(value),
19459            )),
19460        }
19461    }
19462}
19463
19464impl std::convert::From<&str> for EnvoyHeaders {
19465    fn from(value: &str) -> Self {
19466        use std::string::ToString;
19467        match value {
19468            "ENVOY_HEADERS_UNSPECIFIED" => Self::Unspecified,
19469            "NONE" => Self::None,
19470            "DEBUG_HEADERS" => Self::DebugHeaders,
19471            _ => Self::UnknownValue(envoy_headers::UnknownValue(
19472                wkt::internal::UnknownEnumValue::String(value.to_string()),
19473            )),
19474        }
19475    }
19476}
19477
19478impl serde::ser::Serialize for EnvoyHeaders {
19479    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19480    where
19481        S: serde::Serializer,
19482    {
19483        match self {
19484            Self::Unspecified => serializer.serialize_i32(0),
19485            Self::None => serializer.serialize_i32(1),
19486            Self::DebugHeaders => serializer.serialize_i32(2),
19487            Self::UnknownValue(u) => u.0.serialize(serializer),
19488        }
19489    }
19490}
19491
19492impl<'de> serde::de::Deserialize<'de> for EnvoyHeaders {
19493    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19494    where
19495        D: serde::Deserializer<'de>,
19496    {
19497        deserializer.deserialize_any(wkt::internal::EnumVisitor::<EnvoyHeaders>::new(
19498            ".google.cloud.networkservices.v1.EnvoyHeaders",
19499        ))
19500    }
19501}
19502
19503/// The part of the request or response for which the extension is called.
19504///
19505/// # Working with unknown values
19506///
19507/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19508/// additional enum variants at any time. Adding new variants is not considered
19509/// a breaking change. Applications should write their code in anticipation of:
19510///
19511/// - New values appearing in future releases of the client library, **and**
19512/// - New values received dynamically, without application changes.
19513///
19514/// Please consult the [Working with enums] section in the user guide for some
19515/// guidelines.
19516///
19517/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19518#[derive(Clone, Debug, PartialEq)]
19519#[non_exhaustive]
19520pub enum EventType {
19521    /// Unspecified value. Do not use.
19522    Unspecified,
19523    /// If included in `supported_events`,
19524    /// the extension is called when the HTTP request headers arrive.
19525    RequestHeaders,
19526    /// If included in `supported_events`,
19527    /// the extension is called when the HTTP request body arrives.
19528    RequestBody,
19529    /// If included in `supported_events`,
19530    /// the extension is called when the HTTP response headers arrive.
19531    ResponseHeaders,
19532    /// If included in `supported_events`,
19533    /// the extension is called when the HTTP response body arrives.
19534    ResponseBody,
19535    /// If included in `supported_events`,
19536    /// the extension is called when the HTTP request trailers arrives.
19537    RequestTrailers,
19538    /// If included in `supported_events`,
19539    /// the extension is called when the HTTP response trailers arrives.
19540    ResponseTrailers,
19541    /// If set, the enum was initialized with an unknown value.
19542    ///
19543    /// Applications can examine the value using [EventType::value] or
19544    /// [EventType::name].
19545    UnknownValue(event_type::UnknownValue),
19546}
19547
19548#[doc(hidden)]
19549pub mod event_type {
19550    #[allow(unused_imports)]
19551    use super::*;
19552    #[derive(Clone, Debug, PartialEq)]
19553    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19554}
19555
19556impl EventType {
19557    /// Gets the enum value.
19558    ///
19559    /// Returns `None` if the enum contains an unknown value deserialized from
19560    /// the string representation of enums.
19561    pub fn value(&self) -> std::option::Option<i32> {
19562        match self {
19563            Self::Unspecified => std::option::Option::Some(0),
19564            Self::RequestHeaders => std::option::Option::Some(1),
19565            Self::RequestBody => std::option::Option::Some(2),
19566            Self::ResponseHeaders => std::option::Option::Some(3),
19567            Self::ResponseBody => std::option::Option::Some(4),
19568            Self::RequestTrailers => std::option::Option::Some(5),
19569            Self::ResponseTrailers => std::option::Option::Some(6),
19570            Self::UnknownValue(u) => u.0.value(),
19571        }
19572    }
19573
19574    /// Gets the enum value as a string.
19575    ///
19576    /// Returns `None` if the enum contains an unknown value deserialized from
19577    /// the integer representation of enums.
19578    pub fn name(&self) -> std::option::Option<&str> {
19579        match self {
19580            Self::Unspecified => std::option::Option::Some("EVENT_TYPE_UNSPECIFIED"),
19581            Self::RequestHeaders => std::option::Option::Some("REQUEST_HEADERS"),
19582            Self::RequestBody => std::option::Option::Some("REQUEST_BODY"),
19583            Self::ResponseHeaders => std::option::Option::Some("RESPONSE_HEADERS"),
19584            Self::ResponseBody => std::option::Option::Some("RESPONSE_BODY"),
19585            Self::RequestTrailers => std::option::Option::Some("REQUEST_TRAILERS"),
19586            Self::ResponseTrailers => std::option::Option::Some("RESPONSE_TRAILERS"),
19587            Self::UnknownValue(u) => u.0.name(),
19588        }
19589    }
19590}
19591
19592impl std::default::Default for EventType {
19593    fn default() -> Self {
19594        use std::convert::From;
19595        Self::from(0)
19596    }
19597}
19598
19599impl std::fmt::Display for EventType {
19600    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19601        wkt::internal::display_enum(f, self.name(), self.value())
19602    }
19603}
19604
19605impl std::convert::From<i32> for EventType {
19606    fn from(value: i32) -> Self {
19607        match value {
19608            0 => Self::Unspecified,
19609            1 => Self::RequestHeaders,
19610            2 => Self::RequestBody,
19611            3 => Self::ResponseHeaders,
19612            4 => Self::ResponseBody,
19613            5 => Self::RequestTrailers,
19614            6 => Self::ResponseTrailers,
19615            _ => Self::UnknownValue(event_type::UnknownValue(
19616                wkt::internal::UnknownEnumValue::Integer(value),
19617            )),
19618        }
19619    }
19620}
19621
19622impl std::convert::From<&str> for EventType {
19623    fn from(value: &str) -> Self {
19624        use std::string::ToString;
19625        match value {
19626            "EVENT_TYPE_UNSPECIFIED" => Self::Unspecified,
19627            "REQUEST_HEADERS" => Self::RequestHeaders,
19628            "REQUEST_BODY" => Self::RequestBody,
19629            "RESPONSE_HEADERS" => Self::ResponseHeaders,
19630            "RESPONSE_BODY" => Self::ResponseBody,
19631            "REQUEST_TRAILERS" => Self::RequestTrailers,
19632            "RESPONSE_TRAILERS" => Self::ResponseTrailers,
19633            _ => Self::UnknownValue(event_type::UnknownValue(
19634                wkt::internal::UnknownEnumValue::String(value.to_string()),
19635            )),
19636        }
19637    }
19638}
19639
19640impl serde::ser::Serialize for EventType {
19641    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19642    where
19643        S: serde::Serializer,
19644    {
19645        match self {
19646            Self::Unspecified => serializer.serialize_i32(0),
19647            Self::RequestHeaders => serializer.serialize_i32(1),
19648            Self::RequestBody => serializer.serialize_i32(2),
19649            Self::ResponseHeaders => serializer.serialize_i32(3),
19650            Self::ResponseBody => serializer.serialize_i32(4),
19651            Self::RequestTrailers => serializer.serialize_i32(5),
19652            Self::ResponseTrailers => serializer.serialize_i32(6),
19653            Self::UnknownValue(u) => u.0.serialize(serializer),
19654        }
19655    }
19656}
19657
19658impl<'de> serde::de::Deserialize<'de> for EventType {
19659    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19660    where
19661        D: serde::Deserializer<'de>,
19662    {
19663        deserializer.deserialize_any(wkt::internal::EnumVisitor::<EventType>::new(
19664            ".google.cloud.networkservices.v1.EventType",
19665        ))
19666    }
19667}
19668
19669/// Load balancing schemes supported by the `LbTrafficExtension`,
19670/// `LbRouteExtension`, and `LbEdgeExtension` resources.
19671/// For more information, refer to [Backend services
19672/// overview](https://cloud.google.com/load-balancing/docs/backend-service).
19673///
19674/// # Working with unknown values
19675///
19676/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19677/// additional enum variants at any time. Adding new variants is not considered
19678/// a breaking change. Applications should write their code in anticipation of:
19679///
19680/// - New values appearing in future releases of the client library, **and**
19681/// - New values received dynamically, without application changes.
19682///
19683/// Please consult the [Working with enums] section in the user guide for some
19684/// guidelines.
19685///
19686/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19687#[derive(Clone, Debug, PartialEq)]
19688#[non_exhaustive]
19689pub enum LoadBalancingScheme {
19690    /// Default value. Do not use.
19691    Unspecified,
19692    /// Signifies that this is used for Internal HTTP(S) Load Balancing.
19693    InternalManaged,
19694    /// Signifies that this is used for External Managed HTTP(S) Load
19695    /// Balancing.
19696    ExternalManaged,
19697    /// If set, the enum was initialized with an unknown value.
19698    ///
19699    /// Applications can examine the value using [LoadBalancingScheme::value] or
19700    /// [LoadBalancingScheme::name].
19701    UnknownValue(load_balancing_scheme::UnknownValue),
19702}
19703
19704#[doc(hidden)]
19705pub mod load_balancing_scheme {
19706    #[allow(unused_imports)]
19707    use super::*;
19708    #[derive(Clone, Debug, PartialEq)]
19709    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19710}
19711
19712impl LoadBalancingScheme {
19713    /// Gets the enum value.
19714    ///
19715    /// Returns `None` if the enum contains an unknown value deserialized from
19716    /// the string representation of enums.
19717    pub fn value(&self) -> std::option::Option<i32> {
19718        match self {
19719            Self::Unspecified => std::option::Option::Some(0),
19720            Self::InternalManaged => std::option::Option::Some(1),
19721            Self::ExternalManaged => std::option::Option::Some(2),
19722            Self::UnknownValue(u) => u.0.value(),
19723        }
19724    }
19725
19726    /// Gets the enum value as a string.
19727    ///
19728    /// Returns `None` if the enum contains an unknown value deserialized from
19729    /// the integer representation of enums.
19730    pub fn name(&self) -> std::option::Option<&str> {
19731        match self {
19732            Self::Unspecified => std::option::Option::Some("LOAD_BALANCING_SCHEME_UNSPECIFIED"),
19733            Self::InternalManaged => std::option::Option::Some("INTERNAL_MANAGED"),
19734            Self::ExternalManaged => std::option::Option::Some("EXTERNAL_MANAGED"),
19735            Self::UnknownValue(u) => u.0.name(),
19736        }
19737    }
19738}
19739
19740impl std::default::Default for LoadBalancingScheme {
19741    fn default() -> Self {
19742        use std::convert::From;
19743        Self::from(0)
19744    }
19745}
19746
19747impl std::fmt::Display for LoadBalancingScheme {
19748    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19749        wkt::internal::display_enum(f, self.name(), self.value())
19750    }
19751}
19752
19753impl std::convert::From<i32> for LoadBalancingScheme {
19754    fn from(value: i32) -> Self {
19755        match value {
19756            0 => Self::Unspecified,
19757            1 => Self::InternalManaged,
19758            2 => Self::ExternalManaged,
19759            _ => Self::UnknownValue(load_balancing_scheme::UnknownValue(
19760                wkt::internal::UnknownEnumValue::Integer(value),
19761            )),
19762        }
19763    }
19764}
19765
19766impl std::convert::From<&str> for LoadBalancingScheme {
19767    fn from(value: &str) -> Self {
19768        use std::string::ToString;
19769        match value {
19770            "LOAD_BALANCING_SCHEME_UNSPECIFIED" => Self::Unspecified,
19771            "INTERNAL_MANAGED" => Self::InternalManaged,
19772            "EXTERNAL_MANAGED" => Self::ExternalManaged,
19773            _ => Self::UnknownValue(load_balancing_scheme::UnknownValue(
19774                wkt::internal::UnknownEnumValue::String(value.to_string()),
19775            )),
19776        }
19777    }
19778}
19779
19780impl serde::ser::Serialize for LoadBalancingScheme {
19781    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19782    where
19783        S: serde::Serializer,
19784    {
19785        match self {
19786            Self::Unspecified => serializer.serialize_i32(0),
19787            Self::InternalManaged => serializer.serialize_i32(1),
19788            Self::ExternalManaged => serializer.serialize_i32(2),
19789            Self::UnknownValue(u) => u.0.serialize(serializer),
19790        }
19791    }
19792}
19793
19794impl<'de> serde::de::Deserialize<'de> for LoadBalancingScheme {
19795    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19796    where
19797        D: serde::Deserializer<'de>,
19798    {
19799        deserializer.deserialize_any(wkt::internal::EnumVisitor::<LoadBalancingScheme>::new(
19800            ".google.cloud.networkservices.v1.LoadBalancingScheme",
19801        ))
19802    }
19803}
19804
19805/// The format of communication supported by the extension.
19806///
19807/// # Working with unknown values
19808///
19809/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19810/// additional enum variants at any time. Adding new variants is not considered
19811/// a breaking change. Applications should write their code in anticipation of:
19812///
19813/// - New values appearing in future releases of the client library, **and**
19814/// - New values received dynamically, without application changes.
19815///
19816/// Please consult the [Working with enums] section in the user guide for some
19817/// guidelines.
19818///
19819/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19820#[derive(Clone, Debug, PartialEq)]
19821#[non_exhaustive]
19822pub enum WireFormat {
19823    /// Not specified.
19824    Unspecified,
19825    /// The extension service uses ext_proc gRPC API over a gRPC stream. This is
19826    /// the default value if the wire format is not specified. The backend service
19827    /// for the extension must use HTTP2 or H2C as the protocol. All
19828    /// `supported_events` for a client request are sent as part of the same
19829    /// gRPC stream.
19830    ExtProcGrpc,
19831    /// If set, the enum was initialized with an unknown value.
19832    ///
19833    /// Applications can examine the value using [WireFormat::value] or
19834    /// [WireFormat::name].
19835    UnknownValue(wire_format::UnknownValue),
19836}
19837
19838#[doc(hidden)]
19839pub mod wire_format {
19840    #[allow(unused_imports)]
19841    use super::*;
19842    #[derive(Clone, Debug, PartialEq)]
19843    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19844}
19845
19846impl WireFormat {
19847    /// Gets the enum value.
19848    ///
19849    /// Returns `None` if the enum contains an unknown value deserialized from
19850    /// the string representation of enums.
19851    pub fn value(&self) -> std::option::Option<i32> {
19852        match self {
19853            Self::Unspecified => std::option::Option::Some(0),
19854            Self::ExtProcGrpc => std::option::Option::Some(1),
19855            Self::UnknownValue(u) => u.0.value(),
19856        }
19857    }
19858
19859    /// Gets the enum value as a string.
19860    ///
19861    /// Returns `None` if the enum contains an unknown value deserialized from
19862    /// the integer representation of enums.
19863    pub fn name(&self) -> std::option::Option<&str> {
19864        match self {
19865            Self::Unspecified => std::option::Option::Some("WIRE_FORMAT_UNSPECIFIED"),
19866            Self::ExtProcGrpc => std::option::Option::Some("EXT_PROC_GRPC"),
19867            Self::UnknownValue(u) => u.0.name(),
19868        }
19869    }
19870}
19871
19872impl std::default::Default for WireFormat {
19873    fn default() -> Self {
19874        use std::convert::From;
19875        Self::from(0)
19876    }
19877}
19878
19879impl std::fmt::Display for WireFormat {
19880    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19881        wkt::internal::display_enum(f, self.name(), self.value())
19882    }
19883}
19884
19885impl std::convert::From<i32> for WireFormat {
19886    fn from(value: i32) -> Self {
19887        match value {
19888            0 => Self::Unspecified,
19889            1 => Self::ExtProcGrpc,
19890            _ => Self::UnknownValue(wire_format::UnknownValue(
19891                wkt::internal::UnknownEnumValue::Integer(value),
19892            )),
19893        }
19894    }
19895}
19896
19897impl std::convert::From<&str> for WireFormat {
19898    fn from(value: &str) -> Self {
19899        use std::string::ToString;
19900        match value {
19901            "WIRE_FORMAT_UNSPECIFIED" => Self::Unspecified,
19902            "EXT_PROC_GRPC" => Self::ExtProcGrpc,
19903            _ => Self::UnknownValue(wire_format::UnknownValue(
19904                wkt::internal::UnknownEnumValue::String(value.to_string()),
19905            )),
19906        }
19907    }
19908}
19909
19910impl serde::ser::Serialize for WireFormat {
19911    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19912    where
19913        S: serde::Serializer,
19914    {
19915        match self {
19916            Self::Unspecified => serializer.serialize_i32(0),
19917            Self::ExtProcGrpc => serializer.serialize_i32(1),
19918            Self::UnknownValue(u) => u.0.serialize(serializer),
19919        }
19920    }
19921}
19922
19923impl<'de> serde::de::Deserialize<'de> for WireFormat {
19924    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19925    where
19926        D: serde::Deserializer<'de>,
19927    {
19928        deserializer.deserialize_any(wkt::internal::EnumVisitor::<WireFormat>::new(
19929            ".google.cloud.networkservices.v1.WireFormat",
19930        ))
19931    }
19932}
19933
19934/// Determines the information that should be returned by the server.
19935///
19936/// # Working with unknown values
19937///
19938/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19939/// additional enum variants at any time. Adding new variants is not considered
19940/// a breaking change. Applications should write their code in anticipation of:
19941///
19942/// - New values appearing in future releases of the client library, **and**
19943/// - New values received dynamically, without application changes.
19944///
19945/// Please consult the [Working with enums] section in the user guide for some
19946/// guidelines.
19947///
19948/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19949#[derive(Clone, Debug, PartialEq)]
19950#[non_exhaustive]
19951pub enum WasmPluginView {
19952    /// Unspecified value. Do not use.
19953    Unspecified,
19954    /// If specified in the `GET` request for a `WasmPlugin` resource, the server's
19955    /// response includes just the `WasmPlugin` resource.
19956    Basic,
19957    /// If specified in the `GET` request for a `WasmPlugin` resource, the server's
19958    /// response includes the `WasmPlugin` resource with all its versions.
19959    Full,
19960    /// If set, the enum was initialized with an unknown value.
19961    ///
19962    /// Applications can examine the value using [WasmPluginView::value] or
19963    /// [WasmPluginView::name].
19964    UnknownValue(wasm_plugin_view::UnknownValue),
19965}
19966
19967#[doc(hidden)]
19968pub mod wasm_plugin_view {
19969    #[allow(unused_imports)]
19970    use super::*;
19971    #[derive(Clone, Debug, PartialEq)]
19972    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19973}
19974
19975impl WasmPluginView {
19976    /// Gets the enum value.
19977    ///
19978    /// Returns `None` if the enum contains an unknown value deserialized from
19979    /// the string representation of enums.
19980    pub fn value(&self) -> std::option::Option<i32> {
19981        match self {
19982            Self::Unspecified => std::option::Option::Some(0),
19983            Self::Basic => std::option::Option::Some(1),
19984            Self::Full => std::option::Option::Some(2),
19985            Self::UnknownValue(u) => u.0.value(),
19986        }
19987    }
19988
19989    /// Gets the enum value as a string.
19990    ///
19991    /// Returns `None` if the enum contains an unknown value deserialized from
19992    /// the integer representation of enums.
19993    pub fn name(&self) -> std::option::Option<&str> {
19994        match self {
19995            Self::Unspecified => std::option::Option::Some("WASM_PLUGIN_VIEW_UNSPECIFIED"),
19996            Self::Basic => std::option::Option::Some("WASM_PLUGIN_VIEW_BASIC"),
19997            Self::Full => std::option::Option::Some("WASM_PLUGIN_VIEW_FULL"),
19998            Self::UnknownValue(u) => u.0.name(),
19999        }
20000    }
20001}
20002
20003impl std::default::Default for WasmPluginView {
20004    fn default() -> Self {
20005        use std::convert::From;
20006        Self::from(0)
20007    }
20008}
20009
20010impl std::fmt::Display for WasmPluginView {
20011    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20012        wkt::internal::display_enum(f, self.name(), self.value())
20013    }
20014}
20015
20016impl std::convert::From<i32> for WasmPluginView {
20017    fn from(value: i32) -> Self {
20018        match value {
20019            0 => Self::Unspecified,
20020            1 => Self::Basic,
20021            2 => Self::Full,
20022            _ => Self::UnknownValue(wasm_plugin_view::UnknownValue(
20023                wkt::internal::UnknownEnumValue::Integer(value),
20024            )),
20025        }
20026    }
20027}
20028
20029impl std::convert::From<&str> for WasmPluginView {
20030    fn from(value: &str) -> Self {
20031        use std::string::ToString;
20032        match value {
20033            "WASM_PLUGIN_VIEW_UNSPECIFIED" => Self::Unspecified,
20034            "WASM_PLUGIN_VIEW_BASIC" => Self::Basic,
20035            "WASM_PLUGIN_VIEW_FULL" => Self::Full,
20036            _ => Self::UnknownValue(wasm_plugin_view::UnknownValue(
20037                wkt::internal::UnknownEnumValue::String(value.to_string()),
20038            )),
20039        }
20040    }
20041}
20042
20043impl serde::ser::Serialize for WasmPluginView {
20044    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20045    where
20046        S: serde::Serializer,
20047    {
20048        match self {
20049            Self::Unspecified => serializer.serialize_i32(0),
20050            Self::Basic => serializer.serialize_i32(1),
20051            Self::Full => serializer.serialize_i32(2),
20052            Self::UnknownValue(u) => u.0.serialize(serializer),
20053        }
20054    }
20055}
20056
20057impl<'de> serde::de::Deserialize<'de> for WasmPluginView {
20058    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20059    where
20060        D: serde::Deserializer<'de>,
20061    {
20062        deserializer.deserialize_any(wkt::internal::EnumVisitor::<WasmPluginView>::new(
20063            ".google.cloud.networkservices.v1.WasmPluginView",
20064        ))
20065    }
20066}