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