1#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate grafeas;
25extern crate lazy_static;
26extern crate reqwest;
27extern crate serde;
28extern crate serde_json;
29extern crate serde_with;
30extern crate std;
31extern crate tracing;
32extern crate wkt;
33
34mod debug;
35mod deserialize;
36mod serialize;
37
38#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct Policy {
44 pub name: std::string::String,
47
48 pub description: std::string::String,
50
51 pub global_policy_evaluation_mode: crate::model::policy::GlobalPolicyEvaluationMode,
56
57 pub admission_whitelist_patterns: std::vec::Vec<crate::model::AdmissionWhitelistPattern>,
61
62 pub cluster_admission_rules:
70 std::collections::HashMap<std::string::String, crate::model::AdmissionRule>,
71
72 pub kubernetes_namespace_admission_rules:
75 std::collections::HashMap<std::string::String, crate::model::AdmissionRule>,
76
77 pub kubernetes_service_account_admission_rules:
80 std::collections::HashMap<std::string::String, crate::model::AdmissionRule>,
81
82 pub istio_service_identity_admission_rules:
88 std::collections::HashMap<std::string::String, crate::model::AdmissionRule>,
89
90 pub default_admission_rule: std::option::Option<crate::model::AdmissionRule>,
93
94 pub update_time: std::option::Option<wkt::Timestamp>,
96
97 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
98}
99
100impl Policy {
101 pub fn new() -> Self {
102 std::default::Default::default()
103 }
104
105 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
107 self.name = v.into();
108 self
109 }
110
111 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
113 self.description = v.into();
114 self
115 }
116
117 pub fn set_global_policy_evaluation_mode<
119 T: std::convert::Into<crate::model::policy::GlobalPolicyEvaluationMode>,
120 >(
121 mut self,
122 v: T,
123 ) -> Self {
124 self.global_policy_evaluation_mode = v.into();
125 self
126 }
127
128 pub fn set_admission_whitelist_patterns<T, V>(mut self, v: T) -> Self
130 where
131 T: std::iter::IntoIterator<Item = V>,
132 V: std::convert::Into<crate::model::AdmissionWhitelistPattern>,
133 {
134 use std::iter::Iterator;
135 self.admission_whitelist_patterns = v.into_iter().map(|i| i.into()).collect();
136 self
137 }
138
139 pub fn set_cluster_admission_rules<T, K, V>(mut self, v: T) -> Self
141 where
142 T: std::iter::IntoIterator<Item = (K, V)>,
143 K: std::convert::Into<std::string::String>,
144 V: std::convert::Into<crate::model::AdmissionRule>,
145 {
146 use std::iter::Iterator;
147 self.cluster_admission_rules = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
148 self
149 }
150
151 pub fn set_kubernetes_namespace_admission_rules<T, K, V>(mut self, v: T) -> Self
153 where
154 T: std::iter::IntoIterator<Item = (K, V)>,
155 K: std::convert::Into<std::string::String>,
156 V: std::convert::Into<crate::model::AdmissionRule>,
157 {
158 use std::iter::Iterator;
159 self.kubernetes_namespace_admission_rules =
160 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
161 self
162 }
163
164 pub fn set_kubernetes_service_account_admission_rules<T, K, V>(mut self, v: T) -> Self
166 where
167 T: std::iter::IntoIterator<Item = (K, V)>,
168 K: std::convert::Into<std::string::String>,
169 V: std::convert::Into<crate::model::AdmissionRule>,
170 {
171 use std::iter::Iterator;
172 self.kubernetes_service_account_admission_rules =
173 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
174 self
175 }
176
177 pub fn set_istio_service_identity_admission_rules<T, K, V>(mut self, v: T) -> Self
179 where
180 T: std::iter::IntoIterator<Item = (K, V)>,
181 K: std::convert::Into<std::string::String>,
182 V: std::convert::Into<crate::model::AdmissionRule>,
183 {
184 use std::iter::Iterator;
185 self.istio_service_identity_admission_rules =
186 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
187 self
188 }
189
190 pub fn set_default_admission_rule<T>(mut self, v: T) -> Self
192 where
193 T: std::convert::Into<crate::model::AdmissionRule>,
194 {
195 self.default_admission_rule = std::option::Option::Some(v.into());
196 self
197 }
198
199 pub fn set_or_clear_default_admission_rule<T>(mut self, v: std::option::Option<T>) -> Self
201 where
202 T: std::convert::Into<crate::model::AdmissionRule>,
203 {
204 self.default_admission_rule = v.map(|x| x.into());
205 self
206 }
207
208 pub fn set_update_time<T>(mut self, v: T) -> Self
210 where
211 T: std::convert::Into<wkt::Timestamp>,
212 {
213 self.update_time = std::option::Option::Some(v.into());
214 self
215 }
216
217 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
219 where
220 T: std::convert::Into<wkt::Timestamp>,
221 {
222 self.update_time = v.map(|x| x.into());
223 self
224 }
225}
226
227impl wkt::message::Message for Policy {
228 fn typename() -> &'static str {
229 "type.googleapis.com/google.cloud.binaryauthorization.v1.Policy"
230 }
231}
232
233pub mod policy {
235 #[allow(unused_imports)]
236 use super::*;
237
238 #[derive(Clone, Debug, PartialEq)]
253 #[non_exhaustive]
254 pub enum GlobalPolicyEvaluationMode {
255 Unspecified,
257 Enable,
259 Disable,
261 UnknownValue(global_policy_evaluation_mode::UnknownValue),
266 }
267
268 #[doc(hidden)]
269 pub mod global_policy_evaluation_mode {
270 #[allow(unused_imports)]
271 use super::*;
272 #[derive(Clone, Debug, PartialEq)]
273 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
274 }
275
276 impl GlobalPolicyEvaluationMode {
277 pub fn value(&self) -> std::option::Option<i32> {
282 match self {
283 Self::Unspecified => std::option::Option::Some(0),
284 Self::Enable => std::option::Option::Some(1),
285 Self::Disable => std::option::Option::Some(2),
286 Self::UnknownValue(u) => u.0.value(),
287 }
288 }
289
290 pub fn name(&self) -> std::option::Option<&str> {
295 match self {
296 Self::Unspecified => {
297 std::option::Option::Some("GLOBAL_POLICY_EVALUATION_MODE_UNSPECIFIED")
298 }
299 Self::Enable => std::option::Option::Some("ENABLE"),
300 Self::Disable => std::option::Option::Some("DISABLE"),
301 Self::UnknownValue(u) => u.0.name(),
302 }
303 }
304 }
305
306 impl std::default::Default for GlobalPolicyEvaluationMode {
307 fn default() -> Self {
308 use std::convert::From;
309 Self::from(0)
310 }
311 }
312
313 impl std::fmt::Display for GlobalPolicyEvaluationMode {
314 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
315 wkt::internal::display_enum(f, self.name(), self.value())
316 }
317 }
318
319 impl std::convert::From<i32> for GlobalPolicyEvaluationMode {
320 fn from(value: i32) -> Self {
321 match value {
322 0 => Self::Unspecified,
323 1 => Self::Enable,
324 2 => Self::Disable,
325 _ => Self::UnknownValue(global_policy_evaluation_mode::UnknownValue(
326 wkt::internal::UnknownEnumValue::Integer(value),
327 )),
328 }
329 }
330 }
331
332 impl std::convert::From<&str> for GlobalPolicyEvaluationMode {
333 fn from(value: &str) -> Self {
334 use std::string::ToString;
335 match value {
336 "GLOBAL_POLICY_EVALUATION_MODE_UNSPECIFIED" => Self::Unspecified,
337 "ENABLE" => Self::Enable,
338 "DISABLE" => Self::Disable,
339 _ => Self::UnknownValue(global_policy_evaluation_mode::UnknownValue(
340 wkt::internal::UnknownEnumValue::String(value.to_string()),
341 )),
342 }
343 }
344 }
345
346 impl serde::ser::Serialize for GlobalPolicyEvaluationMode {
347 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
348 where
349 S: serde::Serializer,
350 {
351 match self {
352 Self::Unspecified => serializer.serialize_i32(0),
353 Self::Enable => serializer.serialize_i32(1),
354 Self::Disable => serializer.serialize_i32(2),
355 Self::UnknownValue(u) => u.0.serialize(serializer),
356 }
357 }
358 }
359
360 impl<'de> serde::de::Deserialize<'de> for GlobalPolicyEvaluationMode {
361 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
362 where
363 D: serde::Deserializer<'de>,
364 {
365 deserializer.deserialize_any(
366 wkt::internal::EnumVisitor::<GlobalPolicyEvaluationMode>::new(
367 ".google.cloud.binaryauthorization.v1.Policy.GlobalPolicyEvaluationMode",
368 ),
369 )
370 }
371 }
372}
373
374#[derive(Clone, Default, PartialEq)]
380#[non_exhaustive]
381pub struct AdmissionWhitelistPattern {
382 pub name_pattern: std::string::String,
387
388 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
389}
390
391impl AdmissionWhitelistPattern {
392 pub fn new() -> Self {
393 std::default::Default::default()
394 }
395
396 pub fn set_name_pattern<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
398 self.name_pattern = v.into();
399 self
400 }
401}
402
403impl wkt::message::Message for AdmissionWhitelistPattern {
404 fn typename() -> &'static str {
405 "type.googleapis.com/google.cloud.binaryauthorization.v1.AdmissionWhitelistPattern"
406 }
407}
408
409#[derive(Clone, Default, PartialEq)]
421#[non_exhaustive]
422pub struct AdmissionRule {
423 pub evaluation_mode: crate::model::admission_rule::EvaluationMode,
425
426 pub require_attestations_by: std::vec::Vec<std::string::String>,
435
436 pub enforcement_mode: crate::model::admission_rule::EnforcementMode,
438
439 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
440}
441
442impl AdmissionRule {
443 pub fn new() -> Self {
444 std::default::Default::default()
445 }
446
447 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 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 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
487pub mod admission_rule {
489 #[allow(unused_imports)]
490 use super::*;
491
492 #[derive(Clone, Debug, PartialEq)]
507 #[non_exhaustive]
508 pub enum EvaluationMode {
509 Unspecified,
511 AlwaysAllow,
513 RequireAttestation,
517 AlwaysDeny,
519 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 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 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 #[derive(Clone, Debug, PartialEq)]
649 #[non_exhaustive]
650 pub enum EnforcementMode {
651 Unspecified,
653 EnforcedBlockAndAuditLog,
655 DryrunAuditLogOnly,
658 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 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 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#[derive(Clone, Default, PartialEq)]
775#[non_exhaustive]
776pub struct Attestor {
777 pub name: std::string::String,
780
781 pub description: std::string::String,
784
785 pub update_time: std::option::Option<wkt::Timestamp>,
787
788 pub attestor_type: std::option::Option<crate::model::attestor::AttestorType>,
789
790 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
791}
792
793impl Attestor {
794 pub fn new() -> Self {
795 std::default::Default::default()
796 }
797
798 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
800 self.name = v.into();
801 self
802 }
803
804 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
806 self.description = v.into();
807 self
808 }
809
810 pub fn set_update_time<T>(mut self, v: T) -> Self
812 where
813 T: std::convert::Into<wkt::Timestamp>,
814 {
815 self.update_time = std::option::Option::Some(v.into());
816 self
817 }
818
819 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
821 where
822 T: std::convert::Into<wkt::Timestamp>,
823 {
824 self.update_time = v.map(|x| x.into());
825 self
826 }
827
828 pub fn set_attestor_type<
833 T: std::convert::Into<std::option::Option<crate::model::attestor::AttestorType>>,
834 >(
835 mut self,
836 v: T,
837 ) -> Self {
838 self.attestor_type = v.into();
839 self
840 }
841
842 pub fn user_owned_grafeas_note(
846 &self,
847 ) -> std::option::Option<&std::boxed::Box<crate::model::UserOwnedGrafeasNote>> {
848 #[allow(unreachable_patterns)]
849 self.attestor_type.as_ref().and_then(|v| match v {
850 crate::model::attestor::AttestorType::UserOwnedGrafeasNote(v) => {
851 std::option::Option::Some(v)
852 }
853 _ => std::option::Option::None,
854 })
855 }
856
857 pub fn set_user_owned_grafeas_note<
863 T: std::convert::Into<std::boxed::Box<crate::model::UserOwnedGrafeasNote>>,
864 >(
865 mut self,
866 v: T,
867 ) -> Self {
868 self.attestor_type = std::option::Option::Some(
869 crate::model::attestor::AttestorType::UserOwnedGrafeasNote(v.into()),
870 );
871 self
872 }
873}
874
875impl wkt::message::Message for Attestor {
876 fn typename() -> &'static str {
877 "type.googleapis.com/google.cloud.binaryauthorization.v1.Attestor"
878 }
879}
880
881pub mod attestor {
883 #[allow(unused_imports)]
884 use super::*;
885
886 #[derive(Clone, Debug, PartialEq)]
887 #[non_exhaustive]
888 pub enum AttestorType {
889 UserOwnedGrafeasNote(std::boxed::Box<crate::model::UserOwnedGrafeasNote>),
892 }
893}
894
895#[derive(Clone, Default, PartialEq)]
900#[non_exhaustive]
901pub struct UserOwnedGrafeasNote {
902 pub note_reference: std::string::String,
910
911 pub public_keys: std::vec::Vec<crate::model::AttestorPublicKey>,
921
922 pub delegation_service_account_email: std::string::String,
932
933 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
934}
935
936impl UserOwnedGrafeasNote {
937 pub fn new() -> Self {
938 std::default::Default::default()
939 }
940
941 pub fn set_note_reference<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
943 self.note_reference = v.into();
944 self
945 }
946
947 pub fn set_public_keys<T, V>(mut self, v: T) -> Self
949 where
950 T: std::iter::IntoIterator<Item = V>,
951 V: std::convert::Into<crate::model::AttestorPublicKey>,
952 {
953 use std::iter::Iterator;
954 self.public_keys = v.into_iter().map(|i| i.into()).collect();
955 self
956 }
957
958 pub fn set_delegation_service_account_email<T: std::convert::Into<std::string::String>>(
960 mut self,
961 v: T,
962 ) -> Self {
963 self.delegation_service_account_email = v.into();
964 self
965 }
966}
967
968impl wkt::message::Message for UserOwnedGrafeasNote {
969 fn typename() -> &'static str {
970 "type.googleapis.com/google.cloud.binaryauthorization.v1.UserOwnedGrafeasNote"
971 }
972}
973
974#[derive(Clone, Default, PartialEq)]
979#[non_exhaustive]
980pub struct PkixPublicKey {
981 pub public_key_pem: std::string::String,
984
985 pub signature_algorithm: crate::model::pkix_public_key::SignatureAlgorithm,
991
992 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
993}
994
995impl PkixPublicKey {
996 pub fn new() -> Self {
997 std::default::Default::default()
998 }
999
1000 pub fn set_public_key_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1002 self.public_key_pem = v.into();
1003 self
1004 }
1005
1006 pub fn set_signature_algorithm<
1008 T: std::convert::Into<crate::model::pkix_public_key::SignatureAlgorithm>,
1009 >(
1010 mut self,
1011 v: T,
1012 ) -> Self {
1013 self.signature_algorithm = v.into();
1014 self
1015 }
1016}
1017
1018impl wkt::message::Message for PkixPublicKey {
1019 fn typename() -> &'static str {
1020 "type.googleapis.com/google.cloud.binaryauthorization.v1.PkixPublicKey"
1021 }
1022}
1023
1024pub mod pkix_public_key {
1026 #[allow(unused_imports)]
1027 use super::*;
1028
1029 #[derive(Clone, Debug, PartialEq)]
1050 #[non_exhaustive]
1051 pub enum SignatureAlgorithm {
1052 Unspecified,
1054 RsaPss2048Sha256,
1056 RsaPss3072Sha256,
1058 RsaPss4096Sha256,
1060 RsaPss4096Sha512,
1062 RsaSignPkcs12048Sha256,
1064 RsaSignPkcs13072Sha256,
1066 RsaSignPkcs14096Sha256,
1068 RsaSignPkcs14096Sha512,
1070 EcdsaP256Sha256,
1072 EcSignP256Sha256,
1074 EcdsaP384Sha384,
1076 EcSignP384Sha384,
1078 EcdsaP521Sha512,
1080 EcSignP521Sha512,
1082 UnknownValue(signature_algorithm::UnknownValue),
1087 }
1088
1089 #[doc(hidden)]
1090 pub mod signature_algorithm {
1091 #[allow(unused_imports)]
1092 use super::*;
1093 #[derive(Clone, Debug, PartialEq)]
1094 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1095 }
1096
1097 impl SignatureAlgorithm {
1098 pub fn value(&self) -> std::option::Option<i32> {
1103 match self {
1104 Self::Unspecified => std::option::Option::Some(0),
1105 Self::RsaPss2048Sha256 => std::option::Option::Some(1),
1106 Self::RsaPss3072Sha256 => std::option::Option::Some(2),
1107 Self::RsaPss4096Sha256 => std::option::Option::Some(3),
1108 Self::RsaPss4096Sha512 => std::option::Option::Some(4),
1109 Self::RsaSignPkcs12048Sha256 => std::option::Option::Some(5),
1110 Self::RsaSignPkcs13072Sha256 => std::option::Option::Some(6),
1111 Self::RsaSignPkcs14096Sha256 => std::option::Option::Some(7),
1112 Self::RsaSignPkcs14096Sha512 => std::option::Option::Some(8),
1113 Self::EcdsaP256Sha256 => std::option::Option::Some(9),
1114 Self::EcSignP256Sha256 => std::option::Option::Some(9),
1115 Self::EcdsaP384Sha384 => std::option::Option::Some(10),
1116 Self::EcSignP384Sha384 => std::option::Option::Some(10),
1117 Self::EcdsaP521Sha512 => std::option::Option::Some(11),
1118 Self::EcSignP521Sha512 => std::option::Option::Some(11),
1119 Self::UnknownValue(u) => u.0.value(),
1120 }
1121 }
1122
1123 pub fn name(&self) -> std::option::Option<&str> {
1128 match self {
1129 Self::Unspecified => std::option::Option::Some("SIGNATURE_ALGORITHM_UNSPECIFIED"),
1130 Self::RsaPss2048Sha256 => std::option::Option::Some("RSA_PSS_2048_SHA256"),
1131 Self::RsaPss3072Sha256 => std::option::Option::Some("RSA_PSS_3072_SHA256"),
1132 Self::RsaPss4096Sha256 => std::option::Option::Some("RSA_PSS_4096_SHA256"),
1133 Self::RsaPss4096Sha512 => std::option::Option::Some("RSA_PSS_4096_SHA512"),
1134 Self::RsaSignPkcs12048Sha256 => {
1135 std::option::Option::Some("RSA_SIGN_PKCS1_2048_SHA256")
1136 }
1137 Self::RsaSignPkcs13072Sha256 => {
1138 std::option::Option::Some("RSA_SIGN_PKCS1_3072_SHA256")
1139 }
1140 Self::RsaSignPkcs14096Sha256 => {
1141 std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA256")
1142 }
1143 Self::RsaSignPkcs14096Sha512 => {
1144 std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA512")
1145 }
1146 Self::EcdsaP256Sha256 => std::option::Option::Some("ECDSA_P256_SHA256"),
1147 Self::EcSignP256Sha256 => std::option::Option::Some("EC_SIGN_P256_SHA256"),
1148 Self::EcdsaP384Sha384 => std::option::Option::Some("ECDSA_P384_SHA384"),
1149 Self::EcSignP384Sha384 => std::option::Option::Some("EC_SIGN_P384_SHA384"),
1150 Self::EcdsaP521Sha512 => std::option::Option::Some("ECDSA_P521_SHA512"),
1151 Self::EcSignP521Sha512 => std::option::Option::Some("EC_SIGN_P521_SHA512"),
1152 Self::UnknownValue(u) => u.0.name(),
1153 }
1154 }
1155 }
1156
1157 impl std::default::Default for SignatureAlgorithm {
1158 fn default() -> Self {
1159 use std::convert::From;
1160 Self::from(0)
1161 }
1162 }
1163
1164 impl std::fmt::Display for SignatureAlgorithm {
1165 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1166 wkt::internal::display_enum(f, self.name(), self.value())
1167 }
1168 }
1169
1170 impl std::convert::From<i32> for SignatureAlgorithm {
1171 fn from(value: i32) -> Self {
1172 match value {
1173 0 => Self::Unspecified,
1174 1 => Self::RsaPss2048Sha256,
1175 2 => Self::RsaPss3072Sha256,
1176 3 => Self::RsaPss4096Sha256,
1177 4 => Self::RsaPss4096Sha512,
1178 5 => Self::RsaSignPkcs12048Sha256,
1179 6 => Self::RsaSignPkcs13072Sha256,
1180 7 => Self::RsaSignPkcs14096Sha256,
1181 8 => Self::RsaSignPkcs14096Sha512,
1182 9 => Self::EcdsaP256Sha256,
1183 10 => Self::EcdsaP384Sha384,
1184 11 => Self::EcdsaP521Sha512,
1185 _ => Self::UnknownValue(signature_algorithm::UnknownValue(
1186 wkt::internal::UnknownEnumValue::Integer(value),
1187 )),
1188 }
1189 }
1190 }
1191
1192 impl std::convert::From<&str> for SignatureAlgorithm {
1193 fn from(value: &str) -> Self {
1194 use std::string::ToString;
1195 match value {
1196 "SIGNATURE_ALGORITHM_UNSPECIFIED" => Self::Unspecified,
1197 "RSA_PSS_2048_SHA256" => Self::RsaPss2048Sha256,
1198 "RSA_PSS_3072_SHA256" => Self::RsaPss3072Sha256,
1199 "RSA_PSS_4096_SHA256" => Self::RsaPss4096Sha256,
1200 "RSA_PSS_4096_SHA512" => Self::RsaPss4096Sha512,
1201 "RSA_SIGN_PKCS1_2048_SHA256" => Self::RsaSignPkcs12048Sha256,
1202 "RSA_SIGN_PKCS1_3072_SHA256" => Self::RsaSignPkcs13072Sha256,
1203 "RSA_SIGN_PKCS1_4096_SHA256" => Self::RsaSignPkcs14096Sha256,
1204 "RSA_SIGN_PKCS1_4096_SHA512" => Self::RsaSignPkcs14096Sha512,
1205 "ECDSA_P256_SHA256" => Self::EcdsaP256Sha256,
1206 "EC_SIGN_P256_SHA256" => Self::EcSignP256Sha256,
1207 "ECDSA_P384_SHA384" => Self::EcdsaP384Sha384,
1208 "EC_SIGN_P384_SHA384" => Self::EcSignP384Sha384,
1209 "ECDSA_P521_SHA512" => Self::EcdsaP521Sha512,
1210 "EC_SIGN_P521_SHA512" => Self::EcSignP521Sha512,
1211 _ => Self::UnknownValue(signature_algorithm::UnknownValue(
1212 wkt::internal::UnknownEnumValue::String(value.to_string()),
1213 )),
1214 }
1215 }
1216 }
1217
1218 impl serde::ser::Serialize for SignatureAlgorithm {
1219 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1220 where
1221 S: serde::Serializer,
1222 {
1223 match self {
1224 Self::Unspecified => serializer.serialize_i32(0),
1225 Self::RsaPss2048Sha256 => serializer.serialize_i32(1),
1226 Self::RsaPss3072Sha256 => serializer.serialize_i32(2),
1227 Self::RsaPss4096Sha256 => serializer.serialize_i32(3),
1228 Self::RsaPss4096Sha512 => serializer.serialize_i32(4),
1229 Self::RsaSignPkcs12048Sha256 => serializer.serialize_i32(5),
1230 Self::RsaSignPkcs13072Sha256 => serializer.serialize_i32(6),
1231 Self::RsaSignPkcs14096Sha256 => serializer.serialize_i32(7),
1232 Self::RsaSignPkcs14096Sha512 => serializer.serialize_i32(8),
1233 Self::EcdsaP256Sha256 => serializer.serialize_i32(9),
1234 Self::EcSignP256Sha256 => serializer.serialize_i32(9),
1235 Self::EcdsaP384Sha384 => serializer.serialize_i32(10),
1236 Self::EcSignP384Sha384 => serializer.serialize_i32(10),
1237 Self::EcdsaP521Sha512 => serializer.serialize_i32(11),
1238 Self::EcSignP521Sha512 => serializer.serialize_i32(11),
1239 Self::UnknownValue(u) => u.0.serialize(serializer),
1240 }
1241 }
1242 }
1243
1244 impl<'de> serde::de::Deserialize<'de> for SignatureAlgorithm {
1245 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1246 where
1247 D: serde::Deserializer<'de>,
1248 {
1249 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SignatureAlgorithm>::new(
1250 ".google.cloud.binaryauthorization.v1.PkixPublicKey.SignatureAlgorithm",
1251 ))
1252 }
1253 }
1254}
1255
1256#[derive(Clone, Default, PartialEq)]
1261#[non_exhaustive]
1262pub struct AttestorPublicKey {
1263 pub comment: std::string::String,
1265
1266 pub id: std::string::String,
1274
1275 pub public_key: std::option::Option<crate::model::attestor_public_key::PublicKey>,
1276
1277 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1278}
1279
1280impl AttestorPublicKey {
1281 pub fn new() -> Self {
1282 std::default::Default::default()
1283 }
1284
1285 pub fn set_comment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1287 self.comment = v.into();
1288 self
1289 }
1290
1291 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1293 self.id = v.into();
1294 self
1295 }
1296
1297 pub fn set_public_key<
1302 T: std::convert::Into<std::option::Option<crate::model::attestor_public_key::PublicKey>>,
1303 >(
1304 mut self,
1305 v: T,
1306 ) -> Self {
1307 self.public_key = v.into();
1308 self
1309 }
1310
1311 pub fn ascii_armored_pgp_public_key(&self) -> std::option::Option<&std::string::String> {
1315 #[allow(unreachable_patterns)]
1316 self.public_key.as_ref().and_then(|v| match v {
1317 crate::model::attestor_public_key::PublicKey::AsciiArmoredPgpPublicKey(v) => {
1318 std::option::Option::Some(v)
1319 }
1320 _ => std::option::Option::None,
1321 })
1322 }
1323
1324 pub fn set_ascii_armored_pgp_public_key<T: std::convert::Into<std::string::String>>(
1330 mut self,
1331 v: T,
1332 ) -> Self {
1333 self.public_key = std::option::Option::Some(
1334 crate::model::attestor_public_key::PublicKey::AsciiArmoredPgpPublicKey(v.into()),
1335 );
1336 self
1337 }
1338
1339 pub fn pkix_public_key(
1343 &self,
1344 ) -> std::option::Option<&std::boxed::Box<crate::model::PkixPublicKey>> {
1345 #[allow(unreachable_patterns)]
1346 self.public_key.as_ref().and_then(|v| match v {
1347 crate::model::attestor_public_key::PublicKey::PkixPublicKey(v) => {
1348 std::option::Option::Some(v)
1349 }
1350 _ => std::option::Option::None,
1351 })
1352 }
1353
1354 pub fn set_pkix_public_key<
1360 T: std::convert::Into<std::boxed::Box<crate::model::PkixPublicKey>>,
1361 >(
1362 mut self,
1363 v: T,
1364 ) -> Self {
1365 self.public_key = std::option::Option::Some(
1366 crate::model::attestor_public_key::PublicKey::PkixPublicKey(v.into()),
1367 );
1368 self
1369 }
1370}
1371
1372impl wkt::message::Message for AttestorPublicKey {
1373 fn typename() -> &'static str {
1374 "type.googleapis.com/google.cloud.binaryauthorization.v1.AttestorPublicKey"
1375 }
1376}
1377
1378pub mod attestor_public_key {
1380 #[allow(unused_imports)]
1381 use super::*;
1382
1383 #[derive(Clone, Debug, PartialEq)]
1384 #[non_exhaustive]
1385 pub enum PublicKey {
1386 AsciiArmoredPgpPublicKey(std::string::String),
1395 PkixPublicKey(std::boxed::Box<crate::model::PkixPublicKey>),
1402 }
1403}
1404
1405#[derive(Clone, Default, PartialEq)]
1407#[non_exhaustive]
1408pub struct GetPolicyRequest {
1409 pub name: std::string::String,
1414
1415 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1416}
1417
1418impl GetPolicyRequest {
1419 pub fn new() -> Self {
1420 std::default::Default::default()
1421 }
1422
1423 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1425 self.name = v.into();
1426 self
1427 }
1428}
1429
1430impl wkt::message::Message for GetPolicyRequest {
1431 fn typename() -> &'static str {
1432 "type.googleapis.com/google.cloud.binaryauthorization.v1.GetPolicyRequest"
1433 }
1434}
1435
1436#[derive(Clone, Default, PartialEq)]
1438#[non_exhaustive]
1439pub struct UpdatePolicyRequest {
1440 pub policy: std::option::Option<crate::model::Policy>,
1447
1448 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1449}
1450
1451impl UpdatePolicyRequest {
1452 pub fn new() -> Self {
1453 std::default::Default::default()
1454 }
1455
1456 pub fn set_policy<T>(mut self, v: T) -> Self
1458 where
1459 T: std::convert::Into<crate::model::Policy>,
1460 {
1461 self.policy = std::option::Option::Some(v.into());
1462 self
1463 }
1464
1465 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1467 where
1468 T: std::convert::Into<crate::model::Policy>,
1469 {
1470 self.policy = v.map(|x| x.into());
1471 self
1472 }
1473}
1474
1475impl wkt::message::Message for UpdatePolicyRequest {
1476 fn typename() -> &'static str {
1477 "type.googleapis.com/google.cloud.binaryauthorization.v1.UpdatePolicyRequest"
1478 }
1479}
1480
1481#[derive(Clone, Default, PartialEq)]
1483#[non_exhaustive]
1484pub struct CreateAttestorRequest {
1485 pub parent: std::string::String,
1489
1490 pub attestor_id: std::string::String,
1494
1495 pub attestor: std::option::Option<crate::model::Attestor>,
1502
1503 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1504}
1505
1506impl CreateAttestorRequest {
1507 pub fn new() -> Self {
1508 std::default::Default::default()
1509 }
1510
1511 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1513 self.parent = v.into();
1514 self
1515 }
1516
1517 pub fn set_attestor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1519 self.attestor_id = v.into();
1520 self
1521 }
1522
1523 pub fn set_attestor<T>(mut self, v: T) -> Self
1525 where
1526 T: std::convert::Into<crate::model::Attestor>,
1527 {
1528 self.attestor = std::option::Option::Some(v.into());
1529 self
1530 }
1531
1532 pub fn set_or_clear_attestor<T>(mut self, v: std::option::Option<T>) -> Self
1534 where
1535 T: std::convert::Into<crate::model::Attestor>,
1536 {
1537 self.attestor = v.map(|x| x.into());
1538 self
1539 }
1540}
1541
1542impl wkt::message::Message for CreateAttestorRequest {
1543 fn typename() -> &'static str {
1544 "type.googleapis.com/google.cloud.binaryauthorization.v1.CreateAttestorRequest"
1545 }
1546}
1547
1548#[derive(Clone, Default, PartialEq)]
1550#[non_exhaustive]
1551pub struct GetAttestorRequest {
1552 pub name: std::string::String,
1557
1558 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1559}
1560
1561impl GetAttestorRequest {
1562 pub fn new() -> Self {
1563 std::default::Default::default()
1564 }
1565
1566 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1568 self.name = v.into();
1569 self
1570 }
1571}
1572
1573impl wkt::message::Message for GetAttestorRequest {
1574 fn typename() -> &'static str {
1575 "type.googleapis.com/google.cloud.binaryauthorization.v1.GetAttestorRequest"
1576 }
1577}
1578
1579#[derive(Clone, Default, PartialEq)]
1581#[non_exhaustive]
1582pub struct UpdateAttestorRequest {
1583 pub attestor: std::option::Option<crate::model::Attestor>,
1590
1591 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1592}
1593
1594impl UpdateAttestorRequest {
1595 pub fn new() -> Self {
1596 std::default::Default::default()
1597 }
1598
1599 pub fn set_attestor<T>(mut self, v: T) -> Self
1601 where
1602 T: std::convert::Into<crate::model::Attestor>,
1603 {
1604 self.attestor = std::option::Option::Some(v.into());
1605 self
1606 }
1607
1608 pub fn set_or_clear_attestor<T>(mut self, v: std::option::Option<T>) -> Self
1610 where
1611 T: std::convert::Into<crate::model::Attestor>,
1612 {
1613 self.attestor = v.map(|x| x.into());
1614 self
1615 }
1616}
1617
1618impl wkt::message::Message for UpdateAttestorRequest {
1619 fn typename() -> &'static str {
1620 "type.googleapis.com/google.cloud.binaryauthorization.v1.UpdateAttestorRequest"
1621 }
1622}
1623
1624#[derive(Clone, Default, PartialEq)]
1626#[non_exhaustive]
1627pub struct ListAttestorsRequest {
1628 pub parent: std::string::String,
1633
1634 pub page_size: i32,
1637
1638 pub page_token: std::string::String,
1644
1645 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1646}
1647
1648impl ListAttestorsRequest {
1649 pub fn new() -> Self {
1650 std::default::Default::default()
1651 }
1652
1653 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1655 self.parent = v.into();
1656 self
1657 }
1658
1659 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1661 self.page_size = v.into();
1662 self
1663 }
1664
1665 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1667 self.page_token = v.into();
1668 self
1669 }
1670}
1671
1672impl wkt::message::Message for ListAttestorsRequest {
1673 fn typename() -> &'static str {
1674 "type.googleapis.com/google.cloud.binaryauthorization.v1.ListAttestorsRequest"
1675 }
1676}
1677
1678#[derive(Clone, Default, PartialEq)]
1680#[non_exhaustive]
1681pub struct ListAttestorsResponse {
1682 pub attestors: std::vec::Vec<crate::model::Attestor>,
1686
1687 pub next_page_token: std::string::String,
1693
1694 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1695}
1696
1697impl ListAttestorsResponse {
1698 pub fn new() -> Self {
1699 std::default::Default::default()
1700 }
1701
1702 pub fn set_attestors<T, V>(mut self, v: T) -> Self
1704 where
1705 T: std::iter::IntoIterator<Item = V>,
1706 V: std::convert::Into<crate::model::Attestor>,
1707 {
1708 use std::iter::Iterator;
1709 self.attestors = v.into_iter().map(|i| i.into()).collect();
1710 self
1711 }
1712
1713 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1715 self.next_page_token = v.into();
1716 self
1717 }
1718}
1719
1720impl wkt::message::Message for ListAttestorsResponse {
1721 fn typename() -> &'static str {
1722 "type.googleapis.com/google.cloud.binaryauthorization.v1.ListAttestorsResponse"
1723 }
1724}
1725
1726#[doc(hidden)]
1727impl gax::paginator::internal::PageableResponse for ListAttestorsResponse {
1728 type PageItem = crate::model::Attestor;
1729
1730 fn items(self) -> std::vec::Vec<Self::PageItem> {
1731 self.attestors
1732 }
1733
1734 fn next_page_token(&self) -> std::string::String {
1735 use std::clone::Clone;
1736 self.next_page_token.clone()
1737 }
1738}
1739
1740#[derive(Clone, Default, PartialEq)]
1742#[non_exhaustive]
1743pub struct DeleteAttestorRequest {
1744 pub name: std::string::String,
1749
1750 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1751}
1752
1753impl DeleteAttestorRequest {
1754 pub fn new() -> Self {
1755 std::default::Default::default()
1756 }
1757
1758 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1760 self.name = v.into();
1761 self
1762 }
1763}
1764
1765impl wkt::message::Message for DeleteAttestorRequest {
1766 fn typename() -> &'static str {
1767 "type.googleapis.com/google.cloud.binaryauthorization.v1.DeleteAttestorRequest"
1768 }
1769}
1770
1771#[derive(Clone, Default, PartialEq)]
1773#[non_exhaustive]
1774pub struct GetSystemPolicyRequest {
1775 pub name: std::string::String,
1778
1779 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1780}
1781
1782impl GetSystemPolicyRequest {
1783 pub fn new() -> Self {
1784 std::default::Default::default()
1785 }
1786
1787 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1789 self.name = v.into();
1790 self
1791 }
1792}
1793
1794impl wkt::message::Message for GetSystemPolicyRequest {
1795 fn typename() -> &'static str {
1796 "type.googleapis.com/google.cloud.binaryauthorization.v1.GetSystemPolicyRequest"
1797 }
1798}
1799
1800#[derive(Clone, Default, PartialEq)]
1805#[non_exhaustive]
1806pub struct ValidateAttestationOccurrenceRequest {
1807 pub attestor: std::string::String,
1813
1814 pub attestation: std::option::Option<grafeas::model::AttestationOccurrence>,
1821
1822 pub occurrence_note: std::string::String,
1825
1826 pub occurrence_resource_uri: std::string::String,
1829
1830 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1831}
1832
1833impl ValidateAttestationOccurrenceRequest {
1834 pub fn new() -> Self {
1835 std::default::Default::default()
1836 }
1837
1838 pub fn set_attestor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1840 self.attestor = v.into();
1841 self
1842 }
1843
1844 pub fn set_attestation<T>(mut self, v: T) -> Self
1846 where
1847 T: std::convert::Into<grafeas::model::AttestationOccurrence>,
1848 {
1849 self.attestation = std::option::Option::Some(v.into());
1850 self
1851 }
1852
1853 pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
1855 where
1856 T: std::convert::Into<grafeas::model::AttestationOccurrence>,
1857 {
1858 self.attestation = v.map(|x| x.into());
1859 self
1860 }
1861
1862 pub fn set_occurrence_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1864 self.occurrence_note = v.into();
1865 self
1866 }
1867
1868 pub fn set_occurrence_resource_uri<T: std::convert::Into<std::string::String>>(
1870 mut self,
1871 v: T,
1872 ) -> Self {
1873 self.occurrence_resource_uri = v.into();
1874 self
1875 }
1876}
1877
1878impl wkt::message::Message for ValidateAttestationOccurrenceRequest {
1879 fn typename() -> &'static str {
1880 "type.googleapis.com/google.cloud.binaryauthorization.v1.ValidateAttestationOccurrenceRequest"
1881 }
1882}
1883
1884#[derive(Clone, Default, PartialEq)]
1889#[non_exhaustive]
1890pub struct ValidateAttestationOccurrenceResponse {
1891 pub result: crate::model::validate_attestation_occurrence_response::Result,
1893
1894 pub denial_reason: std::string::String,
1896
1897 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1898}
1899
1900impl ValidateAttestationOccurrenceResponse {
1901 pub fn new() -> Self {
1902 std::default::Default::default()
1903 }
1904
1905 pub fn set_result<
1907 T: std::convert::Into<crate::model::validate_attestation_occurrence_response::Result>,
1908 >(
1909 mut self,
1910 v: T,
1911 ) -> Self {
1912 self.result = v.into();
1913 self
1914 }
1915
1916 pub fn set_denial_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1918 self.denial_reason = v.into();
1919 self
1920 }
1921}
1922
1923impl wkt::message::Message for ValidateAttestationOccurrenceResponse {
1924 fn typename() -> &'static str {
1925 "type.googleapis.com/google.cloud.binaryauthorization.v1.ValidateAttestationOccurrenceResponse"
1926 }
1927}
1928
1929pub mod validate_attestation_occurrence_response {
1931 #[allow(unused_imports)]
1932 use super::*;
1933
1934 #[derive(Clone, Debug, PartialEq)]
1950 #[non_exhaustive]
1951 pub enum Result {
1952 Unspecified,
1954 Verified,
1956 AttestationNotVerifiable,
1958 UnknownValue(result::UnknownValue),
1963 }
1964
1965 #[doc(hidden)]
1966 pub mod result {
1967 #[allow(unused_imports)]
1968 use super::*;
1969 #[derive(Clone, Debug, PartialEq)]
1970 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1971 }
1972
1973 impl Result {
1974 pub fn value(&self) -> std::option::Option<i32> {
1979 match self {
1980 Self::Unspecified => std::option::Option::Some(0),
1981 Self::Verified => std::option::Option::Some(1),
1982 Self::AttestationNotVerifiable => std::option::Option::Some(2),
1983 Self::UnknownValue(u) => u.0.value(),
1984 }
1985 }
1986
1987 pub fn name(&self) -> std::option::Option<&str> {
1992 match self {
1993 Self::Unspecified => std::option::Option::Some("RESULT_UNSPECIFIED"),
1994 Self::Verified => std::option::Option::Some("VERIFIED"),
1995 Self::AttestationNotVerifiable => {
1996 std::option::Option::Some("ATTESTATION_NOT_VERIFIABLE")
1997 }
1998 Self::UnknownValue(u) => u.0.name(),
1999 }
2000 }
2001 }
2002
2003 impl std::default::Default for Result {
2004 fn default() -> Self {
2005 use std::convert::From;
2006 Self::from(0)
2007 }
2008 }
2009
2010 impl std::fmt::Display for Result {
2011 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2012 wkt::internal::display_enum(f, self.name(), self.value())
2013 }
2014 }
2015
2016 impl std::convert::From<i32> for Result {
2017 fn from(value: i32) -> Self {
2018 match value {
2019 0 => Self::Unspecified,
2020 1 => Self::Verified,
2021 2 => Self::AttestationNotVerifiable,
2022 _ => Self::UnknownValue(result::UnknownValue(
2023 wkt::internal::UnknownEnumValue::Integer(value),
2024 )),
2025 }
2026 }
2027 }
2028
2029 impl std::convert::From<&str> for Result {
2030 fn from(value: &str) -> Self {
2031 use std::string::ToString;
2032 match value {
2033 "RESULT_UNSPECIFIED" => Self::Unspecified,
2034 "VERIFIED" => Self::Verified,
2035 "ATTESTATION_NOT_VERIFIABLE" => Self::AttestationNotVerifiable,
2036 _ => Self::UnknownValue(result::UnknownValue(
2037 wkt::internal::UnknownEnumValue::String(value.to_string()),
2038 )),
2039 }
2040 }
2041 }
2042
2043 impl serde::ser::Serialize for Result {
2044 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2045 where
2046 S: serde::Serializer,
2047 {
2048 match self {
2049 Self::Unspecified => serializer.serialize_i32(0),
2050 Self::Verified => serializer.serialize_i32(1),
2051 Self::AttestationNotVerifiable => serializer.serialize_i32(2),
2052 Self::UnknownValue(u) => u.0.serialize(serializer),
2053 }
2054 }
2055 }
2056
2057 impl<'de> serde::de::Deserialize<'de> for Result {
2058 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2059 where
2060 D: serde::Deserializer<'de>,
2061 {
2062 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Result>::new(
2063 ".google.cloud.binaryauthorization.v1.ValidateAttestationOccurrenceResponse.Result",
2064 ))
2065 }
2066 }
2067}