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