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