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
34#[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 #[serde(skip_serializing_if = "std::string::String::is_empty")]
45 pub name: std::string::String,
46
47 #[serde(skip_serializing_if = "std::string::String::is_empty")]
49 pub description: std::string::String,
50
51 pub global_policy_evaluation_mode: crate::model::policy::GlobalPolicyEvaluationMode,
56
57 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
61 pub admission_whitelist_patterns: std::vec::Vec<crate::model::AdmissionWhitelistPattern>,
62
63 #[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 #[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 #[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 #[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 #[serde(skip_serializing_if = "std::option::Option::is_none")]
98 pub default_admission_rule: std::option::Option<crate::model::AdmissionRule>,
99
100 #[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 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 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 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 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 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 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 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 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 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 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
225pub mod policy {
227 #[allow(unused_imports)]
228 use super::*;
229
230 #[derive(Clone, Debug, PartialEq)]
245 #[non_exhaustive]
246 pub enum GlobalPolicyEvaluationMode {
247 Unspecified,
249 Enable,
251 Disable,
253 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 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 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#[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 #[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 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#[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 pub evaluation_mode: crate::model::admission_rule::EvaluationMode,
423
424 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
433 pub require_attestations_by: std::vec::Vec<std::string::String>,
434
435 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 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#[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 #[serde(skip_serializing_if = "std::string::String::is_empty")]
782 pub name: std::string::String,
783
784 #[serde(skip_serializing_if = "std::string::String::is_empty")]
787 pub description: std::string::String,
788
789 #[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 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 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 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 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 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 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
879pub 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 UserOwnedGrafeasNote(std::boxed::Box<crate::model::UserOwnedGrafeasNote>),
892 }
893}
894
895#[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 #[serde(skip_serializing_if = "std::string::String::is_empty")]
912 pub note_reference: std::string::String,
913
914 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
924 pub public_keys: std::vec::Vec<crate::model::AttestorPublicKey>,
925
926 #[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 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 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 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#[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 #[serde(skip_serializing_if = "std::string::String::is_empty")]
992 pub public_key_pem: std::string::String,
993
994 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 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 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
1034pub mod pkix_public_key {
1036 #[allow(unused_imports)]
1037 use super::*;
1038
1039 #[derive(Clone, Debug, PartialEq)]
1060 #[non_exhaustive]
1061 pub enum SignatureAlgorithm {
1062 Unspecified,
1064 RsaPss2048Sha256,
1066 RsaPss3072Sha256,
1068 RsaPss4096Sha256,
1070 RsaPss4096Sha512,
1072 RsaSignPkcs12048Sha256,
1074 RsaSignPkcs13072Sha256,
1076 RsaSignPkcs14096Sha256,
1078 RsaSignPkcs14096Sha512,
1080 EcdsaP256Sha256,
1082 EcSignP256Sha256,
1084 EcdsaP384Sha384,
1086 EcSignP384Sha384,
1088 EcdsaP521Sha512,
1090 EcSignP521Sha512,
1092 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 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 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#[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 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1277 pub comment: std::string::String,
1278
1279 #[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 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 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 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 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 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 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 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
1394pub 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 AsciiArmoredPgpPublicKey(std::string::String),
1413 PkixPublicKey(std::boxed::Box<crate::model::PkixPublicKey>),
1420 }
1421}
1422
1423#[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 #[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 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#[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 #[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 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#[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 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1508 pub parent: std::string::String,
1509
1510 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1514 pub attestor_id: std::string::String,
1515
1516 #[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 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 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 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#[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 #[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 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#[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 #[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 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#[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 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1648 pub parent: std::string::String,
1649
1650 #[serde(skip_serializing_if = "wkt::internal::is_default")]
1653 pub page_size: i32,
1654
1655 #[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 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 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 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#[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 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1707 pub attestors: std::vec::Vec<crate::model::Attestor>,
1708
1709 #[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 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 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#[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 #[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 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#[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 #[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 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#[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 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1847 pub attestor: std::string::String,
1848
1849 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1856 pub attestation: std::option::Option<grafeas::model::AttestationOccurrence>,
1857
1858 #[serde(skip_serializing_if = "std::string::String::is_empty")]
1861 pub occurrence_note: std::string::String,
1862
1863 #[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 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 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 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 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#[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 pub result: crate::model::validate_attestation_occurrence_response::Result,
1927
1928 #[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 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 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
1965pub mod validate_attestation_occurrence_response {
1967 #[allow(unused_imports)]
1968 use super::*;
1969
1970 #[derive(Clone, Debug, PartialEq)]
1986 #[non_exhaustive]
1987 pub enum Result {
1988 Unspecified,
1990 Verified,
1992 AttestationNotVerifiable,
1994 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 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 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}