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
37mod debug;
38mod deserialize;
39mod serialize;
40
41#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct PolicyRule {
45 pub condition: std::option::Option<gtype::model::Expr>,
58
59 pub kind: std::option::Option<crate::model::policy_rule::Kind>,
60
61 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
62}
63
64impl PolicyRule {
65 pub fn new() -> Self {
66 std::default::Default::default()
67 }
68
69 pub fn set_condition<T>(mut self, v: T) -> Self
71 where
72 T: std::convert::Into<gtype::model::Expr>,
73 {
74 self.condition = std::option::Option::Some(v.into());
75 self
76 }
77
78 pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
80 where
81 T: std::convert::Into<gtype::model::Expr>,
82 {
83 self.condition = v.map(|x| x.into());
84 self
85 }
86
87 pub fn set_kind<T: std::convert::Into<std::option::Option<crate::model::policy_rule::Kind>>>(
92 mut self,
93 v: T,
94 ) -> Self {
95 self.kind = v.into();
96 self
97 }
98
99 pub fn values(
103 &self,
104 ) -> std::option::Option<&std::boxed::Box<crate::model::policy_rule::StringValues>> {
105 #[allow(unreachable_patterns)]
106 self.kind.as_ref().and_then(|v| match v {
107 crate::model::policy_rule::Kind::Values(v) => std::option::Option::Some(v),
108 _ => std::option::Option::None,
109 })
110 }
111
112 pub fn set_values<
118 T: std::convert::Into<std::boxed::Box<crate::model::policy_rule::StringValues>>,
119 >(
120 mut self,
121 v: T,
122 ) -> Self {
123 self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::Values(v.into()));
124 self
125 }
126
127 pub fn allow_all(&self) -> std::option::Option<&bool> {
131 #[allow(unreachable_patterns)]
132 self.kind.as_ref().and_then(|v| match v {
133 crate::model::policy_rule::Kind::AllowAll(v) => std::option::Option::Some(v),
134 _ => std::option::Option::None,
135 })
136 }
137
138 pub fn set_allow_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
144 self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::AllowAll(v.into()));
145 self
146 }
147
148 pub fn deny_all(&self) -> std::option::Option<&bool> {
152 #[allow(unreachable_patterns)]
153 self.kind.as_ref().and_then(|v| match v {
154 crate::model::policy_rule::Kind::DenyAll(v) => std::option::Option::Some(v),
155 _ => std::option::Option::None,
156 })
157 }
158
159 pub fn set_deny_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
165 self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::DenyAll(v.into()));
166 self
167 }
168
169 pub fn enforce(&self) -> std::option::Option<&bool> {
173 #[allow(unreachable_patterns)]
174 self.kind.as_ref().and_then(|v| match v {
175 crate::model::policy_rule::Kind::Enforce(v) => std::option::Option::Some(v),
176 _ => std::option::Option::None,
177 })
178 }
179
180 pub fn set_enforce<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
186 self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::Enforce(v.into()));
187 self
188 }
189}
190
191impl wkt::message::Message for PolicyRule {
192 fn typename() -> &'static str {
193 "type.googleapis.com/google.cloud.securityposture.v1.PolicyRule"
194 }
195}
196
197pub mod policy_rule {
199 #[allow(unused_imports)]
200 use super::*;
201
202 #[derive(Clone, Default, PartialEq)]
220 #[non_exhaustive]
221 pub struct StringValues {
222 pub allowed_values: std::vec::Vec<std::string::String>,
224
225 pub denied_values: std::vec::Vec<std::string::String>,
227
228 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
229 }
230
231 impl StringValues {
232 pub fn new() -> Self {
233 std::default::Default::default()
234 }
235
236 pub fn set_allowed_values<T, V>(mut self, v: T) -> Self
238 where
239 T: std::iter::IntoIterator<Item = V>,
240 V: std::convert::Into<std::string::String>,
241 {
242 use std::iter::Iterator;
243 self.allowed_values = v.into_iter().map(|i| i.into()).collect();
244 self
245 }
246
247 pub fn set_denied_values<T, V>(mut self, v: T) -> Self
249 where
250 T: std::iter::IntoIterator<Item = V>,
251 V: std::convert::Into<std::string::String>,
252 {
253 use std::iter::Iterator;
254 self.denied_values = v.into_iter().map(|i| i.into()).collect();
255 self
256 }
257 }
258
259 impl wkt::message::Message for StringValues {
260 fn typename() -> &'static str {
261 "type.googleapis.com/google.cloud.securityposture.v1.PolicyRule.StringValues"
262 }
263 }
264
265 #[derive(Clone, Debug, PartialEq)]
266 #[non_exhaustive]
267 pub enum Kind {
268 Values(std::boxed::Box<crate::model::policy_rule::StringValues>),
271 AllowAll(bool),
274 DenyAll(bool),
277 Enforce(bool),
281 }
282}
283
284#[derive(Clone, Default, PartialEq)]
291#[non_exhaustive]
292pub struct CustomConstraint {
293 pub name: std::string::String,
304
305 pub resource_types: std::vec::Vec<std::string::String>,
310
311 pub method_types: std::vec::Vec<crate::model::custom_constraint::MethodType>,
313
314 pub condition: std::string::String,
320
321 pub action_type: crate::model::custom_constraint::ActionType,
323
324 pub display_name: std::string::String,
327
328 pub description: std::string::String,
331
332 pub update_time: std::option::Option<wkt::Timestamp>,
336
337 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
338}
339
340impl CustomConstraint {
341 pub fn new() -> Self {
342 std::default::Default::default()
343 }
344
345 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
347 self.name = v.into();
348 self
349 }
350
351 pub fn set_resource_types<T, V>(mut self, v: T) -> Self
353 where
354 T: std::iter::IntoIterator<Item = V>,
355 V: std::convert::Into<std::string::String>,
356 {
357 use std::iter::Iterator;
358 self.resource_types = v.into_iter().map(|i| i.into()).collect();
359 self
360 }
361
362 pub fn set_method_types<T, V>(mut self, v: T) -> Self
364 where
365 T: std::iter::IntoIterator<Item = V>,
366 V: std::convert::Into<crate::model::custom_constraint::MethodType>,
367 {
368 use std::iter::Iterator;
369 self.method_types = v.into_iter().map(|i| i.into()).collect();
370 self
371 }
372
373 pub fn set_condition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
375 self.condition = v.into();
376 self
377 }
378
379 pub fn set_action_type<T: std::convert::Into<crate::model::custom_constraint::ActionType>>(
381 mut self,
382 v: T,
383 ) -> Self {
384 self.action_type = v.into();
385 self
386 }
387
388 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
390 self.display_name = v.into();
391 self
392 }
393
394 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
396 self.description = v.into();
397 self
398 }
399
400 pub fn set_update_time<T>(mut self, v: T) -> Self
402 where
403 T: std::convert::Into<wkt::Timestamp>,
404 {
405 self.update_time = std::option::Option::Some(v.into());
406 self
407 }
408
409 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
411 where
412 T: std::convert::Into<wkt::Timestamp>,
413 {
414 self.update_time = v.map(|x| x.into());
415 self
416 }
417}
418
419impl wkt::message::Message for CustomConstraint {
420 fn typename() -> &'static str {
421 "type.googleapis.com/google.cloud.securityposture.v1.CustomConstraint"
422 }
423}
424
425pub mod custom_constraint {
427 #[allow(unused_imports)]
428 use super::*;
429
430 #[derive(Clone, Debug, PartialEq)]
452 #[non_exhaustive]
453 pub enum MethodType {
454 Unspecified,
456 Create,
458 Update,
460 Delete,
463 UnknownValue(method_type::UnknownValue),
468 }
469
470 #[doc(hidden)]
471 pub mod method_type {
472 #[allow(unused_imports)]
473 use super::*;
474 #[derive(Clone, Debug, PartialEq)]
475 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
476 }
477
478 impl MethodType {
479 pub fn value(&self) -> std::option::Option<i32> {
484 match self {
485 Self::Unspecified => std::option::Option::Some(0),
486 Self::Create => std::option::Option::Some(1),
487 Self::Update => std::option::Option::Some(2),
488 Self::Delete => std::option::Option::Some(3),
489 Self::UnknownValue(u) => u.0.value(),
490 }
491 }
492
493 pub fn name(&self) -> std::option::Option<&str> {
498 match self {
499 Self::Unspecified => std::option::Option::Some("METHOD_TYPE_UNSPECIFIED"),
500 Self::Create => std::option::Option::Some("CREATE"),
501 Self::Update => std::option::Option::Some("UPDATE"),
502 Self::Delete => std::option::Option::Some("DELETE"),
503 Self::UnknownValue(u) => u.0.name(),
504 }
505 }
506 }
507
508 impl std::default::Default for MethodType {
509 fn default() -> Self {
510 use std::convert::From;
511 Self::from(0)
512 }
513 }
514
515 impl std::fmt::Display for MethodType {
516 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
517 wkt::internal::display_enum(f, self.name(), self.value())
518 }
519 }
520
521 impl std::convert::From<i32> for MethodType {
522 fn from(value: i32) -> Self {
523 match value {
524 0 => Self::Unspecified,
525 1 => Self::Create,
526 2 => Self::Update,
527 3 => Self::Delete,
528 _ => Self::UnknownValue(method_type::UnknownValue(
529 wkt::internal::UnknownEnumValue::Integer(value),
530 )),
531 }
532 }
533 }
534
535 impl std::convert::From<&str> for MethodType {
536 fn from(value: &str) -> Self {
537 use std::string::ToString;
538 match value {
539 "METHOD_TYPE_UNSPECIFIED" => Self::Unspecified,
540 "CREATE" => Self::Create,
541 "UPDATE" => Self::Update,
542 "DELETE" => Self::Delete,
543 _ => Self::UnknownValue(method_type::UnknownValue(
544 wkt::internal::UnknownEnumValue::String(value.to_string()),
545 )),
546 }
547 }
548 }
549
550 impl serde::ser::Serialize for MethodType {
551 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
552 where
553 S: serde::Serializer,
554 {
555 match self {
556 Self::Unspecified => serializer.serialize_i32(0),
557 Self::Create => serializer.serialize_i32(1),
558 Self::Update => serializer.serialize_i32(2),
559 Self::Delete => serializer.serialize_i32(3),
560 Self::UnknownValue(u) => u.0.serialize(serializer),
561 }
562 }
563 }
564
565 impl<'de> serde::de::Deserialize<'de> for MethodType {
566 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
567 where
568 D: serde::Deserializer<'de>,
569 {
570 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MethodType>::new(
571 ".google.cloud.securityposture.v1.CustomConstraint.MethodType",
572 ))
573 }
574 }
575
576 #[derive(Clone, Debug, PartialEq)]
592 #[non_exhaustive]
593 pub enum ActionType {
594 Unspecified,
596 Allow,
598 Deny,
600 UnknownValue(action_type::UnknownValue),
605 }
606
607 #[doc(hidden)]
608 pub mod action_type {
609 #[allow(unused_imports)]
610 use super::*;
611 #[derive(Clone, Debug, PartialEq)]
612 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
613 }
614
615 impl ActionType {
616 pub fn value(&self) -> std::option::Option<i32> {
621 match self {
622 Self::Unspecified => std::option::Option::Some(0),
623 Self::Allow => std::option::Option::Some(1),
624 Self::Deny => std::option::Option::Some(2),
625 Self::UnknownValue(u) => u.0.value(),
626 }
627 }
628
629 pub fn name(&self) -> std::option::Option<&str> {
634 match self {
635 Self::Unspecified => std::option::Option::Some("ACTION_TYPE_UNSPECIFIED"),
636 Self::Allow => std::option::Option::Some("ALLOW"),
637 Self::Deny => std::option::Option::Some("DENY"),
638 Self::UnknownValue(u) => u.0.name(),
639 }
640 }
641 }
642
643 impl std::default::Default for ActionType {
644 fn default() -> Self {
645 use std::convert::From;
646 Self::from(0)
647 }
648 }
649
650 impl std::fmt::Display for ActionType {
651 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
652 wkt::internal::display_enum(f, self.name(), self.value())
653 }
654 }
655
656 impl std::convert::From<i32> for ActionType {
657 fn from(value: i32) -> Self {
658 match value {
659 0 => Self::Unspecified,
660 1 => Self::Allow,
661 2 => Self::Deny,
662 _ => Self::UnknownValue(action_type::UnknownValue(
663 wkt::internal::UnknownEnumValue::Integer(value),
664 )),
665 }
666 }
667 }
668
669 impl std::convert::From<&str> for ActionType {
670 fn from(value: &str) -> Self {
671 use std::string::ToString;
672 match value {
673 "ACTION_TYPE_UNSPECIFIED" => Self::Unspecified,
674 "ALLOW" => Self::Allow,
675 "DENY" => Self::Deny,
676 _ => Self::UnknownValue(action_type::UnknownValue(
677 wkt::internal::UnknownEnumValue::String(value.to_string()),
678 )),
679 }
680 }
681 }
682
683 impl serde::ser::Serialize for ActionType {
684 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
685 where
686 S: serde::Serializer,
687 {
688 match self {
689 Self::Unspecified => serializer.serialize_i32(0),
690 Self::Allow => serializer.serialize_i32(1),
691 Self::Deny => serializer.serialize_i32(2),
692 Self::UnknownValue(u) => u.0.serialize(serializer),
693 }
694 }
695 }
696
697 impl<'de> serde::de::Deserialize<'de> for ActionType {
698 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
699 where
700 D: serde::Deserializer<'de>,
701 {
702 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ActionType>::new(
703 ".google.cloud.securityposture.v1.CustomConstraint.ActionType",
704 ))
705 }
706 }
707}
708
709#[derive(Clone, Default, PartialEq)]
711#[non_exhaustive]
712pub struct OrgPolicyConstraint {
713 pub canned_constraint_id: std::string::String,
715
716 pub policy_rules: std::vec::Vec<crate::model::PolicyRule>,
718
719 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
720}
721
722impl OrgPolicyConstraint {
723 pub fn new() -> Self {
724 std::default::Default::default()
725 }
726
727 pub fn set_canned_constraint_id<T: std::convert::Into<std::string::String>>(
729 mut self,
730 v: T,
731 ) -> Self {
732 self.canned_constraint_id = v.into();
733 self
734 }
735
736 pub fn set_policy_rules<T, V>(mut self, v: T) -> Self
738 where
739 T: std::iter::IntoIterator<Item = V>,
740 V: std::convert::Into<crate::model::PolicyRule>,
741 {
742 use std::iter::Iterator;
743 self.policy_rules = v.into_iter().map(|i| i.into()).collect();
744 self
745 }
746}
747
748impl wkt::message::Message for OrgPolicyConstraint {
749 fn typename() -> &'static str {
750 "type.googleapis.com/google.cloud.securityposture.v1.OrgPolicyConstraint"
751 }
752}
753
754#[derive(Clone, Default, PartialEq)]
756#[non_exhaustive]
757pub struct OrgPolicyConstraintCustom {
758 pub custom_constraint: std::option::Option<crate::model::CustomConstraint>,
760
761 pub policy_rules: std::vec::Vec<crate::model::PolicyRule>,
763
764 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
765}
766
767impl OrgPolicyConstraintCustom {
768 pub fn new() -> Self {
769 std::default::Default::default()
770 }
771
772 pub fn set_custom_constraint<T>(mut self, v: T) -> Self
774 where
775 T: std::convert::Into<crate::model::CustomConstraint>,
776 {
777 self.custom_constraint = std::option::Option::Some(v.into());
778 self
779 }
780
781 pub fn set_or_clear_custom_constraint<T>(mut self, v: std::option::Option<T>) -> Self
783 where
784 T: std::convert::Into<crate::model::CustomConstraint>,
785 {
786 self.custom_constraint = v.map(|x| x.into());
787 self
788 }
789
790 pub fn set_policy_rules<T, V>(mut self, v: T) -> Self
792 where
793 T: std::iter::IntoIterator<Item = V>,
794 V: std::convert::Into<crate::model::PolicyRule>,
795 {
796 use std::iter::Iterator;
797 self.policy_rules = v.into_iter().map(|i| i.into()).collect();
798 self
799 }
800}
801
802impl wkt::message::Message for OrgPolicyConstraintCustom {
803 fn typename() -> &'static str {
804 "type.googleapis.com/google.cloud.securityposture.v1.OrgPolicyConstraintCustom"
805 }
806}
807
808#[derive(Clone, Default, PartialEq)]
810#[non_exhaustive]
811pub struct OperationMetadata {
812 pub create_time: std::option::Option<wkt::Timestamp>,
814
815 pub end_time: std::option::Option<wkt::Timestamp>,
817
818 pub target: std::string::String,
820
821 pub verb: std::string::String,
823
824 pub status_message: std::string::String,
826
827 pub requested_cancellation: bool,
835
836 pub api_version: std::string::String,
838
839 pub error_message: std::string::String,
843
844 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
845}
846
847impl OperationMetadata {
848 pub fn new() -> Self {
849 std::default::Default::default()
850 }
851
852 pub fn set_create_time<T>(mut self, v: T) -> Self
854 where
855 T: std::convert::Into<wkt::Timestamp>,
856 {
857 self.create_time = std::option::Option::Some(v.into());
858 self
859 }
860
861 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
863 where
864 T: std::convert::Into<wkt::Timestamp>,
865 {
866 self.create_time = v.map(|x| x.into());
867 self
868 }
869
870 pub fn set_end_time<T>(mut self, v: T) -> Self
872 where
873 T: std::convert::Into<wkt::Timestamp>,
874 {
875 self.end_time = std::option::Option::Some(v.into());
876 self
877 }
878
879 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
881 where
882 T: std::convert::Into<wkt::Timestamp>,
883 {
884 self.end_time = v.map(|x| x.into());
885 self
886 }
887
888 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
890 self.target = v.into();
891 self
892 }
893
894 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
896 self.verb = v.into();
897 self
898 }
899
900 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
902 self.status_message = v.into();
903 self
904 }
905
906 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
908 self.requested_cancellation = v.into();
909 self
910 }
911
912 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
914 self.api_version = v.into();
915 self
916 }
917
918 pub fn set_error_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
920 self.error_message = v.into();
921 self
922 }
923}
924
925impl wkt::message::Message for OperationMetadata {
926 fn typename() -> &'static str {
927 "type.googleapis.com/google.cloud.securityposture.v1.OperationMetadata"
928 }
929}
930
931#[derive(Clone, Default, PartialEq)]
934#[non_exhaustive]
935pub struct Posture {
936 pub name: std::string::String,
939
940 pub state: crate::model::posture::State,
942
943 pub revision_id: std::string::String,
947
948 pub create_time: std::option::Option<wkt::Timestamp>,
950
951 pub update_time: std::option::Option<wkt::Timestamp>,
953
954 pub description: std::string::String,
956
957 pub policy_sets: std::vec::Vec<crate::model::PolicySet>,
959
960 pub etag: std::string::String,
971
972 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
976
977 pub reconciling: bool,
980
981 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
982}
983
984impl Posture {
985 pub fn new() -> Self {
986 std::default::Default::default()
987 }
988
989 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
991 self.name = v.into();
992 self
993 }
994
995 pub fn set_state<T: std::convert::Into<crate::model::posture::State>>(mut self, v: T) -> Self {
997 self.state = v.into();
998 self
999 }
1000
1001 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1003 self.revision_id = v.into();
1004 self
1005 }
1006
1007 pub fn set_create_time<T>(mut self, v: T) -> Self
1009 where
1010 T: std::convert::Into<wkt::Timestamp>,
1011 {
1012 self.create_time = std::option::Option::Some(v.into());
1013 self
1014 }
1015
1016 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1018 where
1019 T: std::convert::Into<wkt::Timestamp>,
1020 {
1021 self.create_time = v.map(|x| x.into());
1022 self
1023 }
1024
1025 pub fn set_update_time<T>(mut self, v: T) -> Self
1027 where
1028 T: std::convert::Into<wkt::Timestamp>,
1029 {
1030 self.update_time = std::option::Option::Some(v.into());
1031 self
1032 }
1033
1034 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1036 where
1037 T: std::convert::Into<wkt::Timestamp>,
1038 {
1039 self.update_time = v.map(|x| x.into());
1040 self
1041 }
1042
1043 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1045 self.description = v.into();
1046 self
1047 }
1048
1049 pub fn set_policy_sets<T, V>(mut self, v: T) -> Self
1051 where
1052 T: std::iter::IntoIterator<Item = V>,
1053 V: std::convert::Into<crate::model::PolicySet>,
1054 {
1055 use std::iter::Iterator;
1056 self.policy_sets = v.into_iter().map(|i| i.into()).collect();
1057 self
1058 }
1059
1060 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1062 self.etag = v.into();
1063 self
1064 }
1065
1066 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
1068 where
1069 T: std::iter::IntoIterator<Item = (K, V)>,
1070 K: std::convert::Into<std::string::String>,
1071 V: std::convert::Into<std::string::String>,
1072 {
1073 use std::iter::Iterator;
1074 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1075 self
1076 }
1077
1078 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1080 self.reconciling = v.into();
1081 self
1082 }
1083}
1084
1085impl wkt::message::Message for Posture {
1086 fn typename() -> &'static str {
1087 "type.googleapis.com/google.cloud.securityposture.v1.Posture"
1088 }
1089}
1090
1091pub mod posture {
1093 #[allow(unused_imports)]
1094 use super::*;
1095
1096 #[derive(Clone, Debug, PartialEq)]
1112 #[non_exhaustive]
1113 pub enum State {
1114 Unspecified,
1116 Deprecated,
1118 Draft,
1120 Active,
1122 UnknownValue(state::UnknownValue),
1127 }
1128
1129 #[doc(hidden)]
1130 pub mod state {
1131 #[allow(unused_imports)]
1132 use super::*;
1133 #[derive(Clone, Debug, PartialEq)]
1134 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1135 }
1136
1137 impl State {
1138 pub fn value(&self) -> std::option::Option<i32> {
1143 match self {
1144 Self::Unspecified => std::option::Option::Some(0),
1145 Self::Deprecated => std::option::Option::Some(1),
1146 Self::Draft => std::option::Option::Some(2),
1147 Self::Active => std::option::Option::Some(3),
1148 Self::UnknownValue(u) => u.0.value(),
1149 }
1150 }
1151
1152 pub fn name(&self) -> std::option::Option<&str> {
1157 match self {
1158 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1159 Self::Deprecated => std::option::Option::Some("DEPRECATED"),
1160 Self::Draft => std::option::Option::Some("DRAFT"),
1161 Self::Active => std::option::Option::Some("ACTIVE"),
1162 Self::UnknownValue(u) => u.0.name(),
1163 }
1164 }
1165 }
1166
1167 impl std::default::Default for State {
1168 fn default() -> Self {
1169 use std::convert::From;
1170 Self::from(0)
1171 }
1172 }
1173
1174 impl std::fmt::Display for State {
1175 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1176 wkt::internal::display_enum(f, self.name(), self.value())
1177 }
1178 }
1179
1180 impl std::convert::From<i32> for State {
1181 fn from(value: i32) -> Self {
1182 match value {
1183 0 => Self::Unspecified,
1184 1 => Self::Deprecated,
1185 2 => Self::Draft,
1186 3 => Self::Active,
1187 _ => Self::UnknownValue(state::UnknownValue(
1188 wkt::internal::UnknownEnumValue::Integer(value),
1189 )),
1190 }
1191 }
1192 }
1193
1194 impl std::convert::From<&str> for State {
1195 fn from(value: &str) -> Self {
1196 use std::string::ToString;
1197 match value {
1198 "STATE_UNSPECIFIED" => Self::Unspecified,
1199 "DEPRECATED" => Self::Deprecated,
1200 "DRAFT" => Self::Draft,
1201 "ACTIVE" => Self::Active,
1202 _ => Self::UnknownValue(state::UnknownValue(
1203 wkt::internal::UnknownEnumValue::String(value.to_string()),
1204 )),
1205 }
1206 }
1207 }
1208
1209 impl serde::ser::Serialize for State {
1210 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1211 where
1212 S: serde::Serializer,
1213 {
1214 match self {
1215 Self::Unspecified => serializer.serialize_i32(0),
1216 Self::Deprecated => serializer.serialize_i32(1),
1217 Self::Draft => serializer.serialize_i32(2),
1218 Self::Active => serializer.serialize_i32(3),
1219 Self::UnknownValue(u) => u.0.serialize(serializer),
1220 }
1221 }
1222 }
1223
1224 impl<'de> serde::de::Deserialize<'de> for State {
1225 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1226 where
1227 D: serde::Deserializer<'de>,
1228 {
1229 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1230 ".google.cloud.securityposture.v1.Posture.State",
1231 ))
1232 }
1233 }
1234}
1235
1236#[derive(Clone, Default, PartialEq)]
1238#[non_exhaustive]
1239pub struct PolicySet {
1240 pub policy_set_id: std::string::String,
1242
1243 pub description: std::string::String,
1245
1246 pub policies: std::vec::Vec<crate::model::Policy>,
1248
1249 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1250}
1251
1252impl PolicySet {
1253 pub fn new() -> Self {
1254 std::default::Default::default()
1255 }
1256
1257 pub fn set_policy_set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1259 self.policy_set_id = v.into();
1260 self
1261 }
1262
1263 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1265 self.description = v.into();
1266 self
1267 }
1268
1269 pub fn set_policies<T, V>(mut self, v: T) -> Self
1271 where
1272 T: std::iter::IntoIterator<Item = V>,
1273 V: std::convert::Into<crate::model::Policy>,
1274 {
1275 use std::iter::Iterator;
1276 self.policies = v.into_iter().map(|i| i.into()).collect();
1277 self
1278 }
1279}
1280
1281impl wkt::message::Message for PolicySet {
1282 fn typename() -> &'static str {
1283 "type.googleapis.com/google.cloud.securityposture.v1.PolicySet"
1284 }
1285}
1286
1287#[derive(Clone, Default, PartialEq)]
1289#[non_exhaustive]
1290pub struct Policy {
1291 pub policy_id: std::string::String,
1294
1295 pub compliance_standards: std::vec::Vec<crate::model::policy::ComplianceStandard>,
1297
1298 pub constraint: std::option::Option<crate::model::Constraint>,
1300
1301 pub description: std::string::String,
1303
1304 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1305}
1306
1307impl Policy {
1308 pub fn new() -> Self {
1309 std::default::Default::default()
1310 }
1311
1312 pub fn set_policy_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1314 self.policy_id = v.into();
1315 self
1316 }
1317
1318 pub fn set_compliance_standards<T, V>(mut self, v: T) -> Self
1320 where
1321 T: std::iter::IntoIterator<Item = V>,
1322 V: std::convert::Into<crate::model::policy::ComplianceStandard>,
1323 {
1324 use std::iter::Iterator;
1325 self.compliance_standards = v.into_iter().map(|i| i.into()).collect();
1326 self
1327 }
1328
1329 pub fn set_constraint<T>(mut self, v: T) -> Self
1331 where
1332 T: std::convert::Into<crate::model::Constraint>,
1333 {
1334 self.constraint = std::option::Option::Some(v.into());
1335 self
1336 }
1337
1338 pub fn set_or_clear_constraint<T>(mut self, v: std::option::Option<T>) -> Self
1340 where
1341 T: std::convert::Into<crate::model::Constraint>,
1342 {
1343 self.constraint = v.map(|x| x.into());
1344 self
1345 }
1346
1347 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1349 self.description = v.into();
1350 self
1351 }
1352}
1353
1354impl wkt::message::Message for Policy {
1355 fn typename() -> &'static str {
1356 "type.googleapis.com/google.cloud.securityposture.v1.Policy"
1357 }
1358}
1359
1360pub mod policy {
1362 #[allow(unused_imports)]
1363 use super::*;
1364
1365 #[derive(Clone, Default, PartialEq)]
1367 #[non_exhaustive]
1368 pub struct ComplianceStandard {
1369 pub standard: std::string::String,
1371
1372 pub control: std::string::String,
1374
1375 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1376 }
1377
1378 impl ComplianceStandard {
1379 pub fn new() -> Self {
1380 std::default::Default::default()
1381 }
1382
1383 pub fn set_standard<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1385 self.standard = v.into();
1386 self
1387 }
1388
1389 pub fn set_control<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1391 self.control = v.into();
1392 self
1393 }
1394 }
1395
1396 impl wkt::message::Message for ComplianceStandard {
1397 fn typename() -> &'static str {
1398 "type.googleapis.com/google.cloud.securityposture.v1.Policy.ComplianceStandard"
1399 }
1400 }
1401}
1402
1403#[derive(Clone, Default, PartialEq)]
1405#[non_exhaustive]
1406pub struct Constraint {
1407 pub implementation: std::option::Option<crate::model::constraint::Implementation>,
1408
1409 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1410}
1411
1412impl Constraint {
1413 pub fn new() -> Self {
1414 std::default::Default::default()
1415 }
1416
1417 pub fn set_implementation<
1422 T: std::convert::Into<std::option::Option<crate::model::constraint::Implementation>>,
1423 >(
1424 mut self,
1425 v: T,
1426 ) -> Self {
1427 self.implementation = v.into();
1428 self
1429 }
1430
1431 pub fn security_health_analytics_module(
1435 &self,
1436 ) -> std::option::Option<&std::boxed::Box<crate::model::SecurityHealthAnalyticsModule>> {
1437 #[allow(unreachable_patterns)]
1438 self.implementation.as_ref().and_then(|v| match v {
1439 crate::model::constraint::Implementation::SecurityHealthAnalyticsModule(v) => {
1440 std::option::Option::Some(v)
1441 }
1442 _ => std::option::Option::None,
1443 })
1444 }
1445
1446 pub fn set_security_health_analytics_module<
1452 T: std::convert::Into<std::boxed::Box<crate::model::SecurityHealthAnalyticsModule>>,
1453 >(
1454 mut self,
1455 v: T,
1456 ) -> Self {
1457 self.implementation = std::option::Option::Some(
1458 crate::model::constraint::Implementation::SecurityHealthAnalyticsModule(v.into()),
1459 );
1460 self
1461 }
1462
1463 pub fn security_health_analytics_custom_module(
1467 &self,
1468 ) -> std::option::Option<&std::boxed::Box<crate::model::SecurityHealthAnalyticsCustomModule>>
1469 {
1470 #[allow(unreachable_patterns)]
1471 self.implementation.as_ref().and_then(|v| match v {
1472 crate::model::constraint::Implementation::SecurityHealthAnalyticsCustomModule(v) => {
1473 std::option::Option::Some(v)
1474 }
1475 _ => std::option::Option::None,
1476 })
1477 }
1478
1479 pub fn set_security_health_analytics_custom_module<
1485 T: std::convert::Into<std::boxed::Box<crate::model::SecurityHealthAnalyticsCustomModule>>,
1486 >(
1487 mut self,
1488 v: T,
1489 ) -> Self {
1490 self.implementation = std::option::Option::Some(
1491 crate::model::constraint::Implementation::SecurityHealthAnalyticsCustomModule(v.into()),
1492 );
1493 self
1494 }
1495
1496 pub fn org_policy_constraint(
1500 &self,
1501 ) -> std::option::Option<&std::boxed::Box<crate::model::OrgPolicyConstraint>> {
1502 #[allow(unreachable_patterns)]
1503 self.implementation.as_ref().and_then(|v| match v {
1504 crate::model::constraint::Implementation::OrgPolicyConstraint(v) => {
1505 std::option::Option::Some(v)
1506 }
1507 _ => std::option::Option::None,
1508 })
1509 }
1510
1511 pub fn set_org_policy_constraint<
1517 T: std::convert::Into<std::boxed::Box<crate::model::OrgPolicyConstraint>>,
1518 >(
1519 mut self,
1520 v: T,
1521 ) -> Self {
1522 self.implementation = std::option::Option::Some(
1523 crate::model::constraint::Implementation::OrgPolicyConstraint(v.into()),
1524 );
1525 self
1526 }
1527
1528 pub fn org_policy_constraint_custom(
1532 &self,
1533 ) -> std::option::Option<&std::boxed::Box<crate::model::OrgPolicyConstraintCustom>> {
1534 #[allow(unreachable_patterns)]
1535 self.implementation.as_ref().and_then(|v| match v {
1536 crate::model::constraint::Implementation::OrgPolicyConstraintCustom(v) => {
1537 std::option::Option::Some(v)
1538 }
1539 _ => std::option::Option::None,
1540 })
1541 }
1542
1543 pub fn set_org_policy_constraint_custom<
1549 T: std::convert::Into<std::boxed::Box<crate::model::OrgPolicyConstraintCustom>>,
1550 >(
1551 mut self,
1552 v: T,
1553 ) -> Self {
1554 self.implementation = std::option::Option::Some(
1555 crate::model::constraint::Implementation::OrgPolicyConstraintCustom(v.into()),
1556 );
1557 self
1558 }
1559}
1560
1561impl wkt::message::Message for Constraint {
1562 fn typename() -> &'static str {
1563 "type.googleapis.com/google.cloud.securityposture.v1.Constraint"
1564 }
1565}
1566
1567pub mod constraint {
1569 #[allow(unused_imports)]
1570 use super::*;
1571
1572 #[derive(Clone, Debug, PartialEq)]
1573 #[non_exhaustive]
1574 pub enum Implementation {
1575 SecurityHealthAnalyticsModule(std::boxed::Box<crate::model::SecurityHealthAnalyticsModule>),
1577 SecurityHealthAnalyticsCustomModule(
1579 std::boxed::Box<crate::model::SecurityHealthAnalyticsCustomModule>,
1580 ),
1581 OrgPolicyConstraint(std::boxed::Box<crate::model::OrgPolicyConstraint>),
1583 OrgPolicyConstraintCustom(std::boxed::Box<crate::model::OrgPolicyConstraintCustom>),
1585 }
1586}
1587
1588#[derive(Clone, Default, PartialEq)]
1590#[non_exhaustive]
1591pub struct ListPosturesRequest {
1592 pub parent: std::string::String,
1594
1595 pub page_size: i32,
1598
1599 pub page_token: std::string::String,
1601
1602 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1603}
1604
1605impl ListPosturesRequest {
1606 pub fn new() -> Self {
1607 std::default::Default::default()
1608 }
1609
1610 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1612 self.parent = v.into();
1613 self
1614 }
1615
1616 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1618 self.page_size = v.into();
1619 self
1620 }
1621
1622 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1624 self.page_token = v.into();
1625 self
1626 }
1627}
1628
1629impl wkt::message::Message for ListPosturesRequest {
1630 fn typename() -> &'static str {
1631 "type.googleapis.com/google.cloud.securityposture.v1.ListPosturesRequest"
1632 }
1633}
1634
1635#[derive(Clone, Default, PartialEq)]
1637#[non_exhaustive]
1638pub struct ListPosturesResponse {
1639 pub postures: std::vec::Vec<crate::model::Posture>,
1641
1642 pub next_page_token: std::string::String,
1644
1645 pub unreachable: std::vec::Vec<std::string::String>,
1647
1648 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1649}
1650
1651impl ListPosturesResponse {
1652 pub fn new() -> Self {
1653 std::default::Default::default()
1654 }
1655
1656 pub fn set_postures<T, V>(mut self, v: T) -> Self
1658 where
1659 T: std::iter::IntoIterator<Item = V>,
1660 V: std::convert::Into<crate::model::Posture>,
1661 {
1662 use std::iter::Iterator;
1663 self.postures = v.into_iter().map(|i| i.into()).collect();
1664 self
1665 }
1666
1667 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1669 self.next_page_token = v.into();
1670 self
1671 }
1672
1673 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1675 where
1676 T: std::iter::IntoIterator<Item = V>,
1677 V: std::convert::Into<std::string::String>,
1678 {
1679 use std::iter::Iterator;
1680 self.unreachable = v.into_iter().map(|i| i.into()).collect();
1681 self
1682 }
1683}
1684
1685impl wkt::message::Message for ListPosturesResponse {
1686 fn typename() -> &'static str {
1687 "type.googleapis.com/google.cloud.securityposture.v1.ListPosturesResponse"
1688 }
1689}
1690
1691#[doc(hidden)]
1692impl gax::paginator::internal::PageableResponse for ListPosturesResponse {
1693 type PageItem = crate::model::Posture;
1694
1695 fn items(self) -> std::vec::Vec<Self::PageItem> {
1696 self.postures
1697 }
1698
1699 fn next_page_token(&self) -> std::string::String {
1700 use std::clone::Clone;
1701 self.next_page_token.clone()
1702 }
1703}
1704
1705#[derive(Clone, Default, PartialEq)]
1707#[non_exhaustive]
1708pub struct ListPostureRevisionsRequest {
1709 pub name: std::string::String,
1711
1712 pub page_size: i32,
1715
1716 pub page_token: std::string::String,
1718
1719 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1720}
1721
1722impl ListPostureRevisionsRequest {
1723 pub fn new() -> Self {
1724 std::default::Default::default()
1725 }
1726
1727 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1729 self.name = v.into();
1730 self
1731 }
1732
1733 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1735 self.page_size = v.into();
1736 self
1737 }
1738
1739 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1741 self.page_token = v.into();
1742 self
1743 }
1744}
1745
1746impl wkt::message::Message for ListPostureRevisionsRequest {
1747 fn typename() -> &'static str {
1748 "type.googleapis.com/google.cloud.securityposture.v1.ListPostureRevisionsRequest"
1749 }
1750}
1751
1752#[derive(Clone, Default, PartialEq)]
1754#[non_exhaustive]
1755pub struct ListPostureRevisionsResponse {
1756 pub revisions: std::vec::Vec<crate::model::Posture>,
1758
1759 pub next_page_token: std::string::String,
1761
1762 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1763}
1764
1765impl ListPostureRevisionsResponse {
1766 pub fn new() -> Self {
1767 std::default::Default::default()
1768 }
1769
1770 pub fn set_revisions<T, V>(mut self, v: T) -> Self
1772 where
1773 T: std::iter::IntoIterator<Item = V>,
1774 V: std::convert::Into<crate::model::Posture>,
1775 {
1776 use std::iter::Iterator;
1777 self.revisions = v.into_iter().map(|i| i.into()).collect();
1778 self
1779 }
1780
1781 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1783 self.next_page_token = v.into();
1784 self
1785 }
1786}
1787
1788impl wkt::message::Message for ListPostureRevisionsResponse {
1789 fn typename() -> &'static str {
1790 "type.googleapis.com/google.cloud.securityposture.v1.ListPostureRevisionsResponse"
1791 }
1792}
1793
1794#[doc(hidden)]
1795impl gax::paginator::internal::PageableResponse for ListPostureRevisionsResponse {
1796 type PageItem = crate::model::Posture;
1797
1798 fn items(self) -> std::vec::Vec<Self::PageItem> {
1799 self.revisions
1800 }
1801
1802 fn next_page_token(&self) -> std::string::String {
1803 use std::clone::Clone;
1804 self.next_page_token.clone()
1805 }
1806}
1807
1808#[derive(Clone, Default, PartialEq)]
1810#[non_exhaustive]
1811pub struct GetPostureRequest {
1812 pub name: std::string::String,
1814
1815 pub revision_id: std::string::String,
1817
1818 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1819}
1820
1821impl GetPostureRequest {
1822 pub fn new() -> Self {
1823 std::default::Default::default()
1824 }
1825
1826 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1828 self.name = v.into();
1829 self
1830 }
1831
1832 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1834 self.revision_id = v.into();
1835 self
1836 }
1837}
1838
1839impl wkt::message::Message for GetPostureRequest {
1840 fn typename() -> &'static str {
1841 "type.googleapis.com/google.cloud.securityposture.v1.GetPostureRequest"
1842 }
1843}
1844
1845#[derive(Clone, Default, PartialEq)]
1847#[non_exhaustive]
1848pub struct CreatePostureRequest {
1849 pub parent: std::string::String,
1851
1852 pub posture_id: std::string::String,
1855
1856 pub posture: std::option::Option<crate::model::Posture>,
1858
1859 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1860}
1861
1862impl CreatePostureRequest {
1863 pub fn new() -> Self {
1864 std::default::Default::default()
1865 }
1866
1867 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1869 self.parent = v.into();
1870 self
1871 }
1872
1873 pub fn set_posture_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1875 self.posture_id = v.into();
1876 self
1877 }
1878
1879 pub fn set_posture<T>(mut self, v: T) -> Self
1881 where
1882 T: std::convert::Into<crate::model::Posture>,
1883 {
1884 self.posture = std::option::Option::Some(v.into());
1885 self
1886 }
1887
1888 pub fn set_or_clear_posture<T>(mut self, v: std::option::Option<T>) -> Self
1890 where
1891 T: std::convert::Into<crate::model::Posture>,
1892 {
1893 self.posture = v.map(|x| x.into());
1894 self
1895 }
1896}
1897
1898impl wkt::message::Message for CreatePostureRequest {
1899 fn typename() -> &'static str {
1900 "type.googleapis.com/google.cloud.securityposture.v1.CreatePostureRequest"
1901 }
1902}
1903
1904#[derive(Clone, Default, PartialEq)]
1906#[non_exhaustive]
1907pub struct UpdatePostureRequest {
1908 pub update_mask: std::option::Option<wkt::FieldMask>,
1914
1915 pub posture: std::option::Option<crate::model::Posture>,
1917
1918 pub revision_id: std::string::String,
1920
1921 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1922}
1923
1924impl UpdatePostureRequest {
1925 pub fn new() -> Self {
1926 std::default::Default::default()
1927 }
1928
1929 pub fn set_update_mask<T>(mut self, v: T) -> Self
1931 where
1932 T: std::convert::Into<wkt::FieldMask>,
1933 {
1934 self.update_mask = std::option::Option::Some(v.into());
1935 self
1936 }
1937
1938 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1940 where
1941 T: std::convert::Into<wkt::FieldMask>,
1942 {
1943 self.update_mask = v.map(|x| x.into());
1944 self
1945 }
1946
1947 pub fn set_posture<T>(mut self, v: T) -> Self
1949 where
1950 T: std::convert::Into<crate::model::Posture>,
1951 {
1952 self.posture = std::option::Option::Some(v.into());
1953 self
1954 }
1955
1956 pub fn set_or_clear_posture<T>(mut self, v: std::option::Option<T>) -> Self
1958 where
1959 T: std::convert::Into<crate::model::Posture>,
1960 {
1961 self.posture = v.map(|x| x.into());
1962 self
1963 }
1964
1965 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1967 self.revision_id = v.into();
1968 self
1969 }
1970}
1971
1972impl wkt::message::Message for UpdatePostureRequest {
1973 fn typename() -> &'static str {
1974 "type.googleapis.com/google.cloud.securityposture.v1.UpdatePostureRequest"
1975 }
1976}
1977
1978#[derive(Clone, Default, PartialEq)]
1980#[non_exhaustive]
1981pub struct DeletePostureRequest {
1982 pub name: std::string::String,
1984
1985 pub etag: std::string::String,
1987
1988 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1989}
1990
1991impl DeletePostureRequest {
1992 pub fn new() -> Self {
1993 std::default::Default::default()
1994 }
1995
1996 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1998 self.name = v.into();
1999 self
2000 }
2001
2002 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2004 self.etag = v.into();
2005 self
2006 }
2007}
2008
2009impl wkt::message::Message for DeletePostureRequest {
2010 fn typename() -> &'static str {
2011 "type.googleapis.com/google.cloud.securityposture.v1.DeletePostureRequest"
2012 }
2013}
2014
2015#[derive(Clone, Default, PartialEq)]
2017#[non_exhaustive]
2018pub struct ExtractPostureRequest {
2019 pub parent: std::string::String,
2022
2023 pub posture_id: std::string::String,
2026
2027 pub workload: std::string::String,
2035
2036 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2037}
2038
2039impl ExtractPostureRequest {
2040 pub fn new() -> Self {
2041 std::default::Default::default()
2042 }
2043
2044 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2046 self.parent = v.into();
2047 self
2048 }
2049
2050 pub fn set_posture_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2052 self.posture_id = v.into();
2053 self
2054 }
2055
2056 pub fn set_workload<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2058 self.workload = v.into();
2059 self
2060 }
2061}
2062
2063impl wkt::message::Message for ExtractPostureRequest {
2064 fn typename() -> &'static str {
2065 "type.googleapis.com/google.cloud.securityposture.v1.ExtractPostureRequest"
2066 }
2067}
2068
2069#[derive(Clone, Default, PartialEq)]
2072#[non_exhaustive]
2073pub struct PostureDeployment {
2074 pub name: std::string::String,
2077
2078 pub target_resource: std::string::String,
2082
2083 pub state: crate::model::posture_deployment::State,
2085
2086 pub posture_id: std::string::String,
2092
2093 pub posture_revision_id: std::string::String,
2095
2096 pub create_time: std::option::Option<wkt::Timestamp>,
2098
2099 pub update_time: std::option::Option<wkt::Timestamp>,
2101
2102 pub description: std::string::String,
2104
2105 pub etag: std::string::String,
2117
2118 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
2122
2123 pub reconciling: bool,
2126
2127 pub desired_posture_id: std::string::String,
2131
2132 pub desired_posture_revision_id: std::string::String,
2135
2136 pub failure_message: std::string::String,
2140
2141 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2142}
2143
2144impl PostureDeployment {
2145 pub fn new() -> Self {
2146 std::default::Default::default()
2147 }
2148
2149 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2151 self.name = v.into();
2152 self
2153 }
2154
2155 pub fn set_target_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2157 self.target_resource = v.into();
2158 self
2159 }
2160
2161 pub fn set_state<T: std::convert::Into<crate::model::posture_deployment::State>>(
2163 mut self,
2164 v: T,
2165 ) -> Self {
2166 self.state = v.into();
2167 self
2168 }
2169
2170 pub fn set_posture_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2172 self.posture_id = v.into();
2173 self
2174 }
2175
2176 pub fn set_posture_revision_id<T: std::convert::Into<std::string::String>>(
2178 mut self,
2179 v: T,
2180 ) -> Self {
2181 self.posture_revision_id = v.into();
2182 self
2183 }
2184
2185 pub fn set_create_time<T>(mut self, v: T) -> Self
2187 where
2188 T: std::convert::Into<wkt::Timestamp>,
2189 {
2190 self.create_time = std::option::Option::Some(v.into());
2191 self
2192 }
2193
2194 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2196 where
2197 T: std::convert::Into<wkt::Timestamp>,
2198 {
2199 self.create_time = v.map(|x| x.into());
2200 self
2201 }
2202
2203 pub fn set_update_time<T>(mut self, v: T) -> Self
2205 where
2206 T: std::convert::Into<wkt::Timestamp>,
2207 {
2208 self.update_time = std::option::Option::Some(v.into());
2209 self
2210 }
2211
2212 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2214 where
2215 T: std::convert::Into<wkt::Timestamp>,
2216 {
2217 self.update_time = v.map(|x| x.into());
2218 self
2219 }
2220
2221 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2223 self.description = v.into();
2224 self
2225 }
2226
2227 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2229 self.etag = v.into();
2230 self
2231 }
2232
2233 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
2235 where
2236 T: std::iter::IntoIterator<Item = (K, V)>,
2237 K: std::convert::Into<std::string::String>,
2238 V: std::convert::Into<std::string::String>,
2239 {
2240 use std::iter::Iterator;
2241 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2242 self
2243 }
2244
2245 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2247 self.reconciling = v.into();
2248 self
2249 }
2250
2251 pub fn set_desired_posture_id<T: std::convert::Into<std::string::String>>(
2253 mut self,
2254 v: T,
2255 ) -> Self {
2256 self.desired_posture_id = v.into();
2257 self
2258 }
2259
2260 pub fn set_desired_posture_revision_id<T: std::convert::Into<std::string::String>>(
2262 mut self,
2263 v: T,
2264 ) -> Self {
2265 self.desired_posture_revision_id = v.into();
2266 self
2267 }
2268
2269 pub fn set_failure_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2271 self.failure_message = v.into();
2272 self
2273 }
2274}
2275
2276impl wkt::message::Message for PostureDeployment {
2277 fn typename() -> &'static str {
2278 "type.googleapis.com/google.cloud.securityposture.v1.PostureDeployment"
2279 }
2280}
2281
2282pub mod posture_deployment {
2284 #[allow(unused_imports)]
2285 use super::*;
2286
2287 #[derive(Clone, Debug, PartialEq)]
2303 #[non_exhaustive]
2304 pub enum State {
2305 Unspecified,
2307 Creating,
2309 Deleting,
2311 Updating,
2313 Active,
2315 CreateFailed,
2317 UpdateFailed,
2319 DeleteFailed,
2321 UnknownValue(state::UnknownValue),
2326 }
2327
2328 #[doc(hidden)]
2329 pub mod state {
2330 #[allow(unused_imports)]
2331 use super::*;
2332 #[derive(Clone, Debug, PartialEq)]
2333 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2334 }
2335
2336 impl State {
2337 pub fn value(&self) -> std::option::Option<i32> {
2342 match self {
2343 Self::Unspecified => std::option::Option::Some(0),
2344 Self::Creating => std::option::Option::Some(1),
2345 Self::Deleting => std::option::Option::Some(2),
2346 Self::Updating => std::option::Option::Some(3),
2347 Self::Active => std::option::Option::Some(4),
2348 Self::CreateFailed => std::option::Option::Some(5),
2349 Self::UpdateFailed => std::option::Option::Some(6),
2350 Self::DeleteFailed => std::option::Option::Some(7),
2351 Self::UnknownValue(u) => u.0.value(),
2352 }
2353 }
2354
2355 pub fn name(&self) -> std::option::Option<&str> {
2360 match self {
2361 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2362 Self::Creating => std::option::Option::Some("CREATING"),
2363 Self::Deleting => std::option::Option::Some("DELETING"),
2364 Self::Updating => std::option::Option::Some("UPDATING"),
2365 Self::Active => std::option::Option::Some("ACTIVE"),
2366 Self::CreateFailed => std::option::Option::Some("CREATE_FAILED"),
2367 Self::UpdateFailed => std::option::Option::Some("UPDATE_FAILED"),
2368 Self::DeleteFailed => std::option::Option::Some("DELETE_FAILED"),
2369 Self::UnknownValue(u) => u.0.name(),
2370 }
2371 }
2372 }
2373
2374 impl std::default::Default for State {
2375 fn default() -> Self {
2376 use std::convert::From;
2377 Self::from(0)
2378 }
2379 }
2380
2381 impl std::fmt::Display for State {
2382 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2383 wkt::internal::display_enum(f, self.name(), self.value())
2384 }
2385 }
2386
2387 impl std::convert::From<i32> for State {
2388 fn from(value: i32) -> Self {
2389 match value {
2390 0 => Self::Unspecified,
2391 1 => Self::Creating,
2392 2 => Self::Deleting,
2393 3 => Self::Updating,
2394 4 => Self::Active,
2395 5 => Self::CreateFailed,
2396 6 => Self::UpdateFailed,
2397 7 => Self::DeleteFailed,
2398 _ => Self::UnknownValue(state::UnknownValue(
2399 wkt::internal::UnknownEnumValue::Integer(value),
2400 )),
2401 }
2402 }
2403 }
2404
2405 impl std::convert::From<&str> for State {
2406 fn from(value: &str) -> Self {
2407 use std::string::ToString;
2408 match value {
2409 "STATE_UNSPECIFIED" => Self::Unspecified,
2410 "CREATING" => Self::Creating,
2411 "DELETING" => Self::Deleting,
2412 "UPDATING" => Self::Updating,
2413 "ACTIVE" => Self::Active,
2414 "CREATE_FAILED" => Self::CreateFailed,
2415 "UPDATE_FAILED" => Self::UpdateFailed,
2416 "DELETE_FAILED" => Self::DeleteFailed,
2417 _ => Self::UnknownValue(state::UnknownValue(
2418 wkt::internal::UnknownEnumValue::String(value.to_string()),
2419 )),
2420 }
2421 }
2422 }
2423
2424 impl serde::ser::Serialize for State {
2425 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2426 where
2427 S: serde::Serializer,
2428 {
2429 match self {
2430 Self::Unspecified => serializer.serialize_i32(0),
2431 Self::Creating => serializer.serialize_i32(1),
2432 Self::Deleting => serializer.serialize_i32(2),
2433 Self::Updating => serializer.serialize_i32(3),
2434 Self::Active => serializer.serialize_i32(4),
2435 Self::CreateFailed => serializer.serialize_i32(5),
2436 Self::UpdateFailed => serializer.serialize_i32(6),
2437 Self::DeleteFailed => serializer.serialize_i32(7),
2438 Self::UnknownValue(u) => u.0.serialize(serializer),
2439 }
2440 }
2441 }
2442
2443 impl<'de> serde::de::Deserialize<'de> for State {
2444 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2445 where
2446 D: serde::Deserializer<'de>,
2447 {
2448 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2449 ".google.cloud.securityposture.v1.PostureDeployment.State",
2450 ))
2451 }
2452 }
2453}
2454
2455#[derive(Clone, Default, PartialEq)]
2457#[non_exhaustive]
2458pub struct ListPostureDeploymentsRequest {
2459 pub parent: std::string::String,
2461
2462 pub page_size: i32,
2465
2466 pub page_token: std::string::String,
2468
2469 pub filter: std::string::String,
2472
2473 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2474}
2475
2476impl ListPostureDeploymentsRequest {
2477 pub fn new() -> Self {
2478 std::default::Default::default()
2479 }
2480
2481 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2483 self.parent = v.into();
2484 self
2485 }
2486
2487 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2489 self.page_size = v.into();
2490 self
2491 }
2492
2493 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2495 self.page_token = v.into();
2496 self
2497 }
2498
2499 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2501 self.filter = v.into();
2502 self
2503 }
2504}
2505
2506impl wkt::message::Message for ListPostureDeploymentsRequest {
2507 fn typename() -> &'static str {
2508 "type.googleapis.com/google.cloud.securityposture.v1.ListPostureDeploymentsRequest"
2509 }
2510}
2511
2512#[derive(Clone, Default, PartialEq)]
2514#[non_exhaustive]
2515pub struct ListPostureDeploymentsResponse {
2516 pub posture_deployments: std::vec::Vec<crate::model::PostureDeployment>,
2518
2519 pub next_page_token: std::string::String,
2521
2522 pub unreachable: std::vec::Vec<std::string::String>,
2524
2525 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2526}
2527
2528impl ListPostureDeploymentsResponse {
2529 pub fn new() -> Self {
2530 std::default::Default::default()
2531 }
2532
2533 pub fn set_posture_deployments<T, V>(mut self, v: T) -> Self
2535 where
2536 T: std::iter::IntoIterator<Item = V>,
2537 V: std::convert::Into<crate::model::PostureDeployment>,
2538 {
2539 use std::iter::Iterator;
2540 self.posture_deployments = v.into_iter().map(|i| i.into()).collect();
2541 self
2542 }
2543
2544 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2546 self.next_page_token = v.into();
2547 self
2548 }
2549
2550 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
2552 where
2553 T: std::iter::IntoIterator<Item = V>,
2554 V: std::convert::Into<std::string::String>,
2555 {
2556 use std::iter::Iterator;
2557 self.unreachable = v.into_iter().map(|i| i.into()).collect();
2558 self
2559 }
2560}
2561
2562impl wkt::message::Message for ListPostureDeploymentsResponse {
2563 fn typename() -> &'static str {
2564 "type.googleapis.com/google.cloud.securityposture.v1.ListPostureDeploymentsResponse"
2565 }
2566}
2567
2568#[doc(hidden)]
2569impl gax::paginator::internal::PageableResponse for ListPostureDeploymentsResponse {
2570 type PageItem = crate::model::PostureDeployment;
2571
2572 fn items(self) -> std::vec::Vec<Self::PageItem> {
2573 self.posture_deployments
2574 }
2575
2576 fn next_page_token(&self) -> std::string::String {
2577 use std::clone::Clone;
2578 self.next_page_token.clone()
2579 }
2580}
2581
2582#[derive(Clone, Default, PartialEq)]
2584#[non_exhaustive]
2585pub struct GetPostureDeploymentRequest {
2586 pub name: std::string::String,
2588
2589 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2590}
2591
2592impl GetPostureDeploymentRequest {
2593 pub fn new() -> Self {
2594 std::default::Default::default()
2595 }
2596
2597 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2599 self.name = v.into();
2600 self
2601 }
2602}
2603
2604impl wkt::message::Message for GetPostureDeploymentRequest {
2605 fn typename() -> &'static str {
2606 "type.googleapis.com/google.cloud.securityposture.v1.GetPostureDeploymentRequest"
2607 }
2608}
2609
2610#[derive(Clone, Default, PartialEq)]
2612#[non_exhaustive]
2613pub struct CreatePostureDeploymentRequest {
2614 pub parent: std::string::String,
2617
2618 pub posture_deployment_id: std::string::String,
2621
2622 pub posture_deployment: std::option::Option<crate::model::PostureDeployment>,
2624
2625 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2626}
2627
2628impl CreatePostureDeploymentRequest {
2629 pub fn new() -> Self {
2630 std::default::Default::default()
2631 }
2632
2633 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2635 self.parent = v.into();
2636 self
2637 }
2638
2639 pub fn set_posture_deployment_id<T: std::convert::Into<std::string::String>>(
2641 mut self,
2642 v: T,
2643 ) -> Self {
2644 self.posture_deployment_id = v.into();
2645 self
2646 }
2647
2648 pub fn set_posture_deployment<T>(mut self, v: T) -> Self
2650 where
2651 T: std::convert::Into<crate::model::PostureDeployment>,
2652 {
2653 self.posture_deployment = std::option::Option::Some(v.into());
2654 self
2655 }
2656
2657 pub fn set_or_clear_posture_deployment<T>(mut self, v: std::option::Option<T>) -> Self
2659 where
2660 T: std::convert::Into<crate::model::PostureDeployment>,
2661 {
2662 self.posture_deployment = v.map(|x| x.into());
2663 self
2664 }
2665}
2666
2667impl wkt::message::Message for CreatePostureDeploymentRequest {
2668 fn typename() -> &'static str {
2669 "type.googleapis.com/google.cloud.securityposture.v1.CreatePostureDeploymentRequest"
2670 }
2671}
2672
2673#[derive(Clone, Default, PartialEq)]
2675#[non_exhaustive]
2676pub struct UpdatePostureDeploymentRequest {
2677 pub update_mask: std::option::Option<wkt::FieldMask>,
2683
2684 pub posture_deployment: std::option::Option<crate::model::PostureDeployment>,
2686
2687 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2688}
2689
2690impl UpdatePostureDeploymentRequest {
2691 pub fn new() -> Self {
2692 std::default::Default::default()
2693 }
2694
2695 pub fn set_update_mask<T>(mut self, v: T) -> Self
2697 where
2698 T: std::convert::Into<wkt::FieldMask>,
2699 {
2700 self.update_mask = std::option::Option::Some(v.into());
2701 self
2702 }
2703
2704 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2706 where
2707 T: std::convert::Into<wkt::FieldMask>,
2708 {
2709 self.update_mask = v.map(|x| x.into());
2710 self
2711 }
2712
2713 pub fn set_posture_deployment<T>(mut self, v: T) -> Self
2715 where
2716 T: std::convert::Into<crate::model::PostureDeployment>,
2717 {
2718 self.posture_deployment = std::option::Option::Some(v.into());
2719 self
2720 }
2721
2722 pub fn set_or_clear_posture_deployment<T>(mut self, v: std::option::Option<T>) -> Self
2724 where
2725 T: std::convert::Into<crate::model::PostureDeployment>,
2726 {
2727 self.posture_deployment = v.map(|x| x.into());
2728 self
2729 }
2730}
2731
2732impl wkt::message::Message for UpdatePostureDeploymentRequest {
2733 fn typename() -> &'static str {
2734 "type.googleapis.com/google.cloud.securityposture.v1.UpdatePostureDeploymentRequest"
2735 }
2736}
2737
2738#[derive(Clone, Default, PartialEq)]
2740#[non_exhaustive]
2741pub struct DeletePostureDeploymentRequest {
2742 pub name: std::string::String,
2744
2745 pub etag: std::string::String,
2747
2748 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2749}
2750
2751impl DeletePostureDeploymentRequest {
2752 pub fn new() -> Self {
2753 std::default::Default::default()
2754 }
2755
2756 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2758 self.name = v.into();
2759 self
2760 }
2761
2762 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2764 self.etag = v.into();
2765 self
2766 }
2767}
2768
2769impl wkt::message::Message for DeletePostureDeploymentRequest {
2770 fn typename() -> &'static str {
2771 "type.googleapis.com/google.cloud.securityposture.v1.DeletePostureDeploymentRequest"
2772 }
2773}
2774
2775#[derive(Clone, Default, PartialEq)]
2778#[non_exhaustive]
2779pub struct PostureTemplate {
2780 pub name: std::string::String,
2784
2785 pub revision_id: std::string::String,
2787
2788 pub description: std::string::String,
2790
2791 pub state: crate::model::posture_template::State,
2793
2794 pub policy_sets: std::vec::Vec<crate::model::PolicySet>,
2796
2797 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2798}
2799
2800impl PostureTemplate {
2801 pub fn new() -> Self {
2802 std::default::Default::default()
2803 }
2804
2805 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2807 self.name = v.into();
2808 self
2809 }
2810
2811 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2813 self.revision_id = v.into();
2814 self
2815 }
2816
2817 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2819 self.description = v.into();
2820 self
2821 }
2822
2823 pub fn set_state<T: std::convert::Into<crate::model::posture_template::State>>(
2825 mut self,
2826 v: T,
2827 ) -> Self {
2828 self.state = v.into();
2829 self
2830 }
2831
2832 pub fn set_policy_sets<T, V>(mut self, v: T) -> Self
2834 where
2835 T: std::iter::IntoIterator<Item = V>,
2836 V: std::convert::Into<crate::model::PolicySet>,
2837 {
2838 use std::iter::Iterator;
2839 self.policy_sets = v.into_iter().map(|i| i.into()).collect();
2840 self
2841 }
2842}
2843
2844impl wkt::message::Message for PostureTemplate {
2845 fn typename() -> &'static str {
2846 "type.googleapis.com/google.cloud.securityposture.v1.PostureTemplate"
2847 }
2848}
2849
2850pub mod posture_template {
2852 #[allow(unused_imports)]
2853 use super::*;
2854
2855 #[derive(Clone, Debug, PartialEq)]
2871 #[non_exhaustive]
2872 pub enum State {
2873 Unspecified,
2875 Active,
2877 Deprecated,
2880 UnknownValue(state::UnknownValue),
2885 }
2886
2887 #[doc(hidden)]
2888 pub mod state {
2889 #[allow(unused_imports)]
2890 use super::*;
2891 #[derive(Clone, Debug, PartialEq)]
2892 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2893 }
2894
2895 impl State {
2896 pub fn value(&self) -> std::option::Option<i32> {
2901 match self {
2902 Self::Unspecified => std::option::Option::Some(0),
2903 Self::Active => std::option::Option::Some(1),
2904 Self::Deprecated => std::option::Option::Some(2),
2905 Self::UnknownValue(u) => u.0.value(),
2906 }
2907 }
2908
2909 pub fn name(&self) -> std::option::Option<&str> {
2914 match self {
2915 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2916 Self::Active => std::option::Option::Some("ACTIVE"),
2917 Self::Deprecated => std::option::Option::Some("DEPRECATED"),
2918 Self::UnknownValue(u) => u.0.name(),
2919 }
2920 }
2921 }
2922
2923 impl std::default::Default for State {
2924 fn default() -> Self {
2925 use std::convert::From;
2926 Self::from(0)
2927 }
2928 }
2929
2930 impl std::fmt::Display for State {
2931 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2932 wkt::internal::display_enum(f, self.name(), self.value())
2933 }
2934 }
2935
2936 impl std::convert::From<i32> for State {
2937 fn from(value: i32) -> Self {
2938 match value {
2939 0 => Self::Unspecified,
2940 1 => Self::Active,
2941 2 => Self::Deprecated,
2942 _ => Self::UnknownValue(state::UnknownValue(
2943 wkt::internal::UnknownEnumValue::Integer(value),
2944 )),
2945 }
2946 }
2947 }
2948
2949 impl std::convert::From<&str> for State {
2950 fn from(value: &str) -> Self {
2951 use std::string::ToString;
2952 match value {
2953 "STATE_UNSPECIFIED" => Self::Unspecified,
2954 "ACTIVE" => Self::Active,
2955 "DEPRECATED" => Self::Deprecated,
2956 _ => Self::UnknownValue(state::UnknownValue(
2957 wkt::internal::UnknownEnumValue::String(value.to_string()),
2958 )),
2959 }
2960 }
2961 }
2962
2963 impl serde::ser::Serialize for State {
2964 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2965 where
2966 S: serde::Serializer,
2967 {
2968 match self {
2969 Self::Unspecified => serializer.serialize_i32(0),
2970 Self::Active => serializer.serialize_i32(1),
2971 Self::Deprecated => serializer.serialize_i32(2),
2972 Self::UnknownValue(u) => u.0.serialize(serializer),
2973 }
2974 }
2975 }
2976
2977 impl<'de> serde::de::Deserialize<'de> for State {
2978 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2979 where
2980 D: serde::Deserializer<'de>,
2981 {
2982 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2983 ".google.cloud.securityposture.v1.PostureTemplate.State",
2984 ))
2985 }
2986 }
2987}
2988
2989#[derive(Clone, Default, PartialEq)]
2991#[non_exhaustive]
2992pub struct ListPostureTemplatesRequest {
2993 pub parent: std::string::String,
2995
2996 pub page_size: i32,
2999
3000 pub page_token: std::string::String,
3002
3003 pub filter: std::string::String,
3006
3007 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3008}
3009
3010impl ListPostureTemplatesRequest {
3011 pub fn new() -> Self {
3012 std::default::Default::default()
3013 }
3014
3015 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3017 self.parent = v.into();
3018 self
3019 }
3020
3021 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3023 self.page_size = v.into();
3024 self
3025 }
3026
3027 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3029 self.page_token = v.into();
3030 self
3031 }
3032
3033 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3035 self.filter = v.into();
3036 self
3037 }
3038}
3039
3040impl wkt::message::Message for ListPostureTemplatesRequest {
3041 fn typename() -> &'static str {
3042 "type.googleapis.com/google.cloud.securityposture.v1.ListPostureTemplatesRequest"
3043 }
3044}
3045
3046#[derive(Clone, Default, PartialEq)]
3048#[non_exhaustive]
3049pub struct ListPostureTemplatesResponse {
3050 pub posture_templates: std::vec::Vec<crate::model::PostureTemplate>,
3052
3053 pub next_page_token: std::string::String,
3055
3056 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3057}
3058
3059impl ListPostureTemplatesResponse {
3060 pub fn new() -> Self {
3061 std::default::Default::default()
3062 }
3063
3064 pub fn set_posture_templates<T, V>(mut self, v: T) -> Self
3066 where
3067 T: std::iter::IntoIterator<Item = V>,
3068 V: std::convert::Into<crate::model::PostureTemplate>,
3069 {
3070 use std::iter::Iterator;
3071 self.posture_templates = v.into_iter().map(|i| i.into()).collect();
3072 self
3073 }
3074
3075 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3077 self.next_page_token = v.into();
3078 self
3079 }
3080}
3081
3082impl wkt::message::Message for ListPostureTemplatesResponse {
3083 fn typename() -> &'static str {
3084 "type.googleapis.com/google.cloud.securityposture.v1.ListPostureTemplatesResponse"
3085 }
3086}
3087
3088#[doc(hidden)]
3089impl gax::paginator::internal::PageableResponse for ListPostureTemplatesResponse {
3090 type PageItem = crate::model::PostureTemplate;
3091
3092 fn items(self) -> std::vec::Vec<Self::PageItem> {
3093 self.posture_templates
3094 }
3095
3096 fn next_page_token(&self) -> std::string::String {
3097 use std::clone::Clone;
3098 self.next_page_token.clone()
3099 }
3100}
3101
3102#[derive(Clone, Default, PartialEq)]
3104#[non_exhaustive]
3105pub struct GetPostureTemplateRequest {
3106 pub name: std::string::String,
3108
3109 pub revision_id: std::string::String,
3112
3113 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3114}
3115
3116impl GetPostureTemplateRequest {
3117 pub fn new() -> Self {
3118 std::default::Default::default()
3119 }
3120
3121 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3123 self.name = v.into();
3124 self
3125 }
3126
3127 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3129 self.revision_id = v.into();
3130 self
3131 }
3132}
3133
3134impl wkt::message::Message for GetPostureTemplateRequest {
3135 fn typename() -> &'static str {
3136 "type.googleapis.com/google.cloud.securityposture.v1.GetPostureTemplateRequest"
3137 }
3138}
3139
3140#[derive(Clone, Default, PartialEq)]
3142#[non_exhaustive]
3143pub struct SecurityHealthAnalyticsModule {
3144 pub module_name: std::string::String,
3146
3147 pub module_enablement_state: crate::model::EnablementState,
3150
3151 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3152}
3153
3154impl SecurityHealthAnalyticsModule {
3155 pub fn new() -> Self {
3156 std::default::Default::default()
3157 }
3158
3159 pub fn set_module_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3161 self.module_name = v.into();
3162 self
3163 }
3164
3165 pub fn set_module_enablement_state<T: std::convert::Into<crate::model::EnablementState>>(
3167 mut self,
3168 v: T,
3169 ) -> Self {
3170 self.module_enablement_state = v.into();
3171 self
3172 }
3173}
3174
3175impl wkt::message::Message for SecurityHealthAnalyticsModule {
3176 fn typename() -> &'static str {
3177 "type.googleapis.com/google.cloud.securityposture.v1.SecurityHealthAnalyticsModule"
3178 }
3179}
3180
3181#[derive(Clone, Default, PartialEq)]
3183#[non_exhaustive]
3184pub struct SecurityHealthAnalyticsCustomModule {
3185 pub id: std::string::String,
3189
3190 pub display_name: std::string::String,
3196
3197 pub config: std::option::Option<crate::model::CustomConfig>,
3199
3200 pub module_enablement_state: crate::model::EnablementState,
3203
3204 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3205}
3206
3207impl SecurityHealthAnalyticsCustomModule {
3208 pub fn new() -> Self {
3209 std::default::Default::default()
3210 }
3211
3212 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3214 self.id = v.into();
3215 self
3216 }
3217
3218 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3220 self.display_name = v.into();
3221 self
3222 }
3223
3224 pub fn set_config<T>(mut self, v: T) -> Self
3226 where
3227 T: std::convert::Into<crate::model::CustomConfig>,
3228 {
3229 self.config = std::option::Option::Some(v.into());
3230 self
3231 }
3232
3233 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
3235 where
3236 T: std::convert::Into<crate::model::CustomConfig>,
3237 {
3238 self.config = v.map(|x| x.into());
3239 self
3240 }
3241
3242 pub fn set_module_enablement_state<T: std::convert::Into<crate::model::EnablementState>>(
3244 mut self,
3245 v: T,
3246 ) -> Self {
3247 self.module_enablement_state = v.into();
3248 self
3249 }
3250}
3251
3252impl wkt::message::Message for SecurityHealthAnalyticsCustomModule {
3253 fn typename() -> &'static str {
3254 "type.googleapis.com/google.cloud.securityposture.v1.SecurityHealthAnalyticsCustomModule"
3255 }
3256}
3257
3258#[derive(Clone, Default, PartialEq)]
3262#[non_exhaustive]
3263pub struct CustomConfig {
3264 pub predicate: std::option::Option<gtype::model::Expr>,
3267
3268 pub custom_output: std::option::Option<crate::model::custom_config::CustomOutputSpec>,
3270
3271 pub resource_selector: std::option::Option<crate::model::custom_config::ResourceSelector>,
3274
3275 pub severity: crate::model::custom_config::Severity,
3277
3278 pub description: std::string::String,
3283
3284 pub recommendation: std::string::String,
3289
3290 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3291}
3292
3293impl CustomConfig {
3294 pub fn new() -> Self {
3295 std::default::Default::default()
3296 }
3297
3298 pub fn set_predicate<T>(mut self, v: T) -> Self
3300 where
3301 T: std::convert::Into<gtype::model::Expr>,
3302 {
3303 self.predicate = std::option::Option::Some(v.into());
3304 self
3305 }
3306
3307 pub fn set_or_clear_predicate<T>(mut self, v: std::option::Option<T>) -> Self
3309 where
3310 T: std::convert::Into<gtype::model::Expr>,
3311 {
3312 self.predicate = v.map(|x| x.into());
3313 self
3314 }
3315
3316 pub fn set_custom_output<T>(mut self, v: T) -> Self
3318 where
3319 T: std::convert::Into<crate::model::custom_config::CustomOutputSpec>,
3320 {
3321 self.custom_output = std::option::Option::Some(v.into());
3322 self
3323 }
3324
3325 pub fn set_or_clear_custom_output<T>(mut self, v: std::option::Option<T>) -> Self
3327 where
3328 T: std::convert::Into<crate::model::custom_config::CustomOutputSpec>,
3329 {
3330 self.custom_output = v.map(|x| x.into());
3331 self
3332 }
3333
3334 pub fn set_resource_selector<T>(mut self, v: T) -> Self
3336 where
3337 T: std::convert::Into<crate::model::custom_config::ResourceSelector>,
3338 {
3339 self.resource_selector = std::option::Option::Some(v.into());
3340 self
3341 }
3342
3343 pub fn set_or_clear_resource_selector<T>(mut self, v: std::option::Option<T>) -> Self
3345 where
3346 T: std::convert::Into<crate::model::custom_config::ResourceSelector>,
3347 {
3348 self.resource_selector = v.map(|x| x.into());
3349 self
3350 }
3351
3352 pub fn set_severity<T: std::convert::Into<crate::model::custom_config::Severity>>(
3354 mut self,
3355 v: T,
3356 ) -> Self {
3357 self.severity = v.into();
3358 self
3359 }
3360
3361 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3363 self.description = v.into();
3364 self
3365 }
3366
3367 pub fn set_recommendation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3369 self.recommendation = v.into();
3370 self
3371 }
3372}
3373
3374impl wkt::message::Message for CustomConfig {
3375 fn typename() -> &'static str {
3376 "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig"
3377 }
3378}
3379
3380pub mod custom_config {
3382 #[allow(unused_imports)]
3383 use super::*;
3384
3385 #[derive(Clone, Default, PartialEq)]
3390 #[non_exhaustive]
3391 pub struct CustomOutputSpec {
3392 pub properties: std::vec::Vec<crate::model::custom_config::custom_output_spec::Property>,
3394
3395 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3396 }
3397
3398 impl CustomOutputSpec {
3399 pub fn new() -> Self {
3400 std::default::Default::default()
3401 }
3402
3403 pub fn set_properties<T, V>(mut self, v: T) -> Self
3405 where
3406 T: std::iter::IntoIterator<Item = V>,
3407 V: std::convert::Into<crate::model::custom_config::custom_output_spec::Property>,
3408 {
3409 use std::iter::Iterator;
3410 self.properties = v.into_iter().map(|i| i.into()).collect();
3411 self
3412 }
3413 }
3414
3415 impl wkt::message::Message for CustomOutputSpec {
3416 fn typename() -> &'static str {
3417 "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig.CustomOutputSpec"
3418 }
3419 }
3420
3421 pub mod custom_output_spec {
3423 #[allow(unused_imports)]
3424 use super::*;
3425
3426 #[derive(Clone, Default, PartialEq)]
3428 #[non_exhaustive]
3429 pub struct Property {
3430 pub name: std::string::String,
3432
3433 pub value_expression: std::option::Option<gtype::model::Expr>,
3437
3438 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3439 }
3440
3441 impl Property {
3442 pub fn new() -> Self {
3443 std::default::Default::default()
3444 }
3445
3446 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3448 self.name = v.into();
3449 self
3450 }
3451
3452 pub fn set_value_expression<T>(mut self, v: T) -> Self
3454 where
3455 T: std::convert::Into<gtype::model::Expr>,
3456 {
3457 self.value_expression = std::option::Option::Some(v.into());
3458 self
3459 }
3460
3461 pub fn set_or_clear_value_expression<T>(mut self, v: std::option::Option<T>) -> Self
3463 where
3464 T: std::convert::Into<gtype::model::Expr>,
3465 {
3466 self.value_expression = v.map(|x| x.into());
3467 self
3468 }
3469 }
3470
3471 impl wkt::message::Message for Property {
3472 fn typename() -> &'static str {
3473 "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig.CustomOutputSpec.Property"
3474 }
3475 }
3476 }
3477
3478 #[derive(Clone, Default, PartialEq)]
3480 #[non_exhaustive]
3481 pub struct ResourceSelector {
3482 pub resource_types: std::vec::Vec<std::string::String>,
3484
3485 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3486 }
3487
3488 impl ResourceSelector {
3489 pub fn new() -> Self {
3490 std::default::Default::default()
3491 }
3492
3493 pub fn set_resource_types<T, V>(mut self, v: T) -> Self
3495 where
3496 T: std::iter::IntoIterator<Item = V>,
3497 V: std::convert::Into<std::string::String>,
3498 {
3499 use std::iter::Iterator;
3500 self.resource_types = v.into_iter().map(|i| i.into()).collect();
3501 self
3502 }
3503 }
3504
3505 impl wkt::message::Message for ResourceSelector {
3506 fn typename() -> &'static str {
3507 "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig.ResourceSelector"
3508 }
3509 }
3510
3511 #[derive(Clone, Debug, PartialEq)]
3527 #[non_exhaustive]
3528 pub enum Severity {
3529 Unspecified,
3531 Critical,
3533 High,
3535 Medium,
3537 Low,
3539 UnknownValue(severity::UnknownValue),
3544 }
3545
3546 #[doc(hidden)]
3547 pub mod severity {
3548 #[allow(unused_imports)]
3549 use super::*;
3550 #[derive(Clone, Debug, PartialEq)]
3551 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3552 }
3553
3554 impl Severity {
3555 pub fn value(&self) -> std::option::Option<i32> {
3560 match self {
3561 Self::Unspecified => std::option::Option::Some(0),
3562 Self::Critical => std::option::Option::Some(1),
3563 Self::High => std::option::Option::Some(2),
3564 Self::Medium => std::option::Option::Some(3),
3565 Self::Low => std::option::Option::Some(4),
3566 Self::UnknownValue(u) => u.0.value(),
3567 }
3568 }
3569
3570 pub fn name(&self) -> std::option::Option<&str> {
3575 match self {
3576 Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
3577 Self::Critical => std::option::Option::Some("CRITICAL"),
3578 Self::High => std::option::Option::Some("HIGH"),
3579 Self::Medium => std::option::Option::Some("MEDIUM"),
3580 Self::Low => std::option::Option::Some("LOW"),
3581 Self::UnknownValue(u) => u.0.name(),
3582 }
3583 }
3584 }
3585
3586 impl std::default::Default for Severity {
3587 fn default() -> Self {
3588 use std::convert::From;
3589 Self::from(0)
3590 }
3591 }
3592
3593 impl std::fmt::Display for Severity {
3594 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3595 wkt::internal::display_enum(f, self.name(), self.value())
3596 }
3597 }
3598
3599 impl std::convert::From<i32> for Severity {
3600 fn from(value: i32) -> Self {
3601 match value {
3602 0 => Self::Unspecified,
3603 1 => Self::Critical,
3604 2 => Self::High,
3605 3 => Self::Medium,
3606 4 => Self::Low,
3607 _ => Self::UnknownValue(severity::UnknownValue(
3608 wkt::internal::UnknownEnumValue::Integer(value),
3609 )),
3610 }
3611 }
3612 }
3613
3614 impl std::convert::From<&str> for Severity {
3615 fn from(value: &str) -> Self {
3616 use std::string::ToString;
3617 match value {
3618 "SEVERITY_UNSPECIFIED" => Self::Unspecified,
3619 "CRITICAL" => Self::Critical,
3620 "HIGH" => Self::High,
3621 "MEDIUM" => Self::Medium,
3622 "LOW" => Self::Low,
3623 _ => Self::UnknownValue(severity::UnknownValue(
3624 wkt::internal::UnknownEnumValue::String(value.to_string()),
3625 )),
3626 }
3627 }
3628 }
3629
3630 impl serde::ser::Serialize for Severity {
3631 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3632 where
3633 S: serde::Serializer,
3634 {
3635 match self {
3636 Self::Unspecified => serializer.serialize_i32(0),
3637 Self::Critical => serializer.serialize_i32(1),
3638 Self::High => serializer.serialize_i32(2),
3639 Self::Medium => serializer.serialize_i32(3),
3640 Self::Low => serializer.serialize_i32(4),
3641 Self::UnknownValue(u) => u.0.serialize(serializer),
3642 }
3643 }
3644 }
3645
3646 impl<'de> serde::de::Deserialize<'de> for Severity {
3647 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3648 where
3649 D: serde::Deserializer<'de>,
3650 {
3651 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
3652 ".google.cloud.securityposture.v1.CustomConfig.Severity",
3653 ))
3654 }
3655 }
3656}
3657
3658#[derive(Clone, Debug, PartialEq)]
3674#[non_exhaustive]
3675pub enum EnablementState {
3676 Unspecified,
3678 Enabled,
3680 Disabled,
3682 UnknownValue(enablement_state::UnknownValue),
3687}
3688
3689#[doc(hidden)]
3690pub mod enablement_state {
3691 #[allow(unused_imports)]
3692 use super::*;
3693 #[derive(Clone, Debug, PartialEq)]
3694 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3695}
3696
3697impl EnablementState {
3698 pub fn value(&self) -> std::option::Option<i32> {
3703 match self {
3704 Self::Unspecified => std::option::Option::Some(0),
3705 Self::Enabled => std::option::Option::Some(1),
3706 Self::Disabled => std::option::Option::Some(2),
3707 Self::UnknownValue(u) => u.0.value(),
3708 }
3709 }
3710
3711 pub fn name(&self) -> std::option::Option<&str> {
3716 match self {
3717 Self::Unspecified => std::option::Option::Some("ENABLEMENT_STATE_UNSPECIFIED"),
3718 Self::Enabled => std::option::Option::Some("ENABLED"),
3719 Self::Disabled => std::option::Option::Some("DISABLED"),
3720 Self::UnknownValue(u) => u.0.name(),
3721 }
3722 }
3723}
3724
3725impl std::default::Default for EnablementState {
3726 fn default() -> Self {
3727 use std::convert::From;
3728 Self::from(0)
3729 }
3730}
3731
3732impl std::fmt::Display for EnablementState {
3733 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3734 wkt::internal::display_enum(f, self.name(), self.value())
3735 }
3736}
3737
3738impl std::convert::From<i32> for EnablementState {
3739 fn from(value: i32) -> Self {
3740 match value {
3741 0 => Self::Unspecified,
3742 1 => Self::Enabled,
3743 2 => Self::Disabled,
3744 _ => Self::UnknownValue(enablement_state::UnknownValue(
3745 wkt::internal::UnknownEnumValue::Integer(value),
3746 )),
3747 }
3748 }
3749}
3750
3751impl std::convert::From<&str> for EnablementState {
3752 fn from(value: &str) -> Self {
3753 use std::string::ToString;
3754 match value {
3755 "ENABLEMENT_STATE_UNSPECIFIED" => Self::Unspecified,
3756 "ENABLED" => Self::Enabled,
3757 "DISABLED" => Self::Disabled,
3758 _ => Self::UnknownValue(enablement_state::UnknownValue(
3759 wkt::internal::UnknownEnumValue::String(value.to_string()),
3760 )),
3761 }
3762 }
3763}
3764
3765impl serde::ser::Serialize for EnablementState {
3766 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3767 where
3768 S: serde::Serializer,
3769 {
3770 match self {
3771 Self::Unspecified => serializer.serialize_i32(0),
3772 Self::Enabled => serializer.serialize_i32(1),
3773 Self::Disabled => serializer.serialize_i32(2),
3774 Self::UnknownValue(u) => u.0.serialize(serializer),
3775 }
3776 }
3777}
3778
3779impl<'de> serde::de::Deserialize<'de> for EnablementState {
3780 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3781 where
3782 D: serde::Deserializer<'de>,
3783 {
3784 deserializer.deserialize_any(wkt::internal::EnumVisitor::<EnablementState>::new(
3785 ".google.cloud.securityposture.v1.EnablementState",
3786 ))
3787 }
3788}