Skip to main content

google_cloud_binaryauthorization_v1/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_grafeas_v1;
25extern crate lazy_static;
26extern crate serde;
27extern crate serde_json;
28extern crate serde_with;
29extern crate std;
30extern crate tracing;
31extern crate wkt;
32
33mod debug;
34mod deserialize;
35mod serialize;
36
37/// A [policy][google.cloud.binaryauthorization.v1.Policy] for container image binary authorization.
38///
39/// [google.cloud.binaryauthorization.v1.Policy]: crate::model::Policy
40#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct Policy {
43    /// Output only. The resource name, in the format `projects/*/policy`. There is
44    /// at most one policy per project.
45    pub name: std::string::String,
46
47    /// Optional. A descriptive comment.
48    pub description: std::string::String,
49
50    /// Optional. Controls the evaluation of a Google-maintained global admission
51    /// policy for common system-level images. Images not covered by the global
52    /// policy will be subject to the project admission policy. This setting
53    /// has no effect when specified inside a global admission policy.
54    pub global_policy_evaluation_mode: crate::model::policy::GlobalPolicyEvaluationMode,
55
56    /// Optional. Admission policy allowlisting. A matching admission request will
57    /// always be permitted. This feature is typically used to exclude Google or
58    /// third-party infrastructure images from Binary Authorization policies.
59    pub admission_whitelist_patterns: std::vec::Vec<crate::model::AdmissionWhitelistPattern>,
60
61    /// Optional. Per-cluster admission rules. Cluster spec format:
62    /// `location.clusterId`. There can be at most one admission rule per cluster
63    /// spec.
64    /// A `location` is either a compute zone (e.g. us-central1-a) or a region
65    /// (e.g. us-central1).
66    /// For `clusterId` syntax restrictions see
67    /// <https://cloud.google.com/container-engine/reference/rest/v1/projects.zones.clusters>.
68    pub cluster_admission_rules:
69        std::collections::HashMap<std::string::String, crate::model::AdmissionRule>,
70
71    /// Optional. Per-kubernetes-namespace admission rules. K8s namespace spec format:
72    /// [a-z.-]+, e.g. 'some-namespace'
73    pub kubernetes_namespace_admission_rules:
74        std::collections::HashMap<std::string::String, crate::model::AdmissionRule>,
75
76    /// Optional. Per-kubernetes-service-account admission rules. Service account
77    /// spec format: `namespace:serviceaccount`. e.g. 'test-ns:default'
78    pub kubernetes_service_account_admission_rules:
79        std::collections::HashMap<std::string::String, crate::model::AdmissionRule>,
80
81    /// Optional. Per-istio-service-identity admission rules. Istio service
82    /// identity spec format:
83    /// spiffe://\<domain\>/ns/\<namespace\>/sa/\<serviceaccount\> or
84    /// \<domain\>/ns/\<namespace\>/sa/\<serviceaccount\>
85    /// e.g. spiffe://example.com/ns/test-ns/sa/default
86    pub istio_service_identity_admission_rules:
87        std::collections::HashMap<std::string::String, crate::model::AdmissionRule>,
88
89    /// Required. Default admission rule for a cluster without a per-cluster, per-
90    /// kubernetes-service-account, or per-istio-service-identity admission rule.
91    pub default_admission_rule: std::option::Option<crate::model::AdmissionRule>,
92
93    /// Output only. Time when the policy was last updated.
94    pub update_time: std::option::Option<wkt::Timestamp>,
95
96    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
97}
98
99impl Policy {
100    pub fn new() -> Self {
101        std::default::Default::default()
102    }
103
104    /// Sets the value of [name][crate::model::Policy::name].
105    ///
106    /// # Example
107    /// ```ignore,no_run
108    /// # use google_cloud_binaryauthorization_v1::model::Policy;
109    /// let x = Policy::new().set_name("example");
110    /// ```
111    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
112        self.name = v.into();
113        self
114    }
115
116    /// Sets the value of [description][crate::model::Policy::description].
117    ///
118    /// # Example
119    /// ```ignore,no_run
120    /// # use google_cloud_binaryauthorization_v1::model::Policy;
121    /// let x = Policy::new().set_description("example");
122    /// ```
123    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
124        self.description = v.into();
125        self
126    }
127
128    /// Sets the value of [global_policy_evaluation_mode][crate::model::Policy::global_policy_evaluation_mode].
129    ///
130    /// # Example
131    /// ```ignore,no_run
132    /// # use google_cloud_binaryauthorization_v1::model::Policy;
133    /// use google_cloud_binaryauthorization_v1::model::policy::GlobalPolicyEvaluationMode;
134    /// let x0 = Policy::new().set_global_policy_evaluation_mode(GlobalPolicyEvaluationMode::Enable);
135    /// let x1 = Policy::new().set_global_policy_evaluation_mode(GlobalPolicyEvaluationMode::Disable);
136    /// ```
137    pub fn set_global_policy_evaluation_mode<
138        T: std::convert::Into<crate::model::policy::GlobalPolicyEvaluationMode>,
139    >(
140        mut self,
141        v: T,
142    ) -> Self {
143        self.global_policy_evaluation_mode = v.into();
144        self
145    }
146
147    /// Sets the value of [admission_whitelist_patterns][crate::model::Policy::admission_whitelist_patterns].
148    ///
149    /// # Example
150    /// ```ignore,no_run
151    /// # use google_cloud_binaryauthorization_v1::model::Policy;
152    /// use google_cloud_binaryauthorization_v1::model::AdmissionWhitelistPattern;
153    /// let x = Policy::new()
154    ///     .set_admission_whitelist_patterns([
155    ///         AdmissionWhitelistPattern::default()/* use setters */,
156    ///         AdmissionWhitelistPattern::default()/* use (different) setters */,
157    ///     ]);
158    /// ```
159    pub fn set_admission_whitelist_patterns<T, V>(mut self, v: T) -> Self
160    where
161        T: std::iter::IntoIterator<Item = V>,
162        V: std::convert::Into<crate::model::AdmissionWhitelistPattern>,
163    {
164        use std::iter::Iterator;
165        self.admission_whitelist_patterns = v.into_iter().map(|i| i.into()).collect();
166        self
167    }
168
169    /// Sets the value of [cluster_admission_rules][crate::model::Policy::cluster_admission_rules].
170    ///
171    /// # Example
172    /// ```ignore,no_run
173    /// # use google_cloud_binaryauthorization_v1::model::Policy;
174    /// use google_cloud_binaryauthorization_v1::model::AdmissionRule;
175    /// let x = Policy::new().set_cluster_admission_rules([
176    ///     ("key0", AdmissionRule::default()/* use setters */),
177    ///     ("key1", AdmissionRule::default()/* use (different) setters */),
178    /// ]);
179    /// ```
180    pub fn set_cluster_admission_rules<T, K, V>(mut self, v: T) -> Self
181    where
182        T: std::iter::IntoIterator<Item = (K, V)>,
183        K: std::convert::Into<std::string::String>,
184        V: std::convert::Into<crate::model::AdmissionRule>,
185    {
186        use std::iter::Iterator;
187        self.cluster_admission_rules = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
188        self
189    }
190
191    /// Sets the value of [kubernetes_namespace_admission_rules][crate::model::Policy::kubernetes_namespace_admission_rules].
192    ///
193    /// # Example
194    /// ```ignore,no_run
195    /// # use google_cloud_binaryauthorization_v1::model::Policy;
196    /// use google_cloud_binaryauthorization_v1::model::AdmissionRule;
197    /// let x = Policy::new().set_kubernetes_namespace_admission_rules([
198    ///     ("key0", AdmissionRule::default()/* use setters */),
199    ///     ("key1", AdmissionRule::default()/* use (different) setters */),
200    /// ]);
201    /// ```
202    pub fn set_kubernetes_namespace_admission_rules<T, K, V>(mut self, v: T) -> Self
203    where
204        T: std::iter::IntoIterator<Item = (K, V)>,
205        K: std::convert::Into<std::string::String>,
206        V: std::convert::Into<crate::model::AdmissionRule>,
207    {
208        use std::iter::Iterator;
209        self.kubernetes_namespace_admission_rules =
210            v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
211        self
212    }
213
214    /// Sets the value of [kubernetes_service_account_admission_rules][crate::model::Policy::kubernetes_service_account_admission_rules].
215    ///
216    /// # Example
217    /// ```ignore,no_run
218    /// # use google_cloud_binaryauthorization_v1::model::Policy;
219    /// use google_cloud_binaryauthorization_v1::model::AdmissionRule;
220    /// let x = Policy::new().set_kubernetes_service_account_admission_rules([
221    ///     ("key0", AdmissionRule::default()/* use setters */),
222    ///     ("key1", AdmissionRule::default()/* use (different) setters */),
223    /// ]);
224    /// ```
225    pub fn set_kubernetes_service_account_admission_rules<T, K, V>(mut self, v: T) -> Self
226    where
227        T: std::iter::IntoIterator<Item = (K, V)>,
228        K: std::convert::Into<std::string::String>,
229        V: std::convert::Into<crate::model::AdmissionRule>,
230    {
231        use std::iter::Iterator;
232        self.kubernetes_service_account_admission_rules =
233            v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
234        self
235    }
236
237    /// Sets the value of [istio_service_identity_admission_rules][crate::model::Policy::istio_service_identity_admission_rules].
238    ///
239    /// # Example
240    /// ```ignore,no_run
241    /// # use google_cloud_binaryauthorization_v1::model::Policy;
242    /// use google_cloud_binaryauthorization_v1::model::AdmissionRule;
243    /// let x = Policy::new().set_istio_service_identity_admission_rules([
244    ///     ("key0", AdmissionRule::default()/* use setters */),
245    ///     ("key1", AdmissionRule::default()/* use (different) setters */),
246    /// ]);
247    /// ```
248    pub fn set_istio_service_identity_admission_rules<T, K, V>(mut self, v: T) -> Self
249    where
250        T: std::iter::IntoIterator<Item = (K, V)>,
251        K: std::convert::Into<std::string::String>,
252        V: std::convert::Into<crate::model::AdmissionRule>,
253    {
254        use std::iter::Iterator;
255        self.istio_service_identity_admission_rules =
256            v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
257        self
258    }
259
260    /// Sets the value of [default_admission_rule][crate::model::Policy::default_admission_rule].
261    ///
262    /// # Example
263    /// ```ignore,no_run
264    /// # use google_cloud_binaryauthorization_v1::model::Policy;
265    /// use google_cloud_binaryauthorization_v1::model::AdmissionRule;
266    /// let x = Policy::new().set_default_admission_rule(AdmissionRule::default()/* use setters */);
267    /// ```
268    pub fn set_default_admission_rule<T>(mut self, v: T) -> Self
269    where
270        T: std::convert::Into<crate::model::AdmissionRule>,
271    {
272        self.default_admission_rule = std::option::Option::Some(v.into());
273        self
274    }
275
276    /// Sets or clears the value of [default_admission_rule][crate::model::Policy::default_admission_rule].
277    ///
278    /// # Example
279    /// ```ignore,no_run
280    /// # use google_cloud_binaryauthorization_v1::model::Policy;
281    /// use google_cloud_binaryauthorization_v1::model::AdmissionRule;
282    /// let x = Policy::new().set_or_clear_default_admission_rule(Some(AdmissionRule::default()/* use setters */));
283    /// let x = Policy::new().set_or_clear_default_admission_rule(None::<AdmissionRule>);
284    /// ```
285    pub fn set_or_clear_default_admission_rule<T>(mut self, v: std::option::Option<T>) -> Self
286    where
287        T: std::convert::Into<crate::model::AdmissionRule>,
288    {
289        self.default_admission_rule = v.map(|x| x.into());
290        self
291    }
292
293    /// Sets the value of [update_time][crate::model::Policy::update_time].
294    ///
295    /// # Example
296    /// ```ignore,no_run
297    /// # use google_cloud_binaryauthorization_v1::model::Policy;
298    /// use wkt::Timestamp;
299    /// let x = Policy::new().set_update_time(Timestamp::default()/* use setters */);
300    /// ```
301    pub fn set_update_time<T>(mut self, v: T) -> Self
302    where
303        T: std::convert::Into<wkt::Timestamp>,
304    {
305        self.update_time = std::option::Option::Some(v.into());
306        self
307    }
308
309    /// Sets or clears the value of [update_time][crate::model::Policy::update_time].
310    ///
311    /// # Example
312    /// ```ignore,no_run
313    /// # use google_cloud_binaryauthorization_v1::model::Policy;
314    /// use wkt::Timestamp;
315    /// let x = Policy::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
316    /// let x = Policy::new().set_or_clear_update_time(None::<Timestamp>);
317    /// ```
318    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
319    where
320        T: std::convert::Into<wkt::Timestamp>,
321    {
322        self.update_time = v.map(|x| x.into());
323        self
324    }
325}
326
327impl wkt::message::Message for Policy {
328    fn typename() -> &'static str {
329        "type.googleapis.com/google.cloud.binaryauthorization.v1.Policy"
330    }
331}
332
333/// Defines additional types related to [Policy].
334pub mod policy {
335    #[allow(unused_imports)]
336    use super::*;
337
338    ///
339    /// # Working with unknown values
340    ///
341    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
342    /// additional enum variants at any time. Adding new variants is not considered
343    /// a breaking change. Applications should write their code in anticipation of:
344    ///
345    /// - New values appearing in future releases of the client library, **and**
346    /// - New values received dynamically, without application changes.
347    ///
348    /// Please consult the [Working with enums] section in the user guide for some
349    /// guidelines.
350    ///
351    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
352    #[derive(Clone, Debug, PartialEq)]
353    #[non_exhaustive]
354    pub enum GlobalPolicyEvaluationMode {
355        /// Not specified: DISABLE is assumed.
356        Unspecified,
357        /// Enables system policy evaluation.
358        Enable,
359        /// Disables system policy evaluation.
360        Disable,
361        /// If set, the enum was initialized with an unknown value.
362        ///
363        /// Applications can examine the value using [GlobalPolicyEvaluationMode::value] or
364        /// [GlobalPolicyEvaluationMode::name].
365        UnknownValue(global_policy_evaluation_mode::UnknownValue),
366    }
367
368    #[doc(hidden)]
369    pub mod global_policy_evaluation_mode {
370        #[allow(unused_imports)]
371        use super::*;
372        #[derive(Clone, Debug, PartialEq)]
373        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
374    }
375
376    impl GlobalPolicyEvaluationMode {
377        /// Gets the enum value.
378        ///
379        /// Returns `None` if the enum contains an unknown value deserialized from
380        /// the string representation of enums.
381        pub fn value(&self) -> std::option::Option<i32> {
382            match self {
383                Self::Unspecified => std::option::Option::Some(0),
384                Self::Enable => std::option::Option::Some(1),
385                Self::Disable => std::option::Option::Some(2),
386                Self::UnknownValue(u) => u.0.value(),
387            }
388        }
389
390        /// Gets the enum value as a string.
391        ///
392        /// Returns `None` if the enum contains an unknown value deserialized from
393        /// the integer representation of enums.
394        pub fn name(&self) -> std::option::Option<&str> {
395            match self {
396                Self::Unspecified => {
397                    std::option::Option::Some("GLOBAL_POLICY_EVALUATION_MODE_UNSPECIFIED")
398                }
399                Self::Enable => std::option::Option::Some("ENABLE"),
400                Self::Disable => std::option::Option::Some("DISABLE"),
401                Self::UnknownValue(u) => u.0.name(),
402            }
403        }
404    }
405
406    impl std::default::Default for GlobalPolicyEvaluationMode {
407        fn default() -> Self {
408            use std::convert::From;
409            Self::from(0)
410        }
411    }
412
413    impl std::fmt::Display for GlobalPolicyEvaluationMode {
414        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
415            wkt::internal::display_enum(f, self.name(), self.value())
416        }
417    }
418
419    impl std::convert::From<i32> for GlobalPolicyEvaluationMode {
420        fn from(value: i32) -> Self {
421            match value {
422                0 => Self::Unspecified,
423                1 => Self::Enable,
424                2 => Self::Disable,
425                _ => Self::UnknownValue(global_policy_evaluation_mode::UnknownValue(
426                    wkt::internal::UnknownEnumValue::Integer(value),
427                )),
428            }
429        }
430    }
431
432    impl std::convert::From<&str> for GlobalPolicyEvaluationMode {
433        fn from(value: &str) -> Self {
434            use std::string::ToString;
435            match value {
436                "GLOBAL_POLICY_EVALUATION_MODE_UNSPECIFIED" => Self::Unspecified,
437                "ENABLE" => Self::Enable,
438                "DISABLE" => Self::Disable,
439                _ => Self::UnknownValue(global_policy_evaluation_mode::UnknownValue(
440                    wkt::internal::UnknownEnumValue::String(value.to_string()),
441                )),
442            }
443        }
444    }
445
446    impl serde::ser::Serialize for GlobalPolicyEvaluationMode {
447        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
448        where
449            S: serde::Serializer,
450        {
451            match self {
452                Self::Unspecified => serializer.serialize_i32(0),
453                Self::Enable => serializer.serialize_i32(1),
454                Self::Disable => serializer.serialize_i32(2),
455                Self::UnknownValue(u) => u.0.serialize(serializer),
456            }
457        }
458    }
459
460    impl<'de> serde::de::Deserialize<'de> for GlobalPolicyEvaluationMode {
461        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
462        where
463            D: serde::Deserializer<'de>,
464        {
465            deserializer.deserialize_any(
466                wkt::internal::EnumVisitor::<GlobalPolicyEvaluationMode>::new(
467                    ".google.cloud.binaryauthorization.v1.Policy.GlobalPolicyEvaluationMode",
468                ),
469            )
470        }
471    }
472}
473
474/// An [admission allowlist pattern][google.cloud.binaryauthorization.v1.AdmissionWhitelistPattern] exempts images
475/// from checks by [admission rules][google.cloud.binaryauthorization.v1.AdmissionRule].
476///
477/// [google.cloud.binaryauthorization.v1.AdmissionRule]: crate::model::AdmissionRule
478/// [google.cloud.binaryauthorization.v1.AdmissionWhitelistPattern]: crate::model::AdmissionWhitelistPattern
479#[derive(Clone, Default, PartialEq)]
480#[non_exhaustive]
481pub struct AdmissionWhitelistPattern {
482    /// An image name pattern to allowlist, in the form `registry/path/to/image`.
483    /// This supports a trailing `*` wildcard, but this is allowed only in
484    /// text after the `registry/` part. This also supports a trailing `**`
485    /// wildcard which matches subdirectories of a given entry.
486    pub name_pattern: std::string::String,
487
488    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
489}
490
491impl AdmissionWhitelistPattern {
492    pub fn new() -> Self {
493        std::default::Default::default()
494    }
495
496    /// Sets the value of [name_pattern][crate::model::AdmissionWhitelistPattern::name_pattern].
497    ///
498    /// # Example
499    /// ```ignore,no_run
500    /// # use google_cloud_binaryauthorization_v1::model::AdmissionWhitelistPattern;
501    /// let x = AdmissionWhitelistPattern::new().set_name_pattern("example");
502    /// ```
503    pub fn set_name_pattern<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
504        self.name_pattern = v.into();
505        self
506    }
507}
508
509impl wkt::message::Message for AdmissionWhitelistPattern {
510    fn typename() -> &'static str {
511        "type.googleapis.com/google.cloud.binaryauthorization.v1.AdmissionWhitelistPattern"
512    }
513}
514
515/// An [admission rule][google.cloud.binaryauthorization.v1.AdmissionRule] specifies either that all container images
516/// used in a pod creation request must be attested to by one or more
517/// [attestors][google.cloud.binaryauthorization.v1.Attestor], that all pod creations will be allowed, or that all
518/// pod creations will be denied.
519///
520/// Images matching an [admission allowlist pattern][google.cloud.binaryauthorization.v1.AdmissionWhitelistPattern]
521/// are exempted from admission rules and will never block a pod creation.
522///
523/// [google.cloud.binaryauthorization.v1.AdmissionRule]: crate::model::AdmissionRule
524/// [google.cloud.binaryauthorization.v1.AdmissionWhitelistPattern]: crate::model::AdmissionWhitelistPattern
525/// [google.cloud.binaryauthorization.v1.Attestor]: crate::model::Attestor
526#[derive(Clone, Default, PartialEq)]
527#[non_exhaustive]
528pub struct AdmissionRule {
529    /// Required. How this admission rule will be evaluated.
530    pub evaluation_mode: crate::model::admission_rule::EvaluationMode,
531
532    /// Optional. The resource names of the attestors that must attest to
533    /// a container image, in the format `projects/*/attestors/*`. Each
534    /// attestor must exist before a policy can reference it.  To add an attestor
535    /// to a policy the principal issuing the policy change request must be able
536    /// to read the attestor resource.
537    ///
538    /// Note: this field must be non-empty when the evaluation_mode field specifies
539    /// REQUIRE_ATTESTATION, otherwise it must be empty.
540    pub require_attestations_by: std::vec::Vec<std::string::String>,
541
542    /// Required. The action when a pod creation is denied by the admission rule.
543    pub enforcement_mode: crate::model::admission_rule::EnforcementMode,
544
545    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
546}
547
548impl AdmissionRule {
549    pub fn new() -> Self {
550        std::default::Default::default()
551    }
552
553    /// Sets the value of [evaluation_mode][crate::model::AdmissionRule::evaluation_mode].
554    ///
555    /// # Example
556    /// ```ignore,no_run
557    /// # use google_cloud_binaryauthorization_v1::model::AdmissionRule;
558    /// use google_cloud_binaryauthorization_v1::model::admission_rule::EvaluationMode;
559    /// let x0 = AdmissionRule::new().set_evaluation_mode(EvaluationMode::AlwaysAllow);
560    /// let x1 = AdmissionRule::new().set_evaluation_mode(EvaluationMode::RequireAttestation);
561    /// let x2 = AdmissionRule::new().set_evaluation_mode(EvaluationMode::AlwaysDeny);
562    /// ```
563    pub fn set_evaluation_mode<
564        T: std::convert::Into<crate::model::admission_rule::EvaluationMode>,
565    >(
566        mut self,
567        v: T,
568    ) -> Self {
569        self.evaluation_mode = v.into();
570        self
571    }
572
573    /// Sets the value of [require_attestations_by][crate::model::AdmissionRule::require_attestations_by].
574    ///
575    /// # Example
576    /// ```ignore,no_run
577    /// # use google_cloud_binaryauthorization_v1::model::AdmissionRule;
578    /// let x = AdmissionRule::new().set_require_attestations_by(["a", "b", "c"]);
579    /// ```
580    pub fn set_require_attestations_by<T, V>(mut self, v: T) -> Self
581    where
582        T: std::iter::IntoIterator<Item = V>,
583        V: std::convert::Into<std::string::String>,
584    {
585        use std::iter::Iterator;
586        self.require_attestations_by = v.into_iter().map(|i| i.into()).collect();
587        self
588    }
589
590    /// Sets the value of [enforcement_mode][crate::model::AdmissionRule::enforcement_mode].
591    ///
592    /// # Example
593    /// ```ignore,no_run
594    /// # use google_cloud_binaryauthorization_v1::model::AdmissionRule;
595    /// use google_cloud_binaryauthorization_v1::model::admission_rule::EnforcementMode;
596    /// let x0 = AdmissionRule::new().set_enforcement_mode(EnforcementMode::EnforcedBlockAndAuditLog);
597    /// let x1 = AdmissionRule::new().set_enforcement_mode(EnforcementMode::DryrunAuditLogOnly);
598    /// ```
599    pub fn set_enforcement_mode<
600        T: std::convert::Into<crate::model::admission_rule::EnforcementMode>,
601    >(
602        mut self,
603        v: T,
604    ) -> Self {
605        self.enforcement_mode = v.into();
606        self
607    }
608}
609
610impl wkt::message::Message for AdmissionRule {
611    fn typename() -> &'static str {
612        "type.googleapis.com/google.cloud.binaryauthorization.v1.AdmissionRule"
613    }
614}
615
616/// Defines additional types related to [AdmissionRule].
617pub mod admission_rule {
618    #[allow(unused_imports)]
619    use super::*;
620
621    ///
622    /// # Working with unknown values
623    ///
624    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
625    /// additional enum variants at any time. Adding new variants is not considered
626    /// a breaking change. Applications should write their code in anticipation of:
627    ///
628    /// - New values appearing in future releases of the client library, **and**
629    /// - New values received dynamically, without application changes.
630    ///
631    /// Please consult the [Working with enums] section in the user guide for some
632    /// guidelines.
633    ///
634    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
635    #[derive(Clone, Debug, PartialEq)]
636    #[non_exhaustive]
637    pub enum EvaluationMode {
638        /// Do not use.
639        Unspecified,
640        /// This rule allows all all pod creations.
641        AlwaysAllow,
642        /// This rule allows a pod creation if all the attestors listed in
643        /// 'require_attestations_by' have valid attestations for all of the
644        /// images in the pod spec.
645        RequireAttestation,
646        /// This rule denies all pod creations.
647        AlwaysDeny,
648        /// If set, the enum was initialized with an unknown value.
649        ///
650        /// Applications can examine the value using [EvaluationMode::value] or
651        /// [EvaluationMode::name].
652        UnknownValue(evaluation_mode::UnknownValue),
653    }
654
655    #[doc(hidden)]
656    pub mod evaluation_mode {
657        #[allow(unused_imports)]
658        use super::*;
659        #[derive(Clone, Debug, PartialEq)]
660        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
661    }
662
663    impl EvaluationMode {
664        /// Gets the enum value.
665        ///
666        /// Returns `None` if the enum contains an unknown value deserialized from
667        /// the string representation of enums.
668        pub fn value(&self) -> std::option::Option<i32> {
669            match self {
670                Self::Unspecified => std::option::Option::Some(0),
671                Self::AlwaysAllow => std::option::Option::Some(1),
672                Self::RequireAttestation => std::option::Option::Some(2),
673                Self::AlwaysDeny => std::option::Option::Some(3),
674                Self::UnknownValue(u) => u.0.value(),
675            }
676        }
677
678        /// Gets the enum value as a string.
679        ///
680        /// Returns `None` if the enum contains an unknown value deserialized from
681        /// the integer representation of enums.
682        pub fn name(&self) -> std::option::Option<&str> {
683            match self {
684                Self::Unspecified => std::option::Option::Some("EVALUATION_MODE_UNSPECIFIED"),
685                Self::AlwaysAllow => std::option::Option::Some("ALWAYS_ALLOW"),
686                Self::RequireAttestation => std::option::Option::Some("REQUIRE_ATTESTATION"),
687                Self::AlwaysDeny => std::option::Option::Some("ALWAYS_DENY"),
688                Self::UnknownValue(u) => u.0.name(),
689            }
690        }
691    }
692
693    impl std::default::Default for EvaluationMode {
694        fn default() -> Self {
695            use std::convert::From;
696            Self::from(0)
697        }
698    }
699
700    impl std::fmt::Display for EvaluationMode {
701        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
702            wkt::internal::display_enum(f, self.name(), self.value())
703        }
704    }
705
706    impl std::convert::From<i32> for EvaluationMode {
707        fn from(value: i32) -> Self {
708            match value {
709                0 => Self::Unspecified,
710                1 => Self::AlwaysAllow,
711                2 => Self::RequireAttestation,
712                3 => Self::AlwaysDeny,
713                _ => Self::UnknownValue(evaluation_mode::UnknownValue(
714                    wkt::internal::UnknownEnumValue::Integer(value),
715                )),
716            }
717        }
718    }
719
720    impl std::convert::From<&str> for EvaluationMode {
721        fn from(value: &str) -> Self {
722            use std::string::ToString;
723            match value {
724                "EVALUATION_MODE_UNSPECIFIED" => Self::Unspecified,
725                "ALWAYS_ALLOW" => Self::AlwaysAllow,
726                "REQUIRE_ATTESTATION" => Self::RequireAttestation,
727                "ALWAYS_DENY" => Self::AlwaysDeny,
728                _ => Self::UnknownValue(evaluation_mode::UnknownValue(
729                    wkt::internal::UnknownEnumValue::String(value.to_string()),
730                )),
731            }
732        }
733    }
734
735    impl serde::ser::Serialize for EvaluationMode {
736        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
737        where
738            S: serde::Serializer,
739        {
740            match self {
741                Self::Unspecified => serializer.serialize_i32(0),
742                Self::AlwaysAllow => serializer.serialize_i32(1),
743                Self::RequireAttestation => serializer.serialize_i32(2),
744                Self::AlwaysDeny => serializer.serialize_i32(3),
745                Self::UnknownValue(u) => u.0.serialize(serializer),
746            }
747        }
748    }
749
750    impl<'de> serde::de::Deserialize<'de> for EvaluationMode {
751        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
752        where
753            D: serde::Deserializer<'de>,
754        {
755            deserializer.deserialize_any(wkt::internal::EnumVisitor::<EvaluationMode>::new(
756                ".google.cloud.binaryauthorization.v1.AdmissionRule.EvaluationMode",
757            ))
758        }
759    }
760
761    /// Defines the possible actions when a pod creation is denied by an admission
762    /// rule.
763    ///
764    /// # Working with unknown values
765    ///
766    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
767    /// additional enum variants at any time. Adding new variants is not considered
768    /// a breaking change. Applications should write their code in anticipation of:
769    ///
770    /// - New values appearing in future releases of the client library, **and**
771    /// - New values received dynamically, without application changes.
772    ///
773    /// Please consult the [Working with enums] section in the user guide for some
774    /// guidelines.
775    ///
776    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
777    #[derive(Clone, Debug, PartialEq)]
778    #[non_exhaustive]
779    pub enum EnforcementMode {
780        /// Do not use.
781        Unspecified,
782        /// Enforce the admission rule by blocking the pod creation.
783        EnforcedBlockAndAuditLog,
784        /// Dryrun mode: Audit logging only.  This will allow the pod creation as if
785        /// the admission request had specified break-glass.
786        DryrunAuditLogOnly,
787        /// If set, the enum was initialized with an unknown value.
788        ///
789        /// Applications can examine the value using [EnforcementMode::value] or
790        /// [EnforcementMode::name].
791        UnknownValue(enforcement_mode::UnknownValue),
792    }
793
794    #[doc(hidden)]
795    pub mod enforcement_mode {
796        #[allow(unused_imports)]
797        use super::*;
798        #[derive(Clone, Debug, PartialEq)]
799        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
800    }
801
802    impl EnforcementMode {
803        /// Gets the enum value.
804        ///
805        /// Returns `None` if the enum contains an unknown value deserialized from
806        /// the string representation of enums.
807        pub fn value(&self) -> std::option::Option<i32> {
808            match self {
809                Self::Unspecified => std::option::Option::Some(0),
810                Self::EnforcedBlockAndAuditLog => std::option::Option::Some(1),
811                Self::DryrunAuditLogOnly => std::option::Option::Some(2),
812                Self::UnknownValue(u) => u.0.value(),
813            }
814        }
815
816        /// Gets the enum value as a string.
817        ///
818        /// Returns `None` if the enum contains an unknown value deserialized from
819        /// the integer representation of enums.
820        pub fn name(&self) -> std::option::Option<&str> {
821            match self {
822                Self::Unspecified => std::option::Option::Some("ENFORCEMENT_MODE_UNSPECIFIED"),
823                Self::EnforcedBlockAndAuditLog => {
824                    std::option::Option::Some("ENFORCED_BLOCK_AND_AUDIT_LOG")
825                }
826                Self::DryrunAuditLogOnly => std::option::Option::Some("DRYRUN_AUDIT_LOG_ONLY"),
827                Self::UnknownValue(u) => u.0.name(),
828            }
829        }
830    }
831
832    impl std::default::Default for EnforcementMode {
833        fn default() -> Self {
834            use std::convert::From;
835            Self::from(0)
836        }
837    }
838
839    impl std::fmt::Display for EnforcementMode {
840        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
841            wkt::internal::display_enum(f, self.name(), self.value())
842        }
843    }
844
845    impl std::convert::From<i32> for EnforcementMode {
846        fn from(value: i32) -> Self {
847            match value {
848                0 => Self::Unspecified,
849                1 => Self::EnforcedBlockAndAuditLog,
850                2 => Self::DryrunAuditLogOnly,
851                _ => Self::UnknownValue(enforcement_mode::UnknownValue(
852                    wkt::internal::UnknownEnumValue::Integer(value),
853                )),
854            }
855        }
856    }
857
858    impl std::convert::From<&str> for EnforcementMode {
859        fn from(value: &str) -> Self {
860            use std::string::ToString;
861            match value {
862                "ENFORCEMENT_MODE_UNSPECIFIED" => Self::Unspecified,
863                "ENFORCED_BLOCK_AND_AUDIT_LOG" => Self::EnforcedBlockAndAuditLog,
864                "DRYRUN_AUDIT_LOG_ONLY" => Self::DryrunAuditLogOnly,
865                _ => Self::UnknownValue(enforcement_mode::UnknownValue(
866                    wkt::internal::UnknownEnumValue::String(value.to_string()),
867                )),
868            }
869        }
870    }
871
872    impl serde::ser::Serialize for EnforcementMode {
873        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
874        where
875            S: serde::Serializer,
876        {
877            match self {
878                Self::Unspecified => serializer.serialize_i32(0),
879                Self::EnforcedBlockAndAuditLog => serializer.serialize_i32(1),
880                Self::DryrunAuditLogOnly => serializer.serialize_i32(2),
881                Self::UnknownValue(u) => u.0.serialize(serializer),
882            }
883        }
884    }
885
886    impl<'de> serde::de::Deserialize<'de> for EnforcementMode {
887        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
888        where
889            D: serde::Deserializer<'de>,
890        {
891            deserializer.deserialize_any(wkt::internal::EnumVisitor::<EnforcementMode>::new(
892                ".google.cloud.binaryauthorization.v1.AdmissionRule.EnforcementMode",
893            ))
894        }
895    }
896}
897
898/// An [attestor][google.cloud.binaryauthorization.v1.Attestor] that attests to container image
899/// artifacts. An existing attestor cannot be modified except where
900/// indicated.
901///
902/// [google.cloud.binaryauthorization.v1.Attestor]: crate::model::Attestor
903#[derive(Clone, Default, PartialEq)]
904#[non_exhaustive]
905pub struct Attestor {
906    /// Required. The resource name, in the format:
907    /// `projects/*/attestors/*`. This field may not be updated.
908    pub name: std::string::String,
909
910    /// Optional. A descriptive comment.  This field may be updated.
911    /// The field may be displayed in chooser dialogs.
912    pub description: std::string::String,
913
914    /// Output only. Time when the attestor was last updated.
915    pub update_time: std::option::Option<wkt::Timestamp>,
916
917    pub attestor_type: std::option::Option<crate::model::attestor::AttestorType>,
918
919    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
920}
921
922impl Attestor {
923    pub fn new() -> Self {
924        std::default::Default::default()
925    }
926
927    /// Sets the value of [name][crate::model::Attestor::name].
928    ///
929    /// # Example
930    /// ```ignore,no_run
931    /// # use google_cloud_binaryauthorization_v1::model::Attestor;
932    /// let x = Attestor::new().set_name("example");
933    /// ```
934    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
935        self.name = v.into();
936        self
937    }
938
939    /// Sets the value of [description][crate::model::Attestor::description].
940    ///
941    /// # Example
942    /// ```ignore,no_run
943    /// # use google_cloud_binaryauthorization_v1::model::Attestor;
944    /// let x = Attestor::new().set_description("example");
945    /// ```
946    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
947        self.description = v.into();
948        self
949    }
950
951    /// Sets the value of [update_time][crate::model::Attestor::update_time].
952    ///
953    /// # Example
954    /// ```ignore,no_run
955    /// # use google_cloud_binaryauthorization_v1::model::Attestor;
956    /// use wkt::Timestamp;
957    /// let x = Attestor::new().set_update_time(Timestamp::default()/* use setters */);
958    /// ```
959    pub fn set_update_time<T>(mut self, v: T) -> Self
960    where
961        T: std::convert::Into<wkt::Timestamp>,
962    {
963        self.update_time = std::option::Option::Some(v.into());
964        self
965    }
966
967    /// Sets or clears the value of [update_time][crate::model::Attestor::update_time].
968    ///
969    /// # Example
970    /// ```ignore,no_run
971    /// # use google_cloud_binaryauthorization_v1::model::Attestor;
972    /// use wkt::Timestamp;
973    /// let x = Attestor::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
974    /// let x = Attestor::new().set_or_clear_update_time(None::<Timestamp>);
975    /// ```
976    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
977    where
978        T: std::convert::Into<wkt::Timestamp>,
979    {
980        self.update_time = v.map(|x| x.into());
981        self
982    }
983
984    /// Sets the value of [attestor_type][crate::model::Attestor::attestor_type].
985    ///
986    /// Note that all the setters affecting `attestor_type` are mutually
987    /// exclusive.
988    ///
989    /// # Example
990    /// ```ignore,no_run
991    /// # use google_cloud_binaryauthorization_v1::model::Attestor;
992    /// use google_cloud_binaryauthorization_v1::model::UserOwnedGrafeasNote;
993    /// let x = Attestor::new().set_attestor_type(Some(
994    ///     google_cloud_binaryauthorization_v1::model::attestor::AttestorType::UserOwnedGrafeasNote(UserOwnedGrafeasNote::default().into())));
995    /// ```
996    pub fn set_attestor_type<
997        T: std::convert::Into<std::option::Option<crate::model::attestor::AttestorType>>,
998    >(
999        mut self,
1000        v: T,
1001    ) -> Self {
1002        self.attestor_type = v.into();
1003        self
1004    }
1005
1006    /// The value of [attestor_type][crate::model::Attestor::attestor_type]
1007    /// if it holds a `UserOwnedGrafeasNote`, `None` if the field is not set or
1008    /// holds a different branch.
1009    pub fn user_owned_grafeas_note(
1010        &self,
1011    ) -> std::option::Option<&std::boxed::Box<crate::model::UserOwnedGrafeasNote>> {
1012        #[allow(unreachable_patterns)]
1013        self.attestor_type.as_ref().and_then(|v| match v {
1014            crate::model::attestor::AttestorType::UserOwnedGrafeasNote(v) => {
1015                std::option::Option::Some(v)
1016            }
1017            _ => std::option::Option::None,
1018        })
1019    }
1020
1021    /// Sets the value of [attestor_type][crate::model::Attestor::attestor_type]
1022    /// to hold a `UserOwnedGrafeasNote`.
1023    ///
1024    /// Note that all the setters affecting `attestor_type` are
1025    /// mutually exclusive.
1026    ///
1027    /// # Example
1028    /// ```ignore,no_run
1029    /// # use google_cloud_binaryauthorization_v1::model::Attestor;
1030    /// use google_cloud_binaryauthorization_v1::model::UserOwnedGrafeasNote;
1031    /// let x = Attestor::new().set_user_owned_grafeas_note(UserOwnedGrafeasNote::default()/* use setters */);
1032    /// assert!(x.user_owned_grafeas_note().is_some());
1033    /// ```
1034    pub fn set_user_owned_grafeas_note<
1035        T: std::convert::Into<std::boxed::Box<crate::model::UserOwnedGrafeasNote>>,
1036    >(
1037        mut self,
1038        v: T,
1039    ) -> Self {
1040        self.attestor_type = std::option::Option::Some(
1041            crate::model::attestor::AttestorType::UserOwnedGrafeasNote(v.into()),
1042        );
1043        self
1044    }
1045}
1046
1047impl wkt::message::Message for Attestor {
1048    fn typename() -> &'static str {
1049        "type.googleapis.com/google.cloud.binaryauthorization.v1.Attestor"
1050    }
1051}
1052
1053/// Defines additional types related to [Attestor].
1054pub mod attestor {
1055    #[allow(unused_imports)]
1056    use super::*;
1057
1058    #[derive(Clone, Debug, PartialEq)]
1059    #[non_exhaustive]
1060    pub enum AttestorType {
1061        /// This specifies how an attestation will be read, and how it will be used
1062        /// during policy enforcement.
1063        UserOwnedGrafeasNote(std::boxed::Box<crate::model::UserOwnedGrafeasNote>),
1064    }
1065}
1066
1067/// An [user owned Grafeas note][google.cloud.binaryauthorization.v1.UserOwnedGrafeasNote] references a Grafeas
1068/// Attestation.Authority Note created by the user.
1069///
1070/// [google.cloud.binaryauthorization.v1.UserOwnedGrafeasNote]: crate::model::UserOwnedGrafeasNote
1071#[derive(Clone, Default, PartialEq)]
1072#[non_exhaustive]
1073pub struct UserOwnedGrafeasNote {
1074    /// Required. The Grafeas resource name of a Attestation.Authority Note,
1075    /// created by the user, in the format: `projects/*/notes/*`. This field may
1076    /// not be updated.
1077    ///
1078    /// An attestation by this attestor is stored as a Grafeas
1079    /// Attestation.Authority Occurrence that names a container image and that
1080    /// links to this Note. Grafeas is an external dependency.
1081    pub note_reference: std::string::String,
1082
1083    /// Optional. Public keys that verify attestations signed by this
1084    /// attestor.  This field may be updated.
1085    ///
1086    /// If this field is non-empty, one of the specified public keys must
1087    /// verify that an attestation was signed by this attestor for the
1088    /// image specified in the admission request.
1089    ///
1090    /// If this field is empty, this attestor always returns that no
1091    /// valid attestations exist.
1092    pub public_keys: std::vec::Vec<crate::model::AttestorPublicKey>,
1093
1094    /// Output only. This field will contain the service account email address
1095    /// that this Attestor will use as the principal when querying Container
1096    /// Analysis. Attestor administrators must grant this service account the
1097    /// IAM role needed to read attestations from the [note_reference][Note] in
1098    /// Container Analysis (`containeranalysis.notes.occurrences.viewer`).
1099    ///
1100    /// This email address is fixed for the lifetime of the Attestor, but callers
1101    /// should not make any other assumptions about the service account email;
1102    /// future versions may use an email based on a different naming pattern.
1103    pub delegation_service_account_email: std::string::String,
1104
1105    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1106}
1107
1108impl UserOwnedGrafeasNote {
1109    pub fn new() -> Self {
1110        std::default::Default::default()
1111    }
1112
1113    /// Sets the value of [note_reference][crate::model::UserOwnedGrafeasNote::note_reference].
1114    ///
1115    /// # Example
1116    /// ```ignore,no_run
1117    /// # use google_cloud_binaryauthorization_v1::model::UserOwnedGrafeasNote;
1118    /// let x = UserOwnedGrafeasNote::new().set_note_reference("example");
1119    /// ```
1120    pub fn set_note_reference<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1121        self.note_reference = v.into();
1122        self
1123    }
1124
1125    /// Sets the value of [public_keys][crate::model::UserOwnedGrafeasNote::public_keys].
1126    ///
1127    /// # Example
1128    /// ```ignore,no_run
1129    /// # use google_cloud_binaryauthorization_v1::model::UserOwnedGrafeasNote;
1130    /// use google_cloud_binaryauthorization_v1::model::AttestorPublicKey;
1131    /// let x = UserOwnedGrafeasNote::new()
1132    ///     .set_public_keys([
1133    ///         AttestorPublicKey::default()/* use setters */,
1134    ///         AttestorPublicKey::default()/* use (different) setters */,
1135    ///     ]);
1136    /// ```
1137    pub fn set_public_keys<T, V>(mut self, v: T) -> Self
1138    where
1139        T: std::iter::IntoIterator<Item = V>,
1140        V: std::convert::Into<crate::model::AttestorPublicKey>,
1141    {
1142        use std::iter::Iterator;
1143        self.public_keys = v.into_iter().map(|i| i.into()).collect();
1144        self
1145    }
1146
1147    /// Sets the value of [delegation_service_account_email][crate::model::UserOwnedGrafeasNote::delegation_service_account_email].
1148    ///
1149    /// # Example
1150    /// ```ignore,no_run
1151    /// # use google_cloud_binaryauthorization_v1::model::UserOwnedGrafeasNote;
1152    /// let x = UserOwnedGrafeasNote::new().set_delegation_service_account_email("example");
1153    /// ```
1154    pub fn set_delegation_service_account_email<T: std::convert::Into<std::string::String>>(
1155        mut self,
1156        v: T,
1157    ) -> Self {
1158        self.delegation_service_account_email = v.into();
1159        self
1160    }
1161}
1162
1163impl wkt::message::Message for UserOwnedGrafeasNote {
1164    fn typename() -> &'static str {
1165        "type.googleapis.com/google.cloud.binaryauthorization.v1.UserOwnedGrafeasNote"
1166    }
1167}
1168
1169/// A public key in the PkixPublicKey format (see
1170/// <https://tools.ietf.org/html/rfc5280#section-4.1.2.7> for details).
1171/// Public keys of this type are typically textually encoded using the PEM
1172/// format.
1173#[derive(Clone, Default, PartialEq)]
1174#[non_exhaustive]
1175pub struct PkixPublicKey {
1176    /// A PEM-encoded public key, as described in
1177    /// <https://tools.ietf.org/html/rfc7468#section-13>
1178    pub public_key_pem: std::string::String,
1179
1180    /// The signature algorithm used to verify a message against a signature using
1181    /// this key.
1182    /// These signature algorithm must match the structure and any object
1183    /// identifiers encoded in `public_key_pem` (i.e. this algorithm must match
1184    /// that of the public key).
1185    pub signature_algorithm: crate::model::pkix_public_key::SignatureAlgorithm,
1186
1187    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1188}
1189
1190impl PkixPublicKey {
1191    pub fn new() -> Self {
1192        std::default::Default::default()
1193    }
1194
1195    /// Sets the value of [public_key_pem][crate::model::PkixPublicKey::public_key_pem].
1196    ///
1197    /// # Example
1198    /// ```ignore,no_run
1199    /// # use google_cloud_binaryauthorization_v1::model::PkixPublicKey;
1200    /// let x = PkixPublicKey::new().set_public_key_pem("example");
1201    /// ```
1202    pub fn set_public_key_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1203        self.public_key_pem = v.into();
1204        self
1205    }
1206
1207    /// Sets the value of [signature_algorithm][crate::model::PkixPublicKey::signature_algorithm].
1208    ///
1209    /// # Example
1210    /// ```ignore,no_run
1211    /// # use google_cloud_binaryauthorization_v1::model::PkixPublicKey;
1212    /// use google_cloud_binaryauthorization_v1::model::pkix_public_key::SignatureAlgorithm;
1213    /// let x0 = PkixPublicKey::new().set_signature_algorithm(SignatureAlgorithm::RsaPss2048Sha256);
1214    /// let x1 = PkixPublicKey::new().set_signature_algorithm(SignatureAlgorithm::RsaPss3072Sha256);
1215    /// let x2 = PkixPublicKey::new().set_signature_algorithm(SignatureAlgorithm::RsaPss4096Sha256);
1216    /// ```
1217    pub fn set_signature_algorithm<
1218        T: std::convert::Into<crate::model::pkix_public_key::SignatureAlgorithm>,
1219    >(
1220        mut self,
1221        v: T,
1222    ) -> Self {
1223        self.signature_algorithm = v.into();
1224        self
1225    }
1226}
1227
1228impl wkt::message::Message for PkixPublicKey {
1229    fn typename() -> &'static str {
1230        "type.googleapis.com/google.cloud.binaryauthorization.v1.PkixPublicKey"
1231    }
1232}
1233
1234/// Defines additional types related to [PkixPublicKey].
1235pub mod pkix_public_key {
1236    #[allow(unused_imports)]
1237    use super::*;
1238
1239    /// Represents a signature algorithm and other information necessary to verify
1240    /// signatures with a given public key.
1241    /// This is based primarily on the public key types supported by Tink's
1242    /// PemKeyType, which is in turn based on KMS's supported signing algorithms.
1243    /// See <https://cloud.google.com/kms/docs/algorithms>. In the future, BinAuthz
1244    /// might support additional public key types independently of Tink and/or KMS.
1245    ///
1246    /// # Working with unknown values
1247    ///
1248    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1249    /// additional enum variants at any time. Adding new variants is not considered
1250    /// a breaking change. Applications should write their code in anticipation of:
1251    ///
1252    /// - New values appearing in future releases of the client library, **and**
1253    /// - New values received dynamically, without application changes.
1254    ///
1255    /// Please consult the [Working with enums] section in the user guide for some
1256    /// guidelines.
1257    ///
1258    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1259    #[derive(Clone, Debug, PartialEq)]
1260    #[non_exhaustive]
1261    pub enum SignatureAlgorithm {
1262        /// Not specified.
1263        Unspecified,
1264        /// RSASSA-PSS 2048 bit key with a SHA256 digest.
1265        RsaPss2048Sha256,
1266        /// RSASSA-PSS 3072 bit key with a SHA256 digest.
1267        RsaPss3072Sha256,
1268        /// RSASSA-PSS 4096 bit key with a SHA256 digest.
1269        RsaPss4096Sha256,
1270        /// RSASSA-PSS 4096 bit key with a SHA512 digest.
1271        RsaPss4096Sha512,
1272        /// RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest.
1273        RsaSignPkcs12048Sha256,
1274        /// RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest.
1275        RsaSignPkcs13072Sha256,
1276        /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest.
1277        RsaSignPkcs14096Sha256,
1278        /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA512 digest.
1279        RsaSignPkcs14096Sha512,
1280        /// ECDSA on the NIST P-256 curve with a SHA256 digest.
1281        EcdsaP256Sha256,
1282        /// ECDSA on the NIST P-256 curve with a SHA256 digest.
1283        EcSignP256Sha256,
1284        /// ECDSA on the NIST P-384 curve with a SHA384 digest.
1285        EcdsaP384Sha384,
1286        /// ECDSA on the NIST P-384 curve with a SHA384 digest.
1287        EcSignP384Sha384,
1288        /// ECDSA on the NIST P-521 curve with a SHA512 digest.
1289        EcdsaP521Sha512,
1290        /// ECDSA on the NIST P-521 curve with a SHA512 digest.
1291        EcSignP521Sha512,
1292        /// If set, the enum was initialized with an unknown value.
1293        ///
1294        /// Applications can examine the value using [SignatureAlgorithm::value] or
1295        /// [SignatureAlgorithm::name].
1296        UnknownValue(signature_algorithm::UnknownValue),
1297    }
1298
1299    #[doc(hidden)]
1300    pub mod signature_algorithm {
1301        #[allow(unused_imports)]
1302        use super::*;
1303        #[derive(Clone, Debug, PartialEq)]
1304        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1305    }
1306
1307    impl SignatureAlgorithm {
1308        /// Gets the enum value.
1309        ///
1310        /// Returns `None` if the enum contains an unknown value deserialized from
1311        /// the string representation of enums.
1312        pub fn value(&self) -> std::option::Option<i32> {
1313            match self {
1314                Self::Unspecified => std::option::Option::Some(0),
1315                Self::RsaPss2048Sha256 => std::option::Option::Some(1),
1316                Self::RsaPss3072Sha256 => std::option::Option::Some(2),
1317                Self::RsaPss4096Sha256 => std::option::Option::Some(3),
1318                Self::RsaPss4096Sha512 => std::option::Option::Some(4),
1319                Self::RsaSignPkcs12048Sha256 => std::option::Option::Some(5),
1320                Self::RsaSignPkcs13072Sha256 => std::option::Option::Some(6),
1321                Self::RsaSignPkcs14096Sha256 => std::option::Option::Some(7),
1322                Self::RsaSignPkcs14096Sha512 => std::option::Option::Some(8),
1323                Self::EcdsaP256Sha256 => std::option::Option::Some(9),
1324                Self::EcSignP256Sha256 => std::option::Option::Some(9),
1325                Self::EcdsaP384Sha384 => std::option::Option::Some(10),
1326                Self::EcSignP384Sha384 => std::option::Option::Some(10),
1327                Self::EcdsaP521Sha512 => std::option::Option::Some(11),
1328                Self::EcSignP521Sha512 => std::option::Option::Some(11),
1329                Self::UnknownValue(u) => u.0.value(),
1330            }
1331        }
1332
1333        /// Gets the enum value as a string.
1334        ///
1335        /// Returns `None` if the enum contains an unknown value deserialized from
1336        /// the integer representation of enums.
1337        pub fn name(&self) -> std::option::Option<&str> {
1338            match self {
1339                Self::Unspecified => std::option::Option::Some("SIGNATURE_ALGORITHM_UNSPECIFIED"),
1340                Self::RsaPss2048Sha256 => std::option::Option::Some("RSA_PSS_2048_SHA256"),
1341                Self::RsaPss3072Sha256 => std::option::Option::Some("RSA_PSS_3072_SHA256"),
1342                Self::RsaPss4096Sha256 => std::option::Option::Some("RSA_PSS_4096_SHA256"),
1343                Self::RsaPss4096Sha512 => std::option::Option::Some("RSA_PSS_4096_SHA512"),
1344                Self::RsaSignPkcs12048Sha256 => {
1345                    std::option::Option::Some("RSA_SIGN_PKCS1_2048_SHA256")
1346                }
1347                Self::RsaSignPkcs13072Sha256 => {
1348                    std::option::Option::Some("RSA_SIGN_PKCS1_3072_SHA256")
1349                }
1350                Self::RsaSignPkcs14096Sha256 => {
1351                    std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA256")
1352                }
1353                Self::RsaSignPkcs14096Sha512 => {
1354                    std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA512")
1355                }
1356                Self::EcdsaP256Sha256 => std::option::Option::Some("ECDSA_P256_SHA256"),
1357                Self::EcSignP256Sha256 => std::option::Option::Some("EC_SIGN_P256_SHA256"),
1358                Self::EcdsaP384Sha384 => std::option::Option::Some("ECDSA_P384_SHA384"),
1359                Self::EcSignP384Sha384 => std::option::Option::Some("EC_SIGN_P384_SHA384"),
1360                Self::EcdsaP521Sha512 => std::option::Option::Some("ECDSA_P521_SHA512"),
1361                Self::EcSignP521Sha512 => std::option::Option::Some("EC_SIGN_P521_SHA512"),
1362                Self::UnknownValue(u) => u.0.name(),
1363            }
1364        }
1365    }
1366
1367    impl std::default::Default for SignatureAlgorithm {
1368        fn default() -> Self {
1369            use std::convert::From;
1370            Self::from(0)
1371        }
1372    }
1373
1374    impl std::fmt::Display for SignatureAlgorithm {
1375        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1376            wkt::internal::display_enum(f, self.name(), self.value())
1377        }
1378    }
1379
1380    impl std::convert::From<i32> for SignatureAlgorithm {
1381        fn from(value: i32) -> Self {
1382            match value {
1383                0 => Self::Unspecified,
1384                1 => Self::RsaPss2048Sha256,
1385                2 => Self::RsaPss3072Sha256,
1386                3 => Self::RsaPss4096Sha256,
1387                4 => Self::RsaPss4096Sha512,
1388                5 => Self::RsaSignPkcs12048Sha256,
1389                6 => Self::RsaSignPkcs13072Sha256,
1390                7 => Self::RsaSignPkcs14096Sha256,
1391                8 => Self::RsaSignPkcs14096Sha512,
1392                9 => Self::EcdsaP256Sha256,
1393                10 => Self::EcdsaP384Sha384,
1394                11 => Self::EcdsaP521Sha512,
1395                _ => Self::UnknownValue(signature_algorithm::UnknownValue(
1396                    wkt::internal::UnknownEnumValue::Integer(value),
1397                )),
1398            }
1399        }
1400    }
1401
1402    impl std::convert::From<&str> for SignatureAlgorithm {
1403        fn from(value: &str) -> Self {
1404            use std::string::ToString;
1405            match value {
1406                "SIGNATURE_ALGORITHM_UNSPECIFIED" => Self::Unspecified,
1407                "RSA_PSS_2048_SHA256" => Self::RsaPss2048Sha256,
1408                "RSA_PSS_3072_SHA256" => Self::RsaPss3072Sha256,
1409                "RSA_PSS_4096_SHA256" => Self::RsaPss4096Sha256,
1410                "RSA_PSS_4096_SHA512" => Self::RsaPss4096Sha512,
1411                "RSA_SIGN_PKCS1_2048_SHA256" => Self::RsaSignPkcs12048Sha256,
1412                "RSA_SIGN_PKCS1_3072_SHA256" => Self::RsaSignPkcs13072Sha256,
1413                "RSA_SIGN_PKCS1_4096_SHA256" => Self::RsaSignPkcs14096Sha256,
1414                "RSA_SIGN_PKCS1_4096_SHA512" => Self::RsaSignPkcs14096Sha512,
1415                "ECDSA_P256_SHA256" => Self::EcdsaP256Sha256,
1416                "EC_SIGN_P256_SHA256" => Self::EcSignP256Sha256,
1417                "ECDSA_P384_SHA384" => Self::EcdsaP384Sha384,
1418                "EC_SIGN_P384_SHA384" => Self::EcSignP384Sha384,
1419                "ECDSA_P521_SHA512" => Self::EcdsaP521Sha512,
1420                "EC_SIGN_P521_SHA512" => Self::EcSignP521Sha512,
1421                _ => Self::UnknownValue(signature_algorithm::UnknownValue(
1422                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1423                )),
1424            }
1425        }
1426    }
1427
1428    impl serde::ser::Serialize for SignatureAlgorithm {
1429        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1430        where
1431            S: serde::Serializer,
1432        {
1433            match self {
1434                Self::Unspecified => serializer.serialize_i32(0),
1435                Self::RsaPss2048Sha256 => serializer.serialize_i32(1),
1436                Self::RsaPss3072Sha256 => serializer.serialize_i32(2),
1437                Self::RsaPss4096Sha256 => serializer.serialize_i32(3),
1438                Self::RsaPss4096Sha512 => serializer.serialize_i32(4),
1439                Self::RsaSignPkcs12048Sha256 => serializer.serialize_i32(5),
1440                Self::RsaSignPkcs13072Sha256 => serializer.serialize_i32(6),
1441                Self::RsaSignPkcs14096Sha256 => serializer.serialize_i32(7),
1442                Self::RsaSignPkcs14096Sha512 => serializer.serialize_i32(8),
1443                Self::EcdsaP256Sha256 => serializer.serialize_i32(9),
1444                Self::EcSignP256Sha256 => serializer.serialize_i32(9),
1445                Self::EcdsaP384Sha384 => serializer.serialize_i32(10),
1446                Self::EcSignP384Sha384 => serializer.serialize_i32(10),
1447                Self::EcdsaP521Sha512 => serializer.serialize_i32(11),
1448                Self::EcSignP521Sha512 => serializer.serialize_i32(11),
1449                Self::UnknownValue(u) => u.0.serialize(serializer),
1450            }
1451        }
1452    }
1453
1454    impl<'de> serde::de::Deserialize<'de> for SignatureAlgorithm {
1455        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1456        where
1457            D: serde::Deserializer<'de>,
1458        {
1459            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SignatureAlgorithm>::new(
1460                ".google.cloud.binaryauthorization.v1.PkixPublicKey.SignatureAlgorithm",
1461            ))
1462        }
1463    }
1464}
1465
1466/// An [attestor public key][google.cloud.binaryauthorization.v1.AttestorPublicKey] that will be used to verify
1467/// attestations signed by this attestor.
1468///
1469/// [google.cloud.binaryauthorization.v1.AttestorPublicKey]: crate::model::AttestorPublicKey
1470#[derive(Clone, Default, PartialEq)]
1471#[non_exhaustive]
1472pub struct AttestorPublicKey {
1473    /// Optional. A descriptive comment. This field may be updated.
1474    pub comment: std::string::String,
1475
1476    /// The ID of this public key.
1477    /// Signatures verified by BinAuthz must include the ID of the public key that
1478    /// can be used to verify them, and that ID must match the contents of this
1479    /// field exactly.
1480    /// Additional restrictions on this field can be imposed based on which public
1481    /// key type is encapsulated. See the documentation on `public_key` cases below
1482    /// for details.
1483    pub id: std::string::String,
1484
1485    pub public_key: std::option::Option<crate::model::attestor_public_key::PublicKey>,
1486
1487    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1488}
1489
1490impl AttestorPublicKey {
1491    pub fn new() -> Self {
1492        std::default::Default::default()
1493    }
1494
1495    /// Sets the value of [comment][crate::model::AttestorPublicKey::comment].
1496    ///
1497    /// # Example
1498    /// ```ignore,no_run
1499    /// # use google_cloud_binaryauthorization_v1::model::AttestorPublicKey;
1500    /// let x = AttestorPublicKey::new().set_comment("example");
1501    /// ```
1502    pub fn set_comment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1503        self.comment = v.into();
1504        self
1505    }
1506
1507    /// Sets the value of [id][crate::model::AttestorPublicKey::id].
1508    ///
1509    /// # Example
1510    /// ```ignore,no_run
1511    /// # use google_cloud_binaryauthorization_v1::model::AttestorPublicKey;
1512    /// let x = AttestorPublicKey::new().set_id("example");
1513    /// ```
1514    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1515        self.id = v.into();
1516        self
1517    }
1518
1519    /// Sets the value of [public_key][crate::model::AttestorPublicKey::public_key].
1520    ///
1521    /// Note that all the setters affecting `public_key` are mutually
1522    /// exclusive.
1523    ///
1524    /// # Example
1525    /// ```ignore,no_run
1526    /// # use google_cloud_binaryauthorization_v1::model::AttestorPublicKey;
1527    /// use google_cloud_binaryauthorization_v1::model::attestor_public_key::PublicKey;
1528    /// let x = AttestorPublicKey::new().set_public_key(Some(PublicKey::AsciiArmoredPgpPublicKey("example".to_string())));
1529    /// ```
1530    pub fn set_public_key<
1531        T: std::convert::Into<std::option::Option<crate::model::attestor_public_key::PublicKey>>,
1532    >(
1533        mut self,
1534        v: T,
1535    ) -> Self {
1536        self.public_key = v.into();
1537        self
1538    }
1539
1540    /// The value of [public_key][crate::model::AttestorPublicKey::public_key]
1541    /// if it holds a `AsciiArmoredPgpPublicKey`, `None` if the field is not set or
1542    /// holds a different branch.
1543    pub fn ascii_armored_pgp_public_key(&self) -> std::option::Option<&std::string::String> {
1544        #[allow(unreachable_patterns)]
1545        self.public_key.as_ref().and_then(|v| match v {
1546            crate::model::attestor_public_key::PublicKey::AsciiArmoredPgpPublicKey(v) => {
1547                std::option::Option::Some(v)
1548            }
1549            _ => std::option::Option::None,
1550        })
1551    }
1552
1553    /// Sets the value of [public_key][crate::model::AttestorPublicKey::public_key]
1554    /// to hold a `AsciiArmoredPgpPublicKey`.
1555    ///
1556    /// Note that all the setters affecting `public_key` are
1557    /// mutually exclusive.
1558    ///
1559    /// # Example
1560    /// ```ignore,no_run
1561    /// # use google_cloud_binaryauthorization_v1::model::AttestorPublicKey;
1562    /// let x = AttestorPublicKey::new().set_ascii_armored_pgp_public_key("example");
1563    /// assert!(x.ascii_armored_pgp_public_key().is_some());
1564    /// assert!(x.pkix_public_key().is_none());
1565    /// ```
1566    pub fn set_ascii_armored_pgp_public_key<T: std::convert::Into<std::string::String>>(
1567        mut self,
1568        v: T,
1569    ) -> Self {
1570        self.public_key = std::option::Option::Some(
1571            crate::model::attestor_public_key::PublicKey::AsciiArmoredPgpPublicKey(v.into()),
1572        );
1573        self
1574    }
1575
1576    /// The value of [public_key][crate::model::AttestorPublicKey::public_key]
1577    /// if it holds a `PkixPublicKey`, `None` if the field is not set or
1578    /// holds a different branch.
1579    pub fn pkix_public_key(
1580        &self,
1581    ) -> std::option::Option<&std::boxed::Box<crate::model::PkixPublicKey>> {
1582        #[allow(unreachable_patterns)]
1583        self.public_key.as_ref().and_then(|v| match v {
1584            crate::model::attestor_public_key::PublicKey::PkixPublicKey(v) => {
1585                std::option::Option::Some(v)
1586            }
1587            _ => std::option::Option::None,
1588        })
1589    }
1590
1591    /// Sets the value of [public_key][crate::model::AttestorPublicKey::public_key]
1592    /// to hold a `PkixPublicKey`.
1593    ///
1594    /// Note that all the setters affecting `public_key` are
1595    /// mutually exclusive.
1596    ///
1597    /// # Example
1598    /// ```ignore,no_run
1599    /// # use google_cloud_binaryauthorization_v1::model::AttestorPublicKey;
1600    /// use google_cloud_binaryauthorization_v1::model::PkixPublicKey;
1601    /// let x = AttestorPublicKey::new().set_pkix_public_key(PkixPublicKey::default()/* use setters */);
1602    /// assert!(x.pkix_public_key().is_some());
1603    /// assert!(x.ascii_armored_pgp_public_key().is_none());
1604    /// ```
1605    pub fn set_pkix_public_key<
1606        T: std::convert::Into<std::boxed::Box<crate::model::PkixPublicKey>>,
1607    >(
1608        mut self,
1609        v: T,
1610    ) -> Self {
1611        self.public_key = std::option::Option::Some(
1612            crate::model::attestor_public_key::PublicKey::PkixPublicKey(v.into()),
1613        );
1614        self
1615    }
1616}
1617
1618impl wkt::message::Message for AttestorPublicKey {
1619    fn typename() -> &'static str {
1620        "type.googleapis.com/google.cloud.binaryauthorization.v1.AttestorPublicKey"
1621    }
1622}
1623
1624/// Defines additional types related to [AttestorPublicKey].
1625pub mod attestor_public_key {
1626    #[allow(unused_imports)]
1627    use super::*;
1628
1629    #[derive(Clone, Debug, PartialEq)]
1630    #[non_exhaustive]
1631    pub enum PublicKey {
1632        /// ASCII-armored representation of a PGP public key, as the entire output by
1633        /// the command `gpg --export --armor foo@example.com` (either LF or CRLF
1634        /// line endings).
1635        /// When using this field, `id` should be left blank.  The BinAuthz API
1636        /// handlers will calculate the ID and fill it in automatically.  BinAuthz
1637        /// computes this ID as the OpenPGP RFC4880 V4 fingerprint, represented as
1638        /// upper-case hex.  If `id` is provided by the caller, it will be
1639        /// overwritten by the API-calculated ID.
1640        AsciiArmoredPgpPublicKey(std::string::String),
1641        /// A raw PKIX SubjectPublicKeyInfo format public key.
1642        ///
1643        /// NOTE: `id` may be explicitly provided by the caller when using this
1644        /// type of public key, but it MUST be a valid RFC3986 URI. If `id` is left
1645        /// blank, a default one will be computed based on the digest of the DER
1646        /// encoding of the public key.
1647        PkixPublicKey(std::boxed::Box<crate::model::PkixPublicKey>),
1648    }
1649}
1650
1651/// Request message for [BinauthzManagementService.GetPolicy][].
1652#[derive(Clone, Default, PartialEq)]
1653#[non_exhaustive]
1654pub struct GetPolicyRequest {
1655    /// Required. The resource name of the [policy][google.cloud.binaryauthorization.v1.Policy] to retrieve,
1656    /// in the format `projects/*/policy`.
1657    ///
1658    /// [google.cloud.binaryauthorization.v1.Policy]: crate::model::Policy
1659    pub name: std::string::String,
1660
1661    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1662}
1663
1664impl GetPolicyRequest {
1665    pub fn new() -> Self {
1666        std::default::Default::default()
1667    }
1668
1669    /// Sets the value of [name][crate::model::GetPolicyRequest::name].
1670    ///
1671    /// # Example
1672    /// ```ignore,no_run
1673    /// # use google_cloud_binaryauthorization_v1::model::GetPolicyRequest;
1674    /// let x = GetPolicyRequest::new().set_name("example");
1675    /// ```
1676    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1677        self.name = v.into();
1678        self
1679    }
1680}
1681
1682impl wkt::message::Message for GetPolicyRequest {
1683    fn typename() -> &'static str {
1684        "type.googleapis.com/google.cloud.binaryauthorization.v1.GetPolicyRequest"
1685    }
1686}
1687
1688/// Request message for [BinauthzManagementService.UpdatePolicy][].
1689#[derive(Clone, Default, PartialEq)]
1690#[non_exhaustive]
1691pub struct UpdatePolicyRequest {
1692    /// Required. A new or updated [policy][google.cloud.binaryauthorization.v1.Policy] value. The service will
1693    /// overwrite the [policy name][google.cloud.binaryauthorization.v1.Policy.name] field with the resource name in
1694    /// the request URL, in the format `projects/*/policy`.
1695    ///
1696    /// [google.cloud.binaryauthorization.v1.Policy]: crate::model::Policy
1697    /// [google.cloud.binaryauthorization.v1.Policy.name]: crate::model::Policy::name
1698    pub policy: std::option::Option<crate::model::Policy>,
1699
1700    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1701}
1702
1703impl UpdatePolicyRequest {
1704    pub fn new() -> Self {
1705        std::default::Default::default()
1706    }
1707
1708    /// Sets the value of [policy][crate::model::UpdatePolicyRequest::policy].
1709    ///
1710    /// # Example
1711    /// ```ignore,no_run
1712    /// # use google_cloud_binaryauthorization_v1::model::UpdatePolicyRequest;
1713    /// use google_cloud_binaryauthorization_v1::model::Policy;
1714    /// let x = UpdatePolicyRequest::new().set_policy(Policy::default()/* use setters */);
1715    /// ```
1716    pub fn set_policy<T>(mut self, v: T) -> Self
1717    where
1718        T: std::convert::Into<crate::model::Policy>,
1719    {
1720        self.policy = std::option::Option::Some(v.into());
1721        self
1722    }
1723
1724    /// Sets or clears the value of [policy][crate::model::UpdatePolicyRequest::policy].
1725    ///
1726    /// # Example
1727    /// ```ignore,no_run
1728    /// # use google_cloud_binaryauthorization_v1::model::UpdatePolicyRequest;
1729    /// use google_cloud_binaryauthorization_v1::model::Policy;
1730    /// let x = UpdatePolicyRequest::new().set_or_clear_policy(Some(Policy::default()/* use setters */));
1731    /// let x = UpdatePolicyRequest::new().set_or_clear_policy(None::<Policy>);
1732    /// ```
1733    pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1734    where
1735        T: std::convert::Into<crate::model::Policy>,
1736    {
1737        self.policy = v.map(|x| x.into());
1738        self
1739    }
1740}
1741
1742impl wkt::message::Message for UpdatePolicyRequest {
1743    fn typename() -> &'static str {
1744        "type.googleapis.com/google.cloud.binaryauthorization.v1.UpdatePolicyRequest"
1745    }
1746}
1747
1748/// Request message for [BinauthzManagementService.CreateAttestor][].
1749#[derive(Clone, Default, PartialEq)]
1750#[non_exhaustive]
1751pub struct CreateAttestorRequest {
1752    /// Required. The parent of this [attestor][google.cloud.binaryauthorization.v1.Attestor].
1753    ///
1754    /// [google.cloud.binaryauthorization.v1.Attestor]: crate::model::Attestor
1755    pub parent: std::string::String,
1756
1757    /// Required. The [attestors][google.cloud.binaryauthorization.v1.Attestor] ID.
1758    ///
1759    /// [google.cloud.binaryauthorization.v1.Attestor]: crate::model::Attestor
1760    pub attestor_id: std::string::String,
1761
1762    /// Required. The initial [attestor][google.cloud.binaryauthorization.v1.Attestor] value. The service will
1763    /// overwrite the [attestor name][google.cloud.binaryauthorization.v1.Attestor.name] field with the resource name,
1764    /// in the format `projects/*/attestors/*`.
1765    ///
1766    /// [google.cloud.binaryauthorization.v1.Attestor]: crate::model::Attestor
1767    /// [google.cloud.binaryauthorization.v1.Attestor.name]: crate::model::Attestor::name
1768    pub attestor: std::option::Option<crate::model::Attestor>,
1769
1770    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1771}
1772
1773impl CreateAttestorRequest {
1774    pub fn new() -> Self {
1775        std::default::Default::default()
1776    }
1777
1778    /// Sets the value of [parent][crate::model::CreateAttestorRequest::parent].
1779    ///
1780    /// # Example
1781    /// ```ignore,no_run
1782    /// # use google_cloud_binaryauthorization_v1::model::CreateAttestorRequest;
1783    /// let x = CreateAttestorRequest::new().set_parent("example");
1784    /// ```
1785    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1786        self.parent = v.into();
1787        self
1788    }
1789
1790    /// Sets the value of [attestor_id][crate::model::CreateAttestorRequest::attestor_id].
1791    ///
1792    /// # Example
1793    /// ```ignore,no_run
1794    /// # use google_cloud_binaryauthorization_v1::model::CreateAttestorRequest;
1795    /// let x = CreateAttestorRequest::new().set_attestor_id("example");
1796    /// ```
1797    pub fn set_attestor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1798        self.attestor_id = v.into();
1799        self
1800    }
1801
1802    /// Sets the value of [attestor][crate::model::CreateAttestorRequest::attestor].
1803    ///
1804    /// # Example
1805    /// ```ignore,no_run
1806    /// # use google_cloud_binaryauthorization_v1::model::CreateAttestorRequest;
1807    /// use google_cloud_binaryauthorization_v1::model::Attestor;
1808    /// let x = CreateAttestorRequest::new().set_attestor(Attestor::default()/* use setters */);
1809    /// ```
1810    pub fn set_attestor<T>(mut self, v: T) -> Self
1811    where
1812        T: std::convert::Into<crate::model::Attestor>,
1813    {
1814        self.attestor = std::option::Option::Some(v.into());
1815        self
1816    }
1817
1818    /// Sets or clears the value of [attestor][crate::model::CreateAttestorRequest::attestor].
1819    ///
1820    /// # Example
1821    /// ```ignore,no_run
1822    /// # use google_cloud_binaryauthorization_v1::model::CreateAttestorRequest;
1823    /// use google_cloud_binaryauthorization_v1::model::Attestor;
1824    /// let x = CreateAttestorRequest::new().set_or_clear_attestor(Some(Attestor::default()/* use setters */));
1825    /// let x = CreateAttestorRequest::new().set_or_clear_attestor(None::<Attestor>);
1826    /// ```
1827    pub fn set_or_clear_attestor<T>(mut self, v: std::option::Option<T>) -> Self
1828    where
1829        T: std::convert::Into<crate::model::Attestor>,
1830    {
1831        self.attestor = v.map(|x| x.into());
1832        self
1833    }
1834}
1835
1836impl wkt::message::Message for CreateAttestorRequest {
1837    fn typename() -> &'static str {
1838        "type.googleapis.com/google.cloud.binaryauthorization.v1.CreateAttestorRequest"
1839    }
1840}
1841
1842/// Request message for [BinauthzManagementService.GetAttestor][].
1843#[derive(Clone, Default, PartialEq)]
1844#[non_exhaustive]
1845pub struct GetAttestorRequest {
1846    /// Required. The name of the [attestor][google.cloud.binaryauthorization.v1.Attestor] to retrieve, in the format
1847    /// `projects/*/attestors/*`.
1848    ///
1849    /// [google.cloud.binaryauthorization.v1.Attestor]: crate::model::Attestor
1850    pub name: std::string::String,
1851
1852    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1853}
1854
1855impl GetAttestorRequest {
1856    pub fn new() -> Self {
1857        std::default::Default::default()
1858    }
1859
1860    /// Sets the value of [name][crate::model::GetAttestorRequest::name].
1861    ///
1862    /// # Example
1863    /// ```ignore,no_run
1864    /// # use google_cloud_binaryauthorization_v1::model::GetAttestorRequest;
1865    /// let x = GetAttestorRequest::new().set_name("example");
1866    /// ```
1867    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1868        self.name = v.into();
1869        self
1870    }
1871}
1872
1873impl wkt::message::Message for GetAttestorRequest {
1874    fn typename() -> &'static str {
1875        "type.googleapis.com/google.cloud.binaryauthorization.v1.GetAttestorRequest"
1876    }
1877}
1878
1879/// Request message for [BinauthzManagementService.UpdateAttestor][].
1880#[derive(Clone, Default, PartialEq)]
1881#[non_exhaustive]
1882pub struct UpdateAttestorRequest {
1883    /// Required. The updated [attestor][google.cloud.binaryauthorization.v1.Attestor] value. The service will
1884    /// overwrite the [attestor name][google.cloud.binaryauthorization.v1.Attestor.name] field with the resource name
1885    /// in the request URL, in the format `projects/*/attestors/*`.
1886    ///
1887    /// [google.cloud.binaryauthorization.v1.Attestor]: crate::model::Attestor
1888    /// [google.cloud.binaryauthorization.v1.Attestor.name]: crate::model::Attestor::name
1889    pub attestor: std::option::Option<crate::model::Attestor>,
1890
1891    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1892}
1893
1894impl UpdateAttestorRequest {
1895    pub fn new() -> Self {
1896        std::default::Default::default()
1897    }
1898
1899    /// Sets the value of [attestor][crate::model::UpdateAttestorRequest::attestor].
1900    ///
1901    /// # Example
1902    /// ```ignore,no_run
1903    /// # use google_cloud_binaryauthorization_v1::model::UpdateAttestorRequest;
1904    /// use google_cloud_binaryauthorization_v1::model::Attestor;
1905    /// let x = UpdateAttestorRequest::new().set_attestor(Attestor::default()/* use setters */);
1906    /// ```
1907    pub fn set_attestor<T>(mut self, v: T) -> Self
1908    where
1909        T: std::convert::Into<crate::model::Attestor>,
1910    {
1911        self.attestor = std::option::Option::Some(v.into());
1912        self
1913    }
1914
1915    /// Sets or clears the value of [attestor][crate::model::UpdateAttestorRequest::attestor].
1916    ///
1917    /// # Example
1918    /// ```ignore,no_run
1919    /// # use google_cloud_binaryauthorization_v1::model::UpdateAttestorRequest;
1920    /// use google_cloud_binaryauthorization_v1::model::Attestor;
1921    /// let x = UpdateAttestorRequest::new().set_or_clear_attestor(Some(Attestor::default()/* use setters */));
1922    /// let x = UpdateAttestorRequest::new().set_or_clear_attestor(None::<Attestor>);
1923    /// ```
1924    pub fn set_or_clear_attestor<T>(mut self, v: std::option::Option<T>) -> Self
1925    where
1926        T: std::convert::Into<crate::model::Attestor>,
1927    {
1928        self.attestor = v.map(|x| x.into());
1929        self
1930    }
1931}
1932
1933impl wkt::message::Message for UpdateAttestorRequest {
1934    fn typename() -> &'static str {
1935        "type.googleapis.com/google.cloud.binaryauthorization.v1.UpdateAttestorRequest"
1936    }
1937}
1938
1939/// Request message for [BinauthzManagementService.ListAttestors][].
1940#[derive(Clone, Default, PartialEq)]
1941#[non_exhaustive]
1942pub struct ListAttestorsRequest {
1943    /// Required. The resource name of the project associated with the
1944    /// [attestors][google.cloud.binaryauthorization.v1.Attestor], in the format `projects/*`.
1945    ///
1946    /// [google.cloud.binaryauthorization.v1.Attestor]: crate::model::Attestor
1947    pub parent: std::string::String,
1948
1949    /// Requested page size. The server may return fewer results than requested. If
1950    /// unspecified, the server will pick an appropriate default.
1951    pub page_size: i32,
1952
1953    /// A token identifying a page of results the server should return. Typically,
1954    /// this is the value of [ListAttestorsResponse.next_page_token][google.cloud.binaryauthorization.v1.ListAttestorsResponse.next_page_token] returned
1955    /// from the previous call to the `ListAttestors` method.
1956    ///
1957    /// [google.cloud.binaryauthorization.v1.ListAttestorsResponse.next_page_token]: crate::model::ListAttestorsResponse::next_page_token
1958    pub page_token: std::string::String,
1959
1960    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1961}
1962
1963impl ListAttestorsRequest {
1964    pub fn new() -> Self {
1965        std::default::Default::default()
1966    }
1967
1968    /// Sets the value of [parent][crate::model::ListAttestorsRequest::parent].
1969    ///
1970    /// # Example
1971    /// ```ignore,no_run
1972    /// # use google_cloud_binaryauthorization_v1::model::ListAttestorsRequest;
1973    /// let x = ListAttestorsRequest::new().set_parent("example");
1974    /// ```
1975    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1976        self.parent = v.into();
1977        self
1978    }
1979
1980    /// Sets the value of [page_size][crate::model::ListAttestorsRequest::page_size].
1981    ///
1982    /// # Example
1983    /// ```ignore,no_run
1984    /// # use google_cloud_binaryauthorization_v1::model::ListAttestorsRequest;
1985    /// let x = ListAttestorsRequest::new().set_page_size(42);
1986    /// ```
1987    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1988        self.page_size = v.into();
1989        self
1990    }
1991
1992    /// Sets the value of [page_token][crate::model::ListAttestorsRequest::page_token].
1993    ///
1994    /// # Example
1995    /// ```ignore,no_run
1996    /// # use google_cloud_binaryauthorization_v1::model::ListAttestorsRequest;
1997    /// let x = ListAttestorsRequest::new().set_page_token("example");
1998    /// ```
1999    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2000        self.page_token = v.into();
2001        self
2002    }
2003}
2004
2005impl wkt::message::Message for ListAttestorsRequest {
2006    fn typename() -> &'static str {
2007        "type.googleapis.com/google.cloud.binaryauthorization.v1.ListAttestorsRequest"
2008    }
2009}
2010
2011/// Response message for [BinauthzManagementService.ListAttestors][].
2012#[derive(Clone, Default, PartialEq)]
2013#[non_exhaustive]
2014pub struct ListAttestorsResponse {
2015    /// The list of [attestors][google.cloud.binaryauthorization.v1.Attestor].
2016    ///
2017    /// [google.cloud.binaryauthorization.v1.Attestor]: crate::model::Attestor
2018    pub attestors: std::vec::Vec<crate::model::Attestor>,
2019
2020    /// A token to retrieve the next page of results. Pass this value in the
2021    /// [ListAttestorsRequest.page_token][google.cloud.binaryauthorization.v1.ListAttestorsRequest.page_token] field in the subsequent call to the
2022    /// `ListAttestors` method to retrieve the next page of results.
2023    ///
2024    /// [google.cloud.binaryauthorization.v1.ListAttestorsRequest.page_token]: crate::model::ListAttestorsRequest::page_token
2025    pub next_page_token: std::string::String,
2026
2027    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2028}
2029
2030impl ListAttestorsResponse {
2031    pub fn new() -> Self {
2032        std::default::Default::default()
2033    }
2034
2035    /// Sets the value of [attestors][crate::model::ListAttestorsResponse::attestors].
2036    ///
2037    /// # Example
2038    /// ```ignore,no_run
2039    /// # use google_cloud_binaryauthorization_v1::model::ListAttestorsResponse;
2040    /// use google_cloud_binaryauthorization_v1::model::Attestor;
2041    /// let x = ListAttestorsResponse::new()
2042    ///     .set_attestors([
2043    ///         Attestor::default()/* use setters */,
2044    ///         Attestor::default()/* use (different) setters */,
2045    ///     ]);
2046    /// ```
2047    pub fn set_attestors<T, V>(mut self, v: T) -> Self
2048    where
2049        T: std::iter::IntoIterator<Item = V>,
2050        V: std::convert::Into<crate::model::Attestor>,
2051    {
2052        use std::iter::Iterator;
2053        self.attestors = v.into_iter().map(|i| i.into()).collect();
2054        self
2055    }
2056
2057    /// Sets the value of [next_page_token][crate::model::ListAttestorsResponse::next_page_token].
2058    ///
2059    /// # Example
2060    /// ```ignore,no_run
2061    /// # use google_cloud_binaryauthorization_v1::model::ListAttestorsResponse;
2062    /// let x = ListAttestorsResponse::new().set_next_page_token("example");
2063    /// ```
2064    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2065        self.next_page_token = v.into();
2066        self
2067    }
2068}
2069
2070impl wkt::message::Message for ListAttestorsResponse {
2071    fn typename() -> &'static str {
2072        "type.googleapis.com/google.cloud.binaryauthorization.v1.ListAttestorsResponse"
2073    }
2074}
2075
2076#[doc(hidden)]
2077impl google_cloud_gax::paginator::internal::PageableResponse for ListAttestorsResponse {
2078    type PageItem = crate::model::Attestor;
2079
2080    fn items(self) -> std::vec::Vec<Self::PageItem> {
2081        self.attestors
2082    }
2083
2084    fn next_page_token(&self) -> std::string::String {
2085        use std::clone::Clone;
2086        self.next_page_token.clone()
2087    }
2088}
2089
2090/// Request message for [BinauthzManagementService.DeleteAttestor][].
2091#[derive(Clone, Default, PartialEq)]
2092#[non_exhaustive]
2093pub struct DeleteAttestorRequest {
2094    /// Required. The name of the [attestors][google.cloud.binaryauthorization.v1.Attestor] to delete, in the format
2095    /// `projects/*/attestors/*`.
2096    ///
2097    /// [google.cloud.binaryauthorization.v1.Attestor]: crate::model::Attestor
2098    pub name: std::string::String,
2099
2100    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2101}
2102
2103impl DeleteAttestorRequest {
2104    pub fn new() -> Self {
2105        std::default::Default::default()
2106    }
2107
2108    /// Sets the value of [name][crate::model::DeleteAttestorRequest::name].
2109    ///
2110    /// # Example
2111    /// ```ignore,no_run
2112    /// # use google_cloud_binaryauthorization_v1::model::DeleteAttestorRequest;
2113    /// let x = DeleteAttestorRequest::new().set_name("example");
2114    /// ```
2115    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2116        self.name = v.into();
2117        self
2118    }
2119}
2120
2121impl wkt::message::Message for DeleteAttestorRequest {
2122    fn typename() -> &'static str {
2123        "type.googleapis.com/google.cloud.binaryauthorization.v1.DeleteAttestorRequest"
2124    }
2125}
2126
2127/// Request to read the current system policy.
2128#[derive(Clone, Default, PartialEq)]
2129#[non_exhaustive]
2130pub struct GetSystemPolicyRequest {
2131    /// Required. The resource name, in the format `locations/*/policy`.
2132    /// Note that the system policy is not associated with a project.
2133    pub name: std::string::String,
2134
2135    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2136}
2137
2138impl GetSystemPolicyRequest {
2139    pub fn new() -> Self {
2140        std::default::Default::default()
2141    }
2142
2143    /// Sets the value of [name][crate::model::GetSystemPolicyRequest::name].
2144    ///
2145    /// # Example
2146    /// ```ignore,no_run
2147    /// # use google_cloud_binaryauthorization_v1::model::GetSystemPolicyRequest;
2148    /// let x = GetSystemPolicyRequest::new().set_name("example");
2149    /// ```
2150    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2151        self.name = v.into();
2152        self
2153    }
2154}
2155
2156impl wkt::message::Message for GetSystemPolicyRequest {
2157    fn typename() -> &'static str {
2158        "type.googleapis.com/google.cloud.binaryauthorization.v1.GetSystemPolicyRequest"
2159    }
2160}
2161
2162/// Request message for
2163/// [ValidationHelperV1.ValidateAttestationOccurrence][google.cloud.binaryauthorization.v1.ValidationHelperV1.ValidateAttestationOccurrence].
2164///
2165/// [google.cloud.binaryauthorization.v1.ValidationHelperV1.ValidateAttestationOccurrence]: crate::client::ValidationHelperV1::validate_attestation_occurrence
2166#[derive(Clone, Default, PartialEq)]
2167#[non_exhaustive]
2168pub struct ValidateAttestationOccurrenceRequest {
2169    /// Required. The resource name of the [Attestor][google.cloud.binaryauthorization.v1.Attestor] of the
2170    /// [occurrence][grafeas.v1.Occurrence], in the format
2171    /// `projects/*/attestors/*`.
2172    ///
2173    /// [google.cloud.binaryauthorization.v1.Attestor]: crate::model::Attestor
2174    pub attestor: std::string::String,
2175
2176    /// Required. An [AttestationOccurrence][grafeas.v1.AttestationOccurrence] to
2177    /// be checked that it can be verified by the Attestor. It does not have to be
2178    /// an existing entity in Container Analysis. It must otherwise be a valid
2179    /// AttestationOccurrence.
2180    ///
2181    /// [grafeas.v1.AttestationOccurrence]: google_cloud_grafeas_v1::model::AttestationOccurrence
2182    pub attestation: std::option::Option<google_cloud_grafeas_v1::model::AttestationOccurrence>,
2183
2184    /// Required. The resource name of the [Note][grafeas.v1.Note] to which the
2185    /// containing [Occurrence][grafeas.v1.Occurrence] is associated.
2186    pub occurrence_note: std::string::String,
2187
2188    /// Required. The URI of the artifact (e.g. container image) that is the
2189    /// subject of the containing [Occurrence][grafeas.v1.Occurrence].
2190    pub occurrence_resource_uri: std::string::String,
2191
2192    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2193}
2194
2195impl ValidateAttestationOccurrenceRequest {
2196    pub fn new() -> Self {
2197        std::default::Default::default()
2198    }
2199
2200    /// Sets the value of [attestor][crate::model::ValidateAttestationOccurrenceRequest::attestor].
2201    ///
2202    /// # Example
2203    /// ```ignore,no_run
2204    /// # use google_cloud_binaryauthorization_v1::model::ValidateAttestationOccurrenceRequest;
2205    /// let x = ValidateAttestationOccurrenceRequest::new().set_attestor("example");
2206    /// ```
2207    pub fn set_attestor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2208        self.attestor = v.into();
2209        self
2210    }
2211
2212    /// Sets the value of [attestation][crate::model::ValidateAttestationOccurrenceRequest::attestation].
2213    ///
2214    /// # Example
2215    /// ```ignore,no_run
2216    /// # use google_cloud_binaryauthorization_v1::model::ValidateAttestationOccurrenceRequest;
2217    /// use google_cloud_grafeas_v1::model::AttestationOccurrence;
2218    /// let x = ValidateAttestationOccurrenceRequest::new().set_attestation(AttestationOccurrence::default()/* use setters */);
2219    /// ```
2220    pub fn set_attestation<T>(mut self, v: T) -> Self
2221    where
2222        T: std::convert::Into<google_cloud_grafeas_v1::model::AttestationOccurrence>,
2223    {
2224        self.attestation = std::option::Option::Some(v.into());
2225        self
2226    }
2227
2228    /// Sets or clears the value of [attestation][crate::model::ValidateAttestationOccurrenceRequest::attestation].
2229    ///
2230    /// # Example
2231    /// ```ignore,no_run
2232    /// # use google_cloud_binaryauthorization_v1::model::ValidateAttestationOccurrenceRequest;
2233    /// use google_cloud_grafeas_v1::model::AttestationOccurrence;
2234    /// let x = ValidateAttestationOccurrenceRequest::new().set_or_clear_attestation(Some(AttestationOccurrence::default()/* use setters */));
2235    /// let x = ValidateAttestationOccurrenceRequest::new().set_or_clear_attestation(None::<AttestationOccurrence>);
2236    /// ```
2237    pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
2238    where
2239        T: std::convert::Into<google_cloud_grafeas_v1::model::AttestationOccurrence>,
2240    {
2241        self.attestation = v.map(|x| x.into());
2242        self
2243    }
2244
2245    /// Sets the value of [occurrence_note][crate::model::ValidateAttestationOccurrenceRequest::occurrence_note].
2246    ///
2247    /// # Example
2248    /// ```ignore,no_run
2249    /// # use google_cloud_binaryauthorization_v1::model::ValidateAttestationOccurrenceRequest;
2250    /// let x = ValidateAttestationOccurrenceRequest::new().set_occurrence_note("example");
2251    /// ```
2252    pub fn set_occurrence_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2253        self.occurrence_note = v.into();
2254        self
2255    }
2256
2257    /// Sets the value of [occurrence_resource_uri][crate::model::ValidateAttestationOccurrenceRequest::occurrence_resource_uri].
2258    ///
2259    /// # Example
2260    /// ```ignore,no_run
2261    /// # use google_cloud_binaryauthorization_v1::model::ValidateAttestationOccurrenceRequest;
2262    /// let x = ValidateAttestationOccurrenceRequest::new().set_occurrence_resource_uri("example");
2263    /// ```
2264    pub fn set_occurrence_resource_uri<T: std::convert::Into<std::string::String>>(
2265        mut self,
2266        v: T,
2267    ) -> Self {
2268        self.occurrence_resource_uri = v.into();
2269        self
2270    }
2271}
2272
2273impl wkt::message::Message for ValidateAttestationOccurrenceRequest {
2274    fn typename() -> &'static str {
2275        "type.googleapis.com/google.cloud.binaryauthorization.v1.ValidateAttestationOccurrenceRequest"
2276    }
2277}
2278
2279/// Response message for
2280/// [ValidationHelperV1.ValidateAttestationOccurrence][google.cloud.binaryauthorization.v1.ValidationHelperV1.ValidateAttestationOccurrence].
2281///
2282/// [google.cloud.binaryauthorization.v1.ValidationHelperV1.ValidateAttestationOccurrence]: crate::client::ValidationHelperV1::validate_attestation_occurrence
2283#[derive(Clone, Default, PartialEq)]
2284#[non_exhaustive]
2285pub struct ValidateAttestationOccurrenceResponse {
2286    /// The result of the Attestation validation.
2287    pub result: crate::model::validate_attestation_occurrence_response::Result,
2288
2289    /// The reason for denial if the Attestation couldn't be validated.
2290    pub denial_reason: std::string::String,
2291
2292    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2293}
2294
2295impl ValidateAttestationOccurrenceResponse {
2296    pub fn new() -> Self {
2297        std::default::Default::default()
2298    }
2299
2300    /// Sets the value of [result][crate::model::ValidateAttestationOccurrenceResponse::result].
2301    ///
2302    /// # Example
2303    /// ```ignore,no_run
2304    /// # use google_cloud_binaryauthorization_v1::model::ValidateAttestationOccurrenceResponse;
2305    /// use google_cloud_binaryauthorization_v1::model::validate_attestation_occurrence_response::Result;
2306    /// let x0 = ValidateAttestationOccurrenceResponse::new().set_result(Result::Verified);
2307    /// let x1 = ValidateAttestationOccurrenceResponse::new().set_result(Result::AttestationNotVerifiable);
2308    /// ```
2309    pub fn set_result<
2310        T: std::convert::Into<crate::model::validate_attestation_occurrence_response::Result>,
2311    >(
2312        mut self,
2313        v: T,
2314    ) -> Self {
2315        self.result = v.into();
2316        self
2317    }
2318
2319    /// Sets the value of [denial_reason][crate::model::ValidateAttestationOccurrenceResponse::denial_reason].
2320    ///
2321    /// # Example
2322    /// ```ignore,no_run
2323    /// # use google_cloud_binaryauthorization_v1::model::ValidateAttestationOccurrenceResponse;
2324    /// let x = ValidateAttestationOccurrenceResponse::new().set_denial_reason("example");
2325    /// ```
2326    pub fn set_denial_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2327        self.denial_reason = v.into();
2328        self
2329    }
2330}
2331
2332impl wkt::message::Message for ValidateAttestationOccurrenceResponse {
2333    fn typename() -> &'static str {
2334        "type.googleapis.com/google.cloud.binaryauthorization.v1.ValidateAttestationOccurrenceResponse"
2335    }
2336}
2337
2338/// Defines additional types related to [ValidateAttestationOccurrenceResponse].
2339pub mod validate_attestation_occurrence_response {
2340    #[allow(unused_imports)]
2341    use super::*;
2342
2343    /// The enum returned in the "result" field.
2344    ///
2345    /// # Working with unknown values
2346    ///
2347    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2348    /// additional enum variants at any time. Adding new variants is not considered
2349    /// a breaking change. Applications should write their code in anticipation of:
2350    ///
2351    /// - New values appearing in future releases of the client library, **and**
2352    /// - New values received dynamically, without application changes.
2353    ///
2354    /// Please consult the [Working with enums] section in the user guide for some
2355    /// guidelines.
2356    ///
2357    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2358    #[derive(Clone, Debug, PartialEq)]
2359    #[non_exhaustive]
2360    pub enum Result {
2361        /// Unspecified.
2362        Unspecified,
2363        /// The Attestation was able to verified by the Attestor.
2364        Verified,
2365        /// The Attestation was not able to verified by the Attestor.
2366        AttestationNotVerifiable,
2367        /// If set, the enum was initialized with an unknown value.
2368        ///
2369        /// Applications can examine the value using [Result::value] or
2370        /// [Result::name].
2371        UnknownValue(result::UnknownValue),
2372    }
2373
2374    #[doc(hidden)]
2375    pub mod result {
2376        #[allow(unused_imports)]
2377        use super::*;
2378        #[derive(Clone, Debug, PartialEq)]
2379        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2380    }
2381
2382    impl Result {
2383        /// Gets the enum value.
2384        ///
2385        /// Returns `None` if the enum contains an unknown value deserialized from
2386        /// the string representation of enums.
2387        pub fn value(&self) -> std::option::Option<i32> {
2388            match self {
2389                Self::Unspecified => std::option::Option::Some(0),
2390                Self::Verified => std::option::Option::Some(1),
2391                Self::AttestationNotVerifiable => std::option::Option::Some(2),
2392                Self::UnknownValue(u) => u.0.value(),
2393            }
2394        }
2395
2396        /// Gets the enum value as a string.
2397        ///
2398        /// Returns `None` if the enum contains an unknown value deserialized from
2399        /// the integer representation of enums.
2400        pub fn name(&self) -> std::option::Option<&str> {
2401            match self {
2402                Self::Unspecified => std::option::Option::Some("RESULT_UNSPECIFIED"),
2403                Self::Verified => std::option::Option::Some("VERIFIED"),
2404                Self::AttestationNotVerifiable => {
2405                    std::option::Option::Some("ATTESTATION_NOT_VERIFIABLE")
2406                }
2407                Self::UnknownValue(u) => u.0.name(),
2408            }
2409        }
2410    }
2411
2412    impl std::default::Default for Result {
2413        fn default() -> Self {
2414            use std::convert::From;
2415            Self::from(0)
2416        }
2417    }
2418
2419    impl std::fmt::Display for Result {
2420        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2421            wkt::internal::display_enum(f, self.name(), self.value())
2422        }
2423    }
2424
2425    impl std::convert::From<i32> for Result {
2426        fn from(value: i32) -> Self {
2427            match value {
2428                0 => Self::Unspecified,
2429                1 => Self::Verified,
2430                2 => Self::AttestationNotVerifiable,
2431                _ => Self::UnknownValue(result::UnknownValue(
2432                    wkt::internal::UnknownEnumValue::Integer(value),
2433                )),
2434            }
2435        }
2436    }
2437
2438    impl std::convert::From<&str> for Result {
2439        fn from(value: &str) -> Self {
2440            use std::string::ToString;
2441            match value {
2442                "RESULT_UNSPECIFIED" => Self::Unspecified,
2443                "VERIFIED" => Self::Verified,
2444                "ATTESTATION_NOT_VERIFIABLE" => Self::AttestationNotVerifiable,
2445                _ => Self::UnknownValue(result::UnknownValue(
2446                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2447                )),
2448            }
2449        }
2450    }
2451
2452    impl serde::ser::Serialize for Result {
2453        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2454        where
2455            S: serde::Serializer,
2456        {
2457            match self {
2458                Self::Unspecified => serializer.serialize_i32(0),
2459                Self::Verified => serializer.serialize_i32(1),
2460                Self::AttestationNotVerifiable => serializer.serialize_i32(2),
2461                Self::UnknownValue(u) => u.0.serialize(serializer),
2462            }
2463        }
2464    }
2465
2466    impl<'de> serde::de::Deserialize<'de> for Result {
2467        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2468        where
2469            D: serde::Deserializer<'de>,
2470        {
2471            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Result>::new(
2472                ".google.cloud.binaryauthorization.v1.ValidateAttestationOccurrenceResponse.Result",
2473            ))
2474        }
2475    }
2476}