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