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