Skip to main content

google_cloud_networksecurity_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 lazy_static;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36mod debug;
37mod deserialize;
38mod serialize;
39
40/// AddressGroup is a resource that specifies how a collection of IP/DNS used
41/// in Firewall Policy.
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct AddressGroup {
45    /// Required. Name of the AddressGroup resource. It matches pattern
46    /// `projects/*/locations/{location}/addressGroups/<address_group>`.
47    pub name: std::string::String,
48
49    /// Optional. Free-text description of the resource.
50    pub description: std::string::String,
51
52    /// Output only. The timestamp when the resource was created.
53    pub create_time: std::option::Option<wkt::Timestamp>,
54
55    /// Output only. The timestamp when the resource was updated.
56    pub update_time: std::option::Option<wkt::Timestamp>,
57
58    /// Optional. Set of label tags associated with the AddressGroup resource.
59    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
60
61    /// Required. The type of the Address Group. Possible values are "IPv4" or
62    /// "IPV6".
63    pub r#type: crate::model::address_group::Type,
64
65    /// Optional. List of items.
66    pub items: std::vec::Vec<std::string::String>,
67
68    /// Required. Capacity of the Address Group
69    pub capacity: i32,
70
71    /// Output only. Server-defined fully-qualified URL for this resource.
72    pub self_link: std::string::String,
73
74    /// Optional. List of supported purposes of the Address Group.
75    pub purpose: std::vec::Vec<crate::model::address_group::Purpose>,
76
77    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
78}
79
80impl AddressGroup {
81    pub fn new() -> Self {
82        std::default::Default::default()
83    }
84
85    /// Sets the value of [name][crate::model::AddressGroup::name].
86    ///
87    /// # Example
88    /// ```ignore,no_run
89    /// # use google_cloud_networksecurity_v1::model::AddressGroup;
90    /// let x = AddressGroup::new().set_name("example");
91    /// ```
92    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
93        self.name = v.into();
94        self
95    }
96
97    /// Sets the value of [description][crate::model::AddressGroup::description].
98    ///
99    /// # Example
100    /// ```ignore,no_run
101    /// # use google_cloud_networksecurity_v1::model::AddressGroup;
102    /// let x = AddressGroup::new().set_description("example");
103    /// ```
104    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
105        self.description = v.into();
106        self
107    }
108
109    /// Sets the value of [create_time][crate::model::AddressGroup::create_time].
110    ///
111    /// # Example
112    /// ```ignore,no_run
113    /// # use google_cloud_networksecurity_v1::model::AddressGroup;
114    /// use wkt::Timestamp;
115    /// let x = AddressGroup::new().set_create_time(Timestamp::default()/* use setters */);
116    /// ```
117    pub fn set_create_time<T>(mut self, v: T) -> Self
118    where
119        T: std::convert::Into<wkt::Timestamp>,
120    {
121        self.create_time = std::option::Option::Some(v.into());
122        self
123    }
124
125    /// Sets or clears the value of [create_time][crate::model::AddressGroup::create_time].
126    ///
127    /// # Example
128    /// ```ignore,no_run
129    /// # use google_cloud_networksecurity_v1::model::AddressGroup;
130    /// use wkt::Timestamp;
131    /// let x = AddressGroup::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
132    /// let x = AddressGroup::new().set_or_clear_create_time(None::<Timestamp>);
133    /// ```
134    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
135    where
136        T: std::convert::Into<wkt::Timestamp>,
137    {
138        self.create_time = v.map(|x| x.into());
139        self
140    }
141
142    /// Sets the value of [update_time][crate::model::AddressGroup::update_time].
143    ///
144    /// # Example
145    /// ```ignore,no_run
146    /// # use google_cloud_networksecurity_v1::model::AddressGroup;
147    /// use wkt::Timestamp;
148    /// let x = AddressGroup::new().set_update_time(Timestamp::default()/* use setters */);
149    /// ```
150    pub fn set_update_time<T>(mut self, v: T) -> Self
151    where
152        T: std::convert::Into<wkt::Timestamp>,
153    {
154        self.update_time = std::option::Option::Some(v.into());
155        self
156    }
157
158    /// Sets or clears the value of [update_time][crate::model::AddressGroup::update_time].
159    ///
160    /// # Example
161    /// ```ignore,no_run
162    /// # use google_cloud_networksecurity_v1::model::AddressGroup;
163    /// use wkt::Timestamp;
164    /// let x = AddressGroup::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
165    /// let x = AddressGroup::new().set_or_clear_update_time(None::<Timestamp>);
166    /// ```
167    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
168    where
169        T: std::convert::Into<wkt::Timestamp>,
170    {
171        self.update_time = v.map(|x| x.into());
172        self
173    }
174
175    /// Sets the value of [labels][crate::model::AddressGroup::labels].
176    ///
177    /// # Example
178    /// ```ignore,no_run
179    /// # use google_cloud_networksecurity_v1::model::AddressGroup;
180    /// let x = AddressGroup::new().set_labels([
181    ///     ("key0", "abc"),
182    ///     ("key1", "xyz"),
183    /// ]);
184    /// ```
185    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
186    where
187        T: std::iter::IntoIterator<Item = (K, V)>,
188        K: std::convert::Into<std::string::String>,
189        V: std::convert::Into<std::string::String>,
190    {
191        use std::iter::Iterator;
192        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
193        self
194    }
195
196    /// Sets the value of [r#type][crate::model::AddressGroup::type].
197    ///
198    /// # Example
199    /// ```ignore,no_run
200    /// # use google_cloud_networksecurity_v1::model::AddressGroup;
201    /// use google_cloud_networksecurity_v1::model::address_group::Type;
202    /// let x0 = AddressGroup::new().set_type(Type::Ipv4);
203    /// let x1 = AddressGroup::new().set_type(Type::Ipv6);
204    /// ```
205    pub fn set_type<T: std::convert::Into<crate::model::address_group::Type>>(
206        mut self,
207        v: T,
208    ) -> Self {
209        self.r#type = v.into();
210        self
211    }
212
213    /// Sets the value of [items][crate::model::AddressGroup::items].
214    ///
215    /// # Example
216    /// ```ignore,no_run
217    /// # use google_cloud_networksecurity_v1::model::AddressGroup;
218    /// let x = AddressGroup::new().set_items(["a", "b", "c"]);
219    /// ```
220    pub fn set_items<T, V>(mut self, v: T) -> Self
221    where
222        T: std::iter::IntoIterator<Item = V>,
223        V: std::convert::Into<std::string::String>,
224    {
225        use std::iter::Iterator;
226        self.items = v.into_iter().map(|i| i.into()).collect();
227        self
228    }
229
230    /// Sets the value of [capacity][crate::model::AddressGroup::capacity].
231    ///
232    /// # Example
233    /// ```ignore,no_run
234    /// # use google_cloud_networksecurity_v1::model::AddressGroup;
235    /// let x = AddressGroup::new().set_capacity(42);
236    /// ```
237    pub fn set_capacity<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
238        self.capacity = v.into();
239        self
240    }
241
242    /// Sets the value of [self_link][crate::model::AddressGroup::self_link].
243    ///
244    /// # Example
245    /// ```ignore,no_run
246    /// # use google_cloud_networksecurity_v1::model::AddressGroup;
247    /// let x = AddressGroup::new().set_self_link("example");
248    /// ```
249    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
250        self.self_link = v.into();
251        self
252    }
253
254    /// Sets the value of [purpose][crate::model::AddressGroup::purpose].
255    ///
256    /// # Example
257    /// ```ignore,no_run
258    /// # use google_cloud_networksecurity_v1::model::AddressGroup;
259    /// use google_cloud_networksecurity_v1::model::address_group::Purpose;
260    /// let x = AddressGroup::new().set_purpose([
261    ///     Purpose::Default,
262    ///     Purpose::CloudArmor,
263    /// ]);
264    /// ```
265    pub fn set_purpose<T, V>(mut self, v: T) -> Self
266    where
267        T: std::iter::IntoIterator<Item = V>,
268        V: std::convert::Into<crate::model::address_group::Purpose>,
269    {
270        use std::iter::Iterator;
271        self.purpose = v.into_iter().map(|i| i.into()).collect();
272        self
273    }
274}
275
276impl wkt::message::Message for AddressGroup {
277    fn typename() -> &'static str {
278        "type.googleapis.com/google.cloud.networksecurity.v1.AddressGroup"
279    }
280}
281
282/// Defines additional types related to [AddressGroup].
283pub mod address_group {
284    #[allow(unused_imports)]
285    use super::*;
286
287    /// Possible type of the Address Group.
288    ///
289    /// # Working with unknown values
290    ///
291    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
292    /// additional enum variants at any time. Adding new variants is not considered
293    /// a breaking change. Applications should write their code in anticipation of:
294    ///
295    /// - New values appearing in future releases of the client library, **and**
296    /// - New values received dynamically, without application changes.
297    ///
298    /// Please consult the [Working with enums] section in the user guide for some
299    /// guidelines.
300    ///
301    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
302    #[derive(Clone, Debug, PartialEq)]
303    #[non_exhaustive]
304    pub enum Type {
305        /// Default value.
306        Unspecified,
307        /// IP v4 ranges.
308        Ipv4,
309        /// IP v6 ranges.
310        Ipv6,
311        /// If set, the enum was initialized with an unknown value.
312        ///
313        /// Applications can examine the value using [Type::value] or
314        /// [Type::name].
315        UnknownValue(r#type::UnknownValue),
316    }
317
318    #[doc(hidden)]
319    pub mod r#type {
320        #[allow(unused_imports)]
321        use super::*;
322        #[derive(Clone, Debug, PartialEq)]
323        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
324    }
325
326    impl Type {
327        /// Gets the enum value.
328        ///
329        /// Returns `None` if the enum contains an unknown value deserialized from
330        /// the string representation of enums.
331        pub fn value(&self) -> std::option::Option<i32> {
332            match self {
333                Self::Unspecified => std::option::Option::Some(0),
334                Self::Ipv4 => std::option::Option::Some(1),
335                Self::Ipv6 => std::option::Option::Some(2),
336                Self::UnknownValue(u) => u.0.value(),
337            }
338        }
339
340        /// Gets the enum value as a string.
341        ///
342        /// Returns `None` if the enum contains an unknown value deserialized from
343        /// the integer representation of enums.
344        pub fn name(&self) -> std::option::Option<&str> {
345            match self {
346                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
347                Self::Ipv4 => std::option::Option::Some("IPV4"),
348                Self::Ipv6 => std::option::Option::Some("IPV6"),
349                Self::UnknownValue(u) => u.0.name(),
350            }
351        }
352    }
353
354    impl std::default::Default for Type {
355        fn default() -> Self {
356            use std::convert::From;
357            Self::from(0)
358        }
359    }
360
361    impl std::fmt::Display for Type {
362        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
363            wkt::internal::display_enum(f, self.name(), self.value())
364        }
365    }
366
367    impl std::convert::From<i32> for Type {
368        fn from(value: i32) -> Self {
369            match value {
370                0 => Self::Unspecified,
371                1 => Self::Ipv4,
372                2 => Self::Ipv6,
373                _ => Self::UnknownValue(r#type::UnknownValue(
374                    wkt::internal::UnknownEnumValue::Integer(value),
375                )),
376            }
377        }
378    }
379
380    impl std::convert::From<&str> for Type {
381        fn from(value: &str) -> Self {
382            use std::string::ToString;
383            match value {
384                "TYPE_UNSPECIFIED" => Self::Unspecified,
385                "IPV4" => Self::Ipv4,
386                "IPV6" => Self::Ipv6,
387                _ => Self::UnknownValue(r#type::UnknownValue(
388                    wkt::internal::UnknownEnumValue::String(value.to_string()),
389                )),
390            }
391        }
392    }
393
394    impl serde::ser::Serialize for Type {
395        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
396        where
397            S: serde::Serializer,
398        {
399            match self {
400                Self::Unspecified => serializer.serialize_i32(0),
401                Self::Ipv4 => serializer.serialize_i32(1),
402                Self::Ipv6 => serializer.serialize_i32(2),
403                Self::UnknownValue(u) => u.0.serialize(serializer),
404            }
405        }
406    }
407
408    impl<'de> serde::de::Deserialize<'de> for Type {
409        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
410        where
411            D: serde::Deserializer<'de>,
412        {
413            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
414                ".google.cloud.networksecurity.v1.AddressGroup.Type",
415            ))
416        }
417    }
418
419    /// Purpose of the Address Group.
420    ///
421    /// # Working with unknown values
422    ///
423    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
424    /// additional enum variants at any time. Adding new variants is not considered
425    /// a breaking change. Applications should write their code in anticipation of:
426    ///
427    /// - New values appearing in future releases of the client library, **and**
428    /// - New values received dynamically, without application changes.
429    ///
430    /// Please consult the [Working with enums] section in the user guide for some
431    /// guidelines.
432    ///
433    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
434    #[derive(Clone, Debug, PartialEq)]
435    #[non_exhaustive]
436    pub enum Purpose {
437        /// Default value. Should never happen.
438        Unspecified,
439        /// Address Group is distributed to VMC, and is usable in Firewall Policies
440        /// and other systems that rely on VMC.
441        Default,
442        /// Address Group is usable in Cloud Armor.
443        CloudArmor,
444        /// If set, the enum was initialized with an unknown value.
445        ///
446        /// Applications can examine the value using [Purpose::value] or
447        /// [Purpose::name].
448        UnknownValue(purpose::UnknownValue),
449    }
450
451    #[doc(hidden)]
452    pub mod purpose {
453        #[allow(unused_imports)]
454        use super::*;
455        #[derive(Clone, Debug, PartialEq)]
456        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
457    }
458
459    impl Purpose {
460        /// Gets the enum value.
461        ///
462        /// Returns `None` if the enum contains an unknown value deserialized from
463        /// the string representation of enums.
464        pub fn value(&self) -> std::option::Option<i32> {
465            match self {
466                Self::Unspecified => std::option::Option::Some(0),
467                Self::Default => std::option::Option::Some(1),
468                Self::CloudArmor => std::option::Option::Some(2),
469                Self::UnknownValue(u) => u.0.value(),
470            }
471        }
472
473        /// Gets the enum value as a string.
474        ///
475        /// Returns `None` if the enum contains an unknown value deserialized from
476        /// the integer representation of enums.
477        pub fn name(&self) -> std::option::Option<&str> {
478            match self {
479                Self::Unspecified => std::option::Option::Some("PURPOSE_UNSPECIFIED"),
480                Self::Default => std::option::Option::Some("DEFAULT"),
481                Self::CloudArmor => std::option::Option::Some("CLOUD_ARMOR"),
482                Self::UnknownValue(u) => u.0.name(),
483            }
484        }
485    }
486
487    impl std::default::Default for Purpose {
488        fn default() -> Self {
489            use std::convert::From;
490            Self::from(0)
491        }
492    }
493
494    impl std::fmt::Display for Purpose {
495        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
496            wkt::internal::display_enum(f, self.name(), self.value())
497        }
498    }
499
500    impl std::convert::From<i32> for Purpose {
501        fn from(value: i32) -> Self {
502            match value {
503                0 => Self::Unspecified,
504                1 => Self::Default,
505                2 => Self::CloudArmor,
506                _ => Self::UnknownValue(purpose::UnknownValue(
507                    wkt::internal::UnknownEnumValue::Integer(value),
508                )),
509            }
510        }
511    }
512
513    impl std::convert::From<&str> for Purpose {
514        fn from(value: &str) -> Self {
515            use std::string::ToString;
516            match value {
517                "PURPOSE_UNSPECIFIED" => Self::Unspecified,
518                "DEFAULT" => Self::Default,
519                "CLOUD_ARMOR" => Self::CloudArmor,
520                _ => Self::UnknownValue(purpose::UnknownValue(
521                    wkt::internal::UnknownEnumValue::String(value.to_string()),
522                )),
523            }
524        }
525    }
526
527    impl serde::ser::Serialize for Purpose {
528        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
529        where
530            S: serde::Serializer,
531        {
532            match self {
533                Self::Unspecified => serializer.serialize_i32(0),
534                Self::Default => serializer.serialize_i32(1),
535                Self::CloudArmor => serializer.serialize_i32(2),
536                Self::UnknownValue(u) => u.0.serialize(serializer),
537            }
538        }
539    }
540
541    impl<'de> serde::de::Deserialize<'de> for Purpose {
542        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
543        where
544            D: serde::Deserializer<'de>,
545        {
546            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Purpose>::new(
547                ".google.cloud.networksecurity.v1.AddressGroup.Purpose",
548            ))
549        }
550    }
551}
552
553/// Request used with the ListAddressGroups method.
554#[derive(Clone, Default, PartialEq)]
555#[non_exhaustive]
556pub struct ListAddressGroupsRequest {
557    /// Required. The project and location from which the AddressGroups
558    /// should be listed, specified in the format
559    /// `projects/*/locations/{location}`.
560    pub parent: std::string::String,
561
562    /// Maximum number of AddressGroups to return per call.
563    pub page_size: i32,
564
565    /// The value returned by the last
566    /// `ListAddressGroupsResponse` Indicates that this is a
567    /// continuation of a prior `ListAddressGroups` call, and
568    /// that the system should return the next page of data.
569    pub page_token: std::string::String,
570
571    /// Optional. If true, allow partial responses for multi-regional Aggregated
572    /// List requests.
573    pub return_partial_success: bool,
574
575    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
576}
577
578impl ListAddressGroupsRequest {
579    pub fn new() -> Self {
580        std::default::Default::default()
581    }
582
583    /// Sets the value of [parent][crate::model::ListAddressGroupsRequest::parent].
584    ///
585    /// # Example
586    /// ```ignore,no_run
587    /// # use google_cloud_networksecurity_v1::model::ListAddressGroupsRequest;
588    /// let x = ListAddressGroupsRequest::new().set_parent("example");
589    /// ```
590    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
591        self.parent = v.into();
592        self
593    }
594
595    /// Sets the value of [page_size][crate::model::ListAddressGroupsRequest::page_size].
596    ///
597    /// # Example
598    /// ```ignore,no_run
599    /// # use google_cloud_networksecurity_v1::model::ListAddressGroupsRequest;
600    /// let x = ListAddressGroupsRequest::new().set_page_size(42);
601    /// ```
602    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
603        self.page_size = v.into();
604        self
605    }
606
607    /// Sets the value of [page_token][crate::model::ListAddressGroupsRequest::page_token].
608    ///
609    /// # Example
610    /// ```ignore,no_run
611    /// # use google_cloud_networksecurity_v1::model::ListAddressGroupsRequest;
612    /// let x = ListAddressGroupsRequest::new().set_page_token("example");
613    /// ```
614    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
615        self.page_token = v.into();
616        self
617    }
618
619    /// Sets the value of [return_partial_success][crate::model::ListAddressGroupsRequest::return_partial_success].
620    ///
621    /// # Example
622    /// ```ignore,no_run
623    /// # use google_cloud_networksecurity_v1::model::ListAddressGroupsRequest;
624    /// let x = ListAddressGroupsRequest::new().set_return_partial_success(true);
625    /// ```
626    pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
627        self.return_partial_success = v.into();
628        self
629    }
630}
631
632impl wkt::message::Message for ListAddressGroupsRequest {
633    fn typename() -> &'static str {
634        "type.googleapis.com/google.cloud.networksecurity.v1.ListAddressGroupsRequest"
635    }
636}
637
638/// Response returned by the ListAddressGroups method.
639#[derive(Clone, Default, PartialEq)]
640#[non_exhaustive]
641pub struct ListAddressGroupsResponse {
642    /// List of AddressGroups resources.
643    pub address_groups: std::vec::Vec<crate::model::AddressGroup>,
644
645    /// If there might be more results than those appearing in this response, then
646    /// `next_page_token` is included. To get the next set of results, call this
647    /// method again using the value of `next_page_token` as `page_token`.
648    pub next_page_token: std::string::String,
649
650    /// Locations that could not be reached.
651    pub unreachable: std::vec::Vec<std::string::String>,
652
653    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
654}
655
656impl ListAddressGroupsResponse {
657    pub fn new() -> Self {
658        std::default::Default::default()
659    }
660
661    /// Sets the value of [address_groups][crate::model::ListAddressGroupsResponse::address_groups].
662    ///
663    /// # Example
664    /// ```ignore,no_run
665    /// # use google_cloud_networksecurity_v1::model::ListAddressGroupsResponse;
666    /// use google_cloud_networksecurity_v1::model::AddressGroup;
667    /// let x = ListAddressGroupsResponse::new()
668    ///     .set_address_groups([
669    ///         AddressGroup::default()/* use setters */,
670    ///         AddressGroup::default()/* use (different) setters */,
671    ///     ]);
672    /// ```
673    pub fn set_address_groups<T, V>(mut self, v: T) -> Self
674    where
675        T: std::iter::IntoIterator<Item = V>,
676        V: std::convert::Into<crate::model::AddressGroup>,
677    {
678        use std::iter::Iterator;
679        self.address_groups = v.into_iter().map(|i| i.into()).collect();
680        self
681    }
682
683    /// Sets the value of [next_page_token][crate::model::ListAddressGroupsResponse::next_page_token].
684    ///
685    /// # Example
686    /// ```ignore,no_run
687    /// # use google_cloud_networksecurity_v1::model::ListAddressGroupsResponse;
688    /// let x = ListAddressGroupsResponse::new().set_next_page_token("example");
689    /// ```
690    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
691        self.next_page_token = v.into();
692        self
693    }
694
695    /// Sets the value of [unreachable][crate::model::ListAddressGroupsResponse::unreachable].
696    ///
697    /// # Example
698    /// ```ignore,no_run
699    /// # use google_cloud_networksecurity_v1::model::ListAddressGroupsResponse;
700    /// let x = ListAddressGroupsResponse::new().set_unreachable(["a", "b", "c"]);
701    /// ```
702    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
703    where
704        T: std::iter::IntoIterator<Item = V>,
705        V: std::convert::Into<std::string::String>,
706    {
707        use std::iter::Iterator;
708        self.unreachable = v.into_iter().map(|i| i.into()).collect();
709        self
710    }
711}
712
713impl wkt::message::Message for ListAddressGroupsResponse {
714    fn typename() -> &'static str {
715        "type.googleapis.com/google.cloud.networksecurity.v1.ListAddressGroupsResponse"
716    }
717}
718
719#[doc(hidden)]
720impl google_cloud_gax::paginator::internal::PageableResponse for ListAddressGroupsResponse {
721    type PageItem = crate::model::AddressGroup;
722
723    fn items(self) -> std::vec::Vec<Self::PageItem> {
724        self.address_groups
725    }
726
727    fn next_page_token(&self) -> std::string::String {
728        use std::clone::Clone;
729        self.next_page_token.clone()
730    }
731}
732
733/// Request used by the GetAddressGroup method.
734#[derive(Clone, Default, PartialEq)]
735#[non_exhaustive]
736pub struct GetAddressGroupRequest {
737    /// Required. A name of the AddressGroup to get. Must be in the format
738    /// `projects/*/locations/{location}/addressGroups/*`.
739    pub name: std::string::String,
740
741    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
742}
743
744impl GetAddressGroupRequest {
745    pub fn new() -> Self {
746        std::default::Default::default()
747    }
748
749    /// Sets the value of [name][crate::model::GetAddressGroupRequest::name].
750    ///
751    /// # Example
752    /// ```ignore,no_run
753    /// # use google_cloud_networksecurity_v1::model::GetAddressGroupRequest;
754    /// let x = GetAddressGroupRequest::new().set_name("example");
755    /// ```
756    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
757        self.name = v.into();
758        self
759    }
760}
761
762impl wkt::message::Message for GetAddressGroupRequest {
763    fn typename() -> &'static str {
764        "type.googleapis.com/google.cloud.networksecurity.v1.GetAddressGroupRequest"
765    }
766}
767
768/// Request used by the CreateAddressGroup method.
769#[derive(Clone, Default, PartialEq)]
770#[non_exhaustive]
771pub struct CreateAddressGroupRequest {
772    /// Required. The parent resource of the AddressGroup. Must be in the
773    /// format `projects/*/locations/{location}`.
774    pub parent: std::string::String,
775
776    /// Required. Short name of the AddressGroup resource to be created.
777    /// This value should be 1-63 characters long, containing only
778    /// letters, numbers, hyphens, and underscores, and should not start
779    /// with a number. E.g. "authz_policy".
780    pub address_group_id: std::string::String,
781
782    /// Required. AddressGroup resource to be created.
783    pub address_group: std::option::Option<crate::model::AddressGroup>,
784
785    /// Optional. An optional request ID to identify requests. Specify a unique
786    /// request ID so that if you must retry your request, the server will know to
787    /// ignore the request if it has already been completed. The server will
788    /// guarantee that for at least 60 minutes since the first request.
789    ///
790    /// For example, consider a situation where you make an initial request and
791    /// the request times out. If you make the request again with the same request
792    /// ID, the server can check if original operation with the same request ID
793    /// was received, and if so, will ignore the second request. This prevents
794    /// clients from accidentally creating duplicate commitments.
795    ///
796    /// The request ID must be a valid UUID with the exception that zero UUID is
797    /// not supported (00000000-0000-0000-0000-000000000000).
798    pub request_id: std::string::String,
799
800    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
801}
802
803impl CreateAddressGroupRequest {
804    pub fn new() -> Self {
805        std::default::Default::default()
806    }
807
808    /// Sets the value of [parent][crate::model::CreateAddressGroupRequest::parent].
809    ///
810    /// # Example
811    /// ```ignore,no_run
812    /// # use google_cloud_networksecurity_v1::model::CreateAddressGroupRequest;
813    /// let x = CreateAddressGroupRequest::new().set_parent("example");
814    /// ```
815    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
816        self.parent = v.into();
817        self
818    }
819
820    /// Sets the value of [address_group_id][crate::model::CreateAddressGroupRequest::address_group_id].
821    ///
822    /// # Example
823    /// ```ignore,no_run
824    /// # use google_cloud_networksecurity_v1::model::CreateAddressGroupRequest;
825    /// let x = CreateAddressGroupRequest::new().set_address_group_id("example");
826    /// ```
827    pub fn set_address_group_id<T: std::convert::Into<std::string::String>>(
828        mut self,
829        v: T,
830    ) -> Self {
831        self.address_group_id = v.into();
832        self
833    }
834
835    /// Sets the value of [address_group][crate::model::CreateAddressGroupRequest::address_group].
836    ///
837    /// # Example
838    /// ```ignore,no_run
839    /// # use google_cloud_networksecurity_v1::model::CreateAddressGroupRequest;
840    /// use google_cloud_networksecurity_v1::model::AddressGroup;
841    /// let x = CreateAddressGroupRequest::new().set_address_group(AddressGroup::default()/* use setters */);
842    /// ```
843    pub fn set_address_group<T>(mut self, v: T) -> Self
844    where
845        T: std::convert::Into<crate::model::AddressGroup>,
846    {
847        self.address_group = std::option::Option::Some(v.into());
848        self
849    }
850
851    /// Sets or clears the value of [address_group][crate::model::CreateAddressGroupRequest::address_group].
852    ///
853    /// # Example
854    /// ```ignore,no_run
855    /// # use google_cloud_networksecurity_v1::model::CreateAddressGroupRequest;
856    /// use google_cloud_networksecurity_v1::model::AddressGroup;
857    /// let x = CreateAddressGroupRequest::new().set_or_clear_address_group(Some(AddressGroup::default()/* use setters */));
858    /// let x = CreateAddressGroupRequest::new().set_or_clear_address_group(None::<AddressGroup>);
859    /// ```
860    pub fn set_or_clear_address_group<T>(mut self, v: std::option::Option<T>) -> Self
861    where
862        T: std::convert::Into<crate::model::AddressGroup>,
863    {
864        self.address_group = v.map(|x| x.into());
865        self
866    }
867
868    /// Sets the value of [request_id][crate::model::CreateAddressGroupRequest::request_id].
869    ///
870    /// # Example
871    /// ```ignore,no_run
872    /// # use google_cloud_networksecurity_v1::model::CreateAddressGroupRequest;
873    /// let x = CreateAddressGroupRequest::new().set_request_id("example");
874    /// ```
875    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
876        self.request_id = v.into();
877        self
878    }
879}
880
881impl wkt::message::Message for CreateAddressGroupRequest {
882    fn typename() -> &'static str {
883        "type.googleapis.com/google.cloud.networksecurity.v1.CreateAddressGroupRequest"
884    }
885}
886
887/// Request used by the UpdateAddressGroup method.
888#[derive(Clone, Default, PartialEq)]
889#[non_exhaustive]
890pub struct UpdateAddressGroupRequest {
891    /// Optional. Field mask is used to specify the fields to be overwritten in the
892    /// AddressGroup resource by the update.
893    /// The fields specified in the update_mask are relative to the resource, not
894    /// the full request. A field will be overwritten if it is in the mask. If the
895    /// user does not provide a mask then all fields will be overwritten.
896    pub update_mask: std::option::Option<wkt::FieldMask>,
897
898    /// Required. Updated AddressGroup resource.
899    pub address_group: std::option::Option<crate::model::AddressGroup>,
900
901    /// Optional. An optional request ID to identify requests. Specify a unique
902    /// request ID so that if you must retry your request, the server will know to
903    /// ignore the request if it has already been completed. The server will
904    /// guarantee that for at least 60 minutes since the first request.
905    ///
906    /// For example, consider a situation where you make an initial request and
907    /// the request times out. If you make the request again with the same request
908    /// ID, the server can check if original operation with the same request ID
909    /// was received, and if so, will ignore the second request. This prevents
910    /// clients from accidentally creating duplicate commitments.
911    ///
912    /// The request ID must be a valid UUID with the exception that zero UUID is
913    /// not supported (00000000-0000-0000-0000-000000000000).
914    pub request_id: std::string::String,
915
916    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
917}
918
919impl UpdateAddressGroupRequest {
920    pub fn new() -> Self {
921        std::default::Default::default()
922    }
923
924    /// Sets the value of [update_mask][crate::model::UpdateAddressGroupRequest::update_mask].
925    ///
926    /// # Example
927    /// ```ignore,no_run
928    /// # use google_cloud_networksecurity_v1::model::UpdateAddressGroupRequest;
929    /// use wkt::FieldMask;
930    /// let x = UpdateAddressGroupRequest::new().set_update_mask(FieldMask::default()/* use setters */);
931    /// ```
932    pub fn set_update_mask<T>(mut self, v: T) -> Self
933    where
934        T: std::convert::Into<wkt::FieldMask>,
935    {
936        self.update_mask = std::option::Option::Some(v.into());
937        self
938    }
939
940    /// Sets or clears the value of [update_mask][crate::model::UpdateAddressGroupRequest::update_mask].
941    ///
942    /// # Example
943    /// ```ignore,no_run
944    /// # use google_cloud_networksecurity_v1::model::UpdateAddressGroupRequest;
945    /// use wkt::FieldMask;
946    /// let x = UpdateAddressGroupRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
947    /// let x = UpdateAddressGroupRequest::new().set_or_clear_update_mask(None::<FieldMask>);
948    /// ```
949    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
950    where
951        T: std::convert::Into<wkt::FieldMask>,
952    {
953        self.update_mask = v.map(|x| x.into());
954        self
955    }
956
957    /// Sets the value of [address_group][crate::model::UpdateAddressGroupRequest::address_group].
958    ///
959    /// # Example
960    /// ```ignore,no_run
961    /// # use google_cloud_networksecurity_v1::model::UpdateAddressGroupRequest;
962    /// use google_cloud_networksecurity_v1::model::AddressGroup;
963    /// let x = UpdateAddressGroupRequest::new().set_address_group(AddressGroup::default()/* use setters */);
964    /// ```
965    pub fn set_address_group<T>(mut self, v: T) -> Self
966    where
967        T: std::convert::Into<crate::model::AddressGroup>,
968    {
969        self.address_group = std::option::Option::Some(v.into());
970        self
971    }
972
973    /// Sets or clears the value of [address_group][crate::model::UpdateAddressGroupRequest::address_group].
974    ///
975    /// # Example
976    /// ```ignore,no_run
977    /// # use google_cloud_networksecurity_v1::model::UpdateAddressGroupRequest;
978    /// use google_cloud_networksecurity_v1::model::AddressGroup;
979    /// let x = UpdateAddressGroupRequest::new().set_or_clear_address_group(Some(AddressGroup::default()/* use setters */));
980    /// let x = UpdateAddressGroupRequest::new().set_or_clear_address_group(None::<AddressGroup>);
981    /// ```
982    pub fn set_or_clear_address_group<T>(mut self, v: std::option::Option<T>) -> Self
983    where
984        T: std::convert::Into<crate::model::AddressGroup>,
985    {
986        self.address_group = v.map(|x| x.into());
987        self
988    }
989
990    /// Sets the value of [request_id][crate::model::UpdateAddressGroupRequest::request_id].
991    ///
992    /// # Example
993    /// ```ignore,no_run
994    /// # use google_cloud_networksecurity_v1::model::UpdateAddressGroupRequest;
995    /// let x = UpdateAddressGroupRequest::new().set_request_id("example");
996    /// ```
997    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
998        self.request_id = v.into();
999        self
1000    }
1001}
1002
1003impl wkt::message::Message for UpdateAddressGroupRequest {
1004    fn typename() -> &'static str {
1005        "type.googleapis.com/google.cloud.networksecurity.v1.UpdateAddressGroupRequest"
1006    }
1007}
1008
1009/// Request used by the DeleteAddressGroup method.
1010#[derive(Clone, Default, PartialEq)]
1011#[non_exhaustive]
1012pub struct DeleteAddressGroupRequest {
1013    /// Required. A name of the AddressGroup to delete. Must be in the format
1014    /// `projects/*/locations/{location}/addressGroups/*`.
1015    pub name: std::string::String,
1016
1017    /// Optional. An optional request ID to identify requests. Specify a unique
1018    /// request ID so that if you must retry your request, the server will know to
1019    /// ignore the request if it has already been completed. The server will
1020    /// guarantee that for at least 60 minutes since the first request.
1021    ///
1022    /// For example, consider a situation where you make an initial request and
1023    /// the request times out. If you make the request again with the same request
1024    /// ID, the server can check if original operation with the same request ID
1025    /// was received, and if so, will ignore the second request. This prevents
1026    /// clients from accidentally creating duplicate commitments.
1027    ///
1028    /// The request ID must be a valid UUID with the exception that zero UUID is
1029    /// not supported (00000000-0000-0000-0000-000000000000).
1030    pub request_id: std::string::String,
1031
1032    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1033}
1034
1035impl DeleteAddressGroupRequest {
1036    pub fn new() -> Self {
1037        std::default::Default::default()
1038    }
1039
1040    /// Sets the value of [name][crate::model::DeleteAddressGroupRequest::name].
1041    ///
1042    /// # Example
1043    /// ```ignore,no_run
1044    /// # use google_cloud_networksecurity_v1::model::DeleteAddressGroupRequest;
1045    /// let x = DeleteAddressGroupRequest::new().set_name("example");
1046    /// ```
1047    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1048        self.name = v.into();
1049        self
1050    }
1051
1052    /// Sets the value of [request_id][crate::model::DeleteAddressGroupRequest::request_id].
1053    ///
1054    /// # Example
1055    /// ```ignore,no_run
1056    /// # use google_cloud_networksecurity_v1::model::DeleteAddressGroupRequest;
1057    /// let x = DeleteAddressGroupRequest::new().set_request_id("example");
1058    /// ```
1059    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1060        self.request_id = v.into();
1061        self
1062    }
1063}
1064
1065impl wkt::message::Message for DeleteAddressGroupRequest {
1066    fn typename() -> &'static str {
1067        "type.googleapis.com/google.cloud.networksecurity.v1.DeleteAddressGroupRequest"
1068    }
1069}
1070
1071/// Request used by the AddAddressGroupItems method.
1072#[derive(Clone, Default, PartialEq)]
1073#[non_exhaustive]
1074pub struct AddAddressGroupItemsRequest {
1075    /// Required. A name of the AddressGroup to add items to. Must be in the format
1076    /// `projects|organization/*/locations/{location}/addressGroups/*`.
1077    pub address_group: std::string::String,
1078
1079    /// Required. List of items to add.
1080    pub items: std::vec::Vec<std::string::String>,
1081
1082    /// Optional. An optional request ID to identify requests. Specify a unique
1083    /// request ID so that if you must retry your request, the server will know to
1084    /// ignore the request if it has already been completed. The server will
1085    /// guarantee that for at least 60 minutes since the first request.
1086    ///
1087    /// For example, consider a situation where you make an initial request and
1088    /// the request times out. If you make the request again with the same request
1089    /// ID, the server can check if original operation with the same request ID
1090    /// was received, and if so, will ignore the second request. This prevents
1091    /// clients from accidentally creating duplicate commitments.
1092    ///
1093    /// The request ID must be a valid UUID with the exception that zero UUID is
1094    /// not supported (00000000-0000-0000-0000-000000000000).
1095    pub request_id: std::string::String,
1096
1097    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1098}
1099
1100impl AddAddressGroupItemsRequest {
1101    pub fn new() -> Self {
1102        std::default::Default::default()
1103    }
1104
1105    /// Sets the value of [address_group][crate::model::AddAddressGroupItemsRequest::address_group].
1106    ///
1107    /// # Example
1108    /// ```ignore,no_run
1109    /// # use google_cloud_networksecurity_v1::model::AddAddressGroupItemsRequest;
1110    /// let x = AddAddressGroupItemsRequest::new().set_address_group("example");
1111    /// ```
1112    pub fn set_address_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1113        self.address_group = v.into();
1114        self
1115    }
1116
1117    /// Sets the value of [items][crate::model::AddAddressGroupItemsRequest::items].
1118    ///
1119    /// # Example
1120    /// ```ignore,no_run
1121    /// # use google_cloud_networksecurity_v1::model::AddAddressGroupItemsRequest;
1122    /// let x = AddAddressGroupItemsRequest::new().set_items(["a", "b", "c"]);
1123    /// ```
1124    pub fn set_items<T, V>(mut self, v: T) -> Self
1125    where
1126        T: std::iter::IntoIterator<Item = V>,
1127        V: std::convert::Into<std::string::String>,
1128    {
1129        use std::iter::Iterator;
1130        self.items = v.into_iter().map(|i| i.into()).collect();
1131        self
1132    }
1133
1134    /// Sets the value of [request_id][crate::model::AddAddressGroupItemsRequest::request_id].
1135    ///
1136    /// # Example
1137    /// ```ignore,no_run
1138    /// # use google_cloud_networksecurity_v1::model::AddAddressGroupItemsRequest;
1139    /// let x = AddAddressGroupItemsRequest::new().set_request_id("example");
1140    /// ```
1141    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1142        self.request_id = v.into();
1143        self
1144    }
1145}
1146
1147impl wkt::message::Message for AddAddressGroupItemsRequest {
1148    fn typename() -> &'static str {
1149        "type.googleapis.com/google.cloud.networksecurity.v1.AddAddressGroupItemsRequest"
1150    }
1151}
1152
1153/// Request used by the RemoveAddressGroupItems method.
1154#[derive(Clone, Default, PartialEq)]
1155#[non_exhaustive]
1156pub struct RemoveAddressGroupItemsRequest {
1157    /// Required. A name of the AddressGroup to remove items from. Must be in the
1158    /// format `projects|organization/*/locations/{location}/addressGroups/*`.
1159    pub address_group: std::string::String,
1160
1161    /// Required. List of items to remove.
1162    pub items: std::vec::Vec<std::string::String>,
1163
1164    /// Optional. An optional request ID to identify requests. Specify a unique
1165    /// request ID so that if you must retry your request, the server will know to
1166    /// ignore the request if it has already been completed. The server will
1167    /// guarantee that for at least 60 minutes since the first request.
1168    ///
1169    /// For example, consider a situation where you make an initial request and
1170    /// the request times out. If you make the request again with the same request
1171    /// ID, the server can check if original operation with the same request ID
1172    /// was received, and if so, will ignore the second request. This prevents
1173    /// clients from accidentally creating duplicate commitments.
1174    ///
1175    /// The request ID must be a valid UUID with the exception that zero UUID is
1176    /// not supported (00000000-0000-0000-0000-000000000000).
1177    pub request_id: std::string::String,
1178
1179    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1180}
1181
1182impl RemoveAddressGroupItemsRequest {
1183    pub fn new() -> Self {
1184        std::default::Default::default()
1185    }
1186
1187    /// Sets the value of [address_group][crate::model::RemoveAddressGroupItemsRequest::address_group].
1188    ///
1189    /// # Example
1190    /// ```ignore,no_run
1191    /// # use google_cloud_networksecurity_v1::model::RemoveAddressGroupItemsRequest;
1192    /// let x = RemoveAddressGroupItemsRequest::new().set_address_group("example");
1193    /// ```
1194    pub fn set_address_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1195        self.address_group = v.into();
1196        self
1197    }
1198
1199    /// Sets the value of [items][crate::model::RemoveAddressGroupItemsRequest::items].
1200    ///
1201    /// # Example
1202    /// ```ignore,no_run
1203    /// # use google_cloud_networksecurity_v1::model::RemoveAddressGroupItemsRequest;
1204    /// let x = RemoveAddressGroupItemsRequest::new().set_items(["a", "b", "c"]);
1205    /// ```
1206    pub fn set_items<T, V>(mut self, v: T) -> Self
1207    where
1208        T: std::iter::IntoIterator<Item = V>,
1209        V: std::convert::Into<std::string::String>,
1210    {
1211        use std::iter::Iterator;
1212        self.items = v.into_iter().map(|i| i.into()).collect();
1213        self
1214    }
1215
1216    /// Sets the value of [request_id][crate::model::RemoveAddressGroupItemsRequest::request_id].
1217    ///
1218    /// # Example
1219    /// ```ignore,no_run
1220    /// # use google_cloud_networksecurity_v1::model::RemoveAddressGroupItemsRequest;
1221    /// let x = RemoveAddressGroupItemsRequest::new().set_request_id("example");
1222    /// ```
1223    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1224        self.request_id = v.into();
1225        self
1226    }
1227}
1228
1229impl wkt::message::Message for RemoveAddressGroupItemsRequest {
1230    fn typename() -> &'static str {
1231        "type.googleapis.com/google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest"
1232    }
1233}
1234
1235/// Request used by the CloneAddressGroupItems method.
1236#[derive(Clone, Default, PartialEq)]
1237#[non_exhaustive]
1238pub struct CloneAddressGroupItemsRequest {
1239    /// Required. A name of the AddressGroup to clone items to. Must be in the
1240    /// format `projects|organization/*/locations/{location}/addressGroups/*`.
1241    pub address_group: std::string::String,
1242
1243    /// Required. Source address group to clone items from.
1244    pub source_address_group: std::string::String,
1245
1246    /// Optional. An optional request ID to identify requests. Specify a unique
1247    /// request ID so that if you must retry your request, the server will know to
1248    /// ignore the request if it has already been completed. The server will
1249    /// guarantee that for at least 60 minutes since the first request.
1250    ///
1251    /// For example, consider a situation where you make an initial request and
1252    /// the request times out. If you make the request again with the same request
1253    /// ID, the server can check if original operation with the same request ID
1254    /// was received, and if so, will ignore the second request. This prevents
1255    /// clients from accidentally creating duplicate commitments.
1256    ///
1257    /// The request ID must be a valid UUID with the exception that zero UUID is
1258    /// not supported (00000000-0000-0000-0000-000000000000).
1259    pub request_id: std::string::String,
1260
1261    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1262}
1263
1264impl CloneAddressGroupItemsRequest {
1265    pub fn new() -> Self {
1266        std::default::Default::default()
1267    }
1268
1269    /// Sets the value of [address_group][crate::model::CloneAddressGroupItemsRequest::address_group].
1270    ///
1271    /// # Example
1272    /// ```ignore,no_run
1273    /// # use google_cloud_networksecurity_v1::model::CloneAddressGroupItemsRequest;
1274    /// let x = CloneAddressGroupItemsRequest::new().set_address_group("example");
1275    /// ```
1276    pub fn set_address_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1277        self.address_group = v.into();
1278        self
1279    }
1280
1281    /// Sets the value of [source_address_group][crate::model::CloneAddressGroupItemsRequest::source_address_group].
1282    ///
1283    /// # Example
1284    /// ```ignore,no_run
1285    /// # use google_cloud_networksecurity_v1::model::CloneAddressGroupItemsRequest;
1286    /// let x = CloneAddressGroupItemsRequest::new().set_source_address_group("example");
1287    /// ```
1288    pub fn set_source_address_group<T: std::convert::Into<std::string::String>>(
1289        mut self,
1290        v: T,
1291    ) -> Self {
1292        self.source_address_group = v.into();
1293        self
1294    }
1295
1296    /// Sets the value of [request_id][crate::model::CloneAddressGroupItemsRequest::request_id].
1297    ///
1298    /// # Example
1299    /// ```ignore,no_run
1300    /// # use google_cloud_networksecurity_v1::model::CloneAddressGroupItemsRequest;
1301    /// let x = CloneAddressGroupItemsRequest::new().set_request_id("example");
1302    /// ```
1303    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1304        self.request_id = v.into();
1305        self
1306    }
1307}
1308
1309impl wkt::message::Message for CloneAddressGroupItemsRequest {
1310    fn typename() -> &'static str {
1311        "type.googleapis.com/google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest"
1312    }
1313}
1314
1315/// Request used by the ListAddressGroupReferences method.
1316#[derive(Clone, Default, PartialEq)]
1317#[non_exhaustive]
1318pub struct ListAddressGroupReferencesRequest {
1319    /// Required. A name of the AddressGroup to clone items to. Must be in the
1320    /// format `projects|organization/*/locations/{location}/addressGroups/*`.
1321    pub address_group: std::string::String,
1322
1323    /// The maximum number of references to return.  If unspecified, server
1324    /// will pick an appropriate default. Server may return fewer items than
1325    /// requested. A caller should only rely on response's
1326    /// [next_page_token][google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.next_page_token]
1327    /// to determine if there are more AddressGroupUsers left to be queried.
1328    ///
1329    /// [google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.next_page_token]: crate::model::ListAddressGroupReferencesResponse::next_page_token
1330    pub page_size: i32,
1331
1332    /// The next_page_token value returned from a previous List request,
1333    /// if any.
1334    pub page_token: std::string::String,
1335
1336    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1337}
1338
1339impl ListAddressGroupReferencesRequest {
1340    pub fn new() -> Self {
1341        std::default::Default::default()
1342    }
1343
1344    /// Sets the value of [address_group][crate::model::ListAddressGroupReferencesRequest::address_group].
1345    ///
1346    /// # Example
1347    /// ```ignore,no_run
1348    /// # use google_cloud_networksecurity_v1::model::ListAddressGroupReferencesRequest;
1349    /// let x = ListAddressGroupReferencesRequest::new().set_address_group("example");
1350    /// ```
1351    pub fn set_address_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1352        self.address_group = v.into();
1353        self
1354    }
1355
1356    /// Sets the value of [page_size][crate::model::ListAddressGroupReferencesRequest::page_size].
1357    ///
1358    /// # Example
1359    /// ```ignore,no_run
1360    /// # use google_cloud_networksecurity_v1::model::ListAddressGroupReferencesRequest;
1361    /// let x = ListAddressGroupReferencesRequest::new().set_page_size(42);
1362    /// ```
1363    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1364        self.page_size = v.into();
1365        self
1366    }
1367
1368    /// Sets the value of [page_token][crate::model::ListAddressGroupReferencesRequest::page_token].
1369    ///
1370    /// # Example
1371    /// ```ignore,no_run
1372    /// # use google_cloud_networksecurity_v1::model::ListAddressGroupReferencesRequest;
1373    /// let x = ListAddressGroupReferencesRequest::new().set_page_token("example");
1374    /// ```
1375    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1376        self.page_token = v.into();
1377        self
1378    }
1379}
1380
1381impl wkt::message::Message for ListAddressGroupReferencesRequest {
1382    fn typename() -> &'static str {
1383        "type.googleapis.com/google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest"
1384    }
1385}
1386
1387/// Response of the ListAddressGroupReferences method.
1388#[derive(Clone, Default, PartialEq)]
1389#[non_exhaustive]
1390pub struct ListAddressGroupReferencesResponse {
1391    /// A list of references that matches the specified filter in the request.
1392    pub address_group_references:
1393        std::vec::Vec<crate::model::list_address_group_references_response::AddressGroupReference>,
1394
1395    /// If there might be more results than those appearing in this response, then
1396    /// `next_page_token` is included. To get the next set of results, call this
1397    /// method again using the value of `next_page_token` as `page_token`.
1398    pub next_page_token: std::string::String,
1399
1400    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1401}
1402
1403impl ListAddressGroupReferencesResponse {
1404    pub fn new() -> Self {
1405        std::default::Default::default()
1406    }
1407
1408    /// Sets the value of [address_group_references][crate::model::ListAddressGroupReferencesResponse::address_group_references].
1409    ///
1410    /// # Example
1411    /// ```ignore,no_run
1412    /// # use google_cloud_networksecurity_v1::model::ListAddressGroupReferencesResponse;
1413    /// use google_cloud_networksecurity_v1::model::list_address_group_references_response::AddressGroupReference;
1414    /// let x = ListAddressGroupReferencesResponse::new()
1415    ///     .set_address_group_references([
1416    ///         AddressGroupReference::default()/* use setters */,
1417    ///         AddressGroupReference::default()/* use (different) setters */,
1418    ///     ]);
1419    /// ```
1420    pub fn set_address_group_references<T, V>(mut self, v: T) -> Self
1421    where
1422        T: std::iter::IntoIterator<Item = V>,
1423        V: std::convert::Into<
1424                crate::model::list_address_group_references_response::AddressGroupReference,
1425            >,
1426    {
1427        use std::iter::Iterator;
1428        self.address_group_references = v.into_iter().map(|i| i.into()).collect();
1429        self
1430    }
1431
1432    /// Sets the value of [next_page_token][crate::model::ListAddressGroupReferencesResponse::next_page_token].
1433    ///
1434    /// # Example
1435    /// ```ignore,no_run
1436    /// # use google_cloud_networksecurity_v1::model::ListAddressGroupReferencesResponse;
1437    /// let x = ListAddressGroupReferencesResponse::new().set_next_page_token("example");
1438    /// ```
1439    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1440        self.next_page_token = v.into();
1441        self
1442    }
1443}
1444
1445impl wkt::message::Message for ListAddressGroupReferencesResponse {
1446    fn typename() -> &'static str {
1447        "type.googleapis.com/google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse"
1448    }
1449}
1450
1451#[doc(hidden)]
1452impl google_cloud_gax::paginator::internal::PageableResponse
1453    for ListAddressGroupReferencesResponse
1454{
1455    type PageItem = crate::model::list_address_group_references_response::AddressGroupReference;
1456
1457    fn items(self) -> std::vec::Vec<Self::PageItem> {
1458        self.address_group_references
1459    }
1460
1461    fn next_page_token(&self) -> std::string::String {
1462        use std::clone::Clone;
1463        self.next_page_token.clone()
1464    }
1465}
1466
1467/// Defines additional types related to [ListAddressGroupReferencesResponse].
1468pub mod list_address_group_references_response {
1469    #[allow(unused_imports)]
1470    use super::*;
1471
1472    /// The Reference of AddressGroup.
1473    #[derive(Clone, Default, PartialEq)]
1474    #[non_exhaustive]
1475    pub struct AddressGroupReference {
1476        /// FirewallPolicy that is using the Address Group.
1477        pub firewall_policy: std::string::String,
1478
1479        /// Cloud Armor SecurityPolicy that is using the Address Group.
1480        pub security_policy: std::string::String,
1481
1482        /// Rule priority of the FirewallPolicy that is using the Address Group.
1483        pub rule_priority: i32,
1484
1485        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1486    }
1487
1488    impl AddressGroupReference {
1489        pub fn new() -> Self {
1490            std::default::Default::default()
1491        }
1492
1493        /// Sets the value of [firewall_policy][crate::model::list_address_group_references_response::AddressGroupReference::firewall_policy].
1494        ///
1495        /// # Example
1496        /// ```ignore,no_run
1497        /// # use google_cloud_networksecurity_v1::model::list_address_group_references_response::AddressGroupReference;
1498        /// let x = AddressGroupReference::new().set_firewall_policy("example");
1499        /// ```
1500        pub fn set_firewall_policy<T: std::convert::Into<std::string::String>>(
1501            mut self,
1502            v: T,
1503        ) -> Self {
1504            self.firewall_policy = v.into();
1505            self
1506        }
1507
1508        /// Sets the value of [security_policy][crate::model::list_address_group_references_response::AddressGroupReference::security_policy].
1509        ///
1510        /// # Example
1511        /// ```ignore,no_run
1512        /// # use google_cloud_networksecurity_v1::model::list_address_group_references_response::AddressGroupReference;
1513        /// let x = AddressGroupReference::new().set_security_policy("example");
1514        /// ```
1515        pub fn set_security_policy<T: std::convert::Into<std::string::String>>(
1516            mut self,
1517            v: T,
1518        ) -> Self {
1519            self.security_policy = v.into();
1520            self
1521        }
1522
1523        /// Sets the value of [rule_priority][crate::model::list_address_group_references_response::AddressGroupReference::rule_priority].
1524        ///
1525        /// # Example
1526        /// ```ignore,no_run
1527        /// # use google_cloud_networksecurity_v1::model::list_address_group_references_response::AddressGroupReference;
1528        /// let x = AddressGroupReference::new().set_rule_priority(42);
1529        /// ```
1530        pub fn set_rule_priority<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1531            self.rule_priority = v.into();
1532            self
1533        }
1534    }
1535
1536    impl wkt::message::Message for AddressGroupReference {
1537        fn typename() -> &'static str {
1538            "type.googleapis.com/google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.AddressGroupReference"
1539        }
1540    }
1541}
1542
1543/// AuthorizationPolicy is a resource that specifies how a server
1544/// should authorize incoming connections. This resource in itself does
1545/// not change the configuration unless it's attached to a target https
1546/// proxy or endpoint config selector resource.
1547#[derive(Clone, Default, PartialEq)]
1548#[non_exhaustive]
1549pub struct AuthorizationPolicy {
1550    /// Required. Name of the AuthorizationPolicy resource. It matches pattern
1551    /// `projects/{project}/locations/{location}/authorizationPolicies/<authorization_policy>`.
1552    pub name: std::string::String,
1553
1554    /// Optional. Free-text description of the resource.
1555    pub description: std::string::String,
1556
1557    /// Output only. The timestamp when the resource was created.
1558    pub create_time: std::option::Option<wkt::Timestamp>,
1559
1560    /// Output only. The timestamp when the resource was updated.
1561    pub update_time: std::option::Option<wkt::Timestamp>,
1562
1563    /// Optional. Set of label tags associated with the AuthorizationPolicy resource.
1564    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1565
1566    /// Required. The action to take when a rule match is found. Possible values
1567    /// are "ALLOW" or "DENY".
1568    pub action: crate::model::authorization_policy::Action,
1569
1570    /// Optional. List of rules to match. Note that at least one of the rules must match in
1571    /// order for the action specified in the 'action' field to be taken. A rule is
1572    /// a match if there is a matching source and destination. If left blank, the
1573    /// action specified in the `action` field will be applied on every request.
1574    pub rules: std::vec::Vec<crate::model::authorization_policy::Rule>,
1575
1576    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1577}
1578
1579impl AuthorizationPolicy {
1580    pub fn new() -> Self {
1581        std::default::Default::default()
1582    }
1583
1584    /// Sets the value of [name][crate::model::AuthorizationPolicy::name].
1585    ///
1586    /// # Example
1587    /// ```ignore,no_run
1588    /// # use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
1589    /// let x = AuthorizationPolicy::new().set_name("example");
1590    /// ```
1591    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1592        self.name = v.into();
1593        self
1594    }
1595
1596    /// Sets the value of [description][crate::model::AuthorizationPolicy::description].
1597    ///
1598    /// # Example
1599    /// ```ignore,no_run
1600    /// # use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
1601    /// let x = AuthorizationPolicy::new().set_description("example");
1602    /// ```
1603    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1604        self.description = v.into();
1605        self
1606    }
1607
1608    /// Sets the value of [create_time][crate::model::AuthorizationPolicy::create_time].
1609    ///
1610    /// # Example
1611    /// ```ignore,no_run
1612    /// # use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
1613    /// use wkt::Timestamp;
1614    /// let x = AuthorizationPolicy::new().set_create_time(Timestamp::default()/* use setters */);
1615    /// ```
1616    pub fn set_create_time<T>(mut self, v: T) -> Self
1617    where
1618        T: std::convert::Into<wkt::Timestamp>,
1619    {
1620        self.create_time = std::option::Option::Some(v.into());
1621        self
1622    }
1623
1624    /// Sets or clears the value of [create_time][crate::model::AuthorizationPolicy::create_time].
1625    ///
1626    /// # Example
1627    /// ```ignore,no_run
1628    /// # use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
1629    /// use wkt::Timestamp;
1630    /// let x = AuthorizationPolicy::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1631    /// let x = AuthorizationPolicy::new().set_or_clear_create_time(None::<Timestamp>);
1632    /// ```
1633    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1634    where
1635        T: std::convert::Into<wkt::Timestamp>,
1636    {
1637        self.create_time = v.map(|x| x.into());
1638        self
1639    }
1640
1641    /// Sets the value of [update_time][crate::model::AuthorizationPolicy::update_time].
1642    ///
1643    /// # Example
1644    /// ```ignore,no_run
1645    /// # use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
1646    /// use wkt::Timestamp;
1647    /// let x = AuthorizationPolicy::new().set_update_time(Timestamp::default()/* use setters */);
1648    /// ```
1649    pub fn set_update_time<T>(mut self, v: T) -> Self
1650    where
1651        T: std::convert::Into<wkt::Timestamp>,
1652    {
1653        self.update_time = std::option::Option::Some(v.into());
1654        self
1655    }
1656
1657    /// Sets or clears the value of [update_time][crate::model::AuthorizationPolicy::update_time].
1658    ///
1659    /// # Example
1660    /// ```ignore,no_run
1661    /// # use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
1662    /// use wkt::Timestamp;
1663    /// let x = AuthorizationPolicy::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1664    /// let x = AuthorizationPolicy::new().set_or_clear_update_time(None::<Timestamp>);
1665    /// ```
1666    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1667    where
1668        T: std::convert::Into<wkt::Timestamp>,
1669    {
1670        self.update_time = v.map(|x| x.into());
1671        self
1672    }
1673
1674    /// Sets the value of [labels][crate::model::AuthorizationPolicy::labels].
1675    ///
1676    /// # Example
1677    /// ```ignore,no_run
1678    /// # use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
1679    /// let x = AuthorizationPolicy::new().set_labels([
1680    ///     ("key0", "abc"),
1681    ///     ("key1", "xyz"),
1682    /// ]);
1683    /// ```
1684    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1685    where
1686        T: std::iter::IntoIterator<Item = (K, V)>,
1687        K: std::convert::Into<std::string::String>,
1688        V: std::convert::Into<std::string::String>,
1689    {
1690        use std::iter::Iterator;
1691        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1692        self
1693    }
1694
1695    /// Sets the value of [action][crate::model::AuthorizationPolicy::action].
1696    ///
1697    /// # Example
1698    /// ```ignore,no_run
1699    /// # use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
1700    /// use google_cloud_networksecurity_v1::model::authorization_policy::Action;
1701    /// let x0 = AuthorizationPolicy::new().set_action(Action::Allow);
1702    /// let x1 = AuthorizationPolicy::new().set_action(Action::Deny);
1703    /// ```
1704    pub fn set_action<T: std::convert::Into<crate::model::authorization_policy::Action>>(
1705        mut self,
1706        v: T,
1707    ) -> Self {
1708        self.action = v.into();
1709        self
1710    }
1711
1712    /// Sets the value of [rules][crate::model::AuthorizationPolicy::rules].
1713    ///
1714    /// # Example
1715    /// ```ignore,no_run
1716    /// # use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
1717    /// use google_cloud_networksecurity_v1::model::authorization_policy::Rule;
1718    /// let x = AuthorizationPolicy::new()
1719    ///     .set_rules([
1720    ///         Rule::default()/* use setters */,
1721    ///         Rule::default()/* use (different) setters */,
1722    ///     ]);
1723    /// ```
1724    pub fn set_rules<T, V>(mut self, v: T) -> Self
1725    where
1726        T: std::iter::IntoIterator<Item = V>,
1727        V: std::convert::Into<crate::model::authorization_policy::Rule>,
1728    {
1729        use std::iter::Iterator;
1730        self.rules = v.into_iter().map(|i| i.into()).collect();
1731        self
1732    }
1733}
1734
1735impl wkt::message::Message for AuthorizationPolicy {
1736    fn typename() -> &'static str {
1737        "type.googleapis.com/google.cloud.networksecurity.v1.AuthorizationPolicy"
1738    }
1739}
1740
1741/// Defines additional types related to [AuthorizationPolicy].
1742pub mod authorization_policy {
1743    #[allow(unused_imports)]
1744    use super::*;
1745
1746    /// Specification of rules.
1747    #[derive(Clone, Default, PartialEq)]
1748    #[non_exhaustive]
1749    pub struct Rule {
1750        /// Optional. List of attributes for the traffic source. All of the sources must match.
1751        /// A source is a match if both principals and ip_blocks match. If not set,
1752        /// the action specified in the 'action' field will be applied without any
1753        /// rule checks for the source.
1754        pub sources: std::vec::Vec<crate::model::authorization_policy::rule::Source>,
1755
1756        /// Optional. List of attributes for the traffic destination. All of the destinations
1757        /// must match. A destination is a match if a request matches all the
1758        /// specified hosts, ports, methods and headers. If not set, the
1759        /// action specified in the 'action' field will be applied without any rule
1760        /// checks for the destination.
1761        pub destinations: std::vec::Vec<crate::model::authorization_policy::rule::Destination>,
1762
1763        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1764    }
1765
1766    impl Rule {
1767        pub fn new() -> Self {
1768            std::default::Default::default()
1769        }
1770
1771        /// Sets the value of [sources][crate::model::authorization_policy::Rule::sources].
1772        ///
1773        /// # Example
1774        /// ```ignore,no_run
1775        /// # use google_cloud_networksecurity_v1::model::authorization_policy::Rule;
1776        /// use google_cloud_networksecurity_v1::model::authorization_policy::rule::Source;
1777        /// let x = Rule::new()
1778        ///     .set_sources([
1779        ///         Source::default()/* use setters */,
1780        ///         Source::default()/* use (different) setters */,
1781        ///     ]);
1782        /// ```
1783        pub fn set_sources<T, V>(mut self, v: T) -> Self
1784        where
1785            T: std::iter::IntoIterator<Item = V>,
1786            V: std::convert::Into<crate::model::authorization_policy::rule::Source>,
1787        {
1788            use std::iter::Iterator;
1789            self.sources = v.into_iter().map(|i| i.into()).collect();
1790            self
1791        }
1792
1793        /// Sets the value of [destinations][crate::model::authorization_policy::Rule::destinations].
1794        ///
1795        /// # Example
1796        /// ```ignore,no_run
1797        /// # use google_cloud_networksecurity_v1::model::authorization_policy::Rule;
1798        /// use google_cloud_networksecurity_v1::model::authorization_policy::rule::Destination;
1799        /// let x = Rule::new()
1800        ///     .set_destinations([
1801        ///         Destination::default()/* use setters */,
1802        ///         Destination::default()/* use (different) setters */,
1803        ///     ]);
1804        /// ```
1805        pub fn set_destinations<T, V>(mut self, v: T) -> Self
1806        where
1807            T: std::iter::IntoIterator<Item = V>,
1808            V: std::convert::Into<crate::model::authorization_policy::rule::Destination>,
1809        {
1810            use std::iter::Iterator;
1811            self.destinations = v.into_iter().map(|i| i.into()).collect();
1812            self
1813        }
1814    }
1815
1816    impl wkt::message::Message for Rule {
1817        fn typename() -> &'static str {
1818            "type.googleapis.com/google.cloud.networksecurity.v1.AuthorizationPolicy.Rule"
1819        }
1820    }
1821
1822    /// Defines additional types related to [Rule].
1823    pub mod rule {
1824        #[allow(unused_imports)]
1825        use super::*;
1826
1827        /// Specification of traffic source attributes.
1828        #[derive(Clone, Default, PartialEq)]
1829        #[non_exhaustive]
1830        pub struct Source {
1831            /// Optional. List of peer identities to match for authorization. At least one
1832            /// principal should match. Each peer can be an exact match, or a prefix
1833            /// match (example, "namespace/*") or a suffix match (example,
1834            /// "*/service-account") or a presence match "*". Authorization based on
1835            /// the principal name without certificate validation (configured by
1836            /// ServerTlsPolicy resource) is considered insecure.
1837            pub principals: std::vec::Vec<std::string::String>,
1838
1839            /// Optional. List of CIDR ranges to match based on source IP address. At least one
1840            /// IP block should match. Single IP (e.g., "1.2.3.4") and CIDR (e.g.,
1841            /// "1.2.3.0/24") are supported. Authorization based on source IP alone
1842            /// should be avoided. The IP addresses of any load balancers or proxies
1843            /// should be considered untrusted.
1844            pub ip_blocks: std::vec::Vec<std::string::String>,
1845
1846            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1847        }
1848
1849        impl Source {
1850            pub fn new() -> Self {
1851                std::default::Default::default()
1852            }
1853
1854            /// Sets the value of [principals][crate::model::authorization_policy::rule::Source::principals].
1855            ///
1856            /// # Example
1857            /// ```ignore,no_run
1858            /// # use google_cloud_networksecurity_v1::model::authorization_policy::rule::Source;
1859            /// let x = Source::new().set_principals(["a", "b", "c"]);
1860            /// ```
1861            pub fn set_principals<T, V>(mut self, v: T) -> Self
1862            where
1863                T: std::iter::IntoIterator<Item = V>,
1864                V: std::convert::Into<std::string::String>,
1865            {
1866                use std::iter::Iterator;
1867                self.principals = v.into_iter().map(|i| i.into()).collect();
1868                self
1869            }
1870
1871            /// Sets the value of [ip_blocks][crate::model::authorization_policy::rule::Source::ip_blocks].
1872            ///
1873            /// # Example
1874            /// ```ignore,no_run
1875            /// # use google_cloud_networksecurity_v1::model::authorization_policy::rule::Source;
1876            /// let x = Source::new().set_ip_blocks(["a", "b", "c"]);
1877            /// ```
1878            pub fn set_ip_blocks<T, V>(mut self, v: T) -> Self
1879            where
1880                T: std::iter::IntoIterator<Item = V>,
1881                V: std::convert::Into<std::string::String>,
1882            {
1883                use std::iter::Iterator;
1884                self.ip_blocks = v.into_iter().map(|i| i.into()).collect();
1885                self
1886            }
1887        }
1888
1889        impl wkt::message::Message for Source {
1890            fn typename() -> &'static str {
1891                "type.googleapis.com/google.cloud.networksecurity.v1.AuthorizationPolicy.Rule.Source"
1892            }
1893        }
1894
1895        /// Specification of traffic destination attributes.
1896        #[derive(Clone, Default, PartialEq)]
1897        #[non_exhaustive]
1898        pub struct Destination {
1899            /// Required. List of host names to match. Matched against the ":authority" header in
1900            /// http requests. At least one host should match. Each host can be an
1901            /// exact match, or a prefix match (example "mydomain.*") or a suffix
1902            /// match (example "*.myorg.com") or a presence (any) match "*".
1903            pub hosts: std::vec::Vec<std::string::String>,
1904
1905            /// Required. List of destination ports to match. At least one port should match.
1906            pub ports: std::vec::Vec<u32>,
1907
1908            /// Optional. A list of HTTP methods to match. At least one method should
1909            /// match. Should not be set for gRPC services.
1910            pub methods: std::vec::Vec<std::string::String>,
1911
1912            /// Optional. Match against key:value pair in http header. Provides a flexible match
1913            /// based on HTTP headers, for potentially advanced use cases. At least one
1914            /// header should match. Avoid using header matches to make authorization
1915            /// decisions unless there is a strong guarantee that requests arrive
1916            /// through a trusted client or proxy.
1917            pub http_header_match: std::option::Option<
1918                crate::model::authorization_policy::rule::destination::HttpHeaderMatch,
1919            >,
1920
1921            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1922        }
1923
1924        impl Destination {
1925            pub fn new() -> Self {
1926                std::default::Default::default()
1927            }
1928
1929            /// Sets the value of [hosts][crate::model::authorization_policy::rule::Destination::hosts].
1930            ///
1931            /// # Example
1932            /// ```ignore,no_run
1933            /// # use google_cloud_networksecurity_v1::model::authorization_policy::rule::Destination;
1934            /// let x = Destination::new().set_hosts(["a", "b", "c"]);
1935            /// ```
1936            pub fn set_hosts<T, V>(mut self, v: T) -> Self
1937            where
1938                T: std::iter::IntoIterator<Item = V>,
1939                V: std::convert::Into<std::string::String>,
1940            {
1941                use std::iter::Iterator;
1942                self.hosts = v.into_iter().map(|i| i.into()).collect();
1943                self
1944            }
1945
1946            /// Sets the value of [ports][crate::model::authorization_policy::rule::Destination::ports].
1947            ///
1948            /// # Example
1949            /// ```ignore,no_run
1950            /// # use google_cloud_networksecurity_v1::model::authorization_policy::rule::Destination;
1951            /// let x = Destination::new().set_ports([1_u32, 2_u32, 3_u32]);
1952            /// ```
1953            pub fn set_ports<T, V>(mut self, v: T) -> Self
1954            where
1955                T: std::iter::IntoIterator<Item = V>,
1956                V: std::convert::Into<u32>,
1957            {
1958                use std::iter::Iterator;
1959                self.ports = v.into_iter().map(|i| i.into()).collect();
1960                self
1961            }
1962
1963            /// Sets the value of [methods][crate::model::authorization_policy::rule::Destination::methods].
1964            ///
1965            /// # Example
1966            /// ```ignore,no_run
1967            /// # use google_cloud_networksecurity_v1::model::authorization_policy::rule::Destination;
1968            /// let x = Destination::new().set_methods(["a", "b", "c"]);
1969            /// ```
1970            pub fn set_methods<T, V>(mut self, v: T) -> Self
1971            where
1972                T: std::iter::IntoIterator<Item = V>,
1973                V: std::convert::Into<std::string::String>,
1974            {
1975                use std::iter::Iterator;
1976                self.methods = v.into_iter().map(|i| i.into()).collect();
1977                self
1978            }
1979
1980            /// Sets the value of [http_header_match][crate::model::authorization_policy::rule::Destination::http_header_match].
1981            ///
1982            /// # Example
1983            /// ```ignore,no_run
1984            /// # use google_cloud_networksecurity_v1::model::authorization_policy::rule::Destination;
1985            /// use google_cloud_networksecurity_v1::model::authorization_policy::rule::destination::HttpHeaderMatch;
1986            /// let x = Destination::new().set_http_header_match(HttpHeaderMatch::default()/* use setters */);
1987            /// ```
1988            pub fn set_http_header_match<T>(mut self, v: T) -> Self
1989            where
1990                T: std::convert::Into<
1991                        crate::model::authorization_policy::rule::destination::HttpHeaderMatch,
1992                    >,
1993            {
1994                self.http_header_match = std::option::Option::Some(v.into());
1995                self
1996            }
1997
1998            /// Sets or clears the value of [http_header_match][crate::model::authorization_policy::rule::Destination::http_header_match].
1999            ///
2000            /// # Example
2001            /// ```ignore,no_run
2002            /// # use google_cloud_networksecurity_v1::model::authorization_policy::rule::Destination;
2003            /// use google_cloud_networksecurity_v1::model::authorization_policy::rule::destination::HttpHeaderMatch;
2004            /// let x = Destination::new().set_or_clear_http_header_match(Some(HttpHeaderMatch::default()/* use setters */));
2005            /// let x = Destination::new().set_or_clear_http_header_match(None::<HttpHeaderMatch>);
2006            /// ```
2007            pub fn set_or_clear_http_header_match<T>(mut self, v: std::option::Option<T>) -> Self
2008            where
2009                T: std::convert::Into<
2010                        crate::model::authorization_policy::rule::destination::HttpHeaderMatch,
2011                    >,
2012            {
2013                self.http_header_match = v.map(|x| x.into());
2014                self
2015            }
2016        }
2017
2018        impl wkt::message::Message for Destination {
2019            fn typename() -> &'static str {
2020                "type.googleapis.com/google.cloud.networksecurity.v1.AuthorizationPolicy.Rule.Destination"
2021            }
2022        }
2023
2024        /// Defines additional types related to [Destination].
2025        pub mod destination {
2026            #[allow(unused_imports)]
2027            use super::*;
2028
2029            /// Specification of HTTP header match attributes.
2030            #[derive(Clone, Default, PartialEq)]
2031            #[non_exhaustive]
2032            pub struct HttpHeaderMatch {
2033                /// Required. The name of the HTTP header to match. For matching
2034                /// against the HTTP request's authority, use a headerMatch
2035                /// with the header name ":authority". For matching a
2036                /// request's method, use the headerName ":method".
2037                pub header_name: std::string::String,
2038
2039                pub r#type: std::option::Option<
2040                    crate::model::authorization_policy::rule::destination::http_header_match::Type,
2041                >,
2042
2043                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2044            }
2045
2046            impl HttpHeaderMatch {
2047                pub fn new() -> Self {
2048                    std::default::Default::default()
2049                }
2050
2051                /// Sets the value of [header_name][crate::model::authorization_policy::rule::destination::HttpHeaderMatch::header_name].
2052                ///
2053                /// # Example
2054                /// ```ignore,no_run
2055                /// # use google_cloud_networksecurity_v1::model::authorization_policy::rule::destination::HttpHeaderMatch;
2056                /// let x = HttpHeaderMatch::new().set_header_name("example");
2057                /// ```
2058                pub fn set_header_name<T: std::convert::Into<std::string::String>>(
2059                    mut self,
2060                    v: T,
2061                ) -> Self {
2062                    self.header_name = v.into();
2063                    self
2064                }
2065
2066                /// Sets the value of [r#type][crate::model::authorization_policy::rule::destination::HttpHeaderMatch::type].
2067                ///
2068                /// Note that all the setters affecting `r#type` are mutually
2069                /// exclusive.
2070                ///
2071                /// # Example
2072                /// ```ignore,no_run
2073                /// # use google_cloud_networksecurity_v1::model::authorization_policy::rule::destination::HttpHeaderMatch;
2074                /// use google_cloud_networksecurity_v1::model::authorization_policy::rule::destination::http_header_match::Type;
2075                /// let x = HttpHeaderMatch::new().set_type(Some(Type::RegexMatch("example".to_string())));
2076                /// ```
2077                pub fn set_type<T: std::convert::Into<std::option::Option<crate::model::authorization_policy::rule::destination::http_header_match::Type>>>(mut self, v: T) -> Self
2078                {
2079                    self.r#type = v.into();
2080                    self
2081                }
2082
2083                /// The value of [r#type][crate::model::authorization_policy::rule::destination::HttpHeaderMatch::r#type]
2084                /// if it holds a `RegexMatch`, `None` if the field is not set or
2085                /// holds a different branch.
2086                pub fn regex_match(&self) -> std::option::Option<&std::string::String> {
2087                    #[allow(unreachable_patterns)]
2088                    self.r#type.as_ref().and_then(|v| match v {
2089                        crate::model::authorization_policy::rule::destination::http_header_match::Type::RegexMatch(v) => std::option::Option::Some(v),
2090                        _ => std::option::Option::None,
2091                    })
2092                }
2093
2094                /// Sets the value of [r#type][crate::model::authorization_policy::rule::destination::HttpHeaderMatch::r#type]
2095                /// to hold a `RegexMatch`.
2096                ///
2097                /// Note that all the setters affecting `r#type` are
2098                /// mutually exclusive.
2099                ///
2100                /// # Example
2101                /// ```ignore,no_run
2102                /// # use google_cloud_networksecurity_v1::model::authorization_policy::rule::destination::HttpHeaderMatch;
2103                /// let x = HttpHeaderMatch::new().set_regex_match("example");
2104                /// assert!(x.regex_match().is_some());
2105                /// ```
2106                pub fn set_regex_match<T: std::convert::Into<std::string::String>>(
2107                    mut self,
2108                    v: T,
2109                ) -> Self {
2110                    self.r#type = std::option::Option::Some(
2111                        crate::model::authorization_policy::rule::destination::http_header_match::Type::RegexMatch(
2112                            v.into()
2113                        )
2114                    );
2115                    self
2116                }
2117            }
2118
2119            impl wkt::message::Message for HttpHeaderMatch {
2120                fn typename() -> &'static str {
2121                    "type.googleapis.com/google.cloud.networksecurity.v1.AuthorizationPolicy.Rule.Destination.HttpHeaderMatch"
2122                }
2123            }
2124
2125            /// Defines additional types related to [HttpHeaderMatch].
2126            pub mod http_header_match {
2127                #[allow(unused_imports)]
2128                use super::*;
2129
2130                #[derive(Clone, Debug, PartialEq)]
2131                #[non_exhaustive]
2132                pub enum Type {
2133                    /// Required. The value of the header must match the regular expression
2134                    /// specified in regexMatch. For regular expression grammar,
2135                    /// please see: en.cppreference.com/w/cpp/regex/ecmascript
2136                    /// For matching against a port specified in the HTTP
2137                    /// request, use a headerMatch with headerName set to Host
2138                    /// and a regular expression that satisfies the RFC2616 Host
2139                    /// header's port specifier.
2140                    RegexMatch(std::string::String),
2141                }
2142            }
2143        }
2144    }
2145
2146    /// Possible values that define what action to take.
2147    ///
2148    /// # Working with unknown values
2149    ///
2150    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2151    /// additional enum variants at any time. Adding new variants is not considered
2152    /// a breaking change. Applications should write their code in anticipation of:
2153    ///
2154    /// - New values appearing in future releases of the client library, **and**
2155    /// - New values received dynamically, without application changes.
2156    ///
2157    /// Please consult the [Working with enums] section in the user guide for some
2158    /// guidelines.
2159    ///
2160    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2161    #[derive(Clone, Debug, PartialEq)]
2162    #[non_exhaustive]
2163    pub enum Action {
2164        /// Default value.
2165        Unspecified,
2166        /// Grant access.
2167        Allow,
2168        /// Deny access.
2169        /// Deny rules should be avoided unless they are used to provide a default
2170        /// "deny all" fallback.
2171        Deny,
2172        /// If set, the enum was initialized with an unknown value.
2173        ///
2174        /// Applications can examine the value using [Action::value] or
2175        /// [Action::name].
2176        UnknownValue(action::UnknownValue),
2177    }
2178
2179    #[doc(hidden)]
2180    pub mod action {
2181        #[allow(unused_imports)]
2182        use super::*;
2183        #[derive(Clone, Debug, PartialEq)]
2184        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2185    }
2186
2187    impl Action {
2188        /// Gets the enum value.
2189        ///
2190        /// Returns `None` if the enum contains an unknown value deserialized from
2191        /// the string representation of enums.
2192        pub fn value(&self) -> std::option::Option<i32> {
2193            match self {
2194                Self::Unspecified => std::option::Option::Some(0),
2195                Self::Allow => std::option::Option::Some(1),
2196                Self::Deny => std::option::Option::Some(2),
2197                Self::UnknownValue(u) => u.0.value(),
2198            }
2199        }
2200
2201        /// Gets the enum value as a string.
2202        ///
2203        /// Returns `None` if the enum contains an unknown value deserialized from
2204        /// the integer representation of enums.
2205        pub fn name(&self) -> std::option::Option<&str> {
2206            match self {
2207                Self::Unspecified => std::option::Option::Some("ACTION_UNSPECIFIED"),
2208                Self::Allow => std::option::Option::Some("ALLOW"),
2209                Self::Deny => std::option::Option::Some("DENY"),
2210                Self::UnknownValue(u) => u.0.name(),
2211            }
2212        }
2213    }
2214
2215    impl std::default::Default for Action {
2216        fn default() -> Self {
2217            use std::convert::From;
2218            Self::from(0)
2219        }
2220    }
2221
2222    impl std::fmt::Display for Action {
2223        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2224            wkt::internal::display_enum(f, self.name(), self.value())
2225        }
2226    }
2227
2228    impl std::convert::From<i32> for Action {
2229        fn from(value: i32) -> Self {
2230            match value {
2231                0 => Self::Unspecified,
2232                1 => Self::Allow,
2233                2 => Self::Deny,
2234                _ => Self::UnknownValue(action::UnknownValue(
2235                    wkt::internal::UnknownEnumValue::Integer(value),
2236                )),
2237            }
2238        }
2239    }
2240
2241    impl std::convert::From<&str> for Action {
2242        fn from(value: &str) -> Self {
2243            use std::string::ToString;
2244            match value {
2245                "ACTION_UNSPECIFIED" => Self::Unspecified,
2246                "ALLOW" => Self::Allow,
2247                "DENY" => Self::Deny,
2248                _ => Self::UnknownValue(action::UnknownValue(
2249                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2250                )),
2251            }
2252        }
2253    }
2254
2255    impl serde::ser::Serialize for Action {
2256        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2257        where
2258            S: serde::Serializer,
2259        {
2260            match self {
2261                Self::Unspecified => serializer.serialize_i32(0),
2262                Self::Allow => serializer.serialize_i32(1),
2263                Self::Deny => serializer.serialize_i32(2),
2264                Self::UnknownValue(u) => u.0.serialize(serializer),
2265            }
2266        }
2267    }
2268
2269    impl<'de> serde::de::Deserialize<'de> for Action {
2270        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2271        where
2272            D: serde::Deserializer<'de>,
2273        {
2274            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Action>::new(
2275                ".google.cloud.networksecurity.v1.AuthorizationPolicy.Action",
2276            ))
2277        }
2278    }
2279}
2280
2281/// Request used with the ListAuthorizationPolicies method.
2282#[derive(Clone, Default, PartialEq)]
2283#[non_exhaustive]
2284pub struct ListAuthorizationPoliciesRequest {
2285    /// Required. The project and location from which the AuthorizationPolicies
2286    /// should be listed, specified in the format
2287    /// `projects/{project}/locations/{location}`.
2288    pub parent: std::string::String,
2289
2290    /// Maximum number of AuthorizationPolicies to return per call.
2291    pub page_size: i32,
2292
2293    /// The value returned by the last
2294    /// `ListAuthorizationPoliciesResponse` Indicates that this is a
2295    /// continuation of a prior `ListAuthorizationPolicies` call, and
2296    /// that the system should return the next page of data.
2297    pub page_token: std::string::String,
2298
2299    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2300}
2301
2302impl ListAuthorizationPoliciesRequest {
2303    pub fn new() -> Self {
2304        std::default::Default::default()
2305    }
2306
2307    /// Sets the value of [parent][crate::model::ListAuthorizationPoliciesRequest::parent].
2308    ///
2309    /// # Example
2310    /// ```ignore,no_run
2311    /// # use google_cloud_networksecurity_v1::model::ListAuthorizationPoliciesRequest;
2312    /// let x = ListAuthorizationPoliciesRequest::new().set_parent("example");
2313    /// ```
2314    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2315        self.parent = v.into();
2316        self
2317    }
2318
2319    /// Sets the value of [page_size][crate::model::ListAuthorizationPoliciesRequest::page_size].
2320    ///
2321    /// # Example
2322    /// ```ignore,no_run
2323    /// # use google_cloud_networksecurity_v1::model::ListAuthorizationPoliciesRequest;
2324    /// let x = ListAuthorizationPoliciesRequest::new().set_page_size(42);
2325    /// ```
2326    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2327        self.page_size = v.into();
2328        self
2329    }
2330
2331    /// Sets the value of [page_token][crate::model::ListAuthorizationPoliciesRequest::page_token].
2332    ///
2333    /// # Example
2334    /// ```ignore,no_run
2335    /// # use google_cloud_networksecurity_v1::model::ListAuthorizationPoliciesRequest;
2336    /// let x = ListAuthorizationPoliciesRequest::new().set_page_token("example");
2337    /// ```
2338    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2339        self.page_token = v.into();
2340        self
2341    }
2342}
2343
2344impl wkt::message::Message for ListAuthorizationPoliciesRequest {
2345    fn typename() -> &'static str {
2346        "type.googleapis.com/google.cloud.networksecurity.v1.ListAuthorizationPoliciesRequest"
2347    }
2348}
2349
2350/// Response returned by the ListAuthorizationPolicies method.
2351#[derive(Clone, Default, PartialEq)]
2352#[non_exhaustive]
2353pub struct ListAuthorizationPoliciesResponse {
2354    /// List of AuthorizationPolicies resources.
2355    pub authorization_policies: std::vec::Vec<crate::model::AuthorizationPolicy>,
2356
2357    /// If there might be more results than those appearing in this response, then
2358    /// `next_page_token` is included. To get the next set of results, call this
2359    /// method again using the value of `next_page_token` as `page_token`.
2360    pub next_page_token: std::string::String,
2361
2362    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2363}
2364
2365impl ListAuthorizationPoliciesResponse {
2366    pub fn new() -> Self {
2367        std::default::Default::default()
2368    }
2369
2370    /// Sets the value of [authorization_policies][crate::model::ListAuthorizationPoliciesResponse::authorization_policies].
2371    ///
2372    /// # Example
2373    /// ```ignore,no_run
2374    /// # use google_cloud_networksecurity_v1::model::ListAuthorizationPoliciesResponse;
2375    /// use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
2376    /// let x = ListAuthorizationPoliciesResponse::new()
2377    ///     .set_authorization_policies([
2378    ///         AuthorizationPolicy::default()/* use setters */,
2379    ///         AuthorizationPolicy::default()/* use (different) setters */,
2380    ///     ]);
2381    /// ```
2382    pub fn set_authorization_policies<T, V>(mut self, v: T) -> Self
2383    where
2384        T: std::iter::IntoIterator<Item = V>,
2385        V: std::convert::Into<crate::model::AuthorizationPolicy>,
2386    {
2387        use std::iter::Iterator;
2388        self.authorization_policies = v.into_iter().map(|i| i.into()).collect();
2389        self
2390    }
2391
2392    /// Sets the value of [next_page_token][crate::model::ListAuthorizationPoliciesResponse::next_page_token].
2393    ///
2394    /// # Example
2395    /// ```ignore,no_run
2396    /// # use google_cloud_networksecurity_v1::model::ListAuthorizationPoliciesResponse;
2397    /// let x = ListAuthorizationPoliciesResponse::new().set_next_page_token("example");
2398    /// ```
2399    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2400        self.next_page_token = v.into();
2401        self
2402    }
2403}
2404
2405impl wkt::message::Message for ListAuthorizationPoliciesResponse {
2406    fn typename() -> &'static str {
2407        "type.googleapis.com/google.cloud.networksecurity.v1.ListAuthorizationPoliciesResponse"
2408    }
2409}
2410
2411#[doc(hidden)]
2412impl google_cloud_gax::paginator::internal::PageableResponse for ListAuthorizationPoliciesResponse {
2413    type PageItem = crate::model::AuthorizationPolicy;
2414
2415    fn items(self) -> std::vec::Vec<Self::PageItem> {
2416        self.authorization_policies
2417    }
2418
2419    fn next_page_token(&self) -> std::string::String {
2420        use std::clone::Clone;
2421        self.next_page_token.clone()
2422    }
2423}
2424
2425/// Request used by the GetAuthorizationPolicy method.
2426#[derive(Clone, Default, PartialEq)]
2427#[non_exhaustive]
2428pub struct GetAuthorizationPolicyRequest {
2429    /// Required. A name of the AuthorizationPolicy to get. Must be in the format
2430    /// `projects/{project}/locations/{location}/authorizationPolicies/*`.
2431    pub name: std::string::String,
2432
2433    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2434}
2435
2436impl GetAuthorizationPolicyRequest {
2437    pub fn new() -> Self {
2438        std::default::Default::default()
2439    }
2440
2441    /// Sets the value of [name][crate::model::GetAuthorizationPolicyRequest::name].
2442    ///
2443    /// # Example
2444    /// ```ignore,no_run
2445    /// # use google_cloud_networksecurity_v1::model::GetAuthorizationPolicyRequest;
2446    /// let x = GetAuthorizationPolicyRequest::new().set_name("example");
2447    /// ```
2448    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2449        self.name = v.into();
2450        self
2451    }
2452}
2453
2454impl wkt::message::Message for GetAuthorizationPolicyRequest {
2455    fn typename() -> &'static str {
2456        "type.googleapis.com/google.cloud.networksecurity.v1.GetAuthorizationPolicyRequest"
2457    }
2458}
2459
2460/// Request used by the CreateAuthorizationPolicy method.
2461#[derive(Clone, Default, PartialEq)]
2462#[non_exhaustive]
2463pub struct CreateAuthorizationPolicyRequest {
2464    /// Required. The parent resource of the AuthorizationPolicy. Must be in the
2465    /// format `projects/{project}/locations/{location}`.
2466    pub parent: std::string::String,
2467
2468    /// Required. Short name of the AuthorizationPolicy resource to be created.
2469    /// This value should be 1-63 characters long, containing only
2470    /// letters, numbers, hyphens, and underscores, and should not start
2471    /// with a number. E.g. "authz_policy".
2472    pub authorization_policy_id: std::string::String,
2473
2474    /// Required. AuthorizationPolicy resource to be created.
2475    pub authorization_policy: std::option::Option<crate::model::AuthorizationPolicy>,
2476
2477    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2478}
2479
2480impl CreateAuthorizationPolicyRequest {
2481    pub fn new() -> Self {
2482        std::default::Default::default()
2483    }
2484
2485    /// Sets the value of [parent][crate::model::CreateAuthorizationPolicyRequest::parent].
2486    ///
2487    /// # Example
2488    /// ```ignore,no_run
2489    /// # use google_cloud_networksecurity_v1::model::CreateAuthorizationPolicyRequest;
2490    /// let x = CreateAuthorizationPolicyRequest::new().set_parent("example");
2491    /// ```
2492    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2493        self.parent = v.into();
2494        self
2495    }
2496
2497    /// Sets the value of [authorization_policy_id][crate::model::CreateAuthorizationPolicyRequest::authorization_policy_id].
2498    ///
2499    /// # Example
2500    /// ```ignore,no_run
2501    /// # use google_cloud_networksecurity_v1::model::CreateAuthorizationPolicyRequest;
2502    /// let x = CreateAuthorizationPolicyRequest::new().set_authorization_policy_id("example");
2503    /// ```
2504    pub fn set_authorization_policy_id<T: std::convert::Into<std::string::String>>(
2505        mut self,
2506        v: T,
2507    ) -> Self {
2508        self.authorization_policy_id = v.into();
2509        self
2510    }
2511
2512    /// Sets the value of [authorization_policy][crate::model::CreateAuthorizationPolicyRequest::authorization_policy].
2513    ///
2514    /// # Example
2515    /// ```ignore,no_run
2516    /// # use google_cloud_networksecurity_v1::model::CreateAuthorizationPolicyRequest;
2517    /// use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
2518    /// let x = CreateAuthorizationPolicyRequest::new().set_authorization_policy(AuthorizationPolicy::default()/* use setters */);
2519    /// ```
2520    pub fn set_authorization_policy<T>(mut self, v: T) -> Self
2521    where
2522        T: std::convert::Into<crate::model::AuthorizationPolicy>,
2523    {
2524        self.authorization_policy = std::option::Option::Some(v.into());
2525        self
2526    }
2527
2528    /// Sets or clears the value of [authorization_policy][crate::model::CreateAuthorizationPolicyRequest::authorization_policy].
2529    ///
2530    /// # Example
2531    /// ```ignore,no_run
2532    /// # use google_cloud_networksecurity_v1::model::CreateAuthorizationPolicyRequest;
2533    /// use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
2534    /// let x = CreateAuthorizationPolicyRequest::new().set_or_clear_authorization_policy(Some(AuthorizationPolicy::default()/* use setters */));
2535    /// let x = CreateAuthorizationPolicyRequest::new().set_or_clear_authorization_policy(None::<AuthorizationPolicy>);
2536    /// ```
2537    pub fn set_or_clear_authorization_policy<T>(mut self, v: std::option::Option<T>) -> Self
2538    where
2539        T: std::convert::Into<crate::model::AuthorizationPolicy>,
2540    {
2541        self.authorization_policy = v.map(|x| x.into());
2542        self
2543    }
2544}
2545
2546impl wkt::message::Message for CreateAuthorizationPolicyRequest {
2547    fn typename() -> &'static str {
2548        "type.googleapis.com/google.cloud.networksecurity.v1.CreateAuthorizationPolicyRequest"
2549    }
2550}
2551
2552/// Request used by the UpdateAuthorizationPolicy method.
2553#[derive(Clone, Default, PartialEq)]
2554#[non_exhaustive]
2555pub struct UpdateAuthorizationPolicyRequest {
2556    /// Optional. Field mask is used to specify the fields to be overwritten in the
2557    /// AuthorizationPolicy resource by the update.
2558    /// The fields specified in the update_mask are relative to the resource, not
2559    /// the full request. A field will be overwritten if it is in the mask. If the
2560    /// user does not provide a mask then all fields will be overwritten.
2561    pub update_mask: std::option::Option<wkt::FieldMask>,
2562
2563    /// Required. Updated AuthorizationPolicy resource.
2564    pub authorization_policy: std::option::Option<crate::model::AuthorizationPolicy>,
2565
2566    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2567}
2568
2569impl UpdateAuthorizationPolicyRequest {
2570    pub fn new() -> Self {
2571        std::default::Default::default()
2572    }
2573
2574    /// Sets the value of [update_mask][crate::model::UpdateAuthorizationPolicyRequest::update_mask].
2575    ///
2576    /// # Example
2577    /// ```ignore,no_run
2578    /// # use google_cloud_networksecurity_v1::model::UpdateAuthorizationPolicyRequest;
2579    /// use wkt::FieldMask;
2580    /// let x = UpdateAuthorizationPolicyRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2581    /// ```
2582    pub fn set_update_mask<T>(mut self, v: T) -> Self
2583    where
2584        T: std::convert::Into<wkt::FieldMask>,
2585    {
2586        self.update_mask = std::option::Option::Some(v.into());
2587        self
2588    }
2589
2590    /// Sets or clears the value of [update_mask][crate::model::UpdateAuthorizationPolicyRequest::update_mask].
2591    ///
2592    /// # Example
2593    /// ```ignore,no_run
2594    /// # use google_cloud_networksecurity_v1::model::UpdateAuthorizationPolicyRequest;
2595    /// use wkt::FieldMask;
2596    /// let x = UpdateAuthorizationPolicyRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2597    /// let x = UpdateAuthorizationPolicyRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2598    /// ```
2599    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2600    where
2601        T: std::convert::Into<wkt::FieldMask>,
2602    {
2603        self.update_mask = v.map(|x| x.into());
2604        self
2605    }
2606
2607    /// Sets the value of [authorization_policy][crate::model::UpdateAuthorizationPolicyRequest::authorization_policy].
2608    ///
2609    /// # Example
2610    /// ```ignore,no_run
2611    /// # use google_cloud_networksecurity_v1::model::UpdateAuthorizationPolicyRequest;
2612    /// use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
2613    /// let x = UpdateAuthorizationPolicyRequest::new().set_authorization_policy(AuthorizationPolicy::default()/* use setters */);
2614    /// ```
2615    pub fn set_authorization_policy<T>(mut self, v: T) -> Self
2616    where
2617        T: std::convert::Into<crate::model::AuthorizationPolicy>,
2618    {
2619        self.authorization_policy = std::option::Option::Some(v.into());
2620        self
2621    }
2622
2623    /// Sets or clears the value of [authorization_policy][crate::model::UpdateAuthorizationPolicyRequest::authorization_policy].
2624    ///
2625    /// # Example
2626    /// ```ignore,no_run
2627    /// # use google_cloud_networksecurity_v1::model::UpdateAuthorizationPolicyRequest;
2628    /// use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
2629    /// let x = UpdateAuthorizationPolicyRequest::new().set_or_clear_authorization_policy(Some(AuthorizationPolicy::default()/* use setters */));
2630    /// let x = UpdateAuthorizationPolicyRequest::new().set_or_clear_authorization_policy(None::<AuthorizationPolicy>);
2631    /// ```
2632    pub fn set_or_clear_authorization_policy<T>(mut self, v: std::option::Option<T>) -> Self
2633    where
2634        T: std::convert::Into<crate::model::AuthorizationPolicy>,
2635    {
2636        self.authorization_policy = v.map(|x| x.into());
2637        self
2638    }
2639}
2640
2641impl wkt::message::Message for UpdateAuthorizationPolicyRequest {
2642    fn typename() -> &'static str {
2643        "type.googleapis.com/google.cloud.networksecurity.v1.UpdateAuthorizationPolicyRequest"
2644    }
2645}
2646
2647/// Request used by the DeleteAuthorizationPolicy method.
2648#[derive(Clone, Default, PartialEq)]
2649#[non_exhaustive]
2650pub struct DeleteAuthorizationPolicyRequest {
2651    /// Required. A name of the AuthorizationPolicy to delete. Must be in the format
2652    /// `projects/{project}/locations/{location}/authorizationPolicies/*`.
2653    pub name: std::string::String,
2654
2655    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2656}
2657
2658impl DeleteAuthorizationPolicyRequest {
2659    pub fn new() -> Self {
2660        std::default::Default::default()
2661    }
2662
2663    /// Sets the value of [name][crate::model::DeleteAuthorizationPolicyRequest::name].
2664    ///
2665    /// # Example
2666    /// ```ignore,no_run
2667    /// # use google_cloud_networksecurity_v1::model::DeleteAuthorizationPolicyRequest;
2668    /// let x = DeleteAuthorizationPolicyRequest::new().set_name("example");
2669    /// ```
2670    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2671        self.name = v.into();
2672        self
2673    }
2674}
2675
2676impl wkt::message::Message for DeleteAuthorizationPolicyRequest {
2677    fn typename() -> &'static str {
2678        "type.googleapis.com/google.cloud.networksecurity.v1.DeleteAuthorizationPolicyRequest"
2679    }
2680}
2681
2682/// ClientTlsPolicy is a resource that specifies how a client should authenticate
2683/// connections to backends of a service. This resource itself does not affect
2684/// configuration unless it is attached to a backend service resource.
2685#[derive(Clone, Default, PartialEq)]
2686#[non_exhaustive]
2687pub struct ClientTlsPolicy {
2688    /// Required. Name of the ClientTlsPolicy resource. It matches the pattern
2689    /// `projects/*/locations/{location}/clientTlsPolicies/{client_tls_policy}`
2690    pub name: std::string::String,
2691
2692    /// Optional. Free-text description of the resource.
2693    pub description: std::string::String,
2694
2695    /// Output only. The timestamp when the resource was created.
2696    pub create_time: std::option::Option<wkt::Timestamp>,
2697
2698    /// Output only. The timestamp when the resource was updated.
2699    pub update_time: std::option::Option<wkt::Timestamp>,
2700
2701    /// Optional. Set of label tags associated with the resource.
2702    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2703
2704    /// Optional. Server Name Indication string to present to the server during TLS
2705    /// handshake. E.g: "secure.example.com".
2706    pub sni: std::string::String,
2707
2708    /// Optional. Defines a mechanism to provision client identity (public and private keys)
2709    /// for peer to peer authentication. The presence of this dictates mTLS.
2710    pub client_certificate: std::option::Option<crate::model::CertificateProvider>,
2711
2712    /// Optional. Defines the mechanism to obtain the Certificate Authority certificate to
2713    /// validate the server certificate. If empty, client does not validate the
2714    /// server certificate.
2715    pub server_validation_ca: std::vec::Vec<crate::model::ValidationCA>,
2716
2717    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2718}
2719
2720impl ClientTlsPolicy {
2721    pub fn new() -> Self {
2722        std::default::Default::default()
2723    }
2724
2725    /// Sets the value of [name][crate::model::ClientTlsPolicy::name].
2726    ///
2727    /// # Example
2728    /// ```ignore,no_run
2729    /// # use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
2730    /// let x = ClientTlsPolicy::new().set_name("example");
2731    /// ```
2732    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2733        self.name = v.into();
2734        self
2735    }
2736
2737    /// Sets the value of [description][crate::model::ClientTlsPolicy::description].
2738    ///
2739    /// # Example
2740    /// ```ignore,no_run
2741    /// # use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
2742    /// let x = ClientTlsPolicy::new().set_description("example");
2743    /// ```
2744    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2745        self.description = v.into();
2746        self
2747    }
2748
2749    /// Sets the value of [create_time][crate::model::ClientTlsPolicy::create_time].
2750    ///
2751    /// # Example
2752    /// ```ignore,no_run
2753    /// # use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
2754    /// use wkt::Timestamp;
2755    /// let x = ClientTlsPolicy::new().set_create_time(Timestamp::default()/* use setters */);
2756    /// ```
2757    pub fn set_create_time<T>(mut self, v: T) -> Self
2758    where
2759        T: std::convert::Into<wkt::Timestamp>,
2760    {
2761        self.create_time = std::option::Option::Some(v.into());
2762        self
2763    }
2764
2765    /// Sets or clears the value of [create_time][crate::model::ClientTlsPolicy::create_time].
2766    ///
2767    /// # Example
2768    /// ```ignore,no_run
2769    /// # use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
2770    /// use wkt::Timestamp;
2771    /// let x = ClientTlsPolicy::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2772    /// let x = ClientTlsPolicy::new().set_or_clear_create_time(None::<Timestamp>);
2773    /// ```
2774    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2775    where
2776        T: std::convert::Into<wkt::Timestamp>,
2777    {
2778        self.create_time = v.map(|x| x.into());
2779        self
2780    }
2781
2782    /// Sets the value of [update_time][crate::model::ClientTlsPolicy::update_time].
2783    ///
2784    /// # Example
2785    /// ```ignore,no_run
2786    /// # use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
2787    /// use wkt::Timestamp;
2788    /// let x = ClientTlsPolicy::new().set_update_time(Timestamp::default()/* use setters */);
2789    /// ```
2790    pub fn set_update_time<T>(mut self, v: T) -> Self
2791    where
2792        T: std::convert::Into<wkt::Timestamp>,
2793    {
2794        self.update_time = std::option::Option::Some(v.into());
2795        self
2796    }
2797
2798    /// Sets or clears the value of [update_time][crate::model::ClientTlsPolicy::update_time].
2799    ///
2800    /// # Example
2801    /// ```ignore,no_run
2802    /// # use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
2803    /// use wkt::Timestamp;
2804    /// let x = ClientTlsPolicy::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2805    /// let x = ClientTlsPolicy::new().set_or_clear_update_time(None::<Timestamp>);
2806    /// ```
2807    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2808    where
2809        T: std::convert::Into<wkt::Timestamp>,
2810    {
2811        self.update_time = v.map(|x| x.into());
2812        self
2813    }
2814
2815    /// Sets the value of [labels][crate::model::ClientTlsPolicy::labels].
2816    ///
2817    /// # Example
2818    /// ```ignore,no_run
2819    /// # use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
2820    /// let x = ClientTlsPolicy::new().set_labels([
2821    ///     ("key0", "abc"),
2822    ///     ("key1", "xyz"),
2823    /// ]);
2824    /// ```
2825    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2826    where
2827        T: std::iter::IntoIterator<Item = (K, V)>,
2828        K: std::convert::Into<std::string::String>,
2829        V: std::convert::Into<std::string::String>,
2830    {
2831        use std::iter::Iterator;
2832        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2833        self
2834    }
2835
2836    /// Sets the value of [sni][crate::model::ClientTlsPolicy::sni].
2837    ///
2838    /// # Example
2839    /// ```ignore,no_run
2840    /// # use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
2841    /// let x = ClientTlsPolicy::new().set_sni("example");
2842    /// ```
2843    pub fn set_sni<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2844        self.sni = v.into();
2845        self
2846    }
2847
2848    /// Sets the value of [client_certificate][crate::model::ClientTlsPolicy::client_certificate].
2849    ///
2850    /// # Example
2851    /// ```ignore,no_run
2852    /// # use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
2853    /// use google_cloud_networksecurity_v1::model::CertificateProvider;
2854    /// let x = ClientTlsPolicy::new().set_client_certificate(CertificateProvider::default()/* use setters */);
2855    /// ```
2856    pub fn set_client_certificate<T>(mut self, v: T) -> Self
2857    where
2858        T: std::convert::Into<crate::model::CertificateProvider>,
2859    {
2860        self.client_certificate = std::option::Option::Some(v.into());
2861        self
2862    }
2863
2864    /// Sets or clears the value of [client_certificate][crate::model::ClientTlsPolicy::client_certificate].
2865    ///
2866    /// # Example
2867    /// ```ignore,no_run
2868    /// # use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
2869    /// use google_cloud_networksecurity_v1::model::CertificateProvider;
2870    /// let x = ClientTlsPolicy::new().set_or_clear_client_certificate(Some(CertificateProvider::default()/* use setters */));
2871    /// let x = ClientTlsPolicy::new().set_or_clear_client_certificate(None::<CertificateProvider>);
2872    /// ```
2873    pub fn set_or_clear_client_certificate<T>(mut self, v: std::option::Option<T>) -> Self
2874    where
2875        T: std::convert::Into<crate::model::CertificateProvider>,
2876    {
2877        self.client_certificate = v.map(|x| x.into());
2878        self
2879    }
2880
2881    /// Sets the value of [server_validation_ca][crate::model::ClientTlsPolicy::server_validation_ca].
2882    ///
2883    /// # Example
2884    /// ```ignore,no_run
2885    /// # use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
2886    /// use google_cloud_networksecurity_v1::model::ValidationCA;
2887    /// let x = ClientTlsPolicy::new()
2888    ///     .set_server_validation_ca([
2889    ///         ValidationCA::default()/* use setters */,
2890    ///         ValidationCA::default()/* use (different) setters */,
2891    ///     ]);
2892    /// ```
2893    pub fn set_server_validation_ca<T, V>(mut self, v: T) -> Self
2894    where
2895        T: std::iter::IntoIterator<Item = V>,
2896        V: std::convert::Into<crate::model::ValidationCA>,
2897    {
2898        use std::iter::Iterator;
2899        self.server_validation_ca = v.into_iter().map(|i| i.into()).collect();
2900        self
2901    }
2902}
2903
2904impl wkt::message::Message for ClientTlsPolicy {
2905    fn typename() -> &'static str {
2906        "type.googleapis.com/google.cloud.networksecurity.v1.ClientTlsPolicy"
2907    }
2908}
2909
2910/// Request used by the ListClientTlsPolicies method.
2911#[derive(Clone, Default, PartialEq)]
2912#[non_exhaustive]
2913pub struct ListClientTlsPoliciesRequest {
2914    /// Required. The project and location from which the ClientTlsPolicies should
2915    /// be listed, specified in the format `projects/*/locations/{location}`.
2916    pub parent: std::string::String,
2917
2918    /// Maximum number of ClientTlsPolicies to return per call.
2919    pub page_size: i32,
2920
2921    /// The value returned by the last `ListClientTlsPoliciesResponse`
2922    /// Indicates that this is a continuation of a prior
2923    /// `ListClientTlsPolicies` call, and that the system
2924    /// should return the next page of data.
2925    pub page_token: std::string::String,
2926
2927    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2928}
2929
2930impl ListClientTlsPoliciesRequest {
2931    pub fn new() -> Self {
2932        std::default::Default::default()
2933    }
2934
2935    /// Sets the value of [parent][crate::model::ListClientTlsPoliciesRequest::parent].
2936    ///
2937    /// # Example
2938    /// ```ignore,no_run
2939    /// # use google_cloud_networksecurity_v1::model::ListClientTlsPoliciesRequest;
2940    /// let x = ListClientTlsPoliciesRequest::new().set_parent("example");
2941    /// ```
2942    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2943        self.parent = v.into();
2944        self
2945    }
2946
2947    /// Sets the value of [page_size][crate::model::ListClientTlsPoliciesRequest::page_size].
2948    ///
2949    /// # Example
2950    /// ```ignore,no_run
2951    /// # use google_cloud_networksecurity_v1::model::ListClientTlsPoliciesRequest;
2952    /// let x = ListClientTlsPoliciesRequest::new().set_page_size(42);
2953    /// ```
2954    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2955        self.page_size = v.into();
2956        self
2957    }
2958
2959    /// Sets the value of [page_token][crate::model::ListClientTlsPoliciesRequest::page_token].
2960    ///
2961    /// # Example
2962    /// ```ignore,no_run
2963    /// # use google_cloud_networksecurity_v1::model::ListClientTlsPoliciesRequest;
2964    /// let x = ListClientTlsPoliciesRequest::new().set_page_token("example");
2965    /// ```
2966    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2967        self.page_token = v.into();
2968        self
2969    }
2970}
2971
2972impl wkt::message::Message for ListClientTlsPoliciesRequest {
2973    fn typename() -> &'static str {
2974        "type.googleapis.com/google.cloud.networksecurity.v1.ListClientTlsPoliciesRequest"
2975    }
2976}
2977
2978/// Response returned by the ListClientTlsPolicies method.
2979#[derive(Clone, Default, PartialEq)]
2980#[non_exhaustive]
2981pub struct ListClientTlsPoliciesResponse {
2982    /// List of ClientTlsPolicy resources.
2983    pub client_tls_policies: std::vec::Vec<crate::model::ClientTlsPolicy>,
2984
2985    /// If there might be more results than those appearing in this response, then
2986    /// `next_page_token` is included. To get the next set of results, call this
2987    /// method again using the value of `next_page_token` as `page_token`.
2988    pub next_page_token: std::string::String,
2989
2990    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2991}
2992
2993impl ListClientTlsPoliciesResponse {
2994    pub fn new() -> Self {
2995        std::default::Default::default()
2996    }
2997
2998    /// Sets the value of [client_tls_policies][crate::model::ListClientTlsPoliciesResponse::client_tls_policies].
2999    ///
3000    /// # Example
3001    /// ```ignore,no_run
3002    /// # use google_cloud_networksecurity_v1::model::ListClientTlsPoliciesResponse;
3003    /// use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
3004    /// let x = ListClientTlsPoliciesResponse::new()
3005    ///     .set_client_tls_policies([
3006    ///         ClientTlsPolicy::default()/* use setters */,
3007    ///         ClientTlsPolicy::default()/* use (different) setters */,
3008    ///     ]);
3009    /// ```
3010    pub fn set_client_tls_policies<T, V>(mut self, v: T) -> Self
3011    where
3012        T: std::iter::IntoIterator<Item = V>,
3013        V: std::convert::Into<crate::model::ClientTlsPolicy>,
3014    {
3015        use std::iter::Iterator;
3016        self.client_tls_policies = v.into_iter().map(|i| i.into()).collect();
3017        self
3018    }
3019
3020    /// Sets the value of [next_page_token][crate::model::ListClientTlsPoliciesResponse::next_page_token].
3021    ///
3022    /// # Example
3023    /// ```ignore,no_run
3024    /// # use google_cloud_networksecurity_v1::model::ListClientTlsPoliciesResponse;
3025    /// let x = ListClientTlsPoliciesResponse::new().set_next_page_token("example");
3026    /// ```
3027    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3028        self.next_page_token = v.into();
3029        self
3030    }
3031}
3032
3033impl wkt::message::Message for ListClientTlsPoliciesResponse {
3034    fn typename() -> &'static str {
3035        "type.googleapis.com/google.cloud.networksecurity.v1.ListClientTlsPoliciesResponse"
3036    }
3037}
3038
3039#[doc(hidden)]
3040impl google_cloud_gax::paginator::internal::PageableResponse for ListClientTlsPoliciesResponse {
3041    type PageItem = crate::model::ClientTlsPolicy;
3042
3043    fn items(self) -> std::vec::Vec<Self::PageItem> {
3044        self.client_tls_policies
3045    }
3046
3047    fn next_page_token(&self) -> std::string::String {
3048        use std::clone::Clone;
3049        self.next_page_token.clone()
3050    }
3051}
3052
3053/// Request used by the GetClientTlsPolicy method.
3054#[derive(Clone, Default, PartialEq)]
3055#[non_exhaustive]
3056pub struct GetClientTlsPolicyRequest {
3057    /// Required. A name of the ClientTlsPolicy to get. Must be in the format
3058    /// `projects/*/locations/{location}/clientTlsPolicies/*`.
3059    pub name: std::string::String,
3060
3061    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3062}
3063
3064impl GetClientTlsPolicyRequest {
3065    pub fn new() -> Self {
3066        std::default::Default::default()
3067    }
3068
3069    /// Sets the value of [name][crate::model::GetClientTlsPolicyRequest::name].
3070    ///
3071    /// # Example
3072    /// ```ignore,no_run
3073    /// # use google_cloud_networksecurity_v1::model::GetClientTlsPolicyRequest;
3074    /// let x = GetClientTlsPolicyRequest::new().set_name("example");
3075    /// ```
3076    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3077        self.name = v.into();
3078        self
3079    }
3080}
3081
3082impl wkt::message::Message for GetClientTlsPolicyRequest {
3083    fn typename() -> &'static str {
3084        "type.googleapis.com/google.cloud.networksecurity.v1.GetClientTlsPolicyRequest"
3085    }
3086}
3087
3088/// Request used by the CreateClientTlsPolicy method.
3089#[derive(Clone, Default, PartialEq)]
3090#[non_exhaustive]
3091pub struct CreateClientTlsPolicyRequest {
3092    /// Required. The parent resource of the ClientTlsPolicy. Must be in
3093    /// the format `projects/*/locations/{location}`.
3094    pub parent: std::string::String,
3095
3096    /// Required. Short name of the ClientTlsPolicy resource to be created. This value should
3097    /// be 1-63 characters long, containing only letters, numbers, hyphens, and
3098    /// underscores, and should not start with a number. E.g. "client_mtls_policy".
3099    pub client_tls_policy_id: std::string::String,
3100
3101    /// Required. ClientTlsPolicy resource to be created.
3102    pub client_tls_policy: std::option::Option<crate::model::ClientTlsPolicy>,
3103
3104    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3105}
3106
3107impl CreateClientTlsPolicyRequest {
3108    pub fn new() -> Self {
3109        std::default::Default::default()
3110    }
3111
3112    /// Sets the value of [parent][crate::model::CreateClientTlsPolicyRequest::parent].
3113    ///
3114    /// # Example
3115    /// ```ignore,no_run
3116    /// # use google_cloud_networksecurity_v1::model::CreateClientTlsPolicyRequest;
3117    /// let x = CreateClientTlsPolicyRequest::new().set_parent("example");
3118    /// ```
3119    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3120        self.parent = v.into();
3121        self
3122    }
3123
3124    /// Sets the value of [client_tls_policy_id][crate::model::CreateClientTlsPolicyRequest::client_tls_policy_id].
3125    ///
3126    /// # Example
3127    /// ```ignore,no_run
3128    /// # use google_cloud_networksecurity_v1::model::CreateClientTlsPolicyRequest;
3129    /// let x = CreateClientTlsPolicyRequest::new().set_client_tls_policy_id("example");
3130    /// ```
3131    pub fn set_client_tls_policy_id<T: std::convert::Into<std::string::String>>(
3132        mut self,
3133        v: T,
3134    ) -> Self {
3135        self.client_tls_policy_id = v.into();
3136        self
3137    }
3138
3139    /// Sets the value of [client_tls_policy][crate::model::CreateClientTlsPolicyRequest::client_tls_policy].
3140    ///
3141    /// # Example
3142    /// ```ignore,no_run
3143    /// # use google_cloud_networksecurity_v1::model::CreateClientTlsPolicyRequest;
3144    /// use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
3145    /// let x = CreateClientTlsPolicyRequest::new().set_client_tls_policy(ClientTlsPolicy::default()/* use setters */);
3146    /// ```
3147    pub fn set_client_tls_policy<T>(mut self, v: T) -> Self
3148    where
3149        T: std::convert::Into<crate::model::ClientTlsPolicy>,
3150    {
3151        self.client_tls_policy = std::option::Option::Some(v.into());
3152        self
3153    }
3154
3155    /// Sets or clears the value of [client_tls_policy][crate::model::CreateClientTlsPolicyRequest::client_tls_policy].
3156    ///
3157    /// # Example
3158    /// ```ignore,no_run
3159    /// # use google_cloud_networksecurity_v1::model::CreateClientTlsPolicyRequest;
3160    /// use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
3161    /// let x = CreateClientTlsPolicyRequest::new().set_or_clear_client_tls_policy(Some(ClientTlsPolicy::default()/* use setters */));
3162    /// let x = CreateClientTlsPolicyRequest::new().set_or_clear_client_tls_policy(None::<ClientTlsPolicy>);
3163    /// ```
3164    pub fn set_or_clear_client_tls_policy<T>(mut self, v: std::option::Option<T>) -> Self
3165    where
3166        T: std::convert::Into<crate::model::ClientTlsPolicy>,
3167    {
3168        self.client_tls_policy = v.map(|x| x.into());
3169        self
3170    }
3171}
3172
3173impl wkt::message::Message for CreateClientTlsPolicyRequest {
3174    fn typename() -> &'static str {
3175        "type.googleapis.com/google.cloud.networksecurity.v1.CreateClientTlsPolicyRequest"
3176    }
3177}
3178
3179/// Request used by UpdateClientTlsPolicy method.
3180#[derive(Clone, Default, PartialEq)]
3181#[non_exhaustive]
3182pub struct UpdateClientTlsPolicyRequest {
3183    /// Optional. Field mask is used to specify the fields to be overwritten in the
3184    /// ClientTlsPolicy resource by the update.  The fields
3185    /// specified in the update_mask are relative to the resource, not
3186    /// the full request. A field will be overwritten if it is in the
3187    /// mask. If the user does not provide a mask then all fields will be
3188    /// overwritten.
3189    pub update_mask: std::option::Option<wkt::FieldMask>,
3190
3191    /// Required. Updated ClientTlsPolicy resource.
3192    pub client_tls_policy: std::option::Option<crate::model::ClientTlsPolicy>,
3193
3194    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3195}
3196
3197impl UpdateClientTlsPolicyRequest {
3198    pub fn new() -> Self {
3199        std::default::Default::default()
3200    }
3201
3202    /// Sets the value of [update_mask][crate::model::UpdateClientTlsPolicyRequest::update_mask].
3203    ///
3204    /// # Example
3205    /// ```ignore,no_run
3206    /// # use google_cloud_networksecurity_v1::model::UpdateClientTlsPolicyRequest;
3207    /// use wkt::FieldMask;
3208    /// let x = UpdateClientTlsPolicyRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3209    /// ```
3210    pub fn set_update_mask<T>(mut self, v: T) -> Self
3211    where
3212        T: std::convert::Into<wkt::FieldMask>,
3213    {
3214        self.update_mask = std::option::Option::Some(v.into());
3215        self
3216    }
3217
3218    /// Sets or clears the value of [update_mask][crate::model::UpdateClientTlsPolicyRequest::update_mask].
3219    ///
3220    /// # Example
3221    /// ```ignore,no_run
3222    /// # use google_cloud_networksecurity_v1::model::UpdateClientTlsPolicyRequest;
3223    /// use wkt::FieldMask;
3224    /// let x = UpdateClientTlsPolicyRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3225    /// let x = UpdateClientTlsPolicyRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3226    /// ```
3227    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3228    where
3229        T: std::convert::Into<wkt::FieldMask>,
3230    {
3231        self.update_mask = v.map(|x| x.into());
3232        self
3233    }
3234
3235    /// Sets the value of [client_tls_policy][crate::model::UpdateClientTlsPolicyRequest::client_tls_policy].
3236    ///
3237    /// # Example
3238    /// ```ignore,no_run
3239    /// # use google_cloud_networksecurity_v1::model::UpdateClientTlsPolicyRequest;
3240    /// use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
3241    /// let x = UpdateClientTlsPolicyRequest::new().set_client_tls_policy(ClientTlsPolicy::default()/* use setters */);
3242    /// ```
3243    pub fn set_client_tls_policy<T>(mut self, v: T) -> Self
3244    where
3245        T: std::convert::Into<crate::model::ClientTlsPolicy>,
3246    {
3247        self.client_tls_policy = std::option::Option::Some(v.into());
3248        self
3249    }
3250
3251    /// Sets or clears the value of [client_tls_policy][crate::model::UpdateClientTlsPolicyRequest::client_tls_policy].
3252    ///
3253    /// # Example
3254    /// ```ignore,no_run
3255    /// # use google_cloud_networksecurity_v1::model::UpdateClientTlsPolicyRequest;
3256    /// use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
3257    /// let x = UpdateClientTlsPolicyRequest::new().set_or_clear_client_tls_policy(Some(ClientTlsPolicy::default()/* use setters */));
3258    /// let x = UpdateClientTlsPolicyRequest::new().set_or_clear_client_tls_policy(None::<ClientTlsPolicy>);
3259    /// ```
3260    pub fn set_or_clear_client_tls_policy<T>(mut self, v: std::option::Option<T>) -> Self
3261    where
3262        T: std::convert::Into<crate::model::ClientTlsPolicy>,
3263    {
3264        self.client_tls_policy = v.map(|x| x.into());
3265        self
3266    }
3267}
3268
3269impl wkt::message::Message for UpdateClientTlsPolicyRequest {
3270    fn typename() -> &'static str {
3271        "type.googleapis.com/google.cloud.networksecurity.v1.UpdateClientTlsPolicyRequest"
3272    }
3273}
3274
3275/// Request used by the DeleteClientTlsPolicy method.
3276#[derive(Clone, Default, PartialEq)]
3277#[non_exhaustive]
3278pub struct DeleteClientTlsPolicyRequest {
3279    /// Required. A name of the ClientTlsPolicy to delete. Must be in
3280    /// the format `projects/*/locations/{location}/clientTlsPolicies/*`.
3281    pub name: std::string::String,
3282
3283    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3284}
3285
3286impl DeleteClientTlsPolicyRequest {
3287    pub fn new() -> Self {
3288        std::default::Default::default()
3289    }
3290
3291    /// Sets the value of [name][crate::model::DeleteClientTlsPolicyRequest::name].
3292    ///
3293    /// # Example
3294    /// ```ignore,no_run
3295    /// # use google_cloud_networksecurity_v1::model::DeleteClientTlsPolicyRequest;
3296    /// let x = DeleteClientTlsPolicyRequest::new().set_name("example");
3297    /// ```
3298    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3299        self.name = v.into();
3300        self
3301    }
3302}
3303
3304impl wkt::message::Message for DeleteClientTlsPolicyRequest {
3305    fn typename() -> &'static str {
3306        "type.googleapis.com/google.cloud.networksecurity.v1.DeleteClientTlsPolicyRequest"
3307    }
3308}
3309
3310/// Represents the metadata of the long-running operation.
3311#[derive(Clone, Default, PartialEq)]
3312#[non_exhaustive]
3313pub struct OperationMetadata {
3314    /// Output only. The time the operation was created.
3315    pub create_time: std::option::Option<wkt::Timestamp>,
3316
3317    /// Output only. The time the operation finished running.
3318    pub end_time: std::option::Option<wkt::Timestamp>,
3319
3320    /// Output only. Server-defined resource path for the target of the operation.
3321    pub target: std::string::String,
3322
3323    /// Output only. Name of the verb executed by the operation.
3324    pub verb: std::string::String,
3325
3326    /// Output only. Human-readable status of the operation, if any.
3327    pub status_message: std::string::String,
3328
3329    /// Output only. Identifies whether the user has requested cancellation
3330    /// of the operation. Operations that have successfully been cancelled
3331    /// have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
3332    /// corresponding to `Code.CANCELLED`.
3333    ///
3334    /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
3335    pub requested_cancellation: bool,
3336
3337    /// Output only. API version used to start the operation.
3338    pub api_version: std::string::String,
3339
3340    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3341}
3342
3343impl OperationMetadata {
3344    pub fn new() -> Self {
3345        std::default::Default::default()
3346    }
3347
3348    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
3349    ///
3350    /// # Example
3351    /// ```ignore,no_run
3352    /// # use google_cloud_networksecurity_v1::model::OperationMetadata;
3353    /// use wkt::Timestamp;
3354    /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
3355    /// ```
3356    pub fn set_create_time<T>(mut self, v: T) -> Self
3357    where
3358        T: std::convert::Into<wkt::Timestamp>,
3359    {
3360        self.create_time = std::option::Option::Some(v.into());
3361        self
3362    }
3363
3364    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
3365    ///
3366    /// # Example
3367    /// ```ignore,no_run
3368    /// # use google_cloud_networksecurity_v1::model::OperationMetadata;
3369    /// use wkt::Timestamp;
3370    /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3371    /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
3372    /// ```
3373    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3374    where
3375        T: std::convert::Into<wkt::Timestamp>,
3376    {
3377        self.create_time = v.map(|x| x.into());
3378        self
3379    }
3380
3381    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
3382    ///
3383    /// # Example
3384    /// ```ignore,no_run
3385    /// # use google_cloud_networksecurity_v1::model::OperationMetadata;
3386    /// use wkt::Timestamp;
3387    /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
3388    /// ```
3389    pub fn set_end_time<T>(mut self, v: T) -> Self
3390    where
3391        T: std::convert::Into<wkt::Timestamp>,
3392    {
3393        self.end_time = std::option::Option::Some(v.into());
3394        self
3395    }
3396
3397    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
3398    ///
3399    /// # Example
3400    /// ```ignore,no_run
3401    /// # use google_cloud_networksecurity_v1::model::OperationMetadata;
3402    /// use wkt::Timestamp;
3403    /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
3404    /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
3405    /// ```
3406    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3407    where
3408        T: std::convert::Into<wkt::Timestamp>,
3409    {
3410        self.end_time = v.map(|x| x.into());
3411        self
3412    }
3413
3414    /// Sets the value of [target][crate::model::OperationMetadata::target].
3415    ///
3416    /// # Example
3417    /// ```ignore,no_run
3418    /// # use google_cloud_networksecurity_v1::model::OperationMetadata;
3419    /// let x = OperationMetadata::new().set_target("example");
3420    /// ```
3421    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3422        self.target = v.into();
3423        self
3424    }
3425
3426    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
3427    ///
3428    /// # Example
3429    /// ```ignore,no_run
3430    /// # use google_cloud_networksecurity_v1::model::OperationMetadata;
3431    /// let x = OperationMetadata::new().set_verb("example");
3432    /// ```
3433    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3434        self.verb = v.into();
3435        self
3436    }
3437
3438    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
3439    ///
3440    /// # Example
3441    /// ```ignore,no_run
3442    /// # use google_cloud_networksecurity_v1::model::OperationMetadata;
3443    /// let x = OperationMetadata::new().set_status_message("example");
3444    /// ```
3445    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3446        self.status_message = v.into();
3447        self
3448    }
3449
3450    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
3451    ///
3452    /// # Example
3453    /// ```ignore,no_run
3454    /// # use google_cloud_networksecurity_v1::model::OperationMetadata;
3455    /// let x = OperationMetadata::new().set_requested_cancellation(true);
3456    /// ```
3457    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3458        self.requested_cancellation = v.into();
3459        self
3460    }
3461
3462    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
3463    ///
3464    /// # Example
3465    /// ```ignore,no_run
3466    /// # use google_cloud_networksecurity_v1::model::OperationMetadata;
3467    /// let x = OperationMetadata::new().set_api_version("example");
3468    /// ```
3469    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3470        self.api_version = v.into();
3471        self
3472    }
3473}
3474
3475impl wkt::message::Message for OperationMetadata {
3476    fn typename() -> &'static str {
3477        "type.googleapis.com/google.cloud.networksecurity.v1.OperationMetadata"
3478    }
3479}
3480
3481/// ServerTlsPolicy is a resource that specifies how a server should authenticate
3482/// incoming requests. This resource itself does not affect configuration unless
3483/// it is attached to a target https proxy or endpoint config selector resource.
3484#[derive(Clone, Default, PartialEq)]
3485#[non_exhaustive]
3486pub struct ServerTlsPolicy {
3487    /// Required. Name of the ServerTlsPolicy resource. It matches the pattern
3488    /// `projects/*/locations/{location}/serverTlsPolicies/{server_tls_policy}`
3489    pub name: std::string::String,
3490
3491    /// Free-text description of the resource.
3492    pub description: std::string::String,
3493
3494    /// Output only. The timestamp when the resource was created.
3495    pub create_time: std::option::Option<wkt::Timestamp>,
3496
3497    /// Output only. The timestamp when the resource was updated.
3498    pub update_time: std::option::Option<wkt::Timestamp>,
3499
3500    /// Set of label tags associated with the resource.
3501    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3502
3503    /// Determines if server allows plaintext connections. If set to true, server
3504    /// allows plain text connections. By default, it is set to false. This setting
3505    /// is not exclusive of other encryption modes. For example, if `allow_open`
3506    /// and `mtls_policy` are set, server allows both plain text and mTLS
3507    /// connections. See documentation of other encryption modes to confirm
3508    /// compatibility.
3509    ///
3510    /// Consider using it if you wish to upgrade in place your deployment to TLS
3511    /// while having mixed TLS and non-TLS traffic reaching port :80.
3512    pub allow_open: bool,
3513
3514    /// Defines a mechanism to provision server identity (public and private keys).
3515    /// Cannot be combined with `allow_open` as a permissive mode that allows both
3516    /// plain text and TLS is not supported.
3517    pub server_certificate: std::option::Option<crate::model::CertificateProvider>,
3518
3519    /// Defines a mechanism to provision peer validation certificates for peer to
3520    /// peer authentication (Mutual TLS - mTLS). If not specified, client
3521    /// certificate will not be requested. The connection is treated as TLS and not
3522    /// mTLS. If `allow_open` and `mtls_policy` are set, server allows both plain
3523    /// text and mTLS connections.
3524    pub mtls_policy: std::option::Option<crate::model::server_tls_policy::MTLSPolicy>,
3525
3526    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3527}
3528
3529impl ServerTlsPolicy {
3530    pub fn new() -> Self {
3531        std::default::Default::default()
3532    }
3533
3534    /// Sets the value of [name][crate::model::ServerTlsPolicy::name].
3535    ///
3536    /// # Example
3537    /// ```ignore,no_run
3538    /// # use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
3539    /// let x = ServerTlsPolicy::new().set_name("example");
3540    /// ```
3541    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3542        self.name = v.into();
3543        self
3544    }
3545
3546    /// Sets the value of [description][crate::model::ServerTlsPolicy::description].
3547    ///
3548    /// # Example
3549    /// ```ignore,no_run
3550    /// # use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
3551    /// let x = ServerTlsPolicy::new().set_description("example");
3552    /// ```
3553    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3554        self.description = v.into();
3555        self
3556    }
3557
3558    /// Sets the value of [create_time][crate::model::ServerTlsPolicy::create_time].
3559    ///
3560    /// # Example
3561    /// ```ignore,no_run
3562    /// # use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
3563    /// use wkt::Timestamp;
3564    /// let x = ServerTlsPolicy::new().set_create_time(Timestamp::default()/* use setters */);
3565    /// ```
3566    pub fn set_create_time<T>(mut self, v: T) -> Self
3567    where
3568        T: std::convert::Into<wkt::Timestamp>,
3569    {
3570        self.create_time = std::option::Option::Some(v.into());
3571        self
3572    }
3573
3574    /// Sets or clears the value of [create_time][crate::model::ServerTlsPolicy::create_time].
3575    ///
3576    /// # Example
3577    /// ```ignore,no_run
3578    /// # use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
3579    /// use wkt::Timestamp;
3580    /// let x = ServerTlsPolicy::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3581    /// let x = ServerTlsPolicy::new().set_or_clear_create_time(None::<Timestamp>);
3582    /// ```
3583    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3584    where
3585        T: std::convert::Into<wkt::Timestamp>,
3586    {
3587        self.create_time = v.map(|x| x.into());
3588        self
3589    }
3590
3591    /// Sets the value of [update_time][crate::model::ServerTlsPolicy::update_time].
3592    ///
3593    /// # Example
3594    /// ```ignore,no_run
3595    /// # use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
3596    /// use wkt::Timestamp;
3597    /// let x = ServerTlsPolicy::new().set_update_time(Timestamp::default()/* use setters */);
3598    /// ```
3599    pub fn set_update_time<T>(mut self, v: T) -> Self
3600    where
3601        T: std::convert::Into<wkt::Timestamp>,
3602    {
3603        self.update_time = std::option::Option::Some(v.into());
3604        self
3605    }
3606
3607    /// Sets or clears the value of [update_time][crate::model::ServerTlsPolicy::update_time].
3608    ///
3609    /// # Example
3610    /// ```ignore,no_run
3611    /// # use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
3612    /// use wkt::Timestamp;
3613    /// let x = ServerTlsPolicy::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
3614    /// let x = ServerTlsPolicy::new().set_or_clear_update_time(None::<Timestamp>);
3615    /// ```
3616    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3617    where
3618        T: std::convert::Into<wkt::Timestamp>,
3619    {
3620        self.update_time = v.map(|x| x.into());
3621        self
3622    }
3623
3624    /// Sets the value of [labels][crate::model::ServerTlsPolicy::labels].
3625    ///
3626    /// # Example
3627    /// ```ignore,no_run
3628    /// # use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
3629    /// let x = ServerTlsPolicy::new().set_labels([
3630    ///     ("key0", "abc"),
3631    ///     ("key1", "xyz"),
3632    /// ]);
3633    /// ```
3634    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3635    where
3636        T: std::iter::IntoIterator<Item = (K, V)>,
3637        K: std::convert::Into<std::string::String>,
3638        V: std::convert::Into<std::string::String>,
3639    {
3640        use std::iter::Iterator;
3641        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3642        self
3643    }
3644
3645    /// Sets the value of [allow_open][crate::model::ServerTlsPolicy::allow_open].
3646    ///
3647    /// # Example
3648    /// ```ignore,no_run
3649    /// # use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
3650    /// let x = ServerTlsPolicy::new().set_allow_open(true);
3651    /// ```
3652    pub fn set_allow_open<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3653        self.allow_open = v.into();
3654        self
3655    }
3656
3657    /// Sets the value of [server_certificate][crate::model::ServerTlsPolicy::server_certificate].
3658    ///
3659    /// # Example
3660    /// ```ignore,no_run
3661    /// # use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
3662    /// use google_cloud_networksecurity_v1::model::CertificateProvider;
3663    /// let x = ServerTlsPolicy::new().set_server_certificate(CertificateProvider::default()/* use setters */);
3664    /// ```
3665    pub fn set_server_certificate<T>(mut self, v: T) -> Self
3666    where
3667        T: std::convert::Into<crate::model::CertificateProvider>,
3668    {
3669        self.server_certificate = std::option::Option::Some(v.into());
3670        self
3671    }
3672
3673    /// Sets or clears the value of [server_certificate][crate::model::ServerTlsPolicy::server_certificate].
3674    ///
3675    /// # Example
3676    /// ```ignore,no_run
3677    /// # use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
3678    /// use google_cloud_networksecurity_v1::model::CertificateProvider;
3679    /// let x = ServerTlsPolicy::new().set_or_clear_server_certificate(Some(CertificateProvider::default()/* use setters */));
3680    /// let x = ServerTlsPolicy::new().set_or_clear_server_certificate(None::<CertificateProvider>);
3681    /// ```
3682    pub fn set_or_clear_server_certificate<T>(mut self, v: std::option::Option<T>) -> Self
3683    where
3684        T: std::convert::Into<crate::model::CertificateProvider>,
3685    {
3686        self.server_certificate = v.map(|x| x.into());
3687        self
3688    }
3689
3690    /// Sets the value of [mtls_policy][crate::model::ServerTlsPolicy::mtls_policy].
3691    ///
3692    /// # Example
3693    /// ```ignore,no_run
3694    /// # use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
3695    /// use google_cloud_networksecurity_v1::model::server_tls_policy::MTLSPolicy;
3696    /// let x = ServerTlsPolicy::new().set_mtls_policy(MTLSPolicy::default()/* use setters */);
3697    /// ```
3698    pub fn set_mtls_policy<T>(mut self, v: T) -> Self
3699    where
3700        T: std::convert::Into<crate::model::server_tls_policy::MTLSPolicy>,
3701    {
3702        self.mtls_policy = std::option::Option::Some(v.into());
3703        self
3704    }
3705
3706    /// Sets or clears the value of [mtls_policy][crate::model::ServerTlsPolicy::mtls_policy].
3707    ///
3708    /// # Example
3709    /// ```ignore,no_run
3710    /// # use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
3711    /// use google_cloud_networksecurity_v1::model::server_tls_policy::MTLSPolicy;
3712    /// let x = ServerTlsPolicy::new().set_or_clear_mtls_policy(Some(MTLSPolicy::default()/* use setters */));
3713    /// let x = ServerTlsPolicy::new().set_or_clear_mtls_policy(None::<MTLSPolicy>);
3714    /// ```
3715    pub fn set_or_clear_mtls_policy<T>(mut self, v: std::option::Option<T>) -> Self
3716    where
3717        T: std::convert::Into<crate::model::server_tls_policy::MTLSPolicy>,
3718    {
3719        self.mtls_policy = v.map(|x| x.into());
3720        self
3721    }
3722}
3723
3724impl wkt::message::Message for ServerTlsPolicy {
3725    fn typename() -> &'static str {
3726        "type.googleapis.com/google.cloud.networksecurity.v1.ServerTlsPolicy"
3727    }
3728}
3729
3730/// Defines additional types related to [ServerTlsPolicy].
3731pub mod server_tls_policy {
3732    #[allow(unused_imports)]
3733    use super::*;
3734
3735    /// Specification of the MTLSPolicy.
3736    #[derive(Clone, Default, PartialEq)]
3737    #[non_exhaustive]
3738    pub struct MTLSPolicy {
3739        /// Defines the mechanism to obtain the Certificate Authority certificate to
3740        /// validate the client certificate.
3741        pub client_validation_ca: std::vec::Vec<crate::model::ValidationCA>,
3742
3743        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3744    }
3745
3746    impl MTLSPolicy {
3747        pub fn new() -> Self {
3748            std::default::Default::default()
3749        }
3750
3751        /// Sets the value of [client_validation_ca][crate::model::server_tls_policy::MTLSPolicy::client_validation_ca].
3752        ///
3753        /// # Example
3754        /// ```ignore,no_run
3755        /// # use google_cloud_networksecurity_v1::model::server_tls_policy::MTLSPolicy;
3756        /// use google_cloud_networksecurity_v1::model::ValidationCA;
3757        /// let x = MTLSPolicy::new()
3758        ///     .set_client_validation_ca([
3759        ///         ValidationCA::default()/* use setters */,
3760        ///         ValidationCA::default()/* use (different) setters */,
3761        ///     ]);
3762        /// ```
3763        pub fn set_client_validation_ca<T, V>(mut self, v: T) -> Self
3764        where
3765            T: std::iter::IntoIterator<Item = V>,
3766            V: std::convert::Into<crate::model::ValidationCA>,
3767        {
3768            use std::iter::Iterator;
3769            self.client_validation_ca = v.into_iter().map(|i| i.into()).collect();
3770            self
3771        }
3772    }
3773
3774    impl wkt::message::Message for MTLSPolicy {
3775        fn typename() -> &'static str {
3776            "type.googleapis.com/google.cloud.networksecurity.v1.ServerTlsPolicy.MTLSPolicy"
3777        }
3778    }
3779}
3780
3781/// Request used by the ListServerTlsPolicies method.
3782#[derive(Clone, Default, PartialEq)]
3783#[non_exhaustive]
3784pub struct ListServerTlsPoliciesRequest {
3785    /// Required. The project and location from which the ServerTlsPolicies should
3786    /// be listed, specified in the format `projects/*/locations/{location}`.
3787    pub parent: std::string::String,
3788
3789    /// Maximum number of ServerTlsPolicies to return per call.
3790    pub page_size: i32,
3791
3792    /// The value returned by the last `ListServerTlsPoliciesResponse`
3793    /// Indicates that this is a continuation of a prior
3794    /// `ListServerTlsPolicies` call, and that the system
3795    /// should return the next page of data.
3796    pub page_token: std::string::String,
3797
3798    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3799}
3800
3801impl ListServerTlsPoliciesRequest {
3802    pub fn new() -> Self {
3803        std::default::Default::default()
3804    }
3805
3806    /// Sets the value of [parent][crate::model::ListServerTlsPoliciesRequest::parent].
3807    ///
3808    /// # Example
3809    /// ```ignore,no_run
3810    /// # use google_cloud_networksecurity_v1::model::ListServerTlsPoliciesRequest;
3811    /// let x = ListServerTlsPoliciesRequest::new().set_parent("example");
3812    /// ```
3813    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3814        self.parent = v.into();
3815        self
3816    }
3817
3818    /// Sets the value of [page_size][crate::model::ListServerTlsPoliciesRequest::page_size].
3819    ///
3820    /// # Example
3821    /// ```ignore,no_run
3822    /// # use google_cloud_networksecurity_v1::model::ListServerTlsPoliciesRequest;
3823    /// let x = ListServerTlsPoliciesRequest::new().set_page_size(42);
3824    /// ```
3825    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3826        self.page_size = v.into();
3827        self
3828    }
3829
3830    /// Sets the value of [page_token][crate::model::ListServerTlsPoliciesRequest::page_token].
3831    ///
3832    /// # Example
3833    /// ```ignore,no_run
3834    /// # use google_cloud_networksecurity_v1::model::ListServerTlsPoliciesRequest;
3835    /// let x = ListServerTlsPoliciesRequest::new().set_page_token("example");
3836    /// ```
3837    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3838        self.page_token = v.into();
3839        self
3840    }
3841}
3842
3843impl wkt::message::Message for ListServerTlsPoliciesRequest {
3844    fn typename() -> &'static str {
3845        "type.googleapis.com/google.cloud.networksecurity.v1.ListServerTlsPoliciesRequest"
3846    }
3847}
3848
3849/// Response returned by the ListServerTlsPolicies method.
3850#[derive(Clone, Default, PartialEq)]
3851#[non_exhaustive]
3852pub struct ListServerTlsPoliciesResponse {
3853    /// List of ServerTlsPolicy resources.
3854    pub server_tls_policies: std::vec::Vec<crate::model::ServerTlsPolicy>,
3855
3856    /// If there might be more results than those appearing in this response, then
3857    /// `next_page_token` is included. To get the next set of results, call this
3858    /// method again using the value of `next_page_token` as `page_token`.
3859    pub next_page_token: std::string::String,
3860
3861    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3862}
3863
3864impl ListServerTlsPoliciesResponse {
3865    pub fn new() -> Self {
3866        std::default::Default::default()
3867    }
3868
3869    /// Sets the value of [server_tls_policies][crate::model::ListServerTlsPoliciesResponse::server_tls_policies].
3870    ///
3871    /// # Example
3872    /// ```ignore,no_run
3873    /// # use google_cloud_networksecurity_v1::model::ListServerTlsPoliciesResponse;
3874    /// use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
3875    /// let x = ListServerTlsPoliciesResponse::new()
3876    ///     .set_server_tls_policies([
3877    ///         ServerTlsPolicy::default()/* use setters */,
3878    ///         ServerTlsPolicy::default()/* use (different) setters */,
3879    ///     ]);
3880    /// ```
3881    pub fn set_server_tls_policies<T, V>(mut self, v: T) -> Self
3882    where
3883        T: std::iter::IntoIterator<Item = V>,
3884        V: std::convert::Into<crate::model::ServerTlsPolicy>,
3885    {
3886        use std::iter::Iterator;
3887        self.server_tls_policies = v.into_iter().map(|i| i.into()).collect();
3888        self
3889    }
3890
3891    /// Sets the value of [next_page_token][crate::model::ListServerTlsPoliciesResponse::next_page_token].
3892    ///
3893    /// # Example
3894    /// ```ignore,no_run
3895    /// # use google_cloud_networksecurity_v1::model::ListServerTlsPoliciesResponse;
3896    /// let x = ListServerTlsPoliciesResponse::new().set_next_page_token("example");
3897    /// ```
3898    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3899        self.next_page_token = v.into();
3900        self
3901    }
3902}
3903
3904impl wkt::message::Message for ListServerTlsPoliciesResponse {
3905    fn typename() -> &'static str {
3906        "type.googleapis.com/google.cloud.networksecurity.v1.ListServerTlsPoliciesResponse"
3907    }
3908}
3909
3910#[doc(hidden)]
3911impl google_cloud_gax::paginator::internal::PageableResponse for ListServerTlsPoliciesResponse {
3912    type PageItem = crate::model::ServerTlsPolicy;
3913
3914    fn items(self) -> std::vec::Vec<Self::PageItem> {
3915        self.server_tls_policies
3916    }
3917
3918    fn next_page_token(&self) -> std::string::String {
3919        use std::clone::Clone;
3920        self.next_page_token.clone()
3921    }
3922}
3923
3924/// Request used by the GetServerTlsPolicy method.
3925#[derive(Clone, Default, PartialEq)]
3926#[non_exhaustive]
3927pub struct GetServerTlsPolicyRequest {
3928    /// Required. A name of the ServerTlsPolicy to get. Must be in the format
3929    /// `projects/*/locations/{location}/serverTlsPolicies/*`.
3930    pub name: std::string::String,
3931
3932    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3933}
3934
3935impl GetServerTlsPolicyRequest {
3936    pub fn new() -> Self {
3937        std::default::Default::default()
3938    }
3939
3940    /// Sets the value of [name][crate::model::GetServerTlsPolicyRequest::name].
3941    ///
3942    /// # Example
3943    /// ```ignore,no_run
3944    /// # use google_cloud_networksecurity_v1::model::GetServerTlsPolicyRequest;
3945    /// let x = GetServerTlsPolicyRequest::new().set_name("example");
3946    /// ```
3947    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3948        self.name = v.into();
3949        self
3950    }
3951}
3952
3953impl wkt::message::Message for GetServerTlsPolicyRequest {
3954    fn typename() -> &'static str {
3955        "type.googleapis.com/google.cloud.networksecurity.v1.GetServerTlsPolicyRequest"
3956    }
3957}
3958
3959/// Request used by the CreateServerTlsPolicy method.
3960#[derive(Clone, Default, PartialEq)]
3961#[non_exhaustive]
3962pub struct CreateServerTlsPolicyRequest {
3963    /// Required. The parent resource of the ServerTlsPolicy. Must be in
3964    /// the format `projects/*/locations/{location}`.
3965    pub parent: std::string::String,
3966
3967    /// Required. Short name of the ServerTlsPolicy resource to be created. This value should
3968    /// be 1-63 characters long, containing only letters, numbers, hyphens, and
3969    /// underscores, and should not start with a number. E.g. "server_mtls_policy".
3970    pub server_tls_policy_id: std::string::String,
3971
3972    /// Required. ServerTlsPolicy resource to be created.
3973    pub server_tls_policy: std::option::Option<crate::model::ServerTlsPolicy>,
3974
3975    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3976}
3977
3978impl CreateServerTlsPolicyRequest {
3979    pub fn new() -> Self {
3980        std::default::Default::default()
3981    }
3982
3983    /// Sets the value of [parent][crate::model::CreateServerTlsPolicyRequest::parent].
3984    ///
3985    /// # Example
3986    /// ```ignore,no_run
3987    /// # use google_cloud_networksecurity_v1::model::CreateServerTlsPolicyRequest;
3988    /// let x = CreateServerTlsPolicyRequest::new().set_parent("example");
3989    /// ```
3990    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3991        self.parent = v.into();
3992        self
3993    }
3994
3995    /// Sets the value of [server_tls_policy_id][crate::model::CreateServerTlsPolicyRequest::server_tls_policy_id].
3996    ///
3997    /// # Example
3998    /// ```ignore,no_run
3999    /// # use google_cloud_networksecurity_v1::model::CreateServerTlsPolicyRequest;
4000    /// let x = CreateServerTlsPolicyRequest::new().set_server_tls_policy_id("example");
4001    /// ```
4002    pub fn set_server_tls_policy_id<T: std::convert::Into<std::string::String>>(
4003        mut self,
4004        v: T,
4005    ) -> Self {
4006        self.server_tls_policy_id = v.into();
4007        self
4008    }
4009
4010    /// Sets the value of [server_tls_policy][crate::model::CreateServerTlsPolicyRequest::server_tls_policy].
4011    ///
4012    /// # Example
4013    /// ```ignore,no_run
4014    /// # use google_cloud_networksecurity_v1::model::CreateServerTlsPolicyRequest;
4015    /// use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
4016    /// let x = CreateServerTlsPolicyRequest::new().set_server_tls_policy(ServerTlsPolicy::default()/* use setters */);
4017    /// ```
4018    pub fn set_server_tls_policy<T>(mut self, v: T) -> Self
4019    where
4020        T: std::convert::Into<crate::model::ServerTlsPolicy>,
4021    {
4022        self.server_tls_policy = std::option::Option::Some(v.into());
4023        self
4024    }
4025
4026    /// Sets or clears the value of [server_tls_policy][crate::model::CreateServerTlsPolicyRequest::server_tls_policy].
4027    ///
4028    /// # Example
4029    /// ```ignore,no_run
4030    /// # use google_cloud_networksecurity_v1::model::CreateServerTlsPolicyRequest;
4031    /// use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
4032    /// let x = CreateServerTlsPolicyRequest::new().set_or_clear_server_tls_policy(Some(ServerTlsPolicy::default()/* use setters */));
4033    /// let x = CreateServerTlsPolicyRequest::new().set_or_clear_server_tls_policy(None::<ServerTlsPolicy>);
4034    /// ```
4035    pub fn set_or_clear_server_tls_policy<T>(mut self, v: std::option::Option<T>) -> Self
4036    where
4037        T: std::convert::Into<crate::model::ServerTlsPolicy>,
4038    {
4039        self.server_tls_policy = v.map(|x| x.into());
4040        self
4041    }
4042}
4043
4044impl wkt::message::Message for CreateServerTlsPolicyRequest {
4045    fn typename() -> &'static str {
4046        "type.googleapis.com/google.cloud.networksecurity.v1.CreateServerTlsPolicyRequest"
4047    }
4048}
4049
4050/// Request used by UpdateServerTlsPolicy method.
4051#[derive(Clone, Default, PartialEq)]
4052#[non_exhaustive]
4053pub struct UpdateServerTlsPolicyRequest {
4054    /// Optional. Field mask is used to specify the fields to be overwritten in the
4055    /// ServerTlsPolicy resource by the update.  The fields
4056    /// specified in the update_mask are relative to the resource, not
4057    /// the full request. A field will be overwritten if it is in the
4058    /// mask. If the user does not provide a mask then all fields will be
4059    /// overwritten.
4060    pub update_mask: std::option::Option<wkt::FieldMask>,
4061
4062    /// Required. Updated ServerTlsPolicy resource.
4063    pub server_tls_policy: std::option::Option<crate::model::ServerTlsPolicy>,
4064
4065    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4066}
4067
4068impl UpdateServerTlsPolicyRequest {
4069    pub fn new() -> Self {
4070        std::default::Default::default()
4071    }
4072
4073    /// Sets the value of [update_mask][crate::model::UpdateServerTlsPolicyRequest::update_mask].
4074    ///
4075    /// # Example
4076    /// ```ignore,no_run
4077    /// # use google_cloud_networksecurity_v1::model::UpdateServerTlsPolicyRequest;
4078    /// use wkt::FieldMask;
4079    /// let x = UpdateServerTlsPolicyRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4080    /// ```
4081    pub fn set_update_mask<T>(mut self, v: T) -> Self
4082    where
4083        T: std::convert::Into<wkt::FieldMask>,
4084    {
4085        self.update_mask = std::option::Option::Some(v.into());
4086        self
4087    }
4088
4089    /// Sets or clears the value of [update_mask][crate::model::UpdateServerTlsPolicyRequest::update_mask].
4090    ///
4091    /// # Example
4092    /// ```ignore,no_run
4093    /// # use google_cloud_networksecurity_v1::model::UpdateServerTlsPolicyRequest;
4094    /// use wkt::FieldMask;
4095    /// let x = UpdateServerTlsPolicyRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4096    /// let x = UpdateServerTlsPolicyRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4097    /// ```
4098    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4099    where
4100        T: std::convert::Into<wkt::FieldMask>,
4101    {
4102        self.update_mask = v.map(|x| x.into());
4103        self
4104    }
4105
4106    /// Sets the value of [server_tls_policy][crate::model::UpdateServerTlsPolicyRequest::server_tls_policy].
4107    ///
4108    /// # Example
4109    /// ```ignore,no_run
4110    /// # use google_cloud_networksecurity_v1::model::UpdateServerTlsPolicyRequest;
4111    /// use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
4112    /// let x = UpdateServerTlsPolicyRequest::new().set_server_tls_policy(ServerTlsPolicy::default()/* use setters */);
4113    /// ```
4114    pub fn set_server_tls_policy<T>(mut self, v: T) -> Self
4115    where
4116        T: std::convert::Into<crate::model::ServerTlsPolicy>,
4117    {
4118        self.server_tls_policy = std::option::Option::Some(v.into());
4119        self
4120    }
4121
4122    /// Sets or clears the value of [server_tls_policy][crate::model::UpdateServerTlsPolicyRequest::server_tls_policy].
4123    ///
4124    /// # Example
4125    /// ```ignore,no_run
4126    /// # use google_cloud_networksecurity_v1::model::UpdateServerTlsPolicyRequest;
4127    /// use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
4128    /// let x = UpdateServerTlsPolicyRequest::new().set_or_clear_server_tls_policy(Some(ServerTlsPolicy::default()/* use setters */));
4129    /// let x = UpdateServerTlsPolicyRequest::new().set_or_clear_server_tls_policy(None::<ServerTlsPolicy>);
4130    /// ```
4131    pub fn set_or_clear_server_tls_policy<T>(mut self, v: std::option::Option<T>) -> Self
4132    where
4133        T: std::convert::Into<crate::model::ServerTlsPolicy>,
4134    {
4135        self.server_tls_policy = v.map(|x| x.into());
4136        self
4137    }
4138}
4139
4140impl wkt::message::Message for UpdateServerTlsPolicyRequest {
4141    fn typename() -> &'static str {
4142        "type.googleapis.com/google.cloud.networksecurity.v1.UpdateServerTlsPolicyRequest"
4143    }
4144}
4145
4146/// Request used by the DeleteServerTlsPolicy method.
4147#[derive(Clone, Default, PartialEq)]
4148#[non_exhaustive]
4149pub struct DeleteServerTlsPolicyRequest {
4150    /// Required. A name of the ServerTlsPolicy to delete. Must be in
4151    /// the format `projects/*/locations/{location}/serverTlsPolicies/*`.
4152    pub name: std::string::String,
4153
4154    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4155}
4156
4157impl DeleteServerTlsPolicyRequest {
4158    pub fn new() -> Self {
4159        std::default::Default::default()
4160    }
4161
4162    /// Sets the value of [name][crate::model::DeleteServerTlsPolicyRequest::name].
4163    ///
4164    /// # Example
4165    /// ```ignore,no_run
4166    /// # use google_cloud_networksecurity_v1::model::DeleteServerTlsPolicyRequest;
4167    /// let x = DeleteServerTlsPolicyRequest::new().set_name("example");
4168    /// ```
4169    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4170        self.name = v.into();
4171        self
4172    }
4173}
4174
4175impl wkt::message::Message for DeleteServerTlsPolicyRequest {
4176    fn typename() -> &'static str {
4177        "type.googleapis.com/google.cloud.networksecurity.v1.DeleteServerTlsPolicyRequest"
4178    }
4179}
4180
4181/// Specification of the GRPC Endpoint.
4182#[derive(Clone, Default, PartialEq)]
4183#[non_exhaustive]
4184pub struct GrpcEndpoint {
4185    /// Required. The target URI of the gRPC endpoint. Only UDS path is supported, and
4186    /// should start with "unix:".
4187    pub target_uri: std::string::String,
4188
4189    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4190}
4191
4192impl GrpcEndpoint {
4193    pub fn new() -> Self {
4194        std::default::Default::default()
4195    }
4196
4197    /// Sets the value of [target_uri][crate::model::GrpcEndpoint::target_uri].
4198    ///
4199    /// # Example
4200    /// ```ignore,no_run
4201    /// # use google_cloud_networksecurity_v1::model::GrpcEndpoint;
4202    /// let x = GrpcEndpoint::new().set_target_uri("example");
4203    /// ```
4204    pub fn set_target_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4205        self.target_uri = v.into();
4206        self
4207    }
4208}
4209
4210impl wkt::message::Message for GrpcEndpoint {
4211    fn typename() -> &'static str {
4212        "type.googleapis.com/google.cloud.networksecurity.v1.GrpcEndpoint"
4213    }
4214}
4215
4216/// Specification of ValidationCA. Defines the mechanism to obtain the
4217/// Certificate Authority certificate to validate the peer certificate.
4218#[derive(Clone, Default, PartialEq)]
4219#[non_exhaustive]
4220pub struct ValidationCA {
4221    /// The type of certificate provider which provides the CA certificate.
4222    pub r#type: std::option::Option<crate::model::validation_ca::Type>,
4223
4224    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4225}
4226
4227impl ValidationCA {
4228    pub fn new() -> Self {
4229        std::default::Default::default()
4230    }
4231
4232    /// Sets the value of [r#type][crate::model::ValidationCA::type].
4233    ///
4234    /// Note that all the setters affecting `r#type` are mutually
4235    /// exclusive.
4236    ///
4237    /// # Example
4238    /// ```ignore,no_run
4239    /// # use google_cloud_networksecurity_v1::model::ValidationCA;
4240    /// use google_cloud_networksecurity_v1::model::GrpcEndpoint;
4241    /// let x = ValidationCA::new().set_type(Some(
4242    ///     google_cloud_networksecurity_v1::model::validation_ca::Type::GrpcEndpoint(GrpcEndpoint::default().into())));
4243    /// ```
4244    pub fn set_type<
4245        T: std::convert::Into<std::option::Option<crate::model::validation_ca::Type>>,
4246    >(
4247        mut self,
4248        v: T,
4249    ) -> Self {
4250        self.r#type = v.into();
4251        self
4252    }
4253
4254    /// The value of [r#type][crate::model::ValidationCA::r#type]
4255    /// if it holds a `GrpcEndpoint`, `None` if the field is not set or
4256    /// holds a different branch.
4257    pub fn grpc_endpoint(
4258        &self,
4259    ) -> std::option::Option<&std::boxed::Box<crate::model::GrpcEndpoint>> {
4260        #[allow(unreachable_patterns)]
4261        self.r#type.as_ref().and_then(|v| match v {
4262            crate::model::validation_ca::Type::GrpcEndpoint(v) => std::option::Option::Some(v),
4263            _ => std::option::Option::None,
4264        })
4265    }
4266
4267    /// Sets the value of [r#type][crate::model::ValidationCA::r#type]
4268    /// to hold a `GrpcEndpoint`.
4269    ///
4270    /// Note that all the setters affecting `r#type` are
4271    /// mutually exclusive.
4272    ///
4273    /// # Example
4274    /// ```ignore,no_run
4275    /// # use google_cloud_networksecurity_v1::model::ValidationCA;
4276    /// use google_cloud_networksecurity_v1::model::GrpcEndpoint;
4277    /// let x = ValidationCA::new().set_grpc_endpoint(GrpcEndpoint::default()/* use setters */);
4278    /// assert!(x.grpc_endpoint().is_some());
4279    /// assert!(x.certificate_provider_instance().is_none());
4280    /// ```
4281    pub fn set_grpc_endpoint<T: std::convert::Into<std::boxed::Box<crate::model::GrpcEndpoint>>>(
4282        mut self,
4283        v: T,
4284    ) -> Self {
4285        self.r#type =
4286            std::option::Option::Some(crate::model::validation_ca::Type::GrpcEndpoint(v.into()));
4287        self
4288    }
4289
4290    /// The value of [r#type][crate::model::ValidationCA::r#type]
4291    /// if it holds a `CertificateProviderInstance`, `None` if the field is not set or
4292    /// holds a different branch.
4293    pub fn certificate_provider_instance(
4294        &self,
4295    ) -> std::option::Option<&std::boxed::Box<crate::model::CertificateProviderInstance>> {
4296        #[allow(unreachable_patterns)]
4297        self.r#type.as_ref().and_then(|v| match v {
4298            crate::model::validation_ca::Type::CertificateProviderInstance(v) => {
4299                std::option::Option::Some(v)
4300            }
4301            _ => std::option::Option::None,
4302        })
4303    }
4304
4305    /// Sets the value of [r#type][crate::model::ValidationCA::r#type]
4306    /// to hold a `CertificateProviderInstance`.
4307    ///
4308    /// Note that all the setters affecting `r#type` are
4309    /// mutually exclusive.
4310    ///
4311    /// # Example
4312    /// ```ignore,no_run
4313    /// # use google_cloud_networksecurity_v1::model::ValidationCA;
4314    /// use google_cloud_networksecurity_v1::model::CertificateProviderInstance;
4315    /// let x = ValidationCA::new().set_certificate_provider_instance(CertificateProviderInstance::default()/* use setters */);
4316    /// assert!(x.certificate_provider_instance().is_some());
4317    /// assert!(x.grpc_endpoint().is_none());
4318    /// ```
4319    pub fn set_certificate_provider_instance<
4320        T: std::convert::Into<std::boxed::Box<crate::model::CertificateProviderInstance>>,
4321    >(
4322        mut self,
4323        v: T,
4324    ) -> Self {
4325        self.r#type = std::option::Option::Some(
4326            crate::model::validation_ca::Type::CertificateProviderInstance(v.into()),
4327        );
4328        self
4329    }
4330}
4331
4332impl wkt::message::Message for ValidationCA {
4333    fn typename() -> &'static str {
4334        "type.googleapis.com/google.cloud.networksecurity.v1.ValidationCA"
4335    }
4336}
4337
4338/// Defines additional types related to [ValidationCA].
4339pub mod validation_ca {
4340    #[allow(unused_imports)]
4341    use super::*;
4342
4343    /// The type of certificate provider which provides the CA certificate.
4344    #[derive(Clone, Debug, PartialEq)]
4345    #[non_exhaustive]
4346    pub enum Type {
4347        /// gRPC specific configuration to access the gRPC server to
4348        /// obtain the CA certificate.
4349        GrpcEndpoint(std::boxed::Box<crate::model::GrpcEndpoint>),
4350        /// The certificate provider instance specification that will be passed to
4351        /// the data plane, which will be used to load necessary credential
4352        /// information.
4353        CertificateProviderInstance(std::boxed::Box<crate::model::CertificateProviderInstance>),
4354    }
4355}
4356
4357/// Specification of a TLS certificate provider instance. Workloads may have one
4358/// or more CertificateProvider instances (plugins) and one of them is enabled
4359/// and configured by specifying this message. Workloads use the values from this
4360/// message to locate and load the CertificateProvider instance configuration.
4361#[derive(Clone, Default, PartialEq)]
4362#[non_exhaustive]
4363pub struct CertificateProviderInstance {
4364    /// Required. Plugin instance name, used to locate and load CertificateProvider instance
4365    /// configuration. Set to "google_cloud_private_spiffe" to use Certificate
4366    /// Authority Service certificate provider instance.
4367    pub plugin_instance: std::string::String,
4368
4369    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4370}
4371
4372impl CertificateProviderInstance {
4373    pub fn new() -> Self {
4374        std::default::Default::default()
4375    }
4376
4377    /// Sets the value of [plugin_instance][crate::model::CertificateProviderInstance::plugin_instance].
4378    ///
4379    /// # Example
4380    /// ```ignore,no_run
4381    /// # use google_cloud_networksecurity_v1::model::CertificateProviderInstance;
4382    /// let x = CertificateProviderInstance::new().set_plugin_instance("example");
4383    /// ```
4384    pub fn set_plugin_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4385        self.plugin_instance = v.into();
4386        self
4387    }
4388}
4389
4390impl wkt::message::Message for CertificateProviderInstance {
4391    fn typename() -> &'static str {
4392        "type.googleapis.com/google.cloud.networksecurity.v1.CertificateProviderInstance"
4393    }
4394}
4395
4396/// Specification of certificate provider. Defines the mechanism to obtain the
4397/// certificate and private key for peer to peer authentication.
4398#[derive(Clone, Default, PartialEq)]
4399#[non_exhaustive]
4400pub struct CertificateProvider {
4401    /// The type of certificate provider which provides the certificates and
4402    /// private keys.
4403    pub r#type: std::option::Option<crate::model::certificate_provider::Type>,
4404
4405    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4406}
4407
4408impl CertificateProvider {
4409    pub fn new() -> Self {
4410        std::default::Default::default()
4411    }
4412
4413    /// Sets the value of [r#type][crate::model::CertificateProvider::type].
4414    ///
4415    /// Note that all the setters affecting `r#type` are mutually
4416    /// exclusive.
4417    ///
4418    /// # Example
4419    /// ```ignore,no_run
4420    /// # use google_cloud_networksecurity_v1::model::CertificateProvider;
4421    /// use google_cloud_networksecurity_v1::model::GrpcEndpoint;
4422    /// let x = CertificateProvider::new().set_type(Some(
4423    ///     google_cloud_networksecurity_v1::model::certificate_provider::Type::GrpcEndpoint(GrpcEndpoint::default().into())));
4424    /// ```
4425    pub fn set_type<
4426        T: std::convert::Into<std::option::Option<crate::model::certificate_provider::Type>>,
4427    >(
4428        mut self,
4429        v: T,
4430    ) -> Self {
4431        self.r#type = v.into();
4432        self
4433    }
4434
4435    /// The value of [r#type][crate::model::CertificateProvider::r#type]
4436    /// if it holds a `GrpcEndpoint`, `None` if the field is not set or
4437    /// holds a different branch.
4438    pub fn grpc_endpoint(
4439        &self,
4440    ) -> std::option::Option<&std::boxed::Box<crate::model::GrpcEndpoint>> {
4441        #[allow(unreachable_patterns)]
4442        self.r#type.as_ref().and_then(|v| match v {
4443            crate::model::certificate_provider::Type::GrpcEndpoint(v) => {
4444                std::option::Option::Some(v)
4445            }
4446            _ => std::option::Option::None,
4447        })
4448    }
4449
4450    /// Sets the value of [r#type][crate::model::CertificateProvider::r#type]
4451    /// to hold a `GrpcEndpoint`.
4452    ///
4453    /// Note that all the setters affecting `r#type` are
4454    /// mutually exclusive.
4455    ///
4456    /// # Example
4457    /// ```ignore,no_run
4458    /// # use google_cloud_networksecurity_v1::model::CertificateProvider;
4459    /// use google_cloud_networksecurity_v1::model::GrpcEndpoint;
4460    /// let x = CertificateProvider::new().set_grpc_endpoint(GrpcEndpoint::default()/* use setters */);
4461    /// assert!(x.grpc_endpoint().is_some());
4462    /// assert!(x.certificate_provider_instance().is_none());
4463    /// ```
4464    pub fn set_grpc_endpoint<T: std::convert::Into<std::boxed::Box<crate::model::GrpcEndpoint>>>(
4465        mut self,
4466        v: T,
4467    ) -> Self {
4468        self.r#type = std::option::Option::Some(
4469            crate::model::certificate_provider::Type::GrpcEndpoint(v.into()),
4470        );
4471        self
4472    }
4473
4474    /// The value of [r#type][crate::model::CertificateProvider::r#type]
4475    /// if it holds a `CertificateProviderInstance`, `None` if the field is not set or
4476    /// holds a different branch.
4477    pub fn certificate_provider_instance(
4478        &self,
4479    ) -> std::option::Option<&std::boxed::Box<crate::model::CertificateProviderInstance>> {
4480        #[allow(unreachable_patterns)]
4481        self.r#type.as_ref().and_then(|v| match v {
4482            crate::model::certificate_provider::Type::CertificateProviderInstance(v) => {
4483                std::option::Option::Some(v)
4484            }
4485            _ => std::option::Option::None,
4486        })
4487    }
4488
4489    /// Sets the value of [r#type][crate::model::CertificateProvider::r#type]
4490    /// to hold a `CertificateProviderInstance`.
4491    ///
4492    /// Note that all the setters affecting `r#type` are
4493    /// mutually exclusive.
4494    ///
4495    /// # Example
4496    /// ```ignore,no_run
4497    /// # use google_cloud_networksecurity_v1::model::CertificateProvider;
4498    /// use google_cloud_networksecurity_v1::model::CertificateProviderInstance;
4499    /// let x = CertificateProvider::new().set_certificate_provider_instance(CertificateProviderInstance::default()/* use setters */);
4500    /// assert!(x.certificate_provider_instance().is_some());
4501    /// assert!(x.grpc_endpoint().is_none());
4502    /// ```
4503    pub fn set_certificate_provider_instance<
4504        T: std::convert::Into<std::boxed::Box<crate::model::CertificateProviderInstance>>,
4505    >(
4506        mut self,
4507        v: T,
4508    ) -> Self {
4509        self.r#type = std::option::Option::Some(
4510            crate::model::certificate_provider::Type::CertificateProviderInstance(v.into()),
4511        );
4512        self
4513    }
4514}
4515
4516impl wkt::message::Message for CertificateProvider {
4517    fn typename() -> &'static str {
4518        "type.googleapis.com/google.cloud.networksecurity.v1.CertificateProvider"
4519    }
4520}
4521
4522/// Defines additional types related to [CertificateProvider].
4523pub mod certificate_provider {
4524    #[allow(unused_imports)]
4525    use super::*;
4526
4527    /// The type of certificate provider which provides the certificates and
4528    /// private keys.
4529    #[derive(Clone, Debug, PartialEq)]
4530    #[non_exhaustive]
4531    pub enum Type {
4532        /// gRPC specific configuration to access the gRPC server to
4533        /// obtain the cert and private key.
4534        GrpcEndpoint(std::boxed::Box<crate::model::GrpcEndpoint>),
4535        /// The certificate provider instance specification that will be passed to
4536        /// the data plane, which will be used to load necessary credential
4537        /// information.
4538        CertificateProviderInstance(std::boxed::Box<crate::model::CertificateProviderInstance>),
4539    }
4540}