1#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate gtype;
25extern crate lazy_static;
26extern crate location;
27extern crate longrunning;
28extern crate lro;
29extern crate reqwest;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37#[derive(Clone, Default, PartialEq)]
39#[non_exhaustive]
40pub struct PolicyRule {
41 pub condition: std::option::Option<gtype::model::Expr>,
54
55 pub kind: std::option::Option<crate::model::policy_rule::Kind>,
56
57 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
58}
59
60impl PolicyRule {
61 pub fn new() -> Self {
62 std::default::Default::default()
63 }
64
65 pub fn set_condition<T>(mut self, v: T) -> Self
67 where
68 T: std::convert::Into<gtype::model::Expr>,
69 {
70 self.condition = std::option::Option::Some(v.into());
71 self
72 }
73
74 pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
76 where
77 T: std::convert::Into<gtype::model::Expr>,
78 {
79 self.condition = v.map(|x| x.into());
80 self
81 }
82
83 pub fn set_kind<T: std::convert::Into<std::option::Option<crate::model::policy_rule::Kind>>>(
88 mut self,
89 v: T,
90 ) -> Self {
91 self.kind = v.into();
92 self
93 }
94
95 pub fn values(
99 &self,
100 ) -> std::option::Option<&std::boxed::Box<crate::model::policy_rule::StringValues>> {
101 #[allow(unreachable_patterns)]
102 self.kind.as_ref().and_then(|v| match v {
103 crate::model::policy_rule::Kind::Values(v) => std::option::Option::Some(v),
104 _ => std::option::Option::None,
105 })
106 }
107
108 pub fn set_values<
114 T: std::convert::Into<std::boxed::Box<crate::model::policy_rule::StringValues>>,
115 >(
116 mut self,
117 v: T,
118 ) -> Self {
119 self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::Values(v.into()));
120 self
121 }
122
123 pub fn allow_all(&self) -> std::option::Option<&bool> {
127 #[allow(unreachable_patterns)]
128 self.kind.as_ref().and_then(|v| match v {
129 crate::model::policy_rule::Kind::AllowAll(v) => std::option::Option::Some(v),
130 _ => std::option::Option::None,
131 })
132 }
133
134 pub fn set_allow_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
140 self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::AllowAll(v.into()));
141 self
142 }
143
144 pub fn deny_all(&self) -> std::option::Option<&bool> {
148 #[allow(unreachable_patterns)]
149 self.kind.as_ref().and_then(|v| match v {
150 crate::model::policy_rule::Kind::DenyAll(v) => std::option::Option::Some(v),
151 _ => std::option::Option::None,
152 })
153 }
154
155 pub fn set_deny_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
161 self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::DenyAll(v.into()));
162 self
163 }
164
165 pub fn enforce(&self) -> std::option::Option<&bool> {
169 #[allow(unreachable_patterns)]
170 self.kind.as_ref().and_then(|v| match v {
171 crate::model::policy_rule::Kind::Enforce(v) => std::option::Option::Some(v),
172 _ => std::option::Option::None,
173 })
174 }
175
176 pub fn set_enforce<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
182 self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::Enforce(v.into()));
183 self
184 }
185}
186
187impl wkt::message::Message for PolicyRule {
188 fn typename() -> &'static str {
189 "type.googleapis.com/google.cloud.securityposture.v1.PolicyRule"
190 }
191}
192
193#[doc(hidden)]
194impl<'de> serde::de::Deserialize<'de> for PolicyRule {
195 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
196 where
197 D: serde::Deserializer<'de>,
198 {
199 #[allow(non_camel_case_types)]
200 #[doc(hidden)]
201 #[derive(PartialEq, Eq, Hash)]
202 enum __FieldTag {
203 __values,
204 __allow_all,
205 __deny_all,
206 __enforce,
207 __condition,
208 Unknown(std::string::String),
209 }
210 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
211 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
212 where
213 D: serde::Deserializer<'de>,
214 {
215 struct Visitor;
216 impl<'de> serde::de::Visitor<'de> for Visitor {
217 type Value = __FieldTag;
218 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
219 formatter.write_str("a field name for PolicyRule")
220 }
221 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
222 where
223 E: serde::de::Error,
224 {
225 use std::result::Result::Ok;
226 use std::string::ToString;
227 match value {
228 "values" => Ok(__FieldTag::__values),
229 "allowAll" => Ok(__FieldTag::__allow_all),
230 "allow_all" => Ok(__FieldTag::__allow_all),
231 "denyAll" => Ok(__FieldTag::__deny_all),
232 "deny_all" => Ok(__FieldTag::__deny_all),
233 "enforce" => Ok(__FieldTag::__enforce),
234 "condition" => Ok(__FieldTag::__condition),
235 _ => Ok(__FieldTag::Unknown(value.to_string())),
236 }
237 }
238 }
239 deserializer.deserialize_identifier(Visitor)
240 }
241 }
242 struct Visitor;
243 impl<'de> serde::de::Visitor<'de> for Visitor {
244 type Value = PolicyRule;
245 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
246 formatter.write_str("struct PolicyRule")
247 }
248 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
249 where
250 A: serde::de::MapAccess<'de>,
251 {
252 #[allow(unused_imports)]
253 use serde::de::Error;
254 use std::option::Option::Some;
255 let mut fields = std::collections::HashSet::new();
256 let mut result = Self::Value::new();
257 while let Some(tag) = map.next_key::<__FieldTag>()? {
258 #[allow(clippy::match_single_binding)]
259 match tag {
260 __FieldTag::__values => {
261 if !fields.insert(__FieldTag::__values) {
262 return std::result::Result::Err(A::Error::duplicate_field(
263 "multiple values for values",
264 ));
265 }
266 if result.kind.is_some() {
267 return std::result::Result::Err(A::Error::duplicate_field(
268 "multiple values for `kind`, a oneof with full ID .google.cloud.securityposture.v1.PolicyRule.values, latest field was values",
269 ));
270 }
271 result.kind =
272 std::option::Option::Some(crate::model::policy_rule::Kind::Values(
273 map.next_value::<std::option::Option<
274 std::boxed::Box<crate::model::policy_rule::StringValues>,
275 >>()?
276 .unwrap_or_default(),
277 ));
278 }
279 __FieldTag::__allow_all => {
280 if !fields.insert(__FieldTag::__allow_all) {
281 return std::result::Result::Err(A::Error::duplicate_field(
282 "multiple values for allow_all",
283 ));
284 }
285 if result.kind.is_some() {
286 return std::result::Result::Err(A::Error::duplicate_field(
287 "multiple values for `kind`, a oneof with full ID .google.cloud.securityposture.v1.PolicyRule.allow_all, latest field was allowAll",
288 ));
289 }
290 result.kind = std::option::Option::Some(
291 crate::model::policy_rule::Kind::AllowAll(
292 map.next_value::<std::option::Option<bool>>()?
293 .unwrap_or_default(),
294 ),
295 );
296 }
297 __FieldTag::__deny_all => {
298 if !fields.insert(__FieldTag::__deny_all) {
299 return std::result::Result::Err(A::Error::duplicate_field(
300 "multiple values for deny_all",
301 ));
302 }
303 if result.kind.is_some() {
304 return std::result::Result::Err(A::Error::duplicate_field(
305 "multiple values for `kind`, a oneof with full ID .google.cloud.securityposture.v1.PolicyRule.deny_all, latest field was denyAll",
306 ));
307 }
308 result.kind = std::option::Option::Some(
309 crate::model::policy_rule::Kind::DenyAll(
310 map.next_value::<std::option::Option<bool>>()?
311 .unwrap_or_default(),
312 ),
313 );
314 }
315 __FieldTag::__enforce => {
316 if !fields.insert(__FieldTag::__enforce) {
317 return std::result::Result::Err(A::Error::duplicate_field(
318 "multiple values for enforce",
319 ));
320 }
321 if result.kind.is_some() {
322 return std::result::Result::Err(A::Error::duplicate_field(
323 "multiple values for `kind`, a oneof with full ID .google.cloud.securityposture.v1.PolicyRule.enforce, latest field was enforce",
324 ));
325 }
326 result.kind = std::option::Option::Some(
327 crate::model::policy_rule::Kind::Enforce(
328 map.next_value::<std::option::Option<bool>>()?
329 .unwrap_or_default(),
330 ),
331 );
332 }
333 __FieldTag::__condition => {
334 if !fields.insert(__FieldTag::__condition) {
335 return std::result::Result::Err(A::Error::duplicate_field(
336 "multiple values for condition",
337 ));
338 }
339 result.condition =
340 map.next_value::<std::option::Option<gtype::model::Expr>>()?;
341 }
342 __FieldTag::Unknown(key) => {
343 let value = map.next_value::<serde_json::Value>()?;
344 result._unknown_fields.insert(key, value);
345 }
346 }
347 }
348 std::result::Result::Ok(result)
349 }
350 }
351 deserializer.deserialize_any(Visitor)
352 }
353}
354
355#[doc(hidden)]
356impl serde::ser::Serialize for PolicyRule {
357 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
358 where
359 S: serde::ser::Serializer,
360 {
361 use serde::ser::SerializeMap;
362 #[allow(unused_imports)]
363 use std::option::Option::Some;
364 let mut state = serializer.serialize_map(std::option::Option::None)?;
365 if let Some(value) = self.values() {
366 state.serialize_entry("values", value)?;
367 }
368 if let Some(value) = self.allow_all() {
369 state.serialize_entry("allowAll", value)?;
370 }
371 if let Some(value) = self.deny_all() {
372 state.serialize_entry("denyAll", value)?;
373 }
374 if let Some(value) = self.enforce() {
375 state.serialize_entry("enforce", value)?;
376 }
377 if self.condition.is_some() {
378 state.serialize_entry("condition", &self.condition)?;
379 }
380 if !self._unknown_fields.is_empty() {
381 for (key, value) in self._unknown_fields.iter() {
382 state.serialize_entry(key, &value)?;
383 }
384 }
385 state.end()
386 }
387}
388
389impl std::fmt::Debug for PolicyRule {
390 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
391 let mut debug_struct = f.debug_struct("PolicyRule");
392 debug_struct.field("condition", &self.condition);
393 debug_struct.field("kind", &self.kind);
394 if !self._unknown_fields.is_empty() {
395 debug_struct.field("_unknown_fields", &self._unknown_fields);
396 }
397 debug_struct.finish()
398 }
399}
400
401pub mod policy_rule {
403 #[allow(unused_imports)]
404 use super::*;
405
406 #[derive(Clone, Default, PartialEq)]
424 #[non_exhaustive]
425 pub struct StringValues {
426 pub allowed_values: std::vec::Vec<std::string::String>,
428
429 pub denied_values: std::vec::Vec<std::string::String>,
431
432 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
433 }
434
435 impl StringValues {
436 pub fn new() -> Self {
437 std::default::Default::default()
438 }
439
440 pub fn set_allowed_values<T, V>(mut self, v: T) -> Self
442 where
443 T: std::iter::IntoIterator<Item = V>,
444 V: std::convert::Into<std::string::String>,
445 {
446 use std::iter::Iterator;
447 self.allowed_values = v.into_iter().map(|i| i.into()).collect();
448 self
449 }
450
451 pub fn set_denied_values<T, V>(mut self, v: T) -> Self
453 where
454 T: std::iter::IntoIterator<Item = V>,
455 V: std::convert::Into<std::string::String>,
456 {
457 use std::iter::Iterator;
458 self.denied_values = v.into_iter().map(|i| i.into()).collect();
459 self
460 }
461 }
462
463 impl wkt::message::Message for StringValues {
464 fn typename() -> &'static str {
465 "type.googleapis.com/google.cloud.securityposture.v1.PolicyRule.StringValues"
466 }
467 }
468
469 #[doc(hidden)]
470 impl<'de> serde::de::Deserialize<'de> for StringValues {
471 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
472 where
473 D: serde::Deserializer<'de>,
474 {
475 #[allow(non_camel_case_types)]
476 #[doc(hidden)]
477 #[derive(PartialEq, Eq, Hash)]
478 enum __FieldTag {
479 __allowed_values,
480 __denied_values,
481 Unknown(std::string::String),
482 }
483 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
484 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
485 where
486 D: serde::Deserializer<'de>,
487 {
488 struct Visitor;
489 impl<'de> serde::de::Visitor<'de> for Visitor {
490 type Value = __FieldTag;
491 fn expecting(
492 &self,
493 formatter: &mut std::fmt::Formatter,
494 ) -> std::fmt::Result {
495 formatter.write_str("a field name for StringValues")
496 }
497 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
498 where
499 E: serde::de::Error,
500 {
501 use std::result::Result::Ok;
502 use std::string::ToString;
503 match value {
504 "allowedValues" => Ok(__FieldTag::__allowed_values),
505 "allowed_values" => Ok(__FieldTag::__allowed_values),
506 "deniedValues" => Ok(__FieldTag::__denied_values),
507 "denied_values" => Ok(__FieldTag::__denied_values),
508 _ => Ok(__FieldTag::Unknown(value.to_string())),
509 }
510 }
511 }
512 deserializer.deserialize_identifier(Visitor)
513 }
514 }
515 struct Visitor;
516 impl<'de> serde::de::Visitor<'de> for Visitor {
517 type Value = StringValues;
518 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
519 formatter.write_str("struct StringValues")
520 }
521 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
522 where
523 A: serde::de::MapAccess<'de>,
524 {
525 #[allow(unused_imports)]
526 use serde::de::Error;
527 use std::option::Option::Some;
528 let mut fields = std::collections::HashSet::new();
529 let mut result = Self::Value::new();
530 while let Some(tag) = map.next_key::<__FieldTag>()? {
531 #[allow(clippy::match_single_binding)]
532 match tag {
533 __FieldTag::__allowed_values => {
534 if !fields.insert(__FieldTag::__allowed_values) {
535 return std::result::Result::Err(A::Error::duplicate_field(
536 "multiple values for allowed_values",
537 ));
538 }
539 result.allowed_values = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
540 }
541 __FieldTag::__denied_values => {
542 if !fields.insert(__FieldTag::__denied_values) {
543 return std::result::Result::Err(A::Error::duplicate_field(
544 "multiple values for denied_values",
545 ));
546 }
547 result.denied_values = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
548 }
549 __FieldTag::Unknown(key) => {
550 let value = map.next_value::<serde_json::Value>()?;
551 result._unknown_fields.insert(key, value);
552 }
553 }
554 }
555 std::result::Result::Ok(result)
556 }
557 }
558 deserializer.deserialize_any(Visitor)
559 }
560 }
561
562 #[doc(hidden)]
563 impl serde::ser::Serialize for StringValues {
564 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
565 where
566 S: serde::ser::Serializer,
567 {
568 use serde::ser::SerializeMap;
569 #[allow(unused_imports)]
570 use std::option::Option::Some;
571 let mut state = serializer.serialize_map(std::option::Option::None)?;
572 if !self.allowed_values.is_empty() {
573 state.serialize_entry("allowedValues", &self.allowed_values)?;
574 }
575 if !self.denied_values.is_empty() {
576 state.serialize_entry("deniedValues", &self.denied_values)?;
577 }
578 if !self._unknown_fields.is_empty() {
579 for (key, value) in self._unknown_fields.iter() {
580 state.serialize_entry(key, &value)?;
581 }
582 }
583 state.end()
584 }
585 }
586
587 impl std::fmt::Debug for StringValues {
588 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
589 let mut debug_struct = f.debug_struct("StringValues");
590 debug_struct.field("allowed_values", &self.allowed_values);
591 debug_struct.field("denied_values", &self.denied_values);
592 if !self._unknown_fields.is_empty() {
593 debug_struct.field("_unknown_fields", &self._unknown_fields);
594 }
595 debug_struct.finish()
596 }
597 }
598
599 #[derive(Clone, Debug, PartialEq)]
600 #[non_exhaustive]
601 pub enum Kind {
602 Values(std::boxed::Box<crate::model::policy_rule::StringValues>),
605 AllowAll(bool),
608 DenyAll(bool),
611 Enforce(bool),
615 }
616}
617
618#[derive(Clone, Default, PartialEq)]
625#[non_exhaustive]
626pub struct CustomConstraint {
627 pub name: std::string::String,
638
639 pub resource_types: std::vec::Vec<std::string::String>,
644
645 pub method_types: std::vec::Vec<crate::model::custom_constraint::MethodType>,
647
648 pub condition: std::string::String,
654
655 pub action_type: crate::model::custom_constraint::ActionType,
657
658 pub display_name: std::string::String,
661
662 pub description: std::string::String,
665
666 pub update_time: std::option::Option<wkt::Timestamp>,
670
671 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
672}
673
674impl CustomConstraint {
675 pub fn new() -> Self {
676 std::default::Default::default()
677 }
678
679 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
681 self.name = v.into();
682 self
683 }
684
685 pub fn set_resource_types<T, V>(mut self, v: T) -> Self
687 where
688 T: std::iter::IntoIterator<Item = V>,
689 V: std::convert::Into<std::string::String>,
690 {
691 use std::iter::Iterator;
692 self.resource_types = v.into_iter().map(|i| i.into()).collect();
693 self
694 }
695
696 pub fn set_method_types<T, V>(mut self, v: T) -> Self
698 where
699 T: std::iter::IntoIterator<Item = V>,
700 V: std::convert::Into<crate::model::custom_constraint::MethodType>,
701 {
702 use std::iter::Iterator;
703 self.method_types = v.into_iter().map(|i| i.into()).collect();
704 self
705 }
706
707 pub fn set_condition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
709 self.condition = v.into();
710 self
711 }
712
713 pub fn set_action_type<T: std::convert::Into<crate::model::custom_constraint::ActionType>>(
715 mut self,
716 v: T,
717 ) -> Self {
718 self.action_type = v.into();
719 self
720 }
721
722 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
724 self.display_name = v.into();
725 self
726 }
727
728 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
730 self.description = v.into();
731 self
732 }
733
734 pub fn set_update_time<T>(mut self, v: T) -> Self
736 where
737 T: std::convert::Into<wkt::Timestamp>,
738 {
739 self.update_time = std::option::Option::Some(v.into());
740 self
741 }
742
743 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
745 where
746 T: std::convert::Into<wkt::Timestamp>,
747 {
748 self.update_time = v.map(|x| x.into());
749 self
750 }
751}
752
753impl wkt::message::Message for CustomConstraint {
754 fn typename() -> &'static str {
755 "type.googleapis.com/google.cloud.securityposture.v1.CustomConstraint"
756 }
757}
758
759#[doc(hidden)]
760impl<'de> serde::de::Deserialize<'de> for CustomConstraint {
761 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
762 where
763 D: serde::Deserializer<'de>,
764 {
765 #[allow(non_camel_case_types)]
766 #[doc(hidden)]
767 #[derive(PartialEq, Eq, Hash)]
768 enum __FieldTag {
769 __name,
770 __resource_types,
771 __method_types,
772 __condition,
773 __action_type,
774 __display_name,
775 __description,
776 __update_time,
777 Unknown(std::string::String),
778 }
779 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
780 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
781 where
782 D: serde::Deserializer<'de>,
783 {
784 struct Visitor;
785 impl<'de> serde::de::Visitor<'de> for Visitor {
786 type Value = __FieldTag;
787 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
788 formatter.write_str("a field name for CustomConstraint")
789 }
790 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
791 where
792 E: serde::de::Error,
793 {
794 use std::result::Result::Ok;
795 use std::string::ToString;
796 match value {
797 "name" => Ok(__FieldTag::__name),
798 "resourceTypes" => Ok(__FieldTag::__resource_types),
799 "resource_types" => Ok(__FieldTag::__resource_types),
800 "methodTypes" => Ok(__FieldTag::__method_types),
801 "method_types" => Ok(__FieldTag::__method_types),
802 "condition" => Ok(__FieldTag::__condition),
803 "actionType" => Ok(__FieldTag::__action_type),
804 "action_type" => Ok(__FieldTag::__action_type),
805 "displayName" => Ok(__FieldTag::__display_name),
806 "display_name" => Ok(__FieldTag::__display_name),
807 "description" => Ok(__FieldTag::__description),
808 "updateTime" => Ok(__FieldTag::__update_time),
809 "update_time" => Ok(__FieldTag::__update_time),
810 _ => Ok(__FieldTag::Unknown(value.to_string())),
811 }
812 }
813 }
814 deserializer.deserialize_identifier(Visitor)
815 }
816 }
817 struct Visitor;
818 impl<'de> serde::de::Visitor<'de> for Visitor {
819 type Value = CustomConstraint;
820 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
821 formatter.write_str("struct CustomConstraint")
822 }
823 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
824 where
825 A: serde::de::MapAccess<'de>,
826 {
827 #[allow(unused_imports)]
828 use serde::de::Error;
829 use std::option::Option::Some;
830 let mut fields = std::collections::HashSet::new();
831 let mut result = Self::Value::new();
832 while let Some(tag) = map.next_key::<__FieldTag>()? {
833 #[allow(clippy::match_single_binding)]
834 match tag {
835 __FieldTag::__name => {
836 if !fields.insert(__FieldTag::__name) {
837 return std::result::Result::Err(A::Error::duplicate_field(
838 "multiple values for name",
839 ));
840 }
841 result.name = map
842 .next_value::<std::option::Option<std::string::String>>()?
843 .unwrap_or_default();
844 }
845 __FieldTag::__resource_types => {
846 if !fields.insert(__FieldTag::__resource_types) {
847 return std::result::Result::Err(A::Error::duplicate_field(
848 "multiple values for resource_types",
849 ));
850 }
851 result.resource_types = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
852 }
853 __FieldTag::__method_types => {
854 if !fields.insert(__FieldTag::__method_types) {
855 return std::result::Result::Err(A::Error::duplicate_field(
856 "multiple values for method_types",
857 ));
858 }
859 result.method_types = map
860 .next_value::<std::option::Option<
861 std::vec::Vec<crate::model::custom_constraint::MethodType>,
862 >>()?
863 .unwrap_or_default();
864 }
865 __FieldTag::__condition => {
866 if !fields.insert(__FieldTag::__condition) {
867 return std::result::Result::Err(A::Error::duplicate_field(
868 "multiple values for condition",
869 ));
870 }
871 result.condition = map
872 .next_value::<std::option::Option<std::string::String>>()?
873 .unwrap_or_default();
874 }
875 __FieldTag::__action_type => {
876 if !fields.insert(__FieldTag::__action_type) {
877 return std::result::Result::Err(A::Error::duplicate_field(
878 "multiple values for action_type",
879 ));
880 }
881 result.action_type =
882 map.next_value::<std::option::Option<
883 crate::model::custom_constraint::ActionType,
884 >>()?
885 .unwrap_or_default();
886 }
887 __FieldTag::__display_name => {
888 if !fields.insert(__FieldTag::__display_name) {
889 return std::result::Result::Err(A::Error::duplicate_field(
890 "multiple values for display_name",
891 ));
892 }
893 result.display_name = map
894 .next_value::<std::option::Option<std::string::String>>()?
895 .unwrap_or_default();
896 }
897 __FieldTag::__description => {
898 if !fields.insert(__FieldTag::__description) {
899 return std::result::Result::Err(A::Error::duplicate_field(
900 "multiple values for description",
901 ));
902 }
903 result.description = map
904 .next_value::<std::option::Option<std::string::String>>()?
905 .unwrap_or_default();
906 }
907 __FieldTag::__update_time => {
908 if !fields.insert(__FieldTag::__update_time) {
909 return std::result::Result::Err(A::Error::duplicate_field(
910 "multiple values for update_time",
911 ));
912 }
913 result.update_time =
914 map.next_value::<std::option::Option<wkt::Timestamp>>()?;
915 }
916 __FieldTag::Unknown(key) => {
917 let value = map.next_value::<serde_json::Value>()?;
918 result._unknown_fields.insert(key, value);
919 }
920 }
921 }
922 std::result::Result::Ok(result)
923 }
924 }
925 deserializer.deserialize_any(Visitor)
926 }
927}
928
929#[doc(hidden)]
930impl serde::ser::Serialize for CustomConstraint {
931 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
932 where
933 S: serde::ser::Serializer,
934 {
935 use serde::ser::SerializeMap;
936 #[allow(unused_imports)]
937 use std::option::Option::Some;
938 let mut state = serializer.serialize_map(std::option::Option::None)?;
939 if !self.name.is_empty() {
940 state.serialize_entry("name", &self.name)?;
941 }
942 if !self.resource_types.is_empty() {
943 state.serialize_entry("resourceTypes", &self.resource_types)?;
944 }
945 if !self.method_types.is_empty() {
946 state.serialize_entry("methodTypes", &self.method_types)?;
947 }
948 if !self.condition.is_empty() {
949 state.serialize_entry("condition", &self.condition)?;
950 }
951 if !wkt::internal::is_default(&self.action_type) {
952 state.serialize_entry("actionType", &self.action_type)?;
953 }
954 if !self.display_name.is_empty() {
955 state.serialize_entry("displayName", &self.display_name)?;
956 }
957 if !self.description.is_empty() {
958 state.serialize_entry("description", &self.description)?;
959 }
960 if self.update_time.is_some() {
961 state.serialize_entry("updateTime", &self.update_time)?;
962 }
963 if !self._unknown_fields.is_empty() {
964 for (key, value) in self._unknown_fields.iter() {
965 state.serialize_entry(key, &value)?;
966 }
967 }
968 state.end()
969 }
970}
971
972impl std::fmt::Debug for CustomConstraint {
973 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
974 let mut debug_struct = f.debug_struct("CustomConstraint");
975 debug_struct.field("name", &self.name);
976 debug_struct.field("resource_types", &self.resource_types);
977 debug_struct.field("method_types", &self.method_types);
978 debug_struct.field("condition", &self.condition);
979 debug_struct.field("action_type", &self.action_type);
980 debug_struct.field("display_name", &self.display_name);
981 debug_struct.field("description", &self.description);
982 debug_struct.field("update_time", &self.update_time);
983 if !self._unknown_fields.is_empty() {
984 debug_struct.field("_unknown_fields", &self._unknown_fields);
985 }
986 debug_struct.finish()
987 }
988}
989
990pub mod custom_constraint {
992 #[allow(unused_imports)]
993 use super::*;
994
995 #[derive(Clone, Debug, PartialEq)]
1017 #[non_exhaustive]
1018 pub enum MethodType {
1019 Unspecified,
1021 Create,
1023 Update,
1025 Delete,
1028 UnknownValue(method_type::UnknownValue),
1033 }
1034
1035 #[doc(hidden)]
1036 pub mod method_type {
1037 #[allow(unused_imports)]
1038 use super::*;
1039 #[derive(Clone, Debug, PartialEq)]
1040 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1041 }
1042
1043 impl MethodType {
1044 pub fn value(&self) -> std::option::Option<i32> {
1049 match self {
1050 Self::Unspecified => std::option::Option::Some(0),
1051 Self::Create => std::option::Option::Some(1),
1052 Self::Update => std::option::Option::Some(2),
1053 Self::Delete => std::option::Option::Some(3),
1054 Self::UnknownValue(u) => u.0.value(),
1055 }
1056 }
1057
1058 pub fn name(&self) -> std::option::Option<&str> {
1063 match self {
1064 Self::Unspecified => std::option::Option::Some("METHOD_TYPE_UNSPECIFIED"),
1065 Self::Create => std::option::Option::Some("CREATE"),
1066 Self::Update => std::option::Option::Some("UPDATE"),
1067 Self::Delete => std::option::Option::Some("DELETE"),
1068 Self::UnknownValue(u) => u.0.name(),
1069 }
1070 }
1071 }
1072
1073 impl std::default::Default for MethodType {
1074 fn default() -> Self {
1075 use std::convert::From;
1076 Self::from(0)
1077 }
1078 }
1079
1080 impl std::fmt::Display for MethodType {
1081 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1082 wkt::internal::display_enum(f, self.name(), self.value())
1083 }
1084 }
1085
1086 impl std::convert::From<i32> for MethodType {
1087 fn from(value: i32) -> Self {
1088 match value {
1089 0 => Self::Unspecified,
1090 1 => Self::Create,
1091 2 => Self::Update,
1092 3 => Self::Delete,
1093 _ => Self::UnknownValue(method_type::UnknownValue(
1094 wkt::internal::UnknownEnumValue::Integer(value),
1095 )),
1096 }
1097 }
1098 }
1099
1100 impl std::convert::From<&str> for MethodType {
1101 fn from(value: &str) -> Self {
1102 use std::string::ToString;
1103 match value {
1104 "METHOD_TYPE_UNSPECIFIED" => Self::Unspecified,
1105 "CREATE" => Self::Create,
1106 "UPDATE" => Self::Update,
1107 "DELETE" => Self::Delete,
1108 _ => Self::UnknownValue(method_type::UnknownValue(
1109 wkt::internal::UnknownEnumValue::String(value.to_string()),
1110 )),
1111 }
1112 }
1113 }
1114
1115 impl serde::ser::Serialize for MethodType {
1116 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1117 where
1118 S: serde::Serializer,
1119 {
1120 match self {
1121 Self::Unspecified => serializer.serialize_i32(0),
1122 Self::Create => serializer.serialize_i32(1),
1123 Self::Update => serializer.serialize_i32(2),
1124 Self::Delete => serializer.serialize_i32(3),
1125 Self::UnknownValue(u) => u.0.serialize(serializer),
1126 }
1127 }
1128 }
1129
1130 impl<'de> serde::de::Deserialize<'de> for MethodType {
1131 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1132 where
1133 D: serde::Deserializer<'de>,
1134 {
1135 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MethodType>::new(
1136 ".google.cloud.securityposture.v1.CustomConstraint.MethodType",
1137 ))
1138 }
1139 }
1140
1141 #[derive(Clone, Debug, PartialEq)]
1157 #[non_exhaustive]
1158 pub enum ActionType {
1159 Unspecified,
1161 Allow,
1163 Deny,
1165 UnknownValue(action_type::UnknownValue),
1170 }
1171
1172 #[doc(hidden)]
1173 pub mod action_type {
1174 #[allow(unused_imports)]
1175 use super::*;
1176 #[derive(Clone, Debug, PartialEq)]
1177 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1178 }
1179
1180 impl ActionType {
1181 pub fn value(&self) -> std::option::Option<i32> {
1186 match self {
1187 Self::Unspecified => std::option::Option::Some(0),
1188 Self::Allow => std::option::Option::Some(1),
1189 Self::Deny => std::option::Option::Some(2),
1190 Self::UnknownValue(u) => u.0.value(),
1191 }
1192 }
1193
1194 pub fn name(&self) -> std::option::Option<&str> {
1199 match self {
1200 Self::Unspecified => std::option::Option::Some("ACTION_TYPE_UNSPECIFIED"),
1201 Self::Allow => std::option::Option::Some("ALLOW"),
1202 Self::Deny => std::option::Option::Some("DENY"),
1203 Self::UnknownValue(u) => u.0.name(),
1204 }
1205 }
1206 }
1207
1208 impl std::default::Default for ActionType {
1209 fn default() -> Self {
1210 use std::convert::From;
1211 Self::from(0)
1212 }
1213 }
1214
1215 impl std::fmt::Display for ActionType {
1216 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1217 wkt::internal::display_enum(f, self.name(), self.value())
1218 }
1219 }
1220
1221 impl std::convert::From<i32> for ActionType {
1222 fn from(value: i32) -> Self {
1223 match value {
1224 0 => Self::Unspecified,
1225 1 => Self::Allow,
1226 2 => Self::Deny,
1227 _ => Self::UnknownValue(action_type::UnknownValue(
1228 wkt::internal::UnknownEnumValue::Integer(value),
1229 )),
1230 }
1231 }
1232 }
1233
1234 impl std::convert::From<&str> for ActionType {
1235 fn from(value: &str) -> Self {
1236 use std::string::ToString;
1237 match value {
1238 "ACTION_TYPE_UNSPECIFIED" => Self::Unspecified,
1239 "ALLOW" => Self::Allow,
1240 "DENY" => Self::Deny,
1241 _ => Self::UnknownValue(action_type::UnknownValue(
1242 wkt::internal::UnknownEnumValue::String(value.to_string()),
1243 )),
1244 }
1245 }
1246 }
1247
1248 impl serde::ser::Serialize for ActionType {
1249 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1250 where
1251 S: serde::Serializer,
1252 {
1253 match self {
1254 Self::Unspecified => serializer.serialize_i32(0),
1255 Self::Allow => serializer.serialize_i32(1),
1256 Self::Deny => serializer.serialize_i32(2),
1257 Self::UnknownValue(u) => u.0.serialize(serializer),
1258 }
1259 }
1260 }
1261
1262 impl<'de> serde::de::Deserialize<'de> for ActionType {
1263 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1264 where
1265 D: serde::Deserializer<'de>,
1266 {
1267 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ActionType>::new(
1268 ".google.cloud.securityposture.v1.CustomConstraint.ActionType",
1269 ))
1270 }
1271 }
1272}
1273
1274#[derive(Clone, Default, PartialEq)]
1276#[non_exhaustive]
1277pub struct OrgPolicyConstraint {
1278 pub canned_constraint_id: std::string::String,
1280
1281 pub policy_rules: std::vec::Vec<crate::model::PolicyRule>,
1283
1284 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1285}
1286
1287impl OrgPolicyConstraint {
1288 pub fn new() -> Self {
1289 std::default::Default::default()
1290 }
1291
1292 pub fn set_canned_constraint_id<T: std::convert::Into<std::string::String>>(
1294 mut self,
1295 v: T,
1296 ) -> Self {
1297 self.canned_constraint_id = v.into();
1298 self
1299 }
1300
1301 pub fn set_policy_rules<T, V>(mut self, v: T) -> Self
1303 where
1304 T: std::iter::IntoIterator<Item = V>,
1305 V: std::convert::Into<crate::model::PolicyRule>,
1306 {
1307 use std::iter::Iterator;
1308 self.policy_rules = v.into_iter().map(|i| i.into()).collect();
1309 self
1310 }
1311}
1312
1313impl wkt::message::Message for OrgPolicyConstraint {
1314 fn typename() -> &'static str {
1315 "type.googleapis.com/google.cloud.securityposture.v1.OrgPolicyConstraint"
1316 }
1317}
1318
1319#[doc(hidden)]
1320impl<'de> serde::de::Deserialize<'de> for OrgPolicyConstraint {
1321 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1322 where
1323 D: serde::Deserializer<'de>,
1324 {
1325 #[allow(non_camel_case_types)]
1326 #[doc(hidden)]
1327 #[derive(PartialEq, Eq, Hash)]
1328 enum __FieldTag {
1329 __canned_constraint_id,
1330 __policy_rules,
1331 Unknown(std::string::String),
1332 }
1333 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1334 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1335 where
1336 D: serde::Deserializer<'de>,
1337 {
1338 struct Visitor;
1339 impl<'de> serde::de::Visitor<'de> for Visitor {
1340 type Value = __FieldTag;
1341 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1342 formatter.write_str("a field name for OrgPolicyConstraint")
1343 }
1344 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1345 where
1346 E: serde::de::Error,
1347 {
1348 use std::result::Result::Ok;
1349 use std::string::ToString;
1350 match value {
1351 "cannedConstraintId" => Ok(__FieldTag::__canned_constraint_id),
1352 "canned_constraint_id" => Ok(__FieldTag::__canned_constraint_id),
1353 "policyRules" => Ok(__FieldTag::__policy_rules),
1354 "policy_rules" => Ok(__FieldTag::__policy_rules),
1355 _ => Ok(__FieldTag::Unknown(value.to_string())),
1356 }
1357 }
1358 }
1359 deserializer.deserialize_identifier(Visitor)
1360 }
1361 }
1362 struct Visitor;
1363 impl<'de> serde::de::Visitor<'de> for Visitor {
1364 type Value = OrgPolicyConstraint;
1365 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1366 formatter.write_str("struct OrgPolicyConstraint")
1367 }
1368 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1369 where
1370 A: serde::de::MapAccess<'de>,
1371 {
1372 #[allow(unused_imports)]
1373 use serde::de::Error;
1374 use std::option::Option::Some;
1375 let mut fields = std::collections::HashSet::new();
1376 let mut result = Self::Value::new();
1377 while let Some(tag) = map.next_key::<__FieldTag>()? {
1378 #[allow(clippy::match_single_binding)]
1379 match tag {
1380 __FieldTag::__canned_constraint_id => {
1381 if !fields.insert(__FieldTag::__canned_constraint_id) {
1382 return std::result::Result::Err(A::Error::duplicate_field(
1383 "multiple values for canned_constraint_id",
1384 ));
1385 }
1386 result.canned_constraint_id = map
1387 .next_value::<std::option::Option<std::string::String>>()?
1388 .unwrap_or_default();
1389 }
1390 __FieldTag::__policy_rules => {
1391 if !fields.insert(__FieldTag::__policy_rules) {
1392 return std::result::Result::Err(A::Error::duplicate_field(
1393 "multiple values for policy_rules",
1394 ));
1395 }
1396 result.policy_rules = map.next_value::<std::option::Option<std::vec::Vec<crate::model::PolicyRule>>>()?.unwrap_or_default();
1397 }
1398 __FieldTag::Unknown(key) => {
1399 let value = map.next_value::<serde_json::Value>()?;
1400 result._unknown_fields.insert(key, value);
1401 }
1402 }
1403 }
1404 std::result::Result::Ok(result)
1405 }
1406 }
1407 deserializer.deserialize_any(Visitor)
1408 }
1409}
1410
1411#[doc(hidden)]
1412impl serde::ser::Serialize for OrgPolicyConstraint {
1413 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1414 where
1415 S: serde::ser::Serializer,
1416 {
1417 use serde::ser::SerializeMap;
1418 #[allow(unused_imports)]
1419 use std::option::Option::Some;
1420 let mut state = serializer.serialize_map(std::option::Option::None)?;
1421 if !self.canned_constraint_id.is_empty() {
1422 state.serialize_entry("cannedConstraintId", &self.canned_constraint_id)?;
1423 }
1424 if !self.policy_rules.is_empty() {
1425 state.serialize_entry("policyRules", &self.policy_rules)?;
1426 }
1427 if !self._unknown_fields.is_empty() {
1428 for (key, value) in self._unknown_fields.iter() {
1429 state.serialize_entry(key, &value)?;
1430 }
1431 }
1432 state.end()
1433 }
1434}
1435
1436impl std::fmt::Debug for OrgPolicyConstraint {
1437 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1438 let mut debug_struct = f.debug_struct("OrgPolicyConstraint");
1439 debug_struct.field("canned_constraint_id", &self.canned_constraint_id);
1440 debug_struct.field("policy_rules", &self.policy_rules);
1441 if !self._unknown_fields.is_empty() {
1442 debug_struct.field("_unknown_fields", &self._unknown_fields);
1443 }
1444 debug_struct.finish()
1445 }
1446}
1447
1448#[derive(Clone, Default, PartialEq)]
1450#[non_exhaustive]
1451pub struct OrgPolicyConstraintCustom {
1452 pub custom_constraint: std::option::Option<crate::model::CustomConstraint>,
1454
1455 pub policy_rules: std::vec::Vec<crate::model::PolicyRule>,
1457
1458 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1459}
1460
1461impl OrgPolicyConstraintCustom {
1462 pub fn new() -> Self {
1463 std::default::Default::default()
1464 }
1465
1466 pub fn set_custom_constraint<T>(mut self, v: T) -> Self
1468 where
1469 T: std::convert::Into<crate::model::CustomConstraint>,
1470 {
1471 self.custom_constraint = std::option::Option::Some(v.into());
1472 self
1473 }
1474
1475 pub fn set_or_clear_custom_constraint<T>(mut self, v: std::option::Option<T>) -> Self
1477 where
1478 T: std::convert::Into<crate::model::CustomConstraint>,
1479 {
1480 self.custom_constraint = v.map(|x| x.into());
1481 self
1482 }
1483
1484 pub fn set_policy_rules<T, V>(mut self, v: T) -> Self
1486 where
1487 T: std::iter::IntoIterator<Item = V>,
1488 V: std::convert::Into<crate::model::PolicyRule>,
1489 {
1490 use std::iter::Iterator;
1491 self.policy_rules = v.into_iter().map(|i| i.into()).collect();
1492 self
1493 }
1494}
1495
1496impl wkt::message::Message for OrgPolicyConstraintCustom {
1497 fn typename() -> &'static str {
1498 "type.googleapis.com/google.cloud.securityposture.v1.OrgPolicyConstraintCustom"
1499 }
1500}
1501
1502#[doc(hidden)]
1503impl<'de> serde::de::Deserialize<'de> for OrgPolicyConstraintCustom {
1504 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1505 where
1506 D: serde::Deserializer<'de>,
1507 {
1508 #[allow(non_camel_case_types)]
1509 #[doc(hidden)]
1510 #[derive(PartialEq, Eq, Hash)]
1511 enum __FieldTag {
1512 __custom_constraint,
1513 __policy_rules,
1514 Unknown(std::string::String),
1515 }
1516 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1517 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1518 where
1519 D: serde::Deserializer<'de>,
1520 {
1521 struct Visitor;
1522 impl<'de> serde::de::Visitor<'de> for Visitor {
1523 type Value = __FieldTag;
1524 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1525 formatter.write_str("a field name for OrgPolicyConstraintCustom")
1526 }
1527 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1528 where
1529 E: serde::de::Error,
1530 {
1531 use std::result::Result::Ok;
1532 use std::string::ToString;
1533 match value {
1534 "customConstraint" => Ok(__FieldTag::__custom_constraint),
1535 "custom_constraint" => Ok(__FieldTag::__custom_constraint),
1536 "policyRules" => Ok(__FieldTag::__policy_rules),
1537 "policy_rules" => Ok(__FieldTag::__policy_rules),
1538 _ => Ok(__FieldTag::Unknown(value.to_string())),
1539 }
1540 }
1541 }
1542 deserializer.deserialize_identifier(Visitor)
1543 }
1544 }
1545 struct Visitor;
1546 impl<'de> serde::de::Visitor<'de> for Visitor {
1547 type Value = OrgPolicyConstraintCustom;
1548 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1549 formatter.write_str("struct OrgPolicyConstraintCustom")
1550 }
1551 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1552 where
1553 A: serde::de::MapAccess<'de>,
1554 {
1555 #[allow(unused_imports)]
1556 use serde::de::Error;
1557 use std::option::Option::Some;
1558 let mut fields = std::collections::HashSet::new();
1559 let mut result = Self::Value::new();
1560 while let Some(tag) = map.next_key::<__FieldTag>()? {
1561 #[allow(clippy::match_single_binding)]
1562 match tag {
1563 __FieldTag::__custom_constraint => {
1564 if !fields.insert(__FieldTag::__custom_constraint) {
1565 return std::result::Result::Err(A::Error::duplicate_field(
1566 "multiple values for custom_constraint",
1567 ));
1568 }
1569 result.custom_constraint = map
1570 .next_value::<std::option::Option<crate::model::CustomConstraint>>(
1571 )?;
1572 }
1573 __FieldTag::__policy_rules => {
1574 if !fields.insert(__FieldTag::__policy_rules) {
1575 return std::result::Result::Err(A::Error::duplicate_field(
1576 "multiple values for policy_rules",
1577 ));
1578 }
1579 result.policy_rules = map.next_value::<std::option::Option<std::vec::Vec<crate::model::PolicyRule>>>()?.unwrap_or_default();
1580 }
1581 __FieldTag::Unknown(key) => {
1582 let value = map.next_value::<serde_json::Value>()?;
1583 result._unknown_fields.insert(key, value);
1584 }
1585 }
1586 }
1587 std::result::Result::Ok(result)
1588 }
1589 }
1590 deserializer.deserialize_any(Visitor)
1591 }
1592}
1593
1594#[doc(hidden)]
1595impl serde::ser::Serialize for OrgPolicyConstraintCustom {
1596 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1597 where
1598 S: serde::ser::Serializer,
1599 {
1600 use serde::ser::SerializeMap;
1601 #[allow(unused_imports)]
1602 use std::option::Option::Some;
1603 let mut state = serializer.serialize_map(std::option::Option::None)?;
1604 if self.custom_constraint.is_some() {
1605 state.serialize_entry("customConstraint", &self.custom_constraint)?;
1606 }
1607 if !self.policy_rules.is_empty() {
1608 state.serialize_entry("policyRules", &self.policy_rules)?;
1609 }
1610 if !self._unknown_fields.is_empty() {
1611 for (key, value) in self._unknown_fields.iter() {
1612 state.serialize_entry(key, &value)?;
1613 }
1614 }
1615 state.end()
1616 }
1617}
1618
1619impl std::fmt::Debug for OrgPolicyConstraintCustom {
1620 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1621 let mut debug_struct = f.debug_struct("OrgPolicyConstraintCustom");
1622 debug_struct.field("custom_constraint", &self.custom_constraint);
1623 debug_struct.field("policy_rules", &self.policy_rules);
1624 if !self._unknown_fields.is_empty() {
1625 debug_struct.field("_unknown_fields", &self._unknown_fields);
1626 }
1627 debug_struct.finish()
1628 }
1629}
1630
1631#[derive(Clone, Default, PartialEq)]
1633#[non_exhaustive]
1634pub struct OperationMetadata {
1635 pub create_time: std::option::Option<wkt::Timestamp>,
1637
1638 pub end_time: std::option::Option<wkt::Timestamp>,
1640
1641 pub target: std::string::String,
1643
1644 pub verb: std::string::String,
1646
1647 pub status_message: std::string::String,
1649
1650 pub requested_cancellation: bool,
1658
1659 pub api_version: std::string::String,
1661
1662 pub error_message: std::string::String,
1666
1667 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1668}
1669
1670impl OperationMetadata {
1671 pub fn new() -> Self {
1672 std::default::Default::default()
1673 }
1674
1675 pub fn set_create_time<T>(mut self, v: T) -> Self
1677 where
1678 T: std::convert::Into<wkt::Timestamp>,
1679 {
1680 self.create_time = std::option::Option::Some(v.into());
1681 self
1682 }
1683
1684 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1686 where
1687 T: std::convert::Into<wkt::Timestamp>,
1688 {
1689 self.create_time = v.map(|x| x.into());
1690 self
1691 }
1692
1693 pub fn set_end_time<T>(mut self, v: T) -> Self
1695 where
1696 T: std::convert::Into<wkt::Timestamp>,
1697 {
1698 self.end_time = std::option::Option::Some(v.into());
1699 self
1700 }
1701
1702 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
1704 where
1705 T: std::convert::Into<wkt::Timestamp>,
1706 {
1707 self.end_time = v.map(|x| x.into());
1708 self
1709 }
1710
1711 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1713 self.target = v.into();
1714 self
1715 }
1716
1717 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1719 self.verb = v.into();
1720 self
1721 }
1722
1723 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1725 self.status_message = v.into();
1726 self
1727 }
1728
1729 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1731 self.requested_cancellation = v.into();
1732 self
1733 }
1734
1735 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1737 self.api_version = v.into();
1738 self
1739 }
1740
1741 pub fn set_error_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1743 self.error_message = v.into();
1744 self
1745 }
1746}
1747
1748impl wkt::message::Message for OperationMetadata {
1749 fn typename() -> &'static str {
1750 "type.googleapis.com/google.cloud.securityposture.v1.OperationMetadata"
1751 }
1752}
1753
1754#[doc(hidden)]
1755impl<'de> serde::de::Deserialize<'de> for OperationMetadata {
1756 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1757 where
1758 D: serde::Deserializer<'de>,
1759 {
1760 #[allow(non_camel_case_types)]
1761 #[doc(hidden)]
1762 #[derive(PartialEq, Eq, Hash)]
1763 enum __FieldTag {
1764 __create_time,
1765 __end_time,
1766 __target,
1767 __verb,
1768 __status_message,
1769 __requested_cancellation,
1770 __api_version,
1771 __error_message,
1772 Unknown(std::string::String),
1773 }
1774 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1775 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1776 where
1777 D: serde::Deserializer<'de>,
1778 {
1779 struct Visitor;
1780 impl<'de> serde::de::Visitor<'de> for Visitor {
1781 type Value = __FieldTag;
1782 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1783 formatter.write_str("a field name for OperationMetadata")
1784 }
1785 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1786 where
1787 E: serde::de::Error,
1788 {
1789 use std::result::Result::Ok;
1790 use std::string::ToString;
1791 match value {
1792 "createTime" => Ok(__FieldTag::__create_time),
1793 "create_time" => Ok(__FieldTag::__create_time),
1794 "endTime" => Ok(__FieldTag::__end_time),
1795 "end_time" => Ok(__FieldTag::__end_time),
1796 "target" => Ok(__FieldTag::__target),
1797 "verb" => Ok(__FieldTag::__verb),
1798 "statusMessage" => Ok(__FieldTag::__status_message),
1799 "status_message" => Ok(__FieldTag::__status_message),
1800 "requestedCancellation" => Ok(__FieldTag::__requested_cancellation),
1801 "requested_cancellation" => Ok(__FieldTag::__requested_cancellation),
1802 "apiVersion" => Ok(__FieldTag::__api_version),
1803 "api_version" => Ok(__FieldTag::__api_version),
1804 "errorMessage" => Ok(__FieldTag::__error_message),
1805 "error_message" => Ok(__FieldTag::__error_message),
1806 _ => Ok(__FieldTag::Unknown(value.to_string())),
1807 }
1808 }
1809 }
1810 deserializer.deserialize_identifier(Visitor)
1811 }
1812 }
1813 struct Visitor;
1814 impl<'de> serde::de::Visitor<'de> for Visitor {
1815 type Value = OperationMetadata;
1816 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1817 formatter.write_str("struct OperationMetadata")
1818 }
1819 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1820 where
1821 A: serde::de::MapAccess<'de>,
1822 {
1823 #[allow(unused_imports)]
1824 use serde::de::Error;
1825 use std::option::Option::Some;
1826 let mut fields = std::collections::HashSet::new();
1827 let mut result = Self::Value::new();
1828 while let Some(tag) = map.next_key::<__FieldTag>()? {
1829 #[allow(clippy::match_single_binding)]
1830 match tag {
1831 __FieldTag::__create_time => {
1832 if !fields.insert(__FieldTag::__create_time) {
1833 return std::result::Result::Err(A::Error::duplicate_field(
1834 "multiple values for create_time",
1835 ));
1836 }
1837 result.create_time =
1838 map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1839 }
1840 __FieldTag::__end_time => {
1841 if !fields.insert(__FieldTag::__end_time) {
1842 return std::result::Result::Err(A::Error::duplicate_field(
1843 "multiple values for end_time",
1844 ));
1845 }
1846 result.end_time =
1847 map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1848 }
1849 __FieldTag::__target => {
1850 if !fields.insert(__FieldTag::__target) {
1851 return std::result::Result::Err(A::Error::duplicate_field(
1852 "multiple values for target",
1853 ));
1854 }
1855 result.target = map
1856 .next_value::<std::option::Option<std::string::String>>()?
1857 .unwrap_or_default();
1858 }
1859 __FieldTag::__verb => {
1860 if !fields.insert(__FieldTag::__verb) {
1861 return std::result::Result::Err(A::Error::duplicate_field(
1862 "multiple values for verb",
1863 ));
1864 }
1865 result.verb = map
1866 .next_value::<std::option::Option<std::string::String>>()?
1867 .unwrap_or_default();
1868 }
1869 __FieldTag::__status_message => {
1870 if !fields.insert(__FieldTag::__status_message) {
1871 return std::result::Result::Err(A::Error::duplicate_field(
1872 "multiple values for status_message",
1873 ));
1874 }
1875 result.status_message = map
1876 .next_value::<std::option::Option<std::string::String>>()?
1877 .unwrap_or_default();
1878 }
1879 __FieldTag::__requested_cancellation => {
1880 if !fields.insert(__FieldTag::__requested_cancellation) {
1881 return std::result::Result::Err(A::Error::duplicate_field(
1882 "multiple values for requested_cancellation",
1883 ));
1884 }
1885 result.requested_cancellation = map
1886 .next_value::<std::option::Option<bool>>()?
1887 .unwrap_or_default();
1888 }
1889 __FieldTag::__api_version => {
1890 if !fields.insert(__FieldTag::__api_version) {
1891 return std::result::Result::Err(A::Error::duplicate_field(
1892 "multiple values for api_version",
1893 ));
1894 }
1895 result.api_version = map
1896 .next_value::<std::option::Option<std::string::String>>()?
1897 .unwrap_or_default();
1898 }
1899 __FieldTag::__error_message => {
1900 if !fields.insert(__FieldTag::__error_message) {
1901 return std::result::Result::Err(A::Error::duplicate_field(
1902 "multiple values for error_message",
1903 ));
1904 }
1905 result.error_message = map
1906 .next_value::<std::option::Option<std::string::String>>()?
1907 .unwrap_or_default();
1908 }
1909 __FieldTag::Unknown(key) => {
1910 let value = map.next_value::<serde_json::Value>()?;
1911 result._unknown_fields.insert(key, value);
1912 }
1913 }
1914 }
1915 std::result::Result::Ok(result)
1916 }
1917 }
1918 deserializer.deserialize_any(Visitor)
1919 }
1920}
1921
1922#[doc(hidden)]
1923impl serde::ser::Serialize for OperationMetadata {
1924 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1925 where
1926 S: serde::ser::Serializer,
1927 {
1928 use serde::ser::SerializeMap;
1929 #[allow(unused_imports)]
1930 use std::option::Option::Some;
1931 let mut state = serializer.serialize_map(std::option::Option::None)?;
1932 if self.create_time.is_some() {
1933 state.serialize_entry("createTime", &self.create_time)?;
1934 }
1935 if self.end_time.is_some() {
1936 state.serialize_entry("endTime", &self.end_time)?;
1937 }
1938 if !self.target.is_empty() {
1939 state.serialize_entry("target", &self.target)?;
1940 }
1941 if !self.verb.is_empty() {
1942 state.serialize_entry("verb", &self.verb)?;
1943 }
1944 if !self.status_message.is_empty() {
1945 state.serialize_entry("statusMessage", &self.status_message)?;
1946 }
1947 if !wkt::internal::is_default(&self.requested_cancellation) {
1948 state.serialize_entry("requestedCancellation", &self.requested_cancellation)?;
1949 }
1950 if !self.api_version.is_empty() {
1951 state.serialize_entry("apiVersion", &self.api_version)?;
1952 }
1953 if !self.error_message.is_empty() {
1954 state.serialize_entry("errorMessage", &self.error_message)?;
1955 }
1956 if !self._unknown_fields.is_empty() {
1957 for (key, value) in self._unknown_fields.iter() {
1958 state.serialize_entry(key, &value)?;
1959 }
1960 }
1961 state.end()
1962 }
1963}
1964
1965impl std::fmt::Debug for OperationMetadata {
1966 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1967 let mut debug_struct = f.debug_struct("OperationMetadata");
1968 debug_struct.field("create_time", &self.create_time);
1969 debug_struct.field("end_time", &self.end_time);
1970 debug_struct.field("target", &self.target);
1971 debug_struct.field("verb", &self.verb);
1972 debug_struct.field("status_message", &self.status_message);
1973 debug_struct.field("requested_cancellation", &self.requested_cancellation);
1974 debug_struct.field("api_version", &self.api_version);
1975 debug_struct.field("error_message", &self.error_message);
1976 if !self._unknown_fields.is_empty() {
1977 debug_struct.field("_unknown_fields", &self._unknown_fields);
1978 }
1979 debug_struct.finish()
1980 }
1981}
1982
1983#[derive(Clone, Default, PartialEq)]
1986#[non_exhaustive]
1987pub struct Posture {
1988 pub name: std::string::String,
1991
1992 pub state: crate::model::posture::State,
1994
1995 pub revision_id: std::string::String,
1999
2000 pub create_time: std::option::Option<wkt::Timestamp>,
2002
2003 pub update_time: std::option::Option<wkt::Timestamp>,
2005
2006 pub description: std::string::String,
2008
2009 pub policy_sets: std::vec::Vec<crate::model::PolicySet>,
2011
2012 pub etag: std::string::String,
2023
2024 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
2028
2029 pub reconciling: bool,
2032
2033 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2034}
2035
2036impl Posture {
2037 pub fn new() -> Self {
2038 std::default::Default::default()
2039 }
2040
2041 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2043 self.name = v.into();
2044 self
2045 }
2046
2047 pub fn set_state<T: std::convert::Into<crate::model::posture::State>>(mut self, v: T) -> Self {
2049 self.state = v.into();
2050 self
2051 }
2052
2053 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2055 self.revision_id = v.into();
2056 self
2057 }
2058
2059 pub fn set_create_time<T>(mut self, v: T) -> Self
2061 where
2062 T: std::convert::Into<wkt::Timestamp>,
2063 {
2064 self.create_time = std::option::Option::Some(v.into());
2065 self
2066 }
2067
2068 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2070 where
2071 T: std::convert::Into<wkt::Timestamp>,
2072 {
2073 self.create_time = v.map(|x| x.into());
2074 self
2075 }
2076
2077 pub fn set_update_time<T>(mut self, v: T) -> Self
2079 where
2080 T: std::convert::Into<wkt::Timestamp>,
2081 {
2082 self.update_time = std::option::Option::Some(v.into());
2083 self
2084 }
2085
2086 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2088 where
2089 T: std::convert::Into<wkt::Timestamp>,
2090 {
2091 self.update_time = v.map(|x| x.into());
2092 self
2093 }
2094
2095 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2097 self.description = v.into();
2098 self
2099 }
2100
2101 pub fn set_policy_sets<T, V>(mut self, v: T) -> Self
2103 where
2104 T: std::iter::IntoIterator<Item = V>,
2105 V: std::convert::Into<crate::model::PolicySet>,
2106 {
2107 use std::iter::Iterator;
2108 self.policy_sets = v.into_iter().map(|i| i.into()).collect();
2109 self
2110 }
2111
2112 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2114 self.etag = v.into();
2115 self
2116 }
2117
2118 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
2120 where
2121 T: std::iter::IntoIterator<Item = (K, V)>,
2122 K: std::convert::Into<std::string::String>,
2123 V: std::convert::Into<std::string::String>,
2124 {
2125 use std::iter::Iterator;
2126 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2127 self
2128 }
2129
2130 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2132 self.reconciling = v.into();
2133 self
2134 }
2135}
2136
2137impl wkt::message::Message for Posture {
2138 fn typename() -> &'static str {
2139 "type.googleapis.com/google.cloud.securityposture.v1.Posture"
2140 }
2141}
2142
2143#[doc(hidden)]
2144impl<'de> serde::de::Deserialize<'de> for Posture {
2145 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2146 where
2147 D: serde::Deserializer<'de>,
2148 {
2149 #[allow(non_camel_case_types)]
2150 #[doc(hidden)]
2151 #[derive(PartialEq, Eq, Hash)]
2152 enum __FieldTag {
2153 __name,
2154 __state,
2155 __revision_id,
2156 __create_time,
2157 __update_time,
2158 __description,
2159 __policy_sets,
2160 __etag,
2161 __annotations,
2162 __reconciling,
2163 Unknown(std::string::String),
2164 }
2165 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2166 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2167 where
2168 D: serde::Deserializer<'de>,
2169 {
2170 struct Visitor;
2171 impl<'de> serde::de::Visitor<'de> for Visitor {
2172 type Value = __FieldTag;
2173 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2174 formatter.write_str("a field name for Posture")
2175 }
2176 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2177 where
2178 E: serde::de::Error,
2179 {
2180 use std::result::Result::Ok;
2181 use std::string::ToString;
2182 match value {
2183 "name" => Ok(__FieldTag::__name),
2184 "state" => Ok(__FieldTag::__state),
2185 "revisionId" => Ok(__FieldTag::__revision_id),
2186 "revision_id" => Ok(__FieldTag::__revision_id),
2187 "createTime" => Ok(__FieldTag::__create_time),
2188 "create_time" => Ok(__FieldTag::__create_time),
2189 "updateTime" => Ok(__FieldTag::__update_time),
2190 "update_time" => Ok(__FieldTag::__update_time),
2191 "description" => Ok(__FieldTag::__description),
2192 "policySets" => Ok(__FieldTag::__policy_sets),
2193 "policy_sets" => Ok(__FieldTag::__policy_sets),
2194 "etag" => Ok(__FieldTag::__etag),
2195 "annotations" => Ok(__FieldTag::__annotations),
2196 "reconciling" => Ok(__FieldTag::__reconciling),
2197 _ => Ok(__FieldTag::Unknown(value.to_string())),
2198 }
2199 }
2200 }
2201 deserializer.deserialize_identifier(Visitor)
2202 }
2203 }
2204 struct Visitor;
2205 impl<'de> serde::de::Visitor<'de> for Visitor {
2206 type Value = Posture;
2207 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2208 formatter.write_str("struct Posture")
2209 }
2210 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2211 where
2212 A: serde::de::MapAccess<'de>,
2213 {
2214 #[allow(unused_imports)]
2215 use serde::de::Error;
2216 use std::option::Option::Some;
2217 let mut fields = std::collections::HashSet::new();
2218 let mut result = Self::Value::new();
2219 while let Some(tag) = map.next_key::<__FieldTag>()? {
2220 #[allow(clippy::match_single_binding)]
2221 match tag {
2222 __FieldTag::__name => {
2223 if !fields.insert(__FieldTag::__name) {
2224 return std::result::Result::Err(A::Error::duplicate_field(
2225 "multiple values for name",
2226 ));
2227 }
2228 result.name = map
2229 .next_value::<std::option::Option<std::string::String>>()?
2230 .unwrap_or_default();
2231 }
2232 __FieldTag::__state => {
2233 if !fields.insert(__FieldTag::__state) {
2234 return std::result::Result::Err(A::Error::duplicate_field(
2235 "multiple values for state",
2236 ));
2237 }
2238 result.state = map
2239 .next_value::<std::option::Option<crate::model::posture::State>>()?
2240 .unwrap_or_default();
2241 }
2242 __FieldTag::__revision_id => {
2243 if !fields.insert(__FieldTag::__revision_id) {
2244 return std::result::Result::Err(A::Error::duplicate_field(
2245 "multiple values for revision_id",
2246 ));
2247 }
2248 result.revision_id = map
2249 .next_value::<std::option::Option<std::string::String>>()?
2250 .unwrap_or_default();
2251 }
2252 __FieldTag::__create_time => {
2253 if !fields.insert(__FieldTag::__create_time) {
2254 return std::result::Result::Err(A::Error::duplicate_field(
2255 "multiple values for create_time",
2256 ));
2257 }
2258 result.create_time =
2259 map.next_value::<std::option::Option<wkt::Timestamp>>()?;
2260 }
2261 __FieldTag::__update_time => {
2262 if !fields.insert(__FieldTag::__update_time) {
2263 return std::result::Result::Err(A::Error::duplicate_field(
2264 "multiple values for update_time",
2265 ));
2266 }
2267 result.update_time =
2268 map.next_value::<std::option::Option<wkt::Timestamp>>()?;
2269 }
2270 __FieldTag::__description => {
2271 if !fields.insert(__FieldTag::__description) {
2272 return std::result::Result::Err(A::Error::duplicate_field(
2273 "multiple values for description",
2274 ));
2275 }
2276 result.description = map
2277 .next_value::<std::option::Option<std::string::String>>()?
2278 .unwrap_or_default();
2279 }
2280 __FieldTag::__policy_sets => {
2281 if !fields.insert(__FieldTag::__policy_sets) {
2282 return std::result::Result::Err(A::Error::duplicate_field(
2283 "multiple values for policy_sets",
2284 ));
2285 }
2286 result.policy_sets = map.next_value::<std::option::Option<std::vec::Vec<crate::model::PolicySet>>>()?.unwrap_or_default();
2287 }
2288 __FieldTag::__etag => {
2289 if !fields.insert(__FieldTag::__etag) {
2290 return std::result::Result::Err(A::Error::duplicate_field(
2291 "multiple values for etag",
2292 ));
2293 }
2294 result.etag = map
2295 .next_value::<std::option::Option<std::string::String>>()?
2296 .unwrap_or_default();
2297 }
2298 __FieldTag::__annotations => {
2299 if !fields.insert(__FieldTag::__annotations) {
2300 return std::result::Result::Err(A::Error::duplicate_field(
2301 "multiple values for annotations",
2302 ));
2303 }
2304 result.annotations = map
2305 .next_value::<std::option::Option<
2306 std::collections::HashMap<
2307 std::string::String,
2308 std::string::String,
2309 >,
2310 >>()?
2311 .unwrap_or_default();
2312 }
2313 __FieldTag::__reconciling => {
2314 if !fields.insert(__FieldTag::__reconciling) {
2315 return std::result::Result::Err(A::Error::duplicate_field(
2316 "multiple values for reconciling",
2317 ));
2318 }
2319 result.reconciling = map
2320 .next_value::<std::option::Option<bool>>()?
2321 .unwrap_or_default();
2322 }
2323 __FieldTag::Unknown(key) => {
2324 let value = map.next_value::<serde_json::Value>()?;
2325 result._unknown_fields.insert(key, value);
2326 }
2327 }
2328 }
2329 std::result::Result::Ok(result)
2330 }
2331 }
2332 deserializer.deserialize_any(Visitor)
2333 }
2334}
2335
2336#[doc(hidden)]
2337impl serde::ser::Serialize for Posture {
2338 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2339 where
2340 S: serde::ser::Serializer,
2341 {
2342 use serde::ser::SerializeMap;
2343 #[allow(unused_imports)]
2344 use std::option::Option::Some;
2345 let mut state = serializer.serialize_map(std::option::Option::None)?;
2346 if !self.name.is_empty() {
2347 state.serialize_entry("name", &self.name)?;
2348 }
2349 if !wkt::internal::is_default(&self.state) {
2350 state.serialize_entry("state", &self.state)?;
2351 }
2352 if !self.revision_id.is_empty() {
2353 state.serialize_entry("revisionId", &self.revision_id)?;
2354 }
2355 if self.create_time.is_some() {
2356 state.serialize_entry("createTime", &self.create_time)?;
2357 }
2358 if self.update_time.is_some() {
2359 state.serialize_entry("updateTime", &self.update_time)?;
2360 }
2361 if !self.description.is_empty() {
2362 state.serialize_entry("description", &self.description)?;
2363 }
2364 if !self.policy_sets.is_empty() {
2365 state.serialize_entry("policySets", &self.policy_sets)?;
2366 }
2367 if !self.etag.is_empty() {
2368 state.serialize_entry("etag", &self.etag)?;
2369 }
2370 if !self.annotations.is_empty() {
2371 state.serialize_entry("annotations", &self.annotations)?;
2372 }
2373 if !wkt::internal::is_default(&self.reconciling) {
2374 state.serialize_entry("reconciling", &self.reconciling)?;
2375 }
2376 if !self._unknown_fields.is_empty() {
2377 for (key, value) in self._unknown_fields.iter() {
2378 state.serialize_entry(key, &value)?;
2379 }
2380 }
2381 state.end()
2382 }
2383}
2384
2385impl std::fmt::Debug for Posture {
2386 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2387 let mut debug_struct = f.debug_struct("Posture");
2388 debug_struct.field("name", &self.name);
2389 debug_struct.field("state", &self.state);
2390 debug_struct.field("revision_id", &self.revision_id);
2391 debug_struct.field("create_time", &self.create_time);
2392 debug_struct.field("update_time", &self.update_time);
2393 debug_struct.field("description", &self.description);
2394 debug_struct.field("policy_sets", &self.policy_sets);
2395 debug_struct.field("etag", &self.etag);
2396 debug_struct.field("annotations", &self.annotations);
2397 debug_struct.field("reconciling", &self.reconciling);
2398 if !self._unknown_fields.is_empty() {
2399 debug_struct.field("_unknown_fields", &self._unknown_fields);
2400 }
2401 debug_struct.finish()
2402 }
2403}
2404
2405pub mod posture {
2407 #[allow(unused_imports)]
2408 use super::*;
2409
2410 #[derive(Clone, Debug, PartialEq)]
2426 #[non_exhaustive]
2427 pub enum State {
2428 Unspecified,
2430 Deprecated,
2432 Draft,
2434 Active,
2436 UnknownValue(state::UnknownValue),
2441 }
2442
2443 #[doc(hidden)]
2444 pub mod state {
2445 #[allow(unused_imports)]
2446 use super::*;
2447 #[derive(Clone, Debug, PartialEq)]
2448 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2449 }
2450
2451 impl State {
2452 pub fn value(&self) -> std::option::Option<i32> {
2457 match self {
2458 Self::Unspecified => std::option::Option::Some(0),
2459 Self::Deprecated => std::option::Option::Some(1),
2460 Self::Draft => std::option::Option::Some(2),
2461 Self::Active => std::option::Option::Some(3),
2462 Self::UnknownValue(u) => u.0.value(),
2463 }
2464 }
2465
2466 pub fn name(&self) -> std::option::Option<&str> {
2471 match self {
2472 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2473 Self::Deprecated => std::option::Option::Some("DEPRECATED"),
2474 Self::Draft => std::option::Option::Some("DRAFT"),
2475 Self::Active => std::option::Option::Some("ACTIVE"),
2476 Self::UnknownValue(u) => u.0.name(),
2477 }
2478 }
2479 }
2480
2481 impl std::default::Default for State {
2482 fn default() -> Self {
2483 use std::convert::From;
2484 Self::from(0)
2485 }
2486 }
2487
2488 impl std::fmt::Display for State {
2489 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2490 wkt::internal::display_enum(f, self.name(), self.value())
2491 }
2492 }
2493
2494 impl std::convert::From<i32> for State {
2495 fn from(value: i32) -> Self {
2496 match value {
2497 0 => Self::Unspecified,
2498 1 => Self::Deprecated,
2499 2 => Self::Draft,
2500 3 => Self::Active,
2501 _ => Self::UnknownValue(state::UnknownValue(
2502 wkt::internal::UnknownEnumValue::Integer(value),
2503 )),
2504 }
2505 }
2506 }
2507
2508 impl std::convert::From<&str> for State {
2509 fn from(value: &str) -> Self {
2510 use std::string::ToString;
2511 match value {
2512 "STATE_UNSPECIFIED" => Self::Unspecified,
2513 "DEPRECATED" => Self::Deprecated,
2514 "DRAFT" => Self::Draft,
2515 "ACTIVE" => Self::Active,
2516 _ => Self::UnknownValue(state::UnknownValue(
2517 wkt::internal::UnknownEnumValue::String(value.to_string()),
2518 )),
2519 }
2520 }
2521 }
2522
2523 impl serde::ser::Serialize for State {
2524 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2525 where
2526 S: serde::Serializer,
2527 {
2528 match self {
2529 Self::Unspecified => serializer.serialize_i32(0),
2530 Self::Deprecated => serializer.serialize_i32(1),
2531 Self::Draft => serializer.serialize_i32(2),
2532 Self::Active => serializer.serialize_i32(3),
2533 Self::UnknownValue(u) => u.0.serialize(serializer),
2534 }
2535 }
2536 }
2537
2538 impl<'de> serde::de::Deserialize<'de> for State {
2539 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2540 where
2541 D: serde::Deserializer<'de>,
2542 {
2543 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2544 ".google.cloud.securityposture.v1.Posture.State",
2545 ))
2546 }
2547 }
2548}
2549
2550#[derive(Clone, Default, PartialEq)]
2552#[non_exhaustive]
2553pub struct PolicySet {
2554 pub policy_set_id: std::string::String,
2556
2557 pub description: std::string::String,
2559
2560 pub policies: std::vec::Vec<crate::model::Policy>,
2562
2563 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2564}
2565
2566impl PolicySet {
2567 pub fn new() -> Self {
2568 std::default::Default::default()
2569 }
2570
2571 pub fn set_policy_set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2573 self.policy_set_id = v.into();
2574 self
2575 }
2576
2577 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2579 self.description = v.into();
2580 self
2581 }
2582
2583 pub fn set_policies<T, V>(mut self, v: T) -> Self
2585 where
2586 T: std::iter::IntoIterator<Item = V>,
2587 V: std::convert::Into<crate::model::Policy>,
2588 {
2589 use std::iter::Iterator;
2590 self.policies = v.into_iter().map(|i| i.into()).collect();
2591 self
2592 }
2593}
2594
2595impl wkt::message::Message for PolicySet {
2596 fn typename() -> &'static str {
2597 "type.googleapis.com/google.cloud.securityposture.v1.PolicySet"
2598 }
2599}
2600
2601#[doc(hidden)]
2602impl<'de> serde::de::Deserialize<'de> for PolicySet {
2603 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2604 where
2605 D: serde::Deserializer<'de>,
2606 {
2607 #[allow(non_camel_case_types)]
2608 #[doc(hidden)]
2609 #[derive(PartialEq, Eq, Hash)]
2610 enum __FieldTag {
2611 __policy_set_id,
2612 __description,
2613 __policies,
2614 Unknown(std::string::String),
2615 }
2616 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2617 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2618 where
2619 D: serde::Deserializer<'de>,
2620 {
2621 struct Visitor;
2622 impl<'de> serde::de::Visitor<'de> for Visitor {
2623 type Value = __FieldTag;
2624 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2625 formatter.write_str("a field name for PolicySet")
2626 }
2627 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2628 where
2629 E: serde::de::Error,
2630 {
2631 use std::result::Result::Ok;
2632 use std::string::ToString;
2633 match value {
2634 "policySetId" => Ok(__FieldTag::__policy_set_id),
2635 "policy_set_id" => Ok(__FieldTag::__policy_set_id),
2636 "description" => Ok(__FieldTag::__description),
2637 "policies" => Ok(__FieldTag::__policies),
2638 _ => Ok(__FieldTag::Unknown(value.to_string())),
2639 }
2640 }
2641 }
2642 deserializer.deserialize_identifier(Visitor)
2643 }
2644 }
2645 struct Visitor;
2646 impl<'de> serde::de::Visitor<'de> for Visitor {
2647 type Value = PolicySet;
2648 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2649 formatter.write_str("struct PolicySet")
2650 }
2651 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2652 where
2653 A: serde::de::MapAccess<'de>,
2654 {
2655 #[allow(unused_imports)]
2656 use serde::de::Error;
2657 use std::option::Option::Some;
2658 let mut fields = std::collections::HashSet::new();
2659 let mut result = Self::Value::new();
2660 while let Some(tag) = map.next_key::<__FieldTag>()? {
2661 #[allow(clippy::match_single_binding)]
2662 match tag {
2663 __FieldTag::__policy_set_id => {
2664 if !fields.insert(__FieldTag::__policy_set_id) {
2665 return std::result::Result::Err(A::Error::duplicate_field(
2666 "multiple values for policy_set_id",
2667 ));
2668 }
2669 result.policy_set_id = map
2670 .next_value::<std::option::Option<std::string::String>>()?
2671 .unwrap_or_default();
2672 }
2673 __FieldTag::__description => {
2674 if !fields.insert(__FieldTag::__description) {
2675 return std::result::Result::Err(A::Error::duplicate_field(
2676 "multiple values for description",
2677 ));
2678 }
2679 result.description = map
2680 .next_value::<std::option::Option<std::string::String>>()?
2681 .unwrap_or_default();
2682 }
2683 __FieldTag::__policies => {
2684 if !fields.insert(__FieldTag::__policies) {
2685 return std::result::Result::Err(A::Error::duplicate_field(
2686 "multiple values for policies",
2687 ));
2688 }
2689 result.policies = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Policy>>>()?.unwrap_or_default();
2690 }
2691 __FieldTag::Unknown(key) => {
2692 let value = map.next_value::<serde_json::Value>()?;
2693 result._unknown_fields.insert(key, value);
2694 }
2695 }
2696 }
2697 std::result::Result::Ok(result)
2698 }
2699 }
2700 deserializer.deserialize_any(Visitor)
2701 }
2702}
2703
2704#[doc(hidden)]
2705impl serde::ser::Serialize for PolicySet {
2706 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2707 where
2708 S: serde::ser::Serializer,
2709 {
2710 use serde::ser::SerializeMap;
2711 #[allow(unused_imports)]
2712 use std::option::Option::Some;
2713 let mut state = serializer.serialize_map(std::option::Option::None)?;
2714 if !self.policy_set_id.is_empty() {
2715 state.serialize_entry("policySetId", &self.policy_set_id)?;
2716 }
2717 if !self.description.is_empty() {
2718 state.serialize_entry("description", &self.description)?;
2719 }
2720 if !self.policies.is_empty() {
2721 state.serialize_entry("policies", &self.policies)?;
2722 }
2723 if !self._unknown_fields.is_empty() {
2724 for (key, value) in self._unknown_fields.iter() {
2725 state.serialize_entry(key, &value)?;
2726 }
2727 }
2728 state.end()
2729 }
2730}
2731
2732impl std::fmt::Debug for PolicySet {
2733 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2734 let mut debug_struct = f.debug_struct("PolicySet");
2735 debug_struct.field("policy_set_id", &self.policy_set_id);
2736 debug_struct.field("description", &self.description);
2737 debug_struct.field("policies", &self.policies);
2738 if !self._unknown_fields.is_empty() {
2739 debug_struct.field("_unknown_fields", &self._unknown_fields);
2740 }
2741 debug_struct.finish()
2742 }
2743}
2744
2745#[derive(Clone, Default, PartialEq)]
2747#[non_exhaustive]
2748pub struct Policy {
2749 pub policy_id: std::string::String,
2752
2753 pub compliance_standards: std::vec::Vec<crate::model::policy::ComplianceStandard>,
2755
2756 pub constraint: std::option::Option<crate::model::Constraint>,
2758
2759 pub description: std::string::String,
2761
2762 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2763}
2764
2765impl Policy {
2766 pub fn new() -> Self {
2767 std::default::Default::default()
2768 }
2769
2770 pub fn set_policy_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2772 self.policy_id = v.into();
2773 self
2774 }
2775
2776 pub fn set_compliance_standards<T, V>(mut self, v: T) -> Self
2778 where
2779 T: std::iter::IntoIterator<Item = V>,
2780 V: std::convert::Into<crate::model::policy::ComplianceStandard>,
2781 {
2782 use std::iter::Iterator;
2783 self.compliance_standards = v.into_iter().map(|i| i.into()).collect();
2784 self
2785 }
2786
2787 pub fn set_constraint<T>(mut self, v: T) -> Self
2789 where
2790 T: std::convert::Into<crate::model::Constraint>,
2791 {
2792 self.constraint = std::option::Option::Some(v.into());
2793 self
2794 }
2795
2796 pub fn set_or_clear_constraint<T>(mut self, v: std::option::Option<T>) -> Self
2798 where
2799 T: std::convert::Into<crate::model::Constraint>,
2800 {
2801 self.constraint = v.map(|x| x.into());
2802 self
2803 }
2804
2805 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2807 self.description = v.into();
2808 self
2809 }
2810}
2811
2812impl wkt::message::Message for Policy {
2813 fn typename() -> &'static str {
2814 "type.googleapis.com/google.cloud.securityposture.v1.Policy"
2815 }
2816}
2817
2818#[doc(hidden)]
2819impl<'de> serde::de::Deserialize<'de> for Policy {
2820 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2821 where
2822 D: serde::Deserializer<'de>,
2823 {
2824 #[allow(non_camel_case_types)]
2825 #[doc(hidden)]
2826 #[derive(PartialEq, Eq, Hash)]
2827 enum __FieldTag {
2828 __policy_id,
2829 __compliance_standards,
2830 __constraint,
2831 __description,
2832 Unknown(std::string::String),
2833 }
2834 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2835 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2836 where
2837 D: serde::Deserializer<'de>,
2838 {
2839 struct Visitor;
2840 impl<'de> serde::de::Visitor<'de> for Visitor {
2841 type Value = __FieldTag;
2842 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2843 formatter.write_str("a field name for Policy")
2844 }
2845 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2846 where
2847 E: serde::de::Error,
2848 {
2849 use std::result::Result::Ok;
2850 use std::string::ToString;
2851 match value {
2852 "policyId" => Ok(__FieldTag::__policy_id),
2853 "policy_id" => Ok(__FieldTag::__policy_id),
2854 "complianceStandards" => Ok(__FieldTag::__compliance_standards),
2855 "compliance_standards" => Ok(__FieldTag::__compliance_standards),
2856 "constraint" => Ok(__FieldTag::__constraint),
2857 "description" => Ok(__FieldTag::__description),
2858 _ => Ok(__FieldTag::Unknown(value.to_string())),
2859 }
2860 }
2861 }
2862 deserializer.deserialize_identifier(Visitor)
2863 }
2864 }
2865 struct Visitor;
2866 impl<'de> serde::de::Visitor<'de> for Visitor {
2867 type Value = Policy;
2868 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2869 formatter.write_str("struct Policy")
2870 }
2871 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2872 where
2873 A: serde::de::MapAccess<'de>,
2874 {
2875 #[allow(unused_imports)]
2876 use serde::de::Error;
2877 use std::option::Option::Some;
2878 let mut fields = std::collections::HashSet::new();
2879 let mut result = Self::Value::new();
2880 while let Some(tag) = map.next_key::<__FieldTag>()? {
2881 #[allow(clippy::match_single_binding)]
2882 match tag {
2883 __FieldTag::__policy_id => {
2884 if !fields.insert(__FieldTag::__policy_id) {
2885 return std::result::Result::Err(A::Error::duplicate_field(
2886 "multiple values for policy_id",
2887 ));
2888 }
2889 result.policy_id = map
2890 .next_value::<std::option::Option<std::string::String>>()?
2891 .unwrap_or_default();
2892 }
2893 __FieldTag::__compliance_standards => {
2894 if !fields.insert(__FieldTag::__compliance_standards) {
2895 return std::result::Result::Err(A::Error::duplicate_field(
2896 "multiple values for compliance_standards",
2897 ));
2898 }
2899 result.compliance_standards = map
2900 .next_value::<std::option::Option<
2901 std::vec::Vec<crate::model::policy::ComplianceStandard>,
2902 >>()?
2903 .unwrap_or_default();
2904 }
2905 __FieldTag::__constraint => {
2906 if !fields.insert(__FieldTag::__constraint) {
2907 return std::result::Result::Err(A::Error::duplicate_field(
2908 "multiple values for constraint",
2909 ));
2910 }
2911 result.constraint =
2912 map.next_value::<std::option::Option<crate::model::Constraint>>()?;
2913 }
2914 __FieldTag::__description => {
2915 if !fields.insert(__FieldTag::__description) {
2916 return std::result::Result::Err(A::Error::duplicate_field(
2917 "multiple values for description",
2918 ));
2919 }
2920 result.description = map
2921 .next_value::<std::option::Option<std::string::String>>()?
2922 .unwrap_or_default();
2923 }
2924 __FieldTag::Unknown(key) => {
2925 let value = map.next_value::<serde_json::Value>()?;
2926 result._unknown_fields.insert(key, value);
2927 }
2928 }
2929 }
2930 std::result::Result::Ok(result)
2931 }
2932 }
2933 deserializer.deserialize_any(Visitor)
2934 }
2935}
2936
2937#[doc(hidden)]
2938impl serde::ser::Serialize for Policy {
2939 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2940 where
2941 S: serde::ser::Serializer,
2942 {
2943 use serde::ser::SerializeMap;
2944 #[allow(unused_imports)]
2945 use std::option::Option::Some;
2946 let mut state = serializer.serialize_map(std::option::Option::None)?;
2947 if !self.policy_id.is_empty() {
2948 state.serialize_entry("policyId", &self.policy_id)?;
2949 }
2950 if !self.compliance_standards.is_empty() {
2951 state.serialize_entry("complianceStandards", &self.compliance_standards)?;
2952 }
2953 if self.constraint.is_some() {
2954 state.serialize_entry("constraint", &self.constraint)?;
2955 }
2956 if !self.description.is_empty() {
2957 state.serialize_entry("description", &self.description)?;
2958 }
2959 if !self._unknown_fields.is_empty() {
2960 for (key, value) in self._unknown_fields.iter() {
2961 state.serialize_entry(key, &value)?;
2962 }
2963 }
2964 state.end()
2965 }
2966}
2967
2968impl std::fmt::Debug for Policy {
2969 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2970 let mut debug_struct = f.debug_struct("Policy");
2971 debug_struct.field("policy_id", &self.policy_id);
2972 debug_struct.field("compliance_standards", &self.compliance_standards);
2973 debug_struct.field("constraint", &self.constraint);
2974 debug_struct.field("description", &self.description);
2975 if !self._unknown_fields.is_empty() {
2976 debug_struct.field("_unknown_fields", &self._unknown_fields);
2977 }
2978 debug_struct.finish()
2979 }
2980}
2981
2982pub mod policy {
2984 #[allow(unused_imports)]
2985 use super::*;
2986
2987 #[derive(Clone, Default, PartialEq)]
2989 #[non_exhaustive]
2990 pub struct ComplianceStandard {
2991 pub standard: std::string::String,
2993
2994 pub control: std::string::String,
2996
2997 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2998 }
2999
3000 impl ComplianceStandard {
3001 pub fn new() -> Self {
3002 std::default::Default::default()
3003 }
3004
3005 pub fn set_standard<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3007 self.standard = v.into();
3008 self
3009 }
3010
3011 pub fn set_control<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3013 self.control = v.into();
3014 self
3015 }
3016 }
3017
3018 impl wkt::message::Message for ComplianceStandard {
3019 fn typename() -> &'static str {
3020 "type.googleapis.com/google.cloud.securityposture.v1.Policy.ComplianceStandard"
3021 }
3022 }
3023
3024 #[doc(hidden)]
3025 impl<'de> serde::de::Deserialize<'de> for ComplianceStandard {
3026 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3027 where
3028 D: serde::Deserializer<'de>,
3029 {
3030 #[allow(non_camel_case_types)]
3031 #[doc(hidden)]
3032 #[derive(PartialEq, Eq, Hash)]
3033 enum __FieldTag {
3034 __standard,
3035 __control,
3036 Unknown(std::string::String),
3037 }
3038 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3039 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3040 where
3041 D: serde::Deserializer<'de>,
3042 {
3043 struct Visitor;
3044 impl<'de> serde::de::Visitor<'de> for Visitor {
3045 type Value = __FieldTag;
3046 fn expecting(
3047 &self,
3048 formatter: &mut std::fmt::Formatter,
3049 ) -> std::fmt::Result {
3050 formatter.write_str("a field name for ComplianceStandard")
3051 }
3052 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3053 where
3054 E: serde::de::Error,
3055 {
3056 use std::result::Result::Ok;
3057 use std::string::ToString;
3058 match value {
3059 "standard" => Ok(__FieldTag::__standard),
3060 "control" => Ok(__FieldTag::__control),
3061 _ => Ok(__FieldTag::Unknown(value.to_string())),
3062 }
3063 }
3064 }
3065 deserializer.deserialize_identifier(Visitor)
3066 }
3067 }
3068 struct Visitor;
3069 impl<'de> serde::de::Visitor<'de> for Visitor {
3070 type Value = ComplianceStandard;
3071 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3072 formatter.write_str("struct ComplianceStandard")
3073 }
3074 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3075 where
3076 A: serde::de::MapAccess<'de>,
3077 {
3078 #[allow(unused_imports)]
3079 use serde::de::Error;
3080 use std::option::Option::Some;
3081 let mut fields = std::collections::HashSet::new();
3082 let mut result = Self::Value::new();
3083 while let Some(tag) = map.next_key::<__FieldTag>()? {
3084 #[allow(clippy::match_single_binding)]
3085 match tag {
3086 __FieldTag::__standard => {
3087 if !fields.insert(__FieldTag::__standard) {
3088 return std::result::Result::Err(A::Error::duplicate_field(
3089 "multiple values for standard",
3090 ));
3091 }
3092 result.standard = map
3093 .next_value::<std::option::Option<std::string::String>>()?
3094 .unwrap_or_default();
3095 }
3096 __FieldTag::__control => {
3097 if !fields.insert(__FieldTag::__control) {
3098 return std::result::Result::Err(A::Error::duplicate_field(
3099 "multiple values for control",
3100 ));
3101 }
3102 result.control = map
3103 .next_value::<std::option::Option<std::string::String>>()?
3104 .unwrap_or_default();
3105 }
3106 __FieldTag::Unknown(key) => {
3107 let value = map.next_value::<serde_json::Value>()?;
3108 result._unknown_fields.insert(key, value);
3109 }
3110 }
3111 }
3112 std::result::Result::Ok(result)
3113 }
3114 }
3115 deserializer.deserialize_any(Visitor)
3116 }
3117 }
3118
3119 #[doc(hidden)]
3120 impl serde::ser::Serialize for ComplianceStandard {
3121 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3122 where
3123 S: serde::ser::Serializer,
3124 {
3125 use serde::ser::SerializeMap;
3126 #[allow(unused_imports)]
3127 use std::option::Option::Some;
3128 let mut state = serializer.serialize_map(std::option::Option::None)?;
3129 if !self.standard.is_empty() {
3130 state.serialize_entry("standard", &self.standard)?;
3131 }
3132 if !self.control.is_empty() {
3133 state.serialize_entry("control", &self.control)?;
3134 }
3135 if !self._unknown_fields.is_empty() {
3136 for (key, value) in self._unknown_fields.iter() {
3137 state.serialize_entry(key, &value)?;
3138 }
3139 }
3140 state.end()
3141 }
3142 }
3143
3144 impl std::fmt::Debug for ComplianceStandard {
3145 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3146 let mut debug_struct = f.debug_struct("ComplianceStandard");
3147 debug_struct.field("standard", &self.standard);
3148 debug_struct.field("control", &self.control);
3149 if !self._unknown_fields.is_empty() {
3150 debug_struct.field("_unknown_fields", &self._unknown_fields);
3151 }
3152 debug_struct.finish()
3153 }
3154 }
3155}
3156
3157#[derive(Clone, Default, PartialEq)]
3159#[non_exhaustive]
3160pub struct Constraint {
3161 pub implementation: std::option::Option<crate::model::constraint::Implementation>,
3162
3163 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3164}
3165
3166impl Constraint {
3167 pub fn new() -> Self {
3168 std::default::Default::default()
3169 }
3170
3171 pub fn set_implementation<
3176 T: std::convert::Into<std::option::Option<crate::model::constraint::Implementation>>,
3177 >(
3178 mut self,
3179 v: T,
3180 ) -> Self {
3181 self.implementation = v.into();
3182 self
3183 }
3184
3185 pub fn security_health_analytics_module(
3189 &self,
3190 ) -> std::option::Option<&std::boxed::Box<crate::model::SecurityHealthAnalyticsModule>> {
3191 #[allow(unreachable_patterns)]
3192 self.implementation.as_ref().and_then(|v| match v {
3193 crate::model::constraint::Implementation::SecurityHealthAnalyticsModule(v) => {
3194 std::option::Option::Some(v)
3195 }
3196 _ => std::option::Option::None,
3197 })
3198 }
3199
3200 pub fn set_security_health_analytics_module<
3206 T: std::convert::Into<std::boxed::Box<crate::model::SecurityHealthAnalyticsModule>>,
3207 >(
3208 mut self,
3209 v: T,
3210 ) -> Self {
3211 self.implementation = std::option::Option::Some(
3212 crate::model::constraint::Implementation::SecurityHealthAnalyticsModule(v.into()),
3213 );
3214 self
3215 }
3216
3217 pub fn security_health_analytics_custom_module(
3221 &self,
3222 ) -> std::option::Option<&std::boxed::Box<crate::model::SecurityHealthAnalyticsCustomModule>>
3223 {
3224 #[allow(unreachable_patterns)]
3225 self.implementation.as_ref().and_then(|v| match v {
3226 crate::model::constraint::Implementation::SecurityHealthAnalyticsCustomModule(v) => {
3227 std::option::Option::Some(v)
3228 }
3229 _ => std::option::Option::None,
3230 })
3231 }
3232
3233 pub fn set_security_health_analytics_custom_module<
3239 T: std::convert::Into<std::boxed::Box<crate::model::SecurityHealthAnalyticsCustomModule>>,
3240 >(
3241 mut self,
3242 v: T,
3243 ) -> Self {
3244 self.implementation = std::option::Option::Some(
3245 crate::model::constraint::Implementation::SecurityHealthAnalyticsCustomModule(v.into()),
3246 );
3247 self
3248 }
3249
3250 pub fn org_policy_constraint(
3254 &self,
3255 ) -> std::option::Option<&std::boxed::Box<crate::model::OrgPolicyConstraint>> {
3256 #[allow(unreachable_patterns)]
3257 self.implementation.as_ref().and_then(|v| match v {
3258 crate::model::constraint::Implementation::OrgPolicyConstraint(v) => {
3259 std::option::Option::Some(v)
3260 }
3261 _ => std::option::Option::None,
3262 })
3263 }
3264
3265 pub fn set_org_policy_constraint<
3271 T: std::convert::Into<std::boxed::Box<crate::model::OrgPolicyConstraint>>,
3272 >(
3273 mut self,
3274 v: T,
3275 ) -> Self {
3276 self.implementation = std::option::Option::Some(
3277 crate::model::constraint::Implementation::OrgPolicyConstraint(v.into()),
3278 );
3279 self
3280 }
3281
3282 pub fn org_policy_constraint_custom(
3286 &self,
3287 ) -> std::option::Option<&std::boxed::Box<crate::model::OrgPolicyConstraintCustom>> {
3288 #[allow(unreachable_patterns)]
3289 self.implementation.as_ref().and_then(|v| match v {
3290 crate::model::constraint::Implementation::OrgPolicyConstraintCustom(v) => {
3291 std::option::Option::Some(v)
3292 }
3293 _ => std::option::Option::None,
3294 })
3295 }
3296
3297 pub fn set_org_policy_constraint_custom<
3303 T: std::convert::Into<std::boxed::Box<crate::model::OrgPolicyConstraintCustom>>,
3304 >(
3305 mut self,
3306 v: T,
3307 ) -> Self {
3308 self.implementation = std::option::Option::Some(
3309 crate::model::constraint::Implementation::OrgPolicyConstraintCustom(v.into()),
3310 );
3311 self
3312 }
3313}
3314
3315impl wkt::message::Message for Constraint {
3316 fn typename() -> &'static str {
3317 "type.googleapis.com/google.cloud.securityposture.v1.Constraint"
3318 }
3319}
3320
3321#[doc(hidden)]
3322impl<'de> serde::de::Deserialize<'de> for Constraint {
3323 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3324 where
3325 D: serde::Deserializer<'de>,
3326 {
3327 #[allow(non_camel_case_types)]
3328 #[doc(hidden)]
3329 #[derive(PartialEq, Eq, Hash)]
3330 enum __FieldTag {
3331 __security_health_analytics_module,
3332 __security_health_analytics_custom_module,
3333 __org_policy_constraint,
3334 __org_policy_constraint_custom,
3335 Unknown(std::string::String),
3336 }
3337 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3338 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3339 where
3340 D: serde::Deserializer<'de>,
3341 {
3342 struct Visitor;
3343 impl<'de> serde::de::Visitor<'de> for Visitor {
3344 type Value = __FieldTag;
3345 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3346 formatter.write_str("a field name for Constraint")
3347 }
3348 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3349 where
3350 E: serde::de::Error,
3351 {
3352 use std::result::Result::Ok;
3353 use std::string::ToString;
3354 match value {
3355 "securityHealthAnalyticsModule" => {
3356 Ok(__FieldTag::__security_health_analytics_module)
3357 }
3358 "security_health_analytics_module" => {
3359 Ok(__FieldTag::__security_health_analytics_module)
3360 }
3361 "securityHealthAnalyticsCustomModule" => {
3362 Ok(__FieldTag::__security_health_analytics_custom_module)
3363 }
3364 "security_health_analytics_custom_module" => {
3365 Ok(__FieldTag::__security_health_analytics_custom_module)
3366 }
3367 "orgPolicyConstraint" => Ok(__FieldTag::__org_policy_constraint),
3368 "org_policy_constraint" => Ok(__FieldTag::__org_policy_constraint),
3369 "orgPolicyConstraintCustom" => {
3370 Ok(__FieldTag::__org_policy_constraint_custom)
3371 }
3372 "org_policy_constraint_custom" => {
3373 Ok(__FieldTag::__org_policy_constraint_custom)
3374 }
3375 _ => Ok(__FieldTag::Unknown(value.to_string())),
3376 }
3377 }
3378 }
3379 deserializer.deserialize_identifier(Visitor)
3380 }
3381 }
3382 struct Visitor;
3383 impl<'de> serde::de::Visitor<'de> for Visitor {
3384 type Value = Constraint;
3385 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3386 formatter.write_str("struct Constraint")
3387 }
3388 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3389 where
3390 A: serde::de::MapAccess<'de>,
3391 {
3392 #[allow(unused_imports)]
3393 use serde::de::Error;
3394 use std::option::Option::Some;
3395 let mut fields = std::collections::HashSet::new();
3396 let mut result = Self::Value::new();
3397 while let Some(tag) = map.next_key::<__FieldTag>()? {
3398 #[allow(clippy::match_single_binding)]
3399 match tag {
3400 __FieldTag::__security_health_analytics_module => {
3401 if !fields.insert(__FieldTag::__security_health_analytics_module) {
3402 return std::result::Result::Err(A::Error::duplicate_field(
3403 "multiple values for security_health_analytics_module",
3404 ));
3405 }
3406 if result.implementation.is_some() {
3407 return std::result::Result::Err(A::Error::duplicate_field(
3408 "multiple values for `implementation`, a oneof with full ID .google.cloud.securityposture.v1.Constraint.security_health_analytics_module, latest field was securityHealthAnalyticsModule",
3409 ));
3410 }
3411 result.implementation = std::option::Option::Some(
3412 crate::model::constraint::Implementation::SecurityHealthAnalyticsModule(
3413 map.next_value::<std::option::Option<std::boxed::Box<crate::model::SecurityHealthAnalyticsModule>>>()?.unwrap_or_default()
3414 ),
3415 );
3416 }
3417 __FieldTag::__security_health_analytics_custom_module => {
3418 if !fields.insert(__FieldTag::__security_health_analytics_custom_module)
3419 {
3420 return std::result::Result::Err(A::Error::duplicate_field(
3421 "multiple values for security_health_analytics_custom_module",
3422 ));
3423 }
3424 if result.implementation.is_some() {
3425 return std::result::Result::Err(A::Error::duplicate_field(
3426 "multiple values for `implementation`, a oneof with full ID .google.cloud.securityposture.v1.Constraint.security_health_analytics_custom_module, latest field was securityHealthAnalyticsCustomModule",
3427 ));
3428 }
3429 result.implementation = std::option::Option::Some(
3430 crate::model::constraint::Implementation::SecurityHealthAnalyticsCustomModule(
3431 map.next_value::<std::option::Option<std::boxed::Box<crate::model::SecurityHealthAnalyticsCustomModule>>>()?.unwrap_or_default()
3432 ),
3433 );
3434 }
3435 __FieldTag::__org_policy_constraint => {
3436 if !fields.insert(__FieldTag::__org_policy_constraint) {
3437 return std::result::Result::Err(A::Error::duplicate_field(
3438 "multiple values for org_policy_constraint",
3439 ));
3440 }
3441 if result.implementation.is_some() {
3442 return std::result::Result::Err(A::Error::duplicate_field(
3443 "multiple values for `implementation`, a oneof with full ID .google.cloud.securityposture.v1.Constraint.org_policy_constraint, latest field was orgPolicyConstraint",
3444 ));
3445 }
3446 result.implementation = std::option::Option::Some(
3447 crate::model::constraint::Implementation::OrgPolicyConstraint(
3448 map.next_value::<std::option::Option<
3449 std::boxed::Box<crate::model::OrgPolicyConstraint>,
3450 >>()?
3451 .unwrap_or_default(),
3452 ),
3453 );
3454 }
3455 __FieldTag::__org_policy_constraint_custom => {
3456 if !fields.insert(__FieldTag::__org_policy_constraint_custom) {
3457 return std::result::Result::Err(A::Error::duplicate_field(
3458 "multiple values for org_policy_constraint_custom",
3459 ));
3460 }
3461 if result.implementation.is_some() {
3462 return std::result::Result::Err(A::Error::duplicate_field(
3463 "multiple values for `implementation`, a oneof with full ID .google.cloud.securityposture.v1.Constraint.org_policy_constraint_custom, latest field was orgPolicyConstraintCustom",
3464 ));
3465 }
3466 result.implementation = std::option::Option::Some(
3467 crate::model::constraint::Implementation::OrgPolicyConstraintCustom(
3468 map.next_value::<std::option::Option<
3469 std::boxed::Box<crate::model::OrgPolicyConstraintCustom>,
3470 >>()?
3471 .unwrap_or_default(),
3472 ),
3473 );
3474 }
3475 __FieldTag::Unknown(key) => {
3476 let value = map.next_value::<serde_json::Value>()?;
3477 result._unknown_fields.insert(key, value);
3478 }
3479 }
3480 }
3481 std::result::Result::Ok(result)
3482 }
3483 }
3484 deserializer.deserialize_any(Visitor)
3485 }
3486}
3487
3488#[doc(hidden)]
3489impl serde::ser::Serialize for Constraint {
3490 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3491 where
3492 S: serde::ser::Serializer,
3493 {
3494 use serde::ser::SerializeMap;
3495 #[allow(unused_imports)]
3496 use std::option::Option::Some;
3497 let mut state = serializer.serialize_map(std::option::Option::None)?;
3498 if let Some(value) = self.security_health_analytics_module() {
3499 state.serialize_entry("securityHealthAnalyticsModule", value)?;
3500 }
3501 if let Some(value) = self.security_health_analytics_custom_module() {
3502 state.serialize_entry("securityHealthAnalyticsCustomModule", value)?;
3503 }
3504 if let Some(value) = self.org_policy_constraint() {
3505 state.serialize_entry("orgPolicyConstraint", value)?;
3506 }
3507 if let Some(value) = self.org_policy_constraint_custom() {
3508 state.serialize_entry("orgPolicyConstraintCustom", value)?;
3509 }
3510 if !self._unknown_fields.is_empty() {
3511 for (key, value) in self._unknown_fields.iter() {
3512 state.serialize_entry(key, &value)?;
3513 }
3514 }
3515 state.end()
3516 }
3517}
3518
3519impl std::fmt::Debug for Constraint {
3520 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3521 let mut debug_struct = f.debug_struct("Constraint");
3522 debug_struct.field("implementation", &self.implementation);
3523 if !self._unknown_fields.is_empty() {
3524 debug_struct.field("_unknown_fields", &self._unknown_fields);
3525 }
3526 debug_struct.finish()
3527 }
3528}
3529
3530pub mod constraint {
3532 #[allow(unused_imports)]
3533 use super::*;
3534
3535 #[derive(Clone, Debug, PartialEq)]
3536 #[non_exhaustive]
3537 pub enum Implementation {
3538 SecurityHealthAnalyticsModule(std::boxed::Box<crate::model::SecurityHealthAnalyticsModule>),
3540 SecurityHealthAnalyticsCustomModule(
3542 std::boxed::Box<crate::model::SecurityHealthAnalyticsCustomModule>,
3543 ),
3544 OrgPolicyConstraint(std::boxed::Box<crate::model::OrgPolicyConstraint>),
3546 OrgPolicyConstraintCustom(std::boxed::Box<crate::model::OrgPolicyConstraintCustom>),
3548 }
3549}
3550
3551#[derive(Clone, Default, PartialEq)]
3553#[non_exhaustive]
3554pub struct ListPosturesRequest {
3555 pub parent: std::string::String,
3557
3558 pub page_size: i32,
3561
3562 pub page_token: std::string::String,
3564
3565 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3566}
3567
3568impl ListPosturesRequest {
3569 pub fn new() -> Self {
3570 std::default::Default::default()
3571 }
3572
3573 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3575 self.parent = v.into();
3576 self
3577 }
3578
3579 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3581 self.page_size = v.into();
3582 self
3583 }
3584
3585 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3587 self.page_token = v.into();
3588 self
3589 }
3590}
3591
3592impl wkt::message::Message for ListPosturesRequest {
3593 fn typename() -> &'static str {
3594 "type.googleapis.com/google.cloud.securityposture.v1.ListPosturesRequest"
3595 }
3596}
3597
3598#[doc(hidden)]
3599impl<'de> serde::de::Deserialize<'de> for ListPosturesRequest {
3600 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3601 where
3602 D: serde::Deserializer<'de>,
3603 {
3604 #[allow(non_camel_case_types)]
3605 #[doc(hidden)]
3606 #[derive(PartialEq, Eq, Hash)]
3607 enum __FieldTag {
3608 __parent,
3609 __page_size,
3610 __page_token,
3611 Unknown(std::string::String),
3612 }
3613 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3614 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3615 where
3616 D: serde::Deserializer<'de>,
3617 {
3618 struct Visitor;
3619 impl<'de> serde::de::Visitor<'de> for Visitor {
3620 type Value = __FieldTag;
3621 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3622 formatter.write_str("a field name for ListPosturesRequest")
3623 }
3624 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3625 where
3626 E: serde::de::Error,
3627 {
3628 use std::result::Result::Ok;
3629 use std::string::ToString;
3630 match value {
3631 "parent" => Ok(__FieldTag::__parent),
3632 "pageSize" => Ok(__FieldTag::__page_size),
3633 "page_size" => Ok(__FieldTag::__page_size),
3634 "pageToken" => Ok(__FieldTag::__page_token),
3635 "page_token" => Ok(__FieldTag::__page_token),
3636 _ => Ok(__FieldTag::Unknown(value.to_string())),
3637 }
3638 }
3639 }
3640 deserializer.deserialize_identifier(Visitor)
3641 }
3642 }
3643 struct Visitor;
3644 impl<'de> serde::de::Visitor<'de> for Visitor {
3645 type Value = ListPosturesRequest;
3646 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3647 formatter.write_str("struct ListPosturesRequest")
3648 }
3649 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3650 where
3651 A: serde::de::MapAccess<'de>,
3652 {
3653 #[allow(unused_imports)]
3654 use serde::de::Error;
3655 use std::option::Option::Some;
3656 let mut fields = std::collections::HashSet::new();
3657 let mut result = Self::Value::new();
3658 while let Some(tag) = map.next_key::<__FieldTag>()? {
3659 #[allow(clippy::match_single_binding)]
3660 match tag {
3661 __FieldTag::__parent => {
3662 if !fields.insert(__FieldTag::__parent) {
3663 return std::result::Result::Err(A::Error::duplicate_field(
3664 "multiple values for parent",
3665 ));
3666 }
3667 result.parent = map
3668 .next_value::<std::option::Option<std::string::String>>()?
3669 .unwrap_or_default();
3670 }
3671 __FieldTag::__page_size => {
3672 if !fields.insert(__FieldTag::__page_size) {
3673 return std::result::Result::Err(A::Error::duplicate_field(
3674 "multiple values for page_size",
3675 ));
3676 }
3677 struct __With(std::option::Option<i32>);
3678 impl<'de> serde::de::Deserialize<'de> for __With {
3679 fn deserialize<D>(
3680 deserializer: D,
3681 ) -> std::result::Result<Self, D::Error>
3682 where
3683 D: serde::de::Deserializer<'de>,
3684 {
3685 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3686 }
3687 }
3688 result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
3689 }
3690 __FieldTag::__page_token => {
3691 if !fields.insert(__FieldTag::__page_token) {
3692 return std::result::Result::Err(A::Error::duplicate_field(
3693 "multiple values for page_token",
3694 ));
3695 }
3696 result.page_token = map
3697 .next_value::<std::option::Option<std::string::String>>()?
3698 .unwrap_or_default();
3699 }
3700 __FieldTag::Unknown(key) => {
3701 let value = map.next_value::<serde_json::Value>()?;
3702 result._unknown_fields.insert(key, value);
3703 }
3704 }
3705 }
3706 std::result::Result::Ok(result)
3707 }
3708 }
3709 deserializer.deserialize_any(Visitor)
3710 }
3711}
3712
3713#[doc(hidden)]
3714impl serde::ser::Serialize for ListPosturesRequest {
3715 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3716 where
3717 S: serde::ser::Serializer,
3718 {
3719 use serde::ser::SerializeMap;
3720 #[allow(unused_imports)]
3721 use std::option::Option::Some;
3722 let mut state = serializer.serialize_map(std::option::Option::None)?;
3723 if !self.parent.is_empty() {
3724 state.serialize_entry("parent", &self.parent)?;
3725 }
3726 if !wkt::internal::is_default(&self.page_size) {
3727 struct __With<'a>(&'a i32);
3728 impl<'a> serde::ser::Serialize for __With<'a> {
3729 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3730 where
3731 S: serde::ser::Serializer,
3732 {
3733 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3734 }
3735 }
3736 state.serialize_entry("pageSize", &__With(&self.page_size))?;
3737 }
3738 if !self.page_token.is_empty() {
3739 state.serialize_entry("pageToken", &self.page_token)?;
3740 }
3741 if !self._unknown_fields.is_empty() {
3742 for (key, value) in self._unknown_fields.iter() {
3743 state.serialize_entry(key, &value)?;
3744 }
3745 }
3746 state.end()
3747 }
3748}
3749
3750impl std::fmt::Debug for ListPosturesRequest {
3751 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3752 let mut debug_struct = f.debug_struct("ListPosturesRequest");
3753 debug_struct.field("parent", &self.parent);
3754 debug_struct.field("page_size", &self.page_size);
3755 debug_struct.field("page_token", &self.page_token);
3756 if !self._unknown_fields.is_empty() {
3757 debug_struct.field("_unknown_fields", &self._unknown_fields);
3758 }
3759 debug_struct.finish()
3760 }
3761}
3762
3763#[derive(Clone, Default, PartialEq)]
3765#[non_exhaustive]
3766pub struct ListPosturesResponse {
3767 pub postures: std::vec::Vec<crate::model::Posture>,
3769
3770 pub next_page_token: std::string::String,
3772
3773 pub unreachable: std::vec::Vec<std::string::String>,
3775
3776 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3777}
3778
3779impl ListPosturesResponse {
3780 pub fn new() -> Self {
3781 std::default::Default::default()
3782 }
3783
3784 pub fn set_postures<T, V>(mut self, v: T) -> Self
3786 where
3787 T: std::iter::IntoIterator<Item = V>,
3788 V: std::convert::Into<crate::model::Posture>,
3789 {
3790 use std::iter::Iterator;
3791 self.postures = v.into_iter().map(|i| i.into()).collect();
3792 self
3793 }
3794
3795 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3797 self.next_page_token = v.into();
3798 self
3799 }
3800
3801 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
3803 where
3804 T: std::iter::IntoIterator<Item = V>,
3805 V: std::convert::Into<std::string::String>,
3806 {
3807 use std::iter::Iterator;
3808 self.unreachable = v.into_iter().map(|i| i.into()).collect();
3809 self
3810 }
3811}
3812
3813impl wkt::message::Message for ListPosturesResponse {
3814 fn typename() -> &'static str {
3815 "type.googleapis.com/google.cloud.securityposture.v1.ListPosturesResponse"
3816 }
3817}
3818
3819#[doc(hidden)]
3820impl gax::paginator::internal::PageableResponse for ListPosturesResponse {
3821 type PageItem = crate::model::Posture;
3822
3823 fn items(self) -> std::vec::Vec<Self::PageItem> {
3824 self.postures
3825 }
3826
3827 fn next_page_token(&self) -> std::string::String {
3828 use std::clone::Clone;
3829 self.next_page_token.clone()
3830 }
3831}
3832
3833#[doc(hidden)]
3834impl<'de> serde::de::Deserialize<'de> for ListPosturesResponse {
3835 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3836 where
3837 D: serde::Deserializer<'de>,
3838 {
3839 #[allow(non_camel_case_types)]
3840 #[doc(hidden)]
3841 #[derive(PartialEq, Eq, Hash)]
3842 enum __FieldTag {
3843 __postures,
3844 __next_page_token,
3845 __unreachable,
3846 Unknown(std::string::String),
3847 }
3848 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3849 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3850 where
3851 D: serde::Deserializer<'de>,
3852 {
3853 struct Visitor;
3854 impl<'de> serde::de::Visitor<'de> for Visitor {
3855 type Value = __FieldTag;
3856 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3857 formatter.write_str("a field name for ListPosturesResponse")
3858 }
3859 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3860 where
3861 E: serde::de::Error,
3862 {
3863 use std::result::Result::Ok;
3864 use std::string::ToString;
3865 match value {
3866 "postures" => Ok(__FieldTag::__postures),
3867 "nextPageToken" => Ok(__FieldTag::__next_page_token),
3868 "next_page_token" => Ok(__FieldTag::__next_page_token),
3869 "unreachable" => Ok(__FieldTag::__unreachable),
3870 _ => Ok(__FieldTag::Unknown(value.to_string())),
3871 }
3872 }
3873 }
3874 deserializer.deserialize_identifier(Visitor)
3875 }
3876 }
3877 struct Visitor;
3878 impl<'de> serde::de::Visitor<'de> for Visitor {
3879 type Value = ListPosturesResponse;
3880 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3881 formatter.write_str("struct ListPosturesResponse")
3882 }
3883 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3884 where
3885 A: serde::de::MapAccess<'de>,
3886 {
3887 #[allow(unused_imports)]
3888 use serde::de::Error;
3889 use std::option::Option::Some;
3890 let mut fields = std::collections::HashSet::new();
3891 let mut result = Self::Value::new();
3892 while let Some(tag) = map.next_key::<__FieldTag>()? {
3893 #[allow(clippy::match_single_binding)]
3894 match tag {
3895 __FieldTag::__postures => {
3896 if !fields.insert(__FieldTag::__postures) {
3897 return std::result::Result::Err(A::Error::duplicate_field(
3898 "multiple values for postures",
3899 ));
3900 }
3901 result.postures = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Posture>>>()?.unwrap_or_default();
3902 }
3903 __FieldTag::__next_page_token => {
3904 if !fields.insert(__FieldTag::__next_page_token) {
3905 return std::result::Result::Err(A::Error::duplicate_field(
3906 "multiple values for next_page_token",
3907 ));
3908 }
3909 result.next_page_token = map
3910 .next_value::<std::option::Option<std::string::String>>()?
3911 .unwrap_or_default();
3912 }
3913 __FieldTag::__unreachable => {
3914 if !fields.insert(__FieldTag::__unreachable) {
3915 return std::result::Result::Err(A::Error::duplicate_field(
3916 "multiple values for unreachable",
3917 ));
3918 }
3919 result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
3920 }
3921 __FieldTag::Unknown(key) => {
3922 let value = map.next_value::<serde_json::Value>()?;
3923 result._unknown_fields.insert(key, value);
3924 }
3925 }
3926 }
3927 std::result::Result::Ok(result)
3928 }
3929 }
3930 deserializer.deserialize_any(Visitor)
3931 }
3932}
3933
3934#[doc(hidden)]
3935impl serde::ser::Serialize for ListPosturesResponse {
3936 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3937 where
3938 S: serde::ser::Serializer,
3939 {
3940 use serde::ser::SerializeMap;
3941 #[allow(unused_imports)]
3942 use std::option::Option::Some;
3943 let mut state = serializer.serialize_map(std::option::Option::None)?;
3944 if !self.postures.is_empty() {
3945 state.serialize_entry("postures", &self.postures)?;
3946 }
3947 if !self.next_page_token.is_empty() {
3948 state.serialize_entry("nextPageToken", &self.next_page_token)?;
3949 }
3950 if !self.unreachable.is_empty() {
3951 state.serialize_entry("unreachable", &self.unreachable)?;
3952 }
3953 if !self._unknown_fields.is_empty() {
3954 for (key, value) in self._unknown_fields.iter() {
3955 state.serialize_entry(key, &value)?;
3956 }
3957 }
3958 state.end()
3959 }
3960}
3961
3962impl std::fmt::Debug for ListPosturesResponse {
3963 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3964 let mut debug_struct = f.debug_struct("ListPosturesResponse");
3965 debug_struct.field("postures", &self.postures);
3966 debug_struct.field("next_page_token", &self.next_page_token);
3967 debug_struct.field("unreachable", &self.unreachable);
3968 if !self._unknown_fields.is_empty() {
3969 debug_struct.field("_unknown_fields", &self._unknown_fields);
3970 }
3971 debug_struct.finish()
3972 }
3973}
3974
3975#[derive(Clone, Default, PartialEq)]
3977#[non_exhaustive]
3978pub struct ListPostureRevisionsRequest {
3979 pub name: std::string::String,
3981
3982 pub page_size: i32,
3985
3986 pub page_token: std::string::String,
3988
3989 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3990}
3991
3992impl ListPostureRevisionsRequest {
3993 pub fn new() -> Self {
3994 std::default::Default::default()
3995 }
3996
3997 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3999 self.name = v.into();
4000 self
4001 }
4002
4003 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4005 self.page_size = v.into();
4006 self
4007 }
4008
4009 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4011 self.page_token = v.into();
4012 self
4013 }
4014}
4015
4016impl wkt::message::Message for ListPostureRevisionsRequest {
4017 fn typename() -> &'static str {
4018 "type.googleapis.com/google.cloud.securityposture.v1.ListPostureRevisionsRequest"
4019 }
4020}
4021
4022#[doc(hidden)]
4023impl<'de> serde::de::Deserialize<'de> for ListPostureRevisionsRequest {
4024 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4025 where
4026 D: serde::Deserializer<'de>,
4027 {
4028 #[allow(non_camel_case_types)]
4029 #[doc(hidden)]
4030 #[derive(PartialEq, Eq, Hash)]
4031 enum __FieldTag {
4032 __name,
4033 __page_size,
4034 __page_token,
4035 Unknown(std::string::String),
4036 }
4037 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4038 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4039 where
4040 D: serde::Deserializer<'de>,
4041 {
4042 struct Visitor;
4043 impl<'de> serde::de::Visitor<'de> for Visitor {
4044 type Value = __FieldTag;
4045 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4046 formatter.write_str("a field name for ListPostureRevisionsRequest")
4047 }
4048 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4049 where
4050 E: serde::de::Error,
4051 {
4052 use std::result::Result::Ok;
4053 use std::string::ToString;
4054 match value {
4055 "name" => Ok(__FieldTag::__name),
4056 "pageSize" => Ok(__FieldTag::__page_size),
4057 "page_size" => Ok(__FieldTag::__page_size),
4058 "pageToken" => Ok(__FieldTag::__page_token),
4059 "page_token" => Ok(__FieldTag::__page_token),
4060 _ => Ok(__FieldTag::Unknown(value.to_string())),
4061 }
4062 }
4063 }
4064 deserializer.deserialize_identifier(Visitor)
4065 }
4066 }
4067 struct Visitor;
4068 impl<'de> serde::de::Visitor<'de> for Visitor {
4069 type Value = ListPostureRevisionsRequest;
4070 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4071 formatter.write_str("struct ListPostureRevisionsRequest")
4072 }
4073 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4074 where
4075 A: serde::de::MapAccess<'de>,
4076 {
4077 #[allow(unused_imports)]
4078 use serde::de::Error;
4079 use std::option::Option::Some;
4080 let mut fields = std::collections::HashSet::new();
4081 let mut result = Self::Value::new();
4082 while let Some(tag) = map.next_key::<__FieldTag>()? {
4083 #[allow(clippy::match_single_binding)]
4084 match tag {
4085 __FieldTag::__name => {
4086 if !fields.insert(__FieldTag::__name) {
4087 return std::result::Result::Err(A::Error::duplicate_field(
4088 "multiple values for name",
4089 ));
4090 }
4091 result.name = map
4092 .next_value::<std::option::Option<std::string::String>>()?
4093 .unwrap_or_default();
4094 }
4095 __FieldTag::__page_size => {
4096 if !fields.insert(__FieldTag::__page_size) {
4097 return std::result::Result::Err(A::Error::duplicate_field(
4098 "multiple values for page_size",
4099 ));
4100 }
4101 struct __With(std::option::Option<i32>);
4102 impl<'de> serde::de::Deserialize<'de> for __With {
4103 fn deserialize<D>(
4104 deserializer: D,
4105 ) -> std::result::Result<Self, D::Error>
4106 where
4107 D: serde::de::Deserializer<'de>,
4108 {
4109 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4110 }
4111 }
4112 result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
4113 }
4114 __FieldTag::__page_token => {
4115 if !fields.insert(__FieldTag::__page_token) {
4116 return std::result::Result::Err(A::Error::duplicate_field(
4117 "multiple values for page_token",
4118 ));
4119 }
4120 result.page_token = map
4121 .next_value::<std::option::Option<std::string::String>>()?
4122 .unwrap_or_default();
4123 }
4124 __FieldTag::Unknown(key) => {
4125 let value = map.next_value::<serde_json::Value>()?;
4126 result._unknown_fields.insert(key, value);
4127 }
4128 }
4129 }
4130 std::result::Result::Ok(result)
4131 }
4132 }
4133 deserializer.deserialize_any(Visitor)
4134 }
4135}
4136
4137#[doc(hidden)]
4138impl serde::ser::Serialize for ListPostureRevisionsRequest {
4139 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4140 where
4141 S: serde::ser::Serializer,
4142 {
4143 use serde::ser::SerializeMap;
4144 #[allow(unused_imports)]
4145 use std::option::Option::Some;
4146 let mut state = serializer.serialize_map(std::option::Option::None)?;
4147 if !self.name.is_empty() {
4148 state.serialize_entry("name", &self.name)?;
4149 }
4150 if !wkt::internal::is_default(&self.page_size) {
4151 struct __With<'a>(&'a i32);
4152 impl<'a> serde::ser::Serialize for __With<'a> {
4153 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4154 where
4155 S: serde::ser::Serializer,
4156 {
4157 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4158 }
4159 }
4160 state.serialize_entry("pageSize", &__With(&self.page_size))?;
4161 }
4162 if !self.page_token.is_empty() {
4163 state.serialize_entry("pageToken", &self.page_token)?;
4164 }
4165 if !self._unknown_fields.is_empty() {
4166 for (key, value) in self._unknown_fields.iter() {
4167 state.serialize_entry(key, &value)?;
4168 }
4169 }
4170 state.end()
4171 }
4172}
4173
4174impl std::fmt::Debug for ListPostureRevisionsRequest {
4175 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4176 let mut debug_struct = f.debug_struct("ListPostureRevisionsRequest");
4177 debug_struct.field("name", &self.name);
4178 debug_struct.field("page_size", &self.page_size);
4179 debug_struct.field("page_token", &self.page_token);
4180 if !self._unknown_fields.is_empty() {
4181 debug_struct.field("_unknown_fields", &self._unknown_fields);
4182 }
4183 debug_struct.finish()
4184 }
4185}
4186
4187#[derive(Clone, Default, PartialEq)]
4189#[non_exhaustive]
4190pub struct ListPostureRevisionsResponse {
4191 pub revisions: std::vec::Vec<crate::model::Posture>,
4193
4194 pub next_page_token: std::string::String,
4196
4197 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4198}
4199
4200impl ListPostureRevisionsResponse {
4201 pub fn new() -> Self {
4202 std::default::Default::default()
4203 }
4204
4205 pub fn set_revisions<T, V>(mut self, v: T) -> Self
4207 where
4208 T: std::iter::IntoIterator<Item = V>,
4209 V: std::convert::Into<crate::model::Posture>,
4210 {
4211 use std::iter::Iterator;
4212 self.revisions = v.into_iter().map(|i| i.into()).collect();
4213 self
4214 }
4215
4216 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4218 self.next_page_token = v.into();
4219 self
4220 }
4221}
4222
4223impl wkt::message::Message for ListPostureRevisionsResponse {
4224 fn typename() -> &'static str {
4225 "type.googleapis.com/google.cloud.securityposture.v1.ListPostureRevisionsResponse"
4226 }
4227}
4228
4229#[doc(hidden)]
4230impl gax::paginator::internal::PageableResponse for ListPostureRevisionsResponse {
4231 type PageItem = crate::model::Posture;
4232
4233 fn items(self) -> std::vec::Vec<Self::PageItem> {
4234 self.revisions
4235 }
4236
4237 fn next_page_token(&self) -> std::string::String {
4238 use std::clone::Clone;
4239 self.next_page_token.clone()
4240 }
4241}
4242
4243#[doc(hidden)]
4244impl<'de> serde::de::Deserialize<'de> for ListPostureRevisionsResponse {
4245 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4246 where
4247 D: serde::Deserializer<'de>,
4248 {
4249 #[allow(non_camel_case_types)]
4250 #[doc(hidden)]
4251 #[derive(PartialEq, Eq, Hash)]
4252 enum __FieldTag {
4253 __revisions,
4254 __next_page_token,
4255 Unknown(std::string::String),
4256 }
4257 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4258 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4259 where
4260 D: serde::Deserializer<'de>,
4261 {
4262 struct Visitor;
4263 impl<'de> serde::de::Visitor<'de> for Visitor {
4264 type Value = __FieldTag;
4265 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4266 formatter.write_str("a field name for ListPostureRevisionsResponse")
4267 }
4268 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4269 where
4270 E: serde::de::Error,
4271 {
4272 use std::result::Result::Ok;
4273 use std::string::ToString;
4274 match value {
4275 "revisions" => Ok(__FieldTag::__revisions),
4276 "nextPageToken" => Ok(__FieldTag::__next_page_token),
4277 "next_page_token" => Ok(__FieldTag::__next_page_token),
4278 _ => Ok(__FieldTag::Unknown(value.to_string())),
4279 }
4280 }
4281 }
4282 deserializer.deserialize_identifier(Visitor)
4283 }
4284 }
4285 struct Visitor;
4286 impl<'de> serde::de::Visitor<'de> for Visitor {
4287 type Value = ListPostureRevisionsResponse;
4288 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4289 formatter.write_str("struct ListPostureRevisionsResponse")
4290 }
4291 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4292 where
4293 A: serde::de::MapAccess<'de>,
4294 {
4295 #[allow(unused_imports)]
4296 use serde::de::Error;
4297 use std::option::Option::Some;
4298 let mut fields = std::collections::HashSet::new();
4299 let mut result = Self::Value::new();
4300 while let Some(tag) = map.next_key::<__FieldTag>()? {
4301 #[allow(clippy::match_single_binding)]
4302 match tag {
4303 __FieldTag::__revisions => {
4304 if !fields.insert(__FieldTag::__revisions) {
4305 return std::result::Result::Err(A::Error::duplicate_field(
4306 "multiple values for revisions",
4307 ));
4308 }
4309 result.revisions = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Posture>>>()?.unwrap_or_default();
4310 }
4311 __FieldTag::__next_page_token => {
4312 if !fields.insert(__FieldTag::__next_page_token) {
4313 return std::result::Result::Err(A::Error::duplicate_field(
4314 "multiple values for next_page_token",
4315 ));
4316 }
4317 result.next_page_token = map
4318 .next_value::<std::option::Option<std::string::String>>()?
4319 .unwrap_or_default();
4320 }
4321 __FieldTag::Unknown(key) => {
4322 let value = map.next_value::<serde_json::Value>()?;
4323 result._unknown_fields.insert(key, value);
4324 }
4325 }
4326 }
4327 std::result::Result::Ok(result)
4328 }
4329 }
4330 deserializer.deserialize_any(Visitor)
4331 }
4332}
4333
4334#[doc(hidden)]
4335impl serde::ser::Serialize for ListPostureRevisionsResponse {
4336 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4337 where
4338 S: serde::ser::Serializer,
4339 {
4340 use serde::ser::SerializeMap;
4341 #[allow(unused_imports)]
4342 use std::option::Option::Some;
4343 let mut state = serializer.serialize_map(std::option::Option::None)?;
4344 if !self.revisions.is_empty() {
4345 state.serialize_entry("revisions", &self.revisions)?;
4346 }
4347 if !self.next_page_token.is_empty() {
4348 state.serialize_entry("nextPageToken", &self.next_page_token)?;
4349 }
4350 if !self._unknown_fields.is_empty() {
4351 for (key, value) in self._unknown_fields.iter() {
4352 state.serialize_entry(key, &value)?;
4353 }
4354 }
4355 state.end()
4356 }
4357}
4358
4359impl std::fmt::Debug for ListPostureRevisionsResponse {
4360 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4361 let mut debug_struct = f.debug_struct("ListPostureRevisionsResponse");
4362 debug_struct.field("revisions", &self.revisions);
4363 debug_struct.field("next_page_token", &self.next_page_token);
4364 if !self._unknown_fields.is_empty() {
4365 debug_struct.field("_unknown_fields", &self._unknown_fields);
4366 }
4367 debug_struct.finish()
4368 }
4369}
4370
4371#[derive(Clone, Default, PartialEq)]
4373#[non_exhaustive]
4374pub struct GetPostureRequest {
4375 pub name: std::string::String,
4377
4378 pub revision_id: std::string::String,
4380
4381 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4382}
4383
4384impl GetPostureRequest {
4385 pub fn new() -> Self {
4386 std::default::Default::default()
4387 }
4388
4389 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4391 self.name = v.into();
4392 self
4393 }
4394
4395 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4397 self.revision_id = v.into();
4398 self
4399 }
4400}
4401
4402impl wkt::message::Message for GetPostureRequest {
4403 fn typename() -> &'static str {
4404 "type.googleapis.com/google.cloud.securityposture.v1.GetPostureRequest"
4405 }
4406}
4407
4408#[doc(hidden)]
4409impl<'de> serde::de::Deserialize<'de> for GetPostureRequest {
4410 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4411 where
4412 D: serde::Deserializer<'de>,
4413 {
4414 #[allow(non_camel_case_types)]
4415 #[doc(hidden)]
4416 #[derive(PartialEq, Eq, Hash)]
4417 enum __FieldTag {
4418 __name,
4419 __revision_id,
4420 Unknown(std::string::String),
4421 }
4422 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4423 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4424 where
4425 D: serde::Deserializer<'de>,
4426 {
4427 struct Visitor;
4428 impl<'de> serde::de::Visitor<'de> for Visitor {
4429 type Value = __FieldTag;
4430 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4431 formatter.write_str("a field name for GetPostureRequest")
4432 }
4433 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4434 where
4435 E: serde::de::Error,
4436 {
4437 use std::result::Result::Ok;
4438 use std::string::ToString;
4439 match value {
4440 "name" => Ok(__FieldTag::__name),
4441 "revisionId" => Ok(__FieldTag::__revision_id),
4442 "revision_id" => Ok(__FieldTag::__revision_id),
4443 _ => Ok(__FieldTag::Unknown(value.to_string())),
4444 }
4445 }
4446 }
4447 deserializer.deserialize_identifier(Visitor)
4448 }
4449 }
4450 struct Visitor;
4451 impl<'de> serde::de::Visitor<'de> for Visitor {
4452 type Value = GetPostureRequest;
4453 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4454 formatter.write_str("struct GetPostureRequest")
4455 }
4456 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4457 where
4458 A: serde::de::MapAccess<'de>,
4459 {
4460 #[allow(unused_imports)]
4461 use serde::de::Error;
4462 use std::option::Option::Some;
4463 let mut fields = std::collections::HashSet::new();
4464 let mut result = Self::Value::new();
4465 while let Some(tag) = map.next_key::<__FieldTag>()? {
4466 #[allow(clippy::match_single_binding)]
4467 match tag {
4468 __FieldTag::__name => {
4469 if !fields.insert(__FieldTag::__name) {
4470 return std::result::Result::Err(A::Error::duplicate_field(
4471 "multiple values for name",
4472 ));
4473 }
4474 result.name = map
4475 .next_value::<std::option::Option<std::string::String>>()?
4476 .unwrap_or_default();
4477 }
4478 __FieldTag::__revision_id => {
4479 if !fields.insert(__FieldTag::__revision_id) {
4480 return std::result::Result::Err(A::Error::duplicate_field(
4481 "multiple values for revision_id",
4482 ));
4483 }
4484 result.revision_id = map
4485 .next_value::<std::option::Option<std::string::String>>()?
4486 .unwrap_or_default();
4487 }
4488 __FieldTag::Unknown(key) => {
4489 let value = map.next_value::<serde_json::Value>()?;
4490 result._unknown_fields.insert(key, value);
4491 }
4492 }
4493 }
4494 std::result::Result::Ok(result)
4495 }
4496 }
4497 deserializer.deserialize_any(Visitor)
4498 }
4499}
4500
4501#[doc(hidden)]
4502impl serde::ser::Serialize for GetPostureRequest {
4503 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4504 where
4505 S: serde::ser::Serializer,
4506 {
4507 use serde::ser::SerializeMap;
4508 #[allow(unused_imports)]
4509 use std::option::Option::Some;
4510 let mut state = serializer.serialize_map(std::option::Option::None)?;
4511 if !self.name.is_empty() {
4512 state.serialize_entry("name", &self.name)?;
4513 }
4514 if !self.revision_id.is_empty() {
4515 state.serialize_entry("revisionId", &self.revision_id)?;
4516 }
4517 if !self._unknown_fields.is_empty() {
4518 for (key, value) in self._unknown_fields.iter() {
4519 state.serialize_entry(key, &value)?;
4520 }
4521 }
4522 state.end()
4523 }
4524}
4525
4526impl std::fmt::Debug for GetPostureRequest {
4527 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4528 let mut debug_struct = f.debug_struct("GetPostureRequest");
4529 debug_struct.field("name", &self.name);
4530 debug_struct.field("revision_id", &self.revision_id);
4531 if !self._unknown_fields.is_empty() {
4532 debug_struct.field("_unknown_fields", &self._unknown_fields);
4533 }
4534 debug_struct.finish()
4535 }
4536}
4537
4538#[derive(Clone, Default, PartialEq)]
4540#[non_exhaustive]
4541pub struct CreatePostureRequest {
4542 pub parent: std::string::String,
4544
4545 pub posture_id: std::string::String,
4548
4549 pub posture: std::option::Option<crate::model::Posture>,
4551
4552 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4553}
4554
4555impl CreatePostureRequest {
4556 pub fn new() -> Self {
4557 std::default::Default::default()
4558 }
4559
4560 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4562 self.parent = v.into();
4563 self
4564 }
4565
4566 pub fn set_posture_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4568 self.posture_id = v.into();
4569 self
4570 }
4571
4572 pub fn set_posture<T>(mut self, v: T) -> Self
4574 where
4575 T: std::convert::Into<crate::model::Posture>,
4576 {
4577 self.posture = std::option::Option::Some(v.into());
4578 self
4579 }
4580
4581 pub fn set_or_clear_posture<T>(mut self, v: std::option::Option<T>) -> Self
4583 where
4584 T: std::convert::Into<crate::model::Posture>,
4585 {
4586 self.posture = v.map(|x| x.into());
4587 self
4588 }
4589}
4590
4591impl wkt::message::Message for CreatePostureRequest {
4592 fn typename() -> &'static str {
4593 "type.googleapis.com/google.cloud.securityposture.v1.CreatePostureRequest"
4594 }
4595}
4596
4597#[doc(hidden)]
4598impl<'de> serde::de::Deserialize<'de> for CreatePostureRequest {
4599 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4600 where
4601 D: serde::Deserializer<'de>,
4602 {
4603 #[allow(non_camel_case_types)]
4604 #[doc(hidden)]
4605 #[derive(PartialEq, Eq, Hash)]
4606 enum __FieldTag {
4607 __parent,
4608 __posture_id,
4609 __posture,
4610 Unknown(std::string::String),
4611 }
4612 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4613 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4614 where
4615 D: serde::Deserializer<'de>,
4616 {
4617 struct Visitor;
4618 impl<'de> serde::de::Visitor<'de> for Visitor {
4619 type Value = __FieldTag;
4620 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4621 formatter.write_str("a field name for CreatePostureRequest")
4622 }
4623 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4624 where
4625 E: serde::de::Error,
4626 {
4627 use std::result::Result::Ok;
4628 use std::string::ToString;
4629 match value {
4630 "parent" => Ok(__FieldTag::__parent),
4631 "postureId" => Ok(__FieldTag::__posture_id),
4632 "posture_id" => Ok(__FieldTag::__posture_id),
4633 "posture" => Ok(__FieldTag::__posture),
4634 _ => Ok(__FieldTag::Unknown(value.to_string())),
4635 }
4636 }
4637 }
4638 deserializer.deserialize_identifier(Visitor)
4639 }
4640 }
4641 struct Visitor;
4642 impl<'de> serde::de::Visitor<'de> for Visitor {
4643 type Value = CreatePostureRequest;
4644 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4645 formatter.write_str("struct CreatePostureRequest")
4646 }
4647 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4648 where
4649 A: serde::de::MapAccess<'de>,
4650 {
4651 #[allow(unused_imports)]
4652 use serde::de::Error;
4653 use std::option::Option::Some;
4654 let mut fields = std::collections::HashSet::new();
4655 let mut result = Self::Value::new();
4656 while let Some(tag) = map.next_key::<__FieldTag>()? {
4657 #[allow(clippy::match_single_binding)]
4658 match tag {
4659 __FieldTag::__parent => {
4660 if !fields.insert(__FieldTag::__parent) {
4661 return std::result::Result::Err(A::Error::duplicate_field(
4662 "multiple values for parent",
4663 ));
4664 }
4665 result.parent = map
4666 .next_value::<std::option::Option<std::string::String>>()?
4667 .unwrap_or_default();
4668 }
4669 __FieldTag::__posture_id => {
4670 if !fields.insert(__FieldTag::__posture_id) {
4671 return std::result::Result::Err(A::Error::duplicate_field(
4672 "multiple values for posture_id",
4673 ));
4674 }
4675 result.posture_id = map
4676 .next_value::<std::option::Option<std::string::String>>()?
4677 .unwrap_or_default();
4678 }
4679 __FieldTag::__posture => {
4680 if !fields.insert(__FieldTag::__posture) {
4681 return std::result::Result::Err(A::Error::duplicate_field(
4682 "multiple values for posture",
4683 ));
4684 }
4685 result.posture =
4686 map.next_value::<std::option::Option<crate::model::Posture>>()?;
4687 }
4688 __FieldTag::Unknown(key) => {
4689 let value = map.next_value::<serde_json::Value>()?;
4690 result._unknown_fields.insert(key, value);
4691 }
4692 }
4693 }
4694 std::result::Result::Ok(result)
4695 }
4696 }
4697 deserializer.deserialize_any(Visitor)
4698 }
4699}
4700
4701#[doc(hidden)]
4702impl serde::ser::Serialize for CreatePostureRequest {
4703 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4704 where
4705 S: serde::ser::Serializer,
4706 {
4707 use serde::ser::SerializeMap;
4708 #[allow(unused_imports)]
4709 use std::option::Option::Some;
4710 let mut state = serializer.serialize_map(std::option::Option::None)?;
4711 if !self.parent.is_empty() {
4712 state.serialize_entry("parent", &self.parent)?;
4713 }
4714 if !self.posture_id.is_empty() {
4715 state.serialize_entry("postureId", &self.posture_id)?;
4716 }
4717 if self.posture.is_some() {
4718 state.serialize_entry("posture", &self.posture)?;
4719 }
4720 if !self._unknown_fields.is_empty() {
4721 for (key, value) in self._unknown_fields.iter() {
4722 state.serialize_entry(key, &value)?;
4723 }
4724 }
4725 state.end()
4726 }
4727}
4728
4729impl std::fmt::Debug for CreatePostureRequest {
4730 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4731 let mut debug_struct = f.debug_struct("CreatePostureRequest");
4732 debug_struct.field("parent", &self.parent);
4733 debug_struct.field("posture_id", &self.posture_id);
4734 debug_struct.field("posture", &self.posture);
4735 if !self._unknown_fields.is_empty() {
4736 debug_struct.field("_unknown_fields", &self._unknown_fields);
4737 }
4738 debug_struct.finish()
4739 }
4740}
4741
4742#[derive(Clone, Default, PartialEq)]
4744#[non_exhaustive]
4745pub struct UpdatePostureRequest {
4746 pub update_mask: std::option::Option<wkt::FieldMask>,
4752
4753 pub posture: std::option::Option<crate::model::Posture>,
4755
4756 pub revision_id: std::string::String,
4758
4759 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4760}
4761
4762impl UpdatePostureRequest {
4763 pub fn new() -> Self {
4764 std::default::Default::default()
4765 }
4766
4767 pub fn set_update_mask<T>(mut self, v: T) -> Self
4769 where
4770 T: std::convert::Into<wkt::FieldMask>,
4771 {
4772 self.update_mask = std::option::Option::Some(v.into());
4773 self
4774 }
4775
4776 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4778 where
4779 T: std::convert::Into<wkt::FieldMask>,
4780 {
4781 self.update_mask = v.map(|x| x.into());
4782 self
4783 }
4784
4785 pub fn set_posture<T>(mut self, v: T) -> Self
4787 where
4788 T: std::convert::Into<crate::model::Posture>,
4789 {
4790 self.posture = std::option::Option::Some(v.into());
4791 self
4792 }
4793
4794 pub fn set_or_clear_posture<T>(mut self, v: std::option::Option<T>) -> Self
4796 where
4797 T: std::convert::Into<crate::model::Posture>,
4798 {
4799 self.posture = v.map(|x| x.into());
4800 self
4801 }
4802
4803 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4805 self.revision_id = v.into();
4806 self
4807 }
4808}
4809
4810impl wkt::message::Message for UpdatePostureRequest {
4811 fn typename() -> &'static str {
4812 "type.googleapis.com/google.cloud.securityposture.v1.UpdatePostureRequest"
4813 }
4814}
4815
4816#[doc(hidden)]
4817impl<'de> serde::de::Deserialize<'de> for UpdatePostureRequest {
4818 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4819 where
4820 D: serde::Deserializer<'de>,
4821 {
4822 #[allow(non_camel_case_types)]
4823 #[doc(hidden)]
4824 #[derive(PartialEq, Eq, Hash)]
4825 enum __FieldTag {
4826 __update_mask,
4827 __posture,
4828 __revision_id,
4829 Unknown(std::string::String),
4830 }
4831 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4832 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4833 where
4834 D: serde::Deserializer<'de>,
4835 {
4836 struct Visitor;
4837 impl<'de> serde::de::Visitor<'de> for Visitor {
4838 type Value = __FieldTag;
4839 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4840 formatter.write_str("a field name for UpdatePostureRequest")
4841 }
4842 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4843 where
4844 E: serde::de::Error,
4845 {
4846 use std::result::Result::Ok;
4847 use std::string::ToString;
4848 match value {
4849 "updateMask" => Ok(__FieldTag::__update_mask),
4850 "update_mask" => Ok(__FieldTag::__update_mask),
4851 "posture" => Ok(__FieldTag::__posture),
4852 "revisionId" => Ok(__FieldTag::__revision_id),
4853 "revision_id" => Ok(__FieldTag::__revision_id),
4854 _ => Ok(__FieldTag::Unknown(value.to_string())),
4855 }
4856 }
4857 }
4858 deserializer.deserialize_identifier(Visitor)
4859 }
4860 }
4861 struct Visitor;
4862 impl<'de> serde::de::Visitor<'de> for Visitor {
4863 type Value = UpdatePostureRequest;
4864 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4865 formatter.write_str("struct UpdatePostureRequest")
4866 }
4867 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4868 where
4869 A: serde::de::MapAccess<'de>,
4870 {
4871 #[allow(unused_imports)]
4872 use serde::de::Error;
4873 use std::option::Option::Some;
4874 let mut fields = std::collections::HashSet::new();
4875 let mut result = Self::Value::new();
4876 while let Some(tag) = map.next_key::<__FieldTag>()? {
4877 #[allow(clippy::match_single_binding)]
4878 match tag {
4879 __FieldTag::__update_mask => {
4880 if !fields.insert(__FieldTag::__update_mask) {
4881 return std::result::Result::Err(A::Error::duplicate_field(
4882 "multiple values for update_mask",
4883 ));
4884 }
4885 result.update_mask =
4886 map.next_value::<std::option::Option<wkt::FieldMask>>()?;
4887 }
4888 __FieldTag::__posture => {
4889 if !fields.insert(__FieldTag::__posture) {
4890 return std::result::Result::Err(A::Error::duplicate_field(
4891 "multiple values for posture",
4892 ));
4893 }
4894 result.posture =
4895 map.next_value::<std::option::Option<crate::model::Posture>>()?;
4896 }
4897 __FieldTag::__revision_id => {
4898 if !fields.insert(__FieldTag::__revision_id) {
4899 return std::result::Result::Err(A::Error::duplicate_field(
4900 "multiple values for revision_id",
4901 ));
4902 }
4903 result.revision_id = map
4904 .next_value::<std::option::Option<std::string::String>>()?
4905 .unwrap_or_default();
4906 }
4907 __FieldTag::Unknown(key) => {
4908 let value = map.next_value::<serde_json::Value>()?;
4909 result._unknown_fields.insert(key, value);
4910 }
4911 }
4912 }
4913 std::result::Result::Ok(result)
4914 }
4915 }
4916 deserializer.deserialize_any(Visitor)
4917 }
4918}
4919
4920#[doc(hidden)]
4921impl serde::ser::Serialize for UpdatePostureRequest {
4922 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4923 where
4924 S: serde::ser::Serializer,
4925 {
4926 use serde::ser::SerializeMap;
4927 #[allow(unused_imports)]
4928 use std::option::Option::Some;
4929 let mut state = serializer.serialize_map(std::option::Option::None)?;
4930 if self.update_mask.is_some() {
4931 state.serialize_entry("updateMask", &self.update_mask)?;
4932 }
4933 if self.posture.is_some() {
4934 state.serialize_entry("posture", &self.posture)?;
4935 }
4936 if !self.revision_id.is_empty() {
4937 state.serialize_entry("revisionId", &self.revision_id)?;
4938 }
4939 if !self._unknown_fields.is_empty() {
4940 for (key, value) in self._unknown_fields.iter() {
4941 state.serialize_entry(key, &value)?;
4942 }
4943 }
4944 state.end()
4945 }
4946}
4947
4948impl std::fmt::Debug for UpdatePostureRequest {
4949 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4950 let mut debug_struct = f.debug_struct("UpdatePostureRequest");
4951 debug_struct.field("update_mask", &self.update_mask);
4952 debug_struct.field("posture", &self.posture);
4953 debug_struct.field("revision_id", &self.revision_id);
4954 if !self._unknown_fields.is_empty() {
4955 debug_struct.field("_unknown_fields", &self._unknown_fields);
4956 }
4957 debug_struct.finish()
4958 }
4959}
4960
4961#[derive(Clone, Default, PartialEq)]
4963#[non_exhaustive]
4964pub struct DeletePostureRequest {
4965 pub name: std::string::String,
4967
4968 pub etag: std::string::String,
4970
4971 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4972}
4973
4974impl DeletePostureRequest {
4975 pub fn new() -> Self {
4976 std::default::Default::default()
4977 }
4978
4979 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4981 self.name = v.into();
4982 self
4983 }
4984
4985 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4987 self.etag = v.into();
4988 self
4989 }
4990}
4991
4992impl wkt::message::Message for DeletePostureRequest {
4993 fn typename() -> &'static str {
4994 "type.googleapis.com/google.cloud.securityposture.v1.DeletePostureRequest"
4995 }
4996}
4997
4998#[doc(hidden)]
4999impl<'de> serde::de::Deserialize<'de> for DeletePostureRequest {
5000 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5001 where
5002 D: serde::Deserializer<'de>,
5003 {
5004 #[allow(non_camel_case_types)]
5005 #[doc(hidden)]
5006 #[derive(PartialEq, Eq, Hash)]
5007 enum __FieldTag {
5008 __name,
5009 __etag,
5010 Unknown(std::string::String),
5011 }
5012 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5013 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5014 where
5015 D: serde::Deserializer<'de>,
5016 {
5017 struct Visitor;
5018 impl<'de> serde::de::Visitor<'de> for Visitor {
5019 type Value = __FieldTag;
5020 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5021 formatter.write_str("a field name for DeletePostureRequest")
5022 }
5023 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5024 where
5025 E: serde::de::Error,
5026 {
5027 use std::result::Result::Ok;
5028 use std::string::ToString;
5029 match value {
5030 "name" => Ok(__FieldTag::__name),
5031 "etag" => Ok(__FieldTag::__etag),
5032 _ => Ok(__FieldTag::Unknown(value.to_string())),
5033 }
5034 }
5035 }
5036 deserializer.deserialize_identifier(Visitor)
5037 }
5038 }
5039 struct Visitor;
5040 impl<'de> serde::de::Visitor<'de> for Visitor {
5041 type Value = DeletePostureRequest;
5042 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5043 formatter.write_str("struct DeletePostureRequest")
5044 }
5045 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5046 where
5047 A: serde::de::MapAccess<'de>,
5048 {
5049 #[allow(unused_imports)]
5050 use serde::de::Error;
5051 use std::option::Option::Some;
5052 let mut fields = std::collections::HashSet::new();
5053 let mut result = Self::Value::new();
5054 while let Some(tag) = map.next_key::<__FieldTag>()? {
5055 #[allow(clippy::match_single_binding)]
5056 match tag {
5057 __FieldTag::__name => {
5058 if !fields.insert(__FieldTag::__name) {
5059 return std::result::Result::Err(A::Error::duplicate_field(
5060 "multiple values for name",
5061 ));
5062 }
5063 result.name = map
5064 .next_value::<std::option::Option<std::string::String>>()?
5065 .unwrap_or_default();
5066 }
5067 __FieldTag::__etag => {
5068 if !fields.insert(__FieldTag::__etag) {
5069 return std::result::Result::Err(A::Error::duplicate_field(
5070 "multiple values for etag",
5071 ));
5072 }
5073 result.etag = map
5074 .next_value::<std::option::Option<std::string::String>>()?
5075 .unwrap_or_default();
5076 }
5077 __FieldTag::Unknown(key) => {
5078 let value = map.next_value::<serde_json::Value>()?;
5079 result._unknown_fields.insert(key, value);
5080 }
5081 }
5082 }
5083 std::result::Result::Ok(result)
5084 }
5085 }
5086 deserializer.deserialize_any(Visitor)
5087 }
5088}
5089
5090#[doc(hidden)]
5091impl serde::ser::Serialize for DeletePostureRequest {
5092 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5093 where
5094 S: serde::ser::Serializer,
5095 {
5096 use serde::ser::SerializeMap;
5097 #[allow(unused_imports)]
5098 use std::option::Option::Some;
5099 let mut state = serializer.serialize_map(std::option::Option::None)?;
5100 if !self.name.is_empty() {
5101 state.serialize_entry("name", &self.name)?;
5102 }
5103 if !self.etag.is_empty() {
5104 state.serialize_entry("etag", &self.etag)?;
5105 }
5106 if !self._unknown_fields.is_empty() {
5107 for (key, value) in self._unknown_fields.iter() {
5108 state.serialize_entry(key, &value)?;
5109 }
5110 }
5111 state.end()
5112 }
5113}
5114
5115impl std::fmt::Debug for DeletePostureRequest {
5116 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5117 let mut debug_struct = f.debug_struct("DeletePostureRequest");
5118 debug_struct.field("name", &self.name);
5119 debug_struct.field("etag", &self.etag);
5120 if !self._unknown_fields.is_empty() {
5121 debug_struct.field("_unknown_fields", &self._unknown_fields);
5122 }
5123 debug_struct.finish()
5124 }
5125}
5126
5127#[derive(Clone, Default, PartialEq)]
5129#[non_exhaustive]
5130pub struct ExtractPostureRequest {
5131 pub parent: std::string::String,
5134
5135 pub posture_id: std::string::String,
5138
5139 pub workload: std::string::String,
5147
5148 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5149}
5150
5151impl ExtractPostureRequest {
5152 pub fn new() -> Self {
5153 std::default::Default::default()
5154 }
5155
5156 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5158 self.parent = v.into();
5159 self
5160 }
5161
5162 pub fn set_posture_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5164 self.posture_id = v.into();
5165 self
5166 }
5167
5168 pub fn set_workload<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5170 self.workload = v.into();
5171 self
5172 }
5173}
5174
5175impl wkt::message::Message for ExtractPostureRequest {
5176 fn typename() -> &'static str {
5177 "type.googleapis.com/google.cloud.securityposture.v1.ExtractPostureRequest"
5178 }
5179}
5180
5181#[doc(hidden)]
5182impl<'de> serde::de::Deserialize<'de> for ExtractPostureRequest {
5183 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5184 where
5185 D: serde::Deserializer<'de>,
5186 {
5187 #[allow(non_camel_case_types)]
5188 #[doc(hidden)]
5189 #[derive(PartialEq, Eq, Hash)]
5190 enum __FieldTag {
5191 __parent,
5192 __posture_id,
5193 __workload,
5194 Unknown(std::string::String),
5195 }
5196 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5197 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5198 where
5199 D: serde::Deserializer<'de>,
5200 {
5201 struct Visitor;
5202 impl<'de> serde::de::Visitor<'de> for Visitor {
5203 type Value = __FieldTag;
5204 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5205 formatter.write_str("a field name for ExtractPostureRequest")
5206 }
5207 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5208 where
5209 E: serde::de::Error,
5210 {
5211 use std::result::Result::Ok;
5212 use std::string::ToString;
5213 match value {
5214 "parent" => Ok(__FieldTag::__parent),
5215 "postureId" => Ok(__FieldTag::__posture_id),
5216 "posture_id" => Ok(__FieldTag::__posture_id),
5217 "workload" => Ok(__FieldTag::__workload),
5218 _ => Ok(__FieldTag::Unknown(value.to_string())),
5219 }
5220 }
5221 }
5222 deserializer.deserialize_identifier(Visitor)
5223 }
5224 }
5225 struct Visitor;
5226 impl<'de> serde::de::Visitor<'de> for Visitor {
5227 type Value = ExtractPostureRequest;
5228 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5229 formatter.write_str("struct ExtractPostureRequest")
5230 }
5231 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5232 where
5233 A: serde::de::MapAccess<'de>,
5234 {
5235 #[allow(unused_imports)]
5236 use serde::de::Error;
5237 use std::option::Option::Some;
5238 let mut fields = std::collections::HashSet::new();
5239 let mut result = Self::Value::new();
5240 while let Some(tag) = map.next_key::<__FieldTag>()? {
5241 #[allow(clippy::match_single_binding)]
5242 match tag {
5243 __FieldTag::__parent => {
5244 if !fields.insert(__FieldTag::__parent) {
5245 return std::result::Result::Err(A::Error::duplicate_field(
5246 "multiple values for parent",
5247 ));
5248 }
5249 result.parent = map
5250 .next_value::<std::option::Option<std::string::String>>()?
5251 .unwrap_or_default();
5252 }
5253 __FieldTag::__posture_id => {
5254 if !fields.insert(__FieldTag::__posture_id) {
5255 return std::result::Result::Err(A::Error::duplicate_field(
5256 "multiple values for posture_id",
5257 ));
5258 }
5259 result.posture_id = map
5260 .next_value::<std::option::Option<std::string::String>>()?
5261 .unwrap_or_default();
5262 }
5263 __FieldTag::__workload => {
5264 if !fields.insert(__FieldTag::__workload) {
5265 return std::result::Result::Err(A::Error::duplicate_field(
5266 "multiple values for workload",
5267 ));
5268 }
5269 result.workload = map
5270 .next_value::<std::option::Option<std::string::String>>()?
5271 .unwrap_or_default();
5272 }
5273 __FieldTag::Unknown(key) => {
5274 let value = map.next_value::<serde_json::Value>()?;
5275 result._unknown_fields.insert(key, value);
5276 }
5277 }
5278 }
5279 std::result::Result::Ok(result)
5280 }
5281 }
5282 deserializer.deserialize_any(Visitor)
5283 }
5284}
5285
5286#[doc(hidden)]
5287impl serde::ser::Serialize for ExtractPostureRequest {
5288 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5289 where
5290 S: serde::ser::Serializer,
5291 {
5292 use serde::ser::SerializeMap;
5293 #[allow(unused_imports)]
5294 use std::option::Option::Some;
5295 let mut state = serializer.serialize_map(std::option::Option::None)?;
5296 if !self.parent.is_empty() {
5297 state.serialize_entry("parent", &self.parent)?;
5298 }
5299 if !self.posture_id.is_empty() {
5300 state.serialize_entry("postureId", &self.posture_id)?;
5301 }
5302 if !self.workload.is_empty() {
5303 state.serialize_entry("workload", &self.workload)?;
5304 }
5305 if !self._unknown_fields.is_empty() {
5306 for (key, value) in self._unknown_fields.iter() {
5307 state.serialize_entry(key, &value)?;
5308 }
5309 }
5310 state.end()
5311 }
5312}
5313
5314impl std::fmt::Debug for ExtractPostureRequest {
5315 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5316 let mut debug_struct = f.debug_struct("ExtractPostureRequest");
5317 debug_struct.field("parent", &self.parent);
5318 debug_struct.field("posture_id", &self.posture_id);
5319 debug_struct.field("workload", &self.workload);
5320 if !self._unknown_fields.is_empty() {
5321 debug_struct.field("_unknown_fields", &self._unknown_fields);
5322 }
5323 debug_struct.finish()
5324 }
5325}
5326
5327#[derive(Clone, Default, PartialEq)]
5330#[non_exhaustive]
5331pub struct PostureDeployment {
5332 pub name: std::string::String,
5335
5336 pub target_resource: std::string::String,
5340
5341 pub state: crate::model::posture_deployment::State,
5343
5344 pub posture_id: std::string::String,
5350
5351 pub posture_revision_id: std::string::String,
5353
5354 pub create_time: std::option::Option<wkt::Timestamp>,
5356
5357 pub update_time: std::option::Option<wkt::Timestamp>,
5359
5360 pub description: std::string::String,
5362
5363 pub etag: std::string::String,
5375
5376 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
5380
5381 pub reconciling: bool,
5384
5385 pub desired_posture_id: std::string::String,
5389
5390 pub desired_posture_revision_id: std::string::String,
5393
5394 pub failure_message: std::string::String,
5398
5399 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5400}
5401
5402impl PostureDeployment {
5403 pub fn new() -> Self {
5404 std::default::Default::default()
5405 }
5406
5407 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5409 self.name = v.into();
5410 self
5411 }
5412
5413 pub fn set_target_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5415 self.target_resource = v.into();
5416 self
5417 }
5418
5419 pub fn set_state<T: std::convert::Into<crate::model::posture_deployment::State>>(
5421 mut self,
5422 v: T,
5423 ) -> Self {
5424 self.state = v.into();
5425 self
5426 }
5427
5428 pub fn set_posture_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5430 self.posture_id = v.into();
5431 self
5432 }
5433
5434 pub fn set_posture_revision_id<T: std::convert::Into<std::string::String>>(
5436 mut self,
5437 v: T,
5438 ) -> Self {
5439 self.posture_revision_id = v.into();
5440 self
5441 }
5442
5443 pub fn set_create_time<T>(mut self, v: T) -> Self
5445 where
5446 T: std::convert::Into<wkt::Timestamp>,
5447 {
5448 self.create_time = std::option::Option::Some(v.into());
5449 self
5450 }
5451
5452 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5454 where
5455 T: std::convert::Into<wkt::Timestamp>,
5456 {
5457 self.create_time = v.map(|x| x.into());
5458 self
5459 }
5460
5461 pub fn set_update_time<T>(mut self, v: T) -> Self
5463 where
5464 T: std::convert::Into<wkt::Timestamp>,
5465 {
5466 self.update_time = std::option::Option::Some(v.into());
5467 self
5468 }
5469
5470 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5472 where
5473 T: std::convert::Into<wkt::Timestamp>,
5474 {
5475 self.update_time = v.map(|x| x.into());
5476 self
5477 }
5478
5479 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5481 self.description = v.into();
5482 self
5483 }
5484
5485 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5487 self.etag = v.into();
5488 self
5489 }
5490
5491 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
5493 where
5494 T: std::iter::IntoIterator<Item = (K, V)>,
5495 K: std::convert::Into<std::string::String>,
5496 V: std::convert::Into<std::string::String>,
5497 {
5498 use std::iter::Iterator;
5499 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5500 self
5501 }
5502
5503 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5505 self.reconciling = v.into();
5506 self
5507 }
5508
5509 pub fn set_desired_posture_id<T: std::convert::Into<std::string::String>>(
5511 mut self,
5512 v: T,
5513 ) -> Self {
5514 self.desired_posture_id = v.into();
5515 self
5516 }
5517
5518 pub fn set_desired_posture_revision_id<T: std::convert::Into<std::string::String>>(
5520 mut self,
5521 v: T,
5522 ) -> Self {
5523 self.desired_posture_revision_id = v.into();
5524 self
5525 }
5526
5527 pub fn set_failure_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5529 self.failure_message = v.into();
5530 self
5531 }
5532}
5533
5534impl wkt::message::Message for PostureDeployment {
5535 fn typename() -> &'static str {
5536 "type.googleapis.com/google.cloud.securityposture.v1.PostureDeployment"
5537 }
5538}
5539
5540#[doc(hidden)]
5541impl<'de> serde::de::Deserialize<'de> for PostureDeployment {
5542 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5543 where
5544 D: serde::Deserializer<'de>,
5545 {
5546 #[allow(non_camel_case_types)]
5547 #[doc(hidden)]
5548 #[derive(PartialEq, Eq, Hash)]
5549 enum __FieldTag {
5550 __name,
5551 __target_resource,
5552 __state,
5553 __posture_id,
5554 __posture_revision_id,
5555 __create_time,
5556 __update_time,
5557 __description,
5558 __etag,
5559 __annotations,
5560 __reconciling,
5561 __desired_posture_id,
5562 __desired_posture_revision_id,
5563 __failure_message,
5564 Unknown(std::string::String),
5565 }
5566 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5567 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5568 where
5569 D: serde::Deserializer<'de>,
5570 {
5571 struct Visitor;
5572 impl<'de> serde::de::Visitor<'de> for Visitor {
5573 type Value = __FieldTag;
5574 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5575 formatter.write_str("a field name for PostureDeployment")
5576 }
5577 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5578 where
5579 E: serde::de::Error,
5580 {
5581 use std::result::Result::Ok;
5582 use std::string::ToString;
5583 match value {
5584 "name" => Ok(__FieldTag::__name),
5585 "targetResource" => Ok(__FieldTag::__target_resource),
5586 "target_resource" => Ok(__FieldTag::__target_resource),
5587 "state" => Ok(__FieldTag::__state),
5588 "postureId" => Ok(__FieldTag::__posture_id),
5589 "posture_id" => Ok(__FieldTag::__posture_id),
5590 "postureRevisionId" => Ok(__FieldTag::__posture_revision_id),
5591 "posture_revision_id" => Ok(__FieldTag::__posture_revision_id),
5592 "createTime" => Ok(__FieldTag::__create_time),
5593 "create_time" => Ok(__FieldTag::__create_time),
5594 "updateTime" => Ok(__FieldTag::__update_time),
5595 "update_time" => Ok(__FieldTag::__update_time),
5596 "description" => Ok(__FieldTag::__description),
5597 "etag" => Ok(__FieldTag::__etag),
5598 "annotations" => Ok(__FieldTag::__annotations),
5599 "reconciling" => Ok(__FieldTag::__reconciling),
5600 "desiredPostureId" => Ok(__FieldTag::__desired_posture_id),
5601 "desired_posture_id" => Ok(__FieldTag::__desired_posture_id),
5602 "desiredPostureRevisionId" => {
5603 Ok(__FieldTag::__desired_posture_revision_id)
5604 }
5605 "desired_posture_revision_id" => {
5606 Ok(__FieldTag::__desired_posture_revision_id)
5607 }
5608 "failureMessage" => Ok(__FieldTag::__failure_message),
5609 "failure_message" => Ok(__FieldTag::__failure_message),
5610 _ => Ok(__FieldTag::Unknown(value.to_string())),
5611 }
5612 }
5613 }
5614 deserializer.deserialize_identifier(Visitor)
5615 }
5616 }
5617 struct Visitor;
5618 impl<'de> serde::de::Visitor<'de> for Visitor {
5619 type Value = PostureDeployment;
5620 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5621 formatter.write_str("struct PostureDeployment")
5622 }
5623 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5624 where
5625 A: serde::de::MapAccess<'de>,
5626 {
5627 #[allow(unused_imports)]
5628 use serde::de::Error;
5629 use std::option::Option::Some;
5630 let mut fields = std::collections::HashSet::new();
5631 let mut result = Self::Value::new();
5632 while let Some(tag) = map.next_key::<__FieldTag>()? {
5633 #[allow(clippy::match_single_binding)]
5634 match tag {
5635 __FieldTag::__name => {
5636 if !fields.insert(__FieldTag::__name) {
5637 return std::result::Result::Err(A::Error::duplicate_field(
5638 "multiple values for name",
5639 ));
5640 }
5641 result.name = map
5642 .next_value::<std::option::Option<std::string::String>>()?
5643 .unwrap_or_default();
5644 }
5645 __FieldTag::__target_resource => {
5646 if !fields.insert(__FieldTag::__target_resource) {
5647 return std::result::Result::Err(A::Error::duplicate_field(
5648 "multiple values for target_resource",
5649 ));
5650 }
5651 result.target_resource = map
5652 .next_value::<std::option::Option<std::string::String>>()?
5653 .unwrap_or_default();
5654 }
5655 __FieldTag::__state => {
5656 if !fields.insert(__FieldTag::__state) {
5657 return std::result::Result::Err(A::Error::duplicate_field(
5658 "multiple values for state",
5659 ));
5660 }
5661 result.state = map.next_value::<std::option::Option<crate::model::posture_deployment::State>>()?.unwrap_or_default();
5662 }
5663 __FieldTag::__posture_id => {
5664 if !fields.insert(__FieldTag::__posture_id) {
5665 return std::result::Result::Err(A::Error::duplicate_field(
5666 "multiple values for posture_id",
5667 ));
5668 }
5669 result.posture_id = map
5670 .next_value::<std::option::Option<std::string::String>>()?
5671 .unwrap_or_default();
5672 }
5673 __FieldTag::__posture_revision_id => {
5674 if !fields.insert(__FieldTag::__posture_revision_id) {
5675 return std::result::Result::Err(A::Error::duplicate_field(
5676 "multiple values for posture_revision_id",
5677 ));
5678 }
5679 result.posture_revision_id = map
5680 .next_value::<std::option::Option<std::string::String>>()?
5681 .unwrap_or_default();
5682 }
5683 __FieldTag::__create_time => {
5684 if !fields.insert(__FieldTag::__create_time) {
5685 return std::result::Result::Err(A::Error::duplicate_field(
5686 "multiple values for create_time",
5687 ));
5688 }
5689 result.create_time =
5690 map.next_value::<std::option::Option<wkt::Timestamp>>()?;
5691 }
5692 __FieldTag::__update_time => {
5693 if !fields.insert(__FieldTag::__update_time) {
5694 return std::result::Result::Err(A::Error::duplicate_field(
5695 "multiple values for update_time",
5696 ));
5697 }
5698 result.update_time =
5699 map.next_value::<std::option::Option<wkt::Timestamp>>()?;
5700 }
5701 __FieldTag::__description => {
5702 if !fields.insert(__FieldTag::__description) {
5703 return std::result::Result::Err(A::Error::duplicate_field(
5704 "multiple values for description",
5705 ));
5706 }
5707 result.description = map
5708 .next_value::<std::option::Option<std::string::String>>()?
5709 .unwrap_or_default();
5710 }
5711 __FieldTag::__etag => {
5712 if !fields.insert(__FieldTag::__etag) {
5713 return std::result::Result::Err(A::Error::duplicate_field(
5714 "multiple values for etag",
5715 ));
5716 }
5717 result.etag = map
5718 .next_value::<std::option::Option<std::string::String>>()?
5719 .unwrap_or_default();
5720 }
5721 __FieldTag::__annotations => {
5722 if !fields.insert(__FieldTag::__annotations) {
5723 return std::result::Result::Err(A::Error::duplicate_field(
5724 "multiple values for annotations",
5725 ));
5726 }
5727 result.annotations = map
5728 .next_value::<std::option::Option<
5729 std::collections::HashMap<
5730 std::string::String,
5731 std::string::String,
5732 >,
5733 >>()?
5734 .unwrap_or_default();
5735 }
5736 __FieldTag::__reconciling => {
5737 if !fields.insert(__FieldTag::__reconciling) {
5738 return std::result::Result::Err(A::Error::duplicate_field(
5739 "multiple values for reconciling",
5740 ));
5741 }
5742 result.reconciling = map
5743 .next_value::<std::option::Option<bool>>()?
5744 .unwrap_or_default();
5745 }
5746 __FieldTag::__desired_posture_id => {
5747 if !fields.insert(__FieldTag::__desired_posture_id) {
5748 return std::result::Result::Err(A::Error::duplicate_field(
5749 "multiple values for desired_posture_id",
5750 ));
5751 }
5752 result.desired_posture_id = map
5753 .next_value::<std::option::Option<std::string::String>>()?
5754 .unwrap_or_default();
5755 }
5756 __FieldTag::__desired_posture_revision_id => {
5757 if !fields.insert(__FieldTag::__desired_posture_revision_id) {
5758 return std::result::Result::Err(A::Error::duplicate_field(
5759 "multiple values for desired_posture_revision_id",
5760 ));
5761 }
5762 result.desired_posture_revision_id = map
5763 .next_value::<std::option::Option<std::string::String>>()?
5764 .unwrap_or_default();
5765 }
5766 __FieldTag::__failure_message => {
5767 if !fields.insert(__FieldTag::__failure_message) {
5768 return std::result::Result::Err(A::Error::duplicate_field(
5769 "multiple values for failure_message",
5770 ));
5771 }
5772 result.failure_message = map
5773 .next_value::<std::option::Option<std::string::String>>()?
5774 .unwrap_or_default();
5775 }
5776 __FieldTag::Unknown(key) => {
5777 let value = map.next_value::<serde_json::Value>()?;
5778 result._unknown_fields.insert(key, value);
5779 }
5780 }
5781 }
5782 std::result::Result::Ok(result)
5783 }
5784 }
5785 deserializer.deserialize_any(Visitor)
5786 }
5787}
5788
5789#[doc(hidden)]
5790impl serde::ser::Serialize for PostureDeployment {
5791 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5792 where
5793 S: serde::ser::Serializer,
5794 {
5795 use serde::ser::SerializeMap;
5796 #[allow(unused_imports)]
5797 use std::option::Option::Some;
5798 let mut state = serializer.serialize_map(std::option::Option::None)?;
5799 if !self.name.is_empty() {
5800 state.serialize_entry("name", &self.name)?;
5801 }
5802 if !self.target_resource.is_empty() {
5803 state.serialize_entry("targetResource", &self.target_resource)?;
5804 }
5805 if !wkt::internal::is_default(&self.state) {
5806 state.serialize_entry("state", &self.state)?;
5807 }
5808 if !self.posture_id.is_empty() {
5809 state.serialize_entry("postureId", &self.posture_id)?;
5810 }
5811 if !self.posture_revision_id.is_empty() {
5812 state.serialize_entry("postureRevisionId", &self.posture_revision_id)?;
5813 }
5814 if self.create_time.is_some() {
5815 state.serialize_entry("createTime", &self.create_time)?;
5816 }
5817 if self.update_time.is_some() {
5818 state.serialize_entry("updateTime", &self.update_time)?;
5819 }
5820 if !self.description.is_empty() {
5821 state.serialize_entry("description", &self.description)?;
5822 }
5823 if !self.etag.is_empty() {
5824 state.serialize_entry("etag", &self.etag)?;
5825 }
5826 if !self.annotations.is_empty() {
5827 state.serialize_entry("annotations", &self.annotations)?;
5828 }
5829 if !wkt::internal::is_default(&self.reconciling) {
5830 state.serialize_entry("reconciling", &self.reconciling)?;
5831 }
5832 if !self.desired_posture_id.is_empty() {
5833 state.serialize_entry("desiredPostureId", &self.desired_posture_id)?;
5834 }
5835 if !self.desired_posture_revision_id.is_empty() {
5836 state.serialize_entry(
5837 "desiredPostureRevisionId",
5838 &self.desired_posture_revision_id,
5839 )?;
5840 }
5841 if !self.failure_message.is_empty() {
5842 state.serialize_entry("failureMessage", &self.failure_message)?;
5843 }
5844 if !self._unknown_fields.is_empty() {
5845 for (key, value) in self._unknown_fields.iter() {
5846 state.serialize_entry(key, &value)?;
5847 }
5848 }
5849 state.end()
5850 }
5851}
5852
5853impl std::fmt::Debug for PostureDeployment {
5854 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5855 let mut debug_struct = f.debug_struct("PostureDeployment");
5856 debug_struct.field("name", &self.name);
5857 debug_struct.field("target_resource", &self.target_resource);
5858 debug_struct.field("state", &self.state);
5859 debug_struct.field("posture_id", &self.posture_id);
5860 debug_struct.field("posture_revision_id", &self.posture_revision_id);
5861 debug_struct.field("create_time", &self.create_time);
5862 debug_struct.field("update_time", &self.update_time);
5863 debug_struct.field("description", &self.description);
5864 debug_struct.field("etag", &self.etag);
5865 debug_struct.field("annotations", &self.annotations);
5866 debug_struct.field("reconciling", &self.reconciling);
5867 debug_struct.field("desired_posture_id", &self.desired_posture_id);
5868 debug_struct.field(
5869 "desired_posture_revision_id",
5870 &self.desired_posture_revision_id,
5871 );
5872 debug_struct.field("failure_message", &self.failure_message);
5873 if !self._unknown_fields.is_empty() {
5874 debug_struct.field("_unknown_fields", &self._unknown_fields);
5875 }
5876 debug_struct.finish()
5877 }
5878}
5879
5880pub mod posture_deployment {
5882 #[allow(unused_imports)]
5883 use super::*;
5884
5885 #[derive(Clone, Debug, PartialEq)]
5901 #[non_exhaustive]
5902 pub enum State {
5903 Unspecified,
5905 Creating,
5907 Deleting,
5909 Updating,
5911 Active,
5913 CreateFailed,
5915 UpdateFailed,
5917 DeleteFailed,
5919 UnknownValue(state::UnknownValue),
5924 }
5925
5926 #[doc(hidden)]
5927 pub mod state {
5928 #[allow(unused_imports)]
5929 use super::*;
5930 #[derive(Clone, Debug, PartialEq)]
5931 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5932 }
5933
5934 impl State {
5935 pub fn value(&self) -> std::option::Option<i32> {
5940 match self {
5941 Self::Unspecified => std::option::Option::Some(0),
5942 Self::Creating => std::option::Option::Some(1),
5943 Self::Deleting => std::option::Option::Some(2),
5944 Self::Updating => std::option::Option::Some(3),
5945 Self::Active => std::option::Option::Some(4),
5946 Self::CreateFailed => std::option::Option::Some(5),
5947 Self::UpdateFailed => std::option::Option::Some(6),
5948 Self::DeleteFailed => std::option::Option::Some(7),
5949 Self::UnknownValue(u) => u.0.value(),
5950 }
5951 }
5952
5953 pub fn name(&self) -> std::option::Option<&str> {
5958 match self {
5959 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
5960 Self::Creating => std::option::Option::Some("CREATING"),
5961 Self::Deleting => std::option::Option::Some("DELETING"),
5962 Self::Updating => std::option::Option::Some("UPDATING"),
5963 Self::Active => std::option::Option::Some("ACTIVE"),
5964 Self::CreateFailed => std::option::Option::Some("CREATE_FAILED"),
5965 Self::UpdateFailed => std::option::Option::Some("UPDATE_FAILED"),
5966 Self::DeleteFailed => std::option::Option::Some("DELETE_FAILED"),
5967 Self::UnknownValue(u) => u.0.name(),
5968 }
5969 }
5970 }
5971
5972 impl std::default::Default for State {
5973 fn default() -> Self {
5974 use std::convert::From;
5975 Self::from(0)
5976 }
5977 }
5978
5979 impl std::fmt::Display for State {
5980 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5981 wkt::internal::display_enum(f, self.name(), self.value())
5982 }
5983 }
5984
5985 impl std::convert::From<i32> for State {
5986 fn from(value: i32) -> Self {
5987 match value {
5988 0 => Self::Unspecified,
5989 1 => Self::Creating,
5990 2 => Self::Deleting,
5991 3 => Self::Updating,
5992 4 => Self::Active,
5993 5 => Self::CreateFailed,
5994 6 => Self::UpdateFailed,
5995 7 => Self::DeleteFailed,
5996 _ => Self::UnknownValue(state::UnknownValue(
5997 wkt::internal::UnknownEnumValue::Integer(value),
5998 )),
5999 }
6000 }
6001 }
6002
6003 impl std::convert::From<&str> for State {
6004 fn from(value: &str) -> Self {
6005 use std::string::ToString;
6006 match value {
6007 "STATE_UNSPECIFIED" => Self::Unspecified,
6008 "CREATING" => Self::Creating,
6009 "DELETING" => Self::Deleting,
6010 "UPDATING" => Self::Updating,
6011 "ACTIVE" => Self::Active,
6012 "CREATE_FAILED" => Self::CreateFailed,
6013 "UPDATE_FAILED" => Self::UpdateFailed,
6014 "DELETE_FAILED" => Self::DeleteFailed,
6015 _ => Self::UnknownValue(state::UnknownValue(
6016 wkt::internal::UnknownEnumValue::String(value.to_string()),
6017 )),
6018 }
6019 }
6020 }
6021
6022 impl serde::ser::Serialize for State {
6023 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6024 where
6025 S: serde::Serializer,
6026 {
6027 match self {
6028 Self::Unspecified => serializer.serialize_i32(0),
6029 Self::Creating => serializer.serialize_i32(1),
6030 Self::Deleting => serializer.serialize_i32(2),
6031 Self::Updating => serializer.serialize_i32(3),
6032 Self::Active => serializer.serialize_i32(4),
6033 Self::CreateFailed => serializer.serialize_i32(5),
6034 Self::UpdateFailed => serializer.serialize_i32(6),
6035 Self::DeleteFailed => serializer.serialize_i32(7),
6036 Self::UnknownValue(u) => u.0.serialize(serializer),
6037 }
6038 }
6039 }
6040
6041 impl<'de> serde::de::Deserialize<'de> for State {
6042 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6043 where
6044 D: serde::Deserializer<'de>,
6045 {
6046 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
6047 ".google.cloud.securityposture.v1.PostureDeployment.State",
6048 ))
6049 }
6050 }
6051}
6052
6053#[derive(Clone, Default, PartialEq)]
6055#[non_exhaustive]
6056pub struct ListPostureDeploymentsRequest {
6057 pub parent: std::string::String,
6059
6060 pub page_size: i32,
6063
6064 pub page_token: std::string::String,
6066
6067 pub filter: std::string::String,
6070
6071 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6072}
6073
6074impl ListPostureDeploymentsRequest {
6075 pub fn new() -> Self {
6076 std::default::Default::default()
6077 }
6078
6079 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6081 self.parent = v.into();
6082 self
6083 }
6084
6085 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6087 self.page_size = v.into();
6088 self
6089 }
6090
6091 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6093 self.page_token = v.into();
6094 self
6095 }
6096
6097 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6099 self.filter = v.into();
6100 self
6101 }
6102}
6103
6104impl wkt::message::Message for ListPostureDeploymentsRequest {
6105 fn typename() -> &'static str {
6106 "type.googleapis.com/google.cloud.securityposture.v1.ListPostureDeploymentsRequest"
6107 }
6108}
6109
6110#[doc(hidden)]
6111impl<'de> serde::de::Deserialize<'de> for ListPostureDeploymentsRequest {
6112 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6113 where
6114 D: serde::Deserializer<'de>,
6115 {
6116 #[allow(non_camel_case_types)]
6117 #[doc(hidden)]
6118 #[derive(PartialEq, Eq, Hash)]
6119 enum __FieldTag {
6120 __parent,
6121 __page_size,
6122 __page_token,
6123 __filter,
6124 Unknown(std::string::String),
6125 }
6126 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6127 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6128 where
6129 D: serde::Deserializer<'de>,
6130 {
6131 struct Visitor;
6132 impl<'de> serde::de::Visitor<'de> for Visitor {
6133 type Value = __FieldTag;
6134 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6135 formatter.write_str("a field name for ListPostureDeploymentsRequest")
6136 }
6137 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6138 where
6139 E: serde::de::Error,
6140 {
6141 use std::result::Result::Ok;
6142 use std::string::ToString;
6143 match value {
6144 "parent" => Ok(__FieldTag::__parent),
6145 "pageSize" => Ok(__FieldTag::__page_size),
6146 "page_size" => Ok(__FieldTag::__page_size),
6147 "pageToken" => Ok(__FieldTag::__page_token),
6148 "page_token" => Ok(__FieldTag::__page_token),
6149 "filter" => Ok(__FieldTag::__filter),
6150 _ => Ok(__FieldTag::Unknown(value.to_string())),
6151 }
6152 }
6153 }
6154 deserializer.deserialize_identifier(Visitor)
6155 }
6156 }
6157 struct Visitor;
6158 impl<'de> serde::de::Visitor<'de> for Visitor {
6159 type Value = ListPostureDeploymentsRequest;
6160 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6161 formatter.write_str("struct ListPostureDeploymentsRequest")
6162 }
6163 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6164 where
6165 A: serde::de::MapAccess<'de>,
6166 {
6167 #[allow(unused_imports)]
6168 use serde::de::Error;
6169 use std::option::Option::Some;
6170 let mut fields = std::collections::HashSet::new();
6171 let mut result = Self::Value::new();
6172 while let Some(tag) = map.next_key::<__FieldTag>()? {
6173 #[allow(clippy::match_single_binding)]
6174 match tag {
6175 __FieldTag::__parent => {
6176 if !fields.insert(__FieldTag::__parent) {
6177 return std::result::Result::Err(A::Error::duplicate_field(
6178 "multiple values for parent",
6179 ));
6180 }
6181 result.parent = map
6182 .next_value::<std::option::Option<std::string::String>>()?
6183 .unwrap_or_default();
6184 }
6185 __FieldTag::__page_size => {
6186 if !fields.insert(__FieldTag::__page_size) {
6187 return std::result::Result::Err(A::Error::duplicate_field(
6188 "multiple values for page_size",
6189 ));
6190 }
6191 struct __With(std::option::Option<i32>);
6192 impl<'de> serde::de::Deserialize<'de> for __With {
6193 fn deserialize<D>(
6194 deserializer: D,
6195 ) -> std::result::Result<Self, D::Error>
6196 where
6197 D: serde::de::Deserializer<'de>,
6198 {
6199 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
6200 }
6201 }
6202 result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
6203 }
6204 __FieldTag::__page_token => {
6205 if !fields.insert(__FieldTag::__page_token) {
6206 return std::result::Result::Err(A::Error::duplicate_field(
6207 "multiple values for page_token",
6208 ));
6209 }
6210 result.page_token = map
6211 .next_value::<std::option::Option<std::string::String>>()?
6212 .unwrap_or_default();
6213 }
6214 __FieldTag::__filter => {
6215 if !fields.insert(__FieldTag::__filter) {
6216 return std::result::Result::Err(A::Error::duplicate_field(
6217 "multiple values for filter",
6218 ));
6219 }
6220 result.filter = map
6221 .next_value::<std::option::Option<std::string::String>>()?
6222 .unwrap_or_default();
6223 }
6224 __FieldTag::Unknown(key) => {
6225 let value = map.next_value::<serde_json::Value>()?;
6226 result._unknown_fields.insert(key, value);
6227 }
6228 }
6229 }
6230 std::result::Result::Ok(result)
6231 }
6232 }
6233 deserializer.deserialize_any(Visitor)
6234 }
6235}
6236
6237#[doc(hidden)]
6238impl serde::ser::Serialize for ListPostureDeploymentsRequest {
6239 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6240 where
6241 S: serde::ser::Serializer,
6242 {
6243 use serde::ser::SerializeMap;
6244 #[allow(unused_imports)]
6245 use std::option::Option::Some;
6246 let mut state = serializer.serialize_map(std::option::Option::None)?;
6247 if !self.parent.is_empty() {
6248 state.serialize_entry("parent", &self.parent)?;
6249 }
6250 if !wkt::internal::is_default(&self.page_size) {
6251 struct __With<'a>(&'a i32);
6252 impl<'a> serde::ser::Serialize for __With<'a> {
6253 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6254 where
6255 S: serde::ser::Serializer,
6256 {
6257 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
6258 }
6259 }
6260 state.serialize_entry("pageSize", &__With(&self.page_size))?;
6261 }
6262 if !self.page_token.is_empty() {
6263 state.serialize_entry("pageToken", &self.page_token)?;
6264 }
6265 if !self.filter.is_empty() {
6266 state.serialize_entry("filter", &self.filter)?;
6267 }
6268 if !self._unknown_fields.is_empty() {
6269 for (key, value) in self._unknown_fields.iter() {
6270 state.serialize_entry(key, &value)?;
6271 }
6272 }
6273 state.end()
6274 }
6275}
6276
6277impl std::fmt::Debug for ListPostureDeploymentsRequest {
6278 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6279 let mut debug_struct = f.debug_struct("ListPostureDeploymentsRequest");
6280 debug_struct.field("parent", &self.parent);
6281 debug_struct.field("page_size", &self.page_size);
6282 debug_struct.field("page_token", &self.page_token);
6283 debug_struct.field("filter", &self.filter);
6284 if !self._unknown_fields.is_empty() {
6285 debug_struct.field("_unknown_fields", &self._unknown_fields);
6286 }
6287 debug_struct.finish()
6288 }
6289}
6290
6291#[derive(Clone, Default, PartialEq)]
6293#[non_exhaustive]
6294pub struct ListPostureDeploymentsResponse {
6295 pub posture_deployments: std::vec::Vec<crate::model::PostureDeployment>,
6297
6298 pub next_page_token: std::string::String,
6300
6301 pub unreachable: std::vec::Vec<std::string::String>,
6303
6304 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6305}
6306
6307impl ListPostureDeploymentsResponse {
6308 pub fn new() -> Self {
6309 std::default::Default::default()
6310 }
6311
6312 pub fn set_posture_deployments<T, V>(mut self, v: T) -> Self
6314 where
6315 T: std::iter::IntoIterator<Item = V>,
6316 V: std::convert::Into<crate::model::PostureDeployment>,
6317 {
6318 use std::iter::Iterator;
6319 self.posture_deployments = v.into_iter().map(|i| i.into()).collect();
6320 self
6321 }
6322
6323 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6325 self.next_page_token = v.into();
6326 self
6327 }
6328
6329 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
6331 where
6332 T: std::iter::IntoIterator<Item = V>,
6333 V: std::convert::Into<std::string::String>,
6334 {
6335 use std::iter::Iterator;
6336 self.unreachable = v.into_iter().map(|i| i.into()).collect();
6337 self
6338 }
6339}
6340
6341impl wkt::message::Message for ListPostureDeploymentsResponse {
6342 fn typename() -> &'static str {
6343 "type.googleapis.com/google.cloud.securityposture.v1.ListPostureDeploymentsResponse"
6344 }
6345}
6346
6347#[doc(hidden)]
6348impl gax::paginator::internal::PageableResponse for ListPostureDeploymentsResponse {
6349 type PageItem = crate::model::PostureDeployment;
6350
6351 fn items(self) -> std::vec::Vec<Self::PageItem> {
6352 self.posture_deployments
6353 }
6354
6355 fn next_page_token(&self) -> std::string::String {
6356 use std::clone::Clone;
6357 self.next_page_token.clone()
6358 }
6359}
6360
6361#[doc(hidden)]
6362impl<'de> serde::de::Deserialize<'de> for ListPostureDeploymentsResponse {
6363 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6364 where
6365 D: serde::Deserializer<'de>,
6366 {
6367 #[allow(non_camel_case_types)]
6368 #[doc(hidden)]
6369 #[derive(PartialEq, Eq, Hash)]
6370 enum __FieldTag {
6371 __posture_deployments,
6372 __next_page_token,
6373 __unreachable,
6374 Unknown(std::string::String),
6375 }
6376 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6377 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6378 where
6379 D: serde::Deserializer<'de>,
6380 {
6381 struct Visitor;
6382 impl<'de> serde::de::Visitor<'de> for Visitor {
6383 type Value = __FieldTag;
6384 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6385 formatter.write_str("a field name for ListPostureDeploymentsResponse")
6386 }
6387 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6388 where
6389 E: serde::de::Error,
6390 {
6391 use std::result::Result::Ok;
6392 use std::string::ToString;
6393 match value {
6394 "postureDeployments" => Ok(__FieldTag::__posture_deployments),
6395 "posture_deployments" => Ok(__FieldTag::__posture_deployments),
6396 "nextPageToken" => Ok(__FieldTag::__next_page_token),
6397 "next_page_token" => Ok(__FieldTag::__next_page_token),
6398 "unreachable" => Ok(__FieldTag::__unreachable),
6399 _ => Ok(__FieldTag::Unknown(value.to_string())),
6400 }
6401 }
6402 }
6403 deserializer.deserialize_identifier(Visitor)
6404 }
6405 }
6406 struct Visitor;
6407 impl<'de> serde::de::Visitor<'de> for Visitor {
6408 type Value = ListPostureDeploymentsResponse;
6409 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6410 formatter.write_str("struct ListPostureDeploymentsResponse")
6411 }
6412 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6413 where
6414 A: serde::de::MapAccess<'de>,
6415 {
6416 #[allow(unused_imports)]
6417 use serde::de::Error;
6418 use std::option::Option::Some;
6419 let mut fields = std::collections::HashSet::new();
6420 let mut result = Self::Value::new();
6421 while let Some(tag) = map.next_key::<__FieldTag>()? {
6422 #[allow(clippy::match_single_binding)]
6423 match tag {
6424 __FieldTag::__posture_deployments => {
6425 if !fields.insert(__FieldTag::__posture_deployments) {
6426 return std::result::Result::Err(A::Error::duplicate_field(
6427 "multiple values for posture_deployments",
6428 ));
6429 }
6430 result.posture_deployments =
6431 map.next_value::<std::option::Option<
6432 std::vec::Vec<crate::model::PostureDeployment>,
6433 >>()?
6434 .unwrap_or_default();
6435 }
6436 __FieldTag::__next_page_token => {
6437 if !fields.insert(__FieldTag::__next_page_token) {
6438 return std::result::Result::Err(A::Error::duplicate_field(
6439 "multiple values for next_page_token",
6440 ));
6441 }
6442 result.next_page_token = map
6443 .next_value::<std::option::Option<std::string::String>>()?
6444 .unwrap_or_default();
6445 }
6446 __FieldTag::__unreachable => {
6447 if !fields.insert(__FieldTag::__unreachable) {
6448 return std::result::Result::Err(A::Error::duplicate_field(
6449 "multiple values for unreachable",
6450 ));
6451 }
6452 result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
6453 }
6454 __FieldTag::Unknown(key) => {
6455 let value = map.next_value::<serde_json::Value>()?;
6456 result._unknown_fields.insert(key, value);
6457 }
6458 }
6459 }
6460 std::result::Result::Ok(result)
6461 }
6462 }
6463 deserializer.deserialize_any(Visitor)
6464 }
6465}
6466
6467#[doc(hidden)]
6468impl serde::ser::Serialize for ListPostureDeploymentsResponse {
6469 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6470 where
6471 S: serde::ser::Serializer,
6472 {
6473 use serde::ser::SerializeMap;
6474 #[allow(unused_imports)]
6475 use std::option::Option::Some;
6476 let mut state = serializer.serialize_map(std::option::Option::None)?;
6477 if !self.posture_deployments.is_empty() {
6478 state.serialize_entry("postureDeployments", &self.posture_deployments)?;
6479 }
6480 if !self.next_page_token.is_empty() {
6481 state.serialize_entry("nextPageToken", &self.next_page_token)?;
6482 }
6483 if !self.unreachable.is_empty() {
6484 state.serialize_entry("unreachable", &self.unreachable)?;
6485 }
6486 if !self._unknown_fields.is_empty() {
6487 for (key, value) in self._unknown_fields.iter() {
6488 state.serialize_entry(key, &value)?;
6489 }
6490 }
6491 state.end()
6492 }
6493}
6494
6495impl std::fmt::Debug for ListPostureDeploymentsResponse {
6496 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6497 let mut debug_struct = f.debug_struct("ListPostureDeploymentsResponse");
6498 debug_struct.field("posture_deployments", &self.posture_deployments);
6499 debug_struct.field("next_page_token", &self.next_page_token);
6500 debug_struct.field("unreachable", &self.unreachable);
6501 if !self._unknown_fields.is_empty() {
6502 debug_struct.field("_unknown_fields", &self._unknown_fields);
6503 }
6504 debug_struct.finish()
6505 }
6506}
6507
6508#[derive(Clone, Default, PartialEq)]
6510#[non_exhaustive]
6511pub struct GetPostureDeploymentRequest {
6512 pub name: std::string::String,
6514
6515 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6516}
6517
6518impl GetPostureDeploymentRequest {
6519 pub fn new() -> Self {
6520 std::default::Default::default()
6521 }
6522
6523 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6525 self.name = v.into();
6526 self
6527 }
6528}
6529
6530impl wkt::message::Message for GetPostureDeploymentRequest {
6531 fn typename() -> &'static str {
6532 "type.googleapis.com/google.cloud.securityposture.v1.GetPostureDeploymentRequest"
6533 }
6534}
6535
6536#[doc(hidden)]
6537impl<'de> serde::de::Deserialize<'de> for GetPostureDeploymentRequest {
6538 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6539 where
6540 D: serde::Deserializer<'de>,
6541 {
6542 #[allow(non_camel_case_types)]
6543 #[doc(hidden)]
6544 #[derive(PartialEq, Eq, Hash)]
6545 enum __FieldTag {
6546 __name,
6547 Unknown(std::string::String),
6548 }
6549 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6550 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6551 where
6552 D: serde::Deserializer<'de>,
6553 {
6554 struct Visitor;
6555 impl<'de> serde::de::Visitor<'de> for Visitor {
6556 type Value = __FieldTag;
6557 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6558 formatter.write_str("a field name for GetPostureDeploymentRequest")
6559 }
6560 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6561 where
6562 E: serde::de::Error,
6563 {
6564 use std::result::Result::Ok;
6565 use std::string::ToString;
6566 match value {
6567 "name" => Ok(__FieldTag::__name),
6568 _ => Ok(__FieldTag::Unknown(value.to_string())),
6569 }
6570 }
6571 }
6572 deserializer.deserialize_identifier(Visitor)
6573 }
6574 }
6575 struct Visitor;
6576 impl<'de> serde::de::Visitor<'de> for Visitor {
6577 type Value = GetPostureDeploymentRequest;
6578 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6579 formatter.write_str("struct GetPostureDeploymentRequest")
6580 }
6581 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6582 where
6583 A: serde::de::MapAccess<'de>,
6584 {
6585 #[allow(unused_imports)]
6586 use serde::de::Error;
6587 use std::option::Option::Some;
6588 let mut fields = std::collections::HashSet::new();
6589 let mut result = Self::Value::new();
6590 while let Some(tag) = map.next_key::<__FieldTag>()? {
6591 #[allow(clippy::match_single_binding)]
6592 match tag {
6593 __FieldTag::__name => {
6594 if !fields.insert(__FieldTag::__name) {
6595 return std::result::Result::Err(A::Error::duplicate_field(
6596 "multiple values for name",
6597 ));
6598 }
6599 result.name = map
6600 .next_value::<std::option::Option<std::string::String>>()?
6601 .unwrap_or_default();
6602 }
6603 __FieldTag::Unknown(key) => {
6604 let value = map.next_value::<serde_json::Value>()?;
6605 result._unknown_fields.insert(key, value);
6606 }
6607 }
6608 }
6609 std::result::Result::Ok(result)
6610 }
6611 }
6612 deserializer.deserialize_any(Visitor)
6613 }
6614}
6615
6616#[doc(hidden)]
6617impl serde::ser::Serialize for GetPostureDeploymentRequest {
6618 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6619 where
6620 S: serde::ser::Serializer,
6621 {
6622 use serde::ser::SerializeMap;
6623 #[allow(unused_imports)]
6624 use std::option::Option::Some;
6625 let mut state = serializer.serialize_map(std::option::Option::None)?;
6626 if !self.name.is_empty() {
6627 state.serialize_entry("name", &self.name)?;
6628 }
6629 if !self._unknown_fields.is_empty() {
6630 for (key, value) in self._unknown_fields.iter() {
6631 state.serialize_entry(key, &value)?;
6632 }
6633 }
6634 state.end()
6635 }
6636}
6637
6638impl std::fmt::Debug for GetPostureDeploymentRequest {
6639 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6640 let mut debug_struct = f.debug_struct("GetPostureDeploymentRequest");
6641 debug_struct.field("name", &self.name);
6642 if !self._unknown_fields.is_empty() {
6643 debug_struct.field("_unknown_fields", &self._unknown_fields);
6644 }
6645 debug_struct.finish()
6646 }
6647}
6648
6649#[derive(Clone, Default, PartialEq)]
6651#[non_exhaustive]
6652pub struct CreatePostureDeploymentRequest {
6653 pub parent: std::string::String,
6656
6657 pub posture_deployment_id: std::string::String,
6660
6661 pub posture_deployment: std::option::Option<crate::model::PostureDeployment>,
6663
6664 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6665}
6666
6667impl CreatePostureDeploymentRequest {
6668 pub fn new() -> Self {
6669 std::default::Default::default()
6670 }
6671
6672 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6674 self.parent = v.into();
6675 self
6676 }
6677
6678 pub fn set_posture_deployment_id<T: std::convert::Into<std::string::String>>(
6680 mut self,
6681 v: T,
6682 ) -> Self {
6683 self.posture_deployment_id = v.into();
6684 self
6685 }
6686
6687 pub fn set_posture_deployment<T>(mut self, v: T) -> Self
6689 where
6690 T: std::convert::Into<crate::model::PostureDeployment>,
6691 {
6692 self.posture_deployment = std::option::Option::Some(v.into());
6693 self
6694 }
6695
6696 pub fn set_or_clear_posture_deployment<T>(mut self, v: std::option::Option<T>) -> Self
6698 where
6699 T: std::convert::Into<crate::model::PostureDeployment>,
6700 {
6701 self.posture_deployment = v.map(|x| x.into());
6702 self
6703 }
6704}
6705
6706impl wkt::message::Message for CreatePostureDeploymentRequest {
6707 fn typename() -> &'static str {
6708 "type.googleapis.com/google.cloud.securityposture.v1.CreatePostureDeploymentRequest"
6709 }
6710}
6711
6712#[doc(hidden)]
6713impl<'de> serde::de::Deserialize<'de> for CreatePostureDeploymentRequest {
6714 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6715 where
6716 D: serde::Deserializer<'de>,
6717 {
6718 #[allow(non_camel_case_types)]
6719 #[doc(hidden)]
6720 #[derive(PartialEq, Eq, Hash)]
6721 enum __FieldTag {
6722 __parent,
6723 __posture_deployment_id,
6724 __posture_deployment,
6725 Unknown(std::string::String),
6726 }
6727 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6728 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6729 where
6730 D: serde::Deserializer<'de>,
6731 {
6732 struct Visitor;
6733 impl<'de> serde::de::Visitor<'de> for Visitor {
6734 type Value = __FieldTag;
6735 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6736 formatter.write_str("a field name for CreatePostureDeploymentRequest")
6737 }
6738 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6739 where
6740 E: serde::de::Error,
6741 {
6742 use std::result::Result::Ok;
6743 use std::string::ToString;
6744 match value {
6745 "parent" => Ok(__FieldTag::__parent),
6746 "postureDeploymentId" => Ok(__FieldTag::__posture_deployment_id),
6747 "posture_deployment_id" => Ok(__FieldTag::__posture_deployment_id),
6748 "postureDeployment" => Ok(__FieldTag::__posture_deployment),
6749 "posture_deployment" => Ok(__FieldTag::__posture_deployment),
6750 _ => Ok(__FieldTag::Unknown(value.to_string())),
6751 }
6752 }
6753 }
6754 deserializer.deserialize_identifier(Visitor)
6755 }
6756 }
6757 struct Visitor;
6758 impl<'de> serde::de::Visitor<'de> for Visitor {
6759 type Value = CreatePostureDeploymentRequest;
6760 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6761 formatter.write_str("struct CreatePostureDeploymentRequest")
6762 }
6763 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6764 where
6765 A: serde::de::MapAccess<'de>,
6766 {
6767 #[allow(unused_imports)]
6768 use serde::de::Error;
6769 use std::option::Option::Some;
6770 let mut fields = std::collections::HashSet::new();
6771 let mut result = Self::Value::new();
6772 while let Some(tag) = map.next_key::<__FieldTag>()? {
6773 #[allow(clippy::match_single_binding)]
6774 match tag {
6775 __FieldTag::__parent => {
6776 if !fields.insert(__FieldTag::__parent) {
6777 return std::result::Result::Err(A::Error::duplicate_field(
6778 "multiple values for parent",
6779 ));
6780 }
6781 result.parent = map
6782 .next_value::<std::option::Option<std::string::String>>()?
6783 .unwrap_or_default();
6784 }
6785 __FieldTag::__posture_deployment_id => {
6786 if !fields.insert(__FieldTag::__posture_deployment_id) {
6787 return std::result::Result::Err(A::Error::duplicate_field(
6788 "multiple values for posture_deployment_id",
6789 ));
6790 }
6791 result.posture_deployment_id = map
6792 .next_value::<std::option::Option<std::string::String>>()?
6793 .unwrap_or_default();
6794 }
6795 __FieldTag::__posture_deployment => {
6796 if !fields.insert(__FieldTag::__posture_deployment) {
6797 return std::result::Result::Err(A::Error::duplicate_field(
6798 "multiple values for posture_deployment",
6799 ));
6800 }
6801 result.posture_deployment = map
6802 .next_value::<std::option::Option<crate::model::PostureDeployment>>(
6803 )?;
6804 }
6805 __FieldTag::Unknown(key) => {
6806 let value = map.next_value::<serde_json::Value>()?;
6807 result._unknown_fields.insert(key, value);
6808 }
6809 }
6810 }
6811 std::result::Result::Ok(result)
6812 }
6813 }
6814 deserializer.deserialize_any(Visitor)
6815 }
6816}
6817
6818#[doc(hidden)]
6819impl serde::ser::Serialize for CreatePostureDeploymentRequest {
6820 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6821 where
6822 S: serde::ser::Serializer,
6823 {
6824 use serde::ser::SerializeMap;
6825 #[allow(unused_imports)]
6826 use std::option::Option::Some;
6827 let mut state = serializer.serialize_map(std::option::Option::None)?;
6828 if !self.parent.is_empty() {
6829 state.serialize_entry("parent", &self.parent)?;
6830 }
6831 if !self.posture_deployment_id.is_empty() {
6832 state.serialize_entry("postureDeploymentId", &self.posture_deployment_id)?;
6833 }
6834 if self.posture_deployment.is_some() {
6835 state.serialize_entry("postureDeployment", &self.posture_deployment)?;
6836 }
6837 if !self._unknown_fields.is_empty() {
6838 for (key, value) in self._unknown_fields.iter() {
6839 state.serialize_entry(key, &value)?;
6840 }
6841 }
6842 state.end()
6843 }
6844}
6845
6846impl std::fmt::Debug for CreatePostureDeploymentRequest {
6847 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6848 let mut debug_struct = f.debug_struct("CreatePostureDeploymentRequest");
6849 debug_struct.field("parent", &self.parent);
6850 debug_struct.field("posture_deployment_id", &self.posture_deployment_id);
6851 debug_struct.field("posture_deployment", &self.posture_deployment);
6852 if !self._unknown_fields.is_empty() {
6853 debug_struct.field("_unknown_fields", &self._unknown_fields);
6854 }
6855 debug_struct.finish()
6856 }
6857}
6858
6859#[derive(Clone, Default, PartialEq)]
6861#[non_exhaustive]
6862pub struct UpdatePostureDeploymentRequest {
6863 pub update_mask: std::option::Option<wkt::FieldMask>,
6869
6870 pub posture_deployment: std::option::Option<crate::model::PostureDeployment>,
6872
6873 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6874}
6875
6876impl UpdatePostureDeploymentRequest {
6877 pub fn new() -> Self {
6878 std::default::Default::default()
6879 }
6880
6881 pub fn set_update_mask<T>(mut self, v: T) -> Self
6883 where
6884 T: std::convert::Into<wkt::FieldMask>,
6885 {
6886 self.update_mask = std::option::Option::Some(v.into());
6887 self
6888 }
6889
6890 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6892 where
6893 T: std::convert::Into<wkt::FieldMask>,
6894 {
6895 self.update_mask = v.map(|x| x.into());
6896 self
6897 }
6898
6899 pub fn set_posture_deployment<T>(mut self, v: T) -> Self
6901 where
6902 T: std::convert::Into<crate::model::PostureDeployment>,
6903 {
6904 self.posture_deployment = std::option::Option::Some(v.into());
6905 self
6906 }
6907
6908 pub fn set_or_clear_posture_deployment<T>(mut self, v: std::option::Option<T>) -> Self
6910 where
6911 T: std::convert::Into<crate::model::PostureDeployment>,
6912 {
6913 self.posture_deployment = v.map(|x| x.into());
6914 self
6915 }
6916}
6917
6918impl wkt::message::Message for UpdatePostureDeploymentRequest {
6919 fn typename() -> &'static str {
6920 "type.googleapis.com/google.cloud.securityposture.v1.UpdatePostureDeploymentRequest"
6921 }
6922}
6923
6924#[doc(hidden)]
6925impl<'de> serde::de::Deserialize<'de> for UpdatePostureDeploymentRequest {
6926 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6927 where
6928 D: serde::Deserializer<'de>,
6929 {
6930 #[allow(non_camel_case_types)]
6931 #[doc(hidden)]
6932 #[derive(PartialEq, Eq, Hash)]
6933 enum __FieldTag {
6934 __update_mask,
6935 __posture_deployment,
6936 Unknown(std::string::String),
6937 }
6938 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6939 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6940 where
6941 D: serde::Deserializer<'de>,
6942 {
6943 struct Visitor;
6944 impl<'de> serde::de::Visitor<'de> for Visitor {
6945 type Value = __FieldTag;
6946 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6947 formatter.write_str("a field name for UpdatePostureDeploymentRequest")
6948 }
6949 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6950 where
6951 E: serde::de::Error,
6952 {
6953 use std::result::Result::Ok;
6954 use std::string::ToString;
6955 match value {
6956 "updateMask" => Ok(__FieldTag::__update_mask),
6957 "update_mask" => Ok(__FieldTag::__update_mask),
6958 "postureDeployment" => Ok(__FieldTag::__posture_deployment),
6959 "posture_deployment" => Ok(__FieldTag::__posture_deployment),
6960 _ => Ok(__FieldTag::Unknown(value.to_string())),
6961 }
6962 }
6963 }
6964 deserializer.deserialize_identifier(Visitor)
6965 }
6966 }
6967 struct Visitor;
6968 impl<'de> serde::de::Visitor<'de> for Visitor {
6969 type Value = UpdatePostureDeploymentRequest;
6970 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6971 formatter.write_str("struct UpdatePostureDeploymentRequest")
6972 }
6973 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6974 where
6975 A: serde::de::MapAccess<'de>,
6976 {
6977 #[allow(unused_imports)]
6978 use serde::de::Error;
6979 use std::option::Option::Some;
6980 let mut fields = std::collections::HashSet::new();
6981 let mut result = Self::Value::new();
6982 while let Some(tag) = map.next_key::<__FieldTag>()? {
6983 #[allow(clippy::match_single_binding)]
6984 match tag {
6985 __FieldTag::__update_mask => {
6986 if !fields.insert(__FieldTag::__update_mask) {
6987 return std::result::Result::Err(A::Error::duplicate_field(
6988 "multiple values for update_mask",
6989 ));
6990 }
6991 result.update_mask =
6992 map.next_value::<std::option::Option<wkt::FieldMask>>()?;
6993 }
6994 __FieldTag::__posture_deployment => {
6995 if !fields.insert(__FieldTag::__posture_deployment) {
6996 return std::result::Result::Err(A::Error::duplicate_field(
6997 "multiple values for posture_deployment",
6998 ));
6999 }
7000 result.posture_deployment = map
7001 .next_value::<std::option::Option<crate::model::PostureDeployment>>(
7002 )?;
7003 }
7004 __FieldTag::Unknown(key) => {
7005 let value = map.next_value::<serde_json::Value>()?;
7006 result._unknown_fields.insert(key, value);
7007 }
7008 }
7009 }
7010 std::result::Result::Ok(result)
7011 }
7012 }
7013 deserializer.deserialize_any(Visitor)
7014 }
7015}
7016
7017#[doc(hidden)]
7018impl serde::ser::Serialize for UpdatePostureDeploymentRequest {
7019 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7020 where
7021 S: serde::ser::Serializer,
7022 {
7023 use serde::ser::SerializeMap;
7024 #[allow(unused_imports)]
7025 use std::option::Option::Some;
7026 let mut state = serializer.serialize_map(std::option::Option::None)?;
7027 if self.update_mask.is_some() {
7028 state.serialize_entry("updateMask", &self.update_mask)?;
7029 }
7030 if self.posture_deployment.is_some() {
7031 state.serialize_entry("postureDeployment", &self.posture_deployment)?;
7032 }
7033 if !self._unknown_fields.is_empty() {
7034 for (key, value) in self._unknown_fields.iter() {
7035 state.serialize_entry(key, &value)?;
7036 }
7037 }
7038 state.end()
7039 }
7040}
7041
7042impl std::fmt::Debug for UpdatePostureDeploymentRequest {
7043 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7044 let mut debug_struct = f.debug_struct("UpdatePostureDeploymentRequest");
7045 debug_struct.field("update_mask", &self.update_mask);
7046 debug_struct.field("posture_deployment", &self.posture_deployment);
7047 if !self._unknown_fields.is_empty() {
7048 debug_struct.field("_unknown_fields", &self._unknown_fields);
7049 }
7050 debug_struct.finish()
7051 }
7052}
7053
7054#[derive(Clone, Default, PartialEq)]
7056#[non_exhaustive]
7057pub struct DeletePostureDeploymentRequest {
7058 pub name: std::string::String,
7060
7061 pub etag: std::string::String,
7063
7064 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7065}
7066
7067impl DeletePostureDeploymentRequest {
7068 pub fn new() -> Self {
7069 std::default::Default::default()
7070 }
7071
7072 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7074 self.name = v.into();
7075 self
7076 }
7077
7078 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7080 self.etag = v.into();
7081 self
7082 }
7083}
7084
7085impl wkt::message::Message for DeletePostureDeploymentRequest {
7086 fn typename() -> &'static str {
7087 "type.googleapis.com/google.cloud.securityposture.v1.DeletePostureDeploymentRequest"
7088 }
7089}
7090
7091#[doc(hidden)]
7092impl<'de> serde::de::Deserialize<'de> for DeletePostureDeploymentRequest {
7093 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7094 where
7095 D: serde::Deserializer<'de>,
7096 {
7097 #[allow(non_camel_case_types)]
7098 #[doc(hidden)]
7099 #[derive(PartialEq, Eq, Hash)]
7100 enum __FieldTag {
7101 __name,
7102 __etag,
7103 Unknown(std::string::String),
7104 }
7105 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7106 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7107 where
7108 D: serde::Deserializer<'de>,
7109 {
7110 struct Visitor;
7111 impl<'de> serde::de::Visitor<'de> for Visitor {
7112 type Value = __FieldTag;
7113 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7114 formatter.write_str("a field name for DeletePostureDeploymentRequest")
7115 }
7116 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7117 where
7118 E: serde::de::Error,
7119 {
7120 use std::result::Result::Ok;
7121 use std::string::ToString;
7122 match value {
7123 "name" => Ok(__FieldTag::__name),
7124 "etag" => Ok(__FieldTag::__etag),
7125 _ => Ok(__FieldTag::Unknown(value.to_string())),
7126 }
7127 }
7128 }
7129 deserializer.deserialize_identifier(Visitor)
7130 }
7131 }
7132 struct Visitor;
7133 impl<'de> serde::de::Visitor<'de> for Visitor {
7134 type Value = DeletePostureDeploymentRequest;
7135 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7136 formatter.write_str("struct DeletePostureDeploymentRequest")
7137 }
7138 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7139 where
7140 A: serde::de::MapAccess<'de>,
7141 {
7142 #[allow(unused_imports)]
7143 use serde::de::Error;
7144 use std::option::Option::Some;
7145 let mut fields = std::collections::HashSet::new();
7146 let mut result = Self::Value::new();
7147 while let Some(tag) = map.next_key::<__FieldTag>()? {
7148 #[allow(clippy::match_single_binding)]
7149 match tag {
7150 __FieldTag::__name => {
7151 if !fields.insert(__FieldTag::__name) {
7152 return std::result::Result::Err(A::Error::duplicate_field(
7153 "multiple values for name",
7154 ));
7155 }
7156 result.name = map
7157 .next_value::<std::option::Option<std::string::String>>()?
7158 .unwrap_or_default();
7159 }
7160 __FieldTag::__etag => {
7161 if !fields.insert(__FieldTag::__etag) {
7162 return std::result::Result::Err(A::Error::duplicate_field(
7163 "multiple values for etag",
7164 ));
7165 }
7166 result.etag = map
7167 .next_value::<std::option::Option<std::string::String>>()?
7168 .unwrap_or_default();
7169 }
7170 __FieldTag::Unknown(key) => {
7171 let value = map.next_value::<serde_json::Value>()?;
7172 result._unknown_fields.insert(key, value);
7173 }
7174 }
7175 }
7176 std::result::Result::Ok(result)
7177 }
7178 }
7179 deserializer.deserialize_any(Visitor)
7180 }
7181}
7182
7183#[doc(hidden)]
7184impl serde::ser::Serialize for DeletePostureDeploymentRequest {
7185 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7186 where
7187 S: serde::ser::Serializer,
7188 {
7189 use serde::ser::SerializeMap;
7190 #[allow(unused_imports)]
7191 use std::option::Option::Some;
7192 let mut state = serializer.serialize_map(std::option::Option::None)?;
7193 if !self.name.is_empty() {
7194 state.serialize_entry("name", &self.name)?;
7195 }
7196 if !self.etag.is_empty() {
7197 state.serialize_entry("etag", &self.etag)?;
7198 }
7199 if !self._unknown_fields.is_empty() {
7200 for (key, value) in self._unknown_fields.iter() {
7201 state.serialize_entry(key, &value)?;
7202 }
7203 }
7204 state.end()
7205 }
7206}
7207
7208impl std::fmt::Debug for DeletePostureDeploymentRequest {
7209 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7210 let mut debug_struct = f.debug_struct("DeletePostureDeploymentRequest");
7211 debug_struct.field("name", &self.name);
7212 debug_struct.field("etag", &self.etag);
7213 if !self._unknown_fields.is_empty() {
7214 debug_struct.field("_unknown_fields", &self._unknown_fields);
7215 }
7216 debug_struct.finish()
7217 }
7218}
7219
7220#[derive(Clone, Default, PartialEq)]
7223#[non_exhaustive]
7224pub struct PostureTemplate {
7225 pub name: std::string::String,
7229
7230 pub revision_id: std::string::String,
7232
7233 pub description: std::string::String,
7235
7236 pub state: crate::model::posture_template::State,
7238
7239 pub policy_sets: std::vec::Vec<crate::model::PolicySet>,
7241
7242 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7243}
7244
7245impl PostureTemplate {
7246 pub fn new() -> Self {
7247 std::default::Default::default()
7248 }
7249
7250 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7252 self.name = v.into();
7253 self
7254 }
7255
7256 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7258 self.revision_id = v.into();
7259 self
7260 }
7261
7262 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7264 self.description = v.into();
7265 self
7266 }
7267
7268 pub fn set_state<T: std::convert::Into<crate::model::posture_template::State>>(
7270 mut self,
7271 v: T,
7272 ) -> Self {
7273 self.state = v.into();
7274 self
7275 }
7276
7277 pub fn set_policy_sets<T, V>(mut self, v: T) -> Self
7279 where
7280 T: std::iter::IntoIterator<Item = V>,
7281 V: std::convert::Into<crate::model::PolicySet>,
7282 {
7283 use std::iter::Iterator;
7284 self.policy_sets = v.into_iter().map(|i| i.into()).collect();
7285 self
7286 }
7287}
7288
7289impl wkt::message::Message for PostureTemplate {
7290 fn typename() -> &'static str {
7291 "type.googleapis.com/google.cloud.securityposture.v1.PostureTemplate"
7292 }
7293}
7294
7295#[doc(hidden)]
7296impl<'de> serde::de::Deserialize<'de> for PostureTemplate {
7297 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7298 where
7299 D: serde::Deserializer<'de>,
7300 {
7301 #[allow(non_camel_case_types)]
7302 #[doc(hidden)]
7303 #[derive(PartialEq, Eq, Hash)]
7304 enum __FieldTag {
7305 __name,
7306 __revision_id,
7307 __description,
7308 __state,
7309 __policy_sets,
7310 Unknown(std::string::String),
7311 }
7312 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7313 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7314 where
7315 D: serde::Deserializer<'de>,
7316 {
7317 struct Visitor;
7318 impl<'de> serde::de::Visitor<'de> for Visitor {
7319 type Value = __FieldTag;
7320 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7321 formatter.write_str("a field name for PostureTemplate")
7322 }
7323 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7324 where
7325 E: serde::de::Error,
7326 {
7327 use std::result::Result::Ok;
7328 use std::string::ToString;
7329 match value {
7330 "name" => Ok(__FieldTag::__name),
7331 "revisionId" => Ok(__FieldTag::__revision_id),
7332 "revision_id" => Ok(__FieldTag::__revision_id),
7333 "description" => Ok(__FieldTag::__description),
7334 "state" => Ok(__FieldTag::__state),
7335 "policySets" => Ok(__FieldTag::__policy_sets),
7336 "policy_sets" => Ok(__FieldTag::__policy_sets),
7337 _ => Ok(__FieldTag::Unknown(value.to_string())),
7338 }
7339 }
7340 }
7341 deserializer.deserialize_identifier(Visitor)
7342 }
7343 }
7344 struct Visitor;
7345 impl<'de> serde::de::Visitor<'de> for Visitor {
7346 type Value = PostureTemplate;
7347 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7348 formatter.write_str("struct PostureTemplate")
7349 }
7350 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7351 where
7352 A: serde::de::MapAccess<'de>,
7353 {
7354 #[allow(unused_imports)]
7355 use serde::de::Error;
7356 use std::option::Option::Some;
7357 let mut fields = std::collections::HashSet::new();
7358 let mut result = Self::Value::new();
7359 while let Some(tag) = map.next_key::<__FieldTag>()? {
7360 #[allow(clippy::match_single_binding)]
7361 match tag {
7362 __FieldTag::__name => {
7363 if !fields.insert(__FieldTag::__name) {
7364 return std::result::Result::Err(A::Error::duplicate_field(
7365 "multiple values for name",
7366 ));
7367 }
7368 result.name = map
7369 .next_value::<std::option::Option<std::string::String>>()?
7370 .unwrap_or_default();
7371 }
7372 __FieldTag::__revision_id => {
7373 if !fields.insert(__FieldTag::__revision_id) {
7374 return std::result::Result::Err(A::Error::duplicate_field(
7375 "multiple values for revision_id",
7376 ));
7377 }
7378 result.revision_id = map
7379 .next_value::<std::option::Option<std::string::String>>()?
7380 .unwrap_or_default();
7381 }
7382 __FieldTag::__description => {
7383 if !fields.insert(__FieldTag::__description) {
7384 return std::result::Result::Err(A::Error::duplicate_field(
7385 "multiple values for description",
7386 ));
7387 }
7388 result.description = map
7389 .next_value::<std::option::Option<std::string::String>>()?
7390 .unwrap_or_default();
7391 }
7392 __FieldTag::__state => {
7393 if !fields.insert(__FieldTag::__state) {
7394 return std::result::Result::Err(A::Error::duplicate_field(
7395 "multiple values for state",
7396 ));
7397 }
7398 result.state = map.next_value::<std::option::Option<crate::model::posture_template::State>>()?.unwrap_or_default();
7399 }
7400 __FieldTag::__policy_sets => {
7401 if !fields.insert(__FieldTag::__policy_sets) {
7402 return std::result::Result::Err(A::Error::duplicate_field(
7403 "multiple values for policy_sets",
7404 ));
7405 }
7406 result.policy_sets = map.next_value::<std::option::Option<std::vec::Vec<crate::model::PolicySet>>>()?.unwrap_or_default();
7407 }
7408 __FieldTag::Unknown(key) => {
7409 let value = map.next_value::<serde_json::Value>()?;
7410 result._unknown_fields.insert(key, value);
7411 }
7412 }
7413 }
7414 std::result::Result::Ok(result)
7415 }
7416 }
7417 deserializer.deserialize_any(Visitor)
7418 }
7419}
7420
7421#[doc(hidden)]
7422impl serde::ser::Serialize for PostureTemplate {
7423 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7424 where
7425 S: serde::ser::Serializer,
7426 {
7427 use serde::ser::SerializeMap;
7428 #[allow(unused_imports)]
7429 use std::option::Option::Some;
7430 let mut state = serializer.serialize_map(std::option::Option::None)?;
7431 if !self.name.is_empty() {
7432 state.serialize_entry("name", &self.name)?;
7433 }
7434 if !self.revision_id.is_empty() {
7435 state.serialize_entry("revisionId", &self.revision_id)?;
7436 }
7437 if !self.description.is_empty() {
7438 state.serialize_entry("description", &self.description)?;
7439 }
7440 if !wkt::internal::is_default(&self.state) {
7441 state.serialize_entry("state", &self.state)?;
7442 }
7443 if !self.policy_sets.is_empty() {
7444 state.serialize_entry("policySets", &self.policy_sets)?;
7445 }
7446 if !self._unknown_fields.is_empty() {
7447 for (key, value) in self._unknown_fields.iter() {
7448 state.serialize_entry(key, &value)?;
7449 }
7450 }
7451 state.end()
7452 }
7453}
7454
7455impl std::fmt::Debug for PostureTemplate {
7456 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7457 let mut debug_struct = f.debug_struct("PostureTemplate");
7458 debug_struct.field("name", &self.name);
7459 debug_struct.field("revision_id", &self.revision_id);
7460 debug_struct.field("description", &self.description);
7461 debug_struct.field("state", &self.state);
7462 debug_struct.field("policy_sets", &self.policy_sets);
7463 if !self._unknown_fields.is_empty() {
7464 debug_struct.field("_unknown_fields", &self._unknown_fields);
7465 }
7466 debug_struct.finish()
7467 }
7468}
7469
7470pub mod posture_template {
7472 #[allow(unused_imports)]
7473 use super::*;
7474
7475 #[derive(Clone, Debug, PartialEq)]
7491 #[non_exhaustive]
7492 pub enum State {
7493 Unspecified,
7495 Active,
7497 Deprecated,
7500 UnknownValue(state::UnknownValue),
7505 }
7506
7507 #[doc(hidden)]
7508 pub mod state {
7509 #[allow(unused_imports)]
7510 use super::*;
7511 #[derive(Clone, Debug, PartialEq)]
7512 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7513 }
7514
7515 impl State {
7516 pub fn value(&self) -> std::option::Option<i32> {
7521 match self {
7522 Self::Unspecified => std::option::Option::Some(0),
7523 Self::Active => std::option::Option::Some(1),
7524 Self::Deprecated => std::option::Option::Some(2),
7525 Self::UnknownValue(u) => u.0.value(),
7526 }
7527 }
7528
7529 pub fn name(&self) -> std::option::Option<&str> {
7534 match self {
7535 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
7536 Self::Active => std::option::Option::Some("ACTIVE"),
7537 Self::Deprecated => std::option::Option::Some("DEPRECATED"),
7538 Self::UnknownValue(u) => u.0.name(),
7539 }
7540 }
7541 }
7542
7543 impl std::default::Default for State {
7544 fn default() -> Self {
7545 use std::convert::From;
7546 Self::from(0)
7547 }
7548 }
7549
7550 impl std::fmt::Display for State {
7551 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7552 wkt::internal::display_enum(f, self.name(), self.value())
7553 }
7554 }
7555
7556 impl std::convert::From<i32> for State {
7557 fn from(value: i32) -> Self {
7558 match value {
7559 0 => Self::Unspecified,
7560 1 => Self::Active,
7561 2 => Self::Deprecated,
7562 _ => Self::UnknownValue(state::UnknownValue(
7563 wkt::internal::UnknownEnumValue::Integer(value),
7564 )),
7565 }
7566 }
7567 }
7568
7569 impl std::convert::From<&str> for State {
7570 fn from(value: &str) -> Self {
7571 use std::string::ToString;
7572 match value {
7573 "STATE_UNSPECIFIED" => Self::Unspecified,
7574 "ACTIVE" => Self::Active,
7575 "DEPRECATED" => Self::Deprecated,
7576 _ => Self::UnknownValue(state::UnknownValue(
7577 wkt::internal::UnknownEnumValue::String(value.to_string()),
7578 )),
7579 }
7580 }
7581 }
7582
7583 impl serde::ser::Serialize for State {
7584 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7585 where
7586 S: serde::Serializer,
7587 {
7588 match self {
7589 Self::Unspecified => serializer.serialize_i32(0),
7590 Self::Active => serializer.serialize_i32(1),
7591 Self::Deprecated => serializer.serialize_i32(2),
7592 Self::UnknownValue(u) => u.0.serialize(serializer),
7593 }
7594 }
7595 }
7596
7597 impl<'de> serde::de::Deserialize<'de> for State {
7598 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7599 where
7600 D: serde::Deserializer<'de>,
7601 {
7602 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
7603 ".google.cloud.securityposture.v1.PostureTemplate.State",
7604 ))
7605 }
7606 }
7607}
7608
7609#[derive(Clone, Default, PartialEq)]
7611#[non_exhaustive]
7612pub struct ListPostureTemplatesRequest {
7613 pub parent: std::string::String,
7615
7616 pub page_size: i32,
7619
7620 pub page_token: std::string::String,
7622
7623 pub filter: std::string::String,
7626
7627 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7628}
7629
7630impl ListPostureTemplatesRequest {
7631 pub fn new() -> Self {
7632 std::default::Default::default()
7633 }
7634
7635 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7637 self.parent = v.into();
7638 self
7639 }
7640
7641 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7643 self.page_size = v.into();
7644 self
7645 }
7646
7647 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7649 self.page_token = v.into();
7650 self
7651 }
7652
7653 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7655 self.filter = v.into();
7656 self
7657 }
7658}
7659
7660impl wkt::message::Message for ListPostureTemplatesRequest {
7661 fn typename() -> &'static str {
7662 "type.googleapis.com/google.cloud.securityposture.v1.ListPostureTemplatesRequest"
7663 }
7664}
7665
7666#[doc(hidden)]
7667impl<'de> serde::de::Deserialize<'de> for ListPostureTemplatesRequest {
7668 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7669 where
7670 D: serde::Deserializer<'de>,
7671 {
7672 #[allow(non_camel_case_types)]
7673 #[doc(hidden)]
7674 #[derive(PartialEq, Eq, Hash)]
7675 enum __FieldTag {
7676 __parent,
7677 __page_size,
7678 __page_token,
7679 __filter,
7680 Unknown(std::string::String),
7681 }
7682 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7683 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7684 where
7685 D: serde::Deserializer<'de>,
7686 {
7687 struct Visitor;
7688 impl<'de> serde::de::Visitor<'de> for Visitor {
7689 type Value = __FieldTag;
7690 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7691 formatter.write_str("a field name for ListPostureTemplatesRequest")
7692 }
7693 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7694 where
7695 E: serde::de::Error,
7696 {
7697 use std::result::Result::Ok;
7698 use std::string::ToString;
7699 match value {
7700 "parent" => Ok(__FieldTag::__parent),
7701 "pageSize" => Ok(__FieldTag::__page_size),
7702 "page_size" => Ok(__FieldTag::__page_size),
7703 "pageToken" => Ok(__FieldTag::__page_token),
7704 "page_token" => Ok(__FieldTag::__page_token),
7705 "filter" => Ok(__FieldTag::__filter),
7706 _ => Ok(__FieldTag::Unknown(value.to_string())),
7707 }
7708 }
7709 }
7710 deserializer.deserialize_identifier(Visitor)
7711 }
7712 }
7713 struct Visitor;
7714 impl<'de> serde::de::Visitor<'de> for Visitor {
7715 type Value = ListPostureTemplatesRequest;
7716 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7717 formatter.write_str("struct ListPostureTemplatesRequest")
7718 }
7719 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7720 where
7721 A: serde::de::MapAccess<'de>,
7722 {
7723 #[allow(unused_imports)]
7724 use serde::de::Error;
7725 use std::option::Option::Some;
7726 let mut fields = std::collections::HashSet::new();
7727 let mut result = Self::Value::new();
7728 while let Some(tag) = map.next_key::<__FieldTag>()? {
7729 #[allow(clippy::match_single_binding)]
7730 match tag {
7731 __FieldTag::__parent => {
7732 if !fields.insert(__FieldTag::__parent) {
7733 return std::result::Result::Err(A::Error::duplicate_field(
7734 "multiple values for parent",
7735 ));
7736 }
7737 result.parent = map
7738 .next_value::<std::option::Option<std::string::String>>()?
7739 .unwrap_or_default();
7740 }
7741 __FieldTag::__page_size => {
7742 if !fields.insert(__FieldTag::__page_size) {
7743 return std::result::Result::Err(A::Error::duplicate_field(
7744 "multiple values for page_size",
7745 ));
7746 }
7747 struct __With(std::option::Option<i32>);
7748 impl<'de> serde::de::Deserialize<'de> for __With {
7749 fn deserialize<D>(
7750 deserializer: D,
7751 ) -> std::result::Result<Self, D::Error>
7752 where
7753 D: serde::de::Deserializer<'de>,
7754 {
7755 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
7756 }
7757 }
7758 result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
7759 }
7760 __FieldTag::__page_token => {
7761 if !fields.insert(__FieldTag::__page_token) {
7762 return std::result::Result::Err(A::Error::duplicate_field(
7763 "multiple values for page_token",
7764 ));
7765 }
7766 result.page_token = map
7767 .next_value::<std::option::Option<std::string::String>>()?
7768 .unwrap_or_default();
7769 }
7770 __FieldTag::__filter => {
7771 if !fields.insert(__FieldTag::__filter) {
7772 return std::result::Result::Err(A::Error::duplicate_field(
7773 "multiple values for filter",
7774 ));
7775 }
7776 result.filter = map
7777 .next_value::<std::option::Option<std::string::String>>()?
7778 .unwrap_or_default();
7779 }
7780 __FieldTag::Unknown(key) => {
7781 let value = map.next_value::<serde_json::Value>()?;
7782 result._unknown_fields.insert(key, value);
7783 }
7784 }
7785 }
7786 std::result::Result::Ok(result)
7787 }
7788 }
7789 deserializer.deserialize_any(Visitor)
7790 }
7791}
7792
7793#[doc(hidden)]
7794impl serde::ser::Serialize for ListPostureTemplatesRequest {
7795 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7796 where
7797 S: serde::ser::Serializer,
7798 {
7799 use serde::ser::SerializeMap;
7800 #[allow(unused_imports)]
7801 use std::option::Option::Some;
7802 let mut state = serializer.serialize_map(std::option::Option::None)?;
7803 if !self.parent.is_empty() {
7804 state.serialize_entry("parent", &self.parent)?;
7805 }
7806 if !wkt::internal::is_default(&self.page_size) {
7807 struct __With<'a>(&'a i32);
7808 impl<'a> serde::ser::Serialize for __With<'a> {
7809 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7810 where
7811 S: serde::ser::Serializer,
7812 {
7813 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
7814 }
7815 }
7816 state.serialize_entry("pageSize", &__With(&self.page_size))?;
7817 }
7818 if !self.page_token.is_empty() {
7819 state.serialize_entry("pageToken", &self.page_token)?;
7820 }
7821 if !self.filter.is_empty() {
7822 state.serialize_entry("filter", &self.filter)?;
7823 }
7824 if !self._unknown_fields.is_empty() {
7825 for (key, value) in self._unknown_fields.iter() {
7826 state.serialize_entry(key, &value)?;
7827 }
7828 }
7829 state.end()
7830 }
7831}
7832
7833impl std::fmt::Debug for ListPostureTemplatesRequest {
7834 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7835 let mut debug_struct = f.debug_struct("ListPostureTemplatesRequest");
7836 debug_struct.field("parent", &self.parent);
7837 debug_struct.field("page_size", &self.page_size);
7838 debug_struct.field("page_token", &self.page_token);
7839 debug_struct.field("filter", &self.filter);
7840 if !self._unknown_fields.is_empty() {
7841 debug_struct.field("_unknown_fields", &self._unknown_fields);
7842 }
7843 debug_struct.finish()
7844 }
7845}
7846
7847#[derive(Clone, Default, PartialEq)]
7849#[non_exhaustive]
7850pub struct ListPostureTemplatesResponse {
7851 pub posture_templates: std::vec::Vec<crate::model::PostureTemplate>,
7853
7854 pub next_page_token: std::string::String,
7856
7857 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7858}
7859
7860impl ListPostureTemplatesResponse {
7861 pub fn new() -> Self {
7862 std::default::Default::default()
7863 }
7864
7865 pub fn set_posture_templates<T, V>(mut self, v: T) -> Self
7867 where
7868 T: std::iter::IntoIterator<Item = V>,
7869 V: std::convert::Into<crate::model::PostureTemplate>,
7870 {
7871 use std::iter::Iterator;
7872 self.posture_templates = v.into_iter().map(|i| i.into()).collect();
7873 self
7874 }
7875
7876 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7878 self.next_page_token = v.into();
7879 self
7880 }
7881}
7882
7883impl wkt::message::Message for ListPostureTemplatesResponse {
7884 fn typename() -> &'static str {
7885 "type.googleapis.com/google.cloud.securityposture.v1.ListPostureTemplatesResponse"
7886 }
7887}
7888
7889#[doc(hidden)]
7890impl gax::paginator::internal::PageableResponse for ListPostureTemplatesResponse {
7891 type PageItem = crate::model::PostureTemplate;
7892
7893 fn items(self) -> std::vec::Vec<Self::PageItem> {
7894 self.posture_templates
7895 }
7896
7897 fn next_page_token(&self) -> std::string::String {
7898 use std::clone::Clone;
7899 self.next_page_token.clone()
7900 }
7901}
7902
7903#[doc(hidden)]
7904impl<'de> serde::de::Deserialize<'de> for ListPostureTemplatesResponse {
7905 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7906 where
7907 D: serde::Deserializer<'de>,
7908 {
7909 #[allow(non_camel_case_types)]
7910 #[doc(hidden)]
7911 #[derive(PartialEq, Eq, Hash)]
7912 enum __FieldTag {
7913 __posture_templates,
7914 __next_page_token,
7915 Unknown(std::string::String),
7916 }
7917 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7918 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7919 where
7920 D: serde::Deserializer<'de>,
7921 {
7922 struct Visitor;
7923 impl<'de> serde::de::Visitor<'de> for Visitor {
7924 type Value = __FieldTag;
7925 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7926 formatter.write_str("a field name for ListPostureTemplatesResponse")
7927 }
7928 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7929 where
7930 E: serde::de::Error,
7931 {
7932 use std::result::Result::Ok;
7933 use std::string::ToString;
7934 match value {
7935 "postureTemplates" => Ok(__FieldTag::__posture_templates),
7936 "posture_templates" => Ok(__FieldTag::__posture_templates),
7937 "nextPageToken" => Ok(__FieldTag::__next_page_token),
7938 "next_page_token" => Ok(__FieldTag::__next_page_token),
7939 _ => Ok(__FieldTag::Unknown(value.to_string())),
7940 }
7941 }
7942 }
7943 deserializer.deserialize_identifier(Visitor)
7944 }
7945 }
7946 struct Visitor;
7947 impl<'de> serde::de::Visitor<'de> for Visitor {
7948 type Value = ListPostureTemplatesResponse;
7949 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7950 formatter.write_str("struct ListPostureTemplatesResponse")
7951 }
7952 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7953 where
7954 A: serde::de::MapAccess<'de>,
7955 {
7956 #[allow(unused_imports)]
7957 use serde::de::Error;
7958 use std::option::Option::Some;
7959 let mut fields = std::collections::HashSet::new();
7960 let mut result = Self::Value::new();
7961 while let Some(tag) = map.next_key::<__FieldTag>()? {
7962 #[allow(clippy::match_single_binding)]
7963 match tag {
7964 __FieldTag::__posture_templates => {
7965 if !fields.insert(__FieldTag::__posture_templates) {
7966 return std::result::Result::Err(A::Error::duplicate_field(
7967 "multiple values for posture_templates",
7968 ));
7969 }
7970 result.posture_templates =
7971 map.next_value::<std::option::Option<
7972 std::vec::Vec<crate::model::PostureTemplate>,
7973 >>()?
7974 .unwrap_or_default();
7975 }
7976 __FieldTag::__next_page_token => {
7977 if !fields.insert(__FieldTag::__next_page_token) {
7978 return std::result::Result::Err(A::Error::duplicate_field(
7979 "multiple values for next_page_token",
7980 ));
7981 }
7982 result.next_page_token = map
7983 .next_value::<std::option::Option<std::string::String>>()?
7984 .unwrap_or_default();
7985 }
7986 __FieldTag::Unknown(key) => {
7987 let value = map.next_value::<serde_json::Value>()?;
7988 result._unknown_fields.insert(key, value);
7989 }
7990 }
7991 }
7992 std::result::Result::Ok(result)
7993 }
7994 }
7995 deserializer.deserialize_any(Visitor)
7996 }
7997}
7998
7999#[doc(hidden)]
8000impl serde::ser::Serialize for ListPostureTemplatesResponse {
8001 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8002 where
8003 S: serde::ser::Serializer,
8004 {
8005 use serde::ser::SerializeMap;
8006 #[allow(unused_imports)]
8007 use std::option::Option::Some;
8008 let mut state = serializer.serialize_map(std::option::Option::None)?;
8009 if !self.posture_templates.is_empty() {
8010 state.serialize_entry("postureTemplates", &self.posture_templates)?;
8011 }
8012 if !self.next_page_token.is_empty() {
8013 state.serialize_entry("nextPageToken", &self.next_page_token)?;
8014 }
8015 if !self._unknown_fields.is_empty() {
8016 for (key, value) in self._unknown_fields.iter() {
8017 state.serialize_entry(key, &value)?;
8018 }
8019 }
8020 state.end()
8021 }
8022}
8023
8024impl std::fmt::Debug for ListPostureTemplatesResponse {
8025 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8026 let mut debug_struct = f.debug_struct("ListPostureTemplatesResponse");
8027 debug_struct.field("posture_templates", &self.posture_templates);
8028 debug_struct.field("next_page_token", &self.next_page_token);
8029 if !self._unknown_fields.is_empty() {
8030 debug_struct.field("_unknown_fields", &self._unknown_fields);
8031 }
8032 debug_struct.finish()
8033 }
8034}
8035
8036#[derive(Clone, Default, PartialEq)]
8038#[non_exhaustive]
8039pub struct GetPostureTemplateRequest {
8040 pub name: std::string::String,
8042
8043 pub revision_id: std::string::String,
8046
8047 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8048}
8049
8050impl GetPostureTemplateRequest {
8051 pub fn new() -> Self {
8052 std::default::Default::default()
8053 }
8054
8055 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8057 self.name = v.into();
8058 self
8059 }
8060
8061 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8063 self.revision_id = v.into();
8064 self
8065 }
8066}
8067
8068impl wkt::message::Message for GetPostureTemplateRequest {
8069 fn typename() -> &'static str {
8070 "type.googleapis.com/google.cloud.securityposture.v1.GetPostureTemplateRequest"
8071 }
8072}
8073
8074#[doc(hidden)]
8075impl<'de> serde::de::Deserialize<'de> for GetPostureTemplateRequest {
8076 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8077 where
8078 D: serde::Deserializer<'de>,
8079 {
8080 #[allow(non_camel_case_types)]
8081 #[doc(hidden)]
8082 #[derive(PartialEq, Eq, Hash)]
8083 enum __FieldTag {
8084 __name,
8085 __revision_id,
8086 Unknown(std::string::String),
8087 }
8088 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8089 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8090 where
8091 D: serde::Deserializer<'de>,
8092 {
8093 struct Visitor;
8094 impl<'de> serde::de::Visitor<'de> for Visitor {
8095 type Value = __FieldTag;
8096 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8097 formatter.write_str("a field name for GetPostureTemplateRequest")
8098 }
8099 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8100 where
8101 E: serde::de::Error,
8102 {
8103 use std::result::Result::Ok;
8104 use std::string::ToString;
8105 match value {
8106 "name" => Ok(__FieldTag::__name),
8107 "revisionId" => Ok(__FieldTag::__revision_id),
8108 "revision_id" => Ok(__FieldTag::__revision_id),
8109 _ => Ok(__FieldTag::Unknown(value.to_string())),
8110 }
8111 }
8112 }
8113 deserializer.deserialize_identifier(Visitor)
8114 }
8115 }
8116 struct Visitor;
8117 impl<'de> serde::de::Visitor<'de> for Visitor {
8118 type Value = GetPostureTemplateRequest;
8119 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8120 formatter.write_str("struct GetPostureTemplateRequest")
8121 }
8122 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8123 where
8124 A: serde::de::MapAccess<'de>,
8125 {
8126 #[allow(unused_imports)]
8127 use serde::de::Error;
8128 use std::option::Option::Some;
8129 let mut fields = std::collections::HashSet::new();
8130 let mut result = Self::Value::new();
8131 while let Some(tag) = map.next_key::<__FieldTag>()? {
8132 #[allow(clippy::match_single_binding)]
8133 match tag {
8134 __FieldTag::__name => {
8135 if !fields.insert(__FieldTag::__name) {
8136 return std::result::Result::Err(A::Error::duplicate_field(
8137 "multiple values for name",
8138 ));
8139 }
8140 result.name = map
8141 .next_value::<std::option::Option<std::string::String>>()?
8142 .unwrap_or_default();
8143 }
8144 __FieldTag::__revision_id => {
8145 if !fields.insert(__FieldTag::__revision_id) {
8146 return std::result::Result::Err(A::Error::duplicate_field(
8147 "multiple values for revision_id",
8148 ));
8149 }
8150 result.revision_id = map
8151 .next_value::<std::option::Option<std::string::String>>()?
8152 .unwrap_or_default();
8153 }
8154 __FieldTag::Unknown(key) => {
8155 let value = map.next_value::<serde_json::Value>()?;
8156 result._unknown_fields.insert(key, value);
8157 }
8158 }
8159 }
8160 std::result::Result::Ok(result)
8161 }
8162 }
8163 deserializer.deserialize_any(Visitor)
8164 }
8165}
8166
8167#[doc(hidden)]
8168impl serde::ser::Serialize for GetPostureTemplateRequest {
8169 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8170 where
8171 S: serde::ser::Serializer,
8172 {
8173 use serde::ser::SerializeMap;
8174 #[allow(unused_imports)]
8175 use std::option::Option::Some;
8176 let mut state = serializer.serialize_map(std::option::Option::None)?;
8177 if !self.name.is_empty() {
8178 state.serialize_entry("name", &self.name)?;
8179 }
8180 if !self.revision_id.is_empty() {
8181 state.serialize_entry("revisionId", &self.revision_id)?;
8182 }
8183 if !self._unknown_fields.is_empty() {
8184 for (key, value) in self._unknown_fields.iter() {
8185 state.serialize_entry(key, &value)?;
8186 }
8187 }
8188 state.end()
8189 }
8190}
8191
8192impl std::fmt::Debug for GetPostureTemplateRequest {
8193 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8194 let mut debug_struct = f.debug_struct("GetPostureTemplateRequest");
8195 debug_struct.field("name", &self.name);
8196 debug_struct.field("revision_id", &self.revision_id);
8197 if !self._unknown_fields.is_empty() {
8198 debug_struct.field("_unknown_fields", &self._unknown_fields);
8199 }
8200 debug_struct.finish()
8201 }
8202}
8203
8204#[derive(Clone, Default, PartialEq)]
8206#[non_exhaustive]
8207pub struct SecurityHealthAnalyticsModule {
8208 pub module_name: std::string::String,
8210
8211 pub module_enablement_state: crate::model::EnablementState,
8214
8215 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8216}
8217
8218impl SecurityHealthAnalyticsModule {
8219 pub fn new() -> Self {
8220 std::default::Default::default()
8221 }
8222
8223 pub fn set_module_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8225 self.module_name = v.into();
8226 self
8227 }
8228
8229 pub fn set_module_enablement_state<T: std::convert::Into<crate::model::EnablementState>>(
8231 mut self,
8232 v: T,
8233 ) -> Self {
8234 self.module_enablement_state = v.into();
8235 self
8236 }
8237}
8238
8239impl wkt::message::Message for SecurityHealthAnalyticsModule {
8240 fn typename() -> &'static str {
8241 "type.googleapis.com/google.cloud.securityposture.v1.SecurityHealthAnalyticsModule"
8242 }
8243}
8244
8245#[doc(hidden)]
8246impl<'de> serde::de::Deserialize<'de> for SecurityHealthAnalyticsModule {
8247 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8248 where
8249 D: serde::Deserializer<'de>,
8250 {
8251 #[allow(non_camel_case_types)]
8252 #[doc(hidden)]
8253 #[derive(PartialEq, Eq, Hash)]
8254 enum __FieldTag {
8255 __module_name,
8256 __module_enablement_state,
8257 Unknown(std::string::String),
8258 }
8259 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8260 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8261 where
8262 D: serde::Deserializer<'de>,
8263 {
8264 struct Visitor;
8265 impl<'de> serde::de::Visitor<'de> for Visitor {
8266 type Value = __FieldTag;
8267 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8268 formatter.write_str("a field name for SecurityHealthAnalyticsModule")
8269 }
8270 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8271 where
8272 E: serde::de::Error,
8273 {
8274 use std::result::Result::Ok;
8275 use std::string::ToString;
8276 match value {
8277 "moduleName" => Ok(__FieldTag::__module_name),
8278 "module_name" => Ok(__FieldTag::__module_name),
8279 "moduleEnablementState" => Ok(__FieldTag::__module_enablement_state),
8280 "module_enablement_state" => Ok(__FieldTag::__module_enablement_state),
8281 _ => Ok(__FieldTag::Unknown(value.to_string())),
8282 }
8283 }
8284 }
8285 deserializer.deserialize_identifier(Visitor)
8286 }
8287 }
8288 struct Visitor;
8289 impl<'de> serde::de::Visitor<'de> for Visitor {
8290 type Value = SecurityHealthAnalyticsModule;
8291 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8292 formatter.write_str("struct SecurityHealthAnalyticsModule")
8293 }
8294 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8295 where
8296 A: serde::de::MapAccess<'de>,
8297 {
8298 #[allow(unused_imports)]
8299 use serde::de::Error;
8300 use std::option::Option::Some;
8301 let mut fields = std::collections::HashSet::new();
8302 let mut result = Self::Value::new();
8303 while let Some(tag) = map.next_key::<__FieldTag>()? {
8304 #[allow(clippy::match_single_binding)]
8305 match tag {
8306 __FieldTag::__module_name => {
8307 if !fields.insert(__FieldTag::__module_name) {
8308 return std::result::Result::Err(A::Error::duplicate_field(
8309 "multiple values for module_name",
8310 ));
8311 }
8312 result.module_name = map
8313 .next_value::<std::option::Option<std::string::String>>()?
8314 .unwrap_or_default();
8315 }
8316 __FieldTag::__module_enablement_state => {
8317 if !fields.insert(__FieldTag::__module_enablement_state) {
8318 return std::result::Result::Err(A::Error::duplicate_field(
8319 "multiple values for module_enablement_state",
8320 ));
8321 }
8322 result.module_enablement_state = map
8323 .next_value::<std::option::Option<crate::model::EnablementState>>()?
8324 .unwrap_or_default();
8325 }
8326 __FieldTag::Unknown(key) => {
8327 let value = map.next_value::<serde_json::Value>()?;
8328 result._unknown_fields.insert(key, value);
8329 }
8330 }
8331 }
8332 std::result::Result::Ok(result)
8333 }
8334 }
8335 deserializer.deserialize_any(Visitor)
8336 }
8337}
8338
8339#[doc(hidden)]
8340impl serde::ser::Serialize for SecurityHealthAnalyticsModule {
8341 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8342 where
8343 S: serde::ser::Serializer,
8344 {
8345 use serde::ser::SerializeMap;
8346 #[allow(unused_imports)]
8347 use std::option::Option::Some;
8348 let mut state = serializer.serialize_map(std::option::Option::None)?;
8349 if !self.module_name.is_empty() {
8350 state.serialize_entry("moduleName", &self.module_name)?;
8351 }
8352 if !wkt::internal::is_default(&self.module_enablement_state) {
8353 state.serialize_entry("moduleEnablementState", &self.module_enablement_state)?;
8354 }
8355 if !self._unknown_fields.is_empty() {
8356 for (key, value) in self._unknown_fields.iter() {
8357 state.serialize_entry(key, &value)?;
8358 }
8359 }
8360 state.end()
8361 }
8362}
8363
8364impl std::fmt::Debug for SecurityHealthAnalyticsModule {
8365 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8366 let mut debug_struct = f.debug_struct("SecurityHealthAnalyticsModule");
8367 debug_struct.field("module_name", &self.module_name);
8368 debug_struct.field("module_enablement_state", &self.module_enablement_state);
8369 if !self._unknown_fields.is_empty() {
8370 debug_struct.field("_unknown_fields", &self._unknown_fields);
8371 }
8372 debug_struct.finish()
8373 }
8374}
8375
8376#[derive(Clone, Default, PartialEq)]
8378#[non_exhaustive]
8379pub struct SecurityHealthAnalyticsCustomModule {
8380 pub id: std::string::String,
8384
8385 pub display_name: std::string::String,
8391
8392 pub config: std::option::Option<crate::model::CustomConfig>,
8394
8395 pub module_enablement_state: crate::model::EnablementState,
8398
8399 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8400}
8401
8402impl SecurityHealthAnalyticsCustomModule {
8403 pub fn new() -> Self {
8404 std::default::Default::default()
8405 }
8406
8407 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8409 self.id = v.into();
8410 self
8411 }
8412
8413 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8415 self.display_name = v.into();
8416 self
8417 }
8418
8419 pub fn set_config<T>(mut self, v: T) -> Self
8421 where
8422 T: std::convert::Into<crate::model::CustomConfig>,
8423 {
8424 self.config = std::option::Option::Some(v.into());
8425 self
8426 }
8427
8428 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
8430 where
8431 T: std::convert::Into<crate::model::CustomConfig>,
8432 {
8433 self.config = v.map(|x| x.into());
8434 self
8435 }
8436
8437 pub fn set_module_enablement_state<T: std::convert::Into<crate::model::EnablementState>>(
8439 mut self,
8440 v: T,
8441 ) -> Self {
8442 self.module_enablement_state = v.into();
8443 self
8444 }
8445}
8446
8447impl wkt::message::Message for SecurityHealthAnalyticsCustomModule {
8448 fn typename() -> &'static str {
8449 "type.googleapis.com/google.cloud.securityposture.v1.SecurityHealthAnalyticsCustomModule"
8450 }
8451}
8452
8453#[doc(hidden)]
8454impl<'de> serde::de::Deserialize<'de> for SecurityHealthAnalyticsCustomModule {
8455 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8456 where
8457 D: serde::Deserializer<'de>,
8458 {
8459 #[allow(non_camel_case_types)]
8460 #[doc(hidden)]
8461 #[derive(PartialEq, Eq, Hash)]
8462 enum __FieldTag {
8463 __id,
8464 __display_name,
8465 __config,
8466 __module_enablement_state,
8467 Unknown(std::string::String),
8468 }
8469 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8470 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8471 where
8472 D: serde::Deserializer<'de>,
8473 {
8474 struct Visitor;
8475 impl<'de> serde::de::Visitor<'de> for Visitor {
8476 type Value = __FieldTag;
8477 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8478 formatter.write_str("a field name for SecurityHealthAnalyticsCustomModule")
8479 }
8480 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8481 where
8482 E: serde::de::Error,
8483 {
8484 use std::result::Result::Ok;
8485 use std::string::ToString;
8486 match value {
8487 "id" => Ok(__FieldTag::__id),
8488 "displayName" => Ok(__FieldTag::__display_name),
8489 "display_name" => Ok(__FieldTag::__display_name),
8490 "config" => Ok(__FieldTag::__config),
8491 "moduleEnablementState" => Ok(__FieldTag::__module_enablement_state),
8492 "module_enablement_state" => Ok(__FieldTag::__module_enablement_state),
8493 _ => Ok(__FieldTag::Unknown(value.to_string())),
8494 }
8495 }
8496 }
8497 deserializer.deserialize_identifier(Visitor)
8498 }
8499 }
8500 struct Visitor;
8501 impl<'de> serde::de::Visitor<'de> for Visitor {
8502 type Value = SecurityHealthAnalyticsCustomModule;
8503 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8504 formatter.write_str("struct SecurityHealthAnalyticsCustomModule")
8505 }
8506 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8507 where
8508 A: serde::de::MapAccess<'de>,
8509 {
8510 #[allow(unused_imports)]
8511 use serde::de::Error;
8512 use std::option::Option::Some;
8513 let mut fields = std::collections::HashSet::new();
8514 let mut result = Self::Value::new();
8515 while let Some(tag) = map.next_key::<__FieldTag>()? {
8516 #[allow(clippy::match_single_binding)]
8517 match tag {
8518 __FieldTag::__id => {
8519 if !fields.insert(__FieldTag::__id) {
8520 return std::result::Result::Err(A::Error::duplicate_field(
8521 "multiple values for id",
8522 ));
8523 }
8524 result.id = map
8525 .next_value::<std::option::Option<std::string::String>>()?
8526 .unwrap_or_default();
8527 }
8528 __FieldTag::__display_name => {
8529 if !fields.insert(__FieldTag::__display_name) {
8530 return std::result::Result::Err(A::Error::duplicate_field(
8531 "multiple values for display_name",
8532 ));
8533 }
8534 result.display_name = map
8535 .next_value::<std::option::Option<std::string::String>>()?
8536 .unwrap_or_default();
8537 }
8538 __FieldTag::__config => {
8539 if !fields.insert(__FieldTag::__config) {
8540 return std::result::Result::Err(A::Error::duplicate_field(
8541 "multiple values for config",
8542 ));
8543 }
8544 result.config = map
8545 .next_value::<std::option::Option<crate::model::CustomConfig>>()?;
8546 }
8547 __FieldTag::__module_enablement_state => {
8548 if !fields.insert(__FieldTag::__module_enablement_state) {
8549 return std::result::Result::Err(A::Error::duplicate_field(
8550 "multiple values for module_enablement_state",
8551 ));
8552 }
8553 result.module_enablement_state = map
8554 .next_value::<std::option::Option<crate::model::EnablementState>>()?
8555 .unwrap_or_default();
8556 }
8557 __FieldTag::Unknown(key) => {
8558 let value = map.next_value::<serde_json::Value>()?;
8559 result._unknown_fields.insert(key, value);
8560 }
8561 }
8562 }
8563 std::result::Result::Ok(result)
8564 }
8565 }
8566 deserializer.deserialize_any(Visitor)
8567 }
8568}
8569
8570#[doc(hidden)]
8571impl serde::ser::Serialize for SecurityHealthAnalyticsCustomModule {
8572 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8573 where
8574 S: serde::ser::Serializer,
8575 {
8576 use serde::ser::SerializeMap;
8577 #[allow(unused_imports)]
8578 use std::option::Option::Some;
8579 let mut state = serializer.serialize_map(std::option::Option::None)?;
8580 if !self.id.is_empty() {
8581 state.serialize_entry("id", &self.id)?;
8582 }
8583 if !self.display_name.is_empty() {
8584 state.serialize_entry("displayName", &self.display_name)?;
8585 }
8586 if self.config.is_some() {
8587 state.serialize_entry("config", &self.config)?;
8588 }
8589 if !wkt::internal::is_default(&self.module_enablement_state) {
8590 state.serialize_entry("moduleEnablementState", &self.module_enablement_state)?;
8591 }
8592 if !self._unknown_fields.is_empty() {
8593 for (key, value) in self._unknown_fields.iter() {
8594 state.serialize_entry(key, &value)?;
8595 }
8596 }
8597 state.end()
8598 }
8599}
8600
8601impl std::fmt::Debug for SecurityHealthAnalyticsCustomModule {
8602 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8603 let mut debug_struct = f.debug_struct("SecurityHealthAnalyticsCustomModule");
8604 debug_struct.field("id", &self.id);
8605 debug_struct.field("display_name", &self.display_name);
8606 debug_struct.field("config", &self.config);
8607 debug_struct.field("module_enablement_state", &self.module_enablement_state);
8608 if !self._unknown_fields.is_empty() {
8609 debug_struct.field("_unknown_fields", &self._unknown_fields);
8610 }
8611 debug_struct.finish()
8612 }
8613}
8614
8615#[derive(Clone, Default, PartialEq)]
8619#[non_exhaustive]
8620pub struct CustomConfig {
8621 pub predicate: std::option::Option<gtype::model::Expr>,
8624
8625 pub custom_output: std::option::Option<crate::model::custom_config::CustomOutputSpec>,
8627
8628 pub resource_selector: std::option::Option<crate::model::custom_config::ResourceSelector>,
8631
8632 pub severity: crate::model::custom_config::Severity,
8634
8635 pub description: std::string::String,
8640
8641 pub recommendation: std::string::String,
8646
8647 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8648}
8649
8650impl CustomConfig {
8651 pub fn new() -> Self {
8652 std::default::Default::default()
8653 }
8654
8655 pub fn set_predicate<T>(mut self, v: T) -> Self
8657 where
8658 T: std::convert::Into<gtype::model::Expr>,
8659 {
8660 self.predicate = std::option::Option::Some(v.into());
8661 self
8662 }
8663
8664 pub fn set_or_clear_predicate<T>(mut self, v: std::option::Option<T>) -> Self
8666 where
8667 T: std::convert::Into<gtype::model::Expr>,
8668 {
8669 self.predicate = v.map(|x| x.into());
8670 self
8671 }
8672
8673 pub fn set_custom_output<T>(mut self, v: T) -> Self
8675 where
8676 T: std::convert::Into<crate::model::custom_config::CustomOutputSpec>,
8677 {
8678 self.custom_output = std::option::Option::Some(v.into());
8679 self
8680 }
8681
8682 pub fn set_or_clear_custom_output<T>(mut self, v: std::option::Option<T>) -> Self
8684 where
8685 T: std::convert::Into<crate::model::custom_config::CustomOutputSpec>,
8686 {
8687 self.custom_output = v.map(|x| x.into());
8688 self
8689 }
8690
8691 pub fn set_resource_selector<T>(mut self, v: T) -> Self
8693 where
8694 T: std::convert::Into<crate::model::custom_config::ResourceSelector>,
8695 {
8696 self.resource_selector = std::option::Option::Some(v.into());
8697 self
8698 }
8699
8700 pub fn set_or_clear_resource_selector<T>(mut self, v: std::option::Option<T>) -> Self
8702 where
8703 T: std::convert::Into<crate::model::custom_config::ResourceSelector>,
8704 {
8705 self.resource_selector = v.map(|x| x.into());
8706 self
8707 }
8708
8709 pub fn set_severity<T: std::convert::Into<crate::model::custom_config::Severity>>(
8711 mut self,
8712 v: T,
8713 ) -> Self {
8714 self.severity = v.into();
8715 self
8716 }
8717
8718 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8720 self.description = v.into();
8721 self
8722 }
8723
8724 pub fn set_recommendation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8726 self.recommendation = v.into();
8727 self
8728 }
8729}
8730
8731impl wkt::message::Message for CustomConfig {
8732 fn typename() -> &'static str {
8733 "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig"
8734 }
8735}
8736
8737#[doc(hidden)]
8738impl<'de> serde::de::Deserialize<'de> for CustomConfig {
8739 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8740 where
8741 D: serde::Deserializer<'de>,
8742 {
8743 #[allow(non_camel_case_types)]
8744 #[doc(hidden)]
8745 #[derive(PartialEq, Eq, Hash)]
8746 enum __FieldTag {
8747 __predicate,
8748 __custom_output,
8749 __resource_selector,
8750 __severity,
8751 __description,
8752 __recommendation,
8753 Unknown(std::string::String),
8754 }
8755 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8756 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8757 where
8758 D: serde::Deserializer<'de>,
8759 {
8760 struct Visitor;
8761 impl<'de> serde::de::Visitor<'de> for Visitor {
8762 type Value = __FieldTag;
8763 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8764 formatter.write_str("a field name for CustomConfig")
8765 }
8766 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8767 where
8768 E: serde::de::Error,
8769 {
8770 use std::result::Result::Ok;
8771 use std::string::ToString;
8772 match value {
8773 "predicate" => Ok(__FieldTag::__predicate),
8774 "customOutput" => Ok(__FieldTag::__custom_output),
8775 "custom_output" => Ok(__FieldTag::__custom_output),
8776 "resourceSelector" => Ok(__FieldTag::__resource_selector),
8777 "resource_selector" => Ok(__FieldTag::__resource_selector),
8778 "severity" => Ok(__FieldTag::__severity),
8779 "description" => Ok(__FieldTag::__description),
8780 "recommendation" => Ok(__FieldTag::__recommendation),
8781 _ => Ok(__FieldTag::Unknown(value.to_string())),
8782 }
8783 }
8784 }
8785 deserializer.deserialize_identifier(Visitor)
8786 }
8787 }
8788 struct Visitor;
8789 impl<'de> serde::de::Visitor<'de> for Visitor {
8790 type Value = CustomConfig;
8791 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8792 formatter.write_str("struct CustomConfig")
8793 }
8794 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8795 where
8796 A: serde::de::MapAccess<'de>,
8797 {
8798 #[allow(unused_imports)]
8799 use serde::de::Error;
8800 use std::option::Option::Some;
8801 let mut fields = std::collections::HashSet::new();
8802 let mut result = Self::Value::new();
8803 while let Some(tag) = map.next_key::<__FieldTag>()? {
8804 #[allow(clippy::match_single_binding)]
8805 match tag {
8806 __FieldTag::__predicate => {
8807 if !fields.insert(__FieldTag::__predicate) {
8808 return std::result::Result::Err(A::Error::duplicate_field(
8809 "multiple values for predicate",
8810 ));
8811 }
8812 result.predicate =
8813 map.next_value::<std::option::Option<gtype::model::Expr>>()?;
8814 }
8815 __FieldTag::__custom_output => {
8816 if !fields.insert(__FieldTag::__custom_output) {
8817 return std::result::Result::Err(A::Error::duplicate_field(
8818 "multiple values for custom_output",
8819 ));
8820 }
8821 result.custom_output = map.next_value::<std::option::Option<
8822 crate::model::custom_config::CustomOutputSpec,
8823 >>()?;
8824 }
8825 __FieldTag::__resource_selector => {
8826 if !fields.insert(__FieldTag::__resource_selector) {
8827 return std::result::Result::Err(A::Error::duplicate_field(
8828 "multiple values for resource_selector",
8829 ));
8830 }
8831 result.resource_selector = map.next_value::<std::option::Option<
8832 crate::model::custom_config::ResourceSelector,
8833 >>()?;
8834 }
8835 __FieldTag::__severity => {
8836 if !fields.insert(__FieldTag::__severity) {
8837 return std::result::Result::Err(A::Error::duplicate_field(
8838 "multiple values for severity",
8839 ));
8840 }
8841 result.severity = map.next_value::<std::option::Option<crate::model::custom_config::Severity>>()?.unwrap_or_default();
8842 }
8843 __FieldTag::__description => {
8844 if !fields.insert(__FieldTag::__description) {
8845 return std::result::Result::Err(A::Error::duplicate_field(
8846 "multiple values for description",
8847 ));
8848 }
8849 result.description = map
8850 .next_value::<std::option::Option<std::string::String>>()?
8851 .unwrap_or_default();
8852 }
8853 __FieldTag::__recommendation => {
8854 if !fields.insert(__FieldTag::__recommendation) {
8855 return std::result::Result::Err(A::Error::duplicate_field(
8856 "multiple values for recommendation",
8857 ));
8858 }
8859 result.recommendation = map
8860 .next_value::<std::option::Option<std::string::String>>()?
8861 .unwrap_or_default();
8862 }
8863 __FieldTag::Unknown(key) => {
8864 let value = map.next_value::<serde_json::Value>()?;
8865 result._unknown_fields.insert(key, value);
8866 }
8867 }
8868 }
8869 std::result::Result::Ok(result)
8870 }
8871 }
8872 deserializer.deserialize_any(Visitor)
8873 }
8874}
8875
8876#[doc(hidden)]
8877impl serde::ser::Serialize for CustomConfig {
8878 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8879 where
8880 S: serde::ser::Serializer,
8881 {
8882 use serde::ser::SerializeMap;
8883 #[allow(unused_imports)]
8884 use std::option::Option::Some;
8885 let mut state = serializer.serialize_map(std::option::Option::None)?;
8886 if self.predicate.is_some() {
8887 state.serialize_entry("predicate", &self.predicate)?;
8888 }
8889 if self.custom_output.is_some() {
8890 state.serialize_entry("customOutput", &self.custom_output)?;
8891 }
8892 if self.resource_selector.is_some() {
8893 state.serialize_entry("resourceSelector", &self.resource_selector)?;
8894 }
8895 if !wkt::internal::is_default(&self.severity) {
8896 state.serialize_entry("severity", &self.severity)?;
8897 }
8898 if !self.description.is_empty() {
8899 state.serialize_entry("description", &self.description)?;
8900 }
8901 if !self.recommendation.is_empty() {
8902 state.serialize_entry("recommendation", &self.recommendation)?;
8903 }
8904 if !self._unknown_fields.is_empty() {
8905 for (key, value) in self._unknown_fields.iter() {
8906 state.serialize_entry(key, &value)?;
8907 }
8908 }
8909 state.end()
8910 }
8911}
8912
8913impl std::fmt::Debug for CustomConfig {
8914 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8915 let mut debug_struct = f.debug_struct("CustomConfig");
8916 debug_struct.field("predicate", &self.predicate);
8917 debug_struct.field("custom_output", &self.custom_output);
8918 debug_struct.field("resource_selector", &self.resource_selector);
8919 debug_struct.field("severity", &self.severity);
8920 debug_struct.field("description", &self.description);
8921 debug_struct.field("recommendation", &self.recommendation);
8922 if !self._unknown_fields.is_empty() {
8923 debug_struct.field("_unknown_fields", &self._unknown_fields);
8924 }
8925 debug_struct.finish()
8926 }
8927}
8928
8929pub mod custom_config {
8931 #[allow(unused_imports)]
8932 use super::*;
8933
8934 #[derive(Clone, Default, PartialEq)]
8939 #[non_exhaustive]
8940 pub struct CustomOutputSpec {
8941 pub properties: std::vec::Vec<crate::model::custom_config::custom_output_spec::Property>,
8943
8944 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8945 }
8946
8947 impl CustomOutputSpec {
8948 pub fn new() -> Self {
8949 std::default::Default::default()
8950 }
8951
8952 pub fn set_properties<T, V>(mut self, v: T) -> Self
8954 where
8955 T: std::iter::IntoIterator<Item = V>,
8956 V: std::convert::Into<crate::model::custom_config::custom_output_spec::Property>,
8957 {
8958 use std::iter::Iterator;
8959 self.properties = v.into_iter().map(|i| i.into()).collect();
8960 self
8961 }
8962 }
8963
8964 impl wkt::message::Message for CustomOutputSpec {
8965 fn typename() -> &'static str {
8966 "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig.CustomOutputSpec"
8967 }
8968 }
8969
8970 #[doc(hidden)]
8971 impl<'de> serde::de::Deserialize<'de> for CustomOutputSpec {
8972 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8973 where
8974 D: serde::Deserializer<'de>,
8975 {
8976 #[allow(non_camel_case_types)]
8977 #[doc(hidden)]
8978 #[derive(PartialEq, Eq, Hash)]
8979 enum __FieldTag {
8980 __properties,
8981 Unknown(std::string::String),
8982 }
8983 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8984 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8985 where
8986 D: serde::Deserializer<'de>,
8987 {
8988 struct Visitor;
8989 impl<'de> serde::de::Visitor<'de> for Visitor {
8990 type Value = __FieldTag;
8991 fn expecting(
8992 &self,
8993 formatter: &mut std::fmt::Formatter,
8994 ) -> std::fmt::Result {
8995 formatter.write_str("a field name for CustomOutputSpec")
8996 }
8997 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8998 where
8999 E: serde::de::Error,
9000 {
9001 use std::result::Result::Ok;
9002 use std::string::ToString;
9003 match value {
9004 "properties" => Ok(__FieldTag::__properties),
9005 _ => Ok(__FieldTag::Unknown(value.to_string())),
9006 }
9007 }
9008 }
9009 deserializer.deserialize_identifier(Visitor)
9010 }
9011 }
9012 struct Visitor;
9013 impl<'de> serde::de::Visitor<'de> for Visitor {
9014 type Value = CustomOutputSpec;
9015 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9016 formatter.write_str("struct CustomOutputSpec")
9017 }
9018 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9019 where
9020 A: serde::de::MapAccess<'de>,
9021 {
9022 #[allow(unused_imports)]
9023 use serde::de::Error;
9024 use std::option::Option::Some;
9025 let mut fields = std::collections::HashSet::new();
9026 let mut result = Self::Value::new();
9027 while let Some(tag) = map.next_key::<__FieldTag>()? {
9028 #[allow(clippy::match_single_binding)]
9029 match tag {
9030 __FieldTag::__properties => {
9031 if !fields.insert(__FieldTag::__properties) {
9032 return std::result::Result::Err(A::Error::duplicate_field(
9033 "multiple values for properties",
9034 ));
9035 }
9036 result.properties = map.next_value::<std::option::Option<std::vec::Vec<crate::model::custom_config::custom_output_spec::Property>>>()?.unwrap_or_default();
9037 }
9038 __FieldTag::Unknown(key) => {
9039 let value = map.next_value::<serde_json::Value>()?;
9040 result._unknown_fields.insert(key, value);
9041 }
9042 }
9043 }
9044 std::result::Result::Ok(result)
9045 }
9046 }
9047 deserializer.deserialize_any(Visitor)
9048 }
9049 }
9050
9051 #[doc(hidden)]
9052 impl serde::ser::Serialize for CustomOutputSpec {
9053 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9054 where
9055 S: serde::ser::Serializer,
9056 {
9057 use serde::ser::SerializeMap;
9058 #[allow(unused_imports)]
9059 use std::option::Option::Some;
9060 let mut state = serializer.serialize_map(std::option::Option::None)?;
9061 if !self.properties.is_empty() {
9062 state.serialize_entry("properties", &self.properties)?;
9063 }
9064 if !self._unknown_fields.is_empty() {
9065 for (key, value) in self._unknown_fields.iter() {
9066 state.serialize_entry(key, &value)?;
9067 }
9068 }
9069 state.end()
9070 }
9071 }
9072
9073 impl std::fmt::Debug for CustomOutputSpec {
9074 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9075 let mut debug_struct = f.debug_struct("CustomOutputSpec");
9076 debug_struct.field("properties", &self.properties);
9077 if !self._unknown_fields.is_empty() {
9078 debug_struct.field("_unknown_fields", &self._unknown_fields);
9079 }
9080 debug_struct.finish()
9081 }
9082 }
9083
9084 pub mod custom_output_spec {
9086 #[allow(unused_imports)]
9087 use super::*;
9088
9089 #[derive(Clone, Default, PartialEq)]
9091 #[non_exhaustive]
9092 pub struct Property {
9093 pub name: std::string::String,
9095
9096 pub value_expression: std::option::Option<gtype::model::Expr>,
9100
9101 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9102 }
9103
9104 impl Property {
9105 pub fn new() -> Self {
9106 std::default::Default::default()
9107 }
9108
9109 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9111 self.name = v.into();
9112 self
9113 }
9114
9115 pub fn set_value_expression<T>(mut self, v: T) -> Self
9117 where
9118 T: std::convert::Into<gtype::model::Expr>,
9119 {
9120 self.value_expression = std::option::Option::Some(v.into());
9121 self
9122 }
9123
9124 pub fn set_or_clear_value_expression<T>(mut self, v: std::option::Option<T>) -> Self
9126 where
9127 T: std::convert::Into<gtype::model::Expr>,
9128 {
9129 self.value_expression = v.map(|x| x.into());
9130 self
9131 }
9132 }
9133
9134 impl wkt::message::Message for Property {
9135 fn typename() -> &'static str {
9136 "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig.CustomOutputSpec.Property"
9137 }
9138 }
9139
9140 #[doc(hidden)]
9141 impl<'de> serde::de::Deserialize<'de> for Property {
9142 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9143 where
9144 D: serde::Deserializer<'de>,
9145 {
9146 #[allow(non_camel_case_types)]
9147 #[doc(hidden)]
9148 #[derive(PartialEq, Eq, Hash)]
9149 enum __FieldTag {
9150 __name,
9151 __value_expression,
9152 Unknown(std::string::String),
9153 }
9154 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9155 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9156 where
9157 D: serde::Deserializer<'de>,
9158 {
9159 struct Visitor;
9160 impl<'de> serde::de::Visitor<'de> for Visitor {
9161 type Value = __FieldTag;
9162 fn expecting(
9163 &self,
9164 formatter: &mut std::fmt::Formatter,
9165 ) -> std::fmt::Result {
9166 formatter.write_str("a field name for Property")
9167 }
9168 fn visit_str<E>(
9169 self,
9170 value: &str,
9171 ) -> std::result::Result<Self::Value, E>
9172 where
9173 E: serde::de::Error,
9174 {
9175 use std::result::Result::Ok;
9176 use std::string::ToString;
9177 match value {
9178 "name" => Ok(__FieldTag::__name),
9179 "valueExpression" => Ok(__FieldTag::__value_expression),
9180 "value_expression" => Ok(__FieldTag::__value_expression),
9181 _ => Ok(__FieldTag::Unknown(value.to_string())),
9182 }
9183 }
9184 }
9185 deserializer.deserialize_identifier(Visitor)
9186 }
9187 }
9188 struct Visitor;
9189 impl<'de> serde::de::Visitor<'de> for Visitor {
9190 type Value = Property;
9191 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9192 formatter.write_str("struct Property")
9193 }
9194 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9195 where
9196 A: serde::de::MapAccess<'de>,
9197 {
9198 #[allow(unused_imports)]
9199 use serde::de::Error;
9200 use std::option::Option::Some;
9201 let mut fields = std::collections::HashSet::new();
9202 let mut result = Self::Value::new();
9203 while let Some(tag) = map.next_key::<__FieldTag>()? {
9204 #[allow(clippy::match_single_binding)]
9205 match tag {
9206 __FieldTag::__name => {
9207 if !fields.insert(__FieldTag::__name) {
9208 return std::result::Result::Err(
9209 A::Error::duplicate_field("multiple values for name"),
9210 );
9211 }
9212 result.name = map
9213 .next_value::<std::option::Option<std::string::String>>()?
9214 .unwrap_or_default();
9215 }
9216 __FieldTag::__value_expression => {
9217 if !fields.insert(__FieldTag::__value_expression) {
9218 return std::result::Result::Err(
9219 A::Error::duplicate_field(
9220 "multiple values for value_expression",
9221 ),
9222 );
9223 }
9224 result.value_expression = map
9225 .next_value::<std::option::Option<gtype::model::Expr>>()?;
9226 }
9227 __FieldTag::Unknown(key) => {
9228 let value = map.next_value::<serde_json::Value>()?;
9229 result._unknown_fields.insert(key, value);
9230 }
9231 }
9232 }
9233 std::result::Result::Ok(result)
9234 }
9235 }
9236 deserializer.deserialize_any(Visitor)
9237 }
9238 }
9239
9240 #[doc(hidden)]
9241 impl serde::ser::Serialize for Property {
9242 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9243 where
9244 S: serde::ser::Serializer,
9245 {
9246 use serde::ser::SerializeMap;
9247 #[allow(unused_imports)]
9248 use std::option::Option::Some;
9249 let mut state = serializer.serialize_map(std::option::Option::None)?;
9250 if !self.name.is_empty() {
9251 state.serialize_entry("name", &self.name)?;
9252 }
9253 if self.value_expression.is_some() {
9254 state.serialize_entry("valueExpression", &self.value_expression)?;
9255 }
9256 if !self._unknown_fields.is_empty() {
9257 for (key, value) in self._unknown_fields.iter() {
9258 state.serialize_entry(key, &value)?;
9259 }
9260 }
9261 state.end()
9262 }
9263 }
9264
9265 impl std::fmt::Debug for Property {
9266 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9267 let mut debug_struct = f.debug_struct("Property");
9268 debug_struct.field("name", &self.name);
9269 debug_struct.field("value_expression", &self.value_expression);
9270 if !self._unknown_fields.is_empty() {
9271 debug_struct.field("_unknown_fields", &self._unknown_fields);
9272 }
9273 debug_struct.finish()
9274 }
9275 }
9276 }
9277
9278 #[derive(Clone, Default, PartialEq)]
9280 #[non_exhaustive]
9281 pub struct ResourceSelector {
9282 pub resource_types: std::vec::Vec<std::string::String>,
9284
9285 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9286 }
9287
9288 impl ResourceSelector {
9289 pub fn new() -> Self {
9290 std::default::Default::default()
9291 }
9292
9293 pub fn set_resource_types<T, V>(mut self, v: T) -> Self
9295 where
9296 T: std::iter::IntoIterator<Item = V>,
9297 V: std::convert::Into<std::string::String>,
9298 {
9299 use std::iter::Iterator;
9300 self.resource_types = v.into_iter().map(|i| i.into()).collect();
9301 self
9302 }
9303 }
9304
9305 impl wkt::message::Message for ResourceSelector {
9306 fn typename() -> &'static str {
9307 "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig.ResourceSelector"
9308 }
9309 }
9310
9311 #[doc(hidden)]
9312 impl<'de> serde::de::Deserialize<'de> for ResourceSelector {
9313 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9314 where
9315 D: serde::Deserializer<'de>,
9316 {
9317 #[allow(non_camel_case_types)]
9318 #[doc(hidden)]
9319 #[derive(PartialEq, Eq, Hash)]
9320 enum __FieldTag {
9321 __resource_types,
9322 Unknown(std::string::String),
9323 }
9324 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9325 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9326 where
9327 D: serde::Deserializer<'de>,
9328 {
9329 struct Visitor;
9330 impl<'de> serde::de::Visitor<'de> for Visitor {
9331 type Value = __FieldTag;
9332 fn expecting(
9333 &self,
9334 formatter: &mut std::fmt::Formatter,
9335 ) -> std::fmt::Result {
9336 formatter.write_str("a field name for ResourceSelector")
9337 }
9338 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9339 where
9340 E: serde::de::Error,
9341 {
9342 use std::result::Result::Ok;
9343 use std::string::ToString;
9344 match value {
9345 "resourceTypes" => Ok(__FieldTag::__resource_types),
9346 "resource_types" => Ok(__FieldTag::__resource_types),
9347 _ => Ok(__FieldTag::Unknown(value.to_string())),
9348 }
9349 }
9350 }
9351 deserializer.deserialize_identifier(Visitor)
9352 }
9353 }
9354 struct Visitor;
9355 impl<'de> serde::de::Visitor<'de> for Visitor {
9356 type Value = ResourceSelector;
9357 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9358 formatter.write_str("struct ResourceSelector")
9359 }
9360 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9361 where
9362 A: serde::de::MapAccess<'de>,
9363 {
9364 #[allow(unused_imports)]
9365 use serde::de::Error;
9366 use std::option::Option::Some;
9367 let mut fields = std::collections::HashSet::new();
9368 let mut result = Self::Value::new();
9369 while let Some(tag) = map.next_key::<__FieldTag>()? {
9370 #[allow(clippy::match_single_binding)]
9371 match tag {
9372 __FieldTag::__resource_types => {
9373 if !fields.insert(__FieldTag::__resource_types) {
9374 return std::result::Result::Err(A::Error::duplicate_field(
9375 "multiple values for resource_types",
9376 ));
9377 }
9378 result.resource_types = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
9379 }
9380 __FieldTag::Unknown(key) => {
9381 let value = map.next_value::<serde_json::Value>()?;
9382 result._unknown_fields.insert(key, value);
9383 }
9384 }
9385 }
9386 std::result::Result::Ok(result)
9387 }
9388 }
9389 deserializer.deserialize_any(Visitor)
9390 }
9391 }
9392
9393 #[doc(hidden)]
9394 impl serde::ser::Serialize for ResourceSelector {
9395 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9396 where
9397 S: serde::ser::Serializer,
9398 {
9399 use serde::ser::SerializeMap;
9400 #[allow(unused_imports)]
9401 use std::option::Option::Some;
9402 let mut state = serializer.serialize_map(std::option::Option::None)?;
9403 if !self.resource_types.is_empty() {
9404 state.serialize_entry("resourceTypes", &self.resource_types)?;
9405 }
9406 if !self._unknown_fields.is_empty() {
9407 for (key, value) in self._unknown_fields.iter() {
9408 state.serialize_entry(key, &value)?;
9409 }
9410 }
9411 state.end()
9412 }
9413 }
9414
9415 impl std::fmt::Debug for ResourceSelector {
9416 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9417 let mut debug_struct = f.debug_struct("ResourceSelector");
9418 debug_struct.field("resource_types", &self.resource_types);
9419 if !self._unknown_fields.is_empty() {
9420 debug_struct.field("_unknown_fields", &self._unknown_fields);
9421 }
9422 debug_struct.finish()
9423 }
9424 }
9425
9426 #[derive(Clone, Debug, PartialEq)]
9442 #[non_exhaustive]
9443 pub enum Severity {
9444 Unspecified,
9446 Critical,
9448 High,
9450 Medium,
9452 Low,
9454 UnknownValue(severity::UnknownValue),
9459 }
9460
9461 #[doc(hidden)]
9462 pub mod severity {
9463 #[allow(unused_imports)]
9464 use super::*;
9465 #[derive(Clone, Debug, PartialEq)]
9466 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9467 }
9468
9469 impl Severity {
9470 pub fn value(&self) -> std::option::Option<i32> {
9475 match self {
9476 Self::Unspecified => std::option::Option::Some(0),
9477 Self::Critical => std::option::Option::Some(1),
9478 Self::High => std::option::Option::Some(2),
9479 Self::Medium => std::option::Option::Some(3),
9480 Self::Low => std::option::Option::Some(4),
9481 Self::UnknownValue(u) => u.0.value(),
9482 }
9483 }
9484
9485 pub fn name(&self) -> std::option::Option<&str> {
9490 match self {
9491 Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
9492 Self::Critical => std::option::Option::Some("CRITICAL"),
9493 Self::High => std::option::Option::Some("HIGH"),
9494 Self::Medium => std::option::Option::Some("MEDIUM"),
9495 Self::Low => std::option::Option::Some("LOW"),
9496 Self::UnknownValue(u) => u.0.name(),
9497 }
9498 }
9499 }
9500
9501 impl std::default::Default for Severity {
9502 fn default() -> Self {
9503 use std::convert::From;
9504 Self::from(0)
9505 }
9506 }
9507
9508 impl std::fmt::Display for Severity {
9509 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9510 wkt::internal::display_enum(f, self.name(), self.value())
9511 }
9512 }
9513
9514 impl std::convert::From<i32> for Severity {
9515 fn from(value: i32) -> Self {
9516 match value {
9517 0 => Self::Unspecified,
9518 1 => Self::Critical,
9519 2 => Self::High,
9520 3 => Self::Medium,
9521 4 => Self::Low,
9522 _ => Self::UnknownValue(severity::UnknownValue(
9523 wkt::internal::UnknownEnumValue::Integer(value),
9524 )),
9525 }
9526 }
9527 }
9528
9529 impl std::convert::From<&str> for Severity {
9530 fn from(value: &str) -> Self {
9531 use std::string::ToString;
9532 match value {
9533 "SEVERITY_UNSPECIFIED" => Self::Unspecified,
9534 "CRITICAL" => Self::Critical,
9535 "HIGH" => Self::High,
9536 "MEDIUM" => Self::Medium,
9537 "LOW" => Self::Low,
9538 _ => Self::UnknownValue(severity::UnknownValue(
9539 wkt::internal::UnknownEnumValue::String(value.to_string()),
9540 )),
9541 }
9542 }
9543 }
9544
9545 impl serde::ser::Serialize for Severity {
9546 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9547 where
9548 S: serde::Serializer,
9549 {
9550 match self {
9551 Self::Unspecified => serializer.serialize_i32(0),
9552 Self::Critical => serializer.serialize_i32(1),
9553 Self::High => serializer.serialize_i32(2),
9554 Self::Medium => serializer.serialize_i32(3),
9555 Self::Low => serializer.serialize_i32(4),
9556 Self::UnknownValue(u) => u.0.serialize(serializer),
9557 }
9558 }
9559 }
9560
9561 impl<'de> serde::de::Deserialize<'de> for Severity {
9562 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9563 where
9564 D: serde::Deserializer<'de>,
9565 {
9566 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
9567 ".google.cloud.securityposture.v1.CustomConfig.Severity",
9568 ))
9569 }
9570 }
9571}
9572
9573#[derive(Clone, Debug, PartialEq)]
9589#[non_exhaustive]
9590pub enum EnablementState {
9591 Unspecified,
9593 Enabled,
9595 Disabled,
9597 UnknownValue(enablement_state::UnknownValue),
9602}
9603
9604#[doc(hidden)]
9605pub mod enablement_state {
9606 #[allow(unused_imports)]
9607 use super::*;
9608 #[derive(Clone, Debug, PartialEq)]
9609 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9610}
9611
9612impl EnablementState {
9613 pub fn value(&self) -> std::option::Option<i32> {
9618 match self {
9619 Self::Unspecified => std::option::Option::Some(0),
9620 Self::Enabled => std::option::Option::Some(1),
9621 Self::Disabled => std::option::Option::Some(2),
9622 Self::UnknownValue(u) => u.0.value(),
9623 }
9624 }
9625
9626 pub fn name(&self) -> std::option::Option<&str> {
9631 match self {
9632 Self::Unspecified => std::option::Option::Some("ENABLEMENT_STATE_UNSPECIFIED"),
9633 Self::Enabled => std::option::Option::Some("ENABLED"),
9634 Self::Disabled => std::option::Option::Some("DISABLED"),
9635 Self::UnknownValue(u) => u.0.name(),
9636 }
9637 }
9638}
9639
9640impl std::default::Default for EnablementState {
9641 fn default() -> Self {
9642 use std::convert::From;
9643 Self::from(0)
9644 }
9645}
9646
9647impl std::fmt::Display for EnablementState {
9648 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9649 wkt::internal::display_enum(f, self.name(), self.value())
9650 }
9651}
9652
9653impl std::convert::From<i32> for EnablementState {
9654 fn from(value: i32) -> Self {
9655 match value {
9656 0 => Self::Unspecified,
9657 1 => Self::Enabled,
9658 2 => Self::Disabled,
9659 _ => Self::UnknownValue(enablement_state::UnknownValue(
9660 wkt::internal::UnknownEnumValue::Integer(value),
9661 )),
9662 }
9663 }
9664}
9665
9666impl std::convert::From<&str> for EnablementState {
9667 fn from(value: &str) -> Self {
9668 use std::string::ToString;
9669 match value {
9670 "ENABLEMENT_STATE_UNSPECIFIED" => Self::Unspecified,
9671 "ENABLED" => Self::Enabled,
9672 "DISABLED" => Self::Disabled,
9673 _ => Self::UnknownValue(enablement_state::UnknownValue(
9674 wkt::internal::UnknownEnumValue::String(value.to_string()),
9675 )),
9676 }
9677 }
9678}
9679
9680impl serde::ser::Serialize for EnablementState {
9681 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9682 where
9683 S: serde::Serializer,
9684 {
9685 match self {
9686 Self::Unspecified => serializer.serialize_i32(0),
9687 Self::Enabled => serializer.serialize_i32(1),
9688 Self::Disabled => serializer.serialize_i32(2),
9689 Self::UnknownValue(u) => u.0.serialize(serializer),
9690 }
9691 }
9692}
9693
9694impl<'de> serde::de::Deserialize<'de> for EnablementState {
9695 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9696 where
9697 D: serde::Deserializer<'de>,
9698 {
9699 deserializer.deserialize_any(wkt::internal::EnumVisitor::<EnablementState>::new(
9700 ".google.cloud.securityposture.v1.EnablementState",
9701 ))
9702 }
9703}