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