Skip to main content

google_cloud_securityposture_v1/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_gax;
26extern crate google_cloud_location;
27extern crate google_cloud_longrunning;
28extern crate google_cloud_lro;
29extern crate google_cloud_type;
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/// A rule used to express this policy.
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct PolicyRule {
45    /// A condition which determines whether this rule is used
46    /// in the evaluation of the policy. When set, the `expression` field in
47    /// the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
48    /// or "&&" operators. Each subexpression must be of the form
49    /// "resource.matchTag('<ORG_ID>/tag_key_short_name,
50    /// 'tag_value_short_name')" or "resource.matchTagId('tagKeys/key_id',
51    /// 'tagValues/value_id')" where key_name and value_name are the resource
52    /// names for Label Keys and Values. These names are available from the Tag
53    /// Manager Service. An example expression is:
54    /// "resource.matchTag('123456789/environment,
55    /// 'prod')" or "resource.matchTagId('tagKeys/123',
56    /// 'tagValues/456')".
57    pub condition: std::option::Option<google_cloud_type::model::Expr>,
58
59    #[allow(missing_docs)]
60    pub kind: std::option::Option<crate::model::policy_rule::Kind>,
61
62    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
63}
64
65impl PolicyRule {
66    /// Creates a new default instance.
67    pub fn new() -> Self {
68        std::default::Default::default()
69    }
70
71    /// Sets the value of [condition][crate::model::PolicyRule::condition].
72    ///
73    /// # Example
74    /// ```ignore,no_run
75    /// # use google_cloud_securityposture_v1::model::PolicyRule;
76    /// use google_cloud_type::model::Expr;
77    /// let x = PolicyRule::new().set_condition(Expr::default()/* use setters */);
78    /// ```
79    pub fn set_condition<T>(mut self, v: T) -> Self
80    where
81        T: std::convert::Into<google_cloud_type::model::Expr>,
82    {
83        self.condition = std::option::Option::Some(v.into());
84        self
85    }
86
87    /// Sets or clears the value of [condition][crate::model::PolicyRule::condition].
88    ///
89    /// # Example
90    /// ```ignore,no_run
91    /// # use google_cloud_securityposture_v1::model::PolicyRule;
92    /// use google_cloud_type::model::Expr;
93    /// let x = PolicyRule::new().set_or_clear_condition(Some(Expr::default()/* use setters */));
94    /// let x = PolicyRule::new().set_or_clear_condition(None::<Expr>);
95    /// ```
96    pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
97    where
98        T: std::convert::Into<google_cloud_type::model::Expr>,
99    {
100        self.condition = v.map(|x| x.into());
101        self
102    }
103
104    /// Sets the value of [kind][crate::model::PolicyRule::kind].
105    ///
106    /// Note that all the setters affecting `kind` are mutually
107    /// exclusive.
108    ///
109    /// # Example
110    /// ```ignore,no_run
111    /// # use google_cloud_securityposture_v1::model::PolicyRule;
112    /// use google_cloud_securityposture_v1::model::policy_rule::Kind;
113    /// let x = PolicyRule::new().set_kind(Some(Kind::AllowAll(true)));
114    /// ```
115    pub fn set_kind<T: std::convert::Into<std::option::Option<crate::model::policy_rule::Kind>>>(
116        mut self,
117        v: T,
118    ) -> Self {
119        self.kind = v.into();
120        self
121    }
122
123    /// The value of [kind][crate::model::PolicyRule::kind]
124    /// if it holds a `Values`, `None` if the field is not set or
125    /// holds a different branch.
126    pub fn values(
127        &self,
128    ) -> std::option::Option<&std::boxed::Box<crate::model::policy_rule::StringValues>> {
129        #[allow(unreachable_patterns)]
130        self.kind.as_ref().and_then(|v| match v {
131            crate::model::policy_rule::Kind::Values(v) => std::option::Option::Some(v),
132            _ => std::option::Option::None,
133        })
134    }
135
136    /// Sets the value of [kind][crate::model::PolicyRule::kind]
137    /// to hold a `Values`.
138    ///
139    /// Note that all the setters affecting `kind` are
140    /// mutually exclusive.
141    ///
142    /// # Example
143    /// ```ignore,no_run
144    /// # use google_cloud_securityposture_v1::model::PolicyRule;
145    /// use google_cloud_securityposture_v1::model::policy_rule::StringValues;
146    /// let x = PolicyRule::new().set_values(StringValues::default()/* use setters */);
147    /// assert!(x.values().is_some());
148    /// assert!(x.allow_all().is_none());
149    /// assert!(x.deny_all().is_none());
150    /// assert!(x.enforce().is_none());
151    /// ```
152    pub fn set_values<
153        T: std::convert::Into<std::boxed::Box<crate::model::policy_rule::StringValues>>,
154    >(
155        mut self,
156        v: T,
157    ) -> Self {
158        self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::Values(v.into()));
159        self
160    }
161
162    /// The value of [kind][crate::model::PolicyRule::kind]
163    /// if it holds a `AllowAll`, `None` if the field is not set or
164    /// holds a different branch.
165    pub fn allow_all(&self) -> std::option::Option<&bool> {
166        #[allow(unreachable_patterns)]
167        self.kind.as_ref().and_then(|v| match v {
168            crate::model::policy_rule::Kind::AllowAll(v) => std::option::Option::Some(v),
169            _ => std::option::Option::None,
170        })
171    }
172
173    /// Sets the value of [kind][crate::model::PolicyRule::kind]
174    /// to hold a `AllowAll`.
175    ///
176    /// Note that all the setters affecting `kind` are
177    /// mutually exclusive.
178    ///
179    /// # Example
180    /// ```ignore,no_run
181    /// # use google_cloud_securityposture_v1::model::PolicyRule;
182    /// let x = PolicyRule::new().set_allow_all(true);
183    /// assert!(x.allow_all().is_some());
184    /// assert!(x.values().is_none());
185    /// assert!(x.deny_all().is_none());
186    /// assert!(x.enforce().is_none());
187    /// ```
188    pub fn set_allow_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
189        self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::AllowAll(v.into()));
190        self
191    }
192
193    /// The value of [kind][crate::model::PolicyRule::kind]
194    /// if it holds a `DenyAll`, `None` if the field is not set or
195    /// holds a different branch.
196    pub fn deny_all(&self) -> std::option::Option<&bool> {
197        #[allow(unreachable_patterns)]
198        self.kind.as_ref().and_then(|v| match v {
199            crate::model::policy_rule::Kind::DenyAll(v) => std::option::Option::Some(v),
200            _ => std::option::Option::None,
201        })
202    }
203
204    /// Sets the value of [kind][crate::model::PolicyRule::kind]
205    /// to hold a `DenyAll`.
206    ///
207    /// Note that all the setters affecting `kind` are
208    /// mutually exclusive.
209    ///
210    /// # Example
211    /// ```ignore,no_run
212    /// # use google_cloud_securityposture_v1::model::PolicyRule;
213    /// let x = PolicyRule::new().set_deny_all(true);
214    /// assert!(x.deny_all().is_some());
215    /// assert!(x.values().is_none());
216    /// assert!(x.allow_all().is_none());
217    /// assert!(x.enforce().is_none());
218    /// ```
219    pub fn set_deny_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
220        self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::DenyAll(v.into()));
221        self
222    }
223
224    /// The value of [kind][crate::model::PolicyRule::kind]
225    /// if it holds a `Enforce`, `None` if the field is not set or
226    /// holds a different branch.
227    pub fn enforce(&self) -> std::option::Option<&bool> {
228        #[allow(unreachable_patterns)]
229        self.kind.as_ref().and_then(|v| match v {
230            crate::model::policy_rule::Kind::Enforce(v) => std::option::Option::Some(v),
231            _ => std::option::Option::None,
232        })
233    }
234
235    /// Sets the value of [kind][crate::model::PolicyRule::kind]
236    /// to hold a `Enforce`.
237    ///
238    /// Note that all the setters affecting `kind` are
239    /// mutually exclusive.
240    ///
241    /// # Example
242    /// ```ignore,no_run
243    /// # use google_cloud_securityposture_v1::model::PolicyRule;
244    /// let x = PolicyRule::new().set_enforce(true);
245    /// assert!(x.enforce().is_some());
246    /// assert!(x.values().is_none());
247    /// assert!(x.allow_all().is_none());
248    /// assert!(x.deny_all().is_none());
249    /// ```
250    pub fn set_enforce<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
251        self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::Enforce(v.into()));
252        self
253    }
254}
255
256impl wkt::message::Message for PolicyRule {
257    fn typename() -> &'static str {
258        "type.googleapis.com/google.cloud.securityposture.v1.PolicyRule"
259    }
260}
261
262/// Defines additional types related to [PolicyRule].
263pub mod policy_rule {
264    #[allow(unused_imports)]
265    use super::*;
266
267    /// A message that holds specific allowed and denied values.
268    /// This message can define specific values and subtrees of the Resource
269    /// Manager resource hierarchy (`Organizations`, `Folders`, `Projects`) that
270    /// are allowed or denied. This is achieved by using the `under:` and
271    /// optional `is:` prefixes.
272    /// The `under:` prefix is used to denote resource subtree values.
273    /// The `is:` prefix is used to denote specific values, and is required only
274    /// if the value contains a ":". Values prefixed with "is:" are treated the
275    /// same as values with no prefix.
276    /// Ancestry subtrees must be in one of the following formats:
277    ///
278    /// - `projects/<project-id>` (for example, `projects/tokyo-rain-123`)
279    /// - `folders/<folder-id>` (for example, `folders/1234`)
280    /// - `organizations/<organization-id>` (for example, `organizations/1234`)
281    ///
282    /// The `supports_under` field of the associated `Constraint`  defines
283    /// whether ancestry prefixes can be used.
284    #[derive(Clone, Default, PartialEq)]
285    #[non_exhaustive]
286    pub struct StringValues {
287        /// List of values allowed at this resource.
288        pub allowed_values: std::vec::Vec<std::string::String>,
289
290        /// List of values denied at this resource.
291        pub denied_values: std::vec::Vec<std::string::String>,
292
293        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
294    }
295
296    impl StringValues {
297        /// Creates a new default instance.
298        pub fn new() -> Self {
299            std::default::Default::default()
300        }
301
302        /// Sets the value of [allowed_values][crate::model::policy_rule::StringValues::allowed_values].
303        ///
304        /// # Example
305        /// ```ignore,no_run
306        /// # use google_cloud_securityposture_v1::model::policy_rule::StringValues;
307        /// let x = StringValues::new().set_allowed_values(["a", "b", "c"]);
308        /// ```
309        pub fn set_allowed_values<T, V>(mut self, v: T) -> Self
310        where
311            T: std::iter::IntoIterator<Item = V>,
312            V: std::convert::Into<std::string::String>,
313        {
314            use std::iter::Iterator;
315            self.allowed_values = v.into_iter().map(|i| i.into()).collect();
316            self
317        }
318
319        /// Sets the value of [denied_values][crate::model::policy_rule::StringValues::denied_values].
320        ///
321        /// # Example
322        /// ```ignore,no_run
323        /// # use google_cloud_securityposture_v1::model::policy_rule::StringValues;
324        /// let x = StringValues::new().set_denied_values(["a", "b", "c"]);
325        /// ```
326        pub fn set_denied_values<T, V>(mut self, v: T) -> Self
327        where
328            T: std::iter::IntoIterator<Item = V>,
329            V: std::convert::Into<std::string::String>,
330        {
331            use std::iter::Iterator;
332            self.denied_values = v.into_iter().map(|i| i.into()).collect();
333            self
334        }
335    }
336
337    impl wkt::message::Message for StringValues {
338        fn typename() -> &'static str {
339            "type.googleapis.com/google.cloud.securityposture.v1.PolicyRule.StringValues"
340        }
341    }
342
343    #[allow(missing_docs)]
344    #[derive(Clone, Debug, PartialEq)]
345    #[non_exhaustive]
346    pub enum Kind {
347        /// List of values to be used for this policy rule. This field can be set
348        /// only in policies for list constraints.
349        Values(std::boxed::Box<crate::model::policy_rule::StringValues>),
350        /// Setting this to true means that all values are allowed. This field can
351        /// be set only in policies for list constraints.
352        AllowAll(bool),
353        /// Setting this to true means that all values are denied. This field can
354        /// be set only in policies for list constraints.
355        DenyAll(bool),
356        /// If `true`, then the policy is enforced. If `false`, then any
357        /// configuration is acceptable.
358        /// This field can be set only in policies for boolean constraints.
359        Enforce(bool),
360    }
361}
362
363/// A custom constraint defined by customers which can *only* be applied to the
364/// given resource types and organization.
365///
366/// By creating a custom constraint, customers can apply policies of this
367/// custom constraint. *Creating a custom constraint itself does NOT apply any
368/// policy enforcement*.
369#[derive(Clone, Default, PartialEq)]
370#[non_exhaustive]
371pub struct CustomConstraint {
372    /// Immutable. Name of the constraint. This is unique within the organization.
373    /// Format of the name should be
374    ///
375    ///
376    /// `organizations/{organization_id}/customConstraints/{custom_constraint_id}`
377    ///
378    /// Example: `organizations/123/customConstraints/custom.createOnlyE2TypeVms`
379    ///
380    /// The max length is 70 characters and the minimum length is 1. Note that the
381    /// prefix `organizations/{organization_id}/customConstraints/` is not counted.
382    pub name: std::string::String,
383
384    /// Immutable. The resource instance type on which this policy applies. Format
385    /// will be of the form : `<canonical service name>/<type>` Example:
386    ///
387    /// - `compute.googleapis.com/Instance`.
388    pub resource_types: std::vec::Vec<std::string::String>,
389
390    /// All the operations being applied for this constraint.
391    pub method_types: std::vec::Vec<crate::model::custom_constraint::MethodType>,
392
393    /// Org policy condition/expression. For example:
394    /// `resource.instanceName.matches("[production|test]_.*_(\d)+")` or,
395    /// `resource.management.auto_upgrade == true`
396    ///
397    /// The max length of the condition is 1000 characters.
398    pub condition: std::string::String,
399
400    /// Allow or deny type.
401    pub action_type: crate::model::custom_constraint::ActionType,
402
403    /// One line display name for the UI.
404    /// The max length of the display_name is 200 characters.
405    pub display_name: std::string::String,
406
407    /// Detailed information about this custom policy constraint.
408    /// The max length of the description is 2000 characters.
409    pub description: std::string::String,
410
411    /// Output only. The last time this custom constraint was updated. This
412    /// represents the last time that the `CreateCustomConstraint` or
413    /// `UpdateCustomConstraint` RPC was called
414    pub update_time: std::option::Option<wkt::Timestamp>,
415
416    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
417}
418
419impl CustomConstraint {
420    /// Creates a new default instance.
421    pub fn new() -> Self {
422        std::default::Default::default()
423    }
424
425    /// Sets the value of [name][crate::model::CustomConstraint::name].
426    ///
427    /// # Example
428    /// ```ignore,no_run
429    /// # use google_cloud_securityposture_v1::model::CustomConstraint;
430    /// let x = CustomConstraint::new().set_name("example");
431    /// ```
432    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
433        self.name = v.into();
434        self
435    }
436
437    /// Sets the value of [resource_types][crate::model::CustomConstraint::resource_types].
438    ///
439    /// # Example
440    /// ```ignore,no_run
441    /// # use google_cloud_securityposture_v1::model::CustomConstraint;
442    /// let x = CustomConstraint::new().set_resource_types(["a", "b", "c"]);
443    /// ```
444    pub fn set_resource_types<T, V>(mut self, v: T) -> Self
445    where
446        T: std::iter::IntoIterator<Item = V>,
447        V: std::convert::Into<std::string::String>,
448    {
449        use std::iter::Iterator;
450        self.resource_types = v.into_iter().map(|i| i.into()).collect();
451        self
452    }
453
454    /// Sets the value of [method_types][crate::model::CustomConstraint::method_types].
455    ///
456    /// # Example
457    /// ```ignore,no_run
458    /// # use google_cloud_securityposture_v1::model::CustomConstraint;
459    /// use google_cloud_securityposture_v1::model::custom_constraint::MethodType;
460    /// let x = CustomConstraint::new().set_method_types([
461    ///     MethodType::Create,
462    ///     MethodType::Update,
463    ///     MethodType::Delete,
464    /// ]);
465    /// ```
466    pub fn set_method_types<T, V>(mut self, v: T) -> Self
467    where
468        T: std::iter::IntoIterator<Item = V>,
469        V: std::convert::Into<crate::model::custom_constraint::MethodType>,
470    {
471        use std::iter::Iterator;
472        self.method_types = v.into_iter().map(|i| i.into()).collect();
473        self
474    }
475
476    /// Sets the value of [condition][crate::model::CustomConstraint::condition].
477    ///
478    /// # Example
479    /// ```ignore,no_run
480    /// # use google_cloud_securityposture_v1::model::CustomConstraint;
481    /// let x = CustomConstraint::new().set_condition("example");
482    /// ```
483    pub fn set_condition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
484        self.condition = v.into();
485        self
486    }
487
488    /// Sets the value of [action_type][crate::model::CustomConstraint::action_type].
489    ///
490    /// # Example
491    /// ```ignore,no_run
492    /// # use google_cloud_securityposture_v1::model::CustomConstraint;
493    /// use google_cloud_securityposture_v1::model::custom_constraint::ActionType;
494    /// let x0 = CustomConstraint::new().set_action_type(ActionType::Allow);
495    /// let x1 = CustomConstraint::new().set_action_type(ActionType::Deny);
496    /// ```
497    pub fn set_action_type<T: std::convert::Into<crate::model::custom_constraint::ActionType>>(
498        mut self,
499        v: T,
500    ) -> Self {
501        self.action_type = v.into();
502        self
503    }
504
505    /// Sets the value of [display_name][crate::model::CustomConstraint::display_name].
506    ///
507    /// # Example
508    /// ```ignore,no_run
509    /// # use google_cloud_securityposture_v1::model::CustomConstraint;
510    /// let x = CustomConstraint::new().set_display_name("example");
511    /// ```
512    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
513        self.display_name = v.into();
514        self
515    }
516
517    /// Sets the value of [description][crate::model::CustomConstraint::description].
518    ///
519    /// # Example
520    /// ```ignore,no_run
521    /// # use google_cloud_securityposture_v1::model::CustomConstraint;
522    /// let x = CustomConstraint::new().set_description("example");
523    /// ```
524    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
525        self.description = v.into();
526        self
527    }
528
529    /// Sets the value of [update_time][crate::model::CustomConstraint::update_time].
530    ///
531    /// # Example
532    /// ```ignore,no_run
533    /// # use google_cloud_securityposture_v1::model::CustomConstraint;
534    /// use wkt::Timestamp;
535    /// let x = CustomConstraint::new().set_update_time(Timestamp::default()/* use setters */);
536    /// ```
537    pub fn set_update_time<T>(mut self, v: T) -> Self
538    where
539        T: std::convert::Into<wkt::Timestamp>,
540    {
541        self.update_time = std::option::Option::Some(v.into());
542        self
543    }
544
545    /// Sets or clears the value of [update_time][crate::model::CustomConstraint::update_time].
546    ///
547    /// # Example
548    /// ```ignore,no_run
549    /// # use google_cloud_securityposture_v1::model::CustomConstraint;
550    /// use wkt::Timestamp;
551    /// let x = CustomConstraint::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
552    /// let x = CustomConstraint::new().set_or_clear_update_time(None::<Timestamp>);
553    /// ```
554    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
555    where
556        T: std::convert::Into<wkt::Timestamp>,
557    {
558        self.update_time = v.map(|x| x.into());
559        self
560    }
561}
562
563impl wkt::message::Message for CustomConstraint {
564    fn typename() -> &'static str {
565        "type.googleapis.com/google.cloud.securityposture.v1.CustomConstraint"
566    }
567}
568
569/// Defines additional types related to [CustomConstraint].
570pub mod custom_constraint {
571    #[allow(unused_imports)]
572    use super::*;
573
574    /// The operation for which this constraint will be applied. To apply this
575    /// constraint only when creating new VMs, the `method_types` should be
576    /// `CREATE` only. To apply this constraint when creating or deleting
577    /// VMs, the `method_types` should be `CREATE` and `DELETE`.
578    ///
579    /// `UPDATE` only custom constraints are not supported. Use `CREATE` or
580    /// `CREATE, UPDATE`.
581    ///
582    /// # Working with unknown values
583    ///
584    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
585    /// additional enum variants at any time. Adding new variants is not considered
586    /// a breaking change. Applications should write their code in anticipation of:
587    ///
588    /// - New values appearing in future releases of the client library, **and**
589    /// - New values received dynamically, without application changes.
590    ///
591    /// Please consult the [Working with enums] section in the user guide for some
592    /// guidelines.
593    ///
594    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
595    #[derive(Clone, Debug, PartialEq)]
596    #[non_exhaustive]
597    pub enum MethodType {
598        /// Unspecified. Results in an error.
599        Unspecified,
600        /// Constraint applied when creating the resource.
601        Create,
602        /// Constraint applied when updating the resource.
603        Update,
604        /// Constraint applied when deleting the resource.
605        /// Not supported yet.
606        Delete,
607        /// If set, the enum was initialized with an unknown value.
608        ///
609        /// Applications can examine the value using [MethodType::value] or
610        /// [MethodType::name].
611        UnknownValue(method_type::UnknownValue),
612    }
613
614    #[doc(hidden)]
615    pub mod method_type {
616        #[allow(unused_imports)]
617        use super::*;
618        #[derive(Clone, Debug, PartialEq)]
619        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
620    }
621
622    impl MethodType {
623        /// Gets the enum value.
624        ///
625        /// Returns `None` if the enum contains an unknown value deserialized from
626        /// the string representation of enums.
627        pub fn value(&self) -> std::option::Option<i32> {
628            match self {
629                Self::Unspecified => std::option::Option::Some(0),
630                Self::Create => std::option::Option::Some(1),
631                Self::Update => std::option::Option::Some(2),
632                Self::Delete => std::option::Option::Some(3),
633                Self::UnknownValue(u) => u.0.value(),
634            }
635        }
636
637        /// Gets the enum value as a string.
638        ///
639        /// Returns `None` if the enum contains an unknown value deserialized from
640        /// the integer representation of enums.
641        pub fn name(&self) -> std::option::Option<&str> {
642            match self {
643                Self::Unspecified => std::option::Option::Some("METHOD_TYPE_UNSPECIFIED"),
644                Self::Create => std::option::Option::Some("CREATE"),
645                Self::Update => std::option::Option::Some("UPDATE"),
646                Self::Delete => std::option::Option::Some("DELETE"),
647                Self::UnknownValue(u) => u.0.name(),
648            }
649        }
650    }
651
652    impl std::default::Default for MethodType {
653        fn default() -> Self {
654            use std::convert::From;
655            Self::from(0)
656        }
657    }
658
659    impl std::fmt::Display for MethodType {
660        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
661            wkt::internal::display_enum(f, self.name(), self.value())
662        }
663    }
664
665    impl std::convert::From<i32> for MethodType {
666        fn from(value: i32) -> Self {
667            match value {
668                0 => Self::Unspecified,
669                1 => Self::Create,
670                2 => Self::Update,
671                3 => Self::Delete,
672                _ => Self::UnknownValue(method_type::UnknownValue(
673                    wkt::internal::UnknownEnumValue::Integer(value),
674                )),
675            }
676        }
677    }
678
679    impl std::convert::From<&str> for MethodType {
680        fn from(value: &str) -> Self {
681            use std::string::ToString;
682            match value {
683                "METHOD_TYPE_UNSPECIFIED" => Self::Unspecified,
684                "CREATE" => Self::Create,
685                "UPDATE" => Self::Update,
686                "DELETE" => Self::Delete,
687                _ => Self::UnknownValue(method_type::UnknownValue(
688                    wkt::internal::UnknownEnumValue::String(value.to_string()),
689                )),
690            }
691        }
692    }
693
694    impl serde::ser::Serialize for MethodType {
695        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
696        where
697            S: serde::Serializer,
698        {
699            match self {
700                Self::Unspecified => serializer.serialize_i32(0),
701                Self::Create => serializer.serialize_i32(1),
702                Self::Update => serializer.serialize_i32(2),
703                Self::Delete => serializer.serialize_i32(3),
704                Self::UnknownValue(u) => u.0.serialize(serializer),
705            }
706        }
707    }
708
709    impl<'de> serde::de::Deserialize<'de> for MethodType {
710        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
711        where
712            D: serde::Deserializer<'de>,
713        {
714            deserializer.deserialize_any(wkt::internal::EnumVisitor::<MethodType>::new(
715                ".google.cloud.securityposture.v1.CustomConstraint.MethodType",
716            ))
717        }
718    }
719
720    /// Allow or deny type.
721    ///
722    /// # Working with unknown values
723    ///
724    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
725    /// additional enum variants at any time. Adding new variants is not considered
726    /// a breaking change. Applications should write their code in anticipation of:
727    ///
728    /// - New values appearing in future releases of the client library, **and**
729    /// - New values received dynamically, without application changes.
730    ///
731    /// Please consult the [Working with enums] section in the user guide for some
732    /// guidelines.
733    ///
734    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
735    #[derive(Clone, Debug, PartialEq)]
736    #[non_exhaustive]
737    pub enum ActionType {
738        /// Unspecified. Results in an error.
739        Unspecified,
740        /// Allowed action type.
741        Allow,
742        /// Deny action type.
743        Deny,
744        /// If set, the enum was initialized with an unknown value.
745        ///
746        /// Applications can examine the value using [ActionType::value] or
747        /// [ActionType::name].
748        UnknownValue(action_type::UnknownValue),
749    }
750
751    #[doc(hidden)]
752    pub mod action_type {
753        #[allow(unused_imports)]
754        use super::*;
755        #[derive(Clone, Debug, PartialEq)]
756        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
757    }
758
759    impl ActionType {
760        /// Gets the enum value.
761        ///
762        /// Returns `None` if the enum contains an unknown value deserialized from
763        /// the string representation of enums.
764        pub fn value(&self) -> std::option::Option<i32> {
765            match self {
766                Self::Unspecified => std::option::Option::Some(0),
767                Self::Allow => std::option::Option::Some(1),
768                Self::Deny => std::option::Option::Some(2),
769                Self::UnknownValue(u) => u.0.value(),
770            }
771        }
772
773        /// Gets the enum value as a string.
774        ///
775        /// Returns `None` if the enum contains an unknown value deserialized from
776        /// the integer representation of enums.
777        pub fn name(&self) -> std::option::Option<&str> {
778            match self {
779                Self::Unspecified => std::option::Option::Some("ACTION_TYPE_UNSPECIFIED"),
780                Self::Allow => std::option::Option::Some("ALLOW"),
781                Self::Deny => std::option::Option::Some("DENY"),
782                Self::UnknownValue(u) => u.0.name(),
783            }
784        }
785    }
786
787    impl std::default::Default for ActionType {
788        fn default() -> Self {
789            use std::convert::From;
790            Self::from(0)
791        }
792    }
793
794    impl std::fmt::Display for ActionType {
795        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
796            wkt::internal::display_enum(f, self.name(), self.value())
797        }
798    }
799
800    impl std::convert::From<i32> for ActionType {
801        fn from(value: i32) -> Self {
802            match value {
803                0 => Self::Unspecified,
804                1 => Self::Allow,
805                2 => Self::Deny,
806                _ => Self::UnknownValue(action_type::UnknownValue(
807                    wkt::internal::UnknownEnumValue::Integer(value),
808                )),
809            }
810        }
811    }
812
813    impl std::convert::From<&str> for ActionType {
814        fn from(value: &str) -> Self {
815            use std::string::ToString;
816            match value {
817                "ACTION_TYPE_UNSPECIFIED" => Self::Unspecified,
818                "ALLOW" => Self::Allow,
819                "DENY" => Self::Deny,
820                _ => Self::UnknownValue(action_type::UnknownValue(
821                    wkt::internal::UnknownEnumValue::String(value.to_string()),
822                )),
823            }
824        }
825    }
826
827    impl serde::ser::Serialize for ActionType {
828        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
829        where
830            S: serde::Serializer,
831        {
832            match self {
833                Self::Unspecified => serializer.serialize_i32(0),
834                Self::Allow => serializer.serialize_i32(1),
835                Self::Deny => serializer.serialize_i32(2),
836                Self::UnknownValue(u) => u.0.serialize(serializer),
837            }
838        }
839    }
840
841    impl<'de> serde::de::Deserialize<'de> for ActionType {
842        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
843        where
844            D: serde::Deserializer<'de>,
845        {
846            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ActionType>::new(
847                ".google.cloud.securityposture.v1.CustomConstraint.ActionType",
848            ))
849        }
850    }
851}
852
853/// Message for Org Policy Canned Constraint.
854#[derive(Clone, Default, PartialEq)]
855#[non_exhaustive]
856pub struct OrgPolicyConstraint {
857    /// Required. Org Policy Canned Constraint id.
858    pub canned_constraint_id: std::string::String,
859
860    /// Required. Org PolicySpec rules.
861    pub policy_rules: std::vec::Vec<crate::model::PolicyRule>,
862
863    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
864}
865
866impl OrgPolicyConstraint {
867    /// Creates a new default instance.
868    pub fn new() -> Self {
869        std::default::Default::default()
870    }
871
872    /// Sets the value of [canned_constraint_id][crate::model::OrgPolicyConstraint::canned_constraint_id].
873    ///
874    /// # Example
875    /// ```ignore,no_run
876    /// # use google_cloud_securityposture_v1::model::OrgPolicyConstraint;
877    /// let x = OrgPolicyConstraint::new().set_canned_constraint_id("example");
878    /// ```
879    pub fn set_canned_constraint_id<T: std::convert::Into<std::string::String>>(
880        mut self,
881        v: T,
882    ) -> Self {
883        self.canned_constraint_id = v.into();
884        self
885    }
886
887    /// Sets the value of [policy_rules][crate::model::OrgPolicyConstraint::policy_rules].
888    ///
889    /// # Example
890    /// ```ignore,no_run
891    /// # use google_cloud_securityposture_v1::model::OrgPolicyConstraint;
892    /// use google_cloud_securityposture_v1::model::PolicyRule;
893    /// let x = OrgPolicyConstraint::new()
894    ///     .set_policy_rules([
895    ///         PolicyRule::default()/* use setters */,
896    ///         PolicyRule::default()/* use (different) setters */,
897    ///     ]);
898    /// ```
899    pub fn set_policy_rules<T, V>(mut self, v: T) -> Self
900    where
901        T: std::iter::IntoIterator<Item = V>,
902        V: std::convert::Into<crate::model::PolicyRule>,
903    {
904        use std::iter::Iterator;
905        self.policy_rules = v.into_iter().map(|i| i.into()).collect();
906        self
907    }
908}
909
910impl wkt::message::Message for OrgPolicyConstraint {
911    fn typename() -> &'static str {
912        "type.googleapis.com/google.cloud.securityposture.v1.OrgPolicyConstraint"
913    }
914}
915
916/// Message for Org Policy Custom Constraint.
917#[derive(Clone, Default, PartialEq)]
918#[non_exhaustive]
919pub struct OrgPolicyConstraintCustom {
920    /// Required. Org Policy Custom Constraint.
921    pub custom_constraint: std::option::Option<crate::model::CustomConstraint>,
922
923    /// Required. Org Policyspec rules.
924    pub policy_rules: std::vec::Vec<crate::model::PolicyRule>,
925
926    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
927}
928
929impl OrgPolicyConstraintCustom {
930    /// Creates a new default instance.
931    pub fn new() -> Self {
932        std::default::Default::default()
933    }
934
935    /// Sets the value of [custom_constraint][crate::model::OrgPolicyConstraintCustom::custom_constraint].
936    ///
937    /// # Example
938    /// ```ignore,no_run
939    /// # use google_cloud_securityposture_v1::model::OrgPolicyConstraintCustom;
940    /// use google_cloud_securityposture_v1::model::CustomConstraint;
941    /// let x = OrgPolicyConstraintCustom::new().set_custom_constraint(CustomConstraint::default()/* use setters */);
942    /// ```
943    pub fn set_custom_constraint<T>(mut self, v: T) -> Self
944    where
945        T: std::convert::Into<crate::model::CustomConstraint>,
946    {
947        self.custom_constraint = std::option::Option::Some(v.into());
948        self
949    }
950
951    /// Sets or clears the value of [custom_constraint][crate::model::OrgPolicyConstraintCustom::custom_constraint].
952    ///
953    /// # Example
954    /// ```ignore,no_run
955    /// # use google_cloud_securityposture_v1::model::OrgPolicyConstraintCustom;
956    /// use google_cloud_securityposture_v1::model::CustomConstraint;
957    /// let x = OrgPolicyConstraintCustom::new().set_or_clear_custom_constraint(Some(CustomConstraint::default()/* use setters */));
958    /// let x = OrgPolicyConstraintCustom::new().set_or_clear_custom_constraint(None::<CustomConstraint>);
959    /// ```
960    pub fn set_or_clear_custom_constraint<T>(mut self, v: std::option::Option<T>) -> Self
961    where
962        T: std::convert::Into<crate::model::CustomConstraint>,
963    {
964        self.custom_constraint = v.map(|x| x.into());
965        self
966    }
967
968    /// Sets the value of [policy_rules][crate::model::OrgPolicyConstraintCustom::policy_rules].
969    ///
970    /// # Example
971    /// ```ignore,no_run
972    /// # use google_cloud_securityposture_v1::model::OrgPolicyConstraintCustom;
973    /// use google_cloud_securityposture_v1::model::PolicyRule;
974    /// let x = OrgPolicyConstraintCustom::new()
975    ///     .set_policy_rules([
976    ///         PolicyRule::default()/* use setters */,
977    ///         PolicyRule::default()/* use (different) setters */,
978    ///     ]);
979    /// ```
980    pub fn set_policy_rules<T, V>(mut self, v: T) -> Self
981    where
982        T: std::iter::IntoIterator<Item = V>,
983        V: std::convert::Into<crate::model::PolicyRule>,
984    {
985        use std::iter::Iterator;
986        self.policy_rules = v.into_iter().map(|i| i.into()).collect();
987        self
988    }
989}
990
991impl wkt::message::Message for OrgPolicyConstraintCustom {
992    fn typename() -> &'static str {
993        "type.googleapis.com/google.cloud.securityposture.v1.OrgPolicyConstraintCustom"
994    }
995}
996
997/// Represents the metadata of the long-running operation.
998#[derive(Clone, Default, PartialEq)]
999#[non_exhaustive]
1000pub struct OperationMetadata {
1001    /// Output only. The time the operation was created.
1002    pub create_time: std::option::Option<wkt::Timestamp>,
1003
1004    /// Output only. The time the operation finished running.
1005    pub end_time: std::option::Option<wkt::Timestamp>,
1006
1007    /// Output only. Server-defined resource path for the target of the operation.
1008    pub target: std::string::String,
1009
1010    /// Output only. Name of the verb executed by the operation.
1011    pub verb: std::string::String,
1012
1013    /// Output only. Human-readable status of the operation, if any.
1014    pub status_message: std::string::String,
1015
1016    /// Output only. Identifies whether the user has requested cancellation
1017    /// of the operation. Operations that have been cancelled successfully
1018    /// have [Operation.error][] value with a
1019    /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
1020    /// `Code.CANCELLED`.
1021    pub requested_cancellation: bool,
1022
1023    /// Output only. API version used to start the operation.
1024    pub api_version: std::string::String,
1025
1026    /// Output only. This is a output only optional field which will be filled only
1027    /// in cases where PostureDeployments enter failure states like UPDATE_FAILED
1028    /// or CREATE_FAILED or DELETE_FAILED.
1029    pub error_message: std::string::String,
1030
1031    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1032}
1033
1034impl OperationMetadata {
1035    /// Creates a new default instance.
1036    pub fn new() -> Self {
1037        std::default::Default::default()
1038    }
1039
1040    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
1041    ///
1042    /// # Example
1043    /// ```ignore,no_run
1044    /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1045    /// use wkt::Timestamp;
1046    /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
1047    /// ```
1048    pub fn set_create_time<T>(mut self, v: T) -> Self
1049    where
1050        T: std::convert::Into<wkt::Timestamp>,
1051    {
1052        self.create_time = std::option::Option::Some(v.into());
1053        self
1054    }
1055
1056    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
1057    ///
1058    /// # Example
1059    /// ```ignore,no_run
1060    /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1061    /// use wkt::Timestamp;
1062    /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1063    /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
1064    /// ```
1065    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1066    where
1067        T: std::convert::Into<wkt::Timestamp>,
1068    {
1069        self.create_time = v.map(|x| x.into());
1070        self
1071    }
1072
1073    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
1074    ///
1075    /// # Example
1076    /// ```ignore,no_run
1077    /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1078    /// use wkt::Timestamp;
1079    /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
1080    /// ```
1081    pub fn set_end_time<T>(mut self, v: T) -> Self
1082    where
1083        T: std::convert::Into<wkt::Timestamp>,
1084    {
1085        self.end_time = std::option::Option::Some(v.into());
1086        self
1087    }
1088
1089    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
1090    ///
1091    /// # Example
1092    /// ```ignore,no_run
1093    /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1094    /// use wkt::Timestamp;
1095    /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
1096    /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
1097    /// ```
1098    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
1099    where
1100        T: std::convert::Into<wkt::Timestamp>,
1101    {
1102        self.end_time = v.map(|x| x.into());
1103        self
1104    }
1105
1106    /// Sets the value of [target][crate::model::OperationMetadata::target].
1107    ///
1108    /// # Example
1109    /// ```ignore,no_run
1110    /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1111    /// let x = OperationMetadata::new().set_target("example");
1112    /// ```
1113    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1114        self.target = v.into();
1115        self
1116    }
1117
1118    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
1119    ///
1120    /// # Example
1121    /// ```ignore,no_run
1122    /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1123    /// let x = OperationMetadata::new().set_verb("example");
1124    /// ```
1125    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1126        self.verb = v.into();
1127        self
1128    }
1129
1130    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
1131    ///
1132    /// # Example
1133    /// ```ignore,no_run
1134    /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1135    /// let x = OperationMetadata::new().set_status_message("example");
1136    /// ```
1137    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1138        self.status_message = v.into();
1139        self
1140    }
1141
1142    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
1143    ///
1144    /// # Example
1145    /// ```ignore,no_run
1146    /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1147    /// let x = OperationMetadata::new().set_requested_cancellation(true);
1148    /// ```
1149    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1150        self.requested_cancellation = v.into();
1151        self
1152    }
1153
1154    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
1155    ///
1156    /// # Example
1157    /// ```ignore,no_run
1158    /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1159    /// let x = OperationMetadata::new().set_api_version("example");
1160    /// ```
1161    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1162        self.api_version = v.into();
1163        self
1164    }
1165
1166    /// Sets the value of [error_message][crate::model::OperationMetadata::error_message].
1167    ///
1168    /// # Example
1169    /// ```ignore,no_run
1170    /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1171    /// let x = OperationMetadata::new().set_error_message("example");
1172    /// ```
1173    pub fn set_error_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1174        self.error_message = v.into();
1175        self
1176    }
1177}
1178
1179impl wkt::message::Message for OperationMetadata {
1180    fn typename() -> &'static str {
1181        "type.googleapis.com/google.cloud.securityposture.v1.OperationMetadata"
1182    }
1183}
1184
1185/// Postures
1186/// Definition of a Posture.
1187#[derive(Clone, Default, PartialEq)]
1188#[non_exhaustive]
1189pub struct Posture {
1190    /// Required. Identifier. The name of this Posture resource, in the format of
1191    /// organizations/{org_id}/locations/{location_id}/postures/{posture}.
1192    pub name: std::string::String,
1193
1194    /// Required. State of Posture resource.
1195    pub state: crate::model::posture::State,
1196
1197    /// Output only. Immutable. The revision ID of the posture.
1198    /// The format is an 8-character hexadecimal string.
1199    /// <https://google.aip.dev/162>
1200    pub revision_id: std::string::String,
1201
1202    /// Output only. The timestamp that the posture was created.
1203    pub create_time: std::option::Option<wkt::Timestamp>,
1204
1205    /// Output only. The timestamp that the posture was updated.
1206    pub update_time: std::option::Option<wkt::Timestamp>,
1207
1208    /// Optional. User provided description of the posture.
1209    pub description: std::string::String,
1210
1211    /// Required. List of Policy sets.
1212    pub policy_sets: std::vec::Vec<crate::model::PolicySet>,
1213
1214    /// Optional. An opaque tag indicating the current version of the Posture, used
1215    /// for concurrency control. When the `Posture` is returned from either a
1216    /// `GetPosture` or a `ListPostures` request, this `etag` indicates the version
1217    /// of the current `Posture` to use when executing a read-modify-write loop.
1218    ///
1219    /// When the `Posture` is used in a `UpdatePosture` method, use the `etag`
1220    /// value that was returned from a `GetPosture` request as part of a
1221    /// read-modify-write loop for concurrency control. Not setting the `etag` in a
1222    /// `UpdatePosture` request will result in an unconditional write of the
1223    /// `Posture`.
1224    pub etag: std::string::String,
1225
1226    /// Optional. User annotations. These attributes can only be set and used by
1227    /// the user, and not by Google Security Postures.
1228    /// .
1229    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
1230
1231    /// Output only. Whether or not this Posture is in the process of being
1232    /// updated.
1233    pub reconciling: bool,
1234
1235    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1236}
1237
1238impl Posture {
1239    /// Creates a new default instance.
1240    pub fn new() -> Self {
1241        std::default::Default::default()
1242    }
1243
1244    /// Sets the value of [name][crate::model::Posture::name].
1245    ///
1246    /// # Example
1247    /// ```ignore,no_run
1248    /// # use google_cloud_securityposture_v1::model::Posture;
1249    /// # let organization_id = "organization_id";
1250    /// # let location_id = "location_id";
1251    /// # let posture_id = "posture_id";
1252    /// let x = Posture::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postures/{posture_id}"));
1253    /// ```
1254    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1255        self.name = v.into();
1256        self
1257    }
1258
1259    /// Sets the value of [state][crate::model::Posture::state].
1260    ///
1261    /// # Example
1262    /// ```ignore,no_run
1263    /// # use google_cloud_securityposture_v1::model::Posture;
1264    /// use google_cloud_securityposture_v1::model::posture::State;
1265    /// let x0 = Posture::new().set_state(State::Deprecated);
1266    /// let x1 = Posture::new().set_state(State::Draft);
1267    /// let x2 = Posture::new().set_state(State::Active);
1268    /// ```
1269    pub fn set_state<T: std::convert::Into<crate::model::posture::State>>(mut self, v: T) -> Self {
1270        self.state = v.into();
1271        self
1272    }
1273
1274    /// Sets the value of [revision_id][crate::model::Posture::revision_id].
1275    ///
1276    /// # Example
1277    /// ```ignore,no_run
1278    /// # use google_cloud_securityposture_v1::model::Posture;
1279    /// let x = Posture::new().set_revision_id("example");
1280    /// ```
1281    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1282        self.revision_id = v.into();
1283        self
1284    }
1285
1286    /// Sets the value of [create_time][crate::model::Posture::create_time].
1287    ///
1288    /// # Example
1289    /// ```ignore,no_run
1290    /// # use google_cloud_securityposture_v1::model::Posture;
1291    /// use wkt::Timestamp;
1292    /// let x = Posture::new().set_create_time(Timestamp::default()/* use setters */);
1293    /// ```
1294    pub fn set_create_time<T>(mut self, v: T) -> Self
1295    where
1296        T: std::convert::Into<wkt::Timestamp>,
1297    {
1298        self.create_time = std::option::Option::Some(v.into());
1299        self
1300    }
1301
1302    /// Sets or clears the value of [create_time][crate::model::Posture::create_time].
1303    ///
1304    /// # Example
1305    /// ```ignore,no_run
1306    /// # use google_cloud_securityposture_v1::model::Posture;
1307    /// use wkt::Timestamp;
1308    /// let x = Posture::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1309    /// let x = Posture::new().set_or_clear_create_time(None::<Timestamp>);
1310    /// ```
1311    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1312    where
1313        T: std::convert::Into<wkt::Timestamp>,
1314    {
1315        self.create_time = v.map(|x| x.into());
1316        self
1317    }
1318
1319    /// Sets the value of [update_time][crate::model::Posture::update_time].
1320    ///
1321    /// # Example
1322    /// ```ignore,no_run
1323    /// # use google_cloud_securityposture_v1::model::Posture;
1324    /// use wkt::Timestamp;
1325    /// let x = Posture::new().set_update_time(Timestamp::default()/* use setters */);
1326    /// ```
1327    pub fn set_update_time<T>(mut self, v: T) -> Self
1328    where
1329        T: std::convert::Into<wkt::Timestamp>,
1330    {
1331        self.update_time = std::option::Option::Some(v.into());
1332        self
1333    }
1334
1335    /// Sets or clears the value of [update_time][crate::model::Posture::update_time].
1336    ///
1337    /// # Example
1338    /// ```ignore,no_run
1339    /// # use google_cloud_securityposture_v1::model::Posture;
1340    /// use wkt::Timestamp;
1341    /// let x = Posture::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1342    /// let x = Posture::new().set_or_clear_update_time(None::<Timestamp>);
1343    /// ```
1344    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1345    where
1346        T: std::convert::Into<wkt::Timestamp>,
1347    {
1348        self.update_time = v.map(|x| x.into());
1349        self
1350    }
1351
1352    /// Sets the value of [description][crate::model::Posture::description].
1353    ///
1354    /// # Example
1355    /// ```ignore,no_run
1356    /// # use google_cloud_securityposture_v1::model::Posture;
1357    /// let x = Posture::new().set_description("example");
1358    /// ```
1359    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1360        self.description = v.into();
1361        self
1362    }
1363
1364    /// Sets the value of [policy_sets][crate::model::Posture::policy_sets].
1365    ///
1366    /// # Example
1367    /// ```ignore,no_run
1368    /// # use google_cloud_securityposture_v1::model::Posture;
1369    /// use google_cloud_securityposture_v1::model::PolicySet;
1370    /// let x = Posture::new()
1371    ///     .set_policy_sets([
1372    ///         PolicySet::default()/* use setters */,
1373    ///         PolicySet::default()/* use (different) setters */,
1374    ///     ]);
1375    /// ```
1376    pub fn set_policy_sets<T, V>(mut self, v: T) -> Self
1377    where
1378        T: std::iter::IntoIterator<Item = V>,
1379        V: std::convert::Into<crate::model::PolicySet>,
1380    {
1381        use std::iter::Iterator;
1382        self.policy_sets = v.into_iter().map(|i| i.into()).collect();
1383        self
1384    }
1385
1386    /// Sets the value of [etag][crate::model::Posture::etag].
1387    ///
1388    /// # Example
1389    /// ```ignore,no_run
1390    /// # use google_cloud_securityposture_v1::model::Posture;
1391    /// let x = Posture::new().set_etag("example");
1392    /// ```
1393    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1394        self.etag = v.into();
1395        self
1396    }
1397
1398    /// Sets the value of [annotations][crate::model::Posture::annotations].
1399    ///
1400    /// # Example
1401    /// ```ignore,no_run
1402    /// # use google_cloud_securityposture_v1::model::Posture;
1403    /// let x = Posture::new().set_annotations([
1404    ///     ("key0", "abc"),
1405    ///     ("key1", "xyz"),
1406    /// ]);
1407    /// ```
1408    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
1409    where
1410        T: std::iter::IntoIterator<Item = (K, V)>,
1411        K: std::convert::Into<std::string::String>,
1412        V: std::convert::Into<std::string::String>,
1413    {
1414        use std::iter::Iterator;
1415        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1416        self
1417    }
1418
1419    /// Sets the value of [reconciling][crate::model::Posture::reconciling].
1420    ///
1421    /// # Example
1422    /// ```ignore,no_run
1423    /// # use google_cloud_securityposture_v1::model::Posture;
1424    /// let x = Posture::new().set_reconciling(true);
1425    /// ```
1426    pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1427        self.reconciling = v.into();
1428        self
1429    }
1430}
1431
1432impl wkt::message::Message for Posture {
1433    fn typename() -> &'static str {
1434        "type.googleapis.com/google.cloud.securityposture.v1.Posture"
1435    }
1436}
1437
1438/// Defines additional types related to [Posture].
1439pub mod posture {
1440    #[allow(unused_imports)]
1441    use super::*;
1442
1443    /// State of a Posture.
1444    ///
1445    /// # Working with unknown values
1446    ///
1447    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1448    /// additional enum variants at any time. Adding new variants is not considered
1449    /// a breaking change. Applications should write their code in anticipation of:
1450    ///
1451    /// - New values appearing in future releases of the client library, **and**
1452    /// - New values received dynamically, without application changes.
1453    ///
1454    /// Please consult the [Working with enums] section in the user guide for some
1455    /// guidelines.
1456    ///
1457    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1458    #[derive(Clone, Debug, PartialEq)]
1459    #[non_exhaustive]
1460    pub enum State {
1461        /// Unspecified operation state.
1462        Unspecified,
1463        /// The Posture is marked deprecated when it is not in use by the user.
1464        Deprecated,
1465        /// The Posture is created successfully but is not yet ready for usage.
1466        Draft,
1467        /// The Posture state is active. Ready for use/deployments.
1468        Active,
1469        /// If set, the enum was initialized with an unknown value.
1470        ///
1471        /// Applications can examine the value using [State::value] or
1472        /// [State::name].
1473        UnknownValue(state::UnknownValue),
1474    }
1475
1476    #[doc(hidden)]
1477    pub mod state {
1478        #[allow(unused_imports)]
1479        use super::*;
1480        #[derive(Clone, Debug, PartialEq)]
1481        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1482    }
1483
1484    impl State {
1485        /// Gets the enum value.
1486        ///
1487        /// Returns `None` if the enum contains an unknown value deserialized from
1488        /// the string representation of enums.
1489        pub fn value(&self) -> std::option::Option<i32> {
1490            match self {
1491                Self::Unspecified => std::option::Option::Some(0),
1492                Self::Deprecated => std::option::Option::Some(1),
1493                Self::Draft => std::option::Option::Some(2),
1494                Self::Active => std::option::Option::Some(3),
1495                Self::UnknownValue(u) => u.0.value(),
1496            }
1497        }
1498
1499        /// Gets the enum value as a string.
1500        ///
1501        /// Returns `None` if the enum contains an unknown value deserialized from
1502        /// the integer representation of enums.
1503        pub fn name(&self) -> std::option::Option<&str> {
1504            match self {
1505                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1506                Self::Deprecated => std::option::Option::Some("DEPRECATED"),
1507                Self::Draft => std::option::Option::Some("DRAFT"),
1508                Self::Active => std::option::Option::Some("ACTIVE"),
1509                Self::UnknownValue(u) => u.0.name(),
1510            }
1511        }
1512    }
1513
1514    impl std::default::Default for State {
1515        fn default() -> Self {
1516            use std::convert::From;
1517            Self::from(0)
1518        }
1519    }
1520
1521    impl std::fmt::Display for State {
1522        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1523            wkt::internal::display_enum(f, self.name(), self.value())
1524        }
1525    }
1526
1527    impl std::convert::From<i32> for State {
1528        fn from(value: i32) -> Self {
1529            match value {
1530                0 => Self::Unspecified,
1531                1 => Self::Deprecated,
1532                2 => Self::Draft,
1533                3 => Self::Active,
1534                _ => Self::UnknownValue(state::UnknownValue(
1535                    wkt::internal::UnknownEnumValue::Integer(value),
1536                )),
1537            }
1538        }
1539    }
1540
1541    impl std::convert::From<&str> for State {
1542        fn from(value: &str) -> Self {
1543            use std::string::ToString;
1544            match value {
1545                "STATE_UNSPECIFIED" => Self::Unspecified,
1546                "DEPRECATED" => Self::Deprecated,
1547                "DRAFT" => Self::Draft,
1548                "ACTIVE" => Self::Active,
1549                _ => Self::UnknownValue(state::UnknownValue(
1550                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1551                )),
1552            }
1553        }
1554    }
1555
1556    impl serde::ser::Serialize for State {
1557        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1558        where
1559            S: serde::Serializer,
1560        {
1561            match self {
1562                Self::Unspecified => serializer.serialize_i32(0),
1563                Self::Deprecated => serializer.serialize_i32(1),
1564                Self::Draft => serializer.serialize_i32(2),
1565                Self::Active => serializer.serialize_i32(3),
1566                Self::UnknownValue(u) => u.0.serialize(serializer),
1567            }
1568        }
1569    }
1570
1571    impl<'de> serde::de::Deserialize<'de> for State {
1572        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1573        where
1574            D: serde::Deserializer<'de>,
1575        {
1576            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1577                ".google.cloud.securityposture.v1.Posture.State",
1578            ))
1579        }
1580    }
1581}
1582
1583/// PolicySet representation.
1584#[derive(Clone, Default, PartialEq)]
1585#[non_exhaustive]
1586pub struct PolicySet {
1587    /// Required. ID of the Policy set.
1588    pub policy_set_id: std::string::String,
1589
1590    /// Optional. Description of the Policy set.
1591    pub description: std::string::String,
1592
1593    /// Required. List of policies.
1594    pub policies: std::vec::Vec<crate::model::Policy>,
1595
1596    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1597}
1598
1599impl PolicySet {
1600    /// Creates a new default instance.
1601    pub fn new() -> Self {
1602        std::default::Default::default()
1603    }
1604
1605    /// Sets the value of [policy_set_id][crate::model::PolicySet::policy_set_id].
1606    ///
1607    /// # Example
1608    /// ```ignore,no_run
1609    /// # use google_cloud_securityposture_v1::model::PolicySet;
1610    /// let x = PolicySet::new().set_policy_set_id("example");
1611    /// ```
1612    pub fn set_policy_set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1613        self.policy_set_id = v.into();
1614        self
1615    }
1616
1617    /// Sets the value of [description][crate::model::PolicySet::description].
1618    ///
1619    /// # Example
1620    /// ```ignore,no_run
1621    /// # use google_cloud_securityposture_v1::model::PolicySet;
1622    /// let x = PolicySet::new().set_description("example");
1623    /// ```
1624    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1625        self.description = v.into();
1626        self
1627    }
1628
1629    /// Sets the value of [policies][crate::model::PolicySet::policies].
1630    ///
1631    /// # Example
1632    /// ```ignore,no_run
1633    /// # use google_cloud_securityposture_v1::model::PolicySet;
1634    /// use google_cloud_securityposture_v1::model::Policy;
1635    /// let x = PolicySet::new()
1636    ///     .set_policies([
1637    ///         Policy::default()/* use setters */,
1638    ///         Policy::default()/* use (different) setters */,
1639    ///     ]);
1640    /// ```
1641    pub fn set_policies<T, V>(mut self, v: T) -> Self
1642    where
1643        T: std::iter::IntoIterator<Item = V>,
1644        V: std::convert::Into<crate::model::Policy>,
1645    {
1646        use std::iter::Iterator;
1647        self.policies = v.into_iter().map(|i| i.into()).collect();
1648        self
1649    }
1650}
1651
1652impl wkt::message::Message for PolicySet {
1653    fn typename() -> &'static str {
1654        "type.googleapis.com/google.cloud.securityposture.v1.PolicySet"
1655    }
1656}
1657
1658/// Policy representation.
1659#[derive(Clone, Default, PartialEq)]
1660#[non_exhaustive]
1661pub struct Policy {
1662    /// Required. ID of the Policy that is user generated, immutable and unique
1663    /// within the scope of a policy set.
1664    pub policy_id: std::string::String,
1665
1666    /// Optional. Contains list of mapping for a Policy to a standard and control.
1667    pub compliance_standards: std::vec::Vec<crate::model::policy::ComplianceStandard>,
1668
1669    /// Required. Constraint details.
1670    pub constraint: std::option::Option<crate::model::Constraint>,
1671
1672    /// Optional. Description of the Policy.
1673    pub description: std::string::String,
1674
1675    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1676}
1677
1678impl Policy {
1679    /// Creates a new default instance.
1680    pub fn new() -> Self {
1681        std::default::Default::default()
1682    }
1683
1684    /// Sets the value of [policy_id][crate::model::Policy::policy_id].
1685    ///
1686    /// # Example
1687    /// ```ignore,no_run
1688    /// # use google_cloud_securityposture_v1::model::Policy;
1689    /// let x = Policy::new().set_policy_id("example");
1690    /// ```
1691    pub fn set_policy_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1692        self.policy_id = v.into();
1693        self
1694    }
1695
1696    /// Sets the value of [compliance_standards][crate::model::Policy::compliance_standards].
1697    ///
1698    /// # Example
1699    /// ```ignore,no_run
1700    /// # use google_cloud_securityposture_v1::model::Policy;
1701    /// use google_cloud_securityposture_v1::model::policy::ComplianceStandard;
1702    /// let x = Policy::new()
1703    ///     .set_compliance_standards([
1704    ///         ComplianceStandard::default()/* use setters */,
1705    ///         ComplianceStandard::default()/* use (different) setters */,
1706    ///     ]);
1707    /// ```
1708    pub fn set_compliance_standards<T, V>(mut self, v: T) -> Self
1709    where
1710        T: std::iter::IntoIterator<Item = V>,
1711        V: std::convert::Into<crate::model::policy::ComplianceStandard>,
1712    {
1713        use std::iter::Iterator;
1714        self.compliance_standards = v.into_iter().map(|i| i.into()).collect();
1715        self
1716    }
1717
1718    /// Sets the value of [constraint][crate::model::Policy::constraint].
1719    ///
1720    /// # Example
1721    /// ```ignore,no_run
1722    /// # use google_cloud_securityposture_v1::model::Policy;
1723    /// use google_cloud_securityposture_v1::model::Constraint;
1724    /// let x = Policy::new().set_constraint(Constraint::default()/* use setters */);
1725    /// ```
1726    pub fn set_constraint<T>(mut self, v: T) -> Self
1727    where
1728        T: std::convert::Into<crate::model::Constraint>,
1729    {
1730        self.constraint = std::option::Option::Some(v.into());
1731        self
1732    }
1733
1734    /// Sets or clears the value of [constraint][crate::model::Policy::constraint].
1735    ///
1736    /// # Example
1737    /// ```ignore,no_run
1738    /// # use google_cloud_securityposture_v1::model::Policy;
1739    /// use google_cloud_securityposture_v1::model::Constraint;
1740    /// let x = Policy::new().set_or_clear_constraint(Some(Constraint::default()/* use setters */));
1741    /// let x = Policy::new().set_or_clear_constraint(None::<Constraint>);
1742    /// ```
1743    pub fn set_or_clear_constraint<T>(mut self, v: std::option::Option<T>) -> Self
1744    where
1745        T: std::convert::Into<crate::model::Constraint>,
1746    {
1747        self.constraint = v.map(|x| x.into());
1748        self
1749    }
1750
1751    /// Sets the value of [description][crate::model::Policy::description].
1752    ///
1753    /// # Example
1754    /// ```ignore,no_run
1755    /// # use google_cloud_securityposture_v1::model::Policy;
1756    /// let x = Policy::new().set_description("example");
1757    /// ```
1758    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1759        self.description = v.into();
1760        self
1761    }
1762}
1763
1764impl wkt::message::Message for Policy {
1765    fn typename() -> &'static str {
1766        "type.googleapis.com/google.cloud.securityposture.v1.Policy"
1767    }
1768}
1769
1770/// Defines additional types related to [Policy].
1771pub mod policy {
1772    #[allow(unused_imports)]
1773    use super::*;
1774
1775    /// Mapping for a Policy to standard and control.
1776    #[derive(Clone, Default, PartialEq)]
1777    #[non_exhaustive]
1778    pub struct ComplianceStandard {
1779        /// Optional. The compliance standard that the Policy maps to, e.g.: CIS-2.0.
1780        pub standard: std::string::String,
1781
1782        /// Optional. Control mapping provided by user for this Policy. e.g.: 1.5.
1783        pub control: std::string::String,
1784
1785        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1786    }
1787
1788    impl ComplianceStandard {
1789        /// Creates a new default instance.
1790        pub fn new() -> Self {
1791            std::default::Default::default()
1792        }
1793
1794        /// Sets the value of [standard][crate::model::policy::ComplianceStandard::standard].
1795        ///
1796        /// # Example
1797        /// ```ignore,no_run
1798        /// # use google_cloud_securityposture_v1::model::policy::ComplianceStandard;
1799        /// let x = ComplianceStandard::new().set_standard("example");
1800        /// ```
1801        pub fn set_standard<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1802            self.standard = v.into();
1803            self
1804        }
1805
1806        /// Sets the value of [control][crate::model::policy::ComplianceStandard::control].
1807        ///
1808        /// # Example
1809        /// ```ignore,no_run
1810        /// # use google_cloud_securityposture_v1::model::policy::ComplianceStandard;
1811        /// let x = ComplianceStandard::new().set_control("example");
1812        /// ```
1813        pub fn set_control<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1814            self.control = v.into();
1815            self
1816        }
1817    }
1818
1819    impl wkt::message::Message for ComplianceStandard {
1820        fn typename() -> &'static str {
1821            "type.googleapis.com/google.cloud.securityposture.v1.Policy.ComplianceStandard"
1822        }
1823    }
1824}
1825
1826/// Representation of a Constraint.
1827#[derive(Clone, Default, PartialEq)]
1828#[non_exhaustive]
1829pub struct Constraint {
1830    #[allow(missing_docs)]
1831    pub implementation: std::option::Option<crate::model::constraint::Implementation>,
1832
1833    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1834}
1835
1836impl Constraint {
1837    /// Creates a new default instance.
1838    pub fn new() -> Self {
1839        std::default::Default::default()
1840    }
1841
1842    /// Sets the value of [implementation][crate::model::Constraint::implementation].
1843    ///
1844    /// Note that all the setters affecting `implementation` are mutually
1845    /// exclusive.
1846    ///
1847    /// # Example
1848    /// ```ignore,no_run
1849    /// # use google_cloud_securityposture_v1::model::Constraint;
1850    /// use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsModule;
1851    /// let x = Constraint::new().set_implementation(Some(
1852    ///     google_cloud_securityposture_v1::model::constraint::Implementation::SecurityHealthAnalyticsModule(SecurityHealthAnalyticsModule::default().into())));
1853    /// ```
1854    pub fn set_implementation<
1855        T: std::convert::Into<std::option::Option<crate::model::constraint::Implementation>>,
1856    >(
1857        mut self,
1858        v: T,
1859    ) -> Self {
1860        self.implementation = v.into();
1861        self
1862    }
1863
1864    /// The value of [implementation][crate::model::Constraint::implementation]
1865    /// if it holds a `SecurityHealthAnalyticsModule`, `None` if the field is not set or
1866    /// holds a different branch.
1867    pub fn security_health_analytics_module(
1868        &self,
1869    ) -> std::option::Option<&std::boxed::Box<crate::model::SecurityHealthAnalyticsModule>> {
1870        #[allow(unreachable_patterns)]
1871        self.implementation.as_ref().and_then(|v| match v {
1872            crate::model::constraint::Implementation::SecurityHealthAnalyticsModule(v) => {
1873                std::option::Option::Some(v)
1874            }
1875            _ => std::option::Option::None,
1876        })
1877    }
1878
1879    /// Sets the value of [implementation][crate::model::Constraint::implementation]
1880    /// to hold a `SecurityHealthAnalyticsModule`.
1881    ///
1882    /// Note that all the setters affecting `implementation` are
1883    /// mutually exclusive.
1884    ///
1885    /// # Example
1886    /// ```ignore,no_run
1887    /// # use google_cloud_securityposture_v1::model::Constraint;
1888    /// use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsModule;
1889    /// let x = Constraint::new().set_security_health_analytics_module(SecurityHealthAnalyticsModule::default()/* use setters */);
1890    /// assert!(x.security_health_analytics_module().is_some());
1891    /// assert!(x.security_health_analytics_custom_module().is_none());
1892    /// assert!(x.org_policy_constraint().is_none());
1893    /// assert!(x.org_policy_constraint_custom().is_none());
1894    /// ```
1895    pub fn set_security_health_analytics_module<
1896        T: std::convert::Into<std::boxed::Box<crate::model::SecurityHealthAnalyticsModule>>,
1897    >(
1898        mut self,
1899        v: T,
1900    ) -> Self {
1901        self.implementation = std::option::Option::Some(
1902            crate::model::constraint::Implementation::SecurityHealthAnalyticsModule(v.into()),
1903        );
1904        self
1905    }
1906
1907    /// The value of [implementation][crate::model::Constraint::implementation]
1908    /// if it holds a `SecurityHealthAnalyticsCustomModule`, `None` if the field is not set or
1909    /// holds a different branch.
1910    pub fn security_health_analytics_custom_module(
1911        &self,
1912    ) -> std::option::Option<&std::boxed::Box<crate::model::SecurityHealthAnalyticsCustomModule>>
1913    {
1914        #[allow(unreachable_patterns)]
1915        self.implementation.as_ref().and_then(|v| match v {
1916            crate::model::constraint::Implementation::SecurityHealthAnalyticsCustomModule(v) => {
1917                std::option::Option::Some(v)
1918            }
1919            _ => std::option::Option::None,
1920        })
1921    }
1922
1923    /// Sets the value of [implementation][crate::model::Constraint::implementation]
1924    /// to hold a `SecurityHealthAnalyticsCustomModule`.
1925    ///
1926    /// Note that all the setters affecting `implementation` are
1927    /// mutually exclusive.
1928    ///
1929    /// # Example
1930    /// ```ignore,no_run
1931    /// # use google_cloud_securityposture_v1::model::Constraint;
1932    /// use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsCustomModule;
1933    /// let x = Constraint::new().set_security_health_analytics_custom_module(SecurityHealthAnalyticsCustomModule::default()/* use setters */);
1934    /// assert!(x.security_health_analytics_custom_module().is_some());
1935    /// assert!(x.security_health_analytics_module().is_none());
1936    /// assert!(x.org_policy_constraint().is_none());
1937    /// assert!(x.org_policy_constraint_custom().is_none());
1938    /// ```
1939    pub fn set_security_health_analytics_custom_module<
1940        T: std::convert::Into<std::boxed::Box<crate::model::SecurityHealthAnalyticsCustomModule>>,
1941    >(
1942        mut self,
1943        v: T,
1944    ) -> Self {
1945        self.implementation = std::option::Option::Some(
1946            crate::model::constraint::Implementation::SecurityHealthAnalyticsCustomModule(v.into()),
1947        );
1948        self
1949    }
1950
1951    /// The value of [implementation][crate::model::Constraint::implementation]
1952    /// if it holds a `OrgPolicyConstraint`, `None` if the field is not set or
1953    /// holds a different branch.
1954    pub fn org_policy_constraint(
1955        &self,
1956    ) -> std::option::Option<&std::boxed::Box<crate::model::OrgPolicyConstraint>> {
1957        #[allow(unreachable_patterns)]
1958        self.implementation.as_ref().and_then(|v| match v {
1959            crate::model::constraint::Implementation::OrgPolicyConstraint(v) => {
1960                std::option::Option::Some(v)
1961            }
1962            _ => std::option::Option::None,
1963        })
1964    }
1965
1966    /// Sets the value of [implementation][crate::model::Constraint::implementation]
1967    /// to hold a `OrgPolicyConstraint`.
1968    ///
1969    /// Note that all the setters affecting `implementation` are
1970    /// mutually exclusive.
1971    ///
1972    /// # Example
1973    /// ```ignore,no_run
1974    /// # use google_cloud_securityposture_v1::model::Constraint;
1975    /// use google_cloud_securityposture_v1::model::OrgPolicyConstraint;
1976    /// let x = Constraint::new().set_org_policy_constraint(OrgPolicyConstraint::default()/* use setters */);
1977    /// assert!(x.org_policy_constraint().is_some());
1978    /// assert!(x.security_health_analytics_module().is_none());
1979    /// assert!(x.security_health_analytics_custom_module().is_none());
1980    /// assert!(x.org_policy_constraint_custom().is_none());
1981    /// ```
1982    pub fn set_org_policy_constraint<
1983        T: std::convert::Into<std::boxed::Box<crate::model::OrgPolicyConstraint>>,
1984    >(
1985        mut self,
1986        v: T,
1987    ) -> Self {
1988        self.implementation = std::option::Option::Some(
1989            crate::model::constraint::Implementation::OrgPolicyConstraint(v.into()),
1990        );
1991        self
1992    }
1993
1994    /// The value of [implementation][crate::model::Constraint::implementation]
1995    /// if it holds a `OrgPolicyConstraintCustom`, `None` if the field is not set or
1996    /// holds a different branch.
1997    pub fn org_policy_constraint_custom(
1998        &self,
1999    ) -> std::option::Option<&std::boxed::Box<crate::model::OrgPolicyConstraintCustom>> {
2000        #[allow(unreachable_patterns)]
2001        self.implementation.as_ref().and_then(|v| match v {
2002            crate::model::constraint::Implementation::OrgPolicyConstraintCustom(v) => {
2003                std::option::Option::Some(v)
2004            }
2005            _ => std::option::Option::None,
2006        })
2007    }
2008
2009    /// Sets the value of [implementation][crate::model::Constraint::implementation]
2010    /// to hold a `OrgPolicyConstraintCustom`.
2011    ///
2012    /// Note that all the setters affecting `implementation` are
2013    /// mutually exclusive.
2014    ///
2015    /// # Example
2016    /// ```ignore,no_run
2017    /// # use google_cloud_securityposture_v1::model::Constraint;
2018    /// use google_cloud_securityposture_v1::model::OrgPolicyConstraintCustom;
2019    /// let x = Constraint::new().set_org_policy_constraint_custom(OrgPolicyConstraintCustom::default()/* use setters */);
2020    /// assert!(x.org_policy_constraint_custom().is_some());
2021    /// assert!(x.security_health_analytics_module().is_none());
2022    /// assert!(x.security_health_analytics_custom_module().is_none());
2023    /// assert!(x.org_policy_constraint().is_none());
2024    /// ```
2025    pub fn set_org_policy_constraint_custom<
2026        T: std::convert::Into<std::boxed::Box<crate::model::OrgPolicyConstraintCustom>>,
2027    >(
2028        mut self,
2029        v: T,
2030    ) -> Self {
2031        self.implementation = std::option::Option::Some(
2032            crate::model::constraint::Implementation::OrgPolicyConstraintCustom(v.into()),
2033        );
2034        self
2035    }
2036}
2037
2038impl wkt::message::Message for Constraint {
2039    fn typename() -> &'static str {
2040        "type.googleapis.com/google.cloud.securityposture.v1.Constraint"
2041    }
2042}
2043
2044/// Defines additional types related to [Constraint].
2045pub mod constraint {
2046    #[allow(unused_imports)]
2047    use super::*;
2048
2049    #[allow(missing_docs)]
2050    #[derive(Clone, Debug, PartialEq)]
2051    #[non_exhaustive]
2052    pub enum Implementation {
2053        /// Optional. SHA built-in detector.
2054        SecurityHealthAnalyticsModule(std::boxed::Box<crate::model::SecurityHealthAnalyticsModule>),
2055        /// Optional. SHA custom detector.
2056        SecurityHealthAnalyticsCustomModule(
2057            std::boxed::Box<crate::model::SecurityHealthAnalyticsCustomModule>,
2058        ),
2059        /// Optional. Org Policy builtin constraint.
2060        OrgPolicyConstraint(std::boxed::Box<crate::model::OrgPolicyConstraint>),
2061        /// Optional. Org Policy custom constraint.
2062        OrgPolicyConstraintCustom(std::boxed::Box<crate::model::OrgPolicyConstraintCustom>),
2063    }
2064}
2065
2066/// Message for requesting list of Postures.
2067#[derive(Clone, Default, PartialEq)]
2068#[non_exhaustive]
2069pub struct ListPosturesRequest {
2070    /// Required. Parent value for ListPosturesRequest.
2071    pub parent: std::string::String,
2072
2073    /// Requested page size. Server may return fewer items than requested.
2074    /// If unspecified, server will pick an appropriate default.
2075    pub page_size: i32,
2076
2077    /// A token identifying a page of results the server should return.
2078    pub page_token: std::string::String,
2079
2080    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2081}
2082
2083impl ListPosturesRequest {
2084    /// Creates a new default instance.
2085    pub fn new() -> Self {
2086        std::default::Default::default()
2087    }
2088
2089    /// Sets the value of [parent][crate::model::ListPosturesRequest::parent].
2090    ///
2091    /// # Example
2092    /// ```ignore,no_run
2093    /// # use google_cloud_securityposture_v1::model::ListPosturesRequest;
2094    /// # let organization_id = "organization_id";
2095    /// # let location_id = "location_id";
2096    /// let x = ListPosturesRequest::new().set_parent(format!("organizations/{organization_id}/locations/{location_id}"));
2097    /// ```
2098    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2099        self.parent = v.into();
2100        self
2101    }
2102
2103    /// Sets the value of [page_size][crate::model::ListPosturesRequest::page_size].
2104    ///
2105    /// # Example
2106    /// ```ignore,no_run
2107    /// # use google_cloud_securityposture_v1::model::ListPosturesRequest;
2108    /// let x = ListPosturesRequest::new().set_page_size(42);
2109    /// ```
2110    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2111        self.page_size = v.into();
2112        self
2113    }
2114
2115    /// Sets the value of [page_token][crate::model::ListPosturesRequest::page_token].
2116    ///
2117    /// # Example
2118    /// ```ignore,no_run
2119    /// # use google_cloud_securityposture_v1::model::ListPosturesRequest;
2120    /// let x = ListPosturesRequest::new().set_page_token("example");
2121    /// ```
2122    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2123        self.page_token = v.into();
2124        self
2125    }
2126}
2127
2128impl wkt::message::Message for ListPosturesRequest {
2129    fn typename() -> &'static str {
2130        "type.googleapis.com/google.cloud.securityposture.v1.ListPosturesRequest"
2131    }
2132}
2133
2134/// Message for response to listing Postures.
2135#[derive(Clone, Default, PartialEq)]
2136#[non_exhaustive]
2137pub struct ListPosturesResponse {
2138    /// The list of Posture.
2139    pub postures: std::vec::Vec<crate::model::Posture>,
2140
2141    /// A token identifying a page of results the server should return.
2142    pub next_page_token: std::string::String,
2143
2144    /// Unreachable resources.
2145    pub unreachable: std::vec::Vec<std::string::String>,
2146
2147    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2148}
2149
2150impl ListPosturesResponse {
2151    /// Creates a new default instance.
2152    pub fn new() -> Self {
2153        std::default::Default::default()
2154    }
2155
2156    /// Sets the value of [postures][crate::model::ListPosturesResponse::postures].
2157    ///
2158    /// # Example
2159    /// ```ignore,no_run
2160    /// # use google_cloud_securityposture_v1::model::ListPosturesResponse;
2161    /// use google_cloud_securityposture_v1::model::Posture;
2162    /// let x = ListPosturesResponse::new()
2163    ///     .set_postures([
2164    ///         Posture::default()/* use setters */,
2165    ///         Posture::default()/* use (different) setters */,
2166    ///     ]);
2167    /// ```
2168    pub fn set_postures<T, V>(mut self, v: T) -> Self
2169    where
2170        T: std::iter::IntoIterator<Item = V>,
2171        V: std::convert::Into<crate::model::Posture>,
2172    {
2173        use std::iter::Iterator;
2174        self.postures = v.into_iter().map(|i| i.into()).collect();
2175        self
2176    }
2177
2178    /// Sets the value of [next_page_token][crate::model::ListPosturesResponse::next_page_token].
2179    ///
2180    /// # Example
2181    /// ```ignore,no_run
2182    /// # use google_cloud_securityposture_v1::model::ListPosturesResponse;
2183    /// let x = ListPosturesResponse::new().set_next_page_token("example");
2184    /// ```
2185    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2186        self.next_page_token = v.into();
2187        self
2188    }
2189
2190    /// Sets the value of [unreachable][crate::model::ListPosturesResponse::unreachable].
2191    ///
2192    /// # Example
2193    /// ```ignore,no_run
2194    /// # use google_cloud_securityposture_v1::model::ListPosturesResponse;
2195    /// let x = ListPosturesResponse::new().set_unreachable(["a", "b", "c"]);
2196    /// ```
2197    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
2198    where
2199        T: std::iter::IntoIterator<Item = V>,
2200        V: std::convert::Into<std::string::String>,
2201    {
2202        use std::iter::Iterator;
2203        self.unreachable = v.into_iter().map(|i| i.into()).collect();
2204        self
2205    }
2206}
2207
2208impl wkt::message::Message for ListPosturesResponse {
2209    fn typename() -> &'static str {
2210        "type.googleapis.com/google.cloud.securityposture.v1.ListPosturesResponse"
2211    }
2212}
2213
2214#[doc(hidden)]
2215impl google_cloud_gax::paginator::internal::PageableResponse for ListPosturesResponse {
2216    type PageItem = crate::model::Posture;
2217
2218    fn items(self) -> std::vec::Vec<Self::PageItem> {
2219        self.postures
2220    }
2221
2222    fn next_page_token(&self) -> std::string::String {
2223        use std::clone::Clone;
2224        self.next_page_token.clone()
2225    }
2226}
2227
2228/// Message for requesting list of Posture revisions.
2229#[derive(Clone, Default, PartialEq)]
2230#[non_exhaustive]
2231pub struct ListPostureRevisionsRequest {
2232    /// Required. Name value for ListPostureRevisionsRequest.
2233    pub name: std::string::String,
2234
2235    /// Optional. Requested page size. Server may return fewer items than
2236    /// requested. If unspecified, server will pick 100 as default.
2237    pub page_size: i32,
2238
2239    /// Optional. A token identifying a page of results the server should return.
2240    pub page_token: std::string::String,
2241
2242    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2243}
2244
2245impl ListPostureRevisionsRequest {
2246    /// Creates a new default instance.
2247    pub fn new() -> Self {
2248        std::default::Default::default()
2249    }
2250
2251    /// Sets the value of [name][crate::model::ListPostureRevisionsRequest::name].
2252    ///
2253    /// # Example
2254    /// ```ignore,no_run
2255    /// # use google_cloud_securityposture_v1::model::ListPostureRevisionsRequest;
2256    /// # let organization_id = "organization_id";
2257    /// # let location_id = "location_id";
2258    /// # let posture_id = "posture_id";
2259    /// let x = ListPostureRevisionsRequest::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postures/{posture_id}"));
2260    /// ```
2261    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2262        self.name = v.into();
2263        self
2264    }
2265
2266    /// Sets the value of [page_size][crate::model::ListPostureRevisionsRequest::page_size].
2267    ///
2268    /// # Example
2269    /// ```ignore,no_run
2270    /// # use google_cloud_securityposture_v1::model::ListPostureRevisionsRequest;
2271    /// let x = ListPostureRevisionsRequest::new().set_page_size(42);
2272    /// ```
2273    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2274        self.page_size = v.into();
2275        self
2276    }
2277
2278    /// Sets the value of [page_token][crate::model::ListPostureRevisionsRequest::page_token].
2279    ///
2280    /// # Example
2281    /// ```ignore,no_run
2282    /// # use google_cloud_securityposture_v1::model::ListPostureRevisionsRequest;
2283    /// let x = ListPostureRevisionsRequest::new().set_page_token("example");
2284    /// ```
2285    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2286        self.page_token = v.into();
2287        self
2288    }
2289}
2290
2291impl wkt::message::Message for ListPostureRevisionsRequest {
2292    fn typename() -> &'static str {
2293        "type.googleapis.com/google.cloud.securityposture.v1.ListPostureRevisionsRequest"
2294    }
2295}
2296
2297/// Message for response to listing PostureRevisions.
2298#[derive(Clone, Default, PartialEq)]
2299#[non_exhaustive]
2300pub struct ListPostureRevisionsResponse {
2301    /// The list of Posture revisions.
2302    pub revisions: std::vec::Vec<crate::model::Posture>,
2303
2304    /// A token identifying a page of results the server should return.
2305    pub next_page_token: std::string::String,
2306
2307    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2308}
2309
2310impl ListPostureRevisionsResponse {
2311    /// Creates a new default instance.
2312    pub fn new() -> Self {
2313        std::default::Default::default()
2314    }
2315
2316    /// Sets the value of [revisions][crate::model::ListPostureRevisionsResponse::revisions].
2317    ///
2318    /// # Example
2319    /// ```ignore,no_run
2320    /// # use google_cloud_securityposture_v1::model::ListPostureRevisionsResponse;
2321    /// use google_cloud_securityposture_v1::model::Posture;
2322    /// let x = ListPostureRevisionsResponse::new()
2323    ///     .set_revisions([
2324    ///         Posture::default()/* use setters */,
2325    ///         Posture::default()/* use (different) setters */,
2326    ///     ]);
2327    /// ```
2328    pub fn set_revisions<T, V>(mut self, v: T) -> Self
2329    where
2330        T: std::iter::IntoIterator<Item = V>,
2331        V: std::convert::Into<crate::model::Posture>,
2332    {
2333        use std::iter::Iterator;
2334        self.revisions = v.into_iter().map(|i| i.into()).collect();
2335        self
2336    }
2337
2338    /// Sets the value of [next_page_token][crate::model::ListPostureRevisionsResponse::next_page_token].
2339    ///
2340    /// # Example
2341    /// ```ignore,no_run
2342    /// # use google_cloud_securityposture_v1::model::ListPostureRevisionsResponse;
2343    /// let x = ListPostureRevisionsResponse::new().set_next_page_token("example");
2344    /// ```
2345    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2346        self.next_page_token = v.into();
2347        self
2348    }
2349}
2350
2351impl wkt::message::Message for ListPostureRevisionsResponse {
2352    fn typename() -> &'static str {
2353        "type.googleapis.com/google.cloud.securityposture.v1.ListPostureRevisionsResponse"
2354    }
2355}
2356
2357#[doc(hidden)]
2358impl google_cloud_gax::paginator::internal::PageableResponse for ListPostureRevisionsResponse {
2359    type PageItem = crate::model::Posture;
2360
2361    fn items(self) -> std::vec::Vec<Self::PageItem> {
2362        self.revisions
2363    }
2364
2365    fn next_page_token(&self) -> std::string::String {
2366        use std::clone::Clone;
2367        self.next_page_token.clone()
2368    }
2369}
2370
2371/// Message for getting a Posture.
2372#[derive(Clone, Default, PartialEq)]
2373#[non_exhaustive]
2374pub struct GetPostureRequest {
2375    /// Required. Name of the resource.
2376    pub name: std::string::String,
2377
2378    /// Optional. Posture revision which needs to be retrieved.
2379    pub revision_id: std::string::String,
2380
2381    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2382}
2383
2384impl GetPostureRequest {
2385    /// Creates a new default instance.
2386    pub fn new() -> Self {
2387        std::default::Default::default()
2388    }
2389
2390    /// Sets the value of [name][crate::model::GetPostureRequest::name].
2391    ///
2392    /// # Example
2393    /// ```ignore,no_run
2394    /// # use google_cloud_securityposture_v1::model::GetPostureRequest;
2395    /// # let organization_id = "organization_id";
2396    /// # let location_id = "location_id";
2397    /// # let posture_id = "posture_id";
2398    /// let x = GetPostureRequest::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postures/{posture_id}"));
2399    /// ```
2400    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2401        self.name = v.into();
2402        self
2403    }
2404
2405    /// Sets the value of [revision_id][crate::model::GetPostureRequest::revision_id].
2406    ///
2407    /// # Example
2408    /// ```ignore,no_run
2409    /// # use google_cloud_securityposture_v1::model::GetPostureRequest;
2410    /// let x = GetPostureRequest::new().set_revision_id("example");
2411    /// ```
2412    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2413        self.revision_id = v.into();
2414        self
2415    }
2416}
2417
2418impl wkt::message::Message for GetPostureRequest {
2419    fn typename() -> &'static str {
2420        "type.googleapis.com/google.cloud.securityposture.v1.GetPostureRequest"
2421    }
2422}
2423
2424/// Message for creating a Posture.
2425#[derive(Clone, Default, PartialEq)]
2426#[non_exhaustive]
2427pub struct CreatePostureRequest {
2428    /// Required. Value for parent.
2429    pub parent: std::string::String,
2430
2431    /// Required. User provided identifier. It should be unique in scope of an
2432    /// Organization and location.
2433    pub posture_id: std::string::String,
2434
2435    /// Required. The resource being created.
2436    pub posture: std::option::Option<crate::model::Posture>,
2437
2438    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2439}
2440
2441impl CreatePostureRequest {
2442    /// Creates a new default instance.
2443    pub fn new() -> Self {
2444        std::default::Default::default()
2445    }
2446
2447    /// Sets the value of [parent][crate::model::CreatePostureRequest::parent].
2448    ///
2449    /// # Example
2450    /// ```ignore,no_run
2451    /// # use google_cloud_securityposture_v1::model::CreatePostureRequest;
2452    /// # let organization_id = "organization_id";
2453    /// # let location_id = "location_id";
2454    /// let x = CreatePostureRequest::new().set_parent(format!("organizations/{organization_id}/locations/{location_id}"));
2455    /// ```
2456    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2457        self.parent = v.into();
2458        self
2459    }
2460
2461    /// Sets the value of [posture_id][crate::model::CreatePostureRequest::posture_id].
2462    ///
2463    /// # Example
2464    /// ```ignore,no_run
2465    /// # use google_cloud_securityposture_v1::model::CreatePostureRequest;
2466    /// let x = CreatePostureRequest::new().set_posture_id("example");
2467    /// ```
2468    pub fn set_posture_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2469        self.posture_id = v.into();
2470        self
2471    }
2472
2473    /// Sets the value of [posture][crate::model::CreatePostureRequest::posture].
2474    ///
2475    /// # Example
2476    /// ```ignore,no_run
2477    /// # use google_cloud_securityposture_v1::model::CreatePostureRequest;
2478    /// use google_cloud_securityposture_v1::model::Posture;
2479    /// let x = CreatePostureRequest::new().set_posture(Posture::default()/* use setters */);
2480    /// ```
2481    pub fn set_posture<T>(mut self, v: T) -> Self
2482    where
2483        T: std::convert::Into<crate::model::Posture>,
2484    {
2485        self.posture = std::option::Option::Some(v.into());
2486        self
2487    }
2488
2489    /// Sets or clears the value of [posture][crate::model::CreatePostureRequest::posture].
2490    ///
2491    /// # Example
2492    /// ```ignore,no_run
2493    /// # use google_cloud_securityposture_v1::model::CreatePostureRequest;
2494    /// use google_cloud_securityposture_v1::model::Posture;
2495    /// let x = CreatePostureRequest::new().set_or_clear_posture(Some(Posture::default()/* use setters */));
2496    /// let x = CreatePostureRequest::new().set_or_clear_posture(None::<Posture>);
2497    /// ```
2498    pub fn set_or_clear_posture<T>(mut self, v: std::option::Option<T>) -> Self
2499    where
2500        T: std::convert::Into<crate::model::Posture>,
2501    {
2502        self.posture = v.map(|x| x.into());
2503        self
2504    }
2505}
2506
2507impl wkt::message::Message for CreatePostureRequest {
2508    fn typename() -> &'static str {
2509        "type.googleapis.com/google.cloud.securityposture.v1.CreatePostureRequest"
2510    }
2511}
2512
2513/// Message for updating a Posture.
2514#[derive(Clone, Default, PartialEq)]
2515#[non_exhaustive]
2516pub struct UpdatePostureRequest {
2517    /// Required. Field mask is used to specify the fields to be overwritten in the
2518    /// Posture resource by the update.
2519    /// The fields specified in the update_mask are relative to the resource, not
2520    /// the full request. A field will be overwritten if it is in the mask. If the
2521    /// user does not provide a mask then all fields will be overwritten.
2522    pub update_mask: std::option::Option<wkt::FieldMask>,
2523
2524    /// Required. The resource being updated.
2525    pub posture: std::option::Option<crate::model::Posture>,
2526
2527    /// Required. Posture revision which needs to be updated.
2528    pub revision_id: std::string::String,
2529
2530    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2531}
2532
2533impl UpdatePostureRequest {
2534    /// Creates a new default instance.
2535    pub fn new() -> Self {
2536        std::default::Default::default()
2537    }
2538
2539    /// Sets the value of [update_mask][crate::model::UpdatePostureRequest::update_mask].
2540    ///
2541    /// # Example
2542    /// ```ignore,no_run
2543    /// # use google_cloud_securityposture_v1::model::UpdatePostureRequest;
2544    /// use wkt::FieldMask;
2545    /// let x = UpdatePostureRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2546    /// ```
2547    pub fn set_update_mask<T>(mut self, v: T) -> Self
2548    where
2549        T: std::convert::Into<wkt::FieldMask>,
2550    {
2551        self.update_mask = std::option::Option::Some(v.into());
2552        self
2553    }
2554
2555    /// Sets or clears the value of [update_mask][crate::model::UpdatePostureRequest::update_mask].
2556    ///
2557    /// # Example
2558    /// ```ignore,no_run
2559    /// # use google_cloud_securityposture_v1::model::UpdatePostureRequest;
2560    /// use wkt::FieldMask;
2561    /// let x = UpdatePostureRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2562    /// let x = UpdatePostureRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2563    /// ```
2564    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2565    where
2566        T: std::convert::Into<wkt::FieldMask>,
2567    {
2568        self.update_mask = v.map(|x| x.into());
2569        self
2570    }
2571
2572    /// Sets the value of [posture][crate::model::UpdatePostureRequest::posture].
2573    ///
2574    /// # Example
2575    /// ```ignore,no_run
2576    /// # use google_cloud_securityposture_v1::model::UpdatePostureRequest;
2577    /// use google_cloud_securityposture_v1::model::Posture;
2578    /// let x = UpdatePostureRequest::new().set_posture(Posture::default()/* use setters */);
2579    /// ```
2580    pub fn set_posture<T>(mut self, v: T) -> Self
2581    where
2582        T: std::convert::Into<crate::model::Posture>,
2583    {
2584        self.posture = std::option::Option::Some(v.into());
2585        self
2586    }
2587
2588    /// Sets or clears the value of [posture][crate::model::UpdatePostureRequest::posture].
2589    ///
2590    /// # Example
2591    /// ```ignore,no_run
2592    /// # use google_cloud_securityposture_v1::model::UpdatePostureRequest;
2593    /// use google_cloud_securityposture_v1::model::Posture;
2594    /// let x = UpdatePostureRequest::new().set_or_clear_posture(Some(Posture::default()/* use setters */));
2595    /// let x = UpdatePostureRequest::new().set_or_clear_posture(None::<Posture>);
2596    /// ```
2597    pub fn set_or_clear_posture<T>(mut self, v: std::option::Option<T>) -> Self
2598    where
2599        T: std::convert::Into<crate::model::Posture>,
2600    {
2601        self.posture = v.map(|x| x.into());
2602        self
2603    }
2604
2605    /// Sets the value of [revision_id][crate::model::UpdatePostureRequest::revision_id].
2606    ///
2607    /// # Example
2608    /// ```ignore,no_run
2609    /// # use google_cloud_securityposture_v1::model::UpdatePostureRequest;
2610    /// let x = UpdatePostureRequest::new().set_revision_id("example");
2611    /// ```
2612    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2613        self.revision_id = v.into();
2614        self
2615    }
2616}
2617
2618impl wkt::message::Message for UpdatePostureRequest {
2619    fn typename() -> &'static str {
2620        "type.googleapis.com/google.cloud.securityposture.v1.UpdatePostureRequest"
2621    }
2622}
2623
2624/// Message for deleting a Posture.
2625#[derive(Clone, Default, PartialEq)]
2626#[non_exhaustive]
2627pub struct DeletePostureRequest {
2628    /// Required. Name of the resource.
2629    pub name: std::string::String,
2630
2631    /// Optional. Etag value of the Posture to be deleted.
2632    pub etag: std::string::String,
2633
2634    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2635}
2636
2637impl DeletePostureRequest {
2638    /// Creates a new default instance.
2639    pub fn new() -> Self {
2640        std::default::Default::default()
2641    }
2642
2643    /// Sets the value of [name][crate::model::DeletePostureRequest::name].
2644    ///
2645    /// # Example
2646    /// ```ignore,no_run
2647    /// # use google_cloud_securityposture_v1::model::DeletePostureRequest;
2648    /// # let organization_id = "organization_id";
2649    /// # let location_id = "location_id";
2650    /// # let posture_id = "posture_id";
2651    /// let x = DeletePostureRequest::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postures/{posture_id}"));
2652    /// ```
2653    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2654        self.name = v.into();
2655        self
2656    }
2657
2658    /// Sets the value of [etag][crate::model::DeletePostureRequest::etag].
2659    ///
2660    /// # Example
2661    /// ```ignore,no_run
2662    /// # use google_cloud_securityposture_v1::model::DeletePostureRequest;
2663    /// let x = DeletePostureRequest::new().set_etag("example");
2664    /// ```
2665    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2666        self.etag = v.into();
2667        self
2668    }
2669}
2670
2671impl wkt::message::Message for DeletePostureRequest {
2672    fn typename() -> &'static str {
2673        "type.googleapis.com/google.cloud.securityposture.v1.DeletePostureRequest"
2674    }
2675}
2676
2677/// Message for extracting existing policies on a workload as a Posture.
2678#[derive(Clone, Default, PartialEq)]
2679#[non_exhaustive]
2680pub struct ExtractPostureRequest {
2681    /// Required. The parent resource name. The format of this value is as follows:
2682    /// `organizations/{organization}/locations/{location}`
2683    pub parent: std::string::String,
2684
2685    /// Required. User provided identifier. It should be unique in scope of an
2686    /// Organization and location.
2687    pub posture_id: std::string::String,
2688
2689    /// Required. Workload from which the policies are to be extracted, it should
2690    /// belong to the same organization defined in parent. The format of this value
2691    /// varies depending on the scope of the request:
2692    ///
2693    /// - `folder/folderNumber`
2694    /// - `project/projectNumber`
2695    /// - `organization/organizationNumber`
2696    pub workload: std::string::String,
2697
2698    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2699}
2700
2701impl ExtractPostureRequest {
2702    /// Creates a new default instance.
2703    pub fn new() -> Self {
2704        std::default::Default::default()
2705    }
2706
2707    /// Sets the value of [parent][crate::model::ExtractPostureRequest::parent].
2708    ///
2709    /// # Example
2710    /// ```ignore,no_run
2711    /// # use google_cloud_securityposture_v1::model::ExtractPostureRequest;
2712    /// # let organization_id = "organization_id";
2713    /// # let location_id = "location_id";
2714    /// let x = ExtractPostureRequest::new().set_parent(format!("organizations/{organization_id}/locations/{location_id}"));
2715    /// ```
2716    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2717        self.parent = v.into();
2718        self
2719    }
2720
2721    /// Sets the value of [posture_id][crate::model::ExtractPostureRequest::posture_id].
2722    ///
2723    /// # Example
2724    /// ```ignore,no_run
2725    /// # use google_cloud_securityposture_v1::model::ExtractPostureRequest;
2726    /// let x = ExtractPostureRequest::new().set_posture_id("example");
2727    /// ```
2728    pub fn set_posture_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2729        self.posture_id = v.into();
2730        self
2731    }
2732
2733    /// Sets the value of [workload][crate::model::ExtractPostureRequest::workload].
2734    ///
2735    /// # Example
2736    /// ```ignore,no_run
2737    /// # use google_cloud_securityposture_v1::model::ExtractPostureRequest;
2738    /// let x = ExtractPostureRequest::new().set_workload("example");
2739    /// ```
2740    pub fn set_workload<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2741        self.workload = v.into();
2742        self
2743    }
2744}
2745
2746impl wkt::message::Message for ExtractPostureRequest {
2747    fn typename() -> &'static str {
2748        "type.googleapis.com/google.cloud.securityposture.v1.ExtractPostureRequest"
2749    }
2750}
2751
2752/// ========================== PostureDeployments ==========================
2753/// Message describing PostureDeployment resource.
2754#[derive(Clone, Default, PartialEq)]
2755#[non_exhaustive]
2756pub struct PostureDeployment {
2757    /// Required. The name of this PostureDeployment resource, in the format of
2758    /// organizations/{organization}/locations/{location_id}/postureDeployments/{postureDeployment}.
2759    pub name: std::string::String,
2760
2761    /// Required. Target resource where the Posture will be deployed. Currently
2762    /// supported resources are of types: projects/projectNumber,
2763    /// folders/folderNumber, organizations/organizationNumber.
2764    pub target_resource: std::string::String,
2765
2766    /// Output only. State of PostureDeployment resource.
2767    pub state: crate::model::posture_deployment::State,
2768
2769    /// Required. Posture that needs to be deployed.
2770    /// Format:
2771    /// organizations/{org_id}/locations/{location_id}/postures/\<posture\>
2772    /// Example:
2773    /// organizations/99/locations/global/postures/les-miserables.
2774    pub posture_id: std::string::String,
2775
2776    /// Required. Revision_id of the Posture that is to be deployed.
2777    pub posture_revision_id: std::string::String,
2778
2779    /// Output only. The timestamp that the PostureDeployment was created.
2780    pub create_time: std::option::Option<wkt::Timestamp>,
2781
2782    /// Output only. The timestamp that the PostureDeployment was updated.
2783    pub update_time: std::option::Option<wkt::Timestamp>,
2784
2785    /// Optional. User provided description of the PostureDeployment.
2786    pub description: std::string::String,
2787
2788    /// Optional. An opaque tag indicating the current version of the
2789    /// PostureDeployment, used for concurrency control. When the
2790    /// `PostureDeployment` is returned from either a `GetPostureDeployment` or a
2791    /// `ListPostureDeployments` request, this `etag` indicates the version of the
2792    /// current `PostureDeployment` to use when executing a read-modify-write loop.
2793    ///
2794    /// When the `PostureDeployment` is used in a `UpdatePostureDeployment` method,
2795    /// use the `etag` value that was returned from a `GetPostureDeployment`
2796    /// request as part of a read-modify-write loop for concurrency control. Not
2797    /// setting the `etag` in a `UpdatePostureDeployment` request will result in an
2798    /// unconditional write of the `PostureDeployment`.
2799    pub etag: std::string::String,
2800
2801    /// Optional. User annotations. These attributes can only be set and used by
2802    /// the user, and not by Google Security Postures.
2803    /// .
2804    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
2805
2806    /// Output only. Whether or not this Posture is in the process of being
2807    /// updated.
2808    pub reconciling: bool,
2809
2810    /// Output only. This is a output only optional field which will be filled in
2811    /// case where PostureDeployment state is UPDATE_FAILED or CREATE_FAILED or
2812    /// DELETE_FAILED. It denotes the desired Posture.
2813    pub desired_posture_id: std::string::String,
2814
2815    /// Output only. Output only optional field which provides revision_id of the
2816    /// desired_posture_id.
2817    pub desired_posture_revision_id: std::string::String,
2818
2819    /// Output only. This is a output only optional field which will be filled in
2820    /// case where PostureDeployment enters a failure state like UPDATE_FAILED or
2821    /// CREATE_FAILED or DELETE_FAILED.
2822    pub failure_message: std::string::String,
2823
2824    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2825}
2826
2827impl PostureDeployment {
2828    /// Creates a new default instance.
2829    pub fn new() -> Self {
2830        std::default::Default::default()
2831    }
2832
2833    /// Sets the value of [name][crate::model::PostureDeployment::name].
2834    ///
2835    /// # Example
2836    /// ```ignore,no_run
2837    /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2838    /// # let organization_id = "organization_id";
2839    /// # let location_id = "location_id";
2840    /// # let posture_deployment_id = "posture_deployment_id";
2841    /// let x = PostureDeployment::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postureDeployments/{posture_deployment_id}"));
2842    /// ```
2843    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2844        self.name = v.into();
2845        self
2846    }
2847
2848    /// Sets the value of [target_resource][crate::model::PostureDeployment::target_resource].
2849    ///
2850    /// # Example
2851    /// ```ignore,no_run
2852    /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2853    /// let x = PostureDeployment::new().set_target_resource("example");
2854    /// ```
2855    pub fn set_target_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2856        self.target_resource = v.into();
2857        self
2858    }
2859
2860    /// Sets the value of [state][crate::model::PostureDeployment::state].
2861    ///
2862    /// # Example
2863    /// ```ignore,no_run
2864    /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2865    /// use google_cloud_securityposture_v1::model::posture_deployment::State;
2866    /// let x0 = PostureDeployment::new().set_state(State::Creating);
2867    /// let x1 = PostureDeployment::new().set_state(State::Deleting);
2868    /// let x2 = PostureDeployment::new().set_state(State::Updating);
2869    /// ```
2870    pub fn set_state<T: std::convert::Into<crate::model::posture_deployment::State>>(
2871        mut self,
2872        v: T,
2873    ) -> Self {
2874        self.state = v.into();
2875        self
2876    }
2877
2878    /// Sets the value of [posture_id][crate::model::PostureDeployment::posture_id].
2879    ///
2880    /// # Example
2881    /// ```ignore,no_run
2882    /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2883    /// let x = PostureDeployment::new().set_posture_id("example");
2884    /// ```
2885    pub fn set_posture_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2886        self.posture_id = v.into();
2887        self
2888    }
2889
2890    /// Sets the value of [posture_revision_id][crate::model::PostureDeployment::posture_revision_id].
2891    ///
2892    /// # Example
2893    /// ```ignore,no_run
2894    /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2895    /// let x = PostureDeployment::new().set_posture_revision_id("example");
2896    /// ```
2897    pub fn set_posture_revision_id<T: std::convert::Into<std::string::String>>(
2898        mut self,
2899        v: T,
2900    ) -> Self {
2901        self.posture_revision_id = v.into();
2902        self
2903    }
2904
2905    /// Sets the value of [create_time][crate::model::PostureDeployment::create_time].
2906    ///
2907    /// # Example
2908    /// ```ignore,no_run
2909    /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2910    /// use wkt::Timestamp;
2911    /// let x = PostureDeployment::new().set_create_time(Timestamp::default()/* use setters */);
2912    /// ```
2913    pub fn set_create_time<T>(mut self, v: T) -> Self
2914    where
2915        T: std::convert::Into<wkt::Timestamp>,
2916    {
2917        self.create_time = std::option::Option::Some(v.into());
2918        self
2919    }
2920
2921    /// Sets or clears the value of [create_time][crate::model::PostureDeployment::create_time].
2922    ///
2923    /// # Example
2924    /// ```ignore,no_run
2925    /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2926    /// use wkt::Timestamp;
2927    /// let x = PostureDeployment::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2928    /// let x = PostureDeployment::new().set_or_clear_create_time(None::<Timestamp>);
2929    /// ```
2930    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2931    where
2932        T: std::convert::Into<wkt::Timestamp>,
2933    {
2934        self.create_time = v.map(|x| x.into());
2935        self
2936    }
2937
2938    /// Sets the value of [update_time][crate::model::PostureDeployment::update_time].
2939    ///
2940    /// # Example
2941    /// ```ignore,no_run
2942    /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2943    /// use wkt::Timestamp;
2944    /// let x = PostureDeployment::new().set_update_time(Timestamp::default()/* use setters */);
2945    /// ```
2946    pub fn set_update_time<T>(mut self, v: T) -> Self
2947    where
2948        T: std::convert::Into<wkt::Timestamp>,
2949    {
2950        self.update_time = std::option::Option::Some(v.into());
2951        self
2952    }
2953
2954    /// Sets or clears the value of [update_time][crate::model::PostureDeployment::update_time].
2955    ///
2956    /// # Example
2957    /// ```ignore,no_run
2958    /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2959    /// use wkt::Timestamp;
2960    /// let x = PostureDeployment::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2961    /// let x = PostureDeployment::new().set_or_clear_update_time(None::<Timestamp>);
2962    /// ```
2963    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2964    where
2965        T: std::convert::Into<wkt::Timestamp>,
2966    {
2967        self.update_time = v.map(|x| x.into());
2968        self
2969    }
2970
2971    /// Sets the value of [description][crate::model::PostureDeployment::description].
2972    ///
2973    /// # Example
2974    /// ```ignore,no_run
2975    /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2976    /// let x = PostureDeployment::new().set_description("example");
2977    /// ```
2978    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2979        self.description = v.into();
2980        self
2981    }
2982
2983    /// Sets the value of [etag][crate::model::PostureDeployment::etag].
2984    ///
2985    /// # Example
2986    /// ```ignore,no_run
2987    /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2988    /// let x = PostureDeployment::new().set_etag("example");
2989    /// ```
2990    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2991        self.etag = v.into();
2992        self
2993    }
2994
2995    /// Sets the value of [annotations][crate::model::PostureDeployment::annotations].
2996    ///
2997    /// # Example
2998    /// ```ignore,no_run
2999    /// # use google_cloud_securityposture_v1::model::PostureDeployment;
3000    /// let x = PostureDeployment::new().set_annotations([
3001    ///     ("key0", "abc"),
3002    ///     ("key1", "xyz"),
3003    /// ]);
3004    /// ```
3005    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
3006    where
3007        T: std::iter::IntoIterator<Item = (K, V)>,
3008        K: std::convert::Into<std::string::String>,
3009        V: std::convert::Into<std::string::String>,
3010    {
3011        use std::iter::Iterator;
3012        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3013        self
3014    }
3015
3016    /// Sets the value of [reconciling][crate::model::PostureDeployment::reconciling].
3017    ///
3018    /// # Example
3019    /// ```ignore,no_run
3020    /// # use google_cloud_securityposture_v1::model::PostureDeployment;
3021    /// let x = PostureDeployment::new().set_reconciling(true);
3022    /// ```
3023    pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3024        self.reconciling = v.into();
3025        self
3026    }
3027
3028    /// Sets the value of [desired_posture_id][crate::model::PostureDeployment::desired_posture_id].
3029    ///
3030    /// # Example
3031    /// ```ignore,no_run
3032    /// # use google_cloud_securityposture_v1::model::PostureDeployment;
3033    /// let x = PostureDeployment::new().set_desired_posture_id("example");
3034    /// ```
3035    pub fn set_desired_posture_id<T: std::convert::Into<std::string::String>>(
3036        mut self,
3037        v: T,
3038    ) -> Self {
3039        self.desired_posture_id = v.into();
3040        self
3041    }
3042
3043    /// Sets the value of [desired_posture_revision_id][crate::model::PostureDeployment::desired_posture_revision_id].
3044    ///
3045    /// # Example
3046    /// ```ignore,no_run
3047    /// # use google_cloud_securityposture_v1::model::PostureDeployment;
3048    /// let x = PostureDeployment::new().set_desired_posture_revision_id("example");
3049    /// ```
3050    pub fn set_desired_posture_revision_id<T: std::convert::Into<std::string::String>>(
3051        mut self,
3052        v: T,
3053    ) -> Self {
3054        self.desired_posture_revision_id = v.into();
3055        self
3056    }
3057
3058    /// Sets the value of [failure_message][crate::model::PostureDeployment::failure_message].
3059    ///
3060    /// # Example
3061    /// ```ignore,no_run
3062    /// # use google_cloud_securityposture_v1::model::PostureDeployment;
3063    /// let x = PostureDeployment::new().set_failure_message("example");
3064    /// ```
3065    pub fn set_failure_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3066        self.failure_message = v.into();
3067        self
3068    }
3069}
3070
3071impl wkt::message::Message for PostureDeployment {
3072    fn typename() -> &'static str {
3073        "type.googleapis.com/google.cloud.securityposture.v1.PostureDeployment"
3074    }
3075}
3076
3077/// Defines additional types related to [PostureDeployment].
3078pub mod posture_deployment {
3079    #[allow(unused_imports)]
3080    use super::*;
3081
3082    /// State of a PostureDeployment.
3083    ///
3084    /// # Working with unknown values
3085    ///
3086    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3087    /// additional enum variants at any time. Adding new variants is not considered
3088    /// a breaking change. Applications should write their code in anticipation of:
3089    ///
3090    /// - New values appearing in future releases of the client library, **and**
3091    /// - New values received dynamically, without application changes.
3092    ///
3093    /// Please consult the [Working with enums] section in the user guide for some
3094    /// guidelines.
3095    ///
3096    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3097    #[derive(Clone, Debug, PartialEq)]
3098    #[non_exhaustive]
3099    pub enum State {
3100        /// Unspecified operation state.
3101        Unspecified,
3102        /// The PostureDeployment is being created.
3103        Creating,
3104        /// The PostureDeployment is being deleted.
3105        Deleting,
3106        /// The PostureDeployment state is being updated.
3107        Updating,
3108        /// The PostureDeployment state is active and in use.
3109        Active,
3110        /// The PostureDeployment creation failed.
3111        CreateFailed,
3112        /// The PostureDeployment update failed.
3113        UpdateFailed,
3114        /// The PostureDeployment deletion failed.
3115        DeleteFailed,
3116        /// If set, the enum was initialized with an unknown value.
3117        ///
3118        /// Applications can examine the value using [State::value] or
3119        /// [State::name].
3120        UnknownValue(state::UnknownValue),
3121    }
3122
3123    #[doc(hidden)]
3124    pub mod state {
3125        #[allow(unused_imports)]
3126        use super::*;
3127        #[derive(Clone, Debug, PartialEq)]
3128        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3129    }
3130
3131    impl State {
3132        /// Gets the enum value.
3133        ///
3134        /// Returns `None` if the enum contains an unknown value deserialized from
3135        /// the string representation of enums.
3136        pub fn value(&self) -> std::option::Option<i32> {
3137            match self {
3138                Self::Unspecified => std::option::Option::Some(0),
3139                Self::Creating => std::option::Option::Some(1),
3140                Self::Deleting => std::option::Option::Some(2),
3141                Self::Updating => std::option::Option::Some(3),
3142                Self::Active => std::option::Option::Some(4),
3143                Self::CreateFailed => std::option::Option::Some(5),
3144                Self::UpdateFailed => std::option::Option::Some(6),
3145                Self::DeleteFailed => std::option::Option::Some(7),
3146                Self::UnknownValue(u) => u.0.value(),
3147            }
3148        }
3149
3150        /// Gets the enum value as a string.
3151        ///
3152        /// Returns `None` if the enum contains an unknown value deserialized from
3153        /// the integer representation of enums.
3154        pub fn name(&self) -> std::option::Option<&str> {
3155            match self {
3156                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3157                Self::Creating => std::option::Option::Some("CREATING"),
3158                Self::Deleting => std::option::Option::Some("DELETING"),
3159                Self::Updating => std::option::Option::Some("UPDATING"),
3160                Self::Active => std::option::Option::Some("ACTIVE"),
3161                Self::CreateFailed => std::option::Option::Some("CREATE_FAILED"),
3162                Self::UpdateFailed => std::option::Option::Some("UPDATE_FAILED"),
3163                Self::DeleteFailed => std::option::Option::Some("DELETE_FAILED"),
3164                Self::UnknownValue(u) => u.0.name(),
3165            }
3166        }
3167    }
3168
3169    impl std::default::Default for State {
3170        fn default() -> Self {
3171            use std::convert::From;
3172            Self::from(0)
3173        }
3174    }
3175
3176    impl std::fmt::Display for State {
3177        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3178            wkt::internal::display_enum(f, self.name(), self.value())
3179        }
3180    }
3181
3182    impl std::convert::From<i32> for State {
3183        fn from(value: i32) -> Self {
3184            match value {
3185                0 => Self::Unspecified,
3186                1 => Self::Creating,
3187                2 => Self::Deleting,
3188                3 => Self::Updating,
3189                4 => Self::Active,
3190                5 => Self::CreateFailed,
3191                6 => Self::UpdateFailed,
3192                7 => Self::DeleteFailed,
3193                _ => Self::UnknownValue(state::UnknownValue(
3194                    wkt::internal::UnknownEnumValue::Integer(value),
3195                )),
3196            }
3197        }
3198    }
3199
3200    impl std::convert::From<&str> for State {
3201        fn from(value: &str) -> Self {
3202            use std::string::ToString;
3203            match value {
3204                "STATE_UNSPECIFIED" => Self::Unspecified,
3205                "CREATING" => Self::Creating,
3206                "DELETING" => Self::Deleting,
3207                "UPDATING" => Self::Updating,
3208                "ACTIVE" => Self::Active,
3209                "CREATE_FAILED" => Self::CreateFailed,
3210                "UPDATE_FAILED" => Self::UpdateFailed,
3211                "DELETE_FAILED" => Self::DeleteFailed,
3212                _ => Self::UnknownValue(state::UnknownValue(
3213                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3214                )),
3215            }
3216        }
3217    }
3218
3219    impl serde::ser::Serialize for State {
3220        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3221        where
3222            S: serde::Serializer,
3223        {
3224            match self {
3225                Self::Unspecified => serializer.serialize_i32(0),
3226                Self::Creating => serializer.serialize_i32(1),
3227                Self::Deleting => serializer.serialize_i32(2),
3228                Self::Updating => serializer.serialize_i32(3),
3229                Self::Active => serializer.serialize_i32(4),
3230                Self::CreateFailed => serializer.serialize_i32(5),
3231                Self::UpdateFailed => serializer.serialize_i32(6),
3232                Self::DeleteFailed => serializer.serialize_i32(7),
3233                Self::UnknownValue(u) => u.0.serialize(serializer),
3234            }
3235        }
3236    }
3237
3238    impl<'de> serde::de::Deserialize<'de> for State {
3239        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3240        where
3241            D: serde::Deserializer<'de>,
3242        {
3243            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3244                ".google.cloud.securityposture.v1.PostureDeployment.State",
3245            ))
3246        }
3247    }
3248}
3249
3250/// Message for requesting list of PostureDeployments.
3251#[derive(Clone, Default, PartialEq)]
3252#[non_exhaustive]
3253pub struct ListPostureDeploymentsRequest {
3254    /// Required. Parent value for ListPostureDeploymentsRequest.
3255    pub parent: std::string::String,
3256
3257    /// Optional. Requested page size. Server may return fewer items than
3258    /// requested. If unspecified, server will pick an appropriate default.
3259    pub page_size: i32,
3260
3261    /// Optional. A token identifying a page of results the server should return.
3262    pub page_token: std::string::String,
3263
3264    /// Optional. Filter to be applied on the resource, defined by EBNF grammar
3265    /// <https://google.aip.dev/assets/misc/ebnf-filtering.txt>.
3266    pub filter: std::string::String,
3267
3268    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3269}
3270
3271impl ListPostureDeploymentsRequest {
3272    /// Creates a new default instance.
3273    pub fn new() -> Self {
3274        std::default::Default::default()
3275    }
3276
3277    /// Sets the value of [parent][crate::model::ListPostureDeploymentsRequest::parent].
3278    ///
3279    /// # Example
3280    /// ```ignore,no_run
3281    /// # use google_cloud_securityposture_v1::model::ListPostureDeploymentsRequest;
3282    /// # let organization_id = "organization_id";
3283    /// # let location_id = "location_id";
3284    /// let x = ListPostureDeploymentsRequest::new().set_parent(format!("organizations/{organization_id}/locations/{location_id}"));
3285    /// ```
3286    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3287        self.parent = v.into();
3288        self
3289    }
3290
3291    /// Sets the value of [page_size][crate::model::ListPostureDeploymentsRequest::page_size].
3292    ///
3293    /// # Example
3294    /// ```ignore,no_run
3295    /// # use google_cloud_securityposture_v1::model::ListPostureDeploymentsRequest;
3296    /// let x = ListPostureDeploymentsRequest::new().set_page_size(42);
3297    /// ```
3298    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3299        self.page_size = v.into();
3300        self
3301    }
3302
3303    /// Sets the value of [page_token][crate::model::ListPostureDeploymentsRequest::page_token].
3304    ///
3305    /// # Example
3306    /// ```ignore,no_run
3307    /// # use google_cloud_securityposture_v1::model::ListPostureDeploymentsRequest;
3308    /// let x = ListPostureDeploymentsRequest::new().set_page_token("example");
3309    /// ```
3310    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3311        self.page_token = v.into();
3312        self
3313    }
3314
3315    /// Sets the value of [filter][crate::model::ListPostureDeploymentsRequest::filter].
3316    ///
3317    /// # Example
3318    /// ```ignore,no_run
3319    /// # use google_cloud_securityposture_v1::model::ListPostureDeploymentsRequest;
3320    /// let x = ListPostureDeploymentsRequest::new().set_filter("example");
3321    /// ```
3322    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3323        self.filter = v.into();
3324        self
3325    }
3326}
3327
3328impl wkt::message::Message for ListPostureDeploymentsRequest {
3329    fn typename() -> &'static str {
3330        "type.googleapis.com/google.cloud.securityposture.v1.ListPostureDeploymentsRequest"
3331    }
3332}
3333
3334/// Message for response to listing PostureDeployments.
3335#[derive(Clone, Default, PartialEq)]
3336#[non_exhaustive]
3337pub struct ListPostureDeploymentsResponse {
3338    /// The list of PostureDeployment.
3339    pub posture_deployments: std::vec::Vec<crate::model::PostureDeployment>,
3340
3341    /// A token identifying a page of results the server should return.
3342    pub next_page_token: std::string::String,
3343
3344    /// Locations that could not be reached.
3345    pub unreachable: std::vec::Vec<std::string::String>,
3346
3347    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3348}
3349
3350impl ListPostureDeploymentsResponse {
3351    /// Creates a new default instance.
3352    pub fn new() -> Self {
3353        std::default::Default::default()
3354    }
3355
3356    /// Sets the value of [posture_deployments][crate::model::ListPostureDeploymentsResponse::posture_deployments].
3357    ///
3358    /// # Example
3359    /// ```ignore,no_run
3360    /// # use google_cloud_securityposture_v1::model::ListPostureDeploymentsResponse;
3361    /// use google_cloud_securityposture_v1::model::PostureDeployment;
3362    /// let x = ListPostureDeploymentsResponse::new()
3363    ///     .set_posture_deployments([
3364    ///         PostureDeployment::default()/* use setters */,
3365    ///         PostureDeployment::default()/* use (different) setters */,
3366    ///     ]);
3367    /// ```
3368    pub fn set_posture_deployments<T, V>(mut self, v: T) -> Self
3369    where
3370        T: std::iter::IntoIterator<Item = V>,
3371        V: std::convert::Into<crate::model::PostureDeployment>,
3372    {
3373        use std::iter::Iterator;
3374        self.posture_deployments = v.into_iter().map(|i| i.into()).collect();
3375        self
3376    }
3377
3378    /// Sets the value of [next_page_token][crate::model::ListPostureDeploymentsResponse::next_page_token].
3379    ///
3380    /// # Example
3381    /// ```ignore,no_run
3382    /// # use google_cloud_securityposture_v1::model::ListPostureDeploymentsResponse;
3383    /// let x = ListPostureDeploymentsResponse::new().set_next_page_token("example");
3384    /// ```
3385    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3386        self.next_page_token = v.into();
3387        self
3388    }
3389
3390    /// Sets the value of [unreachable][crate::model::ListPostureDeploymentsResponse::unreachable].
3391    ///
3392    /// # Example
3393    /// ```ignore,no_run
3394    /// # use google_cloud_securityposture_v1::model::ListPostureDeploymentsResponse;
3395    /// let x = ListPostureDeploymentsResponse::new().set_unreachable(["a", "b", "c"]);
3396    /// ```
3397    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
3398    where
3399        T: std::iter::IntoIterator<Item = V>,
3400        V: std::convert::Into<std::string::String>,
3401    {
3402        use std::iter::Iterator;
3403        self.unreachable = v.into_iter().map(|i| i.into()).collect();
3404        self
3405    }
3406}
3407
3408impl wkt::message::Message for ListPostureDeploymentsResponse {
3409    fn typename() -> &'static str {
3410        "type.googleapis.com/google.cloud.securityposture.v1.ListPostureDeploymentsResponse"
3411    }
3412}
3413
3414#[doc(hidden)]
3415impl google_cloud_gax::paginator::internal::PageableResponse for ListPostureDeploymentsResponse {
3416    type PageItem = crate::model::PostureDeployment;
3417
3418    fn items(self) -> std::vec::Vec<Self::PageItem> {
3419        self.posture_deployments
3420    }
3421
3422    fn next_page_token(&self) -> std::string::String {
3423        use std::clone::Clone;
3424        self.next_page_token.clone()
3425    }
3426}
3427
3428/// Message for getting a PostureDeployment.
3429#[derive(Clone, Default, PartialEq)]
3430#[non_exhaustive]
3431pub struct GetPostureDeploymentRequest {
3432    /// Required. Name of the resource.
3433    pub name: std::string::String,
3434
3435    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3436}
3437
3438impl GetPostureDeploymentRequest {
3439    /// Creates a new default instance.
3440    pub fn new() -> Self {
3441        std::default::Default::default()
3442    }
3443
3444    /// Sets the value of [name][crate::model::GetPostureDeploymentRequest::name].
3445    ///
3446    /// # Example
3447    /// ```ignore,no_run
3448    /// # use google_cloud_securityposture_v1::model::GetPostureDeploymentRequest;
3449    /// # let organization_id = "organization_id";
3450    /// # let location_id = "location_id";
3451    /// # let posture_deployment_id = "posture_deployment_id";
3452    /// let x = GetPostureDeploymentRequest::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postureDeployments/{posture_deployment_id}"));
3453    /// ```
3454    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3455        self.name = v.into();
3456        self
3457    }
3458}
3459
3460impl wkt::message::Message for GetPostureDeploymentRequest {
3461    fn typename() -> &'static str {
3462        "type.googleapis.com/google.cloud.securityposture.v1.GetPostureDeploymentRequest"
3463    }
3464}
3465
3466/// Message for creating a PostureDeployment.
3467#[derive(Clone, Default, PartialEq)]
3468#[non_exhaustive]
3469pub struct CreatePostureDeploymentRequest {
3470    /// Required. Value for parent.
3471    /// Format: organizations/{org_id}/locations/{location}
3472    pub parent: std::string::String,
3473
3474    /// Required. User provided identifier. It should be unique in scope of an
3475    /// Organization and location.
3476    pub posture_deployment_id: std::string::String,
3477
3478    /// Required. The resource being created.
3479    pub posture_deployment: std::option::Option<crate::model::PostureDeployment>,
3480
3481    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3482}
3483
3484impl CreatePostureDeploymentRequest {
3485    /// Creates a new default instance.
3486    pub fn new() -> Self {
3487        std::default::Default::default()
3488    }
3489
3490    /// Sets the value of [parent][crate::model::CreatePostureDeploymentRequest::parent].
3491    ///
3492    /// # Example
3493    /// ```ignore,no_run
3494    /// # use google_cloud_securityposture_v1::model::CreatePostureDeploymentRequest;
3495    /// # let organization_id = "organization_id";
3496    /// # let location_id = "location_id";
3497    /// let x = CreatePostureDeploymentRequest::new().set_parent(format!("organizations/{organization_id}/locations/{location_id}"));
3498    /// ```
3499    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3500        self.parent = v.into();
3501        self
3502    }
3503
3504    /// Sets the value of [posture_deployment_id][crate::model::CreatePostureDeploymentRequest::posture_deployment_id].
3505    ///
3506    /// # Example
3507    /// ```ignore,no_run
3508    /// # use google_cloud_securityposture_v1::model::CreatePostureDeploymentRequest;
3509    /// let x = CreatePostureDeploymentRequest::new().set_posture_deployment_id("example");
3510    /// ```
3511    pub fn set_posture_deployment_id<T: std::convert::Into<std::string::String>>(
3512        mut self,
3513        v: T,
3514    ) -> Self {
3515        self.posture_deployment_id = v.into();
3516        self
3517    }
3518
3519    /// Sets the value of [posture_deployment][crate::model::CreatePostureDeploymentRequest::posture_deployment].
3520    ///
3521    /// # Example
3522    /// ```ignore,no_run
3523    /// # use google_cloud_securityposture_v1::model::CreatePostureDeploymentRequest;
3524    /// use google_cloud_securityposture_v1::model::PostureDeployment;
3525    /// let x = CreatePostureDeploymentRequest::new().set_posture_deployment(PostureDeployment::default()/* use setters */);
3526    /// ```
3527    pub fn set_posture_deployment<T>(mut self, v: T) -> Self
3528    where
3529        T: std::convert::Into<crate::model::PostureDeployment>,
3530    {
3531        self.posture_deployment = std::option::Option::Some(v.into());
3532        self
3533    }
3534
3535    /// Sets or clears the value of [posture_deployment][crate::model::CreatePostureDeploymentRequest::posture_deployment].
3536    ///
3537    /// # Example
3538    /// ```ignore,no_run
3539    /// # use google_cloud_securityposture_v1::model::CreatePostureDeploymentRequest;
3540    /// use google_cloud_securityposture_v1::model::PostureDeployment;
3541    /// let x = CreatePostureDeploymentRequest::new().set_or_clear_posture_deployment(Some(PostureDeployment::default()/* use setters */));
3542    /// let x = CreatePostureDeploymentRequest::new().set_or_clear_posture_deployment(None::<PostureDeployment>);
3543    /// ```
3544    pub fn set_or_clear_posture_deployment<T>(mut self, v: std::option::Option<T>) -> Self
3545    where
3546        T: std::convert::Into<crate::model::PostureDeployment>,
3547    {
3548        self.posture_deployment = v.map(|x| x.into());
3549        self
3550    }
3551}
3552
3553impl wkt::message::Message for CreatePostureDeploymentRequest {
3554    fn typename() -> &'static str {
3555        "type.googleapis.com/google.cloud.securityposture.v1.CreatePostureDeploymentRequest"
3556    }
3557}
3558
3559/// Message for updating a PostureDeployment.
3560#[derive(Clone, Default, PartialEq)]
3561#[non_exhaustive]
3562pub struct UpdatePostureDeploymentRequest {
3563    /// Required. Field mask is used to specify the fields to be overwritten in the
3564    /// PostureDeployment resource by the update.
3565    /// The fields specified in the update_mask are relative to the resource, not
3566    /// the full request. A field will be overwritten if it is in the mask. If the
3567    /// user does not provide a mask then all fields will be overwritten.
3568    pub update_mask: std::option::Option<wkt::FieldMask>,
3569
3570    /// Required. The resource being updated.
3571    pub posture_deployment: std::option::Option<crate::model::PostureDeployment>,
3572
3573    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3574}
3575
3576impl UpdatePostureDeploymentRequest {
3577    /// Creates a new default instance.
3578    pub fn new() -> Self {
3579        std::default::Default::default()
3580    }
3581
3582    /// Sets the value of [update_mask][crate::model::UpdatePostureDeploymentRequest::update_mask].
3583    ///
3584    /// # Example
3585    /// ```ignore,no_run
3586    /// # use google_cloud_securityposture_v1::model::UpdatePostureDeploymentRequest;
3587    /// use wkt::FieldMask;
3588    /// let x = UpdatePostureDeploymentRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3589    /// ```
3590    pub fn set_update_mask<T>(mut self, v: T) -> Self
3591    where
3592        T: std::convert::Into<wkt::FieldMask>,
3593    {
3594        self.update_mask = std::option::Option::Some(v.into());
3595        self
3596    }
3597
3598    /// Sets or clears the value of [update_mask][crate::model::UpdatePostureDeploymentRequest::update_mask].
3599    ///
3600    /// # Example
3601    /// ```ignore,no_run
3602    /// # use google_cloud_securityposture_v1::model::UpdatePostureDeploymentRequest;
3603    /// use wkt::FieldMask;
3604    /// let x = UpdatePostureDeploymentRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3605    /// let x = UpdatePostureDeploymentRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3606    /// ```
3607    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3608    where
3609        T: std::convert::Into<wkt::FieldMask>,
3610    {
3611        self.update_mask = v.map(|x| x.into());
3612        self
3613    }
3614
3615    /// Sets the value of [posture_deployment][crate::model::UpdatePostureDeploymentRequest::posture_deployment].
3616    ///
3617    /// # Example
3618    /// ```ignore,no_run
3619    /// # use google_cloud_securityposture_v1::model::UpdatePostureDeploymentRequest;
3620    /// use google_cloud_securityposture_v1::model::PostureDeployment;
3621    /// let x = UpdatePostureDeploymentRequest::new().set_posture_deployment(PostureDeployment::default()/* use setters */);
3622    /// ```
3623    pub fn set_posture_deployment<T>(mut self, v: T) -> Self
3624    where
3625        T: std::convert::Into<crate::model::PostureDeployment>,
3626    {
3627        self.posture_deployment = std::option::Option::Some(v.into());
3628        self
3629    }
3630
3631    /// Sets or clears the value of [posture_deployment][crate::model::UpdatePostureDeploymentRequest::posture_deployment].
3632    ///
3633    /// # Example
3634    /// ```ignore,no_run
3635    /// # use google_cloud_securityposture_v1::model::UpdatePostureDeploymentRequest;
3636    /// use google_cloud_securityposture_v1::model::PostureDeployment;
3637    /// let x = UpdatePostureDeploymentRequest::new().set_or_clear_posture_deployment(Some(PostureDeployment::default()/* use setters */));
3638    /// let x = UpdatePostureDeploymentRequest::new().set_or_clear_posture_deployment(None::<PostureDeployment>);
3639    /// ```
3640    pub fn set_or_clear_posture_deployment<T>(mut self, v: std::option::Option<T>) -> Self
3641    where
3642        T: std::convert::Into<crate::model::PostureDeployment>,
3643    {
3644        self.posture_deployment = v.map(|x| x.into());
3645        self
3646    }
3647}
3648
3649impl wkt::message::Message for UpdatePostureDeploymentRequest {
3650    fn typename() -> &'static str {
3651        "type.googleapis.com/google.cloud.securityposture.v1.UpdatePostureDeploymentRequest"
3652    }
3653}
3654
3655/// Message for deleting a PostureDeployment.
3656#[derive(Clone, Default, PartialEq)]
3657#[non_exhaustive]
3658pub struct DeletePostureDeploymentRequest {
3659    /// Required. Name of the resource.
3660    pub name: std::string::String,
3661
3662    /// Optional. Etag value of the PostureDeployment to be deleted.
3663    pub etag: std::string::String,
3664
3665    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3666}
3667
3668impl DeletePostureDeploymentRequest {
3669    /// Creates a new default instance.
3670    pub fn new() -> Self {
3671        std::default::Default::default()
3672    }
3673
3674    /// Sets the value of [name][crate::model::DeletePostureDeploymentRequest::name].
3675    ///
3676    /// # Example
3677    /// ```ignore,no_run
3678    /// # use google_cloud_securityposture_v1::model::DeletePostureDeploymentRequest;
3679    /// # let organization_id = "organization_id";
3680    /// # let location_id = "location_id";
3681    /// # let posture_deployment_id = "posture_deployment_id";
3682    /// let x = DeletePostureDeploymentRequest::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postureDeployments/{posture_deployment_id}"));
3683    /// ```
3684    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3685        self.name = v.into();
3686        self
3687    }
3688
3689    /// Sets the value of [etag][crate::model::DeletePostureDeploymentRequest::etag].
3690    ///
3691    /// # Example
3692    /// ```ignore,no_run
3693    /// # use google_cloud_securityposture_v1::model::DeletePostureDeploymentRequest;
3694    /// let x = DeletePostureDeploymentRequest::new().set_etag("example");
3695    /// ```
3696    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3697        self.etag = v.into();
3698        self
3699    }
3700}
3701
3702impl wkt::message::Message for DeletePostureDeploymentRequest {
3703    fn typename() -> &'static str {
3704        "type.googleapis.com/google.cloud.securityposture.v1.DeletePostureDeploymentRequest"
3705    }
3706}
3707
3708/// PostureTemplates
3709/// Message describing PostureTemplate object.
3710#[derive(Clone, Default, PartialEq)]
3711#[non_exhaustive]
3712pub struct PostureTemplate {
3713    /// Output only. Identifier. The name of the Posture template will be of the
3714    /// format
3715    /// organizations/{organization}/locations/{location}/postureTemplates/{postureTemplate}
3716    pub name: std::string::String,
3717
3718    /// Output only. The revision_id of a PostureTemplate.
3719    pub revision_id: std::string::String,
3720
3721    /// Output only. Description of the Posture template.
3722    pub description: std::string::String,
3723
3724    /// Output only. State of PostureTemplate resource.
3725    pub state: crate::model::posture_template::State,
3726
3727    /// Output only. Policy_sets to be used by the user.
3728    pub policy_sets: std::vec::Vec<crate::model::PolicySet>,
3729
3730    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3731}
3732
3733impl PostureTemplate {
3734    /// Creates a new default instance.
3735    pub fn new() -> Self {
3736        std::default::Default::default()
3737    }
3738
3739    /// Sets the value of [name][crate::model::PostureTemplate::name].
3740    ///
3741    /// # Example
3742    /// ```ignore,no_run
3743    /// # use google_cloud_securityposture_v1::model::PostureTemplate;
3744    /// # let organization_id = "organization_id";
3745    /// # let location_id = "location_id";
3746    /// # let posture_template_id = "posture_template_id";
3747    /// let x = PostureTemplate::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postureTemplates/{posture_template_id}"));
3748    /// ```
3749    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3750        self.name = v.into();
3751        self
3752    }
3753
3754    /// Sets the value of [revision_id][crate::model::PostureTemplate::revision_id].
3755    ///
3756    /// # Example
3757    /// ```ignore,no_run
3758    /// # use google_cloud_securityposture_v1::model::PostureTemplate;
3759    /// let x = PostureTemplate::new().set_revision_id("example");
3760    /// ```
3761    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3762        self.revision_id = v.into();
3763        self
3764    }
3765
3766    /// Sets the value of [description][crate::model::PostureTemplate::description].
3767    ///
3768    /// # Example
3769    /// ```ignore,no_run
3770    /// # use google_cloud_securityposture_v1::model::PostureTemplate;
3771    /// let x = PostureTemplate::new().set_description("example");
3772    /// ```
3773    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3774        self.description = v.into();
3775        self
3776    }
3777
3778    /// Sets the value of [state][crate::model::PostureTemplate::state].
3779    ///
3780    /// # Example
3781    /// ```ignore,no_run
3782    /// # use google_cloud_securityposture_v1::model::PostureTemplate;
3783    /// use google_cloud_securityposture_v1::model::posture_template::State;
3784    /// let x0 = PostureTemplate::new().set_state(State::Active);
3785    /// let x1 = PostureTemplate::new().set_state(State::Deprecated);
3786    /// ```
3787    pub fn set_state<T: std::convert::Into<crate::model::posture_template::State>>(
3788        mut self,
3789        v: T,
3790    ) -> Self {
3791        self.state = v.into();
3792        self
3793    }
3794
3795    /// Sets the value of [policy_sets][crate::model::PostureTemplate::policy_sets].
3796    ///
3797    /// # Example
3798    /// ```ignore,no_run
3799    /// # use google_cloud_securityposture_v1::model::PostureTemplate;
3800    /// use google_cloud_securityposture_v1::model::PolicySet;
3801    /// let x = PostureTemplate::new()
3802    ///     .set_policy_sets([
3803    ///         PolicySet::default()/* use setters */,
3804    ///         PolicySet::default()/* use (different) setters */,
3805    ///     ]);
3806    /// ```
3807    pub fn set_policy_sets<T, V>(mut self, v: T) -> Self
3808    where
3809        T: std::iter::IntoIterator<Item = V>,
3810        V: std::convert::Into<crate::model::PolicySet>,
3811    {
3812        use std::iter::Iterator;
3813        self.policy_sets = v.into_iter().map(|i| i.into()).collect();
3814        self
3815    }
3816}
3817
3818impl wkt::message::Message for PostureTemplate {
3819    fn typename() -> &'static str {
3820        "type.googleapis.com/google.cloud.securityposture.v1.PostureTemplate"
3821    }
3822}
3823
3824/// Defines additional types related to [PostureTemplate].
3825pub mod posture_template {
3826    #[allow(unused_imports)]
3827    use super::*;
3828
3829    /// State of a PostureTemplate
3830    ///
3831    /// # Working with unknown values
3832    ///
3833    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3834    /// additional enum variants at any time. Adding new variants is not considered
3835    /// a breaking change. Applications should write their code in anticipation of:
3836    ///
3837    /// - New values appearing in future releases of the client library, **and**
3838    /// - New values received dynamically, without application changes.
3839    ///
3840    /// Please consult the [Working with enums] section in the user guide for some
3841    /// guidelines.
3842    ///
3843    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3844    #[derive(Clone, Debug, PartialEq)]
3845    #[non_exhaustive]
3846    pub enum State {
3847        /// Unspecified state
3848        Unspecified,
3849        /// If the Posture template is adhering to the latest controls and standards.
3850        Active,
3851        /// If the Posture template controls and standards are outdated and not
3852        /// recommended for use.
3853        Deprecated,
3854        /// If set, the enum was initialized with an unknown value.
3855        ///
3856        /// Applications can examine the value using [State::value] or
3857        /// [State::name].
3858        UnknownValue(state::UnknownValue),
3859    }
3860
3861    #[doc(hidden)]
3862    pub mod state {
3863        #[allow(unused_imports)]
3864        use super::*;
3865        #[derive(Clone, Debug, PartialEq)]
3866        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3867    }
3868
3869    impl State {
3870        /// Gets the enum value.
3871        ///
3872        /// Returns `None` if the enum contains an unknown value deserialized from
3873        /// the string representation of enums.
3874        pub fn value(&self) -> std::option::Option<i32> {
3875            match self {
3876                Self::Unspecified => std::option::Option::Some(0),
3877                Self::Active => std::option::Option::Some(1),
3878                Self::Deprecated => std::option::Option::Some(2),
3879                Self::UnknownValue(u) => u.0.value(),
3880            }
3881        }
3882
3883        /// Gets the enum value as a string.
3884        ///
3885        /// Returns `None` if the enum contains an unknown value deserialized from
3886        /// the integer representation of enums.
3887        pub fn name(&self) -> std::option::Option<&str> {
3888            match self {
3889                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3890                Self::Active => std::option::Option::Some("ACTIVE"),
3891                Self::Deprecated => std::option::Option::Some("DEPRECATED"),
3892                Self::UnknownValue(u) => u.0.name(),
3893            }
3894        }
3895    }
3896
3897    impl std::default::Default for State {
3898        fn default() -> Self {
3899            use std::convert::From;
3900            Self::from(0)
3901        }
3902    }
3903
3904    impl std::fmt::Display for State {
3905        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3906            wkt::internal::display_enum(f, self.name(), self.value())
3907        }
3908    }
3909
3910    impl std::convert::From<i32> for State {
3911        fn from(value: i32) -> Self {
3912            match value {
3913                0 => Self::Unspecified,
3914                1 => Self::Active,
3915                2 => Self::Deprecated,
3916                _ => Self::UnknownValue(state::UnknownValue(
3917                    wkt::internal::UnknownEnumValue::Integer(value),
3918                )),
3919            }
3920        }
3921    }
3922
3923    impl std::convert::From<&str> for State {
3924        fn from(value: &str) -> Self {
3925            use std::string::ToString;
3926            match value {
3927                "STATE_UNSPECIFIED" => Self::Unspecified,
3928                "ACTIVE" => Self::Active,
3929                "DEPRECATED" => Self::Deprecated,
3930                _ => Self::UnknownValue(state::UnknownValue(
3931                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3932                )),
3933            }
3934        }
3935    }
3936
3937    impl serde::ser::Serialize for State {
3938        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3939        where
3940            S: serde::Serializer,
3941        {
3942            match self {
3943                Self::Unspecified => serializer.serialize_i32(0),
3944                Self::Active => serializer.serialize_i32(1),
3945                Self::Deprecated => serializer.serialize_i32(2),
3946                Self::UnknownValue(u) => u.0.serialize(serializer),
3947            }
3948        }
3949    }
3950
3951    impl<'de> serde::de::Deserialize<'de> for State {
3952        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3953        where
3954            D: serde::Deserializer<'de>,
3955        {
3956            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3957                ".google.cloud.securityposture.v1.PostureTemplate.State",
3958            ))
3959        }
3960    }
3961}
3962
3963/// Message for requesting list of Posture Templates.
3964#[derive(Clone, Default, PartialEq)]
3965#[non_exhaustive]
3966pub struct ListPostureTemplatesRequest {
3967    /// Required. Parent value for ListPostureTemplatesRequest.
3968    pub parent: std::string::String,
3969
3970    /// Optional. Requested page size. Server may return fewer items than
3971    /// requested. If unspecified, server will pick an appropriate default.
3972    pub page_size: i32,
3973
3974    /// Optional. A token identifying a page of results the server should return.
3975    pub page_token: std::string::String,
3976
3977    /// Optional. Filter to be applied on the resource, defined by EBNF grammar
3978    /// <https://google.aip.dev/assets/misc/ebnf-filtering.txt>.
3979    pub filter: std::string::String,
3980
3981    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3982}
3983
3984impl ListPostureTemplatesRequest {
3985    /// Creates a new default instance.
3986    pub fn new() -> Self {
3987        std::default::Default::default()
3988    }
3989
3990    /// Sets the value of [parent][crate::model::ListPostureTemplatesRequest::parent].
3991    ///
3992    /// # Example
3993    /// ```ignore,no_run
3994    /// # use google_cloud_securityposture_v1::model::ListPostureTemplatesRequest;
3995    /// # let organization_id = "organization_id";
3996    /// # let location_id = "location_id";
3997    /// let x = ListPostureTemplatesRequest::new().set_parent(format!("organizations/{organization_id}/locations/{location_id}"));
3998    /// ```
3999    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4000        self.parent = v.into();
4001        self
4002    }
4003
4004    /// Sets the value of [page_size][crate::model::ListPostureTemplatesRequest::page_size].
4005    ///
4006    /// # Example
4007    /// ```ignore,no_run
4008    /// # use google_cloud_securityposture_v1::model::ListPostureTemplatesRequest;
4009    /// let x = ListPostureTemplatesRequest::new().set_page_size(42);
4010    /// ```
4011    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4012        self.page_size = v.into();
4013        self
4014    }
4015
4016    /// Sets the value of [page_token][crate::model::ListPostureTemplatesRequest::page_token].
4017    ///
4018    /// # Example
4019    /// ```ignore,no_run
4020    /// # use google_cloud_securityposture_v1::model::ListPostureTemplatesRequest;
4021    /// let x = ListPostureTemplatesRequest::new().set_page_token("example");
4022    /// ```
4023    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4024        self.page_token = v.into();
4025        self
4026    }
4027
4028    /// Sets the value of [filter][crate::model::ListPostureTemplatesRequest::filter].
4029    ///
4030    /// # Example
4031    /// ```ignore,no_run
4032    /// # use google_cloud_securityposture_v1::model::ListPostureTemplatesRequest;
4033    /// let x = ListPostureTemplatesRequest::new().set_filter("example");
4034    /// ```
4035    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4036        self.filter = v.into();
4037        self
4038    }
4039}
4040
4041impl wkt::message::Message for ListPostureTemplatesRequest {
4042    fn typename() -> &'static str {
4043        "type.googleapis.com/google.cloud.securityposture.v1.ListPostureTemplatesRequest"
4044    }
4045}
4046
4047/// Message for response to listing PostureTemplates.
4048#[derive(Clone, Default, PartialEq)]
4049#[non_exhaustive]
4050pub struct ListPostureTemplatesResponse {
4051    /// The list of PostureTemplate.
4052    pub posture_templates: std::vec::Vec<crate::model::PostureTemplate>,
4053
4054    /// A token identifying a page of results the server should return.
4055    pub next_page_token: std::string::String,
4056
4057    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4058}
4059
4060impl ListPostureTemplatesResponse {
4061    /// Creates a new default instance.
4062    pub fn new() -> Self {
4063        std::default::Default::default()
4064    }
4065
4066    /// Sets the value of [posture_templates][crate::model::ListPostureTemplatesResponse::posture_templates].
4067    ///
4068    /// # Example
4069    /// ```ignore,no_run
4070    /// # use google_cloud_securityposture_v1::model::ListPostureTemplatesResponse;
4071    /// use google_cloud_securityposture_v1::model::PostureTemplate;
4072    /// let x = ListPostureTemplatesResponse::new()
4073    ///     .set_posture_templates([
4074    ///         PostureTemplate::default()/* use setters */,
4075    ///         PostureTemplate::default()/* use (different) setters */,
4076    ///     ]);
4077    /// ```
4078    pub fn set_posture_templates<T, V>(mut self, v: T) -> Self
4079    where
4080        T: std::iter::IntoIterator<Item = V>,
4081        V: std::convert::Into<crate::model::PostureTemplate>,
4082    {
4083        use std::iter::Iterator;
4084        self.posture_templates = v.into_iter().map(|i| i.into()).collect();
4085        self
4086    }
4087
4088    /// Sets the value of [next_page_token][crate::model::ListPostureTemplatesResponse::next_page_token].
4089    ///
4090    /// # Example
4091    /// ```ignore,no_run
4092    /// # use google_cloud_securityposture_v1::model::ListPostureTemplatesResponse;
4093    /// let x = ListPostureTemplatesResponse::new().set_next_page_token("example");
4094    /// ```
4095    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4096        self.next_page_token = v.into();
4097        self
4098    }
4099}
4100
4101impl wkt::message::Message for ListPostureTemplatesResponse {
4102    fn typename() -> &'static str {
4103        "type.googleapis.com/google.cloud.securityposture.v1.ListPostureTemplatesResponse"
4104    }
4105}
4106
4107#[doc(hidden)]
4108impl google_cloud_gax::paginator::internal::PageableResponse for ListPostureTemplatesResponse {
4109    type PageItem = crate::model::PostureTemplate;
4110
4111    fn items(self) -> std::vec::Vec<Self::PageItem> {
4112        self.posture_templates
4113    }
4114
4115    fn next_page_token(&self) -> std::string::String {
4116        use std::clone::Clone;
4117        self.next_page_token.clone()
4118    }
4119}
4120
4121/// Message for getting a Posture Template.
4122#[derive(Clone, Default, PartialEq)]
4123#[non_exhaustive]
4124pub struct GetPostureTemplateRequest {
4125    /// Required. Name of the resource.
4126    pub name: std::string::String,
4127
4128    /// Optional. Specific revision_id of a Posture Template.
4129    /// PostureTemplate revision_id which needs to be retrieved.
4130    pub revision_id: std::string::String,
4131
4132    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4133}
4134
4135impl GetPostureTemplateRequest {
4136    /// Creates a new default instance.
4137    pub fn new() -> Self {
4138        std::default::Default::default()
4139    }
4140
4141    /// Sets the value of [name][crate::model::GetPostureTemplateRequest::name].
4142    ///
4143    /// # Example
4144    /// ```ignore,no_run
4145    /// # use google_cloud_securityposture_v1::model::GetPostureTemplateRequest;
4146    /// # let organization_id = "organization_id";
4147    /// # let location_id = "location_id";
4148    /// # let posture_template_id = "posture_template_id";
4149    /// let x = GetPostureTemplateRequest::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postureTemplates/{posture_template_id}"));
4150    /// ```
4151    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4152        self.name = v.into();
4153        self
4154    }
4155
4156    /// Sets the value of [revision_id][crate::model::GetPostureTemplateRequest::revision_id].
4157    ///
4158    /// # Example
4159    /// ```ignore,no_run
4160    /// # use google_cloud_securityposture_v1::model::GetPostureTemplateRequest;
4161    /// let x = GetPostureTemplateRequest::new().set_revision_id("example");
4162    /// ```
4163    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4164        self.revision_id = v.into();
4165        self
4166    }
4167}
4168
4169impl wkt::message::Message for GetPostureTemplateRequest {
4170    fn typename() -> &'static str {
4171        "type.googleapis.com/google.cloud.securityposture.v1.GetPostureTemplateRequest"
4172    }
4173}
4174
4175/// Message for Security Health Analytics built-in detector.
4176#[derive(Clone, Default, PartialEq)]
4177#[non_exhaustive]
4178pub struct SecurityHealthAnalyticsModule {
4179    /// Required. The name of the module eg: BIGQUERY_TABLE_CMEK_DISABLED.
4180    pub module_name: std::string::String,
4181
4182    /// The state of enablement for the module at its level of the resource
4183    /// hierarchy.
4184    pub module_enablement_state: crate::model::EnablementState,
4185
4186    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4187}
4188
4189impl SecurityHealthAnalyticsModule {
4190    /// Creates a new default instance.
4191    pub fn new() -> Self {
4192        std::default::Default::default()
4193    }
4194
4195    /// Sets the value of [module_name][crate::model::SecurityHealthAnalyticsModule::module_name].
4196    ///
4197    /// # Example
4198    /// ```ignore,no_run
4199    /// # use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsModule;
4200    /// let x = SecurityHealthAnalyticsModule::new().set_module_name("example");
4201    /// ```
4202    pub fn set_module_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4203        self.module_name = v.into();
4204        self
4205    }
4206
4207    /// Sets the value of [module_enablement_state][crate::model::SecurityHealthAnalyticsModule::module_enablement_state].
4208    ///
4209    /// # Example
4210    /// ```ignore,no_run
4211    /// # use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsModule;
4212    /// use google_cloud_securityposture_v1::model::EnablementState;
4213    /// let x0 = SecurityHealthAnalyticsModule::new().set_module_enablement_state(EnablementState::Enabled);
4214    /// let x1 = SecurityHealthAnalyticsModule::new().set_module_enablement_state(EnablementState::Disabled);
4215    /// ```
4216    pub fn set_module_enablement_state<T: std::convert::Into<crate::model::EnablementState>>(
4217        mut self,
4218        v: T,
4219    ) -> Self {
4220        self.module_enablement_state = v.into();
4221        self
4222    }
4223}
4224
4225impl wkt::message::Message for SecurityHealthAnalyticsModule {
4226    fn typename() -> &'static str {
4227        "type.googleapis.com/google.cloud.securityposture.v1.SecurityHealthAnalyticsModule"
4228    }
4229}
4230
4231/// Message for SHA Custom Module
4232#[derive(Clone, Default, PartialEq)]
4233#[non_exhaustive]
4234pub struct SecurityHealthAnalyticsCustomModule {
4235    /// Output only. Immutable. The id of the custom module.
4236    /// The id is server-generated and is not user settable.
4237    /// It will be a numeric id containing 1-20 digits.
4238    pub id: std::string::String,
4239
4240    /// Optional. The display name of the Security Health Analytics custom module.
4241    /// This display name becomes the finding category for all findings that are
4242    /// returned by this custom module. The display name must be between 1 and
4243    /// 128 characters, start with a lowercase letter, and contain alphanumeric
4244    /// characters or underscores only.
4245    pub display_name: std::string::String,
4246
4247    /// Required. custom module details
4248    pub config: std::option::Option<crate::model::CustomConfig>,
4249
4250    /// The state of enablement for the module at its level of the resource
4251    /// hierarchy.
4252    pub module_enablement_state: crate::model::EnablementState,
4253
4254    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4255}
4256
4257impl SecurityHealthAnalyticsCustomModule {
4258    /// Creates a new default instance.
4259    pub fn new() -> Self {
4260        std::default::Default::default()
4261    }
4262
4263    /// Sets the value of [id][crate::model::SecurityHealthAnalyticsCustomModule::id].
4264    ///
4265    /// # Example
4266    /// ```ignore,no_run
4267    /// # use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsCustomModule;
4268    /// let x = SecurityHealthAnalyticsCustomModule::new().set_id("example");
4269    /// ```
4270    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4271        self.id = v.into();
4272        self
4273    }
4274
4275    /// Sets the value of [display_name][crate::model::SecurityHealthAnalyticsCustomModule::display_name].
4276    ///
4277    /// # Example
4278    /// ```ignore,no_run
4279    /// # use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsCustomModule;
4280    /// let x = SecurityHealthAnalyticsCustomModule::new().set_display_name("example");
4281    /// ```
4282    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4283        self.display_name = v.into();
4284        self
4285    }
4286
4287    /// Sets the value of [config][crate::model::SecurityHealthAnalyticsCustomModule::config].
4288    ///
4289    /// # Example
4290    /// ```ignore,no_run
4291    /// # use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsCustomModule;
4292    /// use google_cloud_securityposture_v1::model::CustomConfig;
4293    /// let x = SecurityHealthAnalyticsCustomModule::new().set_config(CustomConfig::default()/* use setters */);
4294    /// ```
4295    pub fn set_config<T>(mut self, v: T) -> Self
4296    where
4297        T: std::convert::Into<crate::model::CustomConfig>,
4298    {
4299        self.config = std::option::Option::Some(v.into());
4300        self
4301    }
4302
4303    /// Sets or clears the value of [config][crate::model::SecurityHealthAnalyticsCustomModule::config].
4304    ///
4305    /// # Example
4306    /// ```ignore,no_run
4307    /// # use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsCustomModule;
4308    /// use google_cloud_securityposture_v1::model::CustomConfig;
4309    /// let x = SecurityHealthAnalyticsCustomModule::new().set_or_clear_config(Some(CustomConfig::default()/* use setters */));
4310    /// let x = SecurityHealthAnalyticsCustomModule::new().set_or_clear_config(None::<CustomConfig>);
4311    /// ```
4312    pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
4313    where
4314        T: std::convert::Into<crate::model::CustomConfig>,
4315    {
4316        self.config = v.map(|x| x.into());
4317        self
4318    }
4319
4320    /// Sets the value of [module_enablement_state][crate::model::SecurityHealthAnalyticsCustomModule::module_enablement_state].
4321    ///
4322    /// # Example
4323    /// ```ignore,no_run
4324    /// # use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsCustomModule;
4325    /// use google_cloud_securityposture_v1::model::EnablementState;
4326    /// let x0 = SecurityHealthAnalyticsCustomModule::new().set_module_enablement_state(EnablementState::Enabled);
4327    /// let x1 = SecurityHealthAnalyticsCustomModule::new().set_module_enablement_state(EnablementState::Disabled);
4328    /// ```
4329    pub fn set_module_enablement_state<T: std::convert::Into<crate::model::EnablementState>>(
4330        mut self,
4331        v: T,
4332    ) -> Self {
4333        self.module_enablement_state = v.into();
4334        self
4335    }
4336}
4337
4338impl wkt::message::Message for SecurityHealthAnalyticsCustomModule {
4339    fn typename() -> &'static str {
4340        "type.googleapis.com/google.cloud.securityposture.v1.SecurityHealthAnalyticsCustomModule"
4341    }
4342}
4343
4344/// Defines the properties in a custom module configuration for Security
4345/// Health Analytics. Use the custom module configuration to create custom
4346/// detectors that generate custom findings for resources that you specify.
4347#[derive(Clone, Default, PartialEq)]
4348#[non_exhaustive]
4349pub struct CustomConfig {
4350    /// Required. The CEL expression to evaluate to produce findings. When the
4351    /// expression evaluates to true against a resource, a finding is generated.
4352    pub predicate: std::option::Option<google_cloud_type::model::Expr>,
4353
4354    /// Optional. Custom output properties.
4355    pub custom_output: std::option::Option<crate::model::custom_config::CustomOutputSpec>,
4356
4357    /// Required. The resource types that the custom module operates on. Each
4358    /// custom module can specify up to 5 resource types.
4359    pub resource_selector: std::option::Option<crate::model::custom_config::ResourceSelector>,
4360
4361    /// Required. The severity to assign to findings generated by the module.
4362    pub severity: crate::model::custom_config::Severity,
4363
4364    /// Optional. Text that describes the vulnerability or misconfiguration that
4365    /// the custom module detects. This explanation is returned with each finding
4366    /// instance to help investigators understand the detected issue. The text must
4367    /// be enclosed in quotation marks.
4368    pub description: std::string::String,
4369
4370    /// Optional. An explanation of the recommended steps that security teams can
4371    /// take to resolve the detected issue. This explanation is returned with each
4372    /// finding generated by this module in the `nextSteps` property of the finding
4373    /// JSON.
4374    pub recommendation: std::string::String,
4375
4376    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4377}
4378
4379impl CustomConfig {
4380    /// Creates a new default instance.
4381    pub fn new() -> Self {
4382        std::default::Default::default()
4383    }
4384
4385    /// Sets the value of [predicate][crate::model::CustomConfig::predicate].
4386    ///
4387    /// # Example
4388    /// ```ignore,no_run
4389    /// # use google_cloud_securityposture_v1::model::CustomConfig;
4390    /// use google_cloud_type::model::Expr;
4391    /// let x = CustomConfig::new().set_predicate(Expr::default()/* use setters */);
4392    /// ```
4393    pub fn set_predicate<T>(mut self, v: T) -> Self
4394    where
4395        T: std::convert::Into<google_cloud_type::model::Expr>,
4396    {
4397        self.predicate = std::option::Option::Some(v.into());
4398        self
4399    }
4400
4401    /// Sets or clears the value of [predicate][crate::model::CustomConfig::predicate].
4402    ///
4403    /// # Example
4404    /// ```ignore,no_run
4405    /// # use google_cloud_securityposture_v1::model::CustomConfig;
4406    /// use google_cloud_type::model::Expr;
4407    /// let x = CustomConfig::new().set_or_clear_predicate(Some(Expr::default()/* use setters */));
4408    /// let x = CustomConfig::new().set_or_clear_predicate(None::<Expr>);
4409    /// ```
4410    pub fn set_or_clear_predicate<T>(mut self, v: std::option::Option<T>) -> Self
4411    where
4412        T: std::convert::Into<google_cloud_type::model::Expr>,
4413    {
4414        self.predicate = v.map(|x| x.into());
4415        self
4416    }
4417
4418    /// Sets the value of [custom_output][crate::model::CustomConfig::custom_output].
4419    ///
4420    /// # Example
4421    /// ```ignore,no_run
4422    /// # use google_cloud_securityposture_v1::model::CustomConfig;
4423    /// use google_cloud_securityposture_v1::model::custom_config::CustomOutputSpec;
4424    /// let x = CustomConfig::new().set_custom_output(CustomOutputSpec::default()/* use setters */);
4425    /// ```
4426    pub fn set_custom_output<T>(mut self, v: T) -> Self
4427    where
4428        T: std::convert::Into<crate::model::custom_config::CustomOutputSpec>,
4429    {
4430        self.custom_output = std::option::Option::Some(v.into());
4431        self
4432    }
4433
4434    /// Sets or clears the value of [custom_output][crate::model::CustomConfig::custom_output].
4435    ///
4436    /// # Example
4437    /// ```ignore,no_run
4438    /// # use google_cloud_securityposture_v1::model::CustomConfig;
4439    /// use google_cloud_securityposture_v1::model::custom_config::CustomOutputSpec;
4440    /// let x = CustomConfig::new().set_or_clear_custom_output(Some(CustomOutputSpec::default()/* use setters */));
4441    /// let x = CustomConfig::new().set_or_clear_custom_output(None::<CustomOutputSpec>);
4442    /// ```
4443    pub fn set_or_clear_custom_output<T>(mut self, v: std::option::Option<T>) -> Self
4444    where
4445        T: std::convert::Into<crate::model::custom_config::CustomOutputSpec>,
4446    {
4447        self.custom_output = v.map(|x| x.into());
4448        self
4449    }
4450
4451    /// Sets the value of [resource_selector][crate::model::CustomConfig::resource_selector].
4452    ///
4453    /// # Example
4454    /// ```ignore,no_run
4455    /// # use google_cloud_securityposture_v1::model::CustomConfig;
4456    /// use google_cloud_securityposture_v1::model::custom_config::ResourceSelector;
4457    /// let x = CustomConfig::new().set_resource_selector(ResourceSelector::default()/* use setters */);
4458    /// ```
4459    pub fn set_resource_selector<T>(mut self, v: T) -> Self
4460    where
4461        T: std::convert::Into<crate::model::custom_config::ResourceSelector>,
4462    {
4463        self.resource_selector = std::option::Option::Some(v.into());
4464        self
4465    }
4466
4467    /// Sets or clears the value of [resource_selector][crate::model::CustomConfig::resource_selector].
4468    ///
4469    /// # Example
4470    /// ```ignore,no_run
4471    /// # use google_cloud_securityposture_v1::model::CustomConfig;
4472    /// use google_cloud_securityposture_v1::model::custom_config::ResourceSelector;
4473    /// let x = CustomConfig::new().set_or_clear_resource_selector(Some(ResourceSelector::default()/* use setters */));
4474    /// let x = CustomConfig::new().set_or_clear_resource_selector(None::<ResourceSelector>);
4475    /// ```
4476    pub fn set_or_clear_resource_selector<T>(mut self, v: std::option::Option<T>) -> Self
4477    where
4478        T: std::convert::Into<crate::model::custom_config::ResourceSelector>,
4479    {
4480        self.resource_selector = v.map(|x| x.into());
4481        self
4482    }
4483
4484    /// Sets the value of [severity][crate::model::CustomConfig::severity].
4485    ///
4486    /// # Example
4487    /// ```ignore,no_run
4488    /// # use google_cloud_securityposture_v1::model::CustomConfig;
4489    /// use google_cloud_securityposture_v1::model::custom_config::Severity;
4490    /// let x0 = CustomConfig::new().set_severity(Severity::Critical);
4491    /// let x1 = CustomConfig::new().set_severity(Severity::High);
4492    /// let x2 = CustomConfig::new().set_severity(Severity::Medium);
4493    /// ```
4494    pub fn set_severity<T: std::convert::Into<crate::model::custom_config::Severity>>(
4495        mut self,
4496        v: T,
4497    ) -> Self {
4498        self.severity = v.into();
4499        self
4500    }
4501
4502    /// Sets the value of [description][crate::model::CustomConfig::description].
4503    ///
4504    /// # Example
4505    /// ```ignore,no_run
4506    /// # use google_cloud_securityposture_v1::model::CustomConfig;
4507    /// let x = CustomConfig::new().set_description("example");
4508    /// ```
4509    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4510        self.description = v.into();
4511        self
4512    }
4513
4514    /// Sets the value of [recommendation][crate::model::CustomConfig::recommendation].
4515    ///
4516    /// # Example
4517    /// ```ignore,no_run
4518    /// # use google_cloud_securityposture_v1::model::CustomConfig;
4519    /// let x = CustomConfig::new().set_recommendation("example");
4520    /// ```
4521    pub fn set_recommendation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4522        self.recommendation = v.into();
4523        self
4524    }
4525}
4526
4527impl wkt::message::Message for CustomConfig {
4528    fn typename() -> &'static str {
4529        "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig"
4530    }
4531}
4532
4533/// Defines additional types related to [CustomConfig].
4534pub mod custom_config {
4535    #[allow(unused_imports)]
4536    use super::*;
4537
4538    /// A set of optional name-value pairs that define custom source properties to
4539    /// return with each finding that is generated by the custom module. The custom
4540    /// source properties that are defined here are included in the finding JSON
4541    /// under `sourceProperties`.
4542    #[derive(Clone, Default, PartialEq)]
4543    #[non_exhaustive]
4544    pub struct CustomOutputSpec {
4545        /// Optional. A list of custom output properties to add to the finding.
4546        pub properties: std::vec::Vec<crate::model::custom_config::custom_output_spec::Property>,
4547
4548        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4549    }
4550
4551    impl CustomOutputSpec {
4552        /// Creates a new default instance.
4553        pub fn new() -> Self {
4554            std::default::Default::default()
4555        }
4556
4557        /// Sets the value of [properties][crate::model::custom_config::CustomOutputSpec::properties].
4558        ///
4559        /// # Example
4560        /// ```ignore,no_run
4561        /// # use google_cloud_securityposture_v1::model::custom_config::CustomOutputSpec;
4562        /// use google_cloud_securityposture_v1::model::custom_config::custom_output_spec::Property;
4563        /// let x = CustomOutputSpec::new()
4564        ///     .set_properties([
4565        ///         Property::default()/* use setters */,
4566        ///         Property::default()/* use (different) setters */,
4567        ///     ]);
4568        /// ```
4569        pub fn set_properties<T, V>(mut self, v: T) -> Self
4570        where
4571            T: std::iter::IntoIterator<Item = V>,
4572            V: std::convert::Into<crate::model::custom_config::custom_output_spec::Property>,
4573        {
4574            use std::iter::Iterator;
4575            self.properties = v.into_iter().map(|i| i.into()).collect();
4576            self
4577        }
4578    }
4579
4580    impl wkt::message::Message for CustomOutputSpec {
4581        fn typename() -> &'static str {
4582            "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig.CustomOutputSpec"
4583        }
4584    }
4585
4586    /// Defines additional types related to [CustomOutputSpec].
4587    pub mod custom_output_spec {
4588        #[allow(unused_imports)]
4589        use super::*;
4590
4591        /// An individual name-value pair that defines a custom source property.
4592        #[derive(Clone, Default, PartialEq)]
4593        #[non_exhaustive]
4594        pub struct Property {
4595            /// Required. Name of the property for the custom output.
4596            pub name: std::string::String,
4597
4598            /// Optional. The CEL expression for the custom output. A resource property
4599            /// can be specified to return the value of the property or a text string
4600            /// enclosed in quotation marks.
4601            pub value_expression: std::option::Option<google_cloud_type::model::Expr>,
4602
4603            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4604        }
4605
4606        impl Property {
4607            /// Creates a new default instance.
4608            pub fn new() -> Self {
4609                std::default::Default::default()
4610            }
4611
4612            /// Sets the value of [name][crate::model::custom_config::custom_output_spec::Property::name].
4613            ///
4614            /// # Example
4615            /// ```ignore,no_run
4616            /// # use google_cloud_securityposture_v1::model::custom_config::custom_output_spec::Property;
4617            /// let x = Property::new().set_name("example");
4618            /// ```
4619            pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4620                self.name = v.into();
4621                self
4622            }
4623
4624            /// Sets the value of [value_expression][crate::model::custom_config::custom_output_spec::Property::value_expression].
4625            ///
4626            /// # Example
4627            /// ```ignore,no_run
4628            /// # use google_cloud_securityposture_v1::model::custom_config::custom_output_spec::Property;
4629            /// use google_cloud_type::model::Expr;
4630            /// let x = Property::new().set_value_expression(Expr::default()/* use setters */);
4631            /// ```
4632            pub fn set_value_expression<T>(mut self, v: T) -> Self
4633            where
4634                T: std::convert::Into<google_cloud_type::model::Expr>,
4635            {
4636                self.value_expression = std::option::Option::Some(v.into());
4637                self
4638            }
4639
4640            /// Sets or clears the value of [value_expression][crate::model::custom_config::custom_output_spec::Property::value_expression].
4641            ///
4642            /// # Example
4643            /// ```ignore,no_run
4644            /// # use google_cloud_securityposture_v1::model::custom_config::custom_output_spec::Property;
4645            /// use google_cloud_type::model::Expr;
4646            /// let x = Property::new().set_or_clear_value_expression(Some(Expr::default()/* use setters */));
4647            /// let x = Property::new().set_or_clear_value_expression(None::<Expr>);
4648            /// ```
4649            pub fn set_or_clear_value_expression<T>(mut self, v: std::option::Option<T>) -> Self
4650            where
4651                T: std::convert::Into<google_cloud_type::model::Expr>,
4652            {
4653                self.value_expression = v.map(|x| x.into());
4654                self
4655            }
4656        }
4657
4658        impl wkt::message::Message for Property {
4659            fn typename() -> &'static str {
4660                "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig.CustomOutputSpec.Property"
4661            }
4662        }
4663    }
4664
4665    /// Resource for selecting resource type.
4666    #[derive(Clone, Default, PartialEq)]
4667    #[non_exhaustive]
4668    pub struct ResourceSelector {
4669        /// Required. The resource types to run the detector on.
4670        pub resource_types: std::vec::Vec<std::string::String>,
4671
4672        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4673    }
4674
4675    impl ResourceSelector {
4676        /// Creates a new default instance.
4677        pub fn new() -> Self {
4678            std::default::Default::default()
4679        }
4680
4681        /// Sets the value of [resource_types][crate::model::custom_config::ResourceSelector::resource_types].
4682        ///
4683        /// # Example
4684        /// ```ignore,no_run
4685        /// # use google_cloud_securityposture_v1::model::custom_config::ResourceSelector;
4686        /// let x = ResourceSelector::new().set_resource_types(["a", "b", "c"]);
4687        /// ```
4688        pub fn set_resource_types<T, V>(mut self, v: T) -> Self
4689        where
4690            T: std::iter::IntoIterator<Item = V>,
4691            V: std::convert::Into<std::string::String>,
4692        {
4693            use std::iter::Iterator;
4694            self.resource_types = v.into_iter().map(|i| i.into()).collect();
4695            self
4696        }
4697    }
4698
4699    impl wkt::message::Message for ResourceSelector {
4700        fn typename() -> &'static str {
4701            "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig.ResourceSelector"
4702        }
4703    }
4704
4705    /// Defines the valid value options for the severity of a finding.
4706    ///
4707    /// # Working with unknown values
4708    ///
4709    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4710    /// additional enum variants at any time. Adding new variants is not considered
4711    /// a breaking change. Applications should write their code in anticipation of:
4712    ///
4713    /// - New values appearing in future releases of the client library, **and**
4714    /// - New values received dynamically, without application changes.
4715    ///
4716    /// Please consult the [Working with enums] section in the user guide for some
4717    /// guidelines.
4718    ///
4719    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4720    #[derive(Clone, Debug, PartialEq)]
4721    #[non_exhaustive]
4722    pub enum Severity {
4723        /// Unspecified severity.
4724        Unspecified,
4725        /// Critical severity.
4726        Critical,
4727        /// High severity.
4728        High,
4729        /// Medium severity.
4730        Medium,
4731        /// Low severity.
4732        Low,
4733        /// If set, the enum was initialized with an unknown value.
4734        ///
4735        /// Applications can examine the value using [Severity::value] or
4736        /// [Severity::name].
4737        UnknownValue(severity::UnknownValue),
4738    }
4739
4740    #[doc(hidden)]
4741    pub mod severity {
4742        #[allow(unused_imports)]
4743        use super::*;
4744        #[derive(Clone, Debug, PartialEq)]
4745        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4746    }
4747
4748    impl Severity {
4749        /// Gets the enum value.
4750        ///
4751        /// Returns `None` if the enum contains an unknown value deserialized from
4752        /// the string representation of enums.
4753        pub fn value(&self) -> std::option::Option<i32> {
4754            match self {
4755                Self::Unspecified => std::option::Option::Some(0),
4756                Self::Critical => std::option::Option::Some(1),
4757                Self::High => std::option::Option::Some(2),
4758                Self::Medium => std::option::Option::Some(3),
4759                Self::Low => std::option::Option::Some(4),
4760                Self::UnknownValue(u) => u.0.value(),
4761            }
4762        }
4763
4764        /// Gets the enum value as a string.
4765        ///
4766        /// Returns `None` if the enum contains an unknown value deserialized from
4767        /// the integer representation of enums.
4768        pub fn name(&self) -> std::option::Option<&str> {
4769            match self {
4770                Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
4771                Self::Critical => std::option::Option::Some("CRITICAL"),
4772                Self::High => std::option::Option::Some("HIGH"),
4773                Self::Medium => std::option::Option::Some("MEDIUM"),
4774                Self::Low => std::option::Option::Some("LOW"),
4775                Self::UnknownValue(u) => u.0.name(),
4776            }
4777        }
4778    }
4779
4780    impl std::default::Default for Severity {
4781        fn default() -> Self {
4782            use std::convert::From;
4783            Self::from(0)
4784        }
4785    }
4786
4787    impl std::fmt::Display for Severity {
4788        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4789            wkt::internal::display_enum(f, self.name(), self.value())
4790        }
4791    }
4792
4793    impl std::convert::From<i32> for Severity {
4794        fn from(value: i32) -> Self {
4795            match value {
4796                0 => Self::Unspecified,
4797                1 => Self::Critical,
4798                2 => Self::High,
4799                3 => Self::Medium,
4800                4 => Self::Low,
4801                _ => Self::UnknownValue(severity::UnknownValue(
4802                    wkt::internal::UnknownEnumValue::Integer(value),
4803                )),
4804            }
4805        }
4806    }
4807
4808    impl std::convert::From<&str> for Severity {
4809        fn from(value: &str) -> Self {
4810            use std::string::ToString;
4811            match value {
4812                "SEVERITY_UNSPECIFIED" => Self::Unspecified,
4813                "CRITICAL" => Self::Critical,
4814                "HIGH" => Self::High,
4815                "MEDIUM" => Self::Medium,
4816                "LOW" => Self::Low,
4817                _ => Self::UnknownValue(severity::UnknownValue(
4818                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4819                )),
4820            }
4821        }
4822    }
4823
4824    impl serde::ser::Serialize for Severity {
4825        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4826        where
4827            S: serde::Serializer,
4828        {
4829            match self {
4830                Self::Unspecified => serializer.serialize_i32(0),
4831                Self::Critical => serializer.serialize_i32(1),
4832                Self::High => serializer.serialize_i32(2),
4833                Self::Medium => serializer.serialize_i32(3),
4834                Self::Low => serializer.serialize_i32(4),
4835                Self::UnknownValue(u) => u.0.serialize(serializer),
4836            }
4837        }
4838    }
4839
4840    impl<'de> serde::de::Deserialize<'de> for Severity {
4841        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4842        where
4843            D: serde::Deserializer<'de>,
4844        {
4845            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
4846                ".google.cloud.securityposture.v1.CustomConfig.Severity",
4847            ))
4848        }
4849    }
4850}
4851
4852/// Possible enablement states of a service or module.
4853///
4854/// # Working with unknown values
4855///
4856/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4857/// additional enum variants at any time. Adding new variants is not considered
4858/// a breaking change. Applications should write their code in anticipation of:
4859///
4860/// - New values appearing in future releases of the client library, **and**
4861/// - New values received dynamically, without application changes.
4862///
4863/// Please consult the [Working with enums] section in the user guide for some
4864/// guidelines.
4865///
4866/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4867#[derive(Clone, Debug, PartialEq)]
4868#[non_exhaustive]
4869pub enum EnablementState {
4870    /// Default value. This value is unused.
4871    Unspecified,
4872    /// State is enabled.
4873    Enabled,
4874    /// State is disabled.
4875    Disabled,
4876    /// If set, the enum was initialized with an unknown value.
4877    ///
4878    /// Applications can examine the value using [EnablementState::value] or
4879    /// [EnablementState::name].
4880    UnknownValue(enablement_state::UnknownValue),
4881}
4882
4883#[doc(hidden)]
4884pub mod enablement_state {
4885    #[allow(unused_imports)]
4886    use super::*;
4887    #[derive(Clone, Debug, PartialEq)]
4888    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4889}
4890
4891impl EnablementState {
4892    /// Gets the enum value.
4893    ///
4894    /// Returns `None` if the enum contains an unknown value deserialized from
4895    /// the string representation of enums.
4896    pub fn value(&self) -> std::option::Option<i32> {
4897        match self {
4898            Self::Unspecified => std::option::Option::Some(0),
4899            Self::Enabled => std::option::Option::Some(1),
4900            Self::Disabled => std::option::Option::Some(2),
4901            Self::UnknownValue(u) => u.0.value(),
4902        }
4903    }
4904
4905    /// Gets the enum value as a string.
4906    ///
4907    /// Returns `None` if the enum contains an unknown value deserialized from
4908    /// the integer representation of enums.
4909    pub fn name(&self) -> std::option::Option<&str> {
4910        match self {
4911            Self::Unspecified => std::option::Option::Some("ENABLEMENT_STATE_UNSPECIFIED"),
4912            Self::Enabled => std::option::Option::Some("ENABLED"),
4913            Self::Disabled => std::option::Option::Some("DISABLED"),
4914            Self::UnknownValue(u) => u.0.name(),
4915        }
4916    }
4917}
4918
4919impl std::default::Default for EnablementState {
4920    fn default() -> Self {
4921        use std::convert::From;
4922        Self::from(0)
4923    }
4924}
4925
4926impl std::fmt::Display for EnablementState {
4927    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4928        wkt::internal::display_enum(f, self.name(), self.value())
4929    }
4930}
4931
4932impl std::convert::From<i32> for EnablementState {
4933    fn from(value: i32) -> Self {
4934        match value {
4935            0 => Self::Unspecified,
4936            1 => Self::Enabled,
4937            2 => Self::Disabled,
4938            _ => Self::UnknownValue(enablement_state::UnknownValue(
4939                wkt::internal::UnknownEnumValue::Integer(value),
4940            )),
4941        }
4942    }
4943}
4944
4945impl std::convert::From<&str> for EnablementState {
4946    fn from(value: &str) -> Self {
4947        use std::string::ToString;
4948        match value {
4949            "ENABLEMENT_STATE_UNSPECIFIED" => Self::Unspecified,
4950            "ENABLED" => Self::Enabled,
4951            "DISABLED" => Self::Disabled,
4952            _ => Self::UnknownValue(enablement_state::UnknownValue(
4953                wkt::internal::UnknownEnumValue::String(value.to_string()),
4954            )),
4955        }
4956    }
4957}
4958
4959impl serde::ser::Serialize for EnablementState {
4960    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4961    where
4962        S: serde::Serializer,
4963    {
4964        match self {
4965            Self::Unspecified => serializer.serialize_i32(0),
4966            Self::Enabled => serializer.serialize_i32(1),
4967            Self::Disabled => serializer.serialize_i32(2),
4968            Self::UnknownValue(u) => u.0.serialize(serializer),
4969        }
4970    }
4971}
4972
4973impl<'de> serde::de::Deserialize<'de> for EnablementState {
4974    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4975    where
4976        D: serde::Deserializer<'de>,
4977    {
4978        deserializer.deserialize_any(wkt::internal::EnumVisitor::<EnablementState>::new(
4979            ".google.cloud.securityposture.v1.EnablementState",
4980        ))
4981    }
4982}