google_cloud_networksecurity_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_iam_v1;
25extern crate google_cloud_location;
26extern crate google_cloud_longrunning;
27extern crate google_cloud_lro;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// AddressGroup is a resource that specifies how a collection of IP/DNS used
40/// in Firewall Policy.
41#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct AddressGroup {
44 /// Required. Name of the AddressGroup resource. It matches pattern
45 /// `projects/*/locations/{location}/addressGroups/<address_group>`.
46 pub name: std::string::String,
47
48 /// Optional. Free-text description of the resource.
49 pub description: std::string::String,
50
51 /// Output only. The timestamp when the resource was created.
52 pub create_time: std::option::Option<wkt::Timestamp>,
53
54 /// Output only. The timestamp when the resource was updated.
55 pub update_time: std::option::Option<wkt::Timestamp>,
56
57 /// Optional. Set of label tags associated with the AddressGroup resource.
58 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
59
60 /// Required. The type of the Address Group. Possible values are "IPv4" or
61 /// "IPV6".
62 pub r#type: crate::model::address_group::Type,
63
64 /// Optional. List of items.
65 pub items: std::vec::Vec<std::string::String>,
66
67 /// Required. Capacity of the Address Group
68 pub capacity: i32,
69
70 /// Output only. Server-defined fully-qualified URL for this resource.
71 pub self_link: std::string::String,
72
73 /// Optional. List of supported purposes of the Address Group.
74 pub purpose: std::vec::Vec<crate::model::address_group::Purpose>,
75
76 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
77}
78
79impl AddressGroup {
80 pub fn new() -> Self {
81 std::default::Default::default()
82 }
83
84 /// Sets the value of [name][crate::model::AddressGroup::name].
85 ///
86 /// # Example
87 /// ```ignore,no_run
88 /// # use google_cloud_networksecurity_v1::model::AddressGroup;
89 /// let x = AddressGroup::new().set_name("example");
90 /// ```
91 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
92 self.name = v.into();
93 self
94 }
95
96 /// Sets the value of [description][crate::model::AddressGroup::description].
97 ///
98 /// # Example
99 /// ```ignore,no_run
100 /// # use google_cloud_networksecurity_v1::model::AddressGroup;
101 /// let x = AddressGroup::new().set_description("example");
102 /// ```
103 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
104 self.description = v.into();
105 self
106 }
107
108 /// Sets the value of [create_time][crate::model::AddressGroup::create_time].
109 ///
110 /// # Example
111 /// ```ignore,no_run
112 /// # use google_cloud_networksecurity_v1::model::AddressGroup;
113 /// use wkt::Timestamp;
114 /// let x = AddressGroup::new().set_create_time(Timestamp::default()/* use setters */);
115 /// ```
116 pub fn set_create_time<T>(mut self, v: T) -> Self
117 where
118 T: std::convert::Into<wkt::Timestamp>,
119 {
120 self.create_time = std::option::Option::Some(v.into());
121 self
122 }
123
124 /// Sets or clears the value of [create_time][crate::model::AddressGroup::create_time].
125 ///
126 /// # Example
127 /// ```ignore,no_run
128 /// # use google_cloud_networksecurity_v1::model::AddressGroup;
129 /// use wkt::Timestamp;
130 /// let x = AddressGroup::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
131 /// let x = AddressGroup::new().set_or_clear_create_time(None::<Timestamp>);
132 /// ```
133 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
134 where
135 T: std::convert::Into<wkt::Timestamp>,
136 {
137 self.create_time = v.map(|x| x.into());
138 self
139 }
140
141 /// Sets the value of [update_time][crate::model::AddressGroup::update_time].
142 ///
143 /// # Example
144 /// ```ignore,no_run
145 /// # use google_cloud_networksecurity_v1::model::AddressGroup;
146 /// use wkt::Timestamp;
147 /// let x = AddressGroup::new().set_update_time(Timestamp::default()/* use setters */);
148 /// ```
149 pub fn set_update_time<T>(mut self, v: T) -> Self
150 where
151 T: std::convert::Into<wkt::Timestamp>,
152 {
153 self.update_time = std::option::Option::Some(v.into());
154 self
155 }
156
157 /// Sets or clears the value of [update_time][crate::model::AddressGroup::update_time].
158 ///
159 /// # Example
160 /// ```ignore,no_run
161 /// # use google_cloud_networksecurity_v1::model::AddressGroup;
162 /// use wkt::Timestamp;
163 /// let x = AddressGroup::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
164 /// let x = AddressGroup::new().set_or_clear_update_time(None::<Timestamp>);
165 /// ```
166 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
167 where
168 T: std::convert::Into<wkt::Timestamp>,
169 {
170 self.update_time = v.map(|x| x.into());
171 self
172 }
173
174 /// Sets the value of [labels][crate::model::AddressGroup::labels].
175 ///
176 /// # Example
177 /// ```ignore,no_run
178 /// # use google_cloud_networksecurity_v1::model::AddressGroup;
179 /// let x = AddressGroup::new().set_labels([
180 /// ("key0", "abc"),
181 /// ("key1", "xyz"),
182 /// ]);
183 /// ```
184 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
185 where
186 T: std::iter::IntoIterator<Item = (K, V)>,
187 K: std::convert::Into<std::string::String>,
188 V: std::convert::Into<std::string::String>,
189 {
190 use std::iter::Iterator;
191 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
192 self
193 }
194
195 /// Sets the value of [r#type][crate::model::AddressGroup::type].
196 ///
197 /// # Example
198 /// ```ignore,no_run
199 /// # use google_cloud_networksecurity_v1::model::AddressGroup;
200 /// use google_cloud_networksecurity_v1::model::address_group::Type;
201 /// let x0 = AddressGroup::new().set_type(Type::Ipv4);
202 /// let x1 = AddressGroup::new().set_type(Type::Ipv6);
203 /// ```
204 pub fn set_type<T: std::convert::Into<crate::model::address_group::Type>>(
205 mut self,
206 v: T,
207 ) -> Self {
208 self.r#type = v.into();
209 self
210 }
211
212 /// Sets the value of [items][crate::model::AddressGroup::items].
213 ///
214 /// # Example
215 /// ```ignore,no_run
216 /// # use google_cloud_networksecurity_v1::model::AddressGroup;
217 /// let x = AddressGroup::new().set_items(["a", "b", "c"]);
218 /// ```
219 pub fn set_items<T, V>(mut self, v: T) -> Self
220 where
221 T: std::iter::IntoIterator<Item = V>,
222 V: std::convert::Into<std::string::String>,
223 {
224 use std::iter::Iterator;
225 self.items = v.into_iter().map(|i| i.into()).collect();
226 self
227 }
228
229 /// Sets the value of [capacity][crate::model::AddressGroup::capacity].
230 ///
231 /// # Example
232 /// ```ignore,no_run
233 /// # use google_cloud_networksecurity_v1::model::AddressGroup;
234 /// let x = AddressGroup::new().set_capacity(42);
235 /// ```
236 pub fn set_capacity<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
237 self.capacity = v.into();
238 self
239 }
240
241 /// Sets the value of [self_link][crate::model::AddressGroup::self_link].
242 ///
243 /// # Example
244 /// ```ignore,no_run
245 /// # use google_cloud_networksecurity_v1::model::AddressGroup;
246 /// let x = AddressGroup::new().set_self_link("example");
247 /// ```
248 pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
249 self.self_link = v.into();
250 self
251 }
252
253 /// Sets the value of [purpose][crate::model::AddressGroup::purpose].
254 ///
255 /// # Example
256 /// ```ignore,no_run
257 /// # use google_cloud_networksecurity_v1::model::AddressGroup;
258 /// use google_cloud_networksecurity_v1::model::address_group::Purpose;
259 /// let x = AddressGroup::new().set_purpose([
260 /// Purpose::Default,
261 /// Purpose::CloudArmor,
262 /// ]);
263 /// ```
264 pub fn set_purpose<T, V>(mut self, v: T) -> Self
265 where
266 T: std::iter::IntoIterator<Item = V>,
267 V: std::convert::Into<crate::model::address_group::Purpose>,
268 {
269 use std::iter::Iterator;
270 self.purpose = v.into_iter().map(|i| i.into()).collect();
271 self
272 }
273}
274
275impl wkt::message::Message for AddressGroup {
276 fn typename() -> &'static str {
277 "type.googleapis.com/google.cloud.networksecurity.v1.AddressGroup"
278 }
279}
280
281/// Defines additional types related to [AddressGroup].
282pub mod address_group {
283 #[allow(unused_imports)]
284 use super::*;
285
286 /// Possible type of the Address Group.
287 ///
288 /// # Working with unknown values
289 ///
290 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
291 /// additional enum variants at any time. Adding new variants is not considered
292 /// a breaking change. Applications should write their code in anticipation of:
293 ///
294 /// - New values appearing in future releases of the client library, **and**
295 /// - New values received dynamically, without application changes.
296 ///
297 /// Please consult the [Working with enums] section in the user guide for some
298 /// guidelines.
299 ///
300 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
301 #[derive(Clone, Debug, PartialEq)]
302 #[non_exhaustive]
303 pub enum Type {
304 /// Default value.
305 Unspecified,
306 /// IP v4 ranges.
307 Ipv4,
308 /// IP v6 ranges.
309 Ipv6,
310 /// If set, the enum was initialized with an unknown value.
311 ///
312 /// Applications can examine the value using [Type::value] or
313 /// [Type::name].
314 UnknownValue(r#type::UnknownValue),
315 }
316
317 #[doc(hidden)]
318 pub mod r#type {
319 #[allow(unused_imports)]
320 use super::*;
321 #[derive(Clone, Debug, PartialEq)]
322 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
323 }
324
325 impl Type {
326 /// Gets the enum value.
327 ///
328 /// Returns `None` if the enum contains an unknown value deserialized from
329 /// the string representation of enums.
330 pub fn value(&self) -> std::option::Option<i32> {
331 match self {
332 Self::Unspecified => std::option::Option::Some(0),
333 Self::Ipv4 => std::option::Option::Some(1),
334 Self::Ipv6 => std::option::Option::Some(2),
335 Self::UnknownValue(u) => u.0.value(),
336 }
337 }
338
339 /// Gets the enum value as a string.
340 ///
341 /// Returns `None` if the enum contains an unknown value deserialized from
342 /// the integer representation of enums.
343 pub fn name(&self) -> std::option::Option<&str> {
344 match self {
345 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
346 Self::Ipv4 => std::option::Option::Some("IPV4"),
347 Self::Ipv6 => std::option::Option::Some("IPV6"),
348 Self::UnknownValue(u) => u.0.name(),
349 }
350 }
351 }
352
353 impl std::default::Default for Type {
354 fn default() -> Self {
355 use std::convert::From;
356 Self::from(0)
357 }
358 }
359
360 impl std::fmt::Display for Type {
361 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
362 wkt::internal::display_enum(f, self.name(), self.value())
363 }
364 }
365
366 impl std::convert::From<i32> for Type {
367 fn from(value: i32) -> Self {
368 match value {
369 0 => Self::Unspecified,
370 1 => Self::Ipv4,
371 2 => Self::Ipv6,
372 _ => Self::UnknownValue(r#type::UnknownValue(
373 wkt::internal::UnknownEnumValue::Integer(value),
374 )),
375 }
376 }
377 }
378
379 impl std::convert::From<&str> for Type {
380 fn from(value: &str) -> Self {
381 use std::string::ToString;
382 match value {
383 "TYPE_UNSPECIFIED" => Self::Unspecified,
384 "IPV4" => Self::Ipv4,
385 "IPV6" => Self::Ipv6,
386 _ => Self::UnknownValue(r#type::UnknownValue(
387 wkt::internal::UnknownEnumValue::String(value.to_string()),
388 )),
389 }
390 }
391 }
392
393 impl serde::ser::Serialize for Type {
394 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
395 where
396 S: serde::Serializer,
397 {
398 match self {
399 Self::Unspecified => serializer.serialize_i32(0),
400 Self::Ipv4 => serializer.serialize_i32(1),
401 Self::Ipv6 => serializer.serialize_i32(2),
402 Self::UnknownValue(u) => u.0.serialize(serializer),
403 }
404 }
405 }
406
407 impl<'de> serde::de::Deserialize<'de> for Type {
408 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
409 where
410 D: serde::Deserializer<'de>,
411 {
412 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
413 ".google.cloud.networksecurity.v1.AddressGroup.Type",
414 ))
415 }
416 }
417
418 /// Purpose of the Address Group.
419 ///
420 /// # Working with unknown values
421 ///
422 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
423 /// additional enum variants at any time. Adding new variants is not considered
424 /// a breaking change. Applications should write their code in anticipation of:
425 ///
426 /// - New values appearing in future releases of the client library, **and**
427 /// - New values received dynamically, without application changes.
428 ///
429 /// Please consult the [Working with enums] section in the user guide for some
430 /// guidelines.
431 ///
432 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
433 #[derive(Clone, Debug, PartialEq)]
434 #[non_exhaustive]
435 pub enum Purpose {
436 /// Default value. Should never happen.
437 Unspecified,
438 /// Address Group is distributed to VMC, and is usable in Firewall Policies
439 /// and other systems that rely on VMC.
440 Default,
441 /// Address Group is usable in Cloud Armor.
442 CloudArmor,
443 /// If set, the enum was initialized with an unknown value.
444 ///
445 /// Applications can examine the value using [Purpose::value] or
446 /// [Purpose::name].
447 UnknownValue(purpose::UnknownValue),
448 }
449
450 #[doc(hidden)]
451 pub mod purpose {
452 #[allow(unused_imports)]
453 use super::*;
454 #[derive(Clone, Debug, PartialEq)]
455 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
456 }
457
458 impl Purpose {
459 /// Gets the enum value.
460 ///
461 /// Returns `None` if the enum contains an unknown value deserialized from
462 /// the string representation of enums.
463 pub fn value(&self) -> std::option::Option<i32> {
464 match self {
465 Self::Unspecified => std::option::Option::Some(0),
466 Self::Default => std::option::Option::Some(1),
467 Self::CloudArmor => std::option::Option::Some(2),
468 Self::UnknownValue(u) => u.0.value(),
469 }
470 }
471
472 /// Gets the enum value as a string.
473 ///
474 /// Returns `None` if the enum contains an unknown value deserialized from
475 /// the integer representation of enums.
476 pub fn name(&self) -> std::option::Option<&str> {
477 match self {
478 Self::Unspecified => std::option::Option::Some("PURPOSE_UNSPECIFIED"),
479 Self::Default => std::option::Option::Some("DEFAULT"),
480 Self::CloudArmor => std::option::Option::Some("CLOUD_ARMOR"),
481 Self::UnknownValue(u) => u.0.name(),
482 }
483 }
484 }
485
486 impl std::default::Default for Purpose {
487 fn default() -> Self {
488 use std::convert::From;
489 Self::from(0)
490 }
491 }
492
493 impl std::fmt::Display for Purpose {
494 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
495 wkt::internal::display_enum(f, self.name(), self.value())
496 }
497 }
498
499 impl std::convert::From<i32> for Purpose {
500 fn from(value: i32) -> Self {
501 match value {
502 0 => Self::Unspecified,
503 1 => Self::Default,
504 2 => Self::CloudArmor,
505 _ => Self::UnknownValue(purpose::UnknownValue(
506 wkt::internal::UnknownEnumValue::Integer(value),
507 )),
508 }
509 }
510 }
511
512 impl std::convert::From<&str> for Purpose {
513 fn from(value: &str) -> Self {
514 use std::string::ToString;
515 match value {
516 "PURPOSE_UNSPECIFIED" => Self::Unspecified,
517 "DEFAULT" => Self::Default,
518 "CLOUD_ARMOR" => Self::CloudArmor,
519 _ => Self::UnknownValue(purpose::UnknownValue(
520 wkt::internal::UnknownEnumValue::String(value.to_string()),
521 )),
522 }
523 }
524 }
525
526 impl serde::ser::Serialize for Purpose {
527 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
528 where
529 S: serde::Serializer,
530 {
531 match self {
532 Self::Unspecified => serializer.serialize_i32(0),
533 Self::Default => serializer.serialize_i32(1),
534 Self::CloudArmor => serializer.serialize_i32(2),
535 Self::UnknownValue(u) => u.0.serialize(serializer),
536 }
537 }
538 }
539
540 impl<'de> serde::de::Deserialize<'de> for Purpose {
541 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
542 where
543 D: serde::Deserializer<'de>,
544 {
545 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Purpose>::new(
546 ".google.cloud.networksecurity.v1.AddressGroup.Purpose",
547 ))
548 }
549 }
550}
551
552/// Request used with the ListAddressGroups method.
553#[derive(Clone, Default, PartialEq)]
554#[non_exhaustive]
555pub struct ListAddressGroupsRequest {
556 /// Required. The project and location from which the AddressGroups
557 /// should be listed, specified in the format
558 /// `projects/*/locations/{location}`.
559 pub parent: std::string::String,
560
561 /// Maximum number of AddressGroups to return per call.
562 pub page_size: i32,
563
564 /// The value returned by the last
565 /// `ListAddressGroupsResponse` Indicates that this is a
566 /// continuation of a prior `ListAddressGroups` call, and
567 /// that the system should return the next page of data.
568 pub page_token: std::string::String,
569
570 /// Optional. If true, allow partial responses for multi-regional Aggregated
571 /// List requests.
572 pub return_partial_success: bool,
573
574 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
575}
576
577impl ListAddressGroupsRequest {
578 pub fn new() -> Self {
579 std::default::Default::default()
580 }
581
582 /// Sets the value of [parent][crate::model::ListAddressGroupsRequest::parent].
583 ///
584 /// # Example
585 /// ```ignore,no_run
586 /// # use google_cloud_networksecurity_v1::model::ListAddressGroupsRequest;
587 /// let x = ListAddressGroupsRequest::new().set_parent("example");
588 /// ```
589 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
590 self.parent = v.into();
591 self
592 }
593
594 /// Sets the value of [page_size][crate::model::ListAddressGroupsRequest::page_size].
595 ///
596 /// # Example
597 /// ```ignore,no_run
598 /// # use google_cloud_networksecurity_v1::model::ListAddressGroupsRequest;
599 /// let x = ListAddressGroupsRequest::new().set_page_size(42);
600 /// ```
601 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
602 self.page_size = v.into();
603 self
604 }
605
606 /// Sets the value of [page_token][crate::model::ListAddressGroupsRequest::page_token].
607 ///
608 /// # Example
609 /// ```ignore,no_run
610 /// # use google_cloud_networksecurity_v1::model::ListAddressGroupsRequest;
611 /// let x = ListAddressGroupsRequest::new().set_page_token("example");
612 /// ```
613 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
614 self.page_token = v.into();
615 self
616 }
617
618 /// Sets the value of [return_partial_success][crate::model::ListAddressGroupsRequest::return_partial_success].
619 ///
620 /// # Example
621 /// ```ignore,no_run
622 /// # use google_cloud_networksecurity_v1::model::ListAddressGroupsRequest;
623 /// let x = ListAddressGroupsRequest::new().set_return_partial_success(true);
624 /// ```
625 pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
626 self.return_partial_success = v.into();
627 self
628 }
629}
630
631impl wkt::message::Message for ListAddressGroupsRequest {
632 fn typename() -> &'static str {
633 "type.googleapis.com/google.cloud.networksecurity.v1.ListAddressGroupsRequest"
634 }
635}
636
637/// Response returned by the ListAddressGroups method.
638#[derive(Clone, Default, PartialEq)]
639#[non_exhaustive]
640pub struct ListAddressGroupsResponse {
641 /// List of AddressGroups resources.
642 pub address_groups: std::vec::Vec<crate::model::AddressGroup>,
643
644 /// If there might be more results than those appearing in this response, then
645 /// `next_page_token` is included. To get the next set of results, call this
646 /// method again using the value of `next_page_token` as `page_token`.
647 pub next_page_token: std::string::String,
648
649 /// Locations that could not be reached.
650 pub unreachable: std::vec::Vec<std::string::String>,
651
652 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
653}
654
655impl ListAddressGroupsResponse {
656 pub fn new() -> Self {
657 std::default::Default::default()
658 }
659
660 /// Sets the value of [address_groups][crate::model::ListAddressGroupsResponse::address_groups].
661 ///
662 /// # Example
663 /// ```ignore,no_run
664 /// # use google_cloud_networksecurity_v1::model::ListAddressGroupsResponse;
665 /// use google_cloud_networksecurity_v1::model::AddressGroup;
666 /// let x = ListAddressGroupsResponse::new()
667 /// .set_address_groups([
668 /// AddressGroup::default()/* use setters */,
669 /// AddressGroup::default()/* use (different) setters */,
670 /// ]);
671 /// ```
672 pub fn set_address_groups<T, V>(mut self, v: T) -> Self
673 where
674 T: std::iter::IntoIterator<Item = V>,
675 V: std::convert::Into<crate::model::AddressGroup>,
676 {
677 use std::iter::Iterator;
678 self.address_groups = v.into_iter().map(|i| i.into()).collect();
679 self
680 }
681
682 /// Sets the value of [next_page_token][crate::model::ListAddressGroupsResponse::next_page_token].
683 ///
684 /// # Example
685 /// ```ignore,no_run
686 /// # use google_cloud_networksecurity_v1::model::ListAddressGroupsResponse;
687 /// let x = ListAddressGroupsResponse::new().set_next_page_token("example");
688 /// ```
689 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
690 self.next_page_token = v.into();
691 self
692 }
693
694 /// Sets the value of [unreachable][crate::model::ListAddressGroupsResponse::unreachable].
695 ///
696 /// # Example
697 /// ```ignore,no_run
698 /// # use google_cloud_networksecurity_v1::model::ListAddressGroupsResponse;
699 /// let x = ListAddressGroupsResponse::new().set_unreachable(["a", "b", "c"]);
700 /// ```
701 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
702 where
703 T: std::iter::IntoIterator<Item = V>,
704 V: std::convert::Into<std::string::String>,
705 {
706 use std::iter::Iterator;
707 self.unreachable = v.into_iter().map(|i| i.into()).collect();
708 self
709 }
710}
711
712impl wkt::message::Message for ListAddressGroupsResponse {
713 fn typename() -> &'static str {
714 "type.googleapis.com/google.cloud.networksecurity.v1.ListAddressGroupsResponse"
715 }
716}
717
718#[doc(hidden)]
719impl google_cloud_gax::paginator::internal::PageableResponse for ListAddressGroupsResponse {
720 type PageItem = crate::model::AddressGroup;
721
722 fn items(self) -> std::vec::Vec<Self::PageItem> {
723 self.address_groups
724 }
725
726 fn next_page_token(&self) -> std::string::String {
727 use std::clone::Clone;
728 self.next_page_token.clone()
729 }
730}
731
732/// Request used by the GetAddressGroup method.
733#[derive(Clone, Default, PartialEq)]
734#[non_exhaustive]
735pub struct GetAddressGroupRequest {
736 /// Required. A name of the AddressGroup to get. Must be in the format
737 /// `projects/*/locations/{location}/addressGroups/*`.
738 pub name: std::string::String,
739
740 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
741}
742
743impl GetAddressGroupRequest {
744 pub fn new() -> Self {
745 std::default::Default::default()
746 }
747
748 /// Sets the value of [name][crate::model::GetAddressGroupRequest::name].
749 ///
750 /// # Example
751 /// ```ignore,no_run
752 /// # use google_cloud_networksecurity_v1::model::GetAddressGroupRequest;
753 /// let x = GetAddressGroupRequest::new().set_name("example");
754 /// ```
755 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
756 self.name = v.into();
757 self
758 }
759}
760
761impl wkt::message::Message for GetAddressGroupRequest {
762 fn typename() -> &'static str {
763 "type.googleapis.com/google.cloud.networksecurity.v1.GetAddressGroupRequest"
764 }
765}
766
767/// Request used by the CreateAddressGroup method.
768#[derive(Clone, Default, PartialEq)]
769#[non_exhaustive]
770pub struct CreateAddressGroupRequest {
771 /// Required. The parent resource of the AddressGroup. Must be in the
772 /// format `projects/*/locations/{location}`.
773 pub parent: std::string::String,
774
775 /// Required. Short name of the AddressGroup resource to be created.
776 /// This value should be 1-63 characters long, containing only
777 /// letters, numbers, hyphens, and underscores, and should not start
778 /// with a number. E.g. "authz_policy".
779 pub address_group_id: std::string::String,
780
781 /// Required. AddressGroup resource to be created.
782 pub address_group: std::option::Option<crate::model::AddressGroup>,
783
784 /// Optional. An optional request ID to identify requests. Specify a unique
785 /// request ID so that if you must retry your request, the server will know to
786 /// ignore the request if it has already been completed. The server will
787 /// guarantee that for at least 60 minutes since the first request.
788 ///
789 /// For example, consider a situation where you make an initial request and
790 /// the request times out. If you make the request again with the same request
791 /// ID, the server can check if original operation with the same request ID
792 /// was received, and if so, will ignore the second request. This prevents
793 /// clients from accidentally creating duplicate commitments.
794 ///
795 /// The request ID must be a valid UUID with the exception that zero UUID is
796 /// not supported (00000000-0000-0000-0000-000000000000).
797 pub request_id: std::string::String,
798
799 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
800}
801
802impl CreateAddressGroupRequest {
803 pub fn new() -> Self {
804 std::default::Default::default()
805 }
806
807 /// Sets the value of [parent][crate::model::CreateAddressGroupRequest::parent].
808 ///
809 /// # Example
810 /// ```ignore,no_run
811 /// # use google_cloud_networksecurity_v1::model::CreateAddressGroupRequest;
812 /// let x = CreateAddressGroupRequest::new().set_parent("example");
813 /// ```
814 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
815 self.parent = v.into();
816 self
817 }
818
819 /// Sets the value of [address_group_id][crate::model::CreateAddressGroupRequest::address_group_id].
820 ///
821 /// # Example
822 /// ```ignore,no_run
823 /// # use google_cloud_networksecurity_v1::model::CreateAddressGroupRequest;
824 /// let x = CreateAddressGroupRequest::new().set_address_group_id("example");
825 /// ```
826 pub fn set_address_group_id<T: std::convert::Into<std::string::String>>(
827 mut self,
828 v: T,
829 ) -> Self {
830 self.address_group_id = v.into();
831 self
832 }
833
834 /// Sets the value of [address_group][crate::model::CreateAddressGroupRequest::address_group].
835 ///
836 /// # Example
837 /// ```ignore,no_run
838 /// # use google_cloud_networksecurity_v1::model::CreateAddressGroupRequest;
839 /// use google_cloud_networksecurity_v1::model::AddressGroup;
840 /// let x = CreateAddressGroupRequest::new().set_address_group(AddressGroup::default()/* use setters */);
841 /// ```
842 pub fn set_address_group<T>(mut self, v: T) -> Self
843 where
844 T: std::convert::Into<crate::model::AddressGroup>,
845 {
846 self.address_group = std::option::Option::Some(v.into());
847 self
848 }
849
850 /// Sets or clears the value of [address_group][crate::model::CreateAddressGroupRequest::address_group].
851 ///
852 /// # Example
853 /// ```ignore,no_run
854 /// # use google_cloud_networksecurity_v1::model::CreateAddressGroupRequest;
855 /// use google_cloud_networksecurity_v1::model::AddressGroup;
856 /// let x = CreateAddressGroupRequest::new().set_or_clear_address_group(Some(AddressGroup::default()/* use setters */));
857 /// let x = CreateAddressGroupRequest::new().set_or_clear_address_group(None::<AddressGroup>);
858 /// ```
859 pub fn set_or_clear_address_group<T>(mut self, v: std::option::Option<T>) -> Self
860 where
861 T: std::convert::Into<crate::model::AddressGroup>,
862 {
863 self.address_group = v.map(|x| x.into());
864 self
865 }
866
867 /// Sets the value of [request_id][crate::model::CreateAddressGroupRequest::request_id].
868 ///
869 /// # Example
870 /// ```ignore,no_run
871 /// # use google_cloud_networksecurity_v1::model::CreateAddressGroupRequest;
872 /// let x = CreateAddressGroupRequest::new().set_request_id("example");
873 /// ```
874 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
875 self.request_id = v.into();
876 self
877 }
878}
879
880impl wkt::message::Message for CreateAddressGroupRequest {
881 fn typename() -> &'static str {
882 "type.googleapis.com/google.cloud.networksecurity.v1.CreateAddressGroupRequest"
883 }
884}
885
886/// Request used by the UpdateAddressGroup method.
887#[derive(Clone, Default, PartialEq)]
888#[non_exhaustive]
889pub struct UpdateAddressGroupRequest {
890 /// Optional. Field mask is used to specify the fields to be overwritten in the
891 /// AddressGroup resource by the update.
892 /// The fields specified in the update_mask are relative to the resource, not
893 /// the full request. A field will be overwritten if it is in the mask. If the
894 /// user does not provide a mask then all fields will be overwritten.
895 pub update_mask: std::option::Option<wkt::FieldMask>,
896
897 /// Required. Updated AddressGroup resource.
898 pub address_group: std::option::Option<crate::model::AddressGroup>,
899
900 /// Optional. An optional request ID to identify requests. Specify a unique
901 /// request ID so that if you must retry your request, the server will know to
902 /// ignore the request if it has already been completed. The server will
903 /// guarantee that for at least 60 minutes since the first request.
904 ///
905 /// For example, consider a situation where you make an initial request and
906 /// the request times out. If you make the request again with the same request
907 /// ID, the server can check if original operation with the same request ID
908 /// was received, and if so, will ignore the second request. This prevents
909 /// clients from accidentally creating duplicate commitments.
910 ///
911 /// The request ID must be a valid UUID with the exception that zero UUID is
912 /// not supported (00000000-0000-0000-0000-000000000000).
913 pub request_id: std::string::String,
914
915 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
916}
917
918impl UpdateAddressGroupRequest {
919 pub fn new() -> Self {
920 std::default::Default::default()
921 }
922
923 /// Sets the value of [update_mask][crate::model::UpdateAddressGroupRequest::update_mask].
924 ///
925 /// # Example
926 /// ```ignore,no_run
927 /// # use google_cloud_networksecurity_v1::model::UpdateAddressGroupRequest;
928 /// use wkt::FieldMask;
929 /// let x = UpdateAddressGroupRequest::new().set_update_mask(FieldMask::default()/* use setters */);
930 /// ```
931 pub fn set_update_mask<T>(mut self, v: T) -> Self
932 where
933 T: std::convert::Into<wkt::FieldMask>,
934 {
935 self.update_mask = std::option::Option::Some(v.into());
936 self
937 }
938
939 /// Sets or clears the value of [update_mask][crate::model::UpdateAddressGroupRequest::update_mask].
940 ///
941 /// # Example
942 /// ```ignore,no_run
943 /// # use google_cloud_networksecurity_v1::model::UpdateAddressGroupRequest;
944 /// use wkt::FieldMask;
945 /// let x = UpdateAddressGroupRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
946 /// let x = UpdateAddressGroupRequest::new().set_or_clear_update_mask(None::<FieldMask>);
947 /// ```
948 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
949 where
950 T: std::convert::Into<wkt::FieldMask>,
951 {
952 self.update_mask = v.map(|x| x.into());
953 self
954 }
955
956 /// Sets the value of [address_group][crate::model::UpdateAddressGroupRequest::address_group].
957 ///
958 /// # Example
959 /// ```ignore,no_run
960 /// # use google_cloud_networksecurity_v1::model::UpdateAddressGroupRequest;
961 /// use google_cloud_networksecurity_v1::model::AddressGroup;
962 /// let x = UpdateAddressGroupRequest::new().set_address_group(AddressGroup::default()/* use setters */);
963 /// ```
964 pub fn set_address_group<T>(mut self, v: T) -> Self
965 where
966 T: std::convert::Into<crate::model::AddressGroup>,
967 {
968 self.address_group = std::option::Option::Some(v.into());
969 self
970 }
971
972 /// Sets or clears the value of [address_group][crate::model::UpdateAddressGroupRequest::address_group].
973 ///
974 /// # Example
975 /// ```ignore,no_run
976 /// # use google_cloud_networksecurity_v1::model::UpdateAddressGroupRequest;
977 /// use google_cloud_networksecurity_v1::model::AddressGroup;
978 /// let x = UpdateAddressGroupRequest::new().set_or_clear_address_group(Some(AddressGroup::default()/* use setters */));
979 /// let x = UpdateAddressGroupRequest::new().set_or_clear_address_group(None::<AddressGroup>);
980 /// ```
981 pub fn set_or_clear_address_group<T>(mut self, v: std::option::Option<T>) -> Self
982 where
983 T: std::convert::Into<crate::model::AddressGroup>,
984 {
985 self.address_group = v.map(|x| x.into());
986 self
987 }
988
989 /// Sets the value of [request_id][crate::model::UpdateAddressGroupRequest::request_id].
990 ///
991 /// # Example
992 /// ```ignore,no_run
993 /// # use google_cloud_networksecurity_v1::model::UpdateAddressGroupRequest;
994 /// let x = UpdateAddressGroupRequest::new().set_request_id("example");
995 /// ```
996 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
997 self.request_id = v.into();
998 self
999 }
1000}
1001
1002impl wkt::message::Message for UpdateAddressGroupRequest {
1003 fn typename() -> &'static str {
1004 "type.googleapis.com/google.cloud.networksecurity.v1.UpdateAddressGroupRequest"
1005 }
1006}
1007
1008/// Request used by the DeleteAddressGroup method.
1009#[derive(Clone, Default, PartialEq)]
1010#[non_exhaustive]
1011pub struct DeleteAddressGroupRequest {
1012 /// Required. A name of the AddressGroup to delete. Must be in the format
1013 /// `projects/*/locations/{location}/addressGroups/*`.
1014 pub name: std::string::String,
1015
1016 /// Optional. An optional request ID to identify requests. Specify a unique
1017 /// request ID so that if you must retry your request, the server will know to
1018 /// ignore the request if it has already been completed. The server will
1019 /// guarantee that for at least 60 minutes since the first request.
1020 ///
1021 /// For example, consider a situation where you make an initial request and
1022 /// the request times out. If you make the request again with the same request
1023 /// ID, the server can check if original operation with the same request ID
1024 /// was received, and if so, will ignore the second request. This prevents
1025 /// clients from accidentally creating duplicate commitments.
1026 ///
1027 /// The request ID must be a valid UUID with the exception that zero UUID is
1028 /// not supported (00000000-0000-0000-0000-000000000000).
1029 pub request_id: std::string::String,
1030
1031 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1032}
1033
1034impl DeleteAddressGroupRequest {
1035 pub fn new() -> Self {
1036 std::default::Default::default()
1037 }
1038
1039 /// Sets the value of [name][crate::model::DeleteAddressGroupRequest::name].
1040 ///
1041 /// # Example
1042 /// ```ignore,no_run
1043 /// # use google_cloud_networksecurity_v1::model::DeleteAddressGroupRequest;
1044 /// let x = DeleteAddressGroupRequest::new().set_name("example");
1045 /// ```
1046 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1047 self.name = v.into();
1048 self
1049 }
1050
1051 /// Sets the value of [request_id][crate::model::DeleteAddressGroupRequest::request_id].
1052 ///
1053 /// # Example
1054 /// ```ignore,no_run
1055 /// # use google_cloud_networksecurity_v1::model::DeleteAddressGroupRequest;
1056 /// let x = DeleteAddressGroupRequest::new().set_request_id("example");
1057 /// ```
1058 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1059 self.request_id = v.into();
1060 self
1061 }
1062}
1063
1064impl wkt::message::Message for DeleteAddressGroupRequest {
1065 fn typename() -> &'static str {
1066 "type.googleapis.com/google.cloud.networksecurity.v1.DeleteAddressGroupRequest"
1067 }
1068}
1069
1070/// Request used by the AddAddressGroupItems method.
1071#[derive(Clone, Default, PartialEq)]
1072#[non_exhaustive]
1073pub struct AddAddressGroupItemsRequest {
1074 /// Required. A name of the AddressGroup to add items to. Must be in the format
1075 /// `projects|organization/*/locations/{location}/addressGroups/*`.
1076 pub address_group: std::string::String,
1077
1078 /// Required. List of items to add.
1079 pub items: std::vec::Vec<std::string::String>,
1080
1081 /// Optional. An optional request ID to identify requests. Specify a unique
1082 /// request ID so that if you must retry your request, the server will know to
1083 /// ignore the request if it has already been completed. The server will
1084 /// guarantee that for at least 60 minutes since the first request.
1085 ///
1086 /// For example, consider a situation where you make an initial request and
1087 /// the request times out. If you make the request again with the same request
1088 /// ID, the server can check if original operation with the same request ID
1089 /// was received, and if so, will ignore the second request. This prevents
1090 /// clients from accidentally creating duplicate commitments.
1091 ///
1092 /// The request ID must be a valid UUID with the exception that zero UUID is
1093 /// not supported (00000000-0000-0000-0000-000000000000).
1094 pub request_id: std::string::String,
1095
1096 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1097}
1098
1099impl AddAddressGroupItemsRequest {
1100 pub fn new() -> Self {
1101 std::default::Default::default()
1102 }
1103
1104 /// Sets the value of [address_group][crate::model::AddAddressGroupItemsRequest::address_group].
1105 ///
1106 /// # Example
1107 /// ```ignore,no_run
1108 /// # use google_cloud_networksecurity_v1::model::AddAddressGroupItemsRequest;
1109 /// let x = AddAddressGroupItemsRequest::new().set_address_group("example");
1110 /// ```
1111 pub fn set_address_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1112 self.address_group = v.into();
1113 self
1114 }
1115
1116 /// Sets the value of [items][crate::model::AddAddressGroupItemsRequest::items].
1117 ///
1118 /// # Example
1119 /// ```ignore,no_run
1120 /// # use google_cloud_networksecurity_v1::model::AddAddressGroupItemsRequest;
1121 /// let x = AddAddressGroupItemsRequest::new().set_items(["a", "b", "c"]);
1122 /// ```
1123 pub fn set_items<T, V>(mut self, v: T) -> Self
1124 where
1125 T: std::iter::IntoIterator<Item = V>,
1126 V: std::convert::Into<std::string::String>,
1127 {
1128 use std::iter::Iterator;
1129 self.items = v.into_iter().map(|i| i.into()).collect();
1130 self
1131 }
1132
1133 /// Sets the value of [request_id][crate::model::AddAddressGroupItemsRequest::request_id].
1134 ///
1135 /// # Example
1136 /// ```ignore,no_run
1137 /// # use google_cloud_networksecurity_v1::model::AddAddressGroupItemsRequest;
1138 /// let x = AddAddressGroupItemsRequest::new().set_request_id("example");
1139 /// ```
1140 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1141 self.request_id = v.into();
1142 self
1143 }
1144}
1145
1146impl wkt::message::Message for AddAddressGroupItemsRequest {
1147 fn typename() -> &'static str {
1148 "type.googleapis.com/google.cloud.networksecurity.v1.AddAddressGroupItemsRequest"
1149 }
1150}
1151
1152/// Request used by the RemoveAddressGroupItems method.
1153#[derive(Clone, Default, PartialEq)]
1154#[non_exhaustive]
1155pub struct RemoveAddressGroupItemsRequest {
1156 /// Required. A name of the AddressGroup to remove items from. Must be in the
1157 /// format `projects|organization/*/locations/{location}/addressGroups/*`.
1158 pub address_group: std::string::String,
1159
1160 /// Required. List of items to remove.
1161 pub items: std::vec::Vec<std::string::String>,
1162
1163 /// Optional. An optional request ID to identify requests. Specify a unique
1164 /// request ID so that if you must retry your request, the server will know to
1165 /// ignore the request if it has already been completed. The server will
1166 /// guarantee that for at least 60 minutes since the first request.
1167 ///
1168 /// For example, consider a situation where you make an initial request and
1169 /// the request times out. If you make the request again with the same request
1170 /// ID, the server can check if original operation with the same request ID
1171 /// was received, and if so, will ignore the second request. This prevents
1172 /// clients from accidentally creating duplicate commitments.
1173 ///
1174 /// The request ID must be a valid UUID with the exception that zero UUID is
1175 /// not supported (00000000-0000-0000-0000-000000000000).
1176 pub request_id: std::string::String,
1177
1178 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1179}
1180
1181impl RemoveAddressGroupItemsRequest {
1182 pub fn new() -> Self {
1183 std::default::Default::default()
1184 }
1185
1186 /// Sets the value of [address_group][crate::model::RemoveAddressGroupItemsRequest::address_group].
1187 ///
1188 /// # Example
1189 /// ```ignore,no_run
1190 /// # use google_cloud_networksecurity_v1::model::RemoveAddressGroupItemsRequest;
1191 /// let x = RemoveAddressGroupItemsRequest::new().set_address_group("example");
1192 /// ```
1193 pub fn set_address_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1194 self.address_group = v.into();
1195 self
1196 }
1197
1198 /// Sets the value of [items][crate::model::RemoveAddressGroupItemsRequest::items].
1199 ///
1200 /// # Example
1201 /// ```ignore,no_run
1202 /// # use google_cloud_networksecurity_v1::model::RemoveAddressGroupItemsRequest;
1203 /// let x = RemoveAddressGroupItemsRequest::new().set_items(["a", "b", "c"]);
1204 /// ```
1205 pub fn set_items<T, V>(mut self, v: T) -> Self
1206 where
1207 T: std::iter::IntoIterator<Item = V>,
1208 V: std::convert::Into<std::string::String>,
1209 {
1210 use std::iter::Iterator;
1211 self.items = v.into_iter().map(|i| i.into()).collect();
1212 self
1213 }
1214
1215 /// Sets the value of [request_id][crate::model::RemoveAddressGroupItemsRequest::request_id].
1216 ///
1217 /// # Example
1218 /// ```ignore,no_run
1219 /// # use google_cloud_networksecurity_v1::model::RemoveAddressGroupItemsRequest;
1220 /// let x = RemoveAddressGroupItemsRequest::new().set_request_id("example");
1221 /// ```
1222 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1223 self.request_id = v.into();
1224 self
1225 }
1226}
1227
1228impl wkt::message::Message for RemoveAddressGroupItemsRequest {
1229 fn typename() -> &'static str {
1230 "type.googleapis.com/google.cloud.networksecurity.v1.RemoveAddressGroupItemsRequest"
1231 }
1232}
1233
1234/// Request used by the CloneAddressGroupItems method.
1235#[derive(Clone, Default, PartialEq)]
1236#[non_exhaustive]
1237pub struct CloneAddressGroupItemsRequest {
1238 /// Required. A name of the AddressGroup to clone items to. Must be in the
1239 /// format `projects|organization/*/locations/{location}/addressGroups/*`.
1240 pub address_group: std::string::String,
1241
1242 /// Required. Source address group to clone items from.
1243 pub source_address_group: std::string::String,
1244
1245 /// Optional. An optional request ID to identify requests. Specify a unique
1246 /// request ID so that if you must retry your request, the server will know to
1247 /// ignore the request if it has already been completed. The server will
1248 /// guarantee that for at least 60 minutes since the first request.
1249 ///
1250 /// For example, consider a situation where you make an initial request and
1251 /// the request times out. If you make the request again with the same request
1252 /// ID, the server can check if original operation with the same request ID
1253 /// was received, and if so, will ignore the second request. This prevents
1254 /// clients from accidentally creating duplicate commitments.
1255 ///
1256 /// The request ID must be a valid UUID with the exception that zero UUID is
1257 /// not supported (00000000-0000-0000-0000-000000000000).
1258 pub request_id: std::string::String,
1259
1260 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1261}
1262
1263impl CloneAddressGroupItemsRequest {
1264 pub fn new() -> Self {
1265 std::default::Default::default()
1266 }
1267
1268 /// Sets the value of [address_group][crate::model::CloneAddressGroupItemsRequest::address_group].
1269 ///
1270 /// # Example
1271 /// ```ignore,no_run
1272 /// # use google_cloud_networksecurity_v1::model::CloneAddressGroupItemsRequest;
1273 /// let x = CloneAddressGroupItemsRequest::new().set_address_group("example");
1274 /// ```
1275 pub fn set_address_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1276 self.address_group = v.into();
1277 self
1278 }
1279
1280 /// Sets the value of [source_address_group][crate::model::CloneAddressGroupItemsRequest::source_address_group].
1281 ///
1282 /// # Example
1283 /// ```ignore,no_run
1284 /// # use google_cloud_networksecurity_v1::model::CloneAddressGroupItemsRequest;
1285 /// let x = CloneAddressGroupItemsRequest::new().set_source_address_group("example");
1286 /// ```
1287 pub fn set_source_address_group<T: std::convert::Into<std::string::String>>(
1288 mut self,
1289 v: T,
1290 ) -> Self {
1291 self.source_address_group = v.into();
1292 self
1293 }
1294
1295 /// Sets the value of [request_id][crate::model::CloneAddressGroupItemsRequest::request_id].
1296 ///
1297 /// # Example
1298 /// ```ignore,no_run
1299 /// # use google_cloud_networksecurity_v1::model::CloneAddressGroupItemsRequest;
1300 /// let x = CloneAddressGroupItemsRequest::new().set_request_id("example");
1301 /// ```
1302 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1303 self.request_id = v.into();
1304 self
1305 }
1306}
1307
1308impl wkt::message::Message for CloneAddressGroupItemsRequest {
1309 fn typename() -> &'static str {
1310 "type.googleapis.com/google.cloud.networksecurity.v1.CloneAddressGroupItemsRequest"
1311 }
1312}
1313
1314/// Request used by the ListAddressGroupReferences method.
1315#[derive(Clone, Default, PartialEq)]
1316#[non_exhaustive]
1317pub struct ListAddressGroupReferencesRequest {
1318 /// Required. A name of the AddressGroup to clone items to. Must be in the
1319 /// format `projects|organization/*/locations/{location}/addressGroups/*`.
1320 pub address_group: std::string::String,
1321
1322 /// The maximum number of references to return. If unspecified, server
1323 /// will pick an appropriate default. Server may return fewer items than
1324 /// requested. A caller should only rely on response's
1325 /// [next_page_token][google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.next_page_token]
1326 /// to determine if there are more AddressGroupUsers left to be queried.
1327 ///
1328 /// [google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse.next_page_token]: crate::model::ListAddressGroupReferencesResponse::next_page_token
1329 pub page_size: i32,
1330
1331 /// The next_page_token value returned from a previous List request,
1332 /// if any.
1333 pub page_token: std::string::String,
1334
1335 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1336}
1337
1338impl ListAddressGroupReferencesRequest {
1339 pub fn new() -> Self {
1340 std::default::Default::default()
1341 }
1342
1343 /// Sets the value of [address_group][crate::model::ListAddressGroupReferencesRequest::address_group].
1344 ///
1345 /// # Example
1346 /// ```ignore,no_run
1347 /// # use google_cloud_networksecurity_v1::model::ListAddressGroupReferencesRequest;
1348 /// let x = ListAddressGroupReferencesRequest::new().set_address_group("example");
1349 /// ```
1350 pub fn set_address_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1351 self.address_group = v.into();
1352 self
1353 }
1354
1355 /// Sets the value of [page_size][crate::model::ListAddressGroupReferencesRequest::page_size].
1356 ///
1357 /// # Example
1358 /// ```ignore,no_run
1359 /// # use google_cloud_networksecurity_v1::model::ListAddressGroupReferencesRequest;
1360 /// let x = ListAddressGroupReferencesRequest::new().set_page_size(42);
1361 /// ```
1362 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1363 self.page_size = v.into();
1364 self
1365 }
1366
1367 /// Sets the value of [page_token][crate::model::ListAddressGroupReferencesRequest::page_token].
1368 ///
1369 /// # Example
1370 /// ```ignore,no_run
1371 /// # use google_cloud_networksecurity_v1::model::ListAddressGroupReferencesRequest;
1372 /// let x = ListAddressGroupReferencesRequest::new().set_page_token("example");
1373 /// ```
1374 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1375 self.page_token = v.into();
1376 self
1377 }
1378}
1379
1380impl wkt::message::Message for ListAddressGroupReferencesRequest {
1381 fn typename() -> &'static str {
1382 "type.googleapis.com/google.cloud.networksecurity.v1.ListAddressGroupReferencesRequest"
1383 }
1384}
1385
1386/// Response of the ListAddressGroupReferences method.
1387#[derive(Clone, Default, PartialEq)]
1388#[non_exhaustive]
1389pub struct ListAddressGroupReferencesResponse {
1390 /// A list of references that matches the specified filter in the request.
1391 pub address_group_references:
1392 std::vec::Vec<crate::model::list_address_group_references_response::AddressGroupReference>,
1393
1394 /// If there might be more results than those appearing in this response, then
1395 /// `next_page_token` is included. To get the next set of results, call this
1396 /// method again using the value of `next_page_token` as `page_token`.
1397 pub next_page_token: std::string::String,
1398
1399 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1400}
1401
1402impl ListAddressGroupReferencesResponse {
1403 pub fn new() -> Self {
1404 std::default::Default::default()
1405 }
1406
1407 /// Sets the value of [address_group_references][crate::model::ListAddressGroupReferencesResponse::address_group_references].
1408 ///
1409 /// # Example
1410 /// ```ignore,no_run
1411 /// # use google_cloud_networksecurity_v1::model::ListAddressGroupReferencesResponse;
1412 /// use google_cloud_networksecurity_v1::model::list_address_group_references_response::AddressGroupReference;
1413 /// let x = ListAddressGroupReferencesResponse::new()
1414 /// .set_address_group_references([
1415 /// AddressGroupReference::default()/* use setters */,
1416 /// AddressGroupReference::default()/* use (different) setters */,
1417 /// ]);
1418 /// ```
1419 pub fn set_address_group_references<T, V>(mut self, v: T) -> Self
1420 where
1421 T: std::iter::IntoIterator<Item = V>,
1422 V: std::convert::Into<
1423 crate::model::list_address_group_references_response::AddressGroupReference,
1424 >,
1425 {
1426 use std::iter::Iterator;
1427 self.address_group_references = v.into_iter().map(|i| i.into()).collect();
1428 self
1429 }
1430
1431 /// Sets the value of [next_page_token][crate::model::ListAddressGroupReferencesResponse::next_page_token].
1432 ///
1433 /// # Example
1434 /// ```ignore,no_run
1435 /// # use google_cloud_networksecurity_v1::model::ListAddressGroupReferencesResponse;
1436 /// let x = ListAddressGroupReferencesResponse::new().set_next_page_token("example");
1437 /// ```
1438 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1439 self.next_page_token = v.into();
1440 self
1441 }
1442}
1443
1444impl wkt::message::Message for ListAddressGroupReferencesResponse {
1445 fn typename() -> &'static str {
1446 "type.googleapis.com/google.cloud.networksecurity.v1.ListAddressGroupReferencesResponse"
1447 }
1448}
1449
1450#[doc(hidden)]
1451impl google_cloud_gax::paginator::internal::PageableResponse
1452 for ListAddressGroupReferencesResponse
1453{
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 google_cloud_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 google_cloud_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]: google_cloud_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 google_cloud_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}