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