Skip to main content

google_cloud_orgpolicy_v2/
model.rs

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