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#[derive(Clone, Debug, Default, PartialEq)]
39#[non_exhaustive]
40pub struct PolicyRule {
41    /// A condition which determines whether this rule is used
42    /// in the evaluation of the policy. When set, the `expression` field in
43    /// the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
44    /// or "&&" operators. Each subexpression must be of the form
45    /// "resource.matchTag('<ORG_ID>/tag_key_short_name,
46    /// 'tag_value_short_name')" or "resource.matchTagId('tagKeys/key_id',
47    /// 'tagValues/value_id')" where key_name and value_name are the resource
48    /// names for Label Keys and Values. These names are available from the Tag
49    /// Manager Service. An example expression is:
50    /// "resource.matchTag('123456789/environment,
51    /// 'prod')" or "resource.matchTagId('tagKeys/123',
52    /// 'tagValues/456')".
53    pub condition: std::option::Option<gtype::model::Expr>,
54
55    pub kind: std::option::Option<crate::model::policy_rule::Kind>,
56
57    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
58}
59
60impl PolicyRule {
61    pub fn new() -> Self {
62        std::default::Default::default()
63    }
64
65    /// Sets the value of [condition][crate::model::PolicyRule::condition].
66    pub fn set_condition<T>(mut self, v: T) -> Self
67    where
68        T: std::convert::Into<gtype::model::Expr>,
69    {
70        self.condition = std::option::Option::Some(v.into());
71        self
72    }
73
74    /// Sets or clears the value of [condition][crate::model::PolicyRule::condition].
75    pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
76    where
77        T: std::convert::Into<gtype::model::Expr>,
78    {
79        self.condition = v.map(|x| x.into());
80        self
81    }
82
83    /// Sets the value of [kind][crate::model::PolicyRule::kind].
84    ///
85    /// Note that all the setters affecting `kind` are mutually
86    /// exclusive.
87    pub fn set_kind<T: std::convert::Into<std::option::Option<crate::model::policy_rule::Kind>>>(
88        mut self,
89        v: T,
90    ) -> Self {
91        self.kind = v.into();
92        self
93    }
94
95    /// The value of [kind][crate::model::PolicyRule::kind]
96    /// if it holds a `Values`, `None` if the field is not set or
97    /// holds a different branch.
98    pub fn values(
99        &self,
100    ) -> std::option::Option<&std::boxed::Box<crate::model::policy_rule::StringValues>> {
101        #[allow(unreachable_patterns)]
102        self.kind.as_ref().and_then(|v| match v {
103            crate::model::policy_rule::Kind::Values(v) => std::option::Option::Some(v),
104            _ => std::option::Option::None,
105        })
106    }
107
108    /// Sets the value of [kind][crate::model::PolicyRule::kind]
109    /// to hold a `Values`.
110    ///
111    /// Note that all the setters affecting `kind` are
112    /// mutually exclusive.
113    pub fn set_values<
114        T: std::convert::Into<std::boxed::Box<crate::model::policy_rule::StringValues>>,
115    >(
116        mut self,
117        v: T,
118    ) -> Self {
119        self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::Values(v.into()));
120        self
121    }
122
123    /// The value of [kind][crate::model::PolicyRule::kind]
124    /// if it holds a `AllowAll`, `None` if the field is not set or
125    /// holds a different branch.
126    pub fn allow_all(&self) -> std::option::Option<&bool> {
127        #[allow(unreachable_patterns)]
128        self.kind.as_ref().and_then(|v| match v {
129            crate::model::policy_rule::Kind::AllowAll(v) => std::option::Option::Some(v),
130            _ => std::option::Option::None,
131        })
132    }
133
134    /// Sets the value of [kind][crate::model::PolicyRule::kind]
135    /// to hold a `AllowAll`.
136    ///
137    /// Note that all the setters affecting `kind` are
138    /// mutually exclusive.
139    pub fn set_allow_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
140        self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::AllowAll(v.into()));
141        self
142    }
143
144    /// The value of [kind][crate::model::PolicyRule::kind]
145    /// if it holds a `DenyAll`, `None` if the field is not set or
146    /// holds a different branch.
147    pub fn deny_all(&self) -> std::option::Option<&bool> {
148        #[allow(unreachable_patterns)]
149        self.kind.as_ref().and_then(|v| match v {
150            crate::model::policy_rule::Kind::DenyAll(v) => std::option::Option::Some(v),
151            _ => std::option::Option::None,
152        })
153    }
154
155    /// Sets the value of [kind][crate::model::PolicyRule::kind]
156    /// to hold a `DenyAll`.
157    ///
158    /// Note that all the setters affecting `kind` are
159    /// mutually exclusive.
160    pub fn set_deny_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
161        self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::DenyAll(v.into()));
162        self
163    }
164
165    /// The value of [kind][crate::model::PolicyRule::kind]
166    /// if it holds a `Enforce`, `None` if the field is not set or
167    /// holds a different branch.
168    pub fn enforce(&self) -> std::option::Option<&bool> {
169        #[allow(unreachable_patterns)]
170        self.kind.as_ref().and_then(|v| match v {
171            crate::model::policy_rule::Kind::Enforce(v) => std::option::Option::Some(v),
172            _ => std::option::Option::None,
173        })
174    }
175
176    /// Sets the value of [kind][crate::model::PolicyRule::kind]
177    /// to hold a `Enforce`.
178    ///
179    /// Note that all the setters affecting `kind` are
180    /// mutually exclusive.
181    pub fn set_enforce<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
182        self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::Enforce(v.into()));
183        self
184    }
185}
186
187impl wkt::message::Message for PolicyRule {
188    fn typename() -> &'static str {
189        "type.googleapis.com/google.cloud.securityposture.v1.PolicyRule"
190    }
191}
192
193#[doc(hidden)]
194impl<'de> serde::de::Deserialize<'de> for PolicyRule {
195    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
196    where
197        D: serde::Deserializer<'de>,
198    {
199        #[allow(non_camel_case_types)]
200        #[doc(hidden)]
201        #[derive(PartialEq, Eq, Hash)]
202        enum __FieldTag {
203            __values,
204            __allow_all,
205            __deny_all,
206            __enforce,
207            __condition,
208            Unknown(std::string::String),
209        }
210        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
211            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
212            where
213                D: serde::Deserializer<'de>,
214            {
215                struct Visitor;
216                impl<'de> serde::de::Visitor<'de> for Visitor {
217                    type Value = __FieldTag;
218                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
219                        formatter.write_str("a field name for PolicyRule")
220                    }
221                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
222                    where
223                        E: serde::de::Error,
224                    {
225                        use std::result::Result::Ok;
226                        use std::string::ToString;
227                        match value {
228                            "values" => Ok(__FieldTag::__values),
229                            "allowAll" => Ok(__FieldTag::__allow_all),
230                            "allow_all" => Ok(__FieldTag::__allow_all),
231                            "denyAll" => Ok(__FieldTag::__deny_all),
232                            "deny_all" => Ok(__FieldTag::__deny_all),
233                            "enforce" => Ok(__FieldTag::__enforce),
234                            "condition" => Ok(__FieldTag::__condition),
235                            _ => Ok(__FieldTag::Unknown(value.to_string())),
236                        }
237                    }
238                }
239                deserializer.deserialize_identifier(Visitor)
240            }
241        }
242        struct Visitor;
243        impl<'de> serde::de::Visitor<'de> for Visitor {
244            type Value = PolicyRule;
245            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
246                formatter.write_str("struct PolicyRule")
247            }
248            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
249            where
250                A: serde::de::MapAccess<'de>,
251            {
252                #[allow(unused_imports)]
253                use serde::de::Error;
254                use std::option::Option::Some;
255                let mut fields = std::collections::HashSet::new();
256                let mut result = Self::Value::new();
257                while let Some(tag) = map.next_key::<__FieldTag>()? {
258                    #[allow(clippy::match_single_binding)]
259                    match tag {
260                        __FieldTag::__values => {
261                            if !fields.insert(__FieldTag::__values) {
262                                return std::result::Result::Err(A::Error::duplicate_field(
263                                    "multiple values for values",
264                                ));
265                            }
266                            if result.kind.is_some() {
267                                return std::result::Result::Err(A::Error::duplicate_field(
268                                    "multiple values for `kind`, a oneof with full ID .google.cloud.securityposture.v1.PolicyRule.values, latest field was values",
269                                ));
270                            }
271                            result.kind =
272                                std::option::Option::Some(crate::model::policy_rule::Kind::Values(
273                                    map.next_value::<std::option::Option<
274                                        std::boxed::Box<crate::model::policy_rule::StringValues>,
275                                    >>()?
276                                    .unwrap_or_default(),
277                                ));
278                        }
279                        __FieldTag::__allow_all => {
280                            if !fields.insert(__FieldTag::__allow_all) {
281                                return std::result::Result::Err(A::Error::duplicate_field(
282                                    "multiple values for allow_all",
283                                ));
284                            }
285                            if result.kind.is_some() {
286                                return std::result::Result::Err(A::Error::duplicate_field(
287                                    "multiple values for `kind`, a oneof with full ID .google.cloud.securityposture.v1.PolicyRule.allow_all, latest field was allowAll",
288                                ));
289                            }
290                            result.kind = std::option::Option::Some(
291                                crate::model::policy_rule::Kind::AllowAll(
292                                    map.next_value::<std::option::Option<bool>>()?
293                                        .unwrap_or_default(),
294                                ),
295                            );
296                        }
297                        __FieldTag::__deny_all => {
298                            if !fields.insert(__FieldTag::__deny_all) {
299                                return std::result::Result::Err(A::Error::duplicate_field(
300                                    "multiple values for deny_all",
301                                ));
302                            }
303                            if result.kind.is_some() {
304                                return std::result::Result::Err(A::Error::duplicate_field(
305                                    "multiple values for `kind`, a oneof with full ID .google.cloud.securityposture.v1.PolicyRule.deny_all, latest field was denyAll",
306                                ));
307                            }
308                            result.kind = std::option::Option::Some(
309                                crate::model::policy_rule::Kind::DenyAll(
310                                    map.next_value::<std::option::Option<bool>>()?
311                                        .unwrap_or_default(),
312                                ),
313                            );
314                        }
315                        __FieldTag::__enforce => {
316                            if !fields.insert(__FieldTag::__enforce) {
317                                return std::result::Result::Err(A::Error::duplicate_field(
318                                    "multiple values for enforce",
319                                ));
320                            }
321                            if result.kind.is_some() {
322                                return std::result::Result::Err(A::Error::duplicate_field(
323                                    "multiple values for `kind`, a oneof with full ID .google.cloud.securityposture.v1.PolicyRule.enforce, latest field was enforce",
324                                ));
325                            }
326                            result.kind = std::option::Option::Some(
327                                crate::model::policy_rule::Kind::Enforce(
328                                    map.next_value::<std::option::Option<bool>>()?
329                                        .unwrap_or_default(),
330                                ),
331                            );
332                        }
333                        __FieldTag::__condition => {
334                            if !fields.insert(__FieldTag::__condition) {
335                                return std::result::Result::Err(A::Error::duplicate_field(
336                                    "multiple values for condition",
337                                ));
338                            }
339                            result.condition =
340                                map.next_value::<std::option::Option<gtype::model::Expr>>()?;
341                        }
342                        __FieldTag::Unknown(key) => {
343                            let value = map.next_value::<serde_json::Value>()?;
344                            result._unknown_fields.insert(key, value);
345                        }
346                    }
347                }
348                std::result::Result::Ok(result)
349            }
350        }
351        deserializer.deserialize_any(Visitor)
352    }
353}
354
355#[doc(hidden)]
356impl serde::ser::Serialize for PolicyRule {
357    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
358    where
359        S: serde::ser::Serializer,
360    {
361        use serde::ser::SerializeMap;
362        #[allow(unused_imports)]
363        use std::option::Option::Some;
364        let mut state = serializer.serialize_map(std::option::Option::None)?;
365        if let Some(value) = self.values() {
366            state.serialize_entry("values", value)?;
367        }
368        if let Some(value) = self.allow_all() {
369            state.serialize_entry("allowAll", value)?;
370        }
371        if let Some(value) = self.deny_all() {
372            state.serialize_entry("denyAll", value)?;
373        }
374        if let Some(value) = self.enforce() {
375            state.serialize_entry("enforce", value)?;
376        }
377        if self.condition.is_some() {
378            state.serialize_entry("condition", &self.condition)?;
379        }
380        if !self._unknown_fields.is_empty() {
381            for (key, value) in self._unknown_fields.iter() {
382                state.serialize_entry(key, &value)?;
383            }
384        }
385        state.end()
386    }
387}
388
389/// Defines additional types related to [PolicyRule].
390pub mod policy_rule {
391    #[allow(unused_imports)]
392    use super::*;
393
394    /// A message that holds specific allowed and denied values.
395    /// This message can define specific values and subtrees of the Resource
396    /// Manager resource hierarchy (`Organizations`, `Folders`, `Projects`) that
397    /// are allowed or denied. This is achieved by using the `under:` and
398    /// optional `is:` prefixes.
399    /// The `under:` prefix is used to denote resource subtree values.
400    /// The `is:` prefix is used to denote specific values, and is required only
401    /// if the value contains a ":". Values prefixed with "is:" are treated the
402    /// same as values with no prefix.
403    /// Ancestry subtrees must be in one of the following formats:
404    ///
405    /// - `projects/<project-id>` (for example, `projects/tokyo-rain-123`)
406    /// - `folders/<folder-id>` (for example, `folders/1234`)
407    /// - `organizations/<organization-id>` (for example, `organizations/1234`)
408    ///
409    /// The `supports_under` field of the associated `Constraint`  defines
410    /// whether ancestry prefixes can be used.
411    #[derive(Clone, Debug, Default, PartialEq)]
412    #[non_exhaustive]
413    pub struct StringValues {
414        /// List of values allowed at this resource.
415        pub allowed_values: std::vec::Vec<std::string::String>,
416
417        /// List of values denied at this resource.
418        pub denied_values: std::vec::Vec<std::string::String>,
419
420        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
421    }
422
423    impl StringValues {
424        pub fn new() -> Self {
425            std::default::Default::default()
426        }
427
428        /// Sets the value of [allowed_values][crate::model::policy_rule::StringValues::allowed_values].
429        pub fn set_allowed_values<T, V>(mut self, v: T) -> Self
430        where
431            T: std::iter::IntoIterator<Item = V>,
432            V: std::convert::Into<std::string::String>,
433        {
434            use std::iter::Iterator;
435            self.allowed_values = v.into_iter().map(|i| i.into()).collect();
436            self
437        }
438
439        /// Sets the value of [denied_values][crate::model::policy_rule::StringValues::denied_values].
440        pub fn set_denied_values<T, V>(mut self, v: T) -> Self
441        where
442            T: std::iter::IntoIterator<Item = V>,
443            V: std::convert::Into<std::string::String>,
444        {
445            use std::iter::Iterator;
446            self.denied_values = v.into_iter().map(|i| i.into()).collect();
447            self
448        }
449    }
450
451    impl wkt::message::Message for StringValues {
452        fn typename() -> &'static str {
453            "type.googleapis.com/google.cloud.securityposture.v1.PolicyRule.StringValues"
454        }
455    }
456
457    #[doc(hidden)]
458    impl<'de> serde::de::Deserialize<'de> for StringValues {
459        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
460        where
461            D: serde::Deserializer<'de>,
462        {
463            #[allow(non_camel_case_types)]
464            #[doc(hidden)]
465            #[derive(PartialEq, Eq, Hash)]
466            enum __FieldTag {
467                __allowed_values,
468                __denied_values,
469                Unknown(std::string::String),
470            }
471            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
472                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
473                where
474                    D: serde::Deserializer<'de>,
475                {
476                    struct Visitor;
477                    impl<'de> serde::de::Visitor<'de> for Visitor {
478                        type Value = __FieldTag;
479                        fn expecting(
480                            &self,
481                            formatter: &mut std::fmt::Formatter,
482                        ) -> std::fmt::Result {
483                            formatter.write_str("a field name for StringValues")
484                        }
485                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
486                        where
487                            E: serde::de::Error,
488                        {
489                            use std::result::Result::Ok;
490                            use std::string::ToString;
491                            match value {
492                                "allowedValues" => Ok(__FieldTag::__allowed_values),
493                                "allowed_values" => Ok(__FieldTag::__allowed_values),
494                                "deniedValues" => Ok(__FieldTag::__denied_values),
495                                "denied_values" => Ok(__FieldTag::__denied_values),
496                                _ => Ok(__FieldTag::Unknown(value.to_string())),
497                            }
498                        }
499                    }
500                    deserializer.deserialize_identifier(Visitor)
501                }
502            }
503            struct Visitor;
504            impl<'de> serde::de::Visitor<'de> for Visitor {
505                type Value = StringValues;
506                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
507                    formatter.write_str("struct StringValues")
508                }
509                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
510                where
511                    A: serde::de::MapAccess<'de>,
512                {
513                    #[allow(unused_imports)]
514                    use serde::de::Error;
515                    use std::option::Option::Some;
516                    let mut fields = std::collections::HashSet::new();
517                    let mut result = Self::Value::new();
518                    while let Some(tag) = map.next_key::<__FieldTag>()? {
519                        #[allow(clippy::match_single_binding)]
520                        match tag {
521                            __FieldTag::__allowed_values => {
522                                if !fields.insert(__FieldTag::__allowed_values) {
523                                    return std::result::Result::Err(A::Error::duplicate_field(
524                                        "multiple values for allowed_values",
525                                    ));
526                                }
527                                result.allowed_values = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
528                            }
529                            __FieldTag::__denied_values => {
530                                if !fields.insert(__FieldTag::__denied_values) {
531                                    return std::result::Result::Err(A::Error::duplicate_field(
532                                        "multiple values for denied_values",
533                                    ));
534                                }
535                                result.denied_values = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
536                            }
537                            __FieldTag::Unknown(key) => {
538                                let value = map.next_value::<serde_json::Value>()?;
539                                result._unknown_fields.insert(key, value);
540                            }
541                        }
542                    }
543                    std::result::Result::Ok(result)
544                }
545            }
546            deserializer.deserialize_any(Visitor)
547        }
548    }
549
550    #[doc(hidden)]
551    impl serde::ser::Serialize for StringValues {
552        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
553        where
554            S: serde::ser::Serializer,
555        {
556            use serde::ser::SerializeMap;
557            #[allow(unused_imports)]
558            use std::option::Option::Some;
559            let mut state = serializer.serialize_map(std::option::Option::None)?;
560            if !self.allowed_values.is_empty() {
561                state.serialize_entry("allowedValues", &self.allowed_values)?;
562            }
563            if !self.denied_values.is_empty() {
564                state.serialize_entry("deniedValues", &self.denied_values)?;
565            }
566            if !self._unknown_fields.is_empty() {
567                for (key, value) in self._unknown_fields.iter() {
568                    state.serialize_entry(key, &value)?;
569                }
570            }
571            state.end()
572        }
573    }
574
575    #[derive(Clone, Debug, PartialEq)]
576    #[non_exhaustive]
577    pub enum Kind {
578        /// List of values to be used for this policy rule. This field can be set
579        /// only in policies for list constraints.
580        Values(std::boxed::Box<crate::model::policy_rule::StringValues>),
581        /// Setting this to true means that all values are allowed. This field can
582        /// be set only in policies for list constraints.
583        AllowAll(bool),
584        /// Setting this to true means that all values are denied. This field can
585        /// be set only in policies for list constraints.
586        DenyAll(bool),
587        /// If `true`, then the policy is enforced. If `false`, then any
588        /// configuration is acceptable.
589        /// This field can be set only in policies for boolean constraints.
590        Enforce(bool),
591    }
592}
593
594/// A custom constraint defined by customers which can *only* be applied to the
595/// given resource types and organization.
596///
597/// By creating a custom constraint, customers can apply policies of this
598/// custom constraint. *Creating a custom constraint itself does NOT apply any
599/// policy enforcement*.
600#[derive(Clone, Debug, Default, PartialEq)]
601#[non_exhaustive]
602pub struct CustomConstraint {
603    /// Immutable. Name of the constraint. This is unique within the organization.
604    /// Format of the name should be
605    ///
606    ///
607    /// `organizations/{organization_id}/customConstraints/{custom_constraint_id}`
608    ///
609    /// Example: `organizations/123/customConstraints/custom.createOnlyE2TypeVms`
610    ///
611    /// The max length is 70 characters and the minimum length is 1. Note that the
612    /// prefix `organizations/{organization_id}/customConstraints/` is not counted.
613    pub name: std::string::String,
614
615    /// Immutable. The resource instance type on which this policy applies. Format
616    /// will be of the form : `<canonical service name>/<type>` Example:
617    ///
618    /// - `compute.googleapis.com/Instance`.
619    pub resource_types: std::vec::Vec<std::string::String>,
620
621    /// All the operations being applied for this constraint.
622    pub method_types: std::vec::Vec<crate::model::custom_constraint::MethodType>,
623
624    /// Org policy condition/expression. For example:
625    /// `resource.instanceName.matches("[production|test]_.*_(\d)+")` or,
626    /// `resource.management.auto_upgrade == true`
627    ///
628    /// The max length of the condition is 1000 characters.
629    pub condition: std::string::String,
630
631    /// Allow or deny type.
632    pub action_type: crate::model::custom_constraint::ActionType,
633
634    /// One line display name for the UI.
635    /// The max length of the display_name is 200 characters.
636    pub display_name: std::string::String,
637
638    /// Detailed information about this custom policy constraint.
639    /// The max length of the description is 2000 characters.
640    pub description: std::string::String,
641
642    /// Output only. The last time this custom constraint was updated. This
643    /// represents the last time that the `CreateCustomConstraint` or
644    /// `UpdateCustomConstraint` RPC was called
645    pub update_time: std::option::Option<wkt::Timestamp>,
646
647    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
648}
649
650impl CustomConstraint {
651    pub fn new() -> Self {
652        std::default::Default::default()
653    }
654
655    /// Sets the value of [name][crate::model::CustomConstraint::name].
656    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
657        self.name = v.into();
658        self
659    }
660
661    /// Sets the value of [resource_types][crate::model::CustomConstraint::resource_types].
662    pub fn set_resource_types<T, V>(mut self, v: T) -> Self
663    where
664        T: std::iter::IntoIterator<Item = V>,
665        V: std::convert::Into<std::string::String>,
666    {
667        use std::iter::Iterator;
668        self.resource_types = v.into_iter().map(|i| i.into()).collect();
669        self
670    }
671
672    /// Sets the value of [method_types][crate::model::CustomConstraint::method_types].
673    pub fn set_method_types<T, V>(mut self, v: T) -> Self
674    where
675        T: std::iter::IntoIterator<Item = V>,
676        V: std::convert::Into<crate::model::custom_constraint::MethodType>,
677    {
678        use std::iter::Iterator;
679        self.method_types = v.into_iter().map(|i| i.into()).collect();
680        self
681    }
682
683    /// Sets the value of [condition][crate::model::CustomConstraint::condition].
684    pub fn set_condition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
685        self.condition = v.into();
686        self
687    }
688
689    /// Sets the value of [action_type][crate::model::CustomConstraint::action_type].
690    pub fn set_action_type<T: std::convert::Into<crate::model::custom_constraint::ActionType>>(
691        mut self,
692        v: T,
693    ) -> Self {
694        self.action_type = v.into();
695        self
696    }
697
698    /// Sets the value of [display_name][crate::model::CustomConstraint::display_name].
699    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
700        self.display_name = v.into();
701        self
702    }
703
704    /// Sets the value of [description][crate::model::CustomConstraint::description].
705    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
706        self.description = v.into();
707        self
708    }
709
710    /// Sets the value of [update_time][crate::model::CustomConstraint::update_time].
711    pub fn set_update_time<T>(mut self, v: T) -> Self
712    where
713        T: std::convert::Into<wkt::Timestamp>,
714    {
715        self.update_time = std::option::Option::Some(v.into());
716        self
717    }
718
719    /// Sets or clears the value of [update_time][crate::model::CustomConstraint::update_time].
720    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
721    where
722        T: std::convert::Into<wkt::Timestamp>,
723    {
724        self.update_time = v.map(|x| x.into());
725        self
726    }
727}
728
729impl wkt::message::Message for CustomConstraint {
730    fn typename() -> &'static str {
731        "type.googleapis.com/google.cloud.securityposture.v1.CustomConstraint"
732    }
733}
734
735#[doc(hidden)]
736impl<'de> serde::de::Deserialize<'de> for CustomConstraint {
737    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
738    where
739        D: serde::Deserializer<'de>,
740    {
741        #[allow(non_camel_case_types)]
742        #[doc(hidden)]
743        #[derive(PartialEq, Eq, Hash)]
744        enum __FieldTag {
745            __name,
746            __resource_types,
747            __method_types,
748            __condition,
749            __action_type,
750            __display_name,
751            __description,
752            __update_time,
753            Unknown(std::string::String),
754        }
755        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
756            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
757            where
758                D: serde::Deserializer<'de>,
759            {
760                struct Visitor;
761                impl<'de> serde::de::Visitor<'de> for Visitor {
762                    type Value = __FieldTag;
763                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
764                        formatter.write_str("a field name for CustomConstraint")
765                    }
766                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
767                    where
768                        E: serde::de::Error,
769                    {
770                        use std::result::Result::Ok;
771                        use std::string::ToString;
772                        match value {
773                            "name" => Ok(__FieldTag::__name),
774                            "resourceTypes" => Ok(__FieldTag::__resource_types),
775                            "resource_types" => Ok(__FieldTag::__resource_types),
776                            "methodTypes" => Ok(__FieldTag::__method_types),
777                            "method_types" => Ok(__FieldTag::__method_types),
778                            "condition" => Ok(__FieldTag::__condition),
779                            "actionType" => Ok(__FieldTag::__action_type),
780                            "action_type" => Ok(__FieldTag::__action_type),
781                            "displayName" => Ok(__FieldTag::__display_name),
782                            "display_name" => Ok(__FieldTag::__display_name),
783                            "description" => Ok(__FieldTag::__description),
784                            "updateTime" => Ok(__FieldTag::__update_time),
785                            "update_time" => Ok(__FieldTag::__update_time),
786                            _ => Ok(__FieldTag::Unknown(value.to_string())),
787                        }
788                    }
789                }
790                deserializer.deserialize_identifier(Visitor)
791            }
792        }
793        struct Visitor;
794        impl<'de> serde::de::Visitor<'de> for Visitor {
795            type Value = CustomConstraint;
796            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
797                formatter.write_str("struct CustomConstraint")
798            }
799            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
800            where
801                A: serde::de::MapAccess<'de>,
802            {
803                #[allow(unused_imports)]
804                use serde::de::Error;
805                use std::option::Option::Some;
806                let mut fields = std::collections::HashSet::new();
807                let mut result = Self::Value::new();
808                while let Some(tag) = map.next_key::<__FieldTag>()? {
809                    #[allow(clippy::match_single_binding)]
810                    match tag {
811                        __FieldTag::__name => {
812                            if !fields.insert(__FieldTag::__name) {
813                                return std::result::Result::Err(A::Error::duplicate_field(
814                                    "multiple values for name",
815                                ));
816                            }
817                            result.name = map
818                                .next_value::<std::option::Option<std::string::String>>()?
819                                .unwrap_or_default();
820                        }
821                        __FieldTag::__resource_types => {
822                            if !fields.insert(__FieldTag::__resource_types) {
823                                return std::result::Result::Err(A::Error::duplicate_field(
824                                    "multiple values for resource_types",
825                                ));
826                            }
827                            result.resource_types = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
828                        }
829                        __FieldTag::__method_types => {
830                            if !fields.insert(__FieldTag::__method_types) {
831                                return std::result::Result::Err(A::Error::duplicate_field(
832                                    "multiple values for method_types",
833                                ));
834                            }
835                            result.method_types = map
836                                .next_value::<std::option::Option<
837                                    std::vec::Vec<crate::model::custom_constraint::MethodType>,
838                                >>()?
839                                .unwrap_or_default();
840                        }
841                        __FieldTag::__condition => {
842                            if !fields.insert(__FieldTag::__condition) {
843                                return std::result::Result::Err(A::Error::duplicate_field(
844                                    "multiple values for condition",
845                                ));
846                            }
847                            result.condition = map
848                                .next_value::<std::option::Option<std::string::String>>()?
849                                .unwrap_or_default();
850                        }
851                        __FieldTag::__action_type => {
852                            if !fields.insert(__FieldTag::__action_type) {
853                                return std::result::Result::Err(A::Error::duplicate_field(
854                                    "multiple values for action_type",
855                                ));
856                            }
857                            result.action_type =
858                                map.next_value::<std::option::Option<
859                                    crate::model::custom_constraint::ActionType,
860                                >>()?
861                                .unwrap_or_default();
862                        }
863                        __FieldTag::__display_name => {
864                            if !fields.insert(__FieldTag::__display_name) {
865                                return std::result::Result::Err(A::Error::duplicate_field(
866                                    "multiple values for display_name",
867                                ));
868                            }
869                            result.display_name = map
870                                .next_value::<std::option::Option<std::string::String>>()?
871                                .unwrap_or_default();
872                        }
873                        __FieldTag::__description => {
874                            if !fields.insert(__FieldTag::__description) {
875                                return std::result::Result::Err(A::Error::duplicate_field(
876                                    "multiple values for description",
877                                ));
878                            }
879                            result.description = map
880                                .next_value::<std::option::Option<std::string::String>>()?
881                                .unwrap_or_default();
882                        }
883                        __FieldTag::__update_time => {
884                            if !fields.insert(__FieldTag::__update_time) {
885                                return std::result::Result::Err(A::Error::duplicate_field(
886                                    "multiple values for update_time",
887                                ));
888                            }
889                            result.update_time =
890                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
891                        }
892                        __FieldTag::Unknown(key) => {
893                            let value = map.next_value::<serde_json::Value>()?;
894                            result._unknown_fields.insert(key, value);
895                        }
896                    }
897                }
898                std::result::Result::Ok(result)
899            }
900        }
901        deserializer.deserialize_any(Visitor)
902    }
903}
904
905#[doc(hidden)]
906impl serde::ser::Serialize for CustomConstraint {
907    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
908    where
909        S: serde::ser::Serializer,
910    {
911        use serde::ser::SerializeMap;
912        #[allow(unused_imports)]
913        use std::option::Option::Some;
914        let mut state = serializer.serialize_map(std::option::Option::None)?;
915        if !self.name.is_empty() {
916            state.serialize_entry("name", &self.name)?;
917        }
918        if !self.resource_types.is_empty() {
919            state.serialize_entry("resourceTypes", &self.resource_types)?;
920        }
921        if !self.method_types.is_empty() {
922            state.serialize_entry("methodTypes", &self.method_types)?;
923        }
924        if !self.condition.is_empty() {
925            state.serialize_entry("condition", &self.condition)?;
926        }
927        if !wkt::internal::is_default(&self.action_type) {
928            state.serialize_entry("actionType", &self.action_type)?;
929        }
930        if !self.display_name.is_empty() {
931            state.serialize_entry("displayName", &self.display_name)?;
932        }
933        if !self.description.is_empty() {
934            state.serialize_entry("description", &self.description)?;
935        }
936        if self.update_time.is_some() {
937            state.serialize_entry("updateTime", &self.update_time)?;
938        }
939        if !self._unknown_fields.is_empty() {
940            for (key, value) in self._unknown_fields.iter() {
941                state.serialize_entry(key, &value)?;
942            }
943        }
944        state.end()
945    }
946}
947
948/// Defines additional types related to [CustomConstraint].
949pub mod custom_constraint {
950    #[allow(unused_imports)]
951    use super::*;
952
953    /// The operation for which this constraint will be applied. To apply this
954    /// constraint only when creating new VMs, the `method_types` should be
955    /// `CREATE` only. To apply this constraint when creating or deleting
956    /// VMs, the `method_types` should be `CREATE` and `DELETE`.
957    ///
958    /// `UPDATE` only custom constraints are not supported. Use `CREATE` or
959    /// `CREATE, UPDATE`.
960    ///
961    /// # Working with unknown values
962    ///
963    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
964    /// additional enum variants at any time. Adding new variants is not considered
965    /// a breaking change. Applications should write their code in anticipation of:
966    ///
967    /// - New values appearing in future releases of the client library, **and**
968    /// - New values received dynamically, without application changes.
969    ///
970    /// Please consult the [Working with enums] section in the user guide for some
971    /// guidelines.
972    ///
973    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
974    #[derive(Clone, Debug, PartialEq)]
975    #[non_exhaustive]
976    pub enum MethodType {
977        /// Unspecified. Results in an error.
978        Unspecified,
979        /// Constraint applied when creating the resource.
980        Create,
981        /// Constraint applied when updating the resource.
982        Update,
983        /// Constraint applied when deleting the resource.
984        /// Not supported yet.
985        Delete,
986        /// If set, the enum was initialized with an unknown value.
987        ///
988        /// Applications can examine the value using [MethodType::value] or
989        /// [MethodType::name].
990        UnknownValue(method_type::UnknownValue),
991    }
992
993    #[doc(hidden)]
994    pub mod method_type {
995        #[allow(unused_imports)]
996        use super::*;
997        #[derive(Clone, Debug, PartialEq)]
998        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
999    }
1000
1001    impl MethodType {
1002        /// Gets the enum value.
1003        ///
1004        /// Returns `None` if the enum contains an unknown value deserialized from
1005        /// the string representation of enums.
1006        pub fn value(&self) -> std::option::Option<i32> {
1007            match self {
1008                Self::Unspecified => std::option::Option::Some(0),
1009                Self::Create => std::option::Option::Some(1),
1010                Self::Update => std::option::Option::Some(2),
1011                Self::Delete => std::option::Option::Some(3),
1012                Self::UnknownValue(u) => u.0.value(),
1013            }
1014        }
1015
1016        /// Gets the enum value as a string.
1017        ///
1018        /// Returns `None` if the enum contains an unknown value deserialized from
1019        /// the integer representation of enums.
1020        pub fn name(&self) -> std::option::Option<&str> {
1021            match self {
1022                Self::Unspecified => std::option::Option::Some("METHOD_TYPE_UNSPECIFIED"),
1023                Self::Create => std::option::Option::Some("CREATE"),
1024                Self::Update => std::option::Option::Some("UPDATE"),
1025                Self::Delete => std::option::Option::Some("DELETE"),
1026                Self::UnknownValue(u) => u.0.name(),
1027            }
1028        }
1029    }
1030
1031    impl std::default::Default for MethodType {
1032        fn default() -> Self {
1033            use std::convert::From;
1034            Self::from(0)
1035        }
1036    }
1037
1038    impl std::fmt::Display for MethodType {
1039        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1040            wkt::internal::display_enum(f, self.name(), self.value())
1041        }
1042    }
1043
1044    impl std::convert::From<i32> for MethodType {
1045        fn from(value: i32) -> Self {
1046            match value {
1047                0 => Self::Unspecified,
1048                1 => Self::Create,
1049                2 => Self::Update,
1050                3 => Self::Delete,
1051                _ => Self::UnknownValue(method_type::UnknownValue(
1052                    wkt::internal::UnknownEnumValue::Integer(value),
1053                )),
1054            }
1055        }
1056    }
1057
1058    impl std::convert::From<&str> for MethodType {
1059        fn from(value: &str) -> Self {
1060            use std::string::ToString;
1061            match value {
1062                "METHOD_TYPE_UNSPECIFIED" => Self::Unspecified,
1063                "CREATE" => Self::Create,
1064                "UPDATE" => Self::Update,
1065                "DELETE" => Self::Delete,
1066                _ => Self::UnknownValue(method_type::UnknownValue(
1067                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1068                )),
1069            }
1070        }
1071    }
1072
1073    impl serde::ser::Serialize for MethodType {
1074        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1075        where
1076            S: serde::Serializer,
1077        {
1078            match self {
1079                Self::Unspecified => serializer.serialize_i32(0),
1080                Self::Create => serializer.serialize_i32(1),
1081                Self::Update => serializer.serialize_i32(2),
1082                Self::Delete => serializer.serialize_i32(3),
1083                Self::UnknownValue(u) => u.0.serialize(serializer),
1084            }
1085        }
1086    }
1087
1088    impl<'de> serde::de::Deserialize<'de> for MethodType {
1089        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1090        where
1091            D: serde::Deserializer<'de>,
1092        {
1093            deserializer.deserialize_any(wkt::internal::EnumVisitor::<MethodType>::new(
1094                ".google.cloud.securityposture.v1.CustomConstraint.MethodType",
1095            ))
1096        }
1097    }
1098
1099    /// Allow or deny type.
1100    ///
1101    /// # Working with unknown values
1102    ///
1103    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1104    /// additional enum variants at any time. Adding new variants is not considered
1105    /// a breaking change. Applications should write their code in anticipation of:
1106    ///
1107    /// - New values appearing in future releases of the client library, **and**
1108    /// - New values received dynamically, without application changes.
1109    ///
1110    /// Please consult the [Working with enums] section in the user guide for some
1111    /// guidelines.
1112    ///
1113    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1114    #[derive(Clone, Debug, PartialEq)]
1115    #[non_exhaustive]
1116    pub enum ActionType {
1117        /// Unspecified. Results in an error.
1118        Unspecified,
1119        /// Allowed action type.
1120        Allow,
1121        /// Deny action type.
1122        Deny,
1123        /// If set, the enum was initialized with an unknown value.
1124        ///
1125        /// Applications can examine the value using [ActionType::value] or
1126        /// [ActionType::name].
1127        UnknownValue(action_type::UnknownValue),
1128    }
1129
1130    #[doc(hidden)]
1131    pub mod action_type {
1132        #[allow(unused_imports)]
1133        use super::*;
1134        #[derive(Clone, Debug, PartialEq)]
1135        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1136    }
1137
1138    impl ActionType {
1139        /// Gets the enum value.
1140        ///
1141        /// Returns `None` if the enum contains an unknown value deserialized from
1142        /// the string representation of enums.
1143        pub fn value(&self) -> std::option::Option<i32> {
1144            match self {
1145                Self::Unspecified => std::option::Option::Some(0),
1146                Self::Allow => std::option::Option::Some(1),
1147                Self::Deny => std::option::Option::Some(2),
1148                Self::UnknownValue(u) => u.0.value(),
1149            }
1150        }
1151
1152        /// Gets the enum value as a string.
1153        ///
1154        /// Returns `None` if the enum contains an unknown value deserialized from
1155        /// the integer representation of enums.
1156        pub fn name(&self) -> std::option::Option<&str> {
1157            match self {
1158                Self::Unspecified => std::option::Option::Some("ACTION_TYPE_UNSPECIFIED"),
1159                Self::Allow => std::option::Option::Some("ALLOW"),
1160                Self::Deny => std::option::Option::Some("DENY"),
1161                Self::UnknownValue(u) => u.0.name(),
1162            }
1163        }
1164    }
1165
1166    impl std::default::Default for ActionType {
1167        fn default() -> Self {
1168            use std::convert::From;
1169            Self::from(0)
1170        }
1171    }
1172
1173    impl std::fmt::Display for ActionType {
1174        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1175            wkt::internal::display_enum(f, self.name(), self.value())
1176        }
1177    }
1178
1179    impl std::convert::From<i32> for ActionType {
1180        fn from(value: i32) -> Self {
1181            match value {
1182                0 => Self::Unspecified,
1183                1 => Self::Allow,
1184                2 => Self::Deny,
1185                _ => Self::UnknownValue(action_type::UnknownValue(
1186                    wkt::internal::UnknownEnumValue::Integer(value),
1187                )),
1188            }
1189        }
1190    }
1191
1192    impl std::convert::From<&str> for ActionType {
1193        fn from(value: &str) -> Self {
1194            use std::string::ToString;
1195            match value {
1196                "ACTION_TYPE_UNSPECIFIED" => Self::Unspecified,
1197                "ALLOW" => Self::Allow,
1198                "DENY" => Self::Deny,
1199                _ => Self::UnknownValue(action_type::UnknownValue(
1200                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1201                )),
1202            }
1203        }
1204    }
1205
1206    impl serde::ser::Serialize for ActionType {
1207        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1208        where
1209            S: serde::Serializer,
1210        {
1211            match self {
1212                Self::Unspecified => serializer.serialize_i32(0),
1213                Self::Allow => serializer.serialize_i32(1),
1214                Self::Deny => serializer.serialize_i32(2),
1215                Self::UnknownValue(u) => u.0.serialize(serializer),
1216            }
1217        }
1218    }
1219
1220    impl<'de> serde::de::Deserialize<'de> for ActionType {
1221        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1222        where
1223            D: serde::Deserializer<'de>,
1224        {
1225            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ActionType>::new(
1226                ".google.cloud.securityposture.v1.CustomConstraint.ActionType",
1227            ))
1228        }
1229    }
1230}
1231
1232/// Message for Org Policy Canned Constraint.
1233#[derive(Clone, Debug, Default, PartialEq)]
1234#[non_exhaustive]
1235pub struct OrgPolicyConstraint {
1236    /// Required. Org Policy Canned Constraint id.
1237    pub canned_constraint_id: std::string::String,
1238
1239    /// Required. Org PolicySpec rules.
1240    pub policy_rules: std::vec::Vec<crate::model::PolicyRule>,
1241
1242    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1243}
1244
1245impl OrgPolicyConstraint {
1246    pub fn new() -> Self {
1247        std::default::Default::default()
1248    }
1249
1250    /// Sets the value of [canned_constraint_id][crate::model::OrgPolicyConstraint::canned_constraint_id].
1251    pub fn set_canned_constraint_id<T: std::convert::Into<std::string::String>>(
1252        mut self,
1253        v: T,
1254    ) -> Self {
1255        self.canned_constraint_id = v.into();
1256        self
1257    }
1258
1259    /// Sets the value of [policy_rules][crate::model::OrgPolicyConstraint::policy_rules].
1260    pub fn set_policy_rules<T, V>(mut self, v: T) -> Self
1261    where
1262        T: std::iter::IntoIterator<Item = V>,
1263        V: std::convert::Into<crate::model::PolicyRule>,
1264    {
1265        use std::iter::Iterator;
1266        self.policy_rules = v.into_iter().map(|i| i.into()).collect();
1267        self
1268    }
1269}
1270
1271impl wkt::message::Message for OrgPolicyConstraint {
1272    fn typename() -> &'static str {
1273        "type.googleapis.com/google.cloud.securityposture.v1.OrgPolicyConstraint"
1274    }
1275}
1276
1277#[doc(hidden)]
1278impl<'de> serde::de::Deserialize<'de> for OrgPolicyConstraint {
1279    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1280    where
1281        D: serde::Deserializer<'de>,
1282    {
1283        #[allow(non_camel_case_types)]
1284        #[doc(hidden)]
1285        #[derive(PartialEq, Eq, Hash)]
1286        enum __FieldTag {
1287            __canned_constraint_id,
1288            __policy_rules,
1289            Unknown(std::string::String),
1290        }
1291        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1292            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1293            where
1294                D: serde::Deserializer<'de>,
1295            {
1296                struct Visitor;
1297                impl<'de> serde::de::Visitor<'de> for Visitor {
1298                    type Value = __FieldTag;
1299                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1300                        formatter.write_str("a field name for OrgPolicyConstraint")
1301                    }
1302                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1303                    where
1304                        E: serde::de::Error,
1305                    {
1306                        use std::result::Result::Ok;
1307                        use std::string::ToString;
1308                        match value {
1309                            "cannedConstraintId" => Ok(__FieldTag::__canned_constraint_id),
1310                            "canned_constraint_id" => Ok(__FieldTag::__canned_constraint_id),
1311                            "policyRules" => Ok(__FieldTag::__policy_rules),
1312                            "policy_rules" => Ok(__FieldTag::__policy_rules),
1313                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1314                        }
1315                    }
1316                }
1317                deserializer.deserialize_identifier(Visitor)
1318            }
1319        }
1320        struct Visitor;
1321        impl<'de> serde::de::Visitor<'de> for Visitor {
1322            type Value = OrgPolicyConstraint;
1323            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1324                formatter.write_str("struct OrgPolicyConstraint")
1325            }
1326            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1327            where
1328                A: serde::de::MapAccess<'de>,
1329            {
1330                #[allow(unused_imports)]
1331                use serde::de::Error;
1332                use std::option::Option::Some;
1333                let mut fields = std::collections::HashSet::new();
1334                let mut result = Self::Value::new();
1335                while let Some(tag) = map.next_key::<__FieldTag>()? {
1336                    #[allow(clippy::match_single_binding)]
1337                    match tag {
1338                        __FieldTag::__canned_constraint_id => {
1339                            if !fields.insert(__FieldTag::__canned_constraint_id) {
1340                                return std::result::Result::Err(A::Error::duplicate_field(
1341                                    "multiple values for canned_constraint_id",
1342                                ));
1343                            }
1344                            result.canned_constraint_id = map
1345                                .next_value::<std::option::Option<std::string::String>>()?
1346                                .unwrap_or_default();
1347                        }
1348                        __FieldTag::__policy_rules => {
1349                            if !fields.insert(__FieldTag::__policy_rules) {
1350                                return std::result::Result::Err(A::Error::duplicate_field(
1351                                    "multiple values for policy_rules",
1352                                ));
1353                            }
1354                            result.policy_rules = map.next_value::<std::option::Option<std::vec::Vec<crate::model::PolicyRule>>>()?.unwrap_or_default();
1355                        }
1356                        __FieldTag::Unknown(key) => {
1357                            let value = map.next_value::<serde_json::Value>()?;
1358                            result._unknown_fields.insert(key, value);
1359                        }
1360                    }
1361                }
1362                std::result::Result::Ok(result)
1363            }
1364        }
1365        deserializer.deserialize_any(Visitor)
1366    }
1367}
1368
1369#[doc(hidden)]
1370impl serde::ser::Serialize for OrgPolicyConstraint {
1371    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1372    where
1373        S: serde::ser::Serializer,
1374    {
1375        use serde::ser::SerializeMap;
1376        #[allow(unused_imports)]
1377        use std::option::Option::Some;
1378        let mut state = serializer.serialize_map(std::option::Option::None)?;
1379        if !self.canned_constraint_id.is_empty() {
1380            state.serialize_entry("cannedConstraintId", &self.canned_constraint_id)?;
1381        }
1382        if !self.policy_rules.is_empty() {
1383            state.serialize_entry("policyRules", &self.policy_rules)?;
1384        }
1385        if !self._unknown_fields.is_empty() {
1386            for (key, value) in self._unknown_fields.iter() {
1387                state.serialize_entry(key, &value)?;
1388            }
1389        }
1390        state.end()
1391    }
1392}
1393
1394/// Message for Org Policy Custom Constraint.
1395#[derive(Clone, Debug, Default, PartialEq)]
1396#[non_exhaustive]
1397pub struct OrgPolicyConstraintCustom {
1398    /// Required. Org Policy Custom Constraint.
1399    pub custom_constraint: std::option::Option<crate::model::CustomConstraint>,
1400
1401    /// Required. Org Policyspec rules.
1402    pub policy_rules: std::vec::Vec<crate::model::PolicyRule>,
1403
1404    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1405}
1406
1407impl OrgPolicyConstraintCustom {
1408    pub fn new() -> Self {
1409        std::default::Default::default()
1410    }
1411
1412    /// Sets the value of [custom_constraint][crate::model::OrgPolicyConstraintCustom::custom_constraint].
1413    pub fn set_custom_constraint<T>(mut self, v: T) -> Self
1414    where
1415        T: std::convert::Into<crate::model::CustomConstraint>,
1416    {
1417        self.custom_constraint = std::option::Option::Some(v.into());
1418        self
1419    }
1420
1421    /// Sets or clears the value of [custom_constraint][crate::model::OrgPolicyConstraintCustom::custom_constraint].
1422    pub fn set_or_clear_custom_constraint<T>(mut self, v: std::option::Option<T>) -> Self
1423    where
1424        T: std::convert::Into<crate::model::CustomConstraint>,
1425    {
1426        self.custom_constraint = v.map(|x| x.into());
1427        self
1428    }
1429
1430    /// Sets the value of [policy_rules][crate::model::OrgPolicyConstraintCustom::policy_rules].
1431    pub fn set_policy_rules<T, V>(mut self, v: T) -> Self
1432    where
1433        T: std::iter::IntoIterator<Item = V>,
1434        V: std::convert::Into<crate::model::PolicyRule>,
1435    {
1436        use std::iter::Iterator;
1437        self.policy_rules = v.into_iter().map(|i| i.into()).collect();
1438        self
1439    }
1440}
1441
1442impl wkt::message::Message for OrgPolicyConstraintCustom {
1443    fn typename() -> &'static str {
1444        "type.googleapis.com/google.cloud.securityposture.v1.OrgPolicyConstraintCustom"
1445    }
1446}
1447
1448#[doc(hidden)]
1449impl<'de> serde::de::Deserialize<'de> for OrgPolicyConstraintCustom {
1450    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1451    where
1452        D: serde::Deserializer<'de>,
1453    {
1454        #[allow(non_camel_case_types)]
1455        #[doc(hidden)]
1456        #[derive(PartialEq, Eq, Hash)]
1457        enum __FieldTag {
1458            __custom_constraint,
1459            __policy_rules,
1460            Unknown(std::string::String),
1461        }
1462        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1463            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1464            where
1465                D: serde::Deserializer<'de>,
1466            {
1467                struct Visitor;
1468                impl<'de> serde::de::Visitor<'de> for Visitor {
1469                    type Value = __FieldTag;
1470                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1471                        formatter.write_str("a field name for OrgPolicyConstraintCustom")
1472                    }
1473                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1474                    where
1475                        E: serde::de::Error,
1476                    {
1477                        use std::result::Result::Ok;
1478                        use std::string::ToString;
1479                        match value {
1480                            "customConstraint" => Ok(__FieldTag::__custom_constraint),
1481                            "custom_constraint" => Ok(__FieldTag::__custom_constraint),
1482                            "policyRules" => Ok(__FieldTag::__policy_rules),
1483                            "policy_rules" => Ok(__FieldTag::__policy_rules),
1484                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1485                        }
1486                    }
1487                }
1488                deserializer.deserialize_identifier(Visitor)
1489            }
1490        }
1491        struct Visitor;
1492        impl<'de> serde::de::Visitor<'de> for Visitor {
1493            type Value = OrgPolicyConstraintCustom;
1494            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1495                formatter.write_str("struct OrgPolicyConstraintCustom")
1496            }
1497            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1498            where
1499                A: serde::de::MapAccess<'de>,
1500            {
1501                #[allow(unused_imports)]
1502                use serde::de::Error;
1503                use std::option::Option::Some;
1504                let mut fields = std::collections::HashSet::new();
1505                let mut result = Self::Value::new();
1506                while let Some(tag) = map.next_key::<__FieldTag>()? {
1507                    #[allow(clippy::match_single_binding)]
1508                    match tag {
1509                        __FieldTag::__custom_constraint => {
1510                            if !fields.insert(__FieldTag::__custom_constraint) {
1511                                return std::result::Result::Err(A::Error::duplicate_field(
1512                                    "multiple values for custom_constraint",
1513                                ));
1514                            }
1515                            result.custom_constraint = map
1516                                .next_value::<std::option::Option<crate::model::CustomConstraint>>(
1517                                )?;
1518                        }
1519                        __FieldTag::__policy_rules => {
1520                            if !fields.insert(__FieldTag::__policy_rules) {
1521                                return std::result::Result::Err(A::Error::duplicate_field(
1522                                    "multiple values for policy_rules",
1523                                ));
1524                            }
1525                            result.policy_rules = map.next_value::<std::option::Option<std::vec::Vec<crate::model::PolicyRule>>>()?.unwrap_or_default();
1526                        }
1527                        __FieldTag::Unknown(key) => {
1528                            let value = map.next_value::<serde_json::Value>()?;
1529                            result._unknown_fields.insert(key, value);
1530                        }
1531                    }
1532                }
1533                std::result::Result::Ok(result)
1534            }
1535        }
1536        deserializer.deserialize_any(Visitor)
1537    }
1538}
1539
1540#[doc(hidden)]
1541impl serde::ser::Serialize for OrgPolicyConstraintCustom {
1542    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1543    where
1544        S: serde::ser::Serializer,
1545    {
1546        use serde::ser::SerializeMap;
1547        #[allow(unused_imports)]
1548        use std::option::Option::Some;
1549        let mut state = serializer.serialize_map(std::option::Option::None)?;
1550        if self.custom_constraint.is_some() {
1551            state.serialize_entry("customConstraint", &self.custom_constraint)?;
1552        }
1553        if !self.policy_rules.is_empty() {
1554            state.serialize_entry("policyRules", &self.policy_rules)?;
1555        }
1556        if !self._unknown_fields.is_empty() {
1557            for (key, value) in self._unknown_fields.iter() {
1558                state.serialize_entry(key, &value)?;
1559            }
1560        }
1561        state.end()
1562    }
1563}
1564
1565/// Represents the metadata of the long-running operation.
1566#[derive(Clone, Debug, Default, PartialEq)]
1567#[non_exhaustive]
1568pub struct OperationMetadata {
1569    /// Output only. The time the operation was created.
1570    pub create_time: std::option::Option<wkt::Timestamp>,
1571
1572    /// Output only. The time the operation finished running.
1573    pub end_time: std::option::Option<wkt::Timestamp>,
1574
1575    /// Output only. Server-defined resource path for the target of the operation.
1576    pub target: std::string::String,
1577
1578    /// Output only. Name of the verb executed by the operation.
1579    pub verb: std::string::String,
1580
1581    /// Output only. Human-readable status of the operation, if any.
1582    pub status_message: std::string::String,
1583
1584    /// Output only. Identifies whether the user has requested cancellation
1585    /// of the operation. Operations that have been cancelled successfully
1586    /// have [Operation.error][] value with a
1587    /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
1588    /// `Code.CANCELLED`.
1589    ///
1590    /// [google.rpc.Status.code]: rpc::model::Status::code
1591    pub requested_cancellation: bool,
1592
1593    /// Output only. API version used to start the operation.
1594    pub api_version: std::string::String,
1595
1596    /// Output only. This is a output only optional field which will be filled only
1597    /// in cases where PostureDeployments enter failure states like UPDATE_FAILED
1598    /// or CREATE_FAILED or DELETE_FAILED.
1599    pub error_message: std::string::String,
1600
1601    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1602}
1603
1604impl OperationMetadata {
1605    pub fn new() -> Self {
1606        std::default::Default::default()
1607    }
1608
1609    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
1610    pub fn set_create_time<T>(mut self, v: T) -> Self
1611    where
1612        T: std::convert::Into<wkt::Timestamp>,
1613    {
1614        self.create_time = std::option::Option::Some(v.into());
1615        self
1616    }
1617
1618    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
1619    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1620    where
1621        T: std::convert::Into<wkt::Timestamp>,
1622    {
1623        self.create_time = v.map(|x| x.into());
1624        self
1625    }
1626
1627    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
1628    pub fn set_end_time<T>(mut self, v: T) -> Self
1629    where
1630        T: std::convert::Into<wkt::Timestamp>,
1631    {
1632        self.end_time = std::option::Option::Some(v.into());
1633        self
1634    }
1635
1636    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
1637    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
1638    where
1639        T: std::convert::Into<wkt::Timestamp>,
1640    {
1641        self.end_time = v.map(|x| x.into());
1642        self
1643    }
1644
1645    /// Sets the value of [target][crate::model::OperationMetadata::target].
1646    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1647        self.target = v.into();
1648        self
1649    }
1650
1651    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
1652    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1653        self.verb = v.into();
1654        self
1655    }
1656
1657    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
1658    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1659        self.status_message = v.into();
1660        self
1661    }
1662
1663    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
1664    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1665        self.requested_cancellation = v.into();
1666        self
1667    }
1668
1669    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
1670    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1671        self.api_version = v.into();
1672        self
1673    }
1674
1675    /// Sets the value of [error_message][crate::model::OperationMetadata::error_message].
1676    pub fn set_error_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1677        self.error_message = v.into();
1678        self
1679    }
1680}
1681
1682impl wkt::message::Message for OperationMetadata {
1683    fn typename() -> &'static str {
1684        "type.googleapis.com/google.cloud.securityposture.v1.OperationMetadata"
1685    }
1686}
1687
1688#[doc(hidden)]
1689impl<'de> serde::de::Deserialize<'de> for OperationMetadata {
1690    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1691    where
1692        D: serde::Deserializer<'de>,
1693    {
1694        #[allow(non_camel_case_types)]
1695        #[doc(hidden)]
1696        #[derive(PartialEq, Eq, Hash)]
1697        enum __FieldTag {
1698            __create_time,
1699            __end_time,
1700            __target,
1701            __verb,
1702            __status_message,
1703            __requested_cancellation,
1704            __api_version,
1705            __error_message,
1706            Unknown(std::string::String),
1707        }
1708        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1709            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1710            where
1711                D: serde::Deserializer<'de>,
1712            {
1713                struct Visitor;
1714                impl<'de> serde::de::Visitor<'de> for Visitor {
1715                    type Value = __FieldTag;
1716                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1717                        formatter.write_str("a field name for OperationMetadata")
1718                    }
1719                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1720                    where
1721                        E: serde::de::Error,
1722                    {
1723                        use std::result::Result::Ok;
1724                        use std::string::ToString;
1725                        match value {
1726                            "createTime" => Ok(__FieldTag::__create_time),
1727                            "create_time" => Ok(__FieldTag::__create_time),
1728                            "endTime" => Ok(__FieldTag::__end_time),
1729                            "end_time" => Ok(__FieldTag::__end_time),
1730                            "target" => Ok(__FieldTag::__target),
1731                            "verb" => Ok(__FieldTag::__verb),
1732                            "statusMessage" => Ok(__FieldTag::__status_message),
1733                            "status_message" => Ok(__FieldTag::__status_message),
1734                            "requestedCancellation" => Ok(__FieldTag::__requested_cancellation),
1735                            "requested_cancellation" => Ok(__FieldTag::__requested_cancellation),
1736                            "apiVersion" => Ok(__FieldTag::__api_version),
1737                            "api_version" => Ok(__FieldTag::__api_version),
1738                            "errorMessage" => Ok(__FieldTag::__error_message),
1739                            "error_message" => Ok(__FieldTag::__error_message),
1740                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1741                        }
1742                    }
1743                }
1744                deserializer.deserialize_identifier(Visitor)
1745            }
1746        }
1747        struct Visitor;
1748        impl<'de> serde::de::Visitor<'de> for Visitor {
1749            type Value = OperationMetadata;
1750            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1751                formatter.write_str("struct OperationMetadata")
1752            }
1753            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1754            where
1755                A: serde::de::MapAccess<'de>,
1756            {
1757                #[allow(unused_imports)]
1758                use serde::de::Error;
1759                use std::option::Option::Some;
1760                let mut fields = std::collections::HashSet::new();
1761                let mut result = Self::Value::new();
1762                while let Some(tag) = map.next_key::<__FieldTag>()? {
1763                    #[allow(clippy::match_single_binding)]
1764                    match tag {
1765                        __FieldTag::__create_time => {
1766                            if !fields.insert(__FieldTag::__create_time) {
1767                                return std::result::Result::Err(A::Error::duplicate_field(
1768                                    "multiple values for create_time",
1769                                ));
1770                            }
1771                            result.create_time =
1772                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1773                        }
1774                        __FieldTag::__end_time => {
1775                            if !fields.insert(__FieldTag::__end_time) {
1776                                return std::result::Result::Err(A::Error::duplicate_field(
1777                                    "multiple values for end_time",
1778                                ));
1779                            }
1780                            result.end_time =
1781                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1782                        }
1783                        __FieldTag::__target => {
1784                            if !fields.insert(__FieldTag::__target) {
1785                                return std::result::Result::Err(A::Error::duplicate_field(
1786                                    "multiple values for target",
1787                                ));
1788                            }
1789                            result.target = map
1790                                .next_value::<std::option::Option<std::string::String>>()?
1791                                .unwrap_or_default();
1792                        }
1793                        __FieldTag::__verb => {
1794                            if !fields.insert(__FieldTag::__verb) {
1795                                return std::result::Result::Err(A::Error::duplicate_field(
1796                                    "multiple values for verb",
1797                                ));
1798                            }
1799                            result.verb = map
1800                                .next_value::<std::option::Option<std::string::String>>()?
1801                                .unwrap_or_default();
1802                        }
1803                        __FieldTag::__status_message => {
1804                            if !fields.insert(__FieldTag::__status_message) {
1805                                return std::result::Result::Err(A::Error::duplicate_field(
1806                                    "multiple values for status_message",
1807                                ));
1808                            }
1809                            result.status_message = map
1810                                .next_value::<std::option::Option<std::string::String>>()?
1811                                .unwrap_or_default();
1812                        }
1813                        __FieldTag::__requested_cancellation => {
1814                            if !fields.insert(__FieldTag::__requested_cancellation) {
1815                                return std::result::Result::Err(A::Error::duplicate_field(
1816                                    "multiple values for requested_cancellation",
1817                                ));
1818                            }
1819                            result.requested_cancellation = map
1820                                .next_value::<std::option::Option<bool>>()?
1821                                .unwrap_or_default();
1822                        }
1823                        __FieldTag::__api_version => {
1824                            if !fields.insert(__FieldTag::__api_version) {
1825                                return std::result::Result::Err(A::Error::duplicate_field(
1826                                    "multiple values for api_version",
1827                                ));
1828                            }
1829                            result.api_version = map
1830                                .next_value::<std::option::Option<std::string::String>>()?
1831                                .unwrap_or_default();
1832                        }
1833                        __FieldTag::__error_message => {
1834                            if !fields.insert(__FieldTag::__error_message) {
1835                                return std::result::Result::Err(A::Error::duplicate_field(
1836                                    "multiple values for error_message",
1837                                ));
1838                            }
1839                            result.error_message = map
1840                                .next_value::<std::option::Option<std::string::String>>()?
1841                                .unwrap_or_default();
1842                        }
1843                        __FieldTag::Unknown(key) => {
1844                            let value = map.next_value::<serde_json::Value>()?;
1845                            result._unknown_fields.insert(key, value);
1846                        }
1847                    }
1848                }
1849                std::result::Result::Ok(result)
1850            }
1851        }
1852        deserializer.deserialize_any(Visitor)
1853    }
1854}
1855
1856#[doc(hidden)]
1857impl serde::ser::Serialize for OperationMetadata {
1858    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1859    where
1860        S: serde::ser::Serializer,
1861    {
1862        use serde::ser::SerializeMap;
1863        #[allow(unused_imports)]
1864        use std::option::Option::Some;
1865        let mut state = serializer.serialize_map(std::option::Option::None)?;
1866        if self.create_time.is_some() {
1867            state.serialize_entry("createTime", &self.create_time)?;
1868        }
1869        if self.end_time.is_some() {
1870            state.serialize_entry("endTime", &self.end_time)?;
1871        }
1872        if !self.target.is_empty() {
1873            state.serialize_entry("target", &self.target)?;
1874        }
1875        if !self.verb.is_empty() {
1876            state.serialize_entry("verb", &self.verb)?;
1877        }
1878        if !self.status_message.is_empty() {
1879            state.serialize_entry("statusMessage", &self.status_message)?;
1880        }
1881        if !wkt::internal::is_default(&self.requested_cancellation) {
1882            state.serialize_entry("requestedCancellation", &self.requested_cancellation)?;
1883        }
1884        if !self.api_version.is_empty() {
1885            state.serialize_entry("apiVersion", &self.api_version)?;
1886        }
1887        if !self.error_message.is_empty() {
1888            state.serialize_entry("errorMessage", &self.error_message)?;
1889        }
1890        if !self._unknown_fields.is_empty() {
1891            for (key, value) in self._unknown_fields.iter() {
1892                state.serialize_entry(key, &value)?;
1893            }
1894        }
1895        state.end()
1896    }
1897}
1898
1899/// Postures
1900/// Definition of a Posture.
1901#[derive(Clone, Debug, Default, PartialEq)]
1902#[non_exhaustive]
1903pub struct Posture {
1904    /// Required. Identifier. The name of this Posture resource, in the format of
1905    /// organizations/{org_id}/locations/{location_id}/postures/{posture}.
1906    pub name: std::string::String,
1907
1908    /// Required. State of Posture resource.
1909    pub state: crate::model::posture::State,
1910
1911    /// Output only. Immutable. The revision ID of the posture.
1912    /// The format is an 8-character hexadecimal string.
1913    /// <https://google.aip.dev/162>
1914    pub revision_id: std::string::String,
1915
1916    /// Output only. The timestamp that the posture was created.
1917    pub create_time: std::option::Option<wkt::Timestamp>,
1918
1919    /// Output only. The timestamp that the posture was updated.
1920    pub update_time: std::option::Option<wkt::Timestamp>,
1921
1922    /// Optional. User provided description of the posture.
1923    pub description: std::string::String,
1924
1925    /// Required. List of Policy sets.
1926    pub policy_sets: std::vec::Vec<crate::model::PolicySet>,
1927
1928    /// Optional. An opaque tag indicating the current version of the Posture, used
1929    /// for concurrency control. When the `Posture` is returned from either a
1930    /// `GetPosture` or a `ListPostures` request, this `etag` indicates the version
1931    /// of the current `Posture` to use when executing a read-modify-write loop.
1932    ///
1933    /// When the `Posture` is used in a `UpdatePosture` method, use the `etag`
1934    /// value that was returned from a `GetPosture` request as part of a
1935    /// read-modify-write loop for concurrency control. Not setting the `etag` in a
1936    /// `UpdatePosture` request will result in an unconditional write of the
1937    /// `Posture`.
1938    pub etag: std::string::String,
1939
1940    /// Optional. User annotations. These attributes can only be set and used by
1941    /// the user, and not by Google Security Postures.
1942    /// .
1943    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
1944
1945    /// Output only. Whether or not this Posture is in the process of being
1946    /// updated.
1947    pub reconciling: bool,
1948
1949    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1950}
1951
1952impl Posture {
1953    pub fn new() -> Self {
1954        std::default::Default::default()
1955    }
1956
1957    /// Sets the value of [name][crate::model::Posture::name].
1958    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1959        self.name = v.into();
1960        self
1961    }
1962
1963    /// Sets the value of [state][crate::model::Posture::state].
1964    pub fn set_state<T: std::convert::Into<crate::model::posture::State>>(mut self, v: T) -> Self {
1965        self.state = v.into();
1966        self
1967    }
1968
1969    /// Sets the value of [revision_id][crate::model::Posture::revision_id].
1970    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1971        self.revision_id = v.into();
1972        self
1973    }
1974
1975    /// Sets the value of [create_time][crate::model::Posture::create_time].
1976    pub fn set_create_time<T>(mut self, v: T) -> Self
1977    where
1978        T: std::convert::Into<wkt::Timestamp>,
1979    {
1980        self.create_time = std::option::Option::Some(v.into());
1981        self
1982    }
1983
1984    /// Sets or clears the value of [create_time][crate::model::Posture::create_time].
1985    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1986    where
1987        T: std::convert::Into<wkt::Timestamp>,
1988    {
1989        self.create_time = v.map(|x| x.into());
1990        self
1991    }
1992
1993    /// Sets the value of [update_time][crate::model::Posture::update_time].
1994    pub fn set_update_time<T>(mut self, v: T) -> Self
1995    where
1996        T: std::convert::Into<wkt::Timestamp>,
1997    {
1998        self.update_time = std::option::Option::Some(v.into());
1999        self
2000    }
2001
2002    /// Sets or clears the value of [update_time][crate::model::Posture::update_time].
2003    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2004    where
2005        T: std::convert::Into<wkt::Timestamp>,
2006    {
2007        self.update_time = v.map(|x| x.into());
2008        self
2009    }
2010
2011    /// Sets the value of [description][crate::model::Posture::description].
2012    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2013        self.description = v.into();
2014        self
2015    }
2016
2017    /// Sets the value of [policy_sets][crate::model::Posture::policy_sets].
2018    pub fn set_policy_sets<T, V>(mut self, v: T) -> Self
2019    where
2020        T: std::iter::IntoIterator<Item = V>,
2021        V: std::convert::Into<crate::model::PolicySet>,
2022    {
2023        use std::iter::Iterator;
2024        self.policy_sets = v.into_iter().map(|i| i.into()).collect();
2025        self
2026    }
2027
2028    /// Sets the value of [etag][crate::model::Posture::etag].
2029    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2030        self.etag = v.into();
2031        self
2032    }
2033
2034    /// Sets the value of [annotations][crate::model::Posture::annotations].
2035    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
2036    where
2037        T: std::iter::IntoIterator<Item = (K, V)>,
2038        K: std::convert::Into<std::string::String>,
2039        V: std::convert::Into<std::string::String>,
2040    {
2041        use std::iter::Iterator;
2042        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2043        self
2044    }
2045
2046    /// Sets the value of [reconciling][crate::model::Posture::reconciling].
2047    pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2048        self.reconciling = v.into();
2049        self
2050    }
2051}
2052
2053impl wkt::message::Message for Posture {
2054    fn typename() -> &'static str {
2055        "type.googleapis.com/google.cloud.securityposture.v1.Posture"
2056    }
2057}
2058
2059#[doc(hidden)]
2060impl<'de> serde::de::Deserialize<'de> for Posture {
2061    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2062    where
2063        D: serde::Deserializer<'de>,
2064    {
2065        #[allow(non_camel_case_types)]
2066        #[doc(hidden)]
2067        #[derive(PartialEq, Eq, Hash)]
2068        enum __FieldTag {
2069            __name,
2070            __state,
2071            __revision_id,
2072            __create_time,
2073            __update_time,
2074            __description,
2075            __policy_sets,
2076            __etag,
2077            __annotations,
2078            __reconciling,
2079            Unknown(std::string::String),
2080        }
2081        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2082            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2083            where
2084                D: serde::Deserializer<'de>,
2085            {
2086                struct Visitor;
2087                impl<'de> serde::de::Visitor<'de> for Visitor {
2088                    type Value = __FieldTag;
2089                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2090                        formatter.write_str("a field name for Posture")
2091                    }
2092                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2093                    where
2094                        E: serde::de::Error,
2095                    {
2096                        use std::result::Result::Ok;
2097                        use std::string::ToString;
2098                        match value {
2099                            "name" => Ok(__FieldTag::__name),
2100                            "state" => Ok(__FieldTag::__state),
2101                            "revisionId" => Ok(__FieldTag::__revision_id),
2102                            "revision_id" => Ok(__FieldTag::__revision_id),
2103                            "createTime" => Ok(__FieldTag::__create_time),
2104                            "create_time" => Ok(__FieldTag::__create_time),
2105                            "updateTime" => Ok(__FieldTag::__update_time),
2106                            "update_time" => Ok(__FieldTag::__update_time),
2107                            "description" => Ok(__FieldTag::__description),
2108                            "policySets" => Ok(__FieldTag::__policy_sets),
2109                            "policy_sets" => Ok(__FieldTag::__policy_sets),
2110                            "etag" => Ok(__FieldTag::__etag),
2111                            "annotations" => Ok(__FieldTag::__annotations),
2112                            "reconciling" => Ok(__FieldTag::__reconciling),
2113                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2114                        }
2115                    }
2116                }
2117                deserializer.deserialize_identifier(Visitor)
2118            }
2119        }
2120        struct Visitor;
2121        impl<'de> serde::de::Visitor<'de> for Visitor {
2122            type Value = Posture;
2123            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2124                formatter.write_str("struct Posture")
2125            }
2126            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2127            where
2128                A: serde::de::MapAccess<'de>,
2129            {
2130                #[allow(unused_imports)]
2131                use serde::de::Error;
2132                use std::option::Option::Some;
2133                let mut fields = std::collections::HashSet::new();
2134                let mut result = Self::Value::new();
2135                while let Some(tag) = map.next_key::<__FieldTag>()? {
2136                    #[allow(clippy::match_single_binding)]
2137                    match tag {
2138                        __FieldTag::__name => {
2139                            if !fields.insert(__FieldTag::__name) {
2140                                return std::result::Result::Err(A::Error::duplicate_field(
2141                                    "multiple values for name",
2142                                ));
2143                            }
2144                            result.name = map
2145                                .next_value::<std::option::Option<std::string::String>>()?
2146                                .unwrap_or_default();
2147                        }
2148                        __FieldTag::__state => {
2149                            if !fields.insert(__FieldTag::__state) {
2150                                return std::result::Result::Err(A::Error::duplicate_field(
2151                                    "multiple values for state",
2152                                ));
2153                            }
2154                            result.state = map
2155                                .next_value::<std::option::Option<crate::model::posture::State>>()?
2156                                .unwrap_or_default();
2157                        }
2158                        __FieldTag::__revision_id => {
2159                            if !fields.insert(__FieldTag::__revision_id) {
2160                                return std::result::Result::Err(A::Error::duplicate_field(
2161                                    "multiple values for revision_id",
2162                                ));
2163                            }
2164                            result.revision_id = map
2165                                .next_value::<std::option::Option<std::string::String>>()?
2166                                .unwrap_or_default();
2167                        }
2168                        __FieldTag::__create_time => {
2169                            if !fields.insert(__FieldTag::__create_time) {
2170                                return std::result::Result::Err(A::Error::duplicate_field(
2171                                    "multiple values for create_time",
2172                                ));
2173                            }
2174                            result.create_time =
2175                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
2176                        }
2177                        __FieldTag::__update_time => {
2178                            if !fields.insert(__FieldTag::__update_time) {
2179                                return std::result::Result::Err(A::Error::duplicate_field(
2180                                    "multiple values for update_time",
2181                                ));
2182                            }
2183                            result.update_time =
2184                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
2185                        }
2186                        __FieldTag::__description => {
2187                            if !fields.insert(__FieldTag::__description) {
2188                                return std::result::Result::Err(A::Error::duplicate_field(
2189                                    "multiple values for description",
2190                                ));
2191                            }
2192                            result.description = map
2193                                .next_value::<std::option::Option<std::string::String>>()?
2194                                .unwrap_or_default();
2195                        }
2196                        __FieldTag::__policy_sets => {
2197                            if !fields.insert(__FieldTag::__policy_sets) {
2198                                return std::result::Result::Err(A::Error::duplicate_field(
2199                                    "multiple values for policy_sets",
2200                                ));
2201                            }
2202                            result.policy_sets = map.next_value::<std::option::Option<std::vec::Vec<crate::model::PolicySet>>>()?.unwrap_or_default();
2203                        }
2204                        __FieldTag::__etag => {
2205                            if !fields.insert(__FieldTag::__etag) {
2206                                return std::result::Result::Err(A::Error::duplicate_field(
2207                                    "multiple values for etag",
2208                                ));
2209                            }
2210                            result.etag = map
2211                                .next_value::<std::option::Option<std::string::String>>()?
2212                                .unwrap_or_default();
2213                        }
2214                        __FieldTag::__annotations => {
2215                            if !fields.insert(__FieldTag::__annotations) {
2216                                return std::result::Result::Err(A::Error::duplicate_field(
2217                                    "multiple values for annotations",
2218                                ));
2219                            }
2220                            result.annotations = map
2221                                .next_value::<std::option::Option<
2222                                    std::collections::HashMap<
2223                                        std::string::String,
2224                                        std::string::String,
2225                                    >,
2226                                >>()?
2227                                .unwrap_or_default();
2228                        }
2229                        __FieldTag::__reconciling => {
2230                            if !fields.insert(__FieldTag::__reconciling) {
2231                                return std::result::Result::Err(A::Error::duplicate_field(
2232                                    "multiple values for reconciling",
2233                                ));
2234                            }
2235                            result.reconciling = map
2236                                .next_value::<std::option::Option<bool>>()?
2237                                .unwrap_or_default();
2238                        }
2239                        __FieldTag::Unknown(key) => {
2240                            let value = map.next_value::<serde_json::Value>()?;
2241                            result._unknown_fields.insert(key, value);
2242                        }
2243                    }
2244                }
2245                std::result::Result::Ok(result)
2246            }
2247        }
2248        deserializer.deserialize_any(Visitor)
2249    }
2250}
2251
2252#[doc(hidden)]
2253impl serde::ser::Serialize for Posture {
2254    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2255    where
2256        S: serde::ser::Serializer,
2257    {
2258        use serde::ser::SerializeMap;
2259        #[allow(unused_imports)]
2260        use std::option::Option::Some;
2261        let mut state = serializer.serialize_map(std::option::Option::None)?;
2262        if !self.name.is_empty() {
2263            state.serialize_entry("name", &self.name)?;
2264        }
2265        if !wkt::internal::is_default(&self.state) {
2266            state.serialize_entry("state", &self.state)?;
2267        }
2268        if !self.revision_id.is_empty() {
2269            state.serialize_entry("revisionId", &self.revision_id)?;
2270        }
2271        if self.create_time.is_some() {
2272            state.serialize_entry("createTime", &self.create_time)?;
2273        }
2274        if self.update_time.is_some() {
2275            state.serialize_entry("updateTime", &self.update_time)?;
2276        }
2277        if !self.description.is_empty() {
2278            state.serialize_entry("description", &self.description)?;
2279        }
2280        if !self.policy_sets.is_empty() {
2281            state.serialize_entry("policySets", &self.policy_sets)?;
2282        }
2283        if !self.etag.is_empty() {
2284            state.serialize_entry("etag", &self.etag)?;
2285        }
2286        if !self.annotations.is_empty() {
2287            state.serialize_entry("annotations", &self.annotations)?;
2288        }
2289        if !wkt::internal::is_default(&self.reconciling) {
2290            state.serialize_entry("reconciling", &self.reconciling)?;
2291        }
2292        if !self._unknown_fields.is_empty() {
2293            for (key, value) in self._unknown_fields.iter() {
2294                state.serialize_entry(key, &value)?;
2295            }
2296        }
2297        state.end()
2298    }
2299}
2300
2301/// Defines additional types related to [Posture].
2302pub mod posture {
2303    #[allow(unused_imports)]
2304    use super::*;
2305
2306    /// State of a Posture.
2307    ///
2308    /// # Working with unknown values
2309    ///
2310    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2311    /// additional enum variants at any time. Adding new variants is not considered
2312    /// a breaking change. Applications should write their code in anticipation of:
2313    ///
2314    /// - New values appearing in future releases of the client library, **and**
2315    /// - New values received dynamically, without application changes.
2316    ///
2317    /// Please consult the [Working with enums] section in the user guide for some
2318    /// guidelines.
2319    ///
2320    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2321    #[derive(Clone, Debug, PartialEq)]
2322    #[non_exhaustive]
2323    pub enum State {
2324        /// Unspecified operation state.
2325        Unspecified,
2326        /// The Posture is marked deprecated when it is not in use by the user.
2327        Deprecated,
2328        /// The Posture is created successfully but is not yet ready for usage.
2329        Draft,
2330        /// The Posture state is active. Ready for use/deployments.
2331        Active,
2332        /// If set, the enum was initialized with an unknown value.
2333        ///
2334        /// Applications can examine the value using [State::value] or
2335        /// [State::name].
2336        UnknownValue(state::UnknownValue),
2337    }
2338
2339    #[doc(hidden)]
2340    pub mod state {
2341        #[allow(unused_imports)]
2342        use super::*;
2343        #[derive(Clone, Debug, PartialEq)]
2344        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2345    }
2346
2347    impl State {
2348        /// Gets the enum value.
2349        ///
2350        /// Returns `None` if the enum contains an unknown value deserialized from
2351        /// the string representation of enums.
2352        pub fn value(&self) -> std::option::Option<i32> {
2353            match self {
2354                Self::Unspecified => std::option::Option::Some(0),
2355                Self::Deprecated => std::option::Option::Some(1),
2356                Self::Draft => std::option::Option::Some(2),
2357                Self::Active => std::option::Option::Some(3),
2358                Self::UnknownValue(u) => u.0.value(),
2359            }
2360        }
2361
2362        /// Gets the enum value as a string.
2363        ///
2364        /// Returns `None` if the enum contains an unknown value deserialized from
2365        /// the integer representation of enums.
2366        pub fn name(&self) -> std::option::Option<&str> {
2367            match self {
2368                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2369                Self::Deprecated => std::option::Option::Some("DEPRECATED"),
2370                Self::Draft => std::option::Option::Some("DRAFT"),
2371                Self::Active => std::option::Option::Some("ACTIVE"),
2372                Self::UnknownValue(u) => u.0.name(),
2373            }
2374        }
2375    }
2376
2377    impl std::default::Default for State {
2378        fn default() -> Self {
2379            use std::convert::From;
2380            Self::from(0)
2381        }
2382    }
2383
2384    impl std::fmt::Display for State {
2385        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2386            wkt::internal::display_enum(f, self.name(), self.value())
2387        }
2388    }
2389
2390    impl std::convert::From<i32> for State {
2391        fn from(value: i32) -> Self {
2392            match value {
2393                0 => Self::Unspecified,
2394                1 => Self::Deprecated,
2395                2 => Self::Draft,
2396                3 => Self::Active,
2397                _ => Self::UnknownValue(state::UnknownValue(
2398                    wkt::internal::UnknownEnumValue::Integer(value),
2399                )),
2400            }
2401        }
2402    }
2403
2404    impl std::convert::From<&str> for State {
2405        fn from(value: &str) -> Self {
2406            use std::string::ToString;
2407            match value {
2408                "STATE_UNSPECIFIED" => Self::Unspecified,
2409                "DEPRECATED" => Self::Deprecated,
2410                "DRAFT" => Self::Draft,
2411                "ACTIVE" => Self::Active,
2412                _ => Self::UnknownValue(state::UnknownValue(
2413                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2414                )),
2415            }
2416        }
2417    }
2418
2419    impl serde::ser::Serialize for State {
2420        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2421        where
2422            S: serde::Serializer,
2423        {
2424            match self {
2425                Self::Unspecified => serializer.serialize_i32(0),
2426                Self::Deprecated => serializer.serialize_i32(1),
2427                Self::Draft => serializer.serialize_i32(2),
2428                Self::Active => serializer.serialize_i32(3),
2429                Self::UnknownValue(u) => u.0.serialize(serializer),
2430            }
2431        }
2432    }
2433
2434    impl<'de> serde::de::Deserialize<'de> for State {
2435        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2436        where
2437            D: serde::Deserializer<'de>,
2438        {
2439            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2440                ".google.cloud.securityposture.v1.Posture.State",
2441            ))
2442        }
2443    }
2444}
2445
2446/// PolicySet representation.
2447#[derive(Clone, Debug, Default, PartialEq)]
2448#[non_exhaustive]
2449pub struct PolicySet {
2450    /// Required. ID of the Policy set.
2451    pub policy_set_id: std::string::String,
2452
2453    /// Optional. Description of the Policy set.
2454    pub description: std::string::String,
2455
2456    /// Required. List of policies.
2457    pub policies: std::vec::Vec<crate::model::Policy>,
2458
2459    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2460}
2461
2462impl PolicySet {
2463    pub fn new() -> Self {
2464        std::default::Default::default()
2465    }
2466
2467    /// Sets the value of [policy_set_id][crate::model::PolicySet::policy_set_id].
2468    pub fn set_policy_set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2469        self.policy_set_id = v.into();
2470        self
2471    }
2472
2473    /// Sets the value of [description][crate::model::PolicySet::description].
2474    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2475        self.description = v.into();
2476        self
2477    }
2478
2479    /// Sets the value of [policies][crate::model::PolicySet::policies].
2480    pub fn set_policies<T, V>(mut self, v: T) -> Self
2481    where
2482        T: std::iter::IntoIterator<Item = V>,
2483        V: std::convert::Into<crate::model::Policy>,
2484    {
2485        use std::iter::Iterator;
2486        self.policies = v.into_iter().map(|i| i.into()).collect();
2487        self
2488    }
2489}
2490
2491impl wkt::message::Message for PolicySet {
2492    fn typename() -> &'static str {
2493        "type.googleapis.com/google.cloud.securityposture.v1.PolicySet"
2494    }
2495}
2496
2497#[doc(hidden)]
2498impl<'de> serde::de::Deserialize<'de> for PolicySet {
2499    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2500    where
2501        D: serde::Deserializer<'de>,
2502    {
2503        #[allow(non_camel_case_types)]
2504        #[doc(hidden)]
2505        #[derive(PartialEq, Eq, Hash)]
2506        enum __FieldTag {
2507            __policy_set_id,
2508            __description,
2509            __policies,
2510            Unknown(std::string::String),
2511        }
2512        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2513            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2514            where
2515                D: serde::Deserializer<'de>,
2516            {
2517                struct Visitor;
2518                impl<'de> serde::de::Visitor<'de> for Visitor {
2519                    type Value = __FieldTag;
2520                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2521                        formatter.write_str("a field name for PolicySet")
2522                    }
2523                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2524                    where
2525                        E: serde::de::Error,
2526                    {
2527                        use std::result::Result::Ok;
2528                        use std::string::ToString;
2529                        match value {
2530                            "policySetId" => Ok(__FieldTag::__policy_set_id),
2531                            "policy_set_id" => Ok(__FieldTag::__policy_set_id),
2532                            "description" => Ok(__FieldTag::__description),
2533                            "policies" => Ok(__FieldTag::__policies),
2534                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2535                        }
2536                    }
2537                }
2538                deserializer.deserialize_identifier(Visitor)
2539            }
2540        }
2541        struct Visitor;
2542        impl<'de> serde::de::Visitor<'de> for Visitor {
2543            type Value = PolicySet;
2544            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2545                formatter.write_str("struct PolicySet")
2546            }
2547            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2548            where
2549                A: serde::de::MapAccess<'de>,
2550            {
2551                #[allow(unused_imports)]
2552                use serde::de::Error;
2553                use std::option::Option::Some;
2554                let mut fields = std::collections::HashSet::new();
2555                let mut result = Self::Value::new();
2556                while let Some(tag) = map.next_key::<__FieldTag>()? {
2557                    #[allow(clippy::match_single_binding)]
2558                    match tag {
2559                        __FieldTag::__policy_set_id => {
2560                            if !fields.insert(__FieldTag::__policy_set_id) {
2561                                return std::result::Result::Err(A::Error::duplicate_field(
2562                                    "multiple values for policy_set_id",
2563                                ));
2564                            }
2565                            result.policy_set_id = map
2566                                .next_value::<std::option::Option<std::string::String>>()?
2567                                .unwrap_or_default();
2568                        }
2569                        __FieldTag::__description => {
2570                            if !fields.insert(__FieldTag::__description) {
2571                                return std::result::Result::Err(A::Error::duplicate_field(
2572                                    "multiple values for description",
2573                                ));
2574                            }
2575                            result.description = map
2576                                .next_value::<std::option::Option<std::string::String>>()?
2577                                .unwrap_or_default();
2578                        }
2579                        __FieldTag::__policies => {
2580                            if !fields.insert(__FieldTag::__policies) {
2581                                return std::result::Result::Err(A::Error::duplicate_field(
2582                                    "multiple values for policies",
2583                                ));
2584                            }
2585                            result.policies = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Policy>>>()?.unwrap_or_default();
2586                        }
2587                        __FieldTag::Unknown(key) => {
2588                            let value = map.next_value::<serde_json::Value>()?;
2589                            result._unknown_fields.insert(key, value);
2590                        }
2591                    }
2592                }
2593                std::result::Result::Ok(result)
2594            }
2595        }
2596        deserializer.deserialize_any(Visitor)
2597    }
2598}
2599
2600#[doc(hidden)]
2601impl serde::ser::Serialize for PolicySet {
2602    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2603    where
2604        S: serde::ser::Serializer,
2605    {
2606        use serde::ser::SerializeMap;
2607        #[allow(unused_imports)]
2608        use std::option::Option::Some;
2609        let mut state = serializer.serialize_map(std::option::Option::None)?;
2610        if !self.policy_set_id.is_empty() {
2611            state.serialize_entry("policySetId", &self.policy_set_id)?;
2612        }
2613        if !self.description.is_empty() {
2614            state.serialize_entry("description", &self.description)?;
2615        }
2616        if !self.policies.is_empty() {
2617            state.serialize_entry("policies", &self.policies)?;
2618        }
2619        if !self._unknown_fields.is_empty() {
2620            for (key, value) in self._unknown_fields.iter() {
2621                state.serialize_entry(key, &value)?;
2622            }
2623        }
2624        state.end()
2625    }
2626}
2627
2628/// Policy representation.
2629#[derive(Clone, Debug, Default, PartialEq)]
2630#[non_exhaustive]
2631pub struct Policy {
2632    /// Required. ID of the Policy that is user generated, immutable and unique
2633    /// within the scope of a policy set.
2634    pub policy_id: std::string::String,
2635
2636    /// Optional. Contains list of mapping for a Policy to a standard and control.
2637    pub compliance_standards: std::vec::Vec<crate::model::policy::ComplianceStandard>,
2638
2639    /// Required. Constraint details.
2640    pub constraint: std::option::Option<crate::model::Constraint>,
2641
2642    /// Optional. Description of the Policy.
2643    pub description: std::string::String,
2644
2645    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2646}
2647
2648impl Policy {
2649    pub fn new() -> Self {
2650        std::default::Default::default()
2651    }
2652
2653    /// Sets the value of [policy_id][crate::model::Policy::policy_id].
2654    pub fn set_policy_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2655        self.policy_id = v.into();
2656        self
2657    }
2658
2659    /// Sets the value of [compliance_standards][crate::model::Policy::compliance_standards].
2660    pub fn set_compliance_standards<T, V>(mut self, v: T) -> Self
2661    where
2662        T: std::iter::IntoIterator<Item = V>,
2663        V: std::convert::Into<crate::model::policy::ComplianceStandard>,
2664    {
2665        use std::iter::Iterator;
2666        self.compliance_standards = v.into_iter().map(|i| i.into()).collect();
2667        self
2668    }
2669
2670    /// Sets the value of [constraint][crate::model::Policy::constraint].
2671    pub fn set_constraint<T>(mut self, v: T) -> Self
2672    where
2673        T: std::convert::Into<crate::model::Constraint>,
2674    {
2675        self.constraint = std::option::Option::Some(v.into());
2676        self
2677    }
2678
2679    /// Sets or clears the value of [constraint][crate::model::Policy::constraint].
2680    pub fn set_or_clear_constraint<T>(mut self, v: std::option::Option<T>) -> Self
2681    where
2682        T: std::convert::Into<crate::model::Constraint>,
2683    {
2684        self.constraint = v.map(|x| x.into());
2685        self
2686    }
2687
2688    /// Sets the value of [description][crate::model::Policy::description].
2689    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2690        self.description = v.into();
2691        self
2692    }
2693}
2694
2695impl wkt::message::Message for Policy {
2696    fn typename() -> &'static str {
2697        "type.googleapis.com/google.cloud.securityposture.v1.Policy"
2698    }
2699}
2700
2701#[doc(hidden)]
2702impl<'de> serde::de::Deserialize<'de> for Policy {
2703    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2704    where
2705        D: serde::Deserializer<'de>,
2706    {
2707        #[allow(non_camel_case_types)]
2708        #[doc(hidden)]
2709        #[derive(PartialEq, Eq, Hash)]
2710        enum __FieldTag {
2711            __policy_id,
2712            __compliance_standards,
2713            __constraint,
2714            __description,
2715            Unknown(std::string::String),
2716        }
2717        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2718            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2719            where
2720                D: serde::Deserializer<'de>,
2721            {
2722                struct Visitor;
2723                impl<'de> serde::de::Visitor<'de> for Visitor {
2724                    type Value = __FieldTag;
2725                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2726                        formatter.write_str("a field name for Policy")
2727                    }
2728                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2729                    where
2730                        E: serde::de::Error,
2731                    {
2732                        use std::result::Result::Ok;
2733                        use std::string::ToString;
2734                        match value {
2735                            "policyId" => Ok(__FieldTag::__policy_id),
2736                            "policy_id" => Ok(__FieldTag::__policy_id),
2737                            "complianceStandards" => Ok(__FieldTag::__compliance_standards),
2738                            "compliance_standards" => Ok(__FieldTag::__compliance_standards),
2739                            "constraint" => Ok(__FieldTag::__constraint),
2740                            "description" => Ok(__FieldTag::__description),
2741                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2742                        }
2743                    }
2744                }
2745                deserializer.deserialize_identifier(Visitor)
2746            }
2747        }
2748        struct Visitor;
2749        impl<'de> serde::de::Visitor<'de> for Visitor {
2750            type Value = Policy;
2751            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2752                formatter.write_str("struct Policy")
2753            }
2754            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2755            where
2756                A: serde::de::MapAccess<'de>,
2757            {
2758                #[allow(unused_imports)]
2759                use serde::de::Error;
2760                use std::option::Option::Some;
2761                let mut fields = std::collections::HashSet::new();
2762                let mut result = Self::Value::new();
2763                while let Some(tag) = map.next_key::<__FieldTag>()? {
2764                    #[allow(clippy::match_single_binding)]
2765                    match tag {
2766                        __FieldTag::__policy_id => {
2767                            if !fields.insert(__FieldTag::__policy_id) {
2768                                return std::result::Result::Err(A::Error::duplicate_field(
2769                                    "multiple values for policy_id",
2770                                ));
2771                            }
2772                            result.policy_id = map
2773                                .next_value::<std::option::Option<std::string::String>>()?
2774                                .unwrap_or_default();
2775                        }
2776                        __FieldTag::__compliance_standards => {
2777                            if !fields.insert(__FieldTag::__compliance_standards) {
2778                                return std::result::Result::Err(A::Error::duplicate_field(
2779                                    "multiple values for compliance_standards",
2780                                ));
2781                            }
2782                            result.compliance_standards = map
2783                                .next_value::<std::option::Option<
2784                                    std::vec::Vec<crate::model::policy::ComplianceStandard>,
2785                                >>()?
2786                                .unwrap_or_default();
2787                        }
2788                        __FieldTag::__constraint => {
2789                            if !fields.insert(__FieldTag::__constraint) {
2790                                return std::result::Result::Err(A::Error::duplicate_field(
2791                                    "multiple values for constraint",
2792                                ));
2793                            }
2794                            result.constraint =
2795                                map.next_value::<std::option::Option<crate::model::Constraint>>()?;
2796                        }
2797                        __FieldTag::__description => {
2798                            if !fields.insert(__FieldTag::__description) {
2799                                return std::result::Result::Err(A::Error::duplicate_field(
2800                                    "multiple values for description",
2801                                ));
2802                            }
2803                            result.description = map
2804                                .next_value::<std::option::Option<std::string::String>>()?
2805                                .unwrap_or_default();
2806                        }
2807                        __FieldTag::Unknown(key) => {
2808                            let value = map.next_value::<serde_json::Value>()?;
2809                            result._unknown_fields.insert(key, value);
2810                        }
2811                    }
2812                }
2813                std::result::Result::Ok(result)
2814            }
2815        }
2816        deserializer.deserialize_any(Visitor)
2817    }
2818}
2819
2820#[doc(hidden)]
2821impl serde::ser::Serialize for Policy {
2822    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2823    where
2824        S: serde::ser::Serializer,
2825    {
2826        use serde::ser::SerializeMap;
2827        #[allow(unused_imports)]
2828        use std::option::Option::Some;
2829        let mut state = serializer.serialize_map(std::option::Option::None)?;
2830        if !self.policy_id.is_empty() {
2831            state.serialize_entry("policyId", &self.policy_id)?;
2832        }
2833        if !self.compliance_standards.is_empty() {
2834            state.serialize_entry("complianceStandards", &self.compliance_standards)?;
2835        }
2836        if self.constraint.is_some() {
2837            state.serialize_entry("constraint", &self.constraint)?;
2838        }
2839        if !self.description.is_empty() {
2840            state.serialize_entry("description", &self.description)?;
2841        }
2842        if !self._unknown_fields.is_empty() {
2843            for (key, value) in self._unknown_fields.iter() {
2844                state.serialize_entry(key, &value)?;
2845            }
2846        }
2847        state.end()
2848    }
2849}
2850
2851/// Defines additional types related to [Policy].
2852pub mod policy {
2853    #[allow(unused_imports)]
2854    use super::*;
2855
2856    /// Mapping for a Policy to standard and control.
2857    #[derive(Clone, Debug, Default, PartialEq)]
2858    #[non_exhaustive]
2859    pub struct ComplianceStandard {
2860        /// Optional. The compliance standard that the Policy maps to, e.g.: CIS-2.0.
2861        pub standard: std::string::String,
2862
2863        /// Optional. Control mapping provided by user for this Policy. e.g.: 1.5.
2864        pub control: std::string::String,
2865
2866        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2867    }
2868
2869    impl ComplianceStandard {
2870        pub fn new() -> Self {
2871            std::default::Default::default()
2872        }
2873
2874        /// Sets the value of [standard][crate::model::policy::ComplianceStandard::standard].
2875        pub fn set_standard<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2876            self.standard = v.into();
2877            self
2878        }
2879
2880        /// Sets the value of [control][crate::model::policy::ComplianceStandard::control].
2881        pub fn set_control<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2882            self.control = v.into();
2883            self
2884        }
2885    }
2886
2887    impl wkt::message::Message for ComplianceStandard {
2888        fn typename() -> &'static str {
2889            "type.googleapis.com/google.cloud.securityposture.v1.Policy.ComplianceStandard"
2890        }
2891    }
2892
2893    #[doc(hidden)]
2894    impl<'de> serde::de::Deserialize<'de> for ComplianceStandard {
2895        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2896        where
2897            D: serde::Deserializer<'de>,
2898        {
2899            #[allow(non_camel_case_types)]
2900            #[doc(hidden)]
2901            #[derive(PartialEq, Eq, Hash)]
2902            enum __FieldTag {
2903                __standard,
2904                __control,
2905                Unknown(std::string::String),
2906            }
2907            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2908                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2909                where
2910                    D: serde::Deserializer<'de>,
2911                {
2912                    struct Visitor;
2913                    impl<'de> serde::de::Visitor<'de> for Visitor {
2914                        type Value = __FieldTag;
2915                        fn expecting(
2916                            &self,
2917                            formatter: &mut std::fmt::Formatter,
2918                        ) -> std::fmt::Result {
2919                            formatter.write_str("a field name for ComplianceStandard")
2920                        }
2921                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2922                        where
2923                            E: serde::de::Error,
2924                        {
2925                            use std::result::Result::Ok;
2926                            use std::string::ToString;
2927                            match value {
2928                                "standard" => Ok(__FieldTag::__standard),
2929                                "control" => Ok(__FieldTag::__control),
2930                                _ => Ok(__FieldTag::Unknown(value.to_string())),
2931                            }
2932                        }
2933                    }
2934                    deserializer.deserialize_identifier(Visitor)
2935                }
2936            }
2937            struct Visitor;
2938            impl<'de> serde::de::Visitor<'de> for Visitor {
2939                type Value = ComplianceStandard;
2940                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2941                    formatter.write_str("struct ComplianceStandard")
2942                }
2943                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2944                where
2945                    A: serde::de::MapAccess<'de>,
2946                {
2947                    #[allow(unused_imports)]
2948                    use serde::de::Error;
2949                    use std::option::Option::Some;
2950                    let mut fields = std::collections::HashSet::new();
2951                    let mut result = Self::Value::new();
2952                    while let Some(tag) = map.next_key::<__FieldTag>()? {
2953                        #[allow(clippy::match_single_binding)]
2954                        match tag {
2955                            __FieldTag::__standard => {
2956                                if !fields.insert(__FieldTag::__standard) {
2957                                    return std::result::Result::Err(A::Error::duplicate_field(
2958                                        "multiple values for standard",
2959                                    ));
2960                                }
2961                                result.standard = map
2962                                    .next_value::<std::option::Option<std::string::String>>()?
2963                                    .unwrap_or_default();
2964                            }
2965                            __FieldTag::__control => {
2966                                if !fields.insert(__FieldTag::__control) {
2967                                    return std::result::Result::Err(A::Error::duplicate_field(
2968                                        "multiple values for control",
2969                                    ));
2970                                }
2971                                result.control = map
2972                                    .next_value::<std::option::Option<std::string::String>>()?
2973                                    .unwrap_or_default();
2974                            }
2975                            __FieldTag::Unknown(key) => {
2976                                let value = map.next_value::<serde_json::Value>()?;
2977                                result._unknown_fields.insert(key, value);
2978                            }
2979                        }
2980                    }
2981                    std::result::Result::Ok(result)
2982                }
2983            }
2984            deserializer.deserialize_any(Visitor)
2985        }
2986    }
2987
2988    #[doc(hidden)]
2989    impl serde::ser::Serialize for ComplianceStandard {
2990        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2991        where
2992            S: serde::ser::Serializer,
2993        {
2994            use serde::ser::SerializeMap;
2995            #[allow(unused_imports)]
2996            use std::option::Option::Some;
2997            let mut state = serializer.serialize_map(std::option::Option::None)?;
2998            if !self.standard.is_empty() {
2999                state.serialize_entry("standard", &self.standard)?;
3000            }
3001            if !self.control.is_empty() {
3002                state.serialize_entry("control", &self.control)?;
3003            }
3004            if !self._unknown_fields.is_empty() {
3005                for (key, value) in self._unknown_fields.iter() {
3006                    state.serialize_entry(key, &value)?;
3007                }
3008            }
3009            state.end()
3010        }
3011    }
3012}
3013
3014/// Representation of a Constraint.
3015#[derive(Clone, Debug, Default, PartialEq)]
3016#[non_exhaustive]
3017pub struct Constraint {
3018    pub implementation: std::option::Option<crate::model::constraint::Implementation>,
3019
3020    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3021}
3022
3023impl Constraint {
3024    pub fn new() -> Self {
3025        std::default::Default::default()
3026    }
3027
3028    /// Sets the value of [implementation][crate::model::Constraint::implementation].
3029    ///
3030    /// Note that all the setters affecting `implementation` are mutually
3031    /// exclusive.
3032    pub fn set_implementation<
3033        T: std::convert::Into<std::option::Option<crate::model::constraint::Implementation>>,
3034    >(
3035        mut self,
3036        v: T,
3037    ) -> Self {
3038        self.implementation = v.into();
3039        self
3040    }
3041
3042    /// The value of [implementation][crate::model::Constraint::implementation]
3043    /// if it holds a `SecurityHealthAnalyticsModule`, `None` if the field is not set or
3044    /// holds a different branch.
3045    pub fn security_health_analytics_module(
3046        &self,
3047    ) -> std::option::Option<&std::boxed::Box<crate::model::SecurityHealthAnalyticsModule>> {
3048        #[allow(unreachable_patterns)]
3049        self.implementation.as_ref().and_then(|v| match v {
3050            crate::model::constraint::Implementation::SecurityHealthAnalyticsModule(v) => {
3051                std::option::Option::Some(v)
3052            }
3053            _ => std::option::Option::None,
3054        })
3055    }
3056
3057    /// Sets the value of [implementation][crate::model::Constraint::implementation]
3058    /// to hold a `SecurityHealthAnalyticsModule`.
3059    ///
3060    /// Note that all the setters affecting `implementation` are
3061    /// mutually exclusive.
3062    pub fn set_security_health_analytics_module<
3063        T: std::convert::Into<std::boxed::Box<crate::model::SecurityHealthAnalyticsModule>>,
3064    >(
3065        mut self,
3066        v: T,
3067    ) -> Self {
3068        self.implementation = std::option::Option::Some(
3069            crate::model::constraint::Implementation::SecurityHealthAnalyticsModule(v.into()),
3070        );
3071        self
3072    }
3073
3074    /// The value of [implementation][crate::model::Constraint::implementation]
3075    /// if it holds a `SecurityHealthAnalyticsCustomModule`, `None` if the field is not set or
3076    /// holds a different branch.
3077    pub fn security_health_analytics_custom_module(
3078        &self,
3079    ) -> std::option::Option<&std::boxed::Box<crate::model::SecurityHealthAnalyticsCustomModule>>
3080    {
3081        #[allow(unreachable_patterns)]
3082        self.implementation.as_ref().and_then(|v| match v {
3083            crate::model::constraint::Implementation::SecurityHealthAnalyticsCustomModule(v) => {
3084                std::option::Option::Some(v)
3085            }
3086            _ => std::option::Option::None,
3087        })
3088    }
3089
3090    /// Sets the value of [implementation][crate::model::Constraint::implementation]
3091    /// to hold a `SecurityHealthAnalyticsCustomModule`.
3092    ///
3093    /// Note that all the setters affecting `implementation` are
3094    /// mutually exclusive.
3095    pub fn set_security_health_analytics_custom_module<
3096        T: std::convert::Into<std::boxed::Box<crate::model::SecurityHealthAnalyticsCustomModule>>,
3097    >(
3098        mut self,
3099        v: T,
3100    ) -> Self {
3101        self.implementation = std::option::Option::Some(
3102            crate::model::constraint::Implementation::SecurityHealthAnalyticsCustomModule(v.into()),
3103        );
3104        self
3105    }
3106
3107    /// The value of [implementation][crate::model::Constraint::implementation]
3108    /// if it holds a `OrgPolicyConstraint`, `None` if the field is not set or
3109    /// holds a different branch.
3110    pub fn org_policy_constraint(
3111        &self,
3112    ) -> std::option::Option<&std::boxed::Box<crate::model::OrgPolicyConstraint>> {
3113        #[allow(unreachable_patterns)]
3114        self.implementation.as_ref().and_then(|v| match v {
3115            crate::model::constraint::Implementation::OrgPolicyConstraint(v) => {
3116                std::option::Option::Some(v)
3117            }
3118            _ => std::option::Option::None,
3119        })
3120    }
3121
3122    /// Sets the value of [implementation][crate::model::Constraint::implementation]
3123    /// to hold a `OrgPolicyConstraint`.
3124    ///
3125    /// Note that all the setters affecting `implementation` are
3126    /// mutually exclusive.
3127    pub fn set_org_policy_constraint<
3128        T: std::convert::Into<std::boxed::Box<crate::model::OrgPolicyConstraint>>,
3129    >(
3130        mut self,
3131        v: T,
3132    ) -> Self {
3133        self.implementation = std::option::Option::Some(
3134            crate::model::constraint::Implementation::OrgPolicyConstraint(v.into()),
3135        );
3136        self
3137    }
3138
3139    /// The value of [implementation][crate::model::Constraint::implementation]
3140    /// if it holds a `OrgPolicyConstraintCustom`, `None` if the field is not set or
3141    /// holds a different branch.
3142    pub fn org_policy_constraint_custom(
3143        &self,
3144    ) -> std::option::Option<&std::boxed::Box<crate::model::OrgPolicyConstraintCustom>> {
3145        #[allow(unreachable_patterns)]
3146        self.implementation.as_ref().and_then(|v| match v {
3147            crate::model::constraint::Implementation::OrgPolicyConstraintCustom(v) => {
3148                std::option::Option::Some(v)
3149            }
3150            _ => std::option::Option::None,
3151        })
3152    }
3153
3154    /// Sets the value of [implementation][crate::model::Constraint::implementation]
3155    /// to hold a `OrgPolicyConstraintCustom`.
3156    ///
3157    /// Note that all the setters affecting `implementation` are
3158    /// mutually exclusive.
3159    pub fn set_org_policy_constraint_custom<
3160        T: std::convert::Into<std::boxed::Box<crate::model::OrgPolicyConstraintCustom>>,
3161    >(
3162        mut self,
3163        v: T,
3164    ) -> Self {
3165        self.implementation = std::option::Option::Some(
3166            crate::model::constraint::Implementation::OrgPolicyConstraintCustom(v.into()),
3167        );
3168        self
3169    }
3170}
3171
3172impl wkt::message::Message for Constraint {
3173    fn typename() -> &'static str {
3174        "type.googleapis.com/google.cloud.securityposture.v1.Constraint"
3175    }
3176}
3177
3178#[doc(hidden)]
3179impl<'de> serde::de::Deserialize<'de> for Constraint {
3180    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3181    where
3182        D: serde::Deserializer<'de>,
3183    {
3184        #[allow(non_camel_case_types)]
3185        #[doc(hidden)]
3186        #[derive(PartialEq, Eq, Hash)]
3187        enum __FieldTag {
3188            __security_health_analytics_module,
3189            __security_health_analytics_custom_module,
3190            __org_policy_constraint,
3191            __org_policy_constraint_custom,
3192            Unknown(std::string::String),
3193        }
3194        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3195            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3196            where
3197                D: serde::Deserializer<'de>,
3198            {
3199                struct Visitor;
3200                impl<'de> serde::de::Visitor<'de> for Visitor {
3201                    type Value = __FieldTag;
3202                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3203                        formatter.write_str("a field name for Constraint")
3204                    }
3205                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3206                    where
3207                        E: serde::de::Error,
3208                    {
3209                        use std::result::Result::Ok;
3210                        use std::string::ToString;
3211                        match value {
3212                            "securityHealthAnalyticsModule" => {
3213                                Ok(__FieldTag::__security_health_analytics_module)
3214                            }
3215                            "security_health_analytics_module" => {
3216                                Ok(__FieldTag::__security_health_analytics_module)
3217                            }
3218                            "securityHealthAnalyticsCustomModule" => {
3219                                Ok(__FieldTag::__security_health_analytics_custom_module)
3220                            }
3221                            "security_health_analytics_custom_module" => {
3222                                Ok(__FieldTag::__security_health_analytics_custom_module)
3223                            }
3224                            "orgPolicyConstraint" => Ok(__FieldTag::__org_policy_constraint),
3225                            "org_policy_constraint" => Ok(__FieldTag::__org_policy_constraint),
3226                            "orgPolicyConstraintCustom" => {
3227                                Ok(__FieldTag::__org_policy_constraint_custom)
3228                            }
3229                            "org_policy_constraint_custom" => {
3230                                Ok(__FieldTag::__org_policy_constraint_custom)
3231                            }
3232                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3233                        }
3234                    }
3235                }
3236                deserializer.deserialize_identifier(Visitor)
3237            }
3238        }
3239        struct Visitor;
3240        impl<'de> serde::de::Visitor<'de> for Visitor {
3241            type Value = Constraint;
3242            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3243                formatter.write_str("struct Constraint")
3244            }
3245            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3246            where
3247                A: serde::de::MapAccess<'de>,
3248            {
3249                #[allow(unused_imports)]
3250                use serde::de::Error;
3251                use std::option::Option::Some;
3252                let mut fields = std::collections::HashSet::new();
3253                let mut result = Self::Value::new();
3254                while let Some(tag) = map.next_key::<__FieldTag>()? {
3255                    #[allow(clippy::match_single_binding)]
3256                    match tag {
3257                        __FieldTag::__security_health_analytics_module => {
3258                            if !fields.insert(__FieldTag::__security_health_analytics_module) {
3259                                return std::result::Result::Err(A::Error::duplicate_field(
3260                                    "multiple values for security_health_analytics_module",
3261                                ));
3262                            }
3263                            if result.implementation.is_some() {
3264                                return std::result::Result::Err(A::Error::duplicate_field(
3265                                    "multiple values for `implementation`, a oneof with full ID .google.cloud.securityposture.v1.Constraint.security_health_analytics_module, latest field was securityHealthAnalyticsModule",
3266                                ));
3267                            }
3268                            result.implementation = std::option::Option::Some(
3269                                crate::model::constraint::Implementation::SecurityHealthAnalyticsModule(
3270                                    map.next_value::<std::option::Option<std::boxed::Box<crate::model::SecurityHealthAnalyticsModule>>>()?.unwrap_or_default()
3271                                ),
3272                            );
3273                        }
3274                        __FieldTag::__security_health_analytics_custom_module => {
3275                            if !fields.insert(__FieldTag::__security_health_analytics_custom_module)
3276                            {
3277                                return std::result::Result::Err(A::Error::duplicate_field(
3278                                    "multiple values for security_health_analytics_custom_module",
3279                                ));
3280                            }
3281                            if result.implementation.is_some() {
3282                                return std::result::Result::Err(A::Error::duplicate_field(
3283                                    "multiple values for `implementation`, a oneof with full ID .google.cloud.securityposture.v1.Constraint.security_health_analytics_custom_module, latest field was securityHealthAnalyticsCustomModule",
3284                                ));
3285                            }
3286                            result.implementation = std::option::Option::Some(
3287                                crate::model::constraint::Implementation::SecurityHealthAnalyticsCustomModule(
3288                                    map.next_value::<std::option::Option<std::boxed::Box<crate::model::SecurityHealthAnalyticsCustomModule>>>()?.unwrap_or_default()
3289                                ),
3290                            );
3291                        }
3292                        __FieldTag::__org_policy_constraint => {
3293                            if !fields.insert(__FieldTag::__org_policy_constraint) {
3294                                return std::result::Result::Err(A::Error::duplicate_field(
3295                                    "multiple values for org_policy_constraint",
3296                                ));
3297                            }
3298                            if result.implementation.is_some() {
3299                                return std::result::Result::Err(A::Error::duplicate_field(
3300                                    "multiple values for `implementation`, a oneof with full ID .google.cloud.securityposture.v1.Constraint.org_policy_constraint, latest field was orgPolicyConstraint",
3301                                ));
3302                            }
3303                            result.implementation = std::option::Option::Some(
3304                                crate::model::constraint::Implementation::OrgPolicyConstraint(
3305                                    map.next_value::<std::option::Option<
3306                                        std::boxed::Box<crate::model::OrgPolicyConstraint>,
3307                                    >>()?
3308                                    .unwrap_or_default(),
3309                                ),
3310                            );
3311                        }
3312                        __FieldTag::__org_policy_constraint_custom => {
3313                            if !fields.insert(__FieldTag::__org_policy_constraint_custom) {
3314                                return std::result::Result::Err(A::Error::duplicate_field(
3315                                    "multiple values for org_policy_constraint_custom",
3316                                ));
3317                            }
3318                            if result.implementation.is_some() {
3319                                return std::result::Result::Err(A::Error::duplicate_field(
3320                                    "multiple values for `implementation`, a oneof with full ID .google.cloud.securityposture.v1.Constraint.org_policy_constraint_custom, latest field was orgPolicyConstraintCustom",
3321                                ));
3322                            }
3323                            result.implementation = std::option::Option::Some(
3324                                crate::model::constraint::Implementation::OrgPolicyConstraintCustom(
3325                                    map.next_value::<std::option::Option<
3326                                        std::boxed::Box<crate::model::OrgPolicyConstraintCustom>,
3327                                    >>()?
3328                                    .unwrap_or_default(),
3329                                ),
3330                            );
3331                        }
3332                        __FieldTag::Unknown(key) => {
3333                            let value = map.next_value::<serde_json::Value>()?;
3334                            result._unknown_fields.insert(key, value);
3335                        }
3336                    }
3337                }
3338                std::result::Result::Ok(result)
3339            }
3340        }
3341        deserializer.deserialize_any(Visitor)
3342    }
3343}
3344
3345#[doc(hidden)]
3346impl serde::ser::Serialize for Constraint {
3347    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3348    where
3349        S: serde::ser::Serializer,
3350    {
3351        use serde::ser::SerializeMap;
3352        #[allow(unused_imports)]
3353        use std::option::Option::Some;
3354        let mut state = serializer.serialize_map(std::option::Option::None)?;
3355        if let Some(value) = self.security_health_analytics_module() {
3356            state.serialize_entry("securityHealthAnalyticsModule", value)?;
3357        }
3358        if let Some(value) = self.security_health_analytics_custom_module() {
3359            state.serialize_entry("securityHealthAnalyticsCustomModule", value)?;
3360        }
3361        if let Some(value) = self.org_policy_constraint() {
3362            state.serialize_entry("orgPolicyConstraint", value)?;
3363        }
3364        if let Some(value) = self.org_policy_constraint_custom() {
3365            state.serialize_entry("orgPolicyConstraintCustom", value)?;
3366        }
3367        if !self._unknown_fields.is_empty() {
3368            for (key, value) in self._unknown_fields.iter() {
3369                state.serialize_entry(key, &value)?;
3370            }
3371        }
3372        state.end()
3373    }
3374}
3375
3376/// Defines additional types related to [Constraint].
3377pub mod constraint {
3378    #[allow(unused_imports)]
3379    use super::*;
3380
3381    #[derive(Clone, Debug, PartialEq)]
3382    #[non_exhaustive]
3383    pub enum Implementation {
3384        /// Optional. SHA built-in detector.
3385        SecurityHealthAnalyticsModule(std::boxed::Box<crate::model::SecurityHealthAnalyticsModule>),
3386        /// Optional. SHA custom detector.
3387        SecurityHealthAnalyticsCustomModule(
3388            std::boxed::Box<crate::model::SecurityHealthAnalyticsCustomModule>,
3389        ),
3390        /// Optional. Org Policy builtin constraint.
3391        OrgPolicyConstraint(std::boxed::Box<crate::model::OrgPolicyConstraint>),
3392        /// Optional. Org Policy custom constraint.
3393        OrgPolicyConstraintCustom(std::boxed::Box<crate::model::OrgPolicyConstraintCustom>),
3394    }
3395}
3396
3397/// Message for requesting list of Postures.
3398#[derive(Clone, Debug, Default, PartialEq)]
3399#[non_exhaustive]
3400pub struct ListPosturesRequest {
3401    /// Required. Parent value for ListPosturesRequest.
3402    pub parent: std::string::String,
3403
3404    /// Requested page size. Server may return fewer items than requested.
3405    /// If unspecified, server will pick an appropriate default.
3406    pub page_size: i32,
3407
3408    /// A token identifying a page of results the server should return.
3409    pub page_token: std::string::String,
3410
3411    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3412}
3413
3414impl ListPosturesRequest {
3415    pub fn new() -> Self {
3416        std::default::Default::default()
3417    }
3418
3419    /// Sets the value of [parent][crate::model::ListPosturesRequest::parent].
3420    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3421        self.parent = v.into();
3422        self
3423    }
3424
3425    /// Sets the value of [page_size][crate::model::ListPosturesRequest::page_size].
3426    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3427        self.page_size = v.into();
3428        self
3429    }
3430
3431    /// Sets the value of [page_token][crate::model::ListPosturesRequest::page_token].
3432    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3433        self.page_token = v.into();
3434        self
3435    }
3436}
3437
3438impl wkt::message::Message for ListPosturesRequest {
3439    fn typename() -> &'static str {
3440        "type.googleapis.com/google.cloud.securityposture.v1.ListPosturesRequest"
3441    }
3442}
3443
3444#[doc(hidden)]
3445impl<'de> serde::de::Deserialize<'de> for ListPosturesRequest {
3446    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3447    where
3448        D: serde::Deserializer<'de>,
3449    {
3450        #[allow(non_camel_case_types)]
3451        #[doc(hidden)]
3452        #[derive(PartialEq, Eq, Hash)]
3453        enum __FieldTag {
3454            __parent,
3455            __page_size,
3456            __page_token,
3457            Unknown(std::string::String),
3458        }
3459        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3460            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3461            where
3462                D: serde::Deserializer<'de>,
3463            {
3464                struct Visitor;
3465                impl<'de> serde::de::Visitor<'de> for Visitor {
3466                    type Value = __FieldTag;
3467                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3468                        formatter.write_str("a field name for ListPosturesRequest")
3469                    }
3470                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3471                    where
3472                        E: serde::de::Error,
3473                    {
3474                        use std::result::Result::Ok;
3475                        use std::string::ToString;
3476                        match value {
3477                            "parent" => Ok(__FieldTag::__parent),
3478                            "pageSize" => Ok(__FieldTag::__page_size),
3479                            "page_size" => Ok(__FieldTag::__page_size),
3480                            "pageToken" => Ok(__FieldTag::__page_token),
3481                            "page_token" => Ok(__FieldTag::__page_token),
3482                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3483                        }
3484                    }
3485                }
3486                deserializer.deserialize_identifier(Visitor)
3487            }
3488        }
3489        struct Visitor;
3490        impl<'de> serde::de::Visitor<'de> for Visitor {
3491            type Value = ListPosturesRequest;
3492            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3493                formatter.write_str("struct ListPosturesRequest")
3494            }
3495            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3496            where
3497                A: serde::de::MapAccess<'de>,
3498            {
3499                #[allow(unused_imports)]
3500                use serde::de::Error;
3501                use std::option::Option::Some;
3502                let mut fields = std::collections::HashSet::new();
3503                let mut result = Self::Value::new();
3504                while let Some(tag) = map.next_key::<__FieldTag>()? {
3505                    #[allow(clippy::match_single_binding)]
3506                    match tag {
3507                        __FieldTag::__parent => {
3508                            if !fields.insert(__FieldTag::__parent) {
3509                                return std::result::Result::Err(A::Error::duplicate_field(
3510                                    "multiple values for parent",
3511                                ));
3512                            }
3513                            result.parent = map
3514                                .next_value::<std::option::Option<std::string::String>>()?
3515                                .unwrap_or_default();
3516                        }
3517                        __FieldTag::__page_size => {
3518                            if !fields.insert(__FieldTag::__page_size) {
3519                                return std::result::Result::Err(A::Error::duplicate_field(
3520                                    "multiple values for page_size",
3521                                ));
3522                            }
3523                            struct __With(std::option::Option<i32>);
3524                            impl<'de> serde::de::Deserialize<'de> for __With {
3525                                fn deserialize<D>(
3526                                    deserializer: D,
3527                                ) -> std::result::Result<Self, D::Error>
3528                                where
3529                                    D: serde::de::Deserializer<'de>,
3530                                {
3531                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3532                                }
3533                            }
3534                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
3535                        }
3536                        __FieldTag::__page_token => {
3537                            if !fields.insert(__FieldTag::__page_token) {
3538                                return std::result::Result::Err(A::Error::duplicate_field(
3539                                    "multiple values for page_token",
3540                                ));
3541                            }
3542                            result.page_token = map
3543                                .next_value::<std::option::Option<std::string::String>>()?
3544                                .unwrap_or_default();
3545                        }
3546                        __FieldTag::Unknown(key) => {
3547                            let value = map.next_value::<serde_json::Value>()?;
3548                            result._unknown_fields.insert(key, value);
3549                        }
3550                    }
3551                }
3552                std::result::Result::Ok(result)
3553            }
3554        }
3555        deserializer.deserialize_any(Visitor)
3556    }
3557}
3558
3559#[doc(hidden)]
3560impl serde::ser::Serialize for ListPosturesRequest {
3561    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3562    where
3563        S: serde::ser::Serializer,
3564    {
3565        use serde::ser::SerializeMap;
3566        #[allow(unused_imports)]
3567        use std::option::Option::Some;
3568        let mut state = serializer.serialize_map(std::option::Option::None)?;
3569        if !self.parent.is_empty() {
3570            state.serialize_entry("parent", &self.parent)?;
3571        }
3572        if !wkt::internal::is_default(&self.page_size) {
3573            struct __With<'a>(&'a i32);
3574            impl<'a> serde::ser::Serialize for __With<'a> {
3575                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3576                where
3577                    S: serde::ser::Serializer,
3578                {
3579                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3580                }
3581            }
3582            state.serialize_entry("pageSize", &__With(&self.page_size))?;
3583        }
3584        if !self.page_token.is_empty() {
3585            state.serialize_entry("pageToken", &self.page_token)?;
3586        }
3587        if !self._unknown_fields.is_empty() {
3588            for (key, value) in self._unknown_fields.iter() {
3589                state.serialize_entry(key, &value)?;
3590            }
3591        }
3592        state.end()
3593    }
3594}
3595
3596/// Message for response to listing Postures.
3597#[derive(Clone, Debug, Default, PartialEq)]
3598#[non_exhaustive]
3599pub struct ListPosturesResponse {
3600    /// The list of Posture.
3601    pub postures: std::vec::Vec<crate::model::Posture>,
3602
3603    /// A token identifying a page of results the server should return.
3604    pub next_page_token: std::string::String,
3605
3606    /// Unreachable resources.
3607    pub unreachable: std::vec::Vec<std::string::String>,
3608
3609    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3610}
3611
3612impl ListPosturesResponse {
3613    pub fn new() -> Self {
3614        std::default::Default::default()
3615    }
3616
3617    /// Sets the value of [postures][crate::model::ListPosturesResponse::postures].
3618    pub fn set_postures<T, V>(mut self, v: T) -> Self
3619    where
3620        T: std::iter::IntoIterator<Item = V>,
3621        V: std::convert::Into<crate::model::Posture>,
3622    {
3623        use std::iter::Iterator;
3624        self.postures = v.into_iter().map(|i| i.into()).collect();
3625        self
3626    }
3627
3628    /// Sets the value of [next_page_token][crate::model::ListPosturesResponse::next_page_token].
3629    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3630        self.next_page_token = v.into();
3631        self
3632    }
3633
3634    /// Sets the value of [unreachable][crate::model::ListPosturesResponse::unreachable].
3635    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
3636    where
3637        T: std::iter::IntoIterator<Item = V>,
3638        V: std::convert::Into<std::string::String>,
3639    {
3640        use std::iter::Iterator;
3641        self.unreachable = v.into_iter().map(|i| i.into()).collect();
3642        self
3643    }
3644}
3645
3646impl wkt::message::Message for ListPosturesResponse {
3647    fn typename() -> &'static str {
3648        "type.googleapis.com/google.cloud.securityposture.v1.ListPosturesResponse"
3649    }
3650}
3651
3652#[doc(hidden)]
3653impl gax::paginator::internal::PageableResponse for ListPosturesResponse {
3654    type PageItem = crate::model::Posture;
3655
3656    fn items(self) -> std::vec::Vec<Self::PageItem> {
3657        self.postures
3658    }
3659
3660    fn next_page_token(&self) -> std::string::String {
3661        use std::clone::Clone;
3662        self.next_page_token.clone()
3663    }
3664}
3665
3666#[doc(hidden)]
3667impl<'de> serde::de::Deserialize<'de> for ListPosturesResponse {
3668    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3669    where
3670        D: serde::Deserializer<'de>,
3671    {
3672        #[allow(non_camel_case_types)]
3673        #[doc(hidden)]
3674        #[derive(PartialEq, Eq, Hash)]
3675        enum __FieldTag {
3676            __postures,
3677            __next_page_token,
3678            __unreachable,
3679            Unknown(std::string::String),
3680        }
3681        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3682            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3683            where
3684                D: serde::Deserializer<'de>,
3685            {
3686                struct Visitor;
3687                impl<'de> serde::de::Visitor<'de> for Visitor {
3688                    type Value = __FieldTag;
3689                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3690                        formatter.write_str("a field name for ListPosturesResponse")
3691                    }
3692                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3693                    where
3694                        E: serde::de::Error,
3695                    {
3696                        use std::result::Result::Ok;
3697                        use std::string::ToString;
3698                        match value {
3699                            "postures" => Ok(__FieldTag::__postures),
3700                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
3701                            "next_page_token" => Ok(__FieldTag::__next_page_token),
3702                            "unreachable" => Ok(__FieldTag::__unreachable),
3703                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3704                        }
3705                    }
3706                }
3707                deserializer.deserialize_identifier(Visitor)
3708            }
3709        }
3710        struct Visitor;
3711        impl<'de> serde::de::Visitor<'de> for Visitor {
3712            type Value = ListPosturesResponse;
3713            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3714                formatter.write_str("struct ListPosturesResponse")
3715            }
3716            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3717            where
3718                A: serde::de::MapAccess<'de>,
3719            {
3720                #[allow(unused_imports)]
3721                use serde::de::Error;
3722                use std::option::Option::Some;
3723                let mut fields = std::collections::HashSet::new();
3724                let mut result = Self::Value::new();
3725                while let Some(tag) = map.next_key::<__FieldTag>()? {
3726                    #[allow(clippy::match_single_binding)]
3727                    match tag {
3728                        __FieldTag::__postures => {
3729                            if !fields.insert(__FieldTag::__postures) {
3730                                return std::result::Result::Err(A::Error::duplicate_field(
3731                                    "multiple values for postures",
3732                                ));
3733                            }
3734                            result.postures = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Posture>>>()?.unwrap_or_default();
3735                        }
3736                        __FieldTag::__next_page_token => {
3737                            if !fields.insert(__FieldTag::__next_page_token) {
3738                                return std::result::Result::Err(A::Error::duplicate_field(
3739                                    "multiple values for next_page_token",
3740                                ));
3741                            }
3742                            result.next_page_token = map
3743                                .next_value::<std::option::Option<std::string::String>>()?
3744                                .unwrap_or_default();
3745                        }
3746                        __FieldTag::__unreachable => {
3747                            if !fields.insert(__FieldTag::__unreachable) {
3748                                return std::result::Result::Err(A::Error::duplicate_field(
3749                                    "multiple values for unreachable",
3750                                ));
3751                            }
3752                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
3753                        }
3754                        __FieldTag::Unknown(key) => {
3755                            let value = map.next_value::<serde_json::Value>()?;
3756                            result._unknown_fields.insert(key, value);
3757                        }
3758                    }
3759                }
3760                std::result::Result::Ok(result)
3761            }
3762        }
3763        deserializer.deserialize_any(Visitor)
3764    }
3765}
3766
3767#[doc(hidden)]
3768impl serde::ser::Serialize for ListPosturesResponse {
3769    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3770    where
3771        S: serde::ser::Serializer,
3772    {
3773        use serde::ser::SerializeMap;
3774        #[allow(unused_imports)]
3775        use std::option::Option::Some;
3776        let mut state = serializer.serialize_map(std::option::Option::None)?;
3777        if !self.postures.is_empty() {
3778            state.serialize_entry("postures", &self.postures)?;
3779        }
3780        if !self.next_page_token.is_empty() {
3781            state.serialize_entry("nextPageToken", &self.next_page_token)?;
3782        }
3783        if !self.unreachable.is_empty() {
3784            state.serialize_entry("unreachable", &self.unreachable)?;
3785        }
3786        if !self._unknown_fields.is_empty() {
3787            for (key, value) in self._unknown_fields.iter() {
3788                state.serialize_entry(key, &value)?;
3789            }
3790        }
3791        state.end()
3792    }
3793}
3794
3795/// Message for requesting list of Posture revisions.
3796#[derive(Clone, Debug, Default, PartialEq)]
3797#[non_exhaustive]
3798pub struct ListPostureRevisionsRequest {
3799    /// Required. Name value for ListPostureRevisionsRequest.
3800    pub name: std::string::String,
3801
3802    /// Optional. Requested page size. Server may return fewer items than
3803    /// requested. If unspecified, server will pick 100 as default.
3804    pub page_size: i32,
3805
3806    /// Optional. A token identifying a page of results the server should return.
3807    pub page_token: std::string::String,
3808
3809    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3810}
3811
3812impl ListPostureRevisionsRequest {
3813    pub fn new() -> Self {
3814        std::default::Default::default()
3815    }
3816
3817    /// Sets the value of [name][crate::model::ListPostureRevisionsRequest::name].
3818    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3819        self.name = v.into();
3820        self
3821    }
3822
3823    /// Sets the value of [page_size][crate::model::ListPostureRevisionsRequest::page_size].
3824    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3825        self.page_size = v.into();
3826        self
3827    }
3828
3829    /// Sets the value of [page_token][crate::model::ListPostureRevisionsRequest::page_token].
3830    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3831        self.page_token = v.into();
3832        self
3833    }
3834}
3835
3836impl wkt::message::Message for ListPostureRevisionsRequest {
3837    fn typename() -> &'static str {
3838        "type.googleapis.com/google.cloud.securityposture.v1.ListPostureRevisionsRequest"
3839    }
3840}
3841
3842#[doc(hidden)]
3843impl<'de> serde::de::Deserialize<'de> for ListPostureRevisionsRequest {
3844    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3845    where
3846        D: serde::Deserializer<'de>,
3847    {
3848        #[allow(non_camel_case_types)]
3849        #[doc(hidden)]
3850        #[derive(PartialEq, Eq, Hash)]
3851        enum __FieldTag {
3852            __name,
3853            __page_size,
3854            __page_token,
3855            Unknown(std::string::String),
3856        }
3857        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3858            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3859            where
3860                D: serde::Deserializer<'de>,
3861            {
3862                struct Visitor;
3863                impl<'de> serde::de::Visitor<'de> for Visitor {
3864                    type Value = __FieldTag;
3865                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3866                        formatter.write_str("a field name for ListPostureRevisionsRequest")
3867                    }
3868                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3869                    where
3870                        E: serde::de::Error,
3871                    {
3872                        use std::result::Result::Ok;
3873                        use std::string::ToString;
3874                        match value {
3875                            "name" => Ok(__FieldTag::__name),
3876                            "pageSize" => Ok(__FieldTag::__page_size),
3877                            "page_size" => Ok(__FieldTag::__page_size),
3878                            "pageToken" => Ok(__FieldTag::__page_token),
3879                            "page_token" => Ok(__FieldTag::__page_token),
3880                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3881                        }
3882                    }
3883                }
3884                deserializer.deserialize_identifier(Visitor)
3885            }
3886        }
3887        struct Visitor;
3888        impl<'de> serde::de::Visitor<'de> for Visitor {
3889            type Value = ListPostureRevisionsRequest;
3890            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3891                formatter.write_str("struct ListPostureRevisionsRequest")
3892            }
3893            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3894            where
3895                A: serde::de::MapAccess<'de>,
3896            {
3897                #[allow(unused_imports)]
3898                use serde::de::Error;
3899                use std::option::Option::Some;
3900                let mut fields = std::collections::HashSet::new();
3901                let mut result = Self::Value::new();
3902                while let Some(tag) = map.next_key::<__FieldTag>()? {
3903                    #[allow(clippy::match_single_binding)]
3904                    match tag {
3905                        __FieldTag::__name => {
3906                            if !fields.insert(__FieldTag::__name) {
3907                                return std::result::Result::Err(A::Error::duplicate_field(
3908                                    "multiple values for name",
3909                                ));
3910                            }
3911                            result.name = map
3912                                .next_value::<std::option::Option<std::string::String>>()?
3913                                .unwrap_or_default();
3914                        }
3915                        __FieldTag::__page_size => {
3916                            if !fields.insert(__FieldTag::__page_size) {
3917                                return std::result::Result::Err(A::Error::duplicate_field(
3918                                    "multiple values for page_size",
3919                                ));
3920                            }
3921                            struct __With(std::option::Option<i32>);
3922                            impl<'de> serde::de::Deserialize<'de> for __With {
3923                                fn deserialize<D>(
3924                                    deserializer: D,
3925                                ) -> std::result::Result<Self, D::Error>
3926                                where
3927                                    D: serde::de::Deserializer<'de>,
3928                                {
3929                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3930                                }
3931                            }
3932                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
3933                        }
3934                        __FieldTag::__page_token => {
3935                            if !fields.insert(__FieldTag::__page_token) {
3936                                return std::result::Result::Err(A::Error::duplicate_field(
3937                                    "multiple values for page_token",
3938                                ));
3939                            }
3940                            result.page_token = map
3941                                .next_value::<std::option::Option<std::string::String>>()?
3942                                .unwrap_or_default();
3943                        }
3944                        __FieldTag::Unknown(key) => {
3945                            let value = map.next_value::<serde_json::Value>()?;
3946                            result._unknown_fields.insert(key, value);
3947                        }
3948                    }
3949                }
3950                std::result::Result::Ok(result)
3951            }
3952        }
3953        deserializer.deserialize_any(Visitor)
3954    }
3955}
3956
3957#[doc(hidden)]
3958impl serde::ser::Serialize for ListPostureRevisionsRequest {
3959    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3960    where
3961        S: serde::ser::Serializer,
3962    {
3963        use serde::ser::SerializeMap;
3964        #[allow(unused_imports)]
3965        use std::option::Option::Some;
3966        let mut state = serializer.serialize_map(std::option::Option::None)?;
3967        if !self.name.is_empty() {
3968            state.serialize_entry("name", &self.name)?;
3969        }
3970        if !wkt::internal::is_default(&self.page_size) {
3971            struct __With<'a>(&'a i32);
3972            impl<'a> serde::ser::Serialize for __With<'a> {
3973                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3974                where
3975                    S: serde::ser::Serializer,
3976                {
3977                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3978                }
3979            }
3980            state.serialize_entry("pageSize", &__With(&self.page_size))?;
3981        }
3982        if !self.page_token.is_empty() {
3983            state.serialize_entry("pageToken", &self.page_token)?;
3984        }
3985        if !self._unknown_fields.is_empty() {
3986            for (key, value) in self._unknown_fields.iter() {
3987                state.serialize_entry(key, &value)?;
3988            }
3989        }
3990        state.end()
3991    }
3992}
3993
3994/// Message for response to listing PostureRevisions.
3995#[derive(Clone, Debug, Default, PartialEq)]
3996#[non_exhaustive]
3997pub struct ListPostureRevisionsResponse {
3998    /// The list of Posture revisions.
3999    pub revisions: std::vec::Vec<crate::model::Posture>,
4000
4001    /// A token identifying a page of results the server should return.
4002    pub next_page_token: std::string::String,
4003
4004    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4005}
4006
4007impl ListPostureRevisionsResponse {
4008    pub fn new() -> Self {
4009        std::default::Default::default()
4010    }
4011
4012    /// Sets the value of [revisions][crate::model::ListPostureRevisionsResponse::revisions].
4013    pub fn set_revisions<T, V>(mut self, v: T) -> Self
4014    where
4015        T: std::iter::IntoIterator<Item = V>,
4016        V: std::convert::Into<crate::model::Posture>,
4017    {
4018        use std::iter::Iterator;
4019        self.revisions = v.into_iter().map(|i| i.into()).collect();
4020        self
4021    }
4022
4023    /// Sets the value of [next_page_token][crate::model::ListPostureRevisionsResponse::next_page_token].
4024    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4025        self.next_page_token = v.into();
4026        self
4027    }
4028}
4029
4030impl wkt::message::Message for ListPostureRevisionsResponse {
4031    fn typename() -> &'static str {
4032        "type.googleapis.com/google.cloud.securityposture.v1.ListPostureRevisionsResponse"
4033    }
4034}
4035
4036#[doc(hidden)]
4037impl gax::paginator::internal::PageableResponse for ListPostureRevisionsResponse {
4038    type PageItem = crate::model::Posture;
4039
4040    fn items(self) -> std::vec::Vec<Self::PageItem> {
4041        self.revisions
4042    }
4043
4044    fn next_page_token(&self) -> std::string::String {
4045        use std::clone::Clone;
4046        self.next_page_token.clone()
4047    }
4048}
4049
4050#[doc(hidden)]
4051impl<'de> serde::de::Deserialize<'de> for ListPostureRevisionsResponse {
4052    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4053    where
4054        D: serde::Deserializer<'de>,
4055    {
4056        #[allow(non_camel_case_types)]
4057        #[doc(hidden)]
4058        #[derive(PartialEq, Eq, Hash)]
4059        enum __FieldTag {
4060            __revisions,
4061            __next_page_token,
4062            Unknown(std::string::String),
4063        }
4064        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4065            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4066            where
4067                D: serde::Deserializer<'de>,
4068            {
4069                struct Visitor;
4070                impl<'de> serde::de::Visitor<'de> for Visitor {
4071                    type Value = __FieldTag;
4072                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4073                        formatter.write_str("a field name for ListPostureRevisionsResponse")
4074                    }
4075                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4076                    where
4077                        E: serde::de::Error,
4078                    {
4079                        use std::result::Result::Ok;
4080                        use std::string::ToString;
4081                        match value {
4082                            "revisions" => Ok(__FieldTag::__revisions),
4083                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
4084                            "next_page_token" => Ok(__FieldTag::__next_page_token),
4085                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4086                        }
4087                    }
4088                }
4089                deserializer.deserialize_identifier(Visitor)
4090            }
4091        }
4092        struct Visitor;
4093        impl<'de> serde::de::Visitor<'de> for Visitor {
4094            type Value = ListPostureRevisionsResponse;
4095            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4096                formatter.write_str("struct ListPostureRevisionsResponse")
4097            }
4098            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4099            where
4100                A: serde::de::MapAccess<'de>,
4101            {
4102                #[allow(unused_imports)]
4103                use serde::de::Error;
4104                use std::option::Option::Some;
4105                let mut fields = std::collections::HashSet::new();
4106                let mut result = Self::Value::new();
4107                while let Some(tag) = map.next_key::<__FieldTag>()? {
4108                    #[allow(clippy::match_single_binding)]
4109                    match tag {
4110                        __FieldTag::__revisions => {
4111                            if !fields.insert(__FieldTag::__revisions) {
4112                                return std::result::Result::Err(A::Error::duplicate_field(
4113                                    "multiple values for revisions",
4114                                ));
4115                            }
4116                            result.revisions = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Posture>>>()?.unwrap_or_default();
4117                        }
4118                        __FieldTag::__next_page_token => {
4119                            if !fields.insert(__FieldTag::__next_page_token) {
4120                                return std::result::Result::Err(A::Error::duplicate_field(
4121                                    "multiple values for next_page_token",
4122                                ));
4123                            }
4124                            result.next_page_token = map
4125                                .next_value::<std::option::Option<std::string::String>>()?
4126                                .unwrap_or_default();
4127                        }
4128                        __FieldTag::Unknown(key) => {
4129                            let value = map.next_value::<serde_json::Value>()?;
4130                            result._unknown_fields.insert(key, value);
4131                        }
4132                    }
4133                }
4134                std::result::Result::Ok(result)
4135            }
4136        }
4137        deserializer.deserialize_any(Visitor)
4138    }
4139}
4140
4141#[doc(hidden)]
4142impl serde::ser::Serialize for ListPostureRevisionsResponse {
4143    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4144    where
4145        S: serde::ser::Serializer,
4146    {
4147        use serde::ser::SerializeMap;
4148        #[allow(unused_imports)]
4149        use std::option::Option::Some;
4150        let mut state = serializer.serialize_map(std::option::Option::None)?;
4151        if !self.revisions.is_empty() {
4152            state.serialize_entry("revisions", &self.revisions)?;
4153        }
4154        if !self.next_page_token.is_empty() {
4155            state.serialize_entry("nextPageToken", &self.next_page_token)?;
4156        }
4157        if !self._unknown_fields.is_empty() {
4158            for (key, value) in self._unknown_fields.iter() {
4159                state.serialize_entry(key, &value)?;
4160            }
4161        }
4162        state.end()
4163    }
4164}
4165
4166/// Message for getting a Posture.
4167#[derive(Clone, Debug, Default, PartialEq)]
4168#[non_exhaustive]
4169pub struct GetPostureRequest {
4170    /// Required. Name of the resource.
4171    pub name: std::string::String,
4172
4173    /// Optional. Posture revision which needs to be retrieved.
4174    pub revision_id: std::string::String,
4175
4176    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4177}
4178
4179impl GetPostureRequest {
4180    pub fn new() -> Self {
4181        std::default::Default::default()
4182    }
4183
4184    /// Sets the value of [name][crate::model::GetPostureRequest::name].
4185    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4186        self.name = v.into();
4187        self
4188    }
4189
4190    /// Sets the value of [revision_id][crate::model::GetPostureRequest::revision_id].
4191    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4192        self.revision_id = v.into();
4193        self
4194    }
4195}
4196
4197impl wkt::message::Message for GetPostureRequest {
4198    fn typename() -> &'static str {
4199        "type.googleapis.com/google.cloud.securityposture.v1.GetPostureRequest"
4200    }
4201}
4202
4203#[doc(hidden)]
4204impl<'de> serde::de::Deserialize<'de> for GetPostureRequest {
4205    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4206    where
4207        D: serde::Deserializer<'de>,
4208    {
4209        #[allow(non_camel_case_types)]
4210        #[doc(hidden)]
4211        #[derive(PartialEq, Eq, Hash)]
4212        enum __FieldTag {
4213            __name,
4214            __revision_id,
4215            Unknown(std::string::String),
4216        }
4217        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4218            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4219            where
4220                D: serde::Deserializer<'de>,
4221            {
4222                struct Visitor;
4223                impl<'de> serde::de::Visitor<'de> for Visitor {
4224                    type Value = __FieldTag;
4225                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4226                        formatter.write_str("a field name for GetPostureRequest")
4227                    }
4228                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4229                    where
4230                        E: serde::de::Error,
4231                    {
4232                        use std::result::Result::Ok;
4233                        use std::string::ToString;
4234                        match value {
4235                            "name" => Ok(__FieldTag::__name),
4236                            "revisionId" => Ok(__FieldTag::__revision_id),
4237                            "revision_id" => Ok(__FieldTag::__revision_id),
4238                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4239                        }
4240                    }
4241                }
4242                deserializer.deserialize_identifier(Visitor)
4243            }
4244        }
4245        struct Visitor;
4246        impl<'de> serde::de::Visitor<'de> for Visitor {
4247            type Value = GetPostureRequest;
4248            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4249                formatter.write_str("struct GetPostureRequest")
4250            }
4251            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4252            where
4253                A: serde::de::MapAccess<'de>,
4254            {
4255                #[allow(unused_imports)]
4256                use serde::de::Error;
4257                use std::option::Option::Some;
4258                let mut fields = std::collections::HashSet::new();
4259                let mut result = Self::Value::new();
4260                while let Some(tag) = map.next_key::<__FieldTag>()? {
4261                    #[allow(clippy::match_single_binding)]
4262                    match tag {
4263                        __FieldTag::__name => {
4264                            if !fields.insert(__FieldTag::__name) {
4265                                return std::result::Result::Err(A::Error::duplicate_field(
4266                                    "multiple values for name",
4267                                ));
4268                            }
4269                            result.name = map
4270                                .next_value::<std::option::Option<std::string::String>>()?
4271                                .unwrap_or_default();
4272                        }
4273                        __FieldTag::__revision_id => {
4274                            if !fields.insert(__FieldTag::__revision_id) {
4275                                return std::result::Result::Err(A::Error::duplicate_field(
4276                                    "multiple values for revision_id",
4277                                ));
4278                            }
4279                            result.revision_id = map
4280                                .next_value::<std::option::Option<std::string::String>>()?
4281                                .unwrap_or_default();
4282                        }
4283                        __FieldTag::Unknown(key) => {
4284                            let value = map.next_value::<serde_json::Value>()?;
4285                            result._unknown_fields.insert(key, value);
4286                        }
4287                    }
4288                }
4289                std::result::Result::Ok(result)
4290            }
4291        }
4292        deserializer.deserialize_any(Visitor)
4293    }
4294}
4295
4296#[doc(hidden)]
4297impl serde::ser::Serialize for GetPostureRequest {
4298    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4299    where
4300        S: serde::ser::Serializer,
4301    {
4302        use serde::ser::SerializeMap;
4303        #[allow(unused_imports)]
4304        use std::option::Option::Some;
4305        let mut state = serializer.serialize_map(std::option::Option::None)?;
4306        if !self.name.is_empty() {
4307            state.serialize_entry("name", &self.name)?;
4308        }
4309        if !self.revision_id.is_empty() {
4310            state.serialize_entry("revisionId", &self.revision_id)?;
4311        }
4312        if !self._unknown_fields.is_empty() {
4313            for (key, value) in self._unknown_fields.iter() {
4314                state.serialize_entry(key, &value)?;
4315            }
4316        }
4317        state.end()
4318    }
4319}
4320
4321/// Message for creating a Posture.
4322#[derive(Clone, Debug, Default, PartialEq)]
4323#[non_exhaustive]
4324pub struct CreatePostureRequest {
4325    /// Required. Value for parent.
4326    pub parent: std::string::String,
4327
4328    /// Required. User provided identifier. It should be unique in scope of an
4329    /// Organization and location.
4330    pub posture_id: std::string::String,
4331
4332    /// Required. The resource being created.
4333    pub posture: std::option::Option<crate::model::Posture>,
4334
4335    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4336}
4337
4338impl CreatePostureRequest {
4339    pub fn new() -> Self {
4340        std::default::Default::default()
4341    }
4342
4343    /// Sets the value of [parent][crate::model::CreatePostureRequest::parent].
4344    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4345        self.parent = v.into();
4346        self
4347    }
4348
4349    /// Sets the value of [posture_id][crate::model::CreatePostureRequest::posture_id].
4350    pub fn set_posture_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4351        self.posture_id = v.into();
4352        self
4353    }
4354
4355    /// Sets the value of [posture][crate::model::CreatePostureRequest::posture].
4356    pub fn set_posture<T>(mut self, v: T) -> Self
4357    where
4358        T: std::convert::Into<crate::model::Posture>,
4359    {
4360        self.posture = std::option::Option::Some(v.into());
4361        self
4362    }
4363
4364    /// Sets or clears the value of [posture][crate::model::CreatePostureRequest::posture].
4365    pub fn set_or_clear_posture<T>(mut self, v: std::option::Option<T>) -> Self
4366    where
4367        T: std::convert::Into<crate::model::Posture>,
4368    {
4369        self.posture = v.map(|x| x.into());
4370        self
4371    }
4372}
4373
4374impl wkt::message::Message for CreatePostureRequest {
4375    fn typename() -> &'static str {
4376        "type.googleapis.com/google.cloud.securityposture.v1.CreatePostureRequest"
4377    }
4378}
4379
4380#[doc(hidden)]
4381impl<'de> serde::de::Deserialize<'de> for CreatePostureRequest {
4382    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4383    where
4384        D: serde::Deserializer<'de>,
4385    {
4386        #[allow(non_camel_case_types)]
4387        #[doc(hidden)]
4388        #[derive(PartialEq, Eq, Hash)]
4389        enum __FieldTag {
4390            __parent,
4391            __posture_id,
4392            __posture,
4393            Unknown(std::string::String),
4394        }
4395        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4396            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4397            where
4398                D: serde::Deserializer<'de>,
4399            {
4400                struct Visitor;
4401                impl<'de> serde::de::Visitor<'de> for Visitor {
4402                    type Value = __FieldTag;
4403                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4404                        formatter.write_str("a field name for CreatePostureRequest")
4405                    }
4406                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4407                    where
4408                        E: serde::de::Error,
4409                    {
4410                        use std::result::Result::Ok;
4411                        use std::string::ToString;
4412                        match value {
4413                            "parent" => Ok(__FieldTag::__parent),
4414                            "postureId" => Ok(__FieldTag::__posture_id),
4415                            "posture_id" => Ok(__FieldTag::__posture_id),
4416                            "posture" => Ok(__FieldTag::__posture),
4417                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4418                        }
4419                    }
4420                }
4421                deserializer.deserialize_identifier(Visitor)
4422            }
4423        }
4424        struct Visitor;
4425        impl<'de> serde::de::Visitor<'de> for Visitor {
4426            type Value = CreatePostureRequest;
4427            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4428                formatter.write_str("struct CreatePostureRequest")
4429            }
4430            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4431            where
4432                A: serde::de::MapAccess<'de>,
4433            {
4434                #[allow(unused_imports)]
4435                use serde::de::Error;
4436                use std::option::Option::Some;
4437                let mut fields = std::collections::HashSet::new();
4438                let mut result = Self::Value::new();
4439                while let Some(tag) = map.next_key::<__FieldTag>()? {
4440                    #[allow(clippy::match_single_binding)]
4441                    match tag {
4442                        __FieldTag::__parent => {
4443                            if !fields.insert(__FieldTag::__parent) {
4444                                return std::result::Result::Err(A::Error::duplicate_field(
4445                                    "multiple values for parent",
4446                                ));
4447                            }
4448                            result.parent = map
4449                                .next_value::<std::option::Option<std::string::String>>()?
4450                                .unwrap_or_default();
4451                        }
4452                        __FieldTag::__posture_id => {
4453                            if !fields.insert(__FieldTag::__posture_id) {
4454                                return std::result::Result::Err(A::Error::duplicate_field(
4455                                    "multiple values for posture_id",
4456                                ));
4457                            }
4458                            result.posture_id = map
4459                                .next_value::<std::option::Option<std::string::String>>()?
4460                                .unwrap_or_default();
4461                        }
4462                        __FieldTag::__posture => {
4463                            if !fields.insert(__FieldTag::__posture) {
4464                                return std::result::Result::Err(A::Error::duplicate_field(
4465                                    "multiple values for posture",
4466                                ));
4467                            }
4468                            result.posture =
4469                                map.next_value::<std::option::Option<crate::model::Posture>>()?;
4470                        }
4471                        __FieldTag::Unknown(key) => {
4472                            let value = map.next_value::<serde_json::Value>()?;
4473                            result._unknown_fields.insert(key, value);
4474                        }
4475                    }
4476                }
4477                std::result::Result::Ok(result)
4478            }
4479        }
4480        deserializer.deserialize_any(Visitor)
4481    }
4482}
4483
4484#[doc(hidden)]
4485impl serde::ser::Serialize for CreatePostureRequest {
4486    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4487    where
4488        S: serde::ser::Serializer,
4489    {
4490        use serde::ser::SerializeMap;
4491        #[allow(unused_imports)]
4492        use std::option::Option::Some;
4493        let mut state = serializer.serialize_map(std::option::Option::None)?;
4494        if !self.parent.is_empty() {
4495            state.serialize_entry("parent", &self.parent)?;
4496        }
4497        if !self.posture_id.is_empty() {
4498            state.serialize_entry("postureId", &self.posture_id)?;
4499        }
4500        if self.posture.is_some() {
4501            state.serialize_entry("posture", &self.posture)?;
4502        }
4503        if !self._unknown_fields.is_empty() {
4504            for (key, value) in self._unknown_fields.iter() {
4505                state.serialize_entry(key, &value)?;
4506            }
4507        }
4508        state.end()
4509    }
4510}
4511
4512/// Message for updating a Posture.
4513#[derive(Clone, Debug, Default, PartialEq)]
4514#[non_exhaustive]
4515pub struct UpdatePostureRequest {
4516    /// Required. Field mask is used to specify the fields to be overwritten in the
4517    /// Posture resource by the update.
4518    /// The fields specified in the update_mask are relative to the resource, not
4519    /// the full request. A field will be overwritten if it is in the mask. If the
4520    /// user does not provide a mask then all fields will be overwritten.
4521    pub update_mask: std::option::Option<wkt::FieldMask>,
4522
4523    /// Required. The resource being updated.
4524    pub posture: std::option::Option<crate::model::Posture>,
4525
4526    /// Required. Posture revision which needs to be updated.
4527    pub revision_id: std::string::String,
4528
4529    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4530}
4531
4532impl UpdatePostureRequest {
4533    pub fn new() -> Self {
4534        std::default::Default::default()
4535    }
4536
4537    /// Sets the value of [update_mask][crate::model::UpdatePostureRequest::update_mask].
4538    pub fn set_update_mask<T>(mut self, v: T) -> Self
4539    where
4540        T: std::convert::Into<wkt::FieldMask>,
4541    {
4542        self.update_mask = std::option::Option::Some(v.into());
4543        self
4544    }
4545
4546    /// Sets or clears the value of [update_mask][crate::model::UpdatePostureRequest::update_mask].
4547    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4548    where
4549        T: std::convert::Into<wkt::FieldMask>,
4550    {
4551        self.update_mask = v.map(|x| x.into());
4552        self
4553    }
4554
4555    /// Sets the value of [posture][crate::model::UpdatePostureRequest::posture].
4556    pub fn set_posture<T>(mut self, v: T) -> Self
4557    where
4558        T: std::convert::Into<crate::model::Posture>,
4559    {
4560        self.posture = std::option::Option::Some(v.into());
4561        self
4562    }
4563
4564    /// Sets or clears the value of [posture][crate::model::UpdatePostureRequest::posture].
4565    pub fn set_or_clear_posture<T>(mut self, v: std::option::Option<T>) -> Self
4566    where
4567        T: std::convert::Into<crate::model::Posture>,
4568    {
4569        self.posture = v.map(|x| x.into());
4570        self
4571    }
4572
4573    /// Sets the value of [revision_id][crate::model::UpdatePostureRequest::revision_id].
4574    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4575        self.revision_id = v.into();
4576        self
4577    }
4578}
4579
4580impl wkt::message::Message for UpdatePostureRequest {
4581    fn typename() -> &'static str {
4582        "type.googleapis.com/google.cloud.securityposture.v1.UpdatePostureRequest"
4583    }
4584}
4585
4586#[doc(hidden)]
4587impl<'de> serde::de::Deserialize<'de> for UpdatePostureRequest {
4588    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4589    where
4590        D: serde::Deserializer<'de>,
4591    {
4592        #[allow(non_camel_case_types)]
4593        #[doc(hidden)]
4594        #[derive(PartialEq, Eq, Hash)]
4595        enum __FieldTag {
4596            __update_mask,
4597            __posture,
4598            __revision_id,
4599            Unknown(std::string::String),
4600        }
4601        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4602            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4603            where
4604                D: serde::Deserializer<'de>,
4605            {
4606                struct Visitor;
4607                impl<'de> serde::de::Visitor<'de> for Visitor {
4608                    type Value = __FieldTag;
4609                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4610                        formatter.write_str("a field name for UpdatePostureRequest")
4611                    }
4612                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4613                    where
4614                        E: serde::de::Error,
4615                    {
4616                        use std::result::Result::Ok;
4617                        use std::string::ToString;
4618                        match value {
4619                            "updateMask" => Ok(__FieldTag::__update_mask),
4620                            "update_mask" => Ok(__FieldTag::__update_mask),
4621                            "posture" => Ok(__FieldTag::__posture),
4622                            "revisionId" => Ok(__FieldTag::__revision_id),
4623                            "revision_id" => Ok(__FieldTag::__revision_id),
4624                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4625                        }
4626                    }
4627                }
4628                deserializer.deserialize_identifier(Visitor)
4629            }
4630        }
4631        struct Visitor;
4632        impl<'de> serde::de::Visitor<'de> for Visitor {
4633            type Value = UpdatePostureRequest;
4634            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4635                formatter.write_str("struct UpdatePostureRequest")
4636            }
4637            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4638            where
4639                A: serde::de::MapAccess<'de>,
4640            {
4641                #[allow(unused_imports)]
4642                use serde::de::Error;
4643                use std::option::Option::Some;
4644                let mut fields = std::collections::HashSet::new();
4645                let mut result = Self::Value::new();
4646                while let Some(tag) = map.next_key::<__FieldTag>()? {
4647                    #[allow(clippy::match_single_binding)]
4648                    match tag {
4649                        __FieldTag::__update_mask => {
4650                            if !fields.insert(__FieldTag::__update_mask) {
4651                                return std::result::Result::Err(A::Error::duplicate_field(
4652                                    "multiple values for update_mask",
4653                                ));
4654                            }
4655                            result.update_mask =
4656                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
4657                        }
4658                        __FieldTag::__posture => {
4659                            if !fields.insert(__FieldTag::__posture) {
4660                                return std::result::Result::Err(A::Error::duplicate_field(
4661                                    "multiple values for posture",
4662                                ));
4663                            }
4664                            result.posture =
4665                                map.next_value::<std::option::Option<crate::model::Posture>>()?;
4666                        }
4667                        __FieldTag::__revision_id => {
4668                            if !fields.insert(__FieldTag::__revision_id) {
4669                                return std::result::Result::Err(A::Error::duplicate_field(
4670                                    "multiple values for revision_id",
4671                                ));
4672                            }
4673                            result.revision_id = map
4674                                .next_value::<std::option::Option<std::string::String>>()?
4675                                .unwrap_or_default();
4676                        }
4677                        __FieldTag::Unknown(key) => {
4678                            let value = map.next_value::<serde_json::Value>()?;
4679                            result._unknown_fields.insert(key, value);
4680                        }
4681                    }
4682                }
4683                std::result::Result::Ok(result)
4684            }
4685        }
4686        deserializer.deserialize_any(Visitor)
4687    }
4688}
4689
4690#[doc(hidden)]
4691impl serde::ser::Serialize for UpdatePostureRequest {
4692    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4693    where
4694        S: serde::ser::Serializer,
4695    {
4696        use serde::ser::SerializeMap;
4697        #[allow(unused_imports)]
4698        use std::option::Option::Some;
4699        let mut state = serializer.serialize_map(std::option::Option::None)?;
4700        if self.update_mask.is_some() {
4701            state.serialize_entry("updateMask", &self.update_mask)?;
4702        }
4703        if self.posture.is_some() {
4704            state.serialize_entry("posture", &self.posture)?;
4705        }
4706        if !self.revision_id.is_empty() {
4707            state.serialize_entry("revisionId", &self.revision_id)?;
4708        }
4709        if !self._unknown_fields.is_empty() {
4710            for (key, value) in self._unknown_fields.iter() {
4711                state.serialize_entry(key, &value)?;
4712            }
4713        }
4714        state.end()
4715    }
4716}
4717
4718/// Message for deleting a Posture.
4719#[derive(Clone, Debug, Default, PartialEq)]
4720#[non_exhaustive]
4721pub struct DeletePostureRequest {
4722    /// Required. Name of the resource.
4723    pub name: std::string::String,
4724
4725    /// Optional. Etag value of the Posture to be deleted.
4726    pub etag: std::string::String,
4727
4728    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4729}
4730
4731impl DeletePostureRequest {
4732    pub fn new() -> Self {
4733        std::default::Default::default()
4734    }
4735
4736    /// Sets the value of [name][crate::model::DeletePostureRequest::name].
4737    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4738        self.name = v.into();
4739        self
4740    }
4741
4742    /// Sets the value of [etag][crate::model::DeletePostureRequest::etag].
4743    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4744        self.etag = v.into();
4745        self
4746    }
4747}
4748
4749impl wkt::message::Message for DeletePostureRequest {
4750    fn typename() -> &'static str {
4751        "type.googleapis.com/google.cloud.securityposture.v1.DeletePostureRequest"
4752    }
4753}
4754
4755#[doc(hidden)]
4756impl<'de> serde::de::Deserialize<'de> for DeletePostureRequest {
4757    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4758    where
4759        D: serde::Deserializer<'de>,
4760    {
4761        #[allow(non_camel_case_types)]
4762        #[doc(hidden)]
4763        #[derive(PartialEq, Eq, Hash)]
4764        enum __FieldTag {
4765            __name,
4766            __etag,
4767            Unknown(std::string::String),
4768        }
4769        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4770            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4771            where
4772                D: serde::Deserializer<'de>,
4773            {
4774                struct Visitor;
4775                impl<'de> serde::de::Visitor<'de> for Visitor {
4776                    type Value = __FieldTag;
4777                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4778                        formatter.write_str("a field name for DeletePostureRequest")
4779                    }
4780                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4781                    where
4782                        E: serde::de::Error,
4783                    {
4784                        use std::result::Result::Ok;
4785                        use std::string::ToString;
4786                        match value {
4787                            "name" => Ok(__FieldTag::__name),
4788                            "etag" => Ok(__FieldTag::__etag),
4789                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4790                        }
4791                    }
4792                }
4793                deserializer.deserialize_identifier(Visitor)
4794            }
4795        }
4796        struct Visitor;
4797        impl<'de> serde::de::Visitor<'de> for Visitor {
4798            type Value = DeletePostureRequest;
4799            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4800                formatter.write_str("struct DeletePostureRequest")
4801            }
4802            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4803            where
4804                A: serde::de::MapAccess<'de>,
4805            {
4806                #[allow(unused_imports)]
4807                use serde::de::Error;
4808                use std::option::Option::Some;
4809                let mut fields = std::collections::HashSet::new();
4810                let mut result = Self::Value::new();
4811                while let Some(tag) = map.next_key::<__FieldTag>()? {
4812                    #[allow(clippy::match_single_binding)]
4813                    match tag {
4814                        __FieldTag::__name => {
4815                            if !fields.insert(__FieldTag::__name) {
4816                                return std::result::Result::Err(A::Error::duplicate_field(
4817                                    "multiple values for name",
4818                                ));
4819                            }
4820                            result.name = map
4821                                .next_value::<std::option::Option<std::string::String>>()?
4822                                .unwrap_or_default();
4823                        }
4824                        __FieldTag::__etag => {
4825                            if !fields.insert(__FieldTag::__etag) {
4826                                return std::result::Result::Err(A::Error::duplicate_field(
4827                                    "multiple values for etag",
4828                                ));
4829                            }
4830                            result.etag = map
4831                                .next_value::<std::option::Option<std::string::String>>()?
4832                                .unwrap_or_default();
4833                        }
4834                        __FieldTag::Unknown(key) => {
4835                            let value = map.next_value::<serde_json::Value>()?;
4836                            result._unknown_fields.insert(key, value);
4837                        }
4838                    }
4839                }
4840                std::result::Result::Ok(result)
4841            }
4842        }
4843        deserializer.deserialize_any(Visitor)
4844    }
4845}
4846
4847#[doc(hidden)]
4848impl serde::ser::Serialize for DeletePostureRequest {
4849    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4850    where
4851        S: serde::ser::Serializer,
4852    {
4853        use serde::ser::SerializeMap;
4854        #[allow(unused_imports)]
4855        use std::option::Option::Some;
4856        let mut state = serializer.serialize_map(std::option::Option::None)?;
4857        if !self.name.is_empty() {
4858            state.serialize_entry("name", &self.name)?;
4859        }
4860        if !self.etag.is_empty() {
4861            state.serialize_entry("etag", &self.etag)?;
4862        }
4863        if !self._unknown_fields.is_empty() {
4864            for (key, value) in self._unknown_fields.iter() {
4865                state.serialize_entry(key, &value)?;
4866            }
4867        }
4868        state.end()
4869    }
4870}
4871
4872/// Message for extracting existing policies on a workload as a Posture.
4873#[derive(Clone, Debug, Default, PartialEq)]
4874#[non_exhaustive]
4875pub struct ExtractPostureRequest {
4876    /// Required. The parent resource name. The format of this value is as follows:
4877    /// `organizations/{organization}/locations/{location}`
4878    pub parent: std::string::String,
4879
4880    /// Required. User provided identifier. It should be unique in scope of an
4881    /// Organization and location.
4882    pub posture_id: std::string::String,
4883
4884    /// Required. Workload from which the policies are to be extracted, it should
4885    /// belong to the same organization defined in parent. The format of this value
4886    /// varies depending on the scope of the request:
4887    ///
4888    /// - `folder/folderNumber`
4889    /// - `project/projectNumber`
4890    /// - `organization/organizationNumber`
4891    pub workload: std::string::String,
4892
4893    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4894}
4895
4896impl ExtractPostureRequest {
4897    pub fn new() -> Self {
4898        std::default::Default::default()
4899    }
4900
4901    /// Sets the value of [parent][crate::model::ExtractPostureRequest::parent].
4902    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4903        self.parent = v.into();
4904        self
4905    }
4906
4907    /// Sets the value of [posture_id][crate::model::ExtractPostureRequest::posture_id].
4908    pub fn set_posture_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4909        self.posture_id = v.into();
4910        self
4911    }
4912
4913    /// Sets the value of [workload][crate::model::ExtractPostureRequest::workload].
4914    pub fn set_workload<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4915        self.workload = v.into();
4916        self
4917    }
4918}
4919
4920impl wkt::message::Message for ExtractPostureRequest {
4921    fn typename() -> &'static str {
4922        "type.googleapis.com/google.cloud.securityposture.v1.ExtractPostureRequest"
4923    }
4924}
4925
4926#[doc(hidden)]
4927impl<'de> serde::de::Deserialize<'de> for ExtractPostureRequest {
4928    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4929    where
4930        D: serde::Deserializer<'de>,
4931    {
4932        #[allow(non_camel_case_types)]
4933        #[doc(hidden)]
4934        #[derive(PartialEq, Eq, Hash)]
4935        enum __FieldTag {
4936            __parent,
4937            __posture_id,
4938            __workload,
4939            Unknown(std::string::String),
4940        }
4941        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4942            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4943            where
4944                D: serde::Deserializer<'de>,
4945            {
4946                struct Visitor;
4947                impl<'de> serde::de::Visitor<'de> for Visitor {
4948                    type Value = __FieldTag;
4949                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4950                        formatter.write_str("a field name for ExtractPostureRequest")
4951                    }
4952                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4953                    where
4954                        E: serde::de::Error,
4955                    {
4956                        use std::result::Result::Ok;
4957                        use std::string::ToString;
4958                        match value {
4959                            "parent" => Ok(__FieldTag::__parent),
4960                            "postureId" => Ok(__FieldTag::__posture_id),
4961                            "posture_id" => Ok(__FieldTag::__posture_id),
4962                            "workload" => Ok(__FieldTag::__workload),
4963                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4964                        }
4965                    }
4966                }
4967                deserializer.deserialize_identifier(Visitor)
4968            }
4969        }
4970        struct Visitor;
4971        impl<'de> serde::de::Visitor<'de> for Visitor {
4972            type Value = ExtractPostureRequest;
4973            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4974                formatter.write_str("struct ExtractPostureRequest")
4975            }
4976            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4977            where
4978                A: serde::de::MapAccess<'de>,
4979            {
4980                #[allow(unused_imports)]
4981                use serde::de::Error;
4982                use std::option::Option::Some;
4983                let mut fields = std::collections::HashSet::new();
4984                let mut result = Self::Value::new();
4985                while let Some(tag) = map.next_key::<__FieldTag>()? {
4986                    #[allow(clippy::match_single_binding)]
4987                    match tag {
4988                        __FieldTag::__parent => {
4989                            if !fields.insert(__FieldTag::__parent) {
4990                                return std::result::Result::Err(A::Error::duplicate_field(
4991                                    "multiple values for parent",
4992                                ));
4993                            }
4994                            result.parent = map
4995                                .next_value::<std::option::Option<std::string::String>>()?
4996                                .unwrap_or_default();
4997                        }
4998                        __FieldTag::__posture_id => {
4999                            if !fields.insert(__FieldTag::__posture_id) {
5000                                return std::result::Result::Err(A::Error::duplicate_field(
5001                                    "multiple values for posture_id",
5002                                ));
5003                            }
5004                            result.posture_id = map
5005                                .next_value::<std::option::Option<std::string::String>>()?
5006                                .unwrap_or_default();
5007                        }
5008                        __FieldTag::__workload => {
5009                            if !fields.insert(__FieldTag::__workload) {
5010                                return std::result::Result::Err(A::Error::duplicate_field(
5011                                    "multiple values for workload",
5012                                ));
5013                            }
5014                            result.workload = map
5015                                .next_value::<std::option::Option<std::string::String>>()?
5016                                .unwrap_or_default();
5017                        }
5018                        __FieldTag::Unknown(key) => {
5019                            let value = map.next_value::<serde_json::Value>()?;
5020                            result._unknown_fields.insert(key, value);
5021                        }
5022                    }
5023                }
5024                std::result::Result::Ok(result)
5025            }
5026        }
5027        deserializer.deserialize_any(Visitor)
5028    }
5029}
5030
5031#[doc(hidden)]
5032impl serde::ser::Serialize for ExtractPostureRequest {
5033    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5034    where
5035        S: serde::ser::Serializer,
5036    {
5037        use serde::ser::SerializeMap;
5038        #[allow(unused_imports)]
5039        use std::option::Option::Some;
5040        let mut state = serializer.serialize_map(std::option::Option::None)?;
5041        if !self.parent.is_empty() {
5042            state.serialize_entry("parent", &self.parent)?;
5043        }
5044        if !self.posture_id.is_empty() {
5045            state.serialize_entry("postureId", &self.posture_id)?;
5046        }
5047        if !self.workload.is_empty() {
5048            state.serialize_entry("workload", &self.workload)?;
5049        }
5050        if !self._unknown_fields.is_empty() {
5051            for (key, value) in self._unknown_fields.iter() {
5052                state.serialize_entry(key, &value)?;
5053            }
5054        }
5055        state.end()
5056    }
5057}
5058
5059/// ========================== PostureDeployments ==========================
5060/// Message describing PostureDeployment resource.
5061#[derive(Clone, Debug, Default, PartialEq)]
5062#[non_exhaustive]
5063pub struct PostureDeployment {
5064    /// Required. The name of this PostureDeployment resource, in the format of
5065    /// organizations/{organization}/locations/{location_id}/postureDeployments/{postureDeployment}.
5066    pub name: std::string::String,
5067
5068    /// Required. Target resource where the Posture will be deployed. Currently
5069    /// supported resources are of types: projects/projectNumber,
5070    /// folders/folderNumber, organizations/organizationNumber.
5071    pub target_resource: std::string::String,
5072
5073    /// Output only. State of PostureDeployment resource.
5074    pub state: crate::model::posture_deployment::State,
5075
5076    /// Required. Posture that needs to be deployed.
5077    /// Format:
5078    /// organizations/{org_id}/locations/{location_id}/postures/\<posture\>
5079    /// Example:
5080    /// organizations/99/locations/global/postures/les-miserables.
5081    pub posture_id: std::string::String,
5082
5083    /// Required. Revision_id of the Posture that is to be deployed.
5084    pub posture_revision_id: std::string::String,
5085
5086    /// Output only. The timestamp that the PostureDeployment was created.
5087    pub create_time: std::option::Option<wkt::Timestamp>,
5088
5089    /// Output only. The timestamp that the PostureDeployment was updated.
5090    pub update_time: std::option::Option<wkt::Timestamp>,
5091
5092    /// Optional. User provided description of the PostureDeployment.
5093    pub description: std::string::String,
5094
5095    /// Optional. An opaque tag indicating the current version of the
5096    /// PostureDeployment, used for concurrency control. When the
5097    /// `PostureDeployment` is returned from either a `GetPostureDeployment` or a
5098    /// `ListPostureDeployments` request, this `etag` indicates the version of the
5099    /// current `PostureDeployment` to use when executing a read-modify-write loop.
5100    ///
5101    /// When the `PostureDeployment` is used in a `UpdatePostureDeployment` method,
5102    /// use the `etag` value that was returned from a `GetPostureDeployment`
5103    /// request as part of a read-modify-write loop for concurrency control. Not
5104    /// setting the `etag` in a `UpdatePostureDeployment` request will result in an
5105    /// unconditional write of the `PostureDeployment`.
5106    pub etag: std::string::String,
5107
5108    /// Optional. User annotations. These attributes can only be set and used by
5109    /// the user, and not by Google Security Postures.
5110    /// .
5111    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
5112
5113    /// Output only. Whether or not this Posture is in the process of being
5114    /// updated.
5115    pub reconciling: bool,
5116
5117    /// Output only. This is a output only optional field which will be filled in
5118    /// case where PostureDeployment state is UPDATE_FAILED or CREATE_FAILED or
5119    /// DELETE_FAILED. It denotes the desired Posture.
5120    pub desired_posture_id: std::string::String,
5121
5122    /// Output only. Output only optional field which provides revision_id of the
5123    /// desired_posture_id.
5124    pub desired_posture_revision_id: std::string::String,
5125
5126    /// Output only. This is a output only optional field which will be filled in
5127    /// case where PostureDeployment enters a failure state like UPDATE_FAILED or
5128    /// CREATE_FAILED or DELETE_FAILED.
5129    pub failure_message: std::string::String,
5130
5131    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5132}
5133
5134impl PostureDeployment {
5135    pub fn new() -> Self {
5136        std::default::Default::default()
5137    }
5138
5139    /// Sets the value of [name][crate::model::PostureDeployment::name].
5140    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5141        self.name = v.into();
5142        self
5143    }
5144
5145    /// Sets the value of [target_resource][crate::model::PostureDeployment::target_resource].
5146    pub fn set_target_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5147        self.target_resource = v.into();
5148        self
5149    }
5150
5151    /// Sets the value of [state][crate::model::PostureDeployment::state].
5152    pub fn set_state<T: std::convert::Into<crate::model::posture_deployment::State>>(
5153        mut self,
5154        v: T,
5155    ) -> Self {
5156        self.state = v.into();
5157        self
5158    }
5159
5160    /// Sets the value of [posture_id][crate::model::PostureDeployment::posture_id].
5161    pub fn set_posture_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5162        self.posture_id = v.into();
5163        self
5164    }
5165
5166    /// Sets the value of [posture_revision_id][crate::model::PostureDeployment::posture_revision_id].
5167    pub fn set_posture_revision_id<T: std::convert::Into<std::string::String>>(
5168        mut self,
5169        v: T,
5170    ) -> Self {
5171        self.posture_revision_id = v.into();
5172        self
5173    }
5174
5175    /// Sets the value of [create_time][crate::model::PostureDeployment::create_time].
5176    pub fn set_create_time<T>(mut self, v: T) -> Self
5177    where
5178        T: std::convert::Into<wkt::Timestamp>,
5179    {
5180        self.create_time = std::option::Option::Some(v.into());
5181        self
5182    }
5183
5184    /// Sets or clears the value of [create_time][crate::model::PostureDeployment::create_time].
5185    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5186    where
5187        T: std::convert::Into<wkt::Timestamp>,
5188    {
5189        self.create_time = v.map(|x| x.into());
5190        self
5191    }
5192
5193    /// Sets the value of [update_time][crate::model::PostureDeployment::update_time].
5194    pub fn set_update_time<T>(mut self, v: T) -> Self
5195    where
5196        T: std::convert::Into<wkt::Timestamp>,
5197    {
5198        self.update_time = std::option::Option::Some(v.into());
5199        self
5200    }
5201
5202    /// Sets or clears the value of [update_time][crate::model::PostureDeployment::update_time].
5203    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5204    where
5205        T: std::convert::Into<wkt::Timestamp>,
5206    {
5207        self.update_time = v.map(|x| x.into());
5208        self
5209    }
5210
5211    /// Sets the value of [description][crate::model::PostureDeployment::description].
5212    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5213        self.description = v.into();
5214        self
5215    }
5216
5217    /// Sets the value of [etag][crate::model::PostureDeployment::etag].
5218    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5219        self.etag = v.into();
5220        self
5221    }
5222
5223    /// Sets the value of [annotations][crate::model::PostureDeployment::annotations].
5224    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
5225    where
5226        T: std::iter::IntoIterator<Item = (K, V)>,
5227        K: std::convert::Into<std::string::String>,
5228        V: std::convert::Into<std::string::String>,
5229    {
5230        use std::iter::Iterator;
5231        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5232        self
5233    }
5234
5235    /// Sets the value of [reconciling][crate::model::PostureDeployment::reconciling].
5236    pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5237        self.reconciling = v.into();
5238        self
5239    }
5240
5241    /// Sets the value of [desired_posture_id][crate::model::PostureDeployment::desired_posture_id].
5242    pub fn set_desired_posture_id<T: std::convert::Into<std::string::String>>(
5243        mut self,
5244        v: T,
5245    ) -> Self {
5246        self.desired_posture_id = v.into();
5247        self
5248    }
5249
5250    /// Sets the value of [desired_posture_revision_id][crate::model::PostureDeployment::desired_posture_revision_id].
5251    pub fn set_desired_posture_revision_id<T: std::convert::Into<std::string::String>>(
5252        mut self,
5253        v: T,
5254    ) -> Self {
5255        self.desired_posture_revision_id = v.into();
5256        self
5257    }
5258
5259    /// Sets the value of [failure_message][crate::model::PostureDeployment::failure_message].
5260    pub fn set_failure_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5261        self.failure_message = v.into();
5262        self
5263    }
5264}
5265
5266impl wkt::message::Message for PostureDeployment {
5267    fn typename() -> &'static str {
5268        "type.googleapis.com/google.cloud.securityposture.v1.PostureDeployment"
5269    }
5270}
5271
5272#[doc(hidden)]
5273impl<'de> serde::de::Deserialize<'de> for PostureDeployment {
5274    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5275    where
5276        D: serde::Deserializer<'de>,
5277    {
5278        #[allow(non_camel_case_types)]
5279        #[doc(hidden)]
5280        #[derive(PartialEq, Eq, Hash)]
5281        enum __FieldTag {
5282            __name,
5283            __target_resource,
5284            __state,
5285            __posture_id,
5286            __posture_revision_id,
5287            __create_time,
5288            __update_time,
5289            __description,
5290            __etag,
5291            __annotations,
5292            __reconciling,
5293            __desired_posture_id,
5294            __desired_posture_revision_id,
5295            __failure_message,
5296            Unknown(std::string::String),
5297        }
5298        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5299            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5300            where
5301                D: serde::Deserializer<'de>,
5302            {
5303                struct Visitor;
5304                impl<'de> serde::de::Visitor<'de> for Visitor {
5305                    type Value = __FieldTag;
5306                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5307                        formatter.write_str("a field name for PostureDeployment")
5308                    }
5309                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5310                    where
5311                        E: serde::de::Error,
5312                    {
5313                        use std::result::Result::Ok;
5314                        use std::string::ToString;
5315                        match value {
5316                            "name" => Ok(__FieldTag::__name),
5317                            "targetResource" => Ok(__FieldTag::__target_resource),
5318                            "target_resource" => Ok(__FieldTag::__target_resource),
5319                            "state" => Ok(__FieldTag::__state),
5320                            "postureId" => Ok(__FieldTag::__posture_id),
5321                            "posture_id" => Ok(__FieldTag::__posture_id),
5322                            "postureRevisionId" => Ok(__FieldTag::__posture_revision_id),
5323                            "posture_revision_id" => Ok(__FieldTag::__posture_revision_id),
5324                            "createTime" => Ok(__FieldTag::__create_time),
5325                            "create_time" => Ok(__FieldTag::__create_time),
5326                            "updateTime" => Ok(__FieldTag::__update_time),
5327                            "update_time" => Ok(__FieldTag::__update_time),
5328                            "description" => Ok(__FieldTag::__description),
5329                            "etag" => Ok(__FieldTag::__etag),
5330                            "annotations" => Ok(__FieldTag::__annotations),
5331                            "reconciling" => Ok(__FieldTag::__reconciling),
5332                            "desiredPostureId" => Ok(__FieldTag::__desired_posture_id),
5333                            "desired_posture_id" => Ok(__FieldTag::__desired_posture_id),
5334                            "desiredPostureRevisionId" => {
5335                                Ok(__FieldTag::__desired_posture_revision_id)
5336                            }
5337                            "desired_posture_revision_id" => {
5338                                Ok(__FieldTag::__desired_posture_revision_id)
5339                            }
5340                            "failureMessage" => Ok(__FieldTag::__failure_message),
5341                            "failure_message" => Ok(__FieldTag::__failure_message),
5342                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5343                        }
5344                    }
5345                }
5346                deserializer.deserialize_identifier(Visitor)
5347            }
5348        }
5349        struct Visitor;
5350        impl<'de> serde::de::Visitor<'de> for Visitor {
5351            type Value = PostureDeployment;
5352            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5353                formatter.write_str("struct PostureDeployment")
5354            }
5355            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5356            where
5357                A: serde::de::MapAccess<'de>,
5358            {
5359                #[allow(unused_imports)]
5360                use serde::de::Error;
5361                use std::option::Option::Some;
5362                let mut fields = std::collections::HashSet::new();
5363                let mut result = Self::Value::new();
5364                while let Some(tag) = map.next_key::<__FieldTag>()? {
5365                    #[allow(clippy::match_single_binding)]
5366                    match tag {
5367                        __FieldTag::__name => {
5368                            if !fields.insert(__FieldTag::__name) {
5369                                return std::result::Result::Err(A::Error::duplicate_field(
5370                                    "multiple values for name",
5371                                ));
5372                            }
5373                            result.name = map
5374                                .next_value::<std::option::Option<std::string::String>>()?
5375                                .unwrap_or_default();
5376                        }
5377                        __FieldTag::__target_resource => {
5378                            if !fields.insert(__FieldTag::__target_resource) {
5379                                return std::result::Result::Err(A::Error::duplicate_field(
5380                                    "multiple values for target_resource",
5381                                ));
5382                            }
5383                            result.target_resource = map
5384                                .next_value::<std::option::Option<std::string::String>>()?
5385                                .unwrap_or_default();
5386                        }
5387                        __FieldTag::__state => {
5388                            if !fields.insert(__FieldTag::__state) {
5389                                return std::result::Result::Err(A::Error::duplicate_field(
5390                                    "multiple values for state",
5391                                ));
5392                            }
5393                            result.state = map.next_value::<std::option::Option<crate::model::posture_deployment::State>>()?.unwrap_or_default();
5394                        }
5395                        __FieldTag::__posture_id => {
5396                            if !fields.insert(__FieldTag::__posture_id) {
5397                                return std::result::Result::Err(A::Error::duplicate_field(
5398                                    "multiple values for posture_id",
5399                                ));
5400                            }
5401                            result.posture_id = map
5402                                .next_value::<std::option::Option<std::string::String>>()?
5403                                .unwrap_or_default();
5404                        }
5405                        __FieldTag::__posture_revision_id => {
5406                            if !fields.insert(__FieldTag::__posture_revision_id) {
5407                                return std::result::Result::Err(A::Error::duplicate_field(
5408                                    "multiple values for posture_revision_id",
5409                                ));
5410                            }
5411                            result.posture_revision_id = map
5412                                .next_value::<std::option::Option<std::string::String>>()?
5413                                .unwrap_or_default();
5414                        }
5415                        __FieldTag::__create_time => {
5416                            if !fields.insert(__FieldTag::__create_time) {
5417                                return std::result::Result::Err(A::Error::duplicate_field(
5418                                    "multiple values for create_time",
5419                                ));
5420                            }
5421                            result.create_time =
5422                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
5423                        }
5424                        __FieldTag::__update_time => {
5425                            if !fields.insert(__FieldTag::__update_time) {
5426                                return std::result::Result::Err(A::Error::duplicate_field(
5427                                    "multiple values for update_time",
5428                                ));
5429                            }
5430                            result.update_time =
5431                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
5432                        }
5433                        __FieldTag::__description => {
5434                            if !fields.insert(__FieldTag::__description) {
5435                                return std::result::Result::Err(A::Error::duplicate_field(
5436                                    "multiple values for description",
5437                                ));
5438                            }
5439                            result.description = map
5440                                .next_value::<std::option::Option<std::string::String>>()?
5441                                .unwrap_or_default();
5442                        }
5443                        __FieldTag::__etag => {
5444                            if !fields.insert(__FieldTag::__etag) {
5445                                return std::result::Result::Err(A::Error::duplicate_field(
5446                                    "multiple values for etag",
5447                                ));
5448                            }
5449                            result.etag = map
5450                                .next_value::<std::option::Option<std::string::String>>()?
5451                                .unwrap_or_default();
5452                        }
5453                        __FieldTag::__annotations => {
5454                            if !fields.insert(__FieldTag::__annotations) {
5455                                return std::result::Result::Err(A::Error::duplicate_field(
5456                                    "multiple values for annotations",
5457                                ));
5458                            }
5459                            result.annotations = map
5460                                .next_value::<std::option::Option<
5461                                    std::collections::HashMap<
5462                                        std::string::String,
5463                                        std::string::String,
5464                                    >,
5465                                >>()?
5466                                .unwrap_or_default();
5467                        }
5468                        __FieldTag::__reconciling => {
5469                            if !fields.insert(__FieldTag::__reconciling) {
5470                                return std::result::Result::Err(A::Error::duplicate_field(
5471                                    "multiple values for reconciling",
5472                                ));
5473                            }
5474                            result.reconciling = map
5475                                .next_value::<std::option::Option<bool>>()?
5476                                .unwrap_or_default();
5477                        }
5478                        __FieldTag::__desired_posture_id => {
5479                            if !fields.insert(__FieldTag::__desired_posture_id) {
5480                                return std::result::Result::Err(A::Error::duplicate_field(
5481                                    "multiple values for desired_posture_id",
5482                                ));
5483                            }
5484                            result.desired_posture_id = map
5485                                .next_value::<std::option::Option<std::string::String>>()?
5486                                .unwrap_or_default();
5487                        }
5488                        __FieldTag::__desired_posture_revision_id => {
5489                            if !fields.insert(__FieldTag::__desired_posture_revision_id) {
5490                                return std::result::Result::Err(A::Error::duplicate_field(
5491                                    "multiple values for desired_posture_revision_id",
5492                                ));
5493                            }
5494                            result.desired_posture_revision_id = map
5495                                .next_value::<std::option::Option<std::string::String>>()?
5496                                .unwrap_or_default();
5497                        }
5498                        __FieldTag::__failure_message => {
5499                            if !fields.insert(__FieldTag::__failure_message) {
5500                                return std::result::Result::Err(A::Error::duplicate_field(
5501                                    "multiple values for failure_message",
5502                                ));
5503                            }
5504                            result.failure_message = map
5505                                .next_value::<std::option::Option<std::string::String>>()?
5506                                .unwrap_or_default();
5507                        }
5508                        __FieldTag::Unknown(key) => {
5509                            let value = map.next_value::<serde_json::Value>()?;
5510                            result._unknown_fields.insert(key, value);
5511                        }
5512                    }
5513                }
5514                std::result::Result::Ok(result)
5515            }
5516        }
5517        deserializer.deserialize_any(Visitor)
5518    }
5519}
5520
5521#[doc(hidden)]
5522impl serde::ser::Serialize for PostureDeployment {
5523    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5524    where
5525        S: serde::ser::Serializer,
5526    {
5527        use serde::ser::SerializeMap;
5528        #[allow(unused_imports)]
5529        use std::option::Option::Some;
5530        let mut state = serializer.serialize_map(std::option::Option::None)?;
5531        if !self.name.is_empty() {
5532            state.serialize_entry("name", &self.name)?;
5533        }
5534        if !self.target_resource.is_empty() {
5535            state.serialize_entry("targetResource", &self.target_resource)?;
5536        }
5537        if !wkt::internal::is_default(&self.state) {
5538            state.serialize_entry("state", &self.state)?;
5539        }
5540        if !self.posture_id.is_empty() {
5541            state.serialize_entry("postureId", &self.posture_id)?;
5542        }
5543        if !self.posture_revision_id.is_empty() {
5544            state.serialize_entry("postureRevisionId", &self.posture_revision_id)?;
5545        }
5546        if self.create_time.is_some() {
5547            state.serialize_entry("createTime", &self.create_time)?;
5548        }
5549        if self.update_time.is_some() {
5550            state.serialize_entry("updateTime", &self.update_time)?;
5551        }
5552        if !self.description.is_empty() {
5553            state.serialize_entry("description", &self.description)?;
5554        }
5555        if !self.etag.is_empty() {
5556            state.serialize_entry("etag", &self.etag)?;
5557        }
5558        if !self.annotations.is_empty() {
5559            state.serialize_entry("annotations", &self.annotations)?;
5560        }
5561        if !wkt::internal::is_default(&self.reconciling) {
5562            state.serialize_entry("reconciling", &self.reconciling)?;
5563        }
5564        if !self.desired_posture_id.is_empty() {
5565            state.serialize_entry("desiredPostureId", &self.desired_posture_id)?;
5566        }
5567        if !self.desired_posture_revision_id.is_empty() {
5568            state.serialize_entry(
5569                "desiredPostureRevisionId",
5570                &self.desired_posture_revision_id,
5571            )?;
5572        }
5573        if !self.failure_message.is_empty() {
5574            state.serialize_entry("failureMessage", &self.failure_message)?;
5575        }
5576        if !self._unknown_fields.is_empty() {
5577            for (key, value) in self._unknown_fields.iter() {
5578                state.serialize_entry(key, &value)?;
5579            }
5580        }
5581        state.end()
5582    }
5583}
5584
5585/// Defines additional types related to [PostureDeployment].
5586pub mod posture_deployment {
5587    #[allow(unused_imports)]
5588    use super::*;
5589
5590    /// State of a PostureDeployment.
5591    ///
5592    /// # Working with unknown values
5593    ///
5594    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5595    /// additional enum variants at any time. Adding new variants is not considered
5596    /// a breaking change. Applications should write their code in anticipation of:
5597    ///
5598    /// - New values appearing in future releases of the client library, **and**
5599    /// - New values received dynamically, without application changes.
5600    ///
5601    /// Please consult the [Working with enums] section in the user guide for some
5602    /// guidelines.
5603    ///
5604    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5605    #[derive(Clone, Debug, PartialEq)]
5606    #[non_exhaustive]
5607    pub enum State {
5608        /// Unspecified operation state.
5609        Unspecified,
5610        /// The PostureDeployment is being created.
5611        Creating,
5612        /// The PostureDeployment is being deleted.
5613        Deleting,
5614        /// The PostureDeployment state is being updated.
5615        Updating,
5616        /// The PostureDeployment state is active and in use.
5617        Active,
5618        /// The PostureDeployment creation failed.
5619        CreateFailed,
5620        /// The PostureDeployment update failed.
5621        UpdateFailed,
5622        /// The PostureDeployment deletion failed.
5623        DeleteFailed,
5624        /// If set, the enum was initialized with an unknown value.
5625        ///
5626        /// Applications can examine the value using [State::value] or
5627        /// [State::name].
5628        UnknownValue(state::UnknownValue),
5629    }
5630
5631    #[doc(hidden)]
5632    pub mod state {
5633        #[allow(unused_imports)]
5634        use super::*;
5635        #[derive(Clone, Debug, PartialEq)]
5636        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5637    }
5638
5639    impl State {
5640        /// Gets the enum value.
5641        ///
5642        /// Returns `None` if the enum contains an unknown value deserialized from
5643        /// the string representation of enums.
5644        pub fn value(&self) -> std::option::Option<i32> {
5645            match self {
5646                Self::Unspecified => std::option::Option::Some(0),
5647                Self::Creating => std::option::Option::Some(1),
5648                Self::Deleting => std::option::Option::Some(2),
5649                Self::Updating => std::option::Option::Some(3),
5650                Self::Active => std::option::Option::Some(4),
5651                Self::CreateFailed => std::option::Option::Some(5),
5652                Self::UpdateFailed => std::option::Option::Some(6),
5653                Self::DeleteFailed => std::option::Option::Some(7),
5654                Self::UnknownValue(u) => u.0.value(),
5655            }
5656        }
5657
5658        /// Gets the enum value as a string.
5659        ///
5660        /// Returns `None` if the enum contains an unknown value deserialized from
5661        /// the integer representation of enums.
5662        pub fn name(&self) -> std::option::Option<&str> {
5663            match self {
5664                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
5665                Self::Creating => std::option::Option::Some("CREATING"),
5666                Self::Deleting => std::option::Option::Some("DELETING"),
5667                Self::Updating => std::option::Option::Some("UPDATING"),
5668                Self::Active => std::option::Option::Some("ACTIVE"),
5669                Self::CreateFailed => std::option::Option::Some("CREATE_FAILED"),
5670                Self::UpdateFailed => std::option::Option::Some("UPDATE_FAILED"),
5671                Self::DeleteFailed => std::option::Option::Some("DELETE_FAILED"),
5672                Self::UnknownValue(u) => u.0.name(),
5673            }
5674        }
5675    }
5676
5677    impl std::default::Default for State {
5678        fn default() -> Self {
5679            use std::convert::From;
5680            Self::from(0)
5681        }
5682    }
5683
5684    impl std::fmt::Display for State {
5685        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5686            wkt::internal::display_enum(f, self.name(), self.value())
5687        }
5688    }
5689
5690    impl std::convert::From<i32> for State {
5691        fn from(value: i32) -> Self {
5692            match value {
5693                0 => Self::Unspecified,
5694                1 => Self::Creating,
5695                2 => Self::Deleting,
5696                3 => Self::Updating,
5697                4 => Self::Active,
5698                5 => Self::CreateFailed,
5699                6 => Self::UpdateFailed,
5700                7 => Self::DeleteFailed,
5701                _ => Self::UnknownValue(state::UnknownValue(
5702                    wkt::internal::UnknownEnumValue::Integer(value),
5703                )),
5704            }
5705        }
5706    }
5707
5708    impl std::convert::From<&str> for State {
5709        fn from(value: &str) -> Self {
5710            use std::string::ToString;
5711            match value {
5712                "STATE_UNSPECIFIED" => Self::Unspecified,
5713                "CREATING" => Self::Creating,
5714                "DELETING" => Self::Deleting,
5715                "UPDATING" => Self::Updating,
5716                "ACTIVE" => Self::Active,
5717                "CREATE_FAILED" => Self::CreateFailed,
5718                "UPDATE_FAILED" => Self::UpdateFailed,
5719                "DELETE_FAILED" => Self::DeleteFailed,
5720                _ => Self::UnknownValue(state::UnknownValue(
5721                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5722                )),
5723            }
5724        }
5725    }
5726
5727    impl serde::ser::Serialize for State {
5728        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5729        where
5730            S: serde::Serializer,
5731        {
5732            match self {
5733                Self::Unspecified => serializer.serialize_i32(0),
5734                Self::Creating => serializer.serialize_i32(1),
5735                Self::Deleting => serializer.serialize_i32(2),
5736                Self::Updating => serializer.serialize_i32(3),
5737                Self::Active => serializer.serialize_i32(4),
5738                Self::CreateFailed => serializer.serialize_i32(5),
5739                Self::UpdateFailed => serializer.serialize_i32(6),
5740                Self::DeleteFailed => serializer.serialize_i32(7),
5741                Self::UnknownValue(u) => u.0.serialize(serializer),
5742            }
5743        }
5744    }
5745
5746    impl<'de> serde::de::Deserialize<'de> for State {
5747        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5748        where
5749            D: serde::Deserializer<'de>,
5750        {
5751            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
5752                ".google.cloud.securityposture.v1.PostureDeployment.State",
5753            ))
5754        }
5755    }
5756}
5757
5758/// Message for requesting list of PostureDeployments.
5759#[derive(Clone, Debug, Default, PartialEq)]
5760#[non_exhaustive]
5761pub struct ListPostureDeploymentsRequest {
5762    /// Required. Parent value for ListPostureDeploymentsRequest.
5763    pub parent: std::string::String,
5764
5765    /// Optional. Requested page size. Server may return fewer items than
5766    /// requested. If unspecified, server will pick an appropriate default.
5767    pub page_size: i32,
5768
5769    /// Optional. A token identifying a page of results the server should return.
5770    pub page_token: std::string::String,
5771
5772    /// Optional. Filter to be applied on the resource, defined by EBNF grammar
5773    /// <https://google.aip.dev/assets/misc/ebnf-filtering.txt>.
5774    pub filter: std::string::String,
5775
5776    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5777}
5778
5779impl ListPostureDeploymentsRequest {
5780    pub fn new() -> Self {
5781        std::default::Default::default()
5782    }
5783
5784    /// Sets the value of [parent][crate::model::ListPostureDeploymentsRequest::parent].
5785    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5786        self.parent = v.into();
5787        self
5788    }
5789
5790    /// Sets the value of [page_size][crate::model::ListPostureDeploymentsRequest::page_size].
5791    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5792        self.page_size = v.into();
5793        self
5794    }
5795
5796    /// Sets the value of [page_token][crate::model::ListPostureDeploymentsRequest::page_token].
5797    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5798        self.page_token = v.into();
5799        self
5800    }
5801
5802    /// Sets the value of [filter][crate::model::ListPostureDeploymentsRequest::filter].
5803    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5804        self.filter = v.into();
5805        self
5806    }
5807}
5808
5809impl wkt::message::Message for ListPostureDeploymentsRequest {
5810    fn typename() -> &'static str {
5811        "type.googleapis.com/google.cloud.securityposture.v1.ListPostureDeploymentsRequest"
5812    }
5813}
5814
5815#[doc(hidden)]
5816impl<'de> serde::de::Deserialize<'de> for ListPostureDeploymentsRequest {
5817    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5818    where
5819        D: serde::Deserializer<'de>,
5820    {
5821        #[allow(non_camel_case_types)]
5822        #[doc(hidden)]
5823        #[derive(PartialEq, Eq, Hash)]
5824        enum __FieldTag {
5825            __parent,
5826            __page_size,
5827            __page_token,
5828            __filter,
5829            Unknown(std::string::String),
5830        }
5831        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5832            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5833            where
5834                D: serde::Deserializer<'de>,
5835            {
5836                struct Visitor;
5837                impl<'de> serde::de::Visitor<'de> for Visitor {
5838                    type Value = __FieldTag;
5839                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5840                        formatter.write_str("a field name for ListPostureDeploymentsRequest")
5841                    }
5842                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5843                    where
5844                        E: serde::de::Error,
5845                    {
5846                        use std::result::Result::Ok;
5847                        use std::string::ToString;
5848                        match value {
5849                            "parent" => Ok(__FieldTag::__parent),
5850                            "pageSize" => Ok(__FieldTag::__page_size),
5851                            "page_size" => Ok(__FieldTag::__page_size),
5852                            "pageToken" => Ok(__FieldTag::__page_token),
5853                            "page_token" => Ok(__FieldTag::__page_token),
5854                            "filter" => Ok(__FieldTag::__filter),
5855                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5856                        }
5857                    }
5858                }
5859                deserializer.deserialize_identifier(Visitor)
5860            }
5861        }
5862        struct Visitor;
5863        impl<'de> serde::de::Visitor<'de> for Visitor {
5864            type Value = ListPostureDeploymentsRequest;
5865            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5866                formatter.write_str("struct ListPostureDeploymentsRequest")
5867            }
5868            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5869            where
5870                A: serde::de::MapAccess<'de>,
5871            {
5872                #[allow(unused_imports)]
5873                use serde::de::Error;
5874                use std::option::Option::Some;
5875                let mut fields = std::collections::HashSet::new();
5876                let mut result = Self::Value::new();
5877                while let Some(tag) = map.next_key::<__FieldTag>()? {
5878                    #[allow(clippy::match_single_binding)]
5879                    match tag {
5880                        __FieldTag::__parent => {
5881                            if !fields.insert(__FieldTag::__parent) {
5882                                return std::result::Result::Err(A::Error::duplicate_field(
5883                                    "multiple values for parent",
5884                                ));
5885                            }
5886                            result.parent = map
5887                                .next_value::<std::option::Option<std::string::String>>()?
5888                                .unwrap_or_default();
5889                        }
5890                        __FieldTag::__page_size => {
5891                            if !fields.insert(__FieldTag::__page_size) {
5892                                return std::result::Result::Err(A::Error::duplicate_field(
5893                                    "multiple values for page_size",
5894                                ));
5895                            }
5896                            struct __With(std::option::Option<i32>);
5897                            impl<'de> serde::de::Deserialize<'de> for __With {
5898                                fn deserialize<D>(
5899                                    deserializer: D,
5900                                ) -> std::result::Result<Self, D::Error>
5901                                where
5902                                    D: serde::de::Deserializer<'de>,
5903                                {
5904                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
5905                                }
5906                            }
5907                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
5908                        }
5909                        __FieldTag::__page_token => {
5910                            if !fields.insert(__FieldTag::__page_token) {
5911                                return std::result::Result::Err(A::Error::duplicate_field(
5912                                    "multiple values for page_token",
5913                                ));
5914                            }
5915                            result.page_token = map
5916                                .next_value::<std::option::Option<std::string::String>>()?
5917                                .unwrap_or_default();
5918                        }
5919                        __FieldTag::__filter => {
5920                            if !fields.insert(__FieldTag::__filter) {
5921                                return std::result::Result::Err(A::Error::duplicate_field(
5922                                    "multiple values for filter",
5923                                ));
5924                            }
5925                            result.filter = map
5926                                .next_value::<std::option::Option<std::string::String>>()?
5927                                .unwrap_or_default();
5928                        }
5929                        __FieldTag::Unknown(key) => {
5930                            let value = map.next_value::<serde_json::Value>()?;
5931                            result._unknown_fields.insert(key, value);
5932                        }
5933                    }
5934                }
5935                std::result::Result::Ok(result)
5936            }
5937        }
5938        deserializer.deserialize_any(Visitor)
5939    }
5940}
5941
5942#[doc(hidden)]
5943impl serde::ser::Serialize for ListPostureDeploymentsRequest {
5944    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5945    where
5946        S: serde::ser::Serializer,
5947    {
5948        use serde::ser::SerializeMap;
5949        #[allow(unused_imports)]
5950        use std::option::Option::Some;
5951        let mut state = serializer.serialize_map(std::option::Option::None)?;
5952        if !self.parent.is_empty() {
5953            state.serialize_entry("parent", &self.parent)?;
5954        }
5955        if !wkt::internal::is_default(&self.page_size) {
5956            struct __With<'a>(&'a i32);
5957            impl<'a> serde::ser::Serialize for __With<'a> {
5958                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5959                where
5960                    S: serde::ser::Serializer,
5961                {
5962                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
5963                }
5964            }
5965            state.serialize_entry("pageSize", &__With(&self.page_size))?;
5966        }
5967        if !self.page_token.is_empty() {
5968            state.serialize_entry("pageToken", &self.page_token)?;
5969        }
5970        if !self.filter.is_empty() {
5971            state.serialize_entry("filter", &self.filter)?;
5972        }
5973        if !self._unknown_fields.is_empty() {
5974            for (key, value) in self._unknown_fields.iter() {
5975                state.serialize_entry(key, &value)?;
5976            }
5977        }
5978        state.end()
5979    }
5980}
5981
5982/// Message for response to listing PostureDeployments.
5983#[derive(Clone, Debug, Default, PartialEq)]
5984#[non_exhaustive]
5985pub struct ListPostureDeploymentsResponse {
5986    /// The list of PostureDeployment.
5987    pub posture_deployments: std::vec::Vec<crate::model::PostureDeployment>,
5988
5989    /// A token identifying a page of results the server should return.
5990    pub next_page_token: std::string::String,
5991
5992    /// Locations that could not be reached.
5993    pub unreachable: std::vec::Vec<std::string::String>,
5994
5995    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5996}
5997
5998impl ListPostureDeploymentsResponse {
5999    pub fn new() -> Self {
6000        std::default::Default::default()
6001    }
6002
6003    /// Sets the value of [posture_deployments][crate::model::ListPostureDeploymentsResponse::posture_deployments].
6004    pub fn set_posture_deployments<T, V>(mut self, v: T) -> Self
6005    where
6006        T: std::iter::IntoIterator<Item = V>,
6007        V: std::convert::Into<crate::model::PostureDeployment>,
6008    {
6009        use std::iter::Iterator;
6010        self.posture_deployments = v.into_iter().map(|i| i.into()).collect();
6011        self
6012    }
6013
6014    /// Sets the value of [next_page_token][crate::model::ListPostureDeploymentsResponse::next_page_token].
6015    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6016        self.next_page_token = v.into();
6017        self
6018    }
6019
6020    /// Sets the value of [unreachable][crate::model::ListPostureDeploymentsResponse::unreachable].
6021    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
6022    where
6023        T: std::iter::IntoIterator<Item = V>,
6024        V: std::convert::Into<std::string::String>,
6025    {
6026        use std::iter::Iterator;
6027        self.unreachable = v.into_iter().map(|i| i.into()).collect();
6028        self
6029    }
6030}
6031
6032impl wkt::message::Message for ListPostureDeploymentsResponse {
6033    fn typename() -> &'static str {
6034        "type.googleapis.com/google.cloud.securityposture.v1.ListPostureDeploymentsResponse"
6035    }
6036}
6037
6038#[doc(hidden)]
6039impl gax::paginator::internal::PageableResponse for ListPostureDeploymentsResponse {
6040    type PageItem = crate::model::PostureDeployment;
6041
6042    fn items(self) -> std::vec::Vec<Self::PageItem> {
6043        self.posture_deployments
6044    }
6045
6046    fn next_page_token(&self) -> std::string::String {
6047        use std::clone::Clone;
6048        self.next_page_token.clone()
6049    }
6050}
6051
6052#[doc(hidden)]
6053impl<'de> serde::de::Deserialize<'de> for ListPostureDeploymentsResponse {
6054    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6055    where
6056        D: serde::Deserializer<'de>,
6057    {
6058        #[allow(non_camel_case_types)]
6059        #[doc(hidden)]
6060        #[derive(PartialEq, Eq, Hash)]
6061        enum __FieldTag {
6062            __posture_deployments,
6063            __next_page_token,
6064            __unreachable,
6065            Unknown(std::string::String),
6066        }
6067        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6068            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6069            where
6070                D: serde::Deserializer<'de>,
6071            {
6072                struct Visitor;
6073                impl<'de> serde::de::Visitor<'de> for Visitor {
6074                    type Value = __FieldTag;
6075                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6076                        formatter.write_str("a field name for ListPostureDeploymentsResponse")
6077                    }
6078                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6079                    where
6080                        E: serde::de::Error,
6081                    {
6082                        use std::result::Result::Ok;
6083                        use std::string::ToString;
6084                        match value {
6085                            "postureDeployments" => Ok(__FieldTag::__posture_deployments),
6086                            "posture_deployments" => Ok(__FieldTag::__posture_deployments),
6087                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
6088                            "next_page_token" => Ok(__FieldTag::__next_page_token),
6089                            "unreachable" => Ok(__FieldTag::__unreachable),
6090                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6091                        }
6092                    }
6093                }
6094                deserializer.deserialize_identifier(Visitor)
6095            }
6096        }
6097        struct Visitor;
6098        impl<'de> serde::de::Visitor<'de> for Visitor {
6099            type Value = ListPostureDeploymentsResponse;
6100            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6101                formatter.write_str("struct ListPostureDeploymentsResponse")
6102            }
6103            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6104            where
6105                A: serde::de::MapAccess<'de>,
6106            {
6107                #[allow(unused_imports)]
6108                use serde::de::Error;
6109                use std::option::Option::Some;
6110                let mut fields = std::collections::HashSet::new();
6111                let mut result = Self::Value::new();
6112                while let Some(tag) = map.next_key::<__FieldTag>()? {
6113                    #[allow(clippy::match_single_binding)]
6114                    match tag {
6115                        __FieldTag::__posture_deployments => {
6116                            if !fields.insert(__FieldTag::__posture_deployments) {
6117                                return std::result::Result::Err(A::Error::duplicate_field(
6118                                    "multiple values for posture_deployments",
6119                                ));
6120                            }
6121                            result.posture_deployments =
6122                                map.next_value::<std::option::Option<
6123                                    std::vec::Vec<crate::model::PostureDeployment>,
6124                                >>()?
6125                                .unwrap_or_default();
6126                        }
6127                        __FieldTag::__next_page_token => {
6128                            if !fields.insert(__FieldTag::__next_page_token) {
6129                                return std::result::Result::Err(A::Error::duplicate_field(
6130                                    "multiple values for next_page_token",
6131                                ));
6132                            }
6133                            result.next_page_token = map
6134                                .next_value::<std::option::Option<std::string::String>>()?
6135                                .unwrap_or_default();
6136                        }
6137                        __FieldTag::__unreachable => {
6138                            if !fields.insert(__FieldTag::__unreachable) {
6139                                return std::result::Result::Err(A::Error::duplicate_field(
6140                                    "multiple values for unreachable",
6141                                ));
6142                            }
6143                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
6144                        }
6145                        __FieldTag::Unknown(key) => {
6146                            let value = map.next_value::<serde_json::Value>()?;
6147                            result._unknown_fields.insert(key, value);
6148                        }
6149                    }
6150                }
6151                std::result::Result::Ok(result)
6152            }
6153        }
6154        deserializer.deserialize_any(Visitor)
6155    }
6156}
6157
6158#[doc(hidden)]
6159impl serde::ser::Serialize for ListPostureDeploymentsResponse {
6160    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6161    where
6162        S: serde::ser::Serializer,
6163    {
6164        use serde::ser::SerializeMap;
6165        #[allow(unused_imports)]
6166        use std::option::Option::Some;
6167        let mut state = serializer.serialize_map(std::option::Option::None)?;
6168        if !self.posture_deployments.is_empty() {
6169            state.serialize_entry("postureDeployments", &self.posture_deployments)?;
6170        }
6171        if !self.next_page_token.is_empty() {
6172            state.serialize_entry("nextPageToken", &self.next_page_token)?;
6173        }
6174        if !self.unreachable.is_empty() {
6175            state.serialize_entry("unreachable", &self.unreachable)?;
6176        }
6177        if !self._unknown_fields.is_empty() {
6178            for (key, value) in self._unknown_fields.iter() {
6179                state.serialize_entry(key, &value)?;
6180            }
6181        }
6182        state.end()
6183    }
6184}
6185
6186/// Message for getting a PostureDeployment.
6187#[derive(Clone, Debug, Default, PartialEq)]
6188#[non_exhaustive]
6189pub struct GetPostureDeploymentRequest {
6190    /// Required. Name of the resource.
6191    pub name: std::string::String,
6192
6193    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6194}
6195
6196impl GetPostureDeploymentRequest {
6197    pub fn new() -> Self {
6198        std::default::Default::default()
6199    }
6200
6201    /// Sets the value of [name][crate::model::GetPostureDeploymentRequest::name].
6202    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6203        self.name = v.into();
6204        self
6205    }
6206}
6207
6208impl wkt::message::Message for GetPostureDeploymentRequest {
6209    fn typename() -> &'static str {
6210        "type.googleapis.com/google.cloud.securityposture.v1.GetPostureDeploymentRequest"
6211    }
6212}
6213
6214#[doc(hidden)]
6215impl<'de> serde::de::Deserialize<'de> for GetPostureDeploymentRequest {
6216    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6217    where
6218        D: serde::Deserializer<'de>,
6219    {
6220        #[allow(non_camel_case_types)]
6221        #[doc(hidden)]
6222        #[derive(PartialEq, Eq, Hash)]
6223        enum __FieldTag {
6224            __name,
6225            Unknown(std::string::String),
6226        }
6227        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6228            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6229            where
6230                D: serde::Deserializer<'de>,
6231            {
6232                struct Visitor;
6233                impl<'de> serde::de::Visitor<'de> for Visitor {
6234                    type Value = __FieldTag;
6235                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6236                        formatter.write_str("a field name for GetPostureDeploymentRequest")
6237                    }
6238                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6239                    where
6240                        E: serde::de::Error,
6241                    {
6242                        use std::result::Result::Ok;
6243                        use std::string::ToString;
6244                        match value {
6245                            "name" => Ok(__FieldTag::__name),
6246                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6247                        }
6248                    }
6249                }
6250                deserializer.deserialize_identifier(Visitor)
6251            }
6252        }
6253        struct Visitor;
6254        impl<'de> serde::de::Visitor<'de> for Visitor {
6255            type Value = GetPostureDeploymentRequest;
6256            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6257                formatter.write_str("struct GetPostureDeploymentRequest")
6258            }
6259            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6260            where
6261                A: serde::de::MapAccess<'de>,
6262            {
6263                #[allow(unused_imports)]
6264                use serde::de::Error;
6265                use std::option::Option::Some;
6266                let mut fields = std::collections::HashSet::new();
6267                let mut result = Self::Value::new();
6268                while let Some(tag) = map.next_key::<__FieldTag>()? {
6269                    #[allow(clippy::match_single_binding)]
6270                    match tag {
6271                        __FieldTag::__name => {
6272                            if !fields.insert(__FieldTag::__name) {
6273                                return std::result::Result::Err(A::Error::duplicate_field(
6274                                    "multiple values for name",
6275                                ));
6276                            }
6277                            result.name = map
6278                                .next_value::<std::option::Option<std::string::String>>()?
6279                                .unwrap_or_default();
6280                        }
6281                        __FieldTag::Unknown(key) => {
6282                            let value = map.next_value::<serde_json::Value>()?;
6283                            result._unknown_fields.insert(key, value);
6284                        }
6285                    }
6286                }
6287                std::result::Result::Ok(result)
6288            }
6289        }
6290        deserializer.deserialize_any(Visitor)
6291    }
6292}
6293
6294#[doc(hidden)]
6295impl serde::ser::Serialize for GetPostureDeploymentRequest {
6296    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6297    where
6298        S: serde::ser::Serializer,
6299    {
6300        use serde::ser::SerializeMap;
6301        #[allow(unused_imports)]
6302        use std::option::Option::Some;
6303        let mut state = serializer.serialize_map(std::option::Option::None)?;
6304        if !self.name.is_empty() {
6305            state.serialize_entry("name", &self.name)?;
6306        }
6307        if !self._unknown_fields.is_empty() {
6308            for (key, value) in self._unknown_fields.iter() {
6309                state.serialize_entry(key, &value)?;
6310            }
6311        }
6312        state.end()
6313    }
6314}
6315
6316/// Message for creating a PostureDeployment.
6317#[derive(Clone, Debug, Default, PartialEq)]
6318#[non_exhaustive]
6319pub struct CreatePostureDeploymentRequest {
6320    /// Required. Value for parent.
6321    /// Format: organizations/{org_id}/locations/{location}
6322    pub parent: std::string::String,
6323
6324    /// Required. User provided identifier. It should be unique in scope of an
6325    /// Organization and location.
6326    pub posture_deployment_id: std::string::String,
6327
6328    /// Required. The resource being created.
6329    pub posture_deployment: std::option::Option<crate::model::PostureDeployment>,
6330
6331    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6332}
6333
6334impl CreatePostureDeploymentRequest {
6335    pub fn new() -> Self {
6336        std::default::Default::default()
6337    }
6338
6339    /// Sets the value of [parent][crate::model::CreatePostureDeploymentRequest::parent].
6340    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6341        self.parent = v.into();
6342        self
6343    }
6344
6345    /// Sets the value of [posture_deployment_id][crate::model::CreatePostureDeploymentRequest::posture_deployment_id].
6346    pub fn set_posture_deployment_id<T: std::convert::Into<std::string::String>>(
6347        mut self,
6348        v: T,
6349    ) -> Self {
6350        self.posture_deployment_id = v.into();
6351        self
6352    }
6353
6354    /// Sets the value of [posture_deployment][crate::model::CreatePostureDeploymentRequest::posture_deployment].
6355    pub fn set_posture_deployment<T>(mut self, v: T) -> Self
6356    where
6357        T: std::convert::Into<crate::model::PostureDeployment>,
6358    {
6359        self.posture_deployment = std::option::Option::Some(v.into());
6360        self
6361    }
6362
6363    /// Sets or clears the value of [posture_deployment][crate::model::CreatePostureDeploymentRequest::posture_deployment].
6364    pub fn set_or_clear_posture_deployment<T>(mut self, v: std::option::Option<T>) -> Self
6365    where
6366        T: std::convert::Into<crate::model::PostureDeployment>,
6367    {
6368        self.posture_deployment = v.map(|x| x.into());
6369        self
6370    }
6371}
6372
6373impl wkt::message::Message for CreatePostureDeploymentRequest {
6374    fn typename() -> &'static str {
6375        "type.googleapis.com/google.cloud.securityposture.v1.CreatePostureDeploymentRequest"
6376    }
6377}
6378
6379#[doc(hidden)]
6380impl<'de> serde::de::Deserialize<'de> for CreatePostureDeploymentRequest {
6381    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6382    where
6383        D: serde::Deserializer<'de>,
6384    {
6385        #[allow(non_camel_case_types)]
6386        #[doc(hidden)]
6387        #[derive(PartialEq, Eq, Hash)]
6388        enum __FieldTag {
6389            __parent,
6390            __posture_deployment_id,
6391            __posture_deployment,
6392            Unknown(std::string::String),
6393        }
6394        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6395            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6396            where
6397                D: serde::Deserializer<'de>,
6398            {
6399                struct Visitor;
6400                impl<'de> serde::de::Visitor<'de> for Visitor {
6401                    type Value = __FieldTag;
6402                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6403                        formatter.write_str("a field name for CreatePostureDeploymentRequest")
6404                    }
6405                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6406                    where
6407                        E: serde::de::Error,
6408                    {
6409                        use std::result::Result::Ok;
6410                        use std::string::ToString;
6411                        match value {
6412                            "parent" => Ok(__FieldTag::__parent),
6413                            "postureDeploymentId" => Ok(__FieldTag::__posture_deployment_id),
6414                            "posture_deployment_id" => Ok(__FieldTag::__posture_deployment_id),
6415                            "postureDeployment" => Ok(__FieldTag::__posture_deployment),
6416                            "posture_deployment" => Ok(__FieldTag::__posture_deployment),
6417                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6418                        }
6419                    }
6420                }
6421                deserializer.deserialize_identifier(Visitor)
6422            }
6423        }
6424        struct Visitor;
6425        impl<'de> serde::de::Visitor<'de> for Visitor {
6426            type Value = CreatePostureDeploymentRequest;
6427            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6428                formatter.write_str("struct CreatePostureDeploymentRequest")
6429            }
6430            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6431            where
6432                A: serde::de::MapAccess<'de>,
6433            {
6434                #[allow(unused_imports)]
6435                use serde::de::Error;
6436                use std::option::Option::Some;
6437                let mut fields = std::collections::HashSet::new();
6438                let mut result = Self::Value::new();
6439                while let Some(tag) = map.next_key::<__FieldTag>()? {
6440                    #[allow(clippy::match_single_binding)]
6441                    match tag {
6442                        __FieldTag::__parent => {
6443                            if !fields.insert(__FieldTag::__parent) {
6444                                return std::result::Result::Err(A::Error::duplicate_field(
6445                                    "multiple values for parent",
6446                                ));
6447                            }
6448                            result.parent = map
6449                                .next_value::<std::option::Option<std::string::String>>()?
6450                                .unwrap_or_default();
6451                        }
6452                        __FieldTag::__posture_deployment_id => {
6453                            if !fields.insert(__FieldTag::__posture_deployment_id) {
6454                                return std::result::Result::Err(A::Error::duplicate_field(
6455                                    "multiple values for posture_deployment_id",
6456                                ));
6457                            }
6458                            result.posture_deployment_id = map
6459                                .next_value::<std::option::Option<std::string::String>>()?
6460                                .unwrap_or_default();
6461                        }
6462                        __FieldTag::__posture_deployment => {
6463                            if !fields.insert(__FieldTag::__posture_deployment) {
6464                                return std::result::Result::Err(A::Error::duplicate_field(
6465                                    "multiple values for posture_deployment",
6466                                ));
6467                            }
6468                            result.posture_deployment = map
6469                                .next_value::<std::option::Option<crate::model::PostureDeployment>>(
6470                                )?;
6471                        }
6472                        __FieldTag::Unknown(key) => {
6473                            let value = map.next_value::<serde_json::Value>()?;
6474                            result._unknown_fields.insert(key, value);
6475                        }
6476                    }
6477                }
6478                std::result::Result::Ok(result)
6479            }
6480        }
6481        deserializer.deserialize_any(Visitor)
6482    }
6483}
6484
6485#[doc(hidden)]
6486impl serde::ser::Serialize for CreatePostureDeploymentRequest {
6487    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6488    where
6489        S: serde::ser::Serializer,
6490    {
6491        use serde::ser::SerializeMap;
6492        #[allow(unused_imports)]
6493        use std::option::Option::Some;
6494        let mut state = serializer.serialize_map(std::option::Option::None)?;
6495        if !self.parent.is_empty() {
6496            state.serialize_entry("parent", &self.parent)?;
6497        }
6498        if !self.posture_deployment_id.is_empty() {
6499            state.serialize_entry("postureDeploymentId", &self.posture_deployment_id)?;
6500        }
6501        if self.posture_deployment.is_some() {
6502            state.serialize_entry("postureDeployment", &self.posture_deployment)?;
6503        }
6504        if !self._unknown_fields.is_empty() {
6505            for (key, value) in self._unknown_fields.iter() {
6506                state.serialize_entry(key, &value)?;
6507            }
6508        }
6509        state.end()
6510    }
6511}
6512
6513/// Message for updating a PostureDeployment.
6514#[derive(Clone, Debug, Default, PartialEq)]
6515#[non_exhaustive]
6516pub struct UpdatePostureDeploymentRequest {
6517    /// Required. Field mask is used to specify the fields to be overwritten in the
6518    /// PostureDeployment resource by the update.
6519    /// The fields specified in the update_mask are relative to the resource, not
6520    /// the full request. A field will be overwritten if it is in the mask. If the
6521    /// user does not provide a mask then all fields will be overwritten.
6522    pub update_mask: std::option::Option<wkt::FieldMask>,
6523
6524    /// Required. The resource being updated.
6525    pub posture_deployment: std::option::Option<crate::model::PostureDeployment>,
6526
6527    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6528}
6529
6530impl UpdatePostureDeploymentRequest {
6531    pub fn new() -> Self {
6532        std::default::Default::default()
6533    }
6534
6535    /// Sets the value of [update_mask][crate::model::UpdatePostureDeploymentRequest::update_mask].
6536    pub fn set_update_mask<T>(mut self, v: T) -> Self
6537    where
6538        T: std::convert::Into<wkt::FieldMask>,
6539    {
6540        self.update_mask = std::option::Option::Some(v.into());
6541        self
6542    }
6543
6544    /// Sets or clears the value of [update_mask][crate::model::UpdatePostureDeploymentRequest::update_mask].
6545    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6546    where
6547        T: std::convert::Into<wkt::FieldMask>,
6548    {
6549        self.update_mask = v.map(|x| x.into());
6550        self
6551    }
6552
6553    /// Sets the value of [posture_deployment][crate::model::UpdatePostureDeploymentRequest::posture_deployment].
6554    pub fn set_posture_deployment<T>(mut self, v: T) -> Self
6555    where
6556        T: std::convert::Into<crate::model::PostureDeployment>,
6557    {
6558        self.posture_deployment = std::option::Option::Some(v.into());
6559        self
6560    }
6561
6562    /// Sets or clears the value of [posture_deployment][crate::model::UpdatePostureDeploymentRequest::posture_deployment].
6563    pub fn set_or_clear_posture_deployment<T>(mut self, v: std::option::Option<T>) -> Self
6564    where
6565        T: std::convert::Into<crate::model::PostureDeployment>,
6566    {
6567        self.posture_deployment = v.map(|x| x.into());
6568        self
6569    }
6570}
6571
6572impl wkt::message::Message for UpdatePostureDeploymentRequest {
6573    fn typename() -> &'static str {
6574        "type.googleapis.com/google.cloud.securityposture.v1.UpdatePostureDeploymentRequest"
6575    }
6576}
6577
6578#[doc(hidden)]
6579impl<'de> serde::de::Deserialize<'de> for UpdatePostureDeploymentRequest {
6580    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6581    where
6582        D: serde::Deserializer<'de>,
6583    {
6584        #[allow(non_camel_case_types)]
6585        #[doc(hidden)]
6586        #[derive(PartialEq, Eq, Hash)]
6587        enum __FieldTag {
6588            __update_mask,
6589            __posture_deployment,
6590            Unknown(std::string::String),
6591        }
6592        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6593            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6594            where
6595                D: serde::Deserializer<'de>,
6596            {
6597                struct Visitor;
6598                impl<'de> serde::de::Visitor<'de> for Visitor {
6599                    type Value = __FieldTag;
6600                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6601                        formatter.write_str("a field name for UpdatePostureDeploymentRequest")
6602                    }
6603                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6604                    where
6605                        E: serde::de::Error,
6606                    {
6607                        use std::result::Result::Ok;
6608                        use std::string::ToString;
6609                        match value {
6610                            "updateMask" => Ok(__FieldTag::__update_mask),
6611                            "update_mask" => Ok(__FieldTag::__update_mask),
6612                            "postureDeployment" => Ok(__FieldTag::__posture_deployment),
6613                            "posture_deployment" => Ok(__FieldTag::__posture_deployment),
6614                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6615                        }
6616                    }
6617                }
6618                deserializer.deserialize_identifier(Visitor)
6619            }
6620        }
6621        struct Visitor;
6622        impl<'de> serde::de::Visitor<'de> for Visitor {
6623            type Value = UpdatePostureDeploymentRequest;
6624            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6625                formatter.write_str("struct UpdatePostureDeploymentRequest")
6626            }
6627            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6628            where
6629                A: serde::de::MapAccess<'de>,
6630            {
6631                #[allow(unused_imports)]
6632                use serde::de::Error;
6633                use std::option::Option::Some;
6634                let mut fields = std::collections::HashSet::new();
6635                let mut result = Self::Value::new();
6636                while let Some(tag) = map.next_key::<__FieldTag>()? {
6637                    #[allow(clippy::match_single_binding)]
6638                    match tag {
6639                        __FieldTag::__update_mask => {
6640                            if !fields.insert(__FieldTag::__update_mask) {
6641                                return std::result::Result::Err(A::Error::duplicate_field(
6642                                    "multiple values for update_mask",
6643                                ));
6644                            }
6645                            result.update_mask =
6646                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
6647                        }
6648                        __FieldTag::__posture_deployment => {
6649                            if !fields.insert(__FieldTag::__posture_deployment) {
6650                                return std::result::Result::Err(A::Error::duplicate_field(
6651                                    "multiple values for posture_deployment",
6652                                ));
6653                            }
6654                            result.posture_deployment = map
6655                                .next_value::<std::option::Option<crate::model::PostureDeployment>>(
6656                                )?;
6657                        }
6658                        __FieldTag::Unknown(key) => {
6659                            let value = map.next_value::<serde_json::Value>()?;
6660                            result._unknown_fields.insert(key, value);
6661                        }
6662                    }
6663                }
6664                std::result::Result::Ok(result)
6665            }
6666        }
6667        deserializer.deserialize_any(Visitor)
6668    }
6669}
6670
6671#[doc(hidden)]
6672impl serde::ser::Serialize for UpdatePostureDeploymentRequest {
6673    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6674    where
6675        S: serde::ser::Serializer,
6676    {
6677        use serde::ser::SerializeMap;
6678        #[allow(unused_imports)]
6679        use std::option::Option::Some;
6680        let mut state = serializer.serialize_map(std::option::Option::None)?;
6681        if self.update_mask.is_some() {
6682            state.serialize_entry("updateMask", &self.update_mask)?;
6683        }
6684        if self.posture_deployment.is_some() {
6685            state.serialize_entry("postureDeployment", &self.posture_deployment)?;
6686        }
6687        if !self._unknown_fields.is_empty() {
6688            for (key, value) in self._unknown_fields.iter() {
6689                state.serialize_entry(key, &value)?;
6690            }
6691        }
6692        state.end()
6693    }
6694}
6695
6696/// Message for deleting a PostureDeployment.
6697#[derive(Clone, Debug, Default, PartialEq)]
6698#[non_exhaustive]
6699pub struct DeletePostureDeploymentRequest {
6700    /// Required. Name of the resource.
6701    pub name: std::string::String,
6702
6703    /// Optional. Etag value of the PostureDeployment to be deleted.
6704    pub etag: std::string::String,
6705
6706    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6707}
6708
6709impl DeletePostureDeploymentRequest {
6710    pub fn new() -> Self {
6711        std::default::Default::default()
6712    }
6713
6714    /// Sets the value of [name][crate::model::DeletePostureDeploymentRequest::name].
6715    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6716        self.name = v.into();
6717        self
6718    }
6719
6720    /// Sets the value of [etag][crate::model::DeletePostureDeploymentRequest::etag].
6721    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6722        self.etag = v.into();
6723        self
6724    }
6725}
6726
6727impl wkt::message::Message for DeletePostureDeploymentRequest {
6728    fn typename() -> &'static str {
6729        "type.googleapis.com/google.cloud.securityposture.v1.DeletePostureDeploymentRequest"
6730    }
6731}
6732
6733#[doc(hidden)]
6734impl<'de> serde::de::Deserialize<'de> for DeletePostureDeploymentRequest {
6735    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6736    where
6737        D: serde::Deserializer<'de>,
6738    {
6739        #[allow(non_camel_case_types)]
6740        #[doc(hidden)]
6741        #[derive(PartialEq, Eq, Hash)]
6742        enum __FieldTag {
6743            __name,
6744            __etag,
6745            Unknown(std::string::String),
6746        }
6747        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6748            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6749            where
6750                D: serde::Deserializer<'de>,
6751            {
6752                struct Visitor;
6753                impl<'de> serde::de::Visitor<'de> for Visitor {
6754                    type Value = __FieldTag;
6755                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6756                        formatter.write_str("a field name for DeletePostureDeploymentRequest")
6757                    }
6758                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6759                    where
6760                        E: serde::de::Error,
6761                    {
6762                        use std::result::Result::Ok;
6763                        use std::string::ToString;
6764                        match value {
6765                            "name" => Ok(__FieldTag::__name),
6766                            "etag" => Ok(__FieldTag::__etag),
6767                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6768                        }
6769                    }
6770                }
6771                deserializer.deserialize_identifier(Visitor)
6772            }
6773        }
6774        struct Visitor;
6775        impl<'de> serde::de::Visitor<'de> for Visitor {
6776            type Value = DeletePostureDeploymentRequest;
6777            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6778                formatter.write_str("struct DeletePostureDeploymentRequest")
6779            }
6780            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6781            where
6782                A: serde::de::MapAccess<'de>,
6783            {
6784                #[allow(unused_imports)]
6785                use serde::de::Error;
6786                use std::option::Option::Some;
6787                let mut fields = std::collections::HashSet::new();
6788                let mut result = Self::Value::new();
6789                while let Some(tag) = map.next_key::<__FieldTag>()? {
6790                    #[allow(clippy::match_single_binding)]
6791                    match tag {
6792                        __FieldTag::__name => {
6793                            if !fields.insert(__FieldTag::__name) {
6794                                return std::result::Result::Err(A::Error::duplicate_field(
6795                                    "multiple values for name",
6796                                ));
6797                            }
6798                            result.name = map
6799                                .next_value::<std::option::Option<std::string::String>>()?
6800                                .unwrap_or_default();
6801                        }
6802                        __FieldTag::__etag => {
6803                            if !fields.insert(__FieldTag::__etag) {
6804                                return std::result::Result::Err(A::Error::duplicate_field(
6805                                    "multiple values for etag",
6806                                ));
6807                            }
6808                            result.etag = map
6809                                .next_value::<std::option::Option<std::string::String>>()?
6810                                .unwrap_or_default();
6811                        }
6812                        __FieldTag::Unknown(key) => {
6813                            let value = map.next_value::<serde_json::Value>()?;
6814                            result._unknown_fields.insert(key, value);
6815                        }
6816                    }
6817                }
6818                std::result::Result::Ok(result)
6819            }
6820        }
6821        deserializer.deserialize_any(Visitor)
6822    }
6823}
6824
6825#[doc(hidden)]
6826impl serde::ser::Serialize for DeletePostureDeploymentRequest {
6827    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6828    where
6829        S: serde::ser::Serializer,
6830    {
6831        use serde::ser::SerializeMap;
6832        #[allow(unused_imports)]
6833        use std::option::Option::Some;
6834        let mut state = serializer.serialize_map(std::option::Option::None)?;
6835        if !self.name.is_empty() {
6836            state.serialize_entry("name", &self.name)?;
6837        }
6838        if !self.etag.is_empty() {
6839            state.serialize_entry("etag", &self.etag)?;
6840        }
6841        if !self._unknown_fields.is_empty() {
6842            for (key, value) in self._unknown_fields.iter() {
6843                state.serialize_entry(key, &value)?;
6844            }
6845        }
6846        state.end()
6847    }
6848}
6849
6850/// PostureTemplates
6851/// Message describing PostureTemplate object.
6852#[derive(Clone, Debug, Default, PartialEq)]
6853#[non_exhaustive]
6854pub struct PostureTemplate {
6855    /// Output only. Identifier. The name of the Posture template will be of the
6856    /// format
6857    /// organizations/{organization}/locations/{location}/postureTemplates/{postureTemplate}
6858    pub name: std::string::String,
6859
6860    /// Output only. The revision_id of a PostureTemplate.
6861    pub revision_id: std::string::String,
6862
6863    /// Output only. Description of the Posture template.
6864    pub description: std::string::String,
6865
6866    /// Output only. State of PostureTemplate resource.
6867    pub state: crate::model::posture_template::State,
6868
6869    /// Output only. Policy_sets to be used by the user.
6870    pub policy_sets: std::vec::Vec<crate::model::PolicySet>,
6871
6872    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6873}
6874
6875impl PostureTemplate {
6876    pub fn new() -> Self {
6877        std::default::Default::default()
6878    }
6879
6880    /// Sets the value of [name][crate::model::PostureTemplate::name].
6881    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6882        self.name = v.into();
6883        self
6884    }
6885
6886    /// Sets the value of [revision_id][crate::model::PostureTemplate::revision_id].
6887    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6888        self.revision_id = v.into();
6889        self
6890    }
6891
6892    /// Sets the value of [description][crate::model::PostureTemplate::description].
6893    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6894        self.description = v.into();
6895        self
6896    }
6897
6898    /// Sets the value of [state][crate::model::PostureTemplate::state].
6899    pub fn set_state<T: std::convert::Into<crate::model::posture_template::State>>(
6900        mut self,
6901        v: T,
6902    ) -> Self {
6903        self.state = v.into();
6904        self
6905    }
6906
6907    /// Sets the value of [policy_sets][crate::model::PostureTemplate::policy_sets].
6908    pub fn set_policy_sets<T, V>(mut self, v: T) -> Self
6909    where
6910        T: std::iter::IntoIterator<Item = V>,
6911        V: std::convert::Into<crate::model::PolicySet>,
6912    {
6913        use std::iter::Iterator;
6914        self.policy_sets = v.into_iter().map(|i| i.into()).collect();
6915        self
6916    }
6917}
6918
6919impl wkt::message::Message for PostureTemplate {
6920    fn typename() -> &'static str {
6921        "type.googleapis.com/google.cloud.securityposture.v1.PostureTemplate"
6922    }
6923}
6924
6925#[doc(hidden)]
6926impl<'de> serde::de::Deserialize<'de> for PostureTemplate {
6927    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6928    where
6929        D: serde::Deserializer<'de>,
6930    {
6931        #[allow(non_camel_case_types)]
6932        #[doc(hidden)]
6933        #[derive(PartialEq, Eq, Hash)]
6934        enum __FieldTag {
6935            __name,
6936            __revision_id,
6937            __description,
6938            __state,
6939            __policy_sets,
6940            Unknown(std::string::String),
6941        }
6942        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6943            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6944            where
6945                D: serde::Deserializer<'de>,
6946            {
6947                struct Visitor;
6948                impl<'de> serde::de::Visitor<'de> for Visitor {
6949                    type Value = __FieldTag;
6950                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6951                        formatter.write_str("a field name for PostureTemplate")
6952                    }
6953                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6954                    where
6955                        E: serde::de::Error,
6956                    {
6957                        use std::result::Result::Ok;
6958                        use std::string::ToString;
6959                        match value {
6960                            "name" => Ok(__FieldTag::__name),
6961                            "revisionId" => Ok(__FieldTag::__revision_id),
6962                            "revision_id" => Ok(__FieldTag::__revision_id),
6963                            "description" => Ok(__FieldTag::__description),
6964                            "state" => Ok(__FieldTag::__state),
6965                            "policySets" => Ok(__FieldTag::__policy_sets),
6966                            "policy_sets" => Ok(__FieldTag::__policy_sets),
6967                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6968                        }
6969                    }
6970                }
6971                deserializer.deserialize_identifier(Visitor)
6972            }
6973        }
6974        struct Visitor;
6975        impl<'de> serde::de::Visitor<'de> for Visitor {
6976            type Value = PostureTemplate;
6977            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6978                formatter.write_str("struct PostureTemplate")
6979            }
6980            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6981            where
6982                A: serde::de::MapAccess<'de>,
6983            {
6984                #[allow(unused_imports)]
6985                use serde::de::Error;
6986                use std::option::Option::Some;
6987                let mut fields = std::collections::HashSet::new();
6988                let mut result = Self::Value::new();
6989                while let Some(tag) = map.next_key::<__FieldTag>()? {
6990                    #[allow(clippy::match_single_binding)]
6991                    match tag {
6992                        __FieldTag::__name => {
6993                            if !fields.insert(__FieldTag::__name) {
6994                                return std::result::Result::Err(A::Error::duplicate_field(
6995                                    "multiple values for name",
6996                                ));
6997                            }
6998                            result.name = map
6999                                .next_value::<std::option::Option<std::string::String>>()?
7000                                .unwrap_or_default();
7001                        }
7002                        __FieldTag::__revision_id => {
7003                            if !fields.insert(__FieldTag::__revision_id) {
7004                                return std::result::Result::Err(A::Error::duplicate_field(
7005                                    "multiple values for revision_id",
7006                                ));
7007                            }
7008                            result.revision_id = map
7009                                .next_value::<std::option::Option<std::string::String>>()?
7010                                .unwrap_or_default();
7011                        }
7012                        __FieldTag::__description => {
7013                            if !fields.insert(__FieldTag::__description) {
7014                                return std::result::Result::Err(A::Error::duplicate_field(
7015                                    "multiple values for description",
7016                                ));
7017                            }
7018                            result.description = map
7019                                .next_value::<std::option::Option<std::string::String>>()?
7020                                .unwrap_or_default();
7021                        }
7022                        __FieldTag::__state => {
7023                            if !fields.insert(__FieldTag::__state) {
7024                                return std::result::Result::Err(A::Error::duplicate_field(
7025                                    "multiple values for state",
7026                                ));
7027                            }
7028                            result.state = map.next_value::<std::option::Option<crate::model::posture_template::State>>()?.unwrap_or_default();
7029                        }
7030                        __FieldTag::__policy_sets => {
7031                            if !fields.insert(__FieldTag::__policy_sets) {
7032                                return std::result::Result::Err(A::Error::duplicate_field(
7033                                    "multiple values for policy_sets",
7034                                ));
7035                            }
7036                            result.policy_sets = map.next_value::<std::option::Option<std::vec::Vec<crate::model::PolicySet>>>()?.unwrap_or_default();
7037                        }
7038                        __FieldTag::Unknown(key) => {
7039                            let value = map.next_value::<serde_json::Value>()?;
7040                            result._unknown_fields.insert(key, value);
7041                        }
7042                    }
7043                }
7044                std::result::Result::Ok(result)
7045            }
7046        }
7047        deserializer.deserialize_any(Visitor)
7048    }
7049}
7050
7051#[doc(hidden)]
7052impl serde::ser::Serialize for PostureTemplate {
7053    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7054    where
7055        S: serde::ser::Serializer,
7056    {
7057        use serde::ser::SerializeMap;
7058        #[allow(unused_imports)]
7059        use std::option::Option::Some;
7060        let mut state = serializer.serialize_map(std::option::Option::None)?;
7061        if !self.name.is_empty() {
7062            state.serialize_entry("name", &self.name)?;
7063        }
7064        if !self.revision_id.is_empty() {
7065            state.serialize_entry("revisionId", &self.revision_id)?;
7066        }
7067        if !self.description.is_empty() {
7068            state.serialize_entry("description", &self.description)?;
7069        }
7070        if !wkt::internal::is_default(&self.state) {
7071            state.serialize_entry("state", &self.state)?;
7072        }
7073        if !self.policy_sets.is_empty() {
7074            state.serialize_entry("policySets", &self.policy_sets)?;
7075        }
7076        if !self._unknown_fields.is_empty() {
7077            for (key, value) in self._unknown_fields.iter() {
7078                state.serialize_entry(key, &value)?;
7079            }
7080        }
7081        state.end()
7082    }
7083}
7084
7085/// Defines additional types related to [PostureTemplate].
7086pub mod posture_template {
7087    #[allow(unused_imports)]
7088    use super::*;
7089
7090    /// State of a PostureTemplate
7091    ///
7092    /// # Working with unknown values
7093    ///
7094    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7095    /// additional enum variants at any time. Adding new variants is not considered
7096    /// a breaking change. Applications should write their code in anticipation of:
7097    ///
7098    /// - New values appearing in future releases of the client library, **and**
7099    /// - New values received dynamically, without application changes.
7100    ///
7101    /// Please consult the [Working with enums] section in the user guide for some
7102    /// guidelines.
7103    ///
7104    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7105    #[derive(Clone, Debug, PartialEq)]
7106    #[non_exhaustive]
7107    pub enum State {
7108        /// Unspecified state
7109        Unspecified,
7110        /// If the Posture template is adhering to the latest controls and standards.
7111        Active,
7112        /// If the Posture template controls and standards are outdated and not
7113        /// recommended for use.
7114        Deprecated,
7115        /// If set, the enum was initialized with an unknown value.
7116        ///
7117        /// Applications can examine the value using [State::value] or
7118        /// [State::name].
7119        UnknownValue(state::UnknownValue),
7120    }
7121
7122    #[doc(hidden)]
7123    pub mod state {
7124        #[allow(unused_imports)]
7125        use super::*;
7126        #[derive(Clone, Debug, PartialEq)]
7127        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7128    }
7129
7130    impl State {
7131        /// Gets the enum value.
7132        ///
7133        /// Returns `None` if the enum contains an unknown value deserialized from
7134        /// the string representation of enums.
7135        pub fn value(&self) -> std::option::Option<i32> {
7136            match self {
7137                Self::Unspecified => std::option::Option::Some(0),
7138                Self::Active => std::option::Option::Some(1),
7139                Self::Deprecated => std::option::Option::Some(2),
7140                Self::UnknownValue(u) => u.0.value(),
7141            }
7142        }
7143
7144        /// Gets the enum value as a string.
7145        ///
7146        /// Returns `None` if the enum contains an unknown value deserialized from
7147        /// the integer representation of enums.
7148        pub fn name(&self) -> std::option::Option<&str> {
7149            match self {
7150                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
7151                Self::Active => std::option::Option::Some("ACTIVE"),
7152                Self::Deprecated => std::option::Option::Some("DEPRECATED"),
7153                Self::UnknownValue(u) => u.0.name(),
7154            }
7155        }
7156    }
7157
7158    impl std::default::Default for State {
7159        fn default() -> Self {
7160            use std::convert::From;
7161            Self::from(0)
7162        }
7163    }
7164
7165    impl std::fmt::Display for State {
7166        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7167            wkt::internal::display_enum(f, self.name(), self.value())
7168        }
7169    }
7170
7171    impl std::convert::From<i32> for State {
7172        fn from(value: i32) -> Self {
7173            match value {
7174                0 => Self::Unspecified,
7175                1 => Self::Active,
7176                2 => Self::Deprecated,
7177                _ => Self::UnknownValue(state::UnknownValue(
7178                    wkt::internal::UnknownEnumValue::Integer(value),
7179                )),
7180            }
7181        }
7182    }
7183
7184    impl std::convert::From<&str> for State {
7185        fn from(value: &str) -> Self {
7186            use std::string::ToString;
7187            match value {
7188                "STATE_UNSPECIFIED" => Self::Unspecified,
7189                "ACTIVE" => Self::Active,
7190                "DEPRECATED" => Self::Deprecated,
7191                _ => Self::UnknownValue(state::UnknownValue(
7192                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7193                )),
7194            }
7195        }
7196    }
7197
7198    impl serde::ser::Serialize for State {
7199        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7200        where
7201            S: serde::Serializer,
7202        {
7203            match self {
7204                Self::Unspecified => serializer.serialize_i32(0),
7205                Self::Active => serializer.serialize_i32(1),
7206                Self::Deprecated => serializer.serialize_i32(2),
7207                Self::UnknownValue(u) => u.0.serialize(serializer),
7208            }
7209        }
7210    }
7211
7212    impl<'de> serde::de::Deserialize<'de> for State {
7213        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7214        where
7215            D: serde::Deserializer<'de>,
7216        {
7217            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
7218                ".google.cloud.securityposture.v1.PostureTemplate.State",
7219            ))
7220        }
7221    }
7222}
7223
7224/// Message for requesting list of Posture Templates.
7225#[derive(Clone, Debug, Default, PartialEq)]
7226#[non_exhaustive]
7227pub struct ListPostureTemplatesRequest {
7228    /// Required. Parent value for ListPostureTemplatesRequest.
7229    pub parent: std::string::String,
7230
7231    /// Optional. Requested page size. Server may return fewer items than
7232    /// requested. If unspecified, server will pick an appropriate default.
7233    pub page_size: i32,
7234
7235    /// Optional. A token identifying a page of results the server should return.
7236    pub page_token: std::string::String,
7237
7238    /// Optional. Filter to be applied on the resource, defined by EBNF grammar
7239    /// <https://google.aip.dev/assets/misc/ebnf-filtering.txt>.
7240    pub filter: std::string::String,
7241
7242    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7243}
7244
7245impl ListPostureTemplatesRequest {
7246    pub fn new() -> Self {
7247        std::default::Default::default()
7248    }
7249
7250    /// Sets the value of [parent][crate::model::ListPostureTemplatesRequest::parent].
7251    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7252        self.parent = v.into();
7253        self
7254    }
7255
7256    /// Sets the value of [page_size][crate::model::ListPostureTemplatesRequest::page_size].
7257    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7258        self.page_size = v.into();
7259        self
7260    }
7261
7262    /// Sets the value of [page_token][crate::model::ListPostureTemplatesRequest::page_token].
7263    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7264        self.page_token = v.into();
7265        self
7266    }
7267
7268    /// Sets the value of [filter][crate::model::ListPostureTemplatesRequest::filter].
7269    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7270        self.filter = v.into();
7271        self
7272    }
7273}
7274
7275impl wkt::message::Message for ListPostureTemplatesRequest {
7276    fn typename() -> &'static str {
7277        "type.googleapis.com/google.cloud.securityposture.v1.ListPostureTemplatesRequest"
7278    }
7279}
7280
7281#[doc(hidden)]
7282impl<'de> serde::de::Deserialize<'de> for ListPostureTemplatesRequest {
7283    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7284    where
7285        D: serde::Deserializer<'de>,
7286    {
7287        #[allow(non_camel_case_types)]
7288        #[doc(hidden)]
7289        #[derive(PartialEq, Eq, Hash)]
7290        enum __FieldTag {
7291            __parent,
7292            __page_size,
7293            __page_token,
7294            __filter,
7295            Unknown(std::string::String),
7296        }
7297        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7298            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7299            where
7300                D: serde::Deserializer<'de>,
7301            {
7302                struct Visitor;
7303                impl<'de> serde::de::Visitor<'de> for Visitor {
7304                    type Value = __FieldTag;
7305                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7306                        formatter.write_str("a field name for ListPostureTemplatesRequest")
7307                    }
7308                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7309                    where
7310                        E: serde::de::Error,
7311                    {
7312                        use std::result::Result::Ok;
7313                        use std::string::ToString;
7314                        match value {
7315                            "parent" => Ok(__FieldTag::__parent),
7316                            "pageSize" => Ok(__FieldTag::__page_size),
7317                            "page_size" => Ok(__FieldTag::__page_size),
7318                            "pageToken" => Ok(__FieldTag::__page_token),
7319                            "page_token" => Ok(__FieldTag::__page_token),
7320                            "filter" => Ok(__FieldTag::__filter),
7321                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7322                        }
7323                    }
7324                }
7325                deserializer.deserialize_identifier(Visitor)
7326            }
7327        }
7328        struct Visitor;
7329        impl<'de> serde::de::Visitor<'de> for Visitor {
7330            type Value = ListPostureTemplatesRequest;
7331            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7332                formatter.write_str("struct ListPostureTemplatesRequest")
7333            }
7334            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7335            where
7336                A: serde::de::MapAccess<'de>,
7337            {
7338                #[allow(unused_imports)]
7339                use serde::de::Error;
7340                use std::option::Option::Some;
7341                let mut fields = std::collections::HashSet::new();
7342                let mut result = Self::Value::new();
7343                while let Some(tag) = map.next_key::<__FieldTag>()? {
7344                    #[allow(clippy::match_single_binding)]
7345                    match tag {
7346                        __FieldTag::__parent => {
7347                            if !fields.insert(__FieldTag::__parent) {
7348                                return std::result::Result::Err(A::Error::duplicate_field(
7349                                    "multiple values for parent",
7350                                ));
7351                            }
7352                            result.parent = map
7353                                .next_value::<std::option::Option<std::string::String>>()?
7354                                .unwrap_or_default();
7355                        }
7356                        __FieldTag::__page_size => {
7357                            if !fields.insert(__FieldTag::__page_size) {
7358                                return std::result::Result::Err(A::Error::duplicate_field(
7359                                    "multiple values for page_size",
7360                                ));
7361                            }
7362                            struct __With(std::option::Option<i32>);
7363                            impl<'de> serde::de::Deserialize<'de> for __With {
7364                                fn deserialize<D>(
7365                                    deserializer: D,
7366                                ) -> std::result::Result<Self, D::Error>
7367                                where
7368                                    D: serde::de::Deserializer<'de>,
7369                                {
7370                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
7371                                }
7372                            }
7373                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
7374                        }
7375                        __FieldTag::__page_token => {
7376                            if !fields.insert(__FieldTag::__page_token) {
7377                                return std::result::Result::Err(A::Error::duplicate_field(
7378                                    "multiple values for page_token",
7379                                ));
7380                            }
7381                            result.page_token = map
7382                                .next_value::<std::option::Option<std::string::String>>()?
7383                                .unwrap_or_default();
7384                        }
7385                        __FieldTag::__filter => {
7386                            if !fields.insert(__FieldTag::__filter) {
7387                                return std::result::Result::Err(A::Error::duplicate_field(
7388                                    "multiple values for filter",
7389                                ));
7390                            }
7391                            result.filter = map
7392                                .next_value::<std::option::Option<std::string::String>>()?
7393                                .unwrap_or_default();
7394                        }
7395                        __FieldTag::Unknown(key) => {
7396                            let value = map.next_value::<serde_json::Value>()?;
7397                            result._unknown_fields.insert(key, value);
7398                        }
7399                    }
7400                }
7401                std::result::Result::Ok(result)
7402            }
7403        }
7404        deserializer.deserialize_any(Visitor)
7405    }
7406}
7407
7408#[doc(hidden)]
7409impl serde::ser::Serialize for ListPostureTemplatesRequest {
7410    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7411    where
7412        S: serde::ser::Serializer,
7413    {
7414        use serde::ser::SerializeMap;
7415        #[allow(unused_imports)]
7416        use std::option::Option::Some;
7417        let mut state = serializer.serialize_map(std::option::Option::None)?;
7418        if !self.parent.is_empty() {
7419            state.serialize_entry("parent", &self.parent)?;
7420        }
7421        if !wkt::internal::is_default(&self.page_size) {
7422            struct __With<'a>(&'a i32);
7423            impl<'a> serde::ser::Serialize for __With<'a> {
7424                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7425                where
7426                    S: serde::ser::Serializer,
7427                {
7428                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
7429                }
7430            }
7431            state.serialize_entry("pageSize", &__With(&self.page_size))?;
7432        }
7433        if !self.page_token.is_empty() {
7434            state.serialize_entry("pageToken", &self.page_token)?;
7435        }
7436        if !self.filter.is_empty() {
7437            state.serialize_entry("filter", &self.filter)?;
7438        }
7439        if !self._unknown_fields.is_empty() {
7440            for (key, value) in self._unknown_fields.iter() {
7441                state.serialize_entry(key, &value)?;
7442            }
7443        }
7444        state.end()
7445    }
7446}
7447
7448/// Message for response to listing PostureTemplates.
7449#[derive(Clone, Debug, Default, PartialEq)]
7450#[non_exhaustive]
7451pub struct ListPostureTemplatesResponse {
7452    /// The list of PostureTemplate.
7453    pub posture_templates: std::vec::Vec<crate::model::PostureTemplate>,
7454
7455    /// A token identifying a page of results the server should return.
7456    pub next_page_token: std::string::String,
7457
7458    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7459}
7460
7461impl ListPostureTemplatesResponse {
7462    pub fn new() -> Self {
7463        std::default::Default::default()
7464    }
7465
7466    /// Sets the value of [posture_templates][crate::model::ListPostureTemplatesResponse::posture_templates].
7467    pub fn set_posture_templates<T, V>(mut self, v: T) -> Self
7468    where
7469        T: std::iter::IntoIterator<Item = V>,
7470        V: std::convert::Into<crate::model::PostureTemplate>,
7471    {
7472        use std::iter::Iterator;
7473        self.posture_templates = v.into_iter().map(|i| i.into()).collect();
7474        self
7475    }
7476
7477    /// Sets the value of [next_page_token][crate::model::ListPostureTemplatesResponse::next_page_token].
7478    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7479        self.next_page_token = v.into();
7480        self
7481    }
7482}
7483
7484impl wkt::message::Message for ListPostureTemplatesResponse {
7485    fn typename() -> &'static str {
7486        "type.googleapis.com/google.cloud.securityposture.v1.ListPostureTemplatesResponse"
7487    }
7488}
7489
7490#[doc(hidden)]
7491impl gax::paginator::internal::PageableResponse for ListPostureTemplatesResponse {
7492    type PageItem = crate::model::PostureTemplate;
7493
7494    fn items(self) -> std::vec::Vec<Self::PageItem> {
7495        self.posture_templates
7496    }
7497
7498    fn next_page_token(&self) -> std::string::String {
7499        use std::clone::Clone;
7500        self.next_page_token.clone()
7501    }
7502}
7503
7504#[doc(hidden)]
7505impl<'de> serde::de::Deserialize<'de> for ListPostureTemplatesResponse {
7506    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7507    where
7508        D: serde::Deserializer<'de>,
7509    {
7510        #[allow(non_camel_case_types)]
7511        #[doc(hidden)]
7512        #[derive(PartialEq, Eq, Hash)]
7513        enum __FieldTag {
7514            __posture_templates,
7515            __next_page_token,
7516            Unknown(std::string::String),
7517        }
7518        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7519            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7520            where
7521                D: serde::Deserializer<'de>,
7522            {
7523                struct Visitor;
7524                impl<'de> serde::de::Visitor<'de> for Visitor {
7525                    type Value = __FieldTag;
7526                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7527                        formatter.write_str("a field name for ListPostureTemplatesResponse")
7528                    }
7529                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7530                    where
7531                        E: serde::de::Error,
7532                    {
7533                        use std::result::Result::Ok;
7534                        use std::string::ToString;
7535                        match value {
7536                            "postureTemplates" => Ok(__FieldTag::__posture_templates),
7537                            "posture_templates" => Ok(__FieldTag::__posture_templates),
7538                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
7539                            "next_page_token" => Ok(__FieldTag::__next_page_token),
7540                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7541                        }
7542                    }
7543                }
7544                deserializer.deserialize_identifier(Visitor)
7545            }
7546        }
7547        struct Visitor;
7548        impl<'de> serde::de::Visitor<'de> for Visitor {
7549            type Value = ListPostureTemplatesResponse;
7550            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7551                formatter.write_str("struct ListPostureTemplatesResponse")
7552            }
7553            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7554            where
7555                A: serde::de::MapAccess<'de>,
7556            {
7557                #[allow(unused_imports)]
7558                use serde::de::Error;
7559                use std::option::Option::Some;
7560                let mut fields = std::collections::HashSet::new();
7561                let mut result = Self::Value::new();
7562                while let Some(tag) = map.next_key::<__FieldTag>()? {
7563                    #[allow(clippy::match_single_binding)]
7564                    match tag {
7565                        __FieldTag::__posture_templates => {
7566                            if !fields.insert(__FieldTag::__posture_templates) {
7567                                return std::result::Result::Err(A::Error::duplicate_field(
7568                                    "multiple values for posture_templates",
7569                                ));
7570                            }
7571                            result.posture_templates =
7572                                map.next_value::<std::option::Option<
7573                                    std::vec::Vec<crate::model::PostureTemplate>,
7574                                >>()?
7575                                .unwrap_or_default();
7576                        }
7577                        __FieldTag::__next_page_token => {
7578                            if !fields.insert(__FieldTag::__next_page_token) {
7579                                return std::result::Result::Err(A::Error::duplicate_field(
7580                                    "multiple values for next_page_token",
7581                                ));
7582                            }
7583                            result.next_page_token = map
7584                                .next_value::<std::option::Option<std::string::String>>()?
7585                                .unwrap_or_default();
7586                        }
7587                        __FieldTag::Unknown(key) => {
7588                            let value = map.next_value::<serde_json::Value>()?;
7589                            result._unknown_fields.insert(key, value);
7590                        }
7591                    }
7592                }
7593                std::result::Result::Ok(result)
7594            }
7595        }
7596        deserializer.deserialize_any(Visitor)
7597    }
7598}
7599
7600#[doc(hidden)]
7601impl serde::ser::Serialize for ListPostureTemplatesResponse {
7602    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7603    where
7604        S: serde::ser::Serializer,
7605    {
7606        use serde::ser::SerializeMap;
7607        #[allow(unused_imports)]
7608        use std::option::Option::Some;
7609        let mut state = serializer.serialize_map(std::option::Option::None)?;
7610        if !self.posture_templates.is_empty() {
7611            state.serialize_entry("postureTemplates", &self.posture_templates)?;
7612        }
7613        if !self.next_page_token.is_empty() {
7614            state.serialize_entry("nextPageToken", &self.next_page_token)?;
7615        }
7616        if !self._unknown_fields.is_empty() {
7617            for (key, value) in self._unknown_fields.iter() {
7618                state.serialize_entry(key, &value)?;
7619            }
7620        }
7621        state.end()
7622    }
7623}
7624
7625/// Message for getting a Posture Template.
7626#[derive(Clone, Debug, Default, PartialEq)]
7627#[non_exhaustive]
7628pub struct GetPostureTemplateRequest {
7629    /// Required. Name of the resource.
7630    pub name: std::string::String,
7631
7632    /// Optional. Specific revision_id of a Posture Template.
7633    /// PostureTemplate revision_id which needs to be retrieved.
7634    pub revision_id: std::string::String,
7635
7636    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7637}
7638
7639impl GetPostureTemplateRequest {
7640    pub fn new() -> Self {
7641        std::default::Default::default()
7642    }
7643
7644    /// Sets the value of [name][crate::model::GetPostureTemplateRequest::name].
7645    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7646        self.name = v.into();
7647        self
7648    }
7649
7650    /// Sets the value of [revision_id][crate::model::GetPostureTemplateRequest::revision_id].
7651    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7652        self.revision_id = v.into();
7653        self
7654    }
7655}
7656
7657impl wkt::message::Message for GetPostureTemplateRequest {
7658    fn typename() -> &'static str {
7659        "type.googleapis.com/google.cloud.securityposture.v1.GetPostureTemplateRequest"
7660    }
7661}
7662
7663#[doc(hidden)]
7664impl<'de> serde::de::Deserialize<'de> for GetPostureTemplateRequest {
7665    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7666    where
7667        D: serde::Deserializer<'de>,
7668    {
7669        #[allow(non_camel_case_types)]
7670        #[doc(hidden)]
7671        #[derive(PartialEq, Eq, Hash)]
7672        enum __FieldTag {
7673            __name,
7674            __revision_id,
7675            Unknown(std::string::String),
7676        }
7677        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7678            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7679            where
7680                D: serde::Deserializer<'de>,
7681            {
7682                struct Visitor;
7683                impl<'de> serde::de::Visitor<'de> for Visitor {
7684                    type Value = __FieldTag;
7685                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7686                        formatter.write_str("a field name for GetPostureTemplateRequest")
7687                    }
7688                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7689                    where
7690                        E: serde::de::Error,
7691                    {
7692                        use std::result::Result::Ok;
7693                        use std::string::ToString;
7694                        match value {
7695                            "name" => Ok(__FieldTag::__name),
7696                            "revisionId" => Ok(__FieldTag::__revision_id),
7697                            "revision_id" => Ok(__FieldTag::__revision_id),
7698                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7699                        }
7700                    }
7701                }
7702                deserializer.deserialize_identifier(Visitor)
7703            }
7704        }
7705        struct Visitor;
7706        impl<'de> serde::de::Visitor<'de> for Visitor {
7707            type Value = GetPostureTemplateRequest;
7708            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7709                formatter.write_str("struct GetPostureTemplateRequest")
7710            }
7711            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7712            where
7713                A: serde::de::MapAccess<'de>,
7714            {
7715                #[allow(unused_imports)]
7716                use serde::de::Error;
7717                use std::option::Option::Some;
7718                let mut fields = std::collections::HashSet::new();
7719                let mut result = Self::Value::new();
7720                while let Some(tag) = map.next_key::<__FieldTag>()? {
7721                    #[allow(clippy::match_single_binding)]
7722                    match tag {
7723                        __FieldTag::__name => {
7724                            if !fields.insert(__FieldTag::__name) {
7725                                return std::result::Result::Err(A::Error::duplicate_field(
7726                                    "multiple values for name",
7727                                ));
7728                            }
7729                            result.name = map
7730                                .next_value::<std::option::Option<std::string::String>>()?
7731                                .unwrap_or_default();
7732                        }
7733                        __FieldTag::__revision_id => {
7734                            if !fields.insert(__FieldTag::__revision_id) {
7735                                return std::result::Result::Err(A::Error::duplicate_field(
7736                                    "multiple values for revision_id",
7737                                ));
7738                            }
7739                            result.revision_id = map
7740                                .next_value::<std::option::Option<std::string::String>>()?
7741                                .unwrap_or_default();
7742                        }
7743                        __FieldTag::Unknown(key) => {
7744                            let value = map.next_value::<serde_json::Value>()?;
7745                            result._unknown_fields.insert(key, value);
7746                        }
7747                    }
7748                }
7749                std::result::Result::Ok(result)
7750            }
7751        }
7752        deserializer.deserialize_any(Visitor)
7753    }
7754}
7755
7756#[doc(hidden)]
7757impl serde::ser::Serialize for GetPostureTemplateRequest {
7758    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7759    where
7760        S: serde::ser::Serializer,
7761    {
7762        use serde::ser::SerializeMap;
7763        #[allow(unused_imports)]
7764        use std::option::Option::Some;
7765        let mut state = serializer.serialize_map(std::option::Option::None)?;
7766        if !self.name.is_empty() {
7767            state.serialize_entry("name", &self.name)?;
7768        }
7769        if !self.revision_id.is_empty() {
7770            state.serialize_entry("revisionId", &self.revision_id)?;
7771        }
7772        if !self._unknown_fields.is_empty() {
7773            for (key, value) in self._unknown_fields.iter() {
7774                state.serialize_entry(key, &value)?;
7775            }
7776        }
7777        state.end()
7778    }
7779}
7780
7781/// Message for Security Health Analytics built-in detector.
7782#[derive(Clone, Debug, Default, PartialEq)]
7783#[non_exhaustive]
7784pub struct SecurityHealthAnalyticsModule {
7785    /// Required. The name of the module eg: BIGQUERY_TABLE_CMEK_DISABLED.
7786    pub module_name: std::string::String,
7787
7788    /// The state of enablement for the module at its level of the resource
7789    /// hierarchy.
7790    pub module_enablement_state: crate::model::EnablementState,
7791
7792    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7793}
7794
7795impl SecurityHealthAnalyticsModule {
7796    pub fn new() -> Self {
7797        std::default::Default::default()
7798    }
7799
7800    /// Sets the value of [module_name][crate::model::SecurityHealthAnalyticsModule::module_name].
7801    pub fn set_module_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7802        self.module_name = v.into();
7803        self
7804    }
7805
7806    /// Sets the value of [module_enablement_state][crate::model::SecurityHealthAnalyticsModule::module_enablement_state].
7807    pub fn set_module_enablement_state<T: std::convert::Into<crate::model::EnablementState>>(
7808        mut self,
7809        v: T,
7810    ) -> Self {
7811        self.module_enablement_state = v.into();
7812        self
7813    }
7814}
7815
7816impl wkt::message::Message for SecurityHealthAnalyticsModule {
7817    fn typename() -> &'static str {
7818        "type.googleapis.com/google.cloud.securityposture.v1.SecurityHealthAnalyticsModule"
7819    }
7820}
7821
7822#[doc(hidden)]
7823impl<'de> serde::de::Deserialize<'de> for SecurityHealthAnalyticsModule {
7824    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7825    where
7826        D: serde::Deserializer<'de>,
7827    {
7828        #[allow(non_camel_case_types)]
7829        #[doc(hidden)]
7830        #[derive(PartialEq, Eq, Hash)]
7831        enum __FieldTag {
7832            __module_name,
7833            __module_enablement_state,
7834            Unknown(std::string::String),
7835        }
7836        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7837            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7838            where
7839                D: serde::Deserializer<'de>,
7840            {
7841                struct Visitor;
7842                impl<'de> serde::de::Visitor<'de> for Visitor {
7843                    type Value = __FieldTag;
7844                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7845                        formatter.write_str("a field name for SecurityHealthAnalyticsModule")
7846                    }
7847                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7848                    where
7849                        E: serde::de::Error,
7850                    {
7851                        use std::result::Result::Ok;
7852                        use std::string::ToString;
7853                        match value {
7854                            "moduleName" => Ok(__FieldTag::__module_name),
7855                            "module_name" => Ok(__FieldTag::__module_name),
7856                            "moduleEnablementState" => Ok(__FieldTag::__module_enablement_state),
7857                            "module_enablement_state" => Ok(__FieldTag::__module_enablement_state),
7858                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7859                        }
7860                    }
7861                }
7862                deserializer.deserialize_identifier(Visitor)
7863            }
7864        }
7865        struct Visitor;
7866        impl<'de> serde::de::Visitor<'de> for Visitor {
7867            type Value = SecurityHealthAnalyticsModule;
7868            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7869                formatter.write_str("struct SecurityHealthAnalyticsModule")
7870            }
7871            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7872            where
7873                A: serde::de::MapAccess<'de>,
7874            {
7875                #[allow(unused_imports)]
7876                use serde::de::Error;
7877                use std::option::Option::Some;
7878                let mut fields = std::collections::HashSet::new();
7879                let mut result = Self::Value::new();
7880                while let Some(tag) = map.next_key::<__FieldTag>()? {
7881                    #[allow(clippy::match_single_binding)]
7882                    match tag {
7883                        __FieldTag::__module_name => {
7884                            if !fields.insert(__FieldTag::__module_name) {
7885                                return std::result::Result::Err(A::Error::duplicate_field(
7886                                    "multiple values for module_name",
7887                                ));
7888                            }
7889                            result.module_name = map
7890                                .next_value::<std::option::Option<std::string::String>>()?
7891                                .unwrap_or_default();
7892                        }
7893                        __FieldTag::__module_enablement_state => {
7894                            if !fields.insert(__FieldTag::__module_enablement_state) {
7895                                return std::result::Result::Err(A::Error::duplicate_field(
7896                                    "multiple values for module_enablement_state",
7897                                ));
7898                            }
7899                            result.module_enablement_state = map
7900                                .next_value::<std::option::Option<crate::model::EnablementState>>()?
7901                                .unwrap_or_default();
7902                        }
7903                        __FieldTag::Unknown(key) => {
7904                            let value = map.next_value::<serde_json::Value>()?;
7905                            result._unknown_fields.insert(key, value);
7906                        }
7907                    }
7908                }
7909                std::result::Result::Ok(result)
7910            }
7911        }
7912        deserializer.deserialize_any(Visitor)
7913    }
7914}
7915
7916#[doc(hidden)]
7917impl serde::ser::Serialize for SecurityHealthAnalyticsModule {
7918    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7919    where
7920        S: serde::ser::Serializer,
7921    {
7922        use serde::ser::SerializeMap;
7923        #[allow(unused_imports)]
7924        use std::option::Option::Some;
7925        let mut state = serializer.serialize_map(std::option::Option::None)?;
7926        if !self.module_name.is_empty() {
7927            state.serialize_entry("moduleName", &self.module_name)?;
7928        }
7929        if !wkt::internal::is_default(&self.module_enablement_state) {
7930            state.serialize_entry("moduleEnablementState", &self.module_enablement_state)?;
7931        }
7932        if !self._unknown_fields.is_empty() {
7933            for (key, value) in self._unknown_fields.iter() {
7934                state.serialize_entry(key, &value)?;
7935            }
7936        }
7937        state.end()
7938    }
7939}
7940
7941/// Message for SHA Custom Module
7942#[derive(Clone, Debug, Default, PartialEq)]
7943#[non_exhaustive]
7944pub struct SecurityHealthAnalyticsCustomModule {
7945    /// Output only. Immutable. The id of the custom module.
7946    /// The id is server-generated and is not user settable.
7947    /// It will be a numeric id containing 1-20 digits.
7948    pub id: std::string::String,
7949
7950    /// Optional. The display name of the Security Health Analytics custom module.
7951    /// This display name becomes the finding category for all findings that are
7952    /// returned by this custom module. The display name must be between 1 and
7953    /// 128 characters, start with a lowercase letter, and contain alphanumeric
7954    /// characters or underscores only.
7955    pub display_name: std::string::String,
7956
7957    /// Required. custom module details
7958    pub config: std::option::Option<crate::model::CustomConfig>,
7959
7960    /// The state of enablement for the module at its level of the resource
7961    /// hierarchy.
7962    pub module_enablement_state: crate::model::EnablementState,
7963
7964    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7965}
7966
7967impl SecurityHealthAnalyticsCustomModule {
7968    pub fn new() -> Self {
7969        std::default::Default::default()
7970    }
7971
7972    /// Sets the value of [id][crate::model::SecurityHealthAnalyticsCustomModule::id].
7973    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7974        self.id = v.into();
7975        self
7976    }
7977
7978    /// Sets the value of [display_name][crate::model::SecurityHealthAnalyticsCustomModule::display_name].
7979    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7980        self.display_name = v.into();
7981        self
7982    }
7983
7984    /// Sets the value of [config][crate::model::SecurityHealthAnalyticsCustomModule::config].
7985    pub fn set_config<T>(mut self, v: T) -> Self
7986    where
7987        T: std::convert::Into<crate::model::CustomConfig>,
7988    {
7989        self.config = std::option::Option::Some(v.into());
7990        self
7991    }
7992
7993    /// Sets or clears the value of [config][crate::model::SecurityHealthAnalyticsCustomModule::config].
7994    pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
7995    where
7996        T: std::convert::Into<crate::model::CustomConfig>,
7997    {
7998        self.config = v.map(|x| x.into());
7999        self
8000    }
8001
8002    /// Sets the value of [module_enablement_state][crate::model::SecurityHealthAnalyticsCustomModule::module_enablement_state].
8003    pub fn set_module_enablement_state<T: std::convert::Into<crate::model::EnablementState>>(
8004        mut self,
8005        v: T,
8006    ) -> Self {
8007        self.module_enablement_state = v.into();
8008        self
8009    }
8010}
8011
8012impl wkt::message::Message for SecurityHealthAnalyticsCustomModule {
8013    fn typename() -> &'static str {
8014        "type.googleapis.com/google.cloud.securityposture.v1.SecurityHealthAnalyticsCustomModule"
8015    }
8016}
8017
8018#[doc(hidden)]
8019impl<'de> serde::de::Deserialize<'de> for SecurityHealthAnalyticsCustomModule {
8020    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8021    where
8022        D: serde::Deserializer<'de>,
8023    {
8024        #[allow(non_camel_case_types)]
8025        #[doc(hidden)]
8026        #[derive(PartialEq, Eq, Hash)]
8027        enum __FieldTag {
8028            __id,
8029            __display_name,
8030            __config,
8031            __module_enablement_state,
8032            Unknown(std::string::String),
8033        }
8034        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8035            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8036            where
8037                D: serde::Deserializer<'de>,
8038            {
8039                struct Visitor;
8040                impl<'de> serde::de::Visitor<'de> for Visitor {
8041                    type Value = __FieldTag;
8042                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8043                        formatter.write_str("a field name for SecurityHealthAnalyticsCustomModule")
8044                    }
8045                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8046                    where
8047                        E: serde::de::Error,
8048                    {
8049                        use std::result::Result::Ok;
8050                        use std::string::ToString;
8051                        match value {
8052                            "id" => Ok(__FieldTag::__id),
8053                            "displayName" => Ok(__FieldTag::__display_name),
8054                            "display_name" => Ok(__FieldTag::__display_name),
8055                            "config" => Ok(__FieldTag::__config),
8056                            "moduleEnablementState" => Ok(__FieldTag::__module_enablement_state),
8057                            "module_enablement_state" => Ok(__FieldTag::__module_enablement_state),
8058                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8059                        }
8060                    }
8061                }
8062                deserializer.deserialize_identifier(Visitor)
8063            }
8064        }
8065        struct Visitor;
8066        impl<'de> serde::de::Visitor<'de> for Visitor {
8067            type Value = SecurityHealthAnalyticsCustomModule;
8068            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8069                formatter.write_str("struct SecurityHealthAnalyticsCustomModule")
8070            }
8071            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8072            where
8073                A: serde::de::MapAccess<'de>,
8074            {
8075                #[allow(unused_imports)]
8076                use serde::de::Error;
8077                use std::option::Option::Some;
8078                let mut fields = std::collections::HashSet::new();
8079                let mut result = Self::Value::new();
8080                while let Some(tag) = map.next_key::<__FieldTag>()? {
8081                    #[allow(clippy::match_single_binding)]
8082                    match tag {
8083                        __FieldTag::__id => {
8084                            if !fields.insert(__FieldTag::__id) {
8085                                return std::result::Result::Err(A::Error::duplicate_field(
8086                                    "multiple values for id",
8087                                ));
8088                            }
8089                            result.id = map
8090                                .next_value::<std::option::Option<std::string::String>>()?
8091                                .unwrap_or_default();
8092                        }
8093                        __FieldTag::__display_name => {
8094                            if !fields.insert(__FieldTag::__display_name) {
8095                                return std::result::Result::Err(A::Error::duplicate_field(
8096                                    "multiple values for display_name",
8097                                ));
8098                            }
8099                            result.display_name = map
8100                                .next_value::<std::option::Option<std::string::String>>()?
8101                                .unwrap_or_default();
8102                        }
8103                        __FieldTag::__config => {
8104                            if !fields.insert(__FieldTag::__config) {
8105                                return std::result::Result::Err(A::Error::duplicate_field(
8106                                    "multiple values for config",
8107                                ));
8108                            }
8109                            result.config = map
8110                                .next_value::<std::option::Option<crate::model::CustomConfig>>()?;
8111                        }
8112                        __FieldTag::__module_enablement_state => {
8113                            if !fields.insert(__FieldTag::__module_enablement_state) {
8114                                return std::result::Result::Err(A::Error::duplicate_field(
8115                                    "multiple values for module_enablement_state",
8116                                ));
8117                            }
8118                            result.module_enablement_state = map
8119                                .next_value::<std::option::Option<crate::model::EnablementState>>()?
8120                                .unwrap_or_default();
8121                        }
8122                        __FieldTag::Unknown(key) => {
8123                            let value = map.next_value::<serde_json::Value>()?;
8124                            result._unknown_fields.insert(key, value);
8125                        }
8126                    }
8127                }
8128                std::result::Result::Ok(result)
8129            }
8130        }
8131        deserializer.deserialize_any(Visitor)
8132    }
8133}
8134
8135#[doc(hidden)]
8136impl serde::ser::Serialize for SecurityHealthAnalyticsCustomModule {
8137    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8138    where
8139        S: serde::ser::Serializer,
8140    {
8141        use serde::ser::SerializeMap;
8142        #[allow(unused_imports)]
8143        use std::option::Option::Some;
8144        let mut state = serializer.serialize_map(std::option::Option::None)?;
8145        if !self.id.is_empty() {
8146            state.serialize_entry("id", &self.id)?;
8147        }
8148        if !self.display_name.is_empty() {
8149            state.serialize_entry("displayName", &self.display_name)?;
8150        }
8151        if self.config.is_some() {
8152            state.serialize_entry("config", &self.config)?;
8153        }
8154        if !wkt::internal::is_default(&self.module_enablement_state) {
8155            state.serialize_entry("moduleEnablementState", &self.module_enablement_state)?;
8156        }
8157        if !self._unknown_fields.is_empty() {
8158            for (key, value) in self._unknown_fields.iter() {
8159                state.serialize_entry(key, &value)?;
8160            }
8161        }
8162        state.end()
8163    }
8164}
8165
8166/// Defines the properties in a custom module configuration for Security
8167/// Health Analytics. Use the custom module configuration to create custom
8168/// detectors that generate custom findings for resources that you specify.
8169#[derive(Clone, Debug, Default, PartialEq)]
8170#[non_exhaustive]
8171pub struct CustomConfig {
8172    /// Required. The CEL expression to evaluate to produce findings. When the
8173    /// expression evaluates to true against a resource, a finding is generated.
8174    pub predicate: std::option::Option<gtype::model::Expr>,
8175
8176    /// Optional. Custom output properties.
8177    pub custom_output: std::option::Option<crate::model::custom_config::CustomOutputSpec>,
8178
8179    /// Required. The resource types that the custom module operates on. Each
8180    /// custom module can specify up to 5 resource types.
8181    pub resource_selector: std::option::Option<crate::model::custom_config::ResourceSelector>,
8182
8183    /// Required. The severity to assign to findings generated by the module.
8184    pub severity: crate::model::custom_config::Severity,
8185
8186    /// Optional. Text that describes the vulnerability or misconfiguration that
8187    /// the custom module detects. This explanation is returned with each finding
8188    /// instance to help investigators understand the detected issue. The text must
8189    /// be enclosed in quotation marks.
8190    pub description: std::string::String,
8191
8192    /// Optional. An explanation of the recommended steps that security teams can
8193    /// take to resolve the detected issue. This explanation is returned with each
8194    /// finding generated by this module in the `nextSteps` property of the finding
8195    /// JSON.
8196    pub recommendation: std::string::String,
8197
8198    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8199}
8200
8201impl CustomConfig {
8202    pub fn new() -> Self {
8203        std::default::Default::default()
8204    }
8205
8206    /// Sets the value of [predicate][crate::model::CustomConfig::predicate].
8207    pub fn set_predicate<T>(mut self, v: T) -> Self
8208    where
8209        T: std::convert::Into<gtype::model::Expr>,
8210    {
8211        self.predicate = std::option::Option::Some(v.into());
8212        self
8213    }
8214
8215    /// Sets or clears the value of [predicate][crate::model::CustomConfig::predicate].
8216    pub fn set_or_clear_predicate<T>(mut self, v: std::option::Option<T>) -> Self
8217    where
8218        T: std::convert::Into<gtype::model::Expr>,
8219    {
8220        self.predicate = v.map(|x| x.into());
8221        self
8222    }
8223
8224    /// Sets the value of [custom_output][crate::model::CustomConfig::custom_output].
8225    pub fn set_custom_output<T>(mut self, v: T) -> Self
8226    where
8227        T: std::convert::Into<crate::model::custom_config::CustomOutputSpec>,
8228    {
8229        self.custom_output = std::option::Option::Some(v.into());
8230        self
8231    }
8232
8233    /// Sets or clears the value of [custom_output][crate::model::CustomConfig::custom_output].
8234    pub fn set_or_clear_custom_output<T>(mut self, v: std::option::Option<T>) -> Self
8235    where
8236        T: std::convert::Into<crate::model::custom_config::CustomOutputSpec>,
8237    {
8238        self.custom_output = v.map(|x| x.into());
8239        self
8240    }
8241
8242    /// Sets the value of [resource_selector][crate::model::CustomConfig::resource_selector].
8243    pub fn set_resource_selector<T>(mut self, v: T) -> Self
8244    where
8245        T: std::convert::Into<crate::model::custom_config::ResourceSelector>,
8246    {
8247        self.resource_selector = std::option::Option::Some(v.into());
8248        self
8249    }
8250
8251    /// Sets or clears the value of [resource_selector][crate::model::CustomConfig::resource_selector].
8252    pub fn set_or_clear_resource_selector<T>(mut self, v: std::option::Option<T>) -> Self
8253    where
8254        T: std::convert::Into<crate::model::custom_config::ResourceSelector>,
8255    {
8256        self.resource_selector = v.map(|x| x.into());
8257        self
8258    }
8259
8260    /// Sets the value of [severity][crate::model::CustomConfig::severity].
8261    pub fn set_severity<T: std::convert::Into<crate::model::custom_config::Severity>>(
8262        mut self,
8263        v: T,
8264    ) -> Self {
8265        self.severity = v.into();
8266        self
8267    }
8268
8269    /// Sets the value of [description][crate::model::CustomConfig::description].
8270    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8271        self.description = v.into();
8272        self
8273    }
8274
8275    /// Sets the value of [recommendation][crate::model::CustomConfig::recommendation].
8276    pub fn set_recommendation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8277        self.recommendation = v.into();
8278        self
8279    }
8280}
8281
8282impl wkt::message::Message for CustomConfig {
8283    fn typename() -> &'static str {
8284        "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig"
8285    }
8286}
8287
8288#[doc(hidden)]
8289impl<'de> serde::de::Deserialize<'de> for CustomConfig {
8290    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8291    where
8292        D: serde::Deserializer<'de>,
8293    {
8294        #[allow(non_camel_case_types)]
8295        #[doc(hidden)]
8296        #[derive(PartialEq, Eq, Hash)]
8297        enum __FieldTag {
8298            __predicate,
8299            __custom_output,
8300            __resource_selector,
8301            __severity,
8302            __description,
8303            __recommendation,
8304            Unknown(std::string::String),
8305        }
8306        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8307            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8308            where
8309                D: serde::Deserializer<'de>,
8310            {
8311                struct Visitor;
8312                impl<'de> serde::de::Visitor<'de> for Visitor {
8313                    type Value = __FieldTag;
8314                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8315                        formatter.write_str("a field name for CustomConfig")
8316                    }
8317                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8318                    where
8319                        E: serde::de::Error,
8320                    {
8321                        use std::result::Result::Ok;
8322                        use std::string::ToString;
8323                        match value {
8324                            "predicate" => Ok(__FieldTag::__predicate),
8325                            "customOutput" => Ok(__FieldTag::__custom_output),
8326                            "custom_output" => Ok(__FieldTag::__custom_output),
8327                            "resourceSelector" => Ok(__FieldTag::__resource_selector),
8328                            "resource_selector" => Ok(__FieldTag::__resource_selector),
8329                            "severity" => Ok(__FieldTag::__severity),
8330                            "description" => Ok(__FieldTag::__description),
8331                            "recommendation" => Ok(__FieldTag::__recommendation),
8332                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8333                        }
8334                    }
8335                }
8336                deserializer.deserialize_identifier(Visitor)
8337            }
8338        }
8339        struct Visitor;
8340        impl<'de> serde::de::Visitor<'de> for Visitor {
8341            type Value = CustomConfig;
8342            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8343                formatter.write_str("struct CustomConfig")
8344            }
8345            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8346            where
8347                A: serde::de::MapAccess<'de>,
8348            {
8349                #[allow(unused_imports)]
8350                use serde::de::Error;
8351                use std::option::Option::Some;
8352                let mut fields = std::collections::HashSet::new();
8353                let mut result = Self::Value::new();
8354                while let Some(tag) = map.next_key::<__FieldTag>()? {
8355                    #[allow(clippy::match_single_binding)]
8356                    match tag {
8357                        __FieldTag::__predicate => {
8358                            if !fields.insert(__FieldTag::__predicate) {
8359                                return std::result::Result::Err(A::Error::duplicate_field(
8360                                    "multiple values for predicate",
8361                                ));
8362                            }
8363                            result.predicate =
8364                                map.next_value::<std::option::Option<gtype::model::Expr>>()?;
8365                        }
8366                        __FieldTag::__custom_output => {
8367                            if !fields.insert(__FieldTag::__custom_output) {
8368                                return std::result::Result::Err(A::Error::duplicate_field(
8369                                    "multiple values for custom_output",
8370                                ));
8371                            }
8372                            result.custom_output = map.next_value::<std::option::Option<
8373                                crate::model::custom_config::CustomOutputSpec,
8374                            >>()?;
8375                        }
8376                        __FieldTag::__resource_selector => {
8377                            if !fields.insert(__FieldTag::__resource_selector) {
8378                                return std::result::Result::Err(A::Error::duplicate_field(
8379                                    "multiple values for resource_selector",
8380                                ));
8381                            }
8382                            result.resource_selector = map.next_value::<std::option::Option<
8383                                crate::model::custom_config::ResourceSelector,
8384                            >>()?;
8385                        }
8386                        __FieldTag::__severity => {
8387                            if !fields.insert(__FieldTag::__severity) {
8388                                return std::result::Result::Err(A::Error::duplicate_field(
8389                                    "multiple values for severity",
8390                                ));
8391                            }
8392                            result.severity = map.next_value::<std::option::Option<crate::model::custom_config::Severity>>()?.unwrap_or_default();
8393                        }
8394                        __FieldTag::__description => {
8395                            if !fields.insert(__FieldTag::__description) {
8396                                return std::result::Result::Err(A::Error::duplicate_field(
8397                                    "multiple values for description",
8398                                ));
8399                            }
8400                            result.description = map
8401                                .next_value::<std::option::Option<std::string::String>>()?
8402                                .unwrap_or_default();
8403                        }
8404                        __FieldTag::__recommendation => {
8405                            if !fields.insert(__FieldTag::__recommendation) {
8406                                return std::result::Result::Err(A::Error::duplicate_field(
8407                                    "multiple values for recommendation",
8408                                ));
8409                            }
8410                            result.recommendation = map
8411                                .next_value::<std::option::Option<std::string::String>>()?
8412                                .unwrap_or_default();
8413                        }
8414                        __FieldTag::Unknown(key) => {
8415                            let value = map.next_value::<serde_json::Value>()?;
8416                            result._unknown_fields.insert(key, value);
8417                        }
8418                    }
8419                }
8420                std::result::Result::Ok(result)
8421            }
8422        }
8423        deserializer.deserialize_any(Visitor)
8424    }
8425}
8426
8427#[doc(hidden)]
8428impl serde::ser::Serialize for CustomConfig {
8429    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8430    where
8431        S: serde::ser::Serializer,
8432    {
8433        use serde::ser::SerializeMap;
8434        #[allow(unused_imports)]
8435        use std::option::Option::Some;
8436        let mut state = serializer.serialize_map(std::option::Option::None)?;
8437        if self.predicate.is_some() {
8438            state.serialize_entry("predicate", &self.predicate)?;
8439        }
8440        if self.custom_output.is_some() {
8441            state.serialize_entry("customOutput", &self.custom_output)?;
8442        }
8443        if self.resource_selector.is_some() {
8444            state.serialize_entry("resourceSelector", &self.resource_selector)?;
8445        }
8446        if !wkt::internal::is_default(&self.severity) {
8447            state.serialize_entry("severity", &self.severity)?;
8448        }
8449        if !self.description.is_empty() {
8450            state.serialize_entry("description", &self.description)?;
8451        }
8452        if !self.recommendation.is_empty() {
8453            state.serialize_entry("recommendation", &self.recommendation)?;
8454        }
8455        if !self._unknown_fields.is_empty() {
8456            for (key, value) in self._unknown_fields.iter() {
8457                state.serialize_entry(key, &value)?;
8458            }
8459        }
8460        state.end()
8461    }
8462}
8463
8464/// Defines additional types related to [CustomConfig].
8465pub mod custom_config {
8466    #[allow(unused_imports)]
8467    use super::*;
8468
8469    /// A set of optional name-value pairs that define custom source properties to
8470    /// return with each finding that is generated by the custom module. The custom
8471    /// source properties that are defined here are included in the finding JSON
8472    /// under `sourceProperties`.
8473    #[derive(Clone, Debug, Default, PartialEq)]
8474    #[non_exhaustive]
8475    pub struct CustomOutputSpec {
8476        /// Optional. A list of custom output properties to add to the finding.
8477        pub properties: std::vec::Vec<crate::model::custom_config::custom_output_spec::Property>,
8478
8479        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8480    }
8481
8482    impl CustomOutputSpec {
8483        pub fn new() -> Self {
8484            std::default::Default::default()
8485        }
8486
8487        /// Sets the value of [properties][crate::model::custom_config::CustomOutputSpec::properties].
8488        pub fn set_properties<T, V>(mut self, v: T) -> Self
8489        where
8490            T: std::iter::IntoIterator<Item = V>,
8491            V: std::convert::Into<crate::model::custom_config::custom_output_spec::Property>,
8492        {
8493            use std::iter::Iterator;
8494            self.properties = v.into_iter().map(|i| i.into()).collect();
8495            self
8496        }
8497    }
8498
8499    impl wkt::message::Message for CustomOutputSpec {
8500        fn typename() -> &'static str {
8501            "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig.CustomOutputSpec"
8502        }
8503    }
8504
8505    #[doc(hidden)]
8506    impl<'de> serde::de::Deserialize<'de> for CustomOutputSpec {
8507        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8508        where
8509            D: serde::Deserializer<'de>,
8510        {
8511            #[allow(non_camel_case_types)]
8512            #[doc(hidden)]
8513            #[derive(PartialEq, Eq, Hash)]
8514            enum __FieldTag {
8515                __properties,
8516                Unknown(std::string::String),
8517            }
8518            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8519                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8520                where
8521                    D: serde::Deserializer<'de>,
8522                {
8523                    struct Visitor;
8524                    impl<'de> serde::de::Visitor<'de> for Visitor {
8525                        type Value = __FieldTag;
8526                        fn expecting(
8527                            &self,
8528                            formatter: &mut std::fmt::Formatter,
8529                        ) -> std::fmt::Result {
8530                            formatter.write_str("a field name for CustomOutputSpec")
8531                        }
8532                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8533                        where
8534                            E: serde::de::Error,
8535                        {
8536                            use std::result::Result::Ok;
8537                            use std::string::ToString;
8538                            match value {
8539                                "properties" => Ok(__FieldTag::__properties),
8540                                _ => Ok(__FieldTag::Unknown(value.to_string())),
8541                            }
8542                        }
8543                    }
8544                    deserializer.deserialize_identifier(Visitor)
8545                }
8546            }
8547            struct Visitor;
8548            impl<'de> serde::de::Visitor<'de> for Visitor {
8549                type Value = CustomOutputSpec;
8550                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8551                    formatter.write_str("struct CustomOutputSpec")
8552                }
8553                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8554                where
8555                    A: serde::de::MapAccess<'de>,
8556                {
8557                    #[allow(unused_imports)]
8558                    use serde::de::Error;
8559                    use std::option::Option::Some;
8560                    let mut fields = std::collections::HashSet::new();
8561                    let mut result = Self::Value::new();
8562                    while let Some(tag) = map.next_key::<__FieldTag>()? {
8563                        #[allow(clippy::match_single_binding)]
8564                        match tag {
8565                            __FieldTag::__properties => {
8566                                if !fields.insert(__FieldTag::__properties) {
8567                                    return std::result::Result::Err(A::Error::duplicate_field(
8568                                        "multiple values for properties",
8569                                    ));
8570                                }
8571                                result.properties = map.next_value::<std::option::Option<std::vec::Vec<crate::model::custom_config::custom_output_spec::Property>>>()?.unwrap_or_default();
8572                            }
8573                            __FieldTag::Unknown(key) => {
8574                                let value = map.next_value::<serde_json::Value>()?;
8575                                result._unknown_fields.insert(key, value);
8576                            }
8577                        }
8578                    }
8579                    std::result::Result::Ok(result)
8580                }
8581            }
8582            deserializer.deserialize_any(Visitor)
8583        }
8584    }
8585
8586    #[doc(hidden)]
8587    impl serde::ser::Serialize for CustomOutputSpec {
8588        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8589        where
8590            S: serde::ser::Serializer,
8591        {
8592            use serde::ser::SerializeMap;
8593            #[allow(unused_imports)]
8594            use std::option::Option::Some;
8595            let mut state = serializer.serialize_map(std::option::Option::None)?;
8596            if !self.properties.is_empty() {
8597                state.serialize_entry("properties", &self.properties)?;
8598            }
8599            if !self._unknown_fields.is_empty() {
8600                for (key, value) in self._unknown_fields.iter() {
8601                    state.serialize_entry(key, &value)?;
8602                }
8603            }
8604            state.end()
8605        }
8606    }
8607
8608    /// Defines additional types related to [CustomOutputSpec].
8609    pub mod custom_output_spec {
8610        #[allow(unused_imports)]
8611        use super::*;
8612
8613        /// An individual name-value pair that defines a custom source property.
8614        #[derive(Clone, Debug, Default, PartialEq)]
8615        #[non_exhaustive]
8616        pub struct Property {
8617            /// Required. Name of the property for the custom output.
8618            pub name: std::string::String,
8619
8620            /// Optional. The CEL expression for the custom output. A resource property
8621            /// can be specified to return the value of the property or a text string
8622            /// enclosed in quotation marks.
8623            pub value_expression: std::option::Option<gtype::model::Expr>,
8624
8625            _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8626        }
8627
8628        impl Property {
8629            pub fn new() -> Self {
8630                std::default::Default::default()
8631            }
8632
8633            /// Sets the value of [name][crate::model::custom_config::custom_output_spec::Property::name].
8634            pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8635                self.name = v.into();
8636                self
8637            }
8638
8639            /// Sets the value of [value_expression][crate::model::custom_config::custom_output_spec::Property::value_expression].
8640            pub fn set_value_expression<T>(mut self, v: T) -> Self
8641            where
8642                T: std::convert::Into<gtype::model::Expr>,
8643            {
8644                self.value_expression = std::option::Option::Some(v.into());
8645                self
8646            }
8647
8648            /// Sets or clears the value of [value_expression][crate::model::custom_config::custom_output_spec::Property::value_expression].
8649            pub fn set_or_clear_value_expression<T>(mut self, v: std::option::Option<T>) -> Self
8650            where
8651                T: std::convert::Into<gtype::model::Expr>,
8652            {
8653                self.value_expression = v.map(|x| x.into());
8654                self
8655            }
8656        }
8657
8658        impl wkt::message::Message for Property {
8659            fn typename() -> &'static str {
8660                "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig.CustomOutputSpec.Property"
8661            }
8662        }
8663
8664        #[doc(hidden)]
8665        impl<'de> serde::de::Deserialize<'de> for Property {
8666            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8667            where
8668                D: serde::Deserializer<'de>,
8669            {
8670                #[allow(non_camel_case_types)]
8671                #[doc(hidden)]
8672                #[derive(PartialEq, Eq, Hash)]
8673                enum __FieldTag {
8674                    __name,
8675                    __value_expression,
8676                    Unknown(std::string::String),
8677                }
8678                impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8679                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8680                    where
8681                        D: serde::Deserializer<'de>,
8682                    {
8683                        struct Visitor;
8684                        impl<'de> serde::de::Visitor<'de> for Visitor {
8685                            type Value = __FieldTag;
8686                            fn expecting(
8687                                &self,
8688                                formatter: &mut std::fmt::Formatter,
8689                            ) -> std::fmt::Result {
8690                                formatter.write_str("a field name for Property")
8691                            }
8692                            fn visit_str<E>(
8693                                self,
8694                                value: &str,
8695                            ) -> std::result::Result<Self::Value, E>
8696                            where
8697                                E: serde::de::Error,
8698                            {
8699                                use std::result::Result::Ok;
8700                                use std::string::ToString;
8701                                match value {
8702                                    "name" => Ok(__FieldTag::__name),
8703                                    "valueExpression" => Ok(__FieldTag::__value_expression),
8704                                    "value_expression" => Ok(__FieldTag::__value_expression),
8705                                    _ => Ok(__FieldTag::Unknown(value.to_string())),
8706                                }
8707                            }
8708                        }
8709                        deserializer.deserialize_identifier(Visitor)
8710                    }
8711                }
8712                struct Visitor;
8713                impl<'de> serde::de::Visitor<'de> for Visitor {
8714                    type Value = Property;
8715                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8716                        formatter.write_str("struct Property")
8717                    }
8718                    fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8719                    where
8720                        A: serde::de::MapAccess<'de>,
8721                    {
8722                        #[allow(unused_imports)]
8723                        use serde::de::Error;
8724                        use std::option::Option::Some;
8725                        let mut fields = std::collections::HashSet::new();
8726                        let mut result = Self::Value::new();
8727                        while let Some(tag) = map.next_key::<__FieldTag>()? {
8728                            #[allow(clippy::match_single_binding)]
8729                            match tag {
8730                                __FieldTag::__name => {
8731                                    if !fields.insert(__FieldTag::__name) {
8732                                        return std::result::Result::Err(
8733                                            A::Error::duplicate_field("multiple values for name"),
8734                                        );
8735                                    }
8736                                    result.name = map
8737                                        .next_value::<std::option::Option<std::string::String>>()?
8738                                        .unwrap_or_default();
8739                                }
8740                                __FieldTag::__value_expression => {
8741                                    if !fields.insert(__FieldTag::__value_expression) {
8742                                        return std::result::Result::Err(
8743                                            A::Error::duplicate_field(
8744                                                "multiple values for value_expression",
8745                                            ),
8746                                        );
8747                                    }
8748                                    result.value_expression = map
8749                                        .next_value::<std::option::Option<gtype::model::Expr>>()?;
8750                                }
8751                                __FieldTag::Unknown(key) => {
8752                                    let value = map.next_value::<serde_json::Value>()?;
8753                                    result._unknown_fields.insert(key, value);
8754                                }
8755                            }
8756                        }
8757                        std::result::Result::Ok(result)
8758                    }
8759                }
8760                deserializer.deserialize_any(Visitor)
8761            }
8762        }
8763
8764        #[doc(hidden)]
8765        impl serde::ser::Serialize for Property {
8766            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8767            where
8768                S: serde::ser::Serializer,
8769            {
8770                use serde::ser::SerializeMap;
8771                #[allow(unused_imports)]
8772                use std::option::Option::Some;
8773                let mut state = serializer.serialize_map(std::option::Option::None)?;
8774                if !self.name.is_empty() {
8775                    state.serialize_entry("name", &self.name)?;
8776                }
8777                if self.value_expression.is_some() {
8778                    state.serialize_entry("valueExpression", &self.value_expression)?;
8779                }
8780                if !self._unknown_fields.is_empty() {
8781                    for (key, value) in self._unknown_fields.iter() {
8782                        state.serialize_entry(key, &value)?;
8783                    }
8784                }
8785                state.end()
8786            }
8787        }
8788    }
8789
8790    /// Resource for selecting resource type.
8791    #[derive(Clone, Debug, Default, PartialEq)]
8792    #[non_exhaustive]
8793    pub struct ResourceSelector {
8794        /// Required. The resource types to run the detector on.
8795        pub resource_types: std::vec::Vec<std::string::String>,
8796
8797        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8798    }
8799
8800    impl ResourceSelector {
8801        pub fn new() -> Self {
8802            std::default::Default::default()
8803        }
8804
8805        /// Sets the value of [resource_types][crate::model::custom_config::ResourceSelector::resource_types].
8806        pub fn set_resource_types<T, V>(mut self, v: T) -> Self
8807        where
8808            T: std::iter::IntoIterator<Item = V>,
8809            V: std::convert::Into<std::string::String>,
8810        {
8811            use std::iter::Iterator;
8812            self.resource_types = v.into_iter().map(|i| i.into()).collect();
8813            self
8814        }
8815    }
8816
8817    impl wkt::message::Message for ResourceSelector {
8818        fn typename() -> &'static str {
8819            "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig.ResourceSelector"
8820        }
8821    }
8822
8823    #[doc(hidden)]
8824    impl<'de> serde::de::Deserialize<'de> for ResourceSelector {
8825        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8826        where
8827            D: serde::Deserializer<'de>,
8828        {
8829            #[allow(non_camel_case_types)]
8830            #[doc(hidden)]
8831            #[derive(PartialEq, Eq, Hash)]
8832            enum __FieldTag {
8833                __resource_types,
8834                Unknown(std::string::String),
8835            }
8836            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8837                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8838                where
8839                    D: serde::Deserializer<'de>,
8840                {
8841                    struct Visitor;
8842                    impl<'de> serde::de::Visitor<'de> for Visitor {
8843                        type Value = __FieldTag;
8844                        fn expecting(
8845                            &self,
8846                            formatter: &mut std::fmt::Formatter,
8847                        ) -> std::fmt::Result {
8848                            formatter.write_str("a field name for ResourceSelector")
8849                        }
8850                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8851                        where
8852                            E: serde::de::Error,
8853                        {
8854                            use std::result::Result::Ok;
8855                            use std::string::ToString;
8856                            match value {
8857                                "resourceTypes" => Ok(__FieldTag::__resource_types),
8858                                "resource_types" => Ok(__FieldTag::__resource_types),
8859                                _ => Ok(__FieldTag::Unknown(value.to_string())),
8860                            }
8861                        }
8862                    }
8863                    deserializer.deserialize_identifier(Visitor)
8864                }
8865            }
8866            struct Visitor;
8867            impl<'de> serde::de::Visitor<'de> for Visitor {
8868                type Value = ResourceSelector;
8869                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8870                    formatter.write_str("struct ResourceSelector")
8871                }
8872                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8873                where
8874                    A: serde::de::MapAccess<'de>,
8875                {
8876                    #[allow(unused_imports)]
8877                    use serde::de::Error;
8878                    use std::option::Option::Some;
8879                    let mut fields = std::collections::HashSet::new();
8880                    let mut result = Self::Value::new();
8881                    while let Some(tag) = map.next_key::<__FieldTag>()? {
8882                        #[allow(clippy::match_single_binding)]
8883                        match tag {
8884                            __FieldTag::__resource_types => {
8885                                if !fields.insert(__FieldTag::__resource_types) {
8886                                    return std::result::Result::Err(A::Error::duplicate_field(
8887                                        "multiple values for resource_types",
8888                                    ));
8889                                }
8890                                result.resource_types = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
8891                            }
8892                            __FieldTag::Unknown(key) => {
8893                                let value = map.next_value::<serde_json::Value>()?;
8894                                result._unknown_fields.insert(key, value);
8895                            }
8896                        }
8897                    }
8898                    std::result::Result::Ok(result)
8899                }
8900            }
8901            deserializer.deserialize_any(Visitor)
8902        }
8903    }
8904
8905    #[doc(hidden)]
8906    impl serde::ser::Serialize for ResourceSelector {
8907        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8908        where
8909            S: serde::ser::Serializer,
8910        {
8911            use serde::ser::SerializeMap;
8912            #[allow(unused_imports)]
8913            use std::option::Option::Some;
8914            let mut state = serializer.serialize_map(std::option::Option::None)?;
8915            if !self.resource_types.is_empty() {
8916                state.serialize_entry("resourceTypes", &self.resource_types)?;
8917            }
8918            if !self._unknown_fields.is_empty() {
8919                for (key, value) in self._unknown_fields.iter() {
8920                    state.serialize_entry(key, &value)?;
8921                }
8922            }
8923            state.end()
8924        }
8925    }
8926
8927    /// Defines the valid value options for the severity of a finding.
8928    ///
8929    /// # Working with unknown values
8930    ///
8931    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8932    /// additional enum variants at any time. Adding new variants is not considered
8933    /// a breaking change. Applications should write their code in anticipation of:
8934    ///
8935    /// - New values appearing in future releases of the client library, **and**
8936    /// - New values received dynamically, without application changes.
8937    ///
8938    /// Please consult the [Working with enums] section in the user guide for some
8939    /// guidelines.
8940    ///
8941    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8942    #[derive(Clone, Debug, PartialEq)]
8943    #[non_exhaustive]
8944    pub enum Severity {
8945        /// Unspecified severity.
8946        Unspecified,
8947        /// Critical severity.
8948        Critical,
8949        /// High severity.
8950        High,
8951        /// Medium severity.
8952        Medium,
8953        /// Low severity.
8954        Low,
8955        /// If set, the enum was initialized with an unknown value.
8956        ///
8957        /// Applications can examine the value using [Severity::value] or
8958        /// [Severity::name].
8959        UnknownValue(severity::UnknownValue),
8960    }
8961
8962    #[doc(hidden)]
8963    pub mod severity {
8964        #[allow(unused_imports)]
8965        use super::*;
8966        #[derive(Clone, Debug, PartialEq)]
8967        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8968    }
8969
8970    impl Severity {
8971        /// Gets the enum value.
8972        ///
8973        /// Returns `None` if the enum contains an unknown value deserialized from
8974        /// the string representation of enums.
8975        pub fn value(&self) -> std::option::Option<i32> {
8976            match self {
8977                Self::Unspecified => std::option::Option::Some(0),
8978                Self::Critical => std::option::Option::Some(1),
8979                Self::High => std::option::Option::Some(2),
8980                Self::Medium => std::option::Option::Some(3),
8981                Self::Low => std::option::Option::Some(4),
8982                Self::UnknownValue(u) => u.0.value(),
8983            }
8984        }
8985
8986        /// Gets the enum value as a string.
8987        ///
8988        /// Returns `None` if the enum contains an unknown value deserialized from
8989        /// the integer representation of enums.
8990        pub fn name(&self) -> std::option::Option<&str> {
8991            match self {
8992                Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
8993                Self::Critical => std::option::Option::Some("CRITICAL"),
8994                Self::High => std::option::Option::Some("HIGH"),
8995                Self::Medium => std::option::Option::Some("MEDIUM"),
8996                Self::Low => std::option::Option::Some("LOW"),
8997                Self::UnknownValue(u) => u.0.name(),
8998            }
8999        }
9000    }
9001
9002    impl std::default::Default for Severity {
9003        fn default() -> Self {
9004            use std::convert::From;
9005            Self::from(0)
9006        }
9007    }
9008
9009    impl std::fmt::Display for Severity {
9010        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9011            wkt::internal::display_enum(f, self.name(), self.value())
9012        }
9013    }
9014
9015    impl std::convert::From<i32> for Severity {
9016        fn from(value: i32) -> Self {
9017            match value {
9018                0 => Self::Unspecified,
9019                1 => Self::Critical,
9020                2 => Self::High,
9021                3 => Self::Medium,
9022                4 => Self::Low,
9023                _ => Self::UnknownValue(severity::UnknownValue(
9024                    wkt::internal::UnknownEnumValue::Integer(value),
9025                )),
9026            }
9027        }
9028    }
9029
9030    impl std::convert::From<&str> for Severity {
9031        fn from(value: &str) -> Self {
9032            use std::string::ToString;
9033            match value {
9034                "SEVERITY_UNSPECIFIED" => Self::Unspecified,
9035                "CRITICAL" => Self::Critical,
9036                "HIGH" => Self::High,
9037                "MEDIUM" => Self::Medium,
9038                "LOW" => Self::Low,
9039                _ => Self::UnknownValue(severity::UnknownValue(
9040                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9041                )),
9042            }
9043        }
9044    }
9045
9046    impl serde::ser::Serialize for Severity {
9047        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9048        where
9049            S: serde::Serializer,
9050        {
9051            match self {
9052                Self::Unspecified => serializer.serialize_i32(0),
9053                Self::Critical => serializer.serialize_i32(1),
9054                Self::High => serializer.serialize_i32(2),
9055                Self::Medium => serializer.serialize_i32(3),
9056                Self::Low => serializer.serialize_i32(4),
9057                Self::UnknownValue(u) => u.0.serialize(serializer),
9058            }
9059        }
9060    }
9061
9062    impl<'de> serde::de::Deserialize<'de> for Severity {
9063        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9064        where
9065            D: serde::Deserializer<'de>,
9066        {
9067            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
9068                ".google.cloud.securityposture.v1.CustomConfig.Severity",
9069            ))
9070        }
9071    }
9072}
9073
9074/// Possible enablement states of a service or module.
9075///
9076/// # Working with unknown values
9077///
9078/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9079/// additional enum variants at any time. Adding new variants is not considered
9080/// a breaking change. Applications should write their code in anticipation of:
9081///
9082/// - New values appearing in future releases of the client library, **and**
9083/// - New values received dynamically, without application changes.
9084///
9085/// Please consult the [Working with enums] section in the user guide for some
9086/// guidelines.
9087///
9088/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9089#[derive(Clone, Debug, PartialEq)]
9090#[non_exhaustive]
9091pub enum EnablementState {
9092    /// Default value. This value is unused.
9093    Unspecified,
9094    /// State is enabled.
9095    Enabled,
9096    /// State is disabled.
9097    Disabled,
9098    /// If set, the enum was initialized with an unknown value.
9099    ///
9100    /// Applications can examine the value using [EnablementState::value] or
9101    /// [EnablementState::name].
9102    UnknownValue(enablement_state::UnknownValue),
9103}
9104
9105#[doc(hidden)]
9106pub mod enablement_state {
9107    #[allow(unused_imports)]
9108    use super::*;
9109    #[derive(Clone, Debug, PartialEq)]
9110    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9111}
9112
9113impl EnablementState {
9114    /// Gets the enum value.
9115    ///
9116    /// Returns `None` if the enum contains an unknown value deserialized from
9117    /// the string representation of enums.
9118    pub fn value(&self) -> std::option::Option<i32> {
9119        match self {
9120            Self::Unspecified => std::option::Option::Some(0),
9121            Self::Enabled => std::option::Option::Some(1),
9122            Self::Disabled => std::option::Option::Some(2),
9123            Self::UnknownValue(u) => u.0.value(),
9124        }
9125    }
9126
9127    /// Gets the enum value as a string.
9128    ///
9129    /// Returns `None` if the enum contains an unknown value deserialized from
9130    /// the integer representation of enums.
9131    pub fn name(&self) -> std::option::Option<&str> {
9132        match self {
9133            Self::Unspecified => std::option::Option::Some("ENABLEMENT_STATE_UNSPECIFIED"),
9134            Self::Enabled => std::option::Option::Some("ENABLED"),
9135            Self::Disabled => std::option::Option::Some("DISABLED"),
9136            Self::UnknownValue(u) => u.0.name(),
9137        }
9138    }
9139}
9140
9141impl std::default::Default for EnablementState {
9142    fn default() -> Self {
9143        use std::convert::From;
9144        Self::from(0)
9145    }
9146}
9147
9148impl std::fmt::Display for EnablementState {
9149    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9150        wkt::internal::display_enum(f, self.name(), self.value())
9151    }
9152}
9153
9154impl std::convert::From<i32> for EnablementState {
9155    fn from(value: i32) -> Self {
9156        match value {
9157            0 => Self::Unspecified,
9158            1 => Self::Enabled,
9159            2 => Self::Disabled,
9160            _ => Self::UnknownValue(enablement_state::UnknownValue(
9161                wkt::internal::UnknownEnumValue::Integer(value),
9162            )),
9163        }
9164    }
9165}
9166
9167impl std::convert::From<&str> for EnablementState {
9168    fn from(value: &str) -> Self {
9169        use std::string::ToString;
9170        match value {
9171            "ENABLEMENT_STATE_UNSPECIFIED" => Self::Unspecified,
9172            "ENABLED" => Self::Enabled,
9173            "DISABLED" => Self::Disabled,
9174            _ => Self::UnknownValue(enablement_state::UnknownValue(
9175                wkt::internal::UnknownEnumValue::String(value.to_string()),
9176            )),
9177        }
9178    }
9179}
9180
9181impl serde::ser::Serialize for EnablementState {
9182    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9183    where
9184        S: serde::Serializer,
9185    {
9186        match self {
9187            Self::Unspecified => serializer.serialize_i32(0),
9188            Self::Enabled => serializer.serialize_i32(1),
9189            Self::Disabled => serializer.serialize_i32(2),
9190            Self::UnknownValue(u) => u.0.serialize(serializer),
9191        }
9192    }
9193}
9194
9195impl<'de> serde::de::Deserialize<'de> for EnablementState {
9196    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9197    where
9198        D: serde::Deserializer<'de>,
9199    {
9200        deserializer.deserialize_any(wkt::internal::EnumVisitor::<EnablementState>::new(
9201            ".google.cloud.securityposture.v1.EnablementState",
9202        ))
9203    }
9204}