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