#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gaxi;
extern crate google_cloud_gax;
extern crate google_cloud_grafeas_v1;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;
mod debug;
mod deserialize;
mod serialize;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Policy {
pub name: std::string::String,
pub description: std::string::String,
pub global_policy_evaluation_mode: crate::model::policy::GlobalPolicyEvaluationMode,
pub admission_whitelist_patterns: std::vec::Vec<crate::model::AdmissionWhitelistPattern>,
pub cluster_admission_rules:
std::collections::HashMap<std::string::String, crate::model::AdmissionRule>,
pub kubernetes_namespace_admission_rules:
std::collections::HashMap<std::string::String, crate::model::AdmissionRule>,
pub kubernetes_service_account_admission_rules:
std::collections::HashMap<std::string::String, crate::model::AdmissionRule>,
pub istio_service_identity_admission_rules:
std::collections::HashMap<std::string::String, crate::model::AdmissionRule>,
pub default_admission_rule: std::option::Option<crate::model::AdmissionRule>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Policy {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
pub fn set_global_policy_evaluation_mode<
T: std::convert::Into<crate::model::policy::GlobalPolicyEvaluationMode>,
>(
mut self,
v: T,
) -> Self {
self.global_policy_evaluation_mode = v.into();
self
}
pub fn set_admission_whitelist_patterns<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::AdmissionWhitelistPattern>,
{
use std::iter::Iterator;
self.admission_whitelist_patterns = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_cluster_admission_rules<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::AdmissionRule>,
{
use std::iter::Iterator;
self.cluster_admission_rules = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_kubernetes_namespace_admission_rules<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::AdmissionRule>,
{
use std::iter::Iterator;
self.kubernetes_namespace_admission_rules =
v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_kubernetes_service_account_admission_rules<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::AdmissionRule>,
{
use std::iter::Iterator;
self.kubernetes_service_account_admission_rules =
v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_istio_service_identity_admission_rules<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::AdmissionRule>,
{
use std::iter::Iterator;
self.istio_service_identity_admission_rules =
v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_default_admission_rule<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AdmissionRule>,
{
self.default_admission_rule = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_default_admission_rule<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AdmissionRule>,
{
self.default_admission_rule = v.map(|x| x.into());
self
}
pub fn set_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Policy {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.binaryauthorization.v1.Policy"
}
}
pub mod policy {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum GlobalPolicyEvaluationMode {
Unspecified,
Enable,
Disable,
UnknownValue(global_policy_evaluation_mode::UnknownValue),
}
#[doc(hidden)]
pub mod global_policy_evaluation_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl GlobalPolicyEvaluationMode {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Enable => std::option::Option::Some(1),
Self::Disable => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("GLOBAL_POLICY_EVALUATION_MODE_UNSPECIFIED")
}
Self::Enable => std::option::Option::Some("ENABLE"),
Self::Disable => std::option::Option::Some("DISABLE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for GlobalPolicyEvaluationMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for GlobalPolicyEvaluationMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for GlobalPolicyEvaluationMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Enable,
2 => Self::Disable,
_ => Self::UnknownValue(global_policy_evaluation_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for GlobalPolicyEvaluationMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"GLOBAL_POLICY_EVALUATION_MODE_UNSPECIFIED" => Self::Unspecified,
"ENABLE" => Self::Enable,
"DISABLE" => Self::Disable,
_ => Self::UnknownValue(global_policy_evaluation_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for GlobalPolicyEvaluationMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Enable => serializer.serialize_i32(1),
Self::Disable => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for GlobalPolicyEvaluationMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(
wkt::internal::EnumVisitor::<GlobalPolicyEvaluationMode>::new(
".google.cloud.binaryauthorization.v1.Policy.GlobalPolicyEvaluationMode",
),
)
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AdmissionWhitelistPattern {
pub name_pattern: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AdmissionWhitelistPattern {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name_pattern<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name_pattern = v.into();
self
}
}
impl wkt::message::Message for AdmissionWhitelistPattern {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.binaryauthorization.v1.AdmissionWhitelistPattern"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AdmissionRule {
pub evaluation_mode: crate::model::admission_rule::EvaluationMode,
pub require_attestations_by: std::vec::Vec<std::string::String>,
pub enforcement_mode: crate::model::admission_rule::EnforcementMode,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AdmissionRule {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_evaluation_mode<
T: std::convert::Into<crate::model::admission_rule::EvaluationMode>,
>(
mut self,
v: T,
) -> Self {
self.evaluation_mode = v.into();
self
}
pub fn set_require_attestations_by<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.require_attestations_by = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_enforcement_mode<
T: std::convert::Into<crate::model::admission_rule::EnforcementMode>,
>(
mut self,
v: T,
) -> Self {
self.enforcement_mode = v.into();
self
}
}
impl wkt::message::Message for AdmissionRule {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.binaryauthorization.v1.AdmissionRule"
}
}
pub mod admission_rule {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum EvaluationMode {
Unspecified,
AlwaysAllow,
RequireAttestation,
AlwaysDeny,
UnknownValue(evaluation_mode::UnknownValue),
}
#[doc(hidden)]
pub mod evaluation_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl EvaluationMode {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::AlwaysAllow => std::option::Option::Some(1),
Self::RequireAttestation => std::option::Option::Some(2),
Self::AlwaysDeny => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("EVALUATION_MODE_UNSPECIFIED"),
Self::AlwaysAllow => std::option::Option::Some("ALWAYS_ALLOW"),
Self::RequireAttestation => std::option::Option::Some("REQUIRE_ATTESTATION"),
Self::AlwaysDeny => std::option::Option::Some("ALWAYS_DENY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for EvaluationMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for EvaluationMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for EvaluationMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::AlwaysAllow,
2 => Self::RequireAttestation,
3 => Self::AlwaysDeny,
_ => Self::UnknownValue(evaluation_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for EvaluationMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"EVALUATION_MODE_UNSPECIFIED" => Self::Unspecified,
"ALWAYS_ALLOW" => Self::AlwaysAllow,
"REQUIRE_ATTESTATION" => Self::RequireAttestation,
"ALWAYS_DENY" => Self::AlwaysDeny,
_ => Self::UnknownValue(evaluation_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for EvaluationMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::AlwaysAllow => serializer.serialize_i32(1),
Self::RequireAttestation => serializer.serialize_i32(2),
Self::AlwaysDeny => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for EvaluationMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<EvaluationMode>::new(
".google.cloud.binaryauthorization.v1.AdmissionRule.EvaluationMode",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum EnforcementMode {
Unspecified,
EnforcedBlockAndAuditLog,
DryrunAuditLogOnly,
UnknownValue(enforcement_mode::UnknownValue),
}
#[doc(hidden)]
pub mod enforcement_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl EnforcementMode {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::EnforcedBlockAndAuditLog => std::option::Option::Some(1),
Self::DryrunAuditLogOnly => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ENFORCEMENT_MODE_UNSPECIFIED"),
Self::EnforcedBlockAndAuditLog => {
std::option::Option::Some("ENFORCED_BLOCK_AND_AUDIT_LOG")
}
Self::DryrunAuditLogOnly => std::option::Option::Some("DRYRUN_AUDIT_LOG_ONLY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for EnforcementMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for EnforcementMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for EnforcementMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::EnforcedBlockAndAuditLog,
2 => Self::DryrunAuditLogOnly,
_ => Self::UnknownValue(enforcement_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for EnforcementMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ENFORCEMENT_MODE_UNSPECIFIED" => Self::Unspecified,
"ENFORCED_BLOCK_AND_AUDIT_LOG" => Self::EnforcedBlockAndAuditLog,
"DRYRUN_AUDIT_LOG_ONLY" => Self::DryrunAuditLogOnly,
_ => Self::UnknownValue(enforcement_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for EnforcementMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::EnforcedBlockAndAuditLog => serializer.serialize_i32(1),
Self::DryrunAuditLogOnly => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for EnforcementMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<EnforcementMode>::new(
".google.cloud.binaryauthorization.v1.AdmissionRule.EnforcementMode",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Attestor {
pub name: std::string::String,
pub description: std::string::String,
pub update_time: std::option::Option<wkt::Timestamp>,
pub attestor_type: std::option::Option<crate::model::attestor::AttestorType>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Attestor {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
pub fn set_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.into());
self
}
pub fn set_attestor_type<
T: std::convert::Into<std::option::Option<crate::model::attestor::AttestorType>>,
>(
mut self,
v: T,
) -> Self {
self.attestor_type = v.into();
self
}
pub fn user_owned_grafeas_note(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::UserOwnedGrafeasNote>> {
#[allow(unreachable_patterns)]
self.attestor_type.as_ref().and_then(|v| match v {
crate::model::attestor::AttestorType::UserOwnedGrafeasNote(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_user_owned_grafeas_note<
T: std::convert::Into<std::boxed::Box<crate::model::UserOwnedGrafeasNote>>,
>(
mut self,
v: T,
) -> Self {
self.attestor_type = std::option::Option::Some(
crate::model::attestor::AttestorType::UserOwnedGrafeasNote(v.into()),
);
self
}
}
impl wkt::message::Message for Attestor {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.binaryauthorization.v1.Attestor"
}
}
pub mod attestor {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AttestorType {
UserOwnedGrafeasNote(std::boxed::Box<crate::model::UserOwnedGrafeasNote>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UserOwnedGrafeasNote {
pub note_reference: std::string::String,
pub public_keys: std::vec::Vec<crate::model::AttestorPublicKey>,
pub delegation_service_account_email: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UserOwnedGrafeasNote {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_note_reference<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.note_reference = v.into();
self
}
pub fn set_public_keys<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::AttestorPublicKey>,
{
use std::iter::Iterator;
self.public_keys = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_delegation_service_account_email<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.delegation_service_account_email = v.into();
self
}
}
impl wkt::message::Message for UserOwnedGrafeasNote {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.binaryauthorization.v1.UserOwnedGrafeasNote"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PkixPublicKey {
pub public_key_pem: std::string::String,
pub signature_algorithm: crate::model::pkix_public_key::SignatureAlgorithm,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PkixPublicKey {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_public_key_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.public_key_pem = v.into();
self
}
pub fn set_signature_algorithm<
T: std::convert::Into<crate::model::pkix_public_key::SignatureAlgorithm>,
>(
mut self,
v: T,
) -> Self {
self.signature_algorithm = v.into();
self
}
}
impl wkt::message::Message for PkixPublicKey {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.binaryauthorization.v1.PkixPublicKey"
}
}
pub mod pkix_public_key {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SignatureAlgorithm {
Unspecified,
RsaPss2048Sha256,
RsaPss3072Sha256,
RsaPss4096Sha256,
RsaPss4096Sha512,
RsaSignPkcs12048Sha256,
RsaSignPkcs13072Sha256,
RsaSignPkcs14096Sha256,
RsaSignPkcs14096Sha512,
EcdsaP256Sha256,
EcSignP256Sha256,
EcdsaP384Sha384,
EcSignP384Sha384,
EcdsaP521Sha512,
EcSignP521Sha512,
UnknownValue(signature_algorithm::UnknownValue),
}
#[doc(hidden)]
pub mod signature_algorithm {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl SignatureAlgorithm {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::RsaPss2048Sha256 => std::option::Option::Some(1),
Self::RsaPss3072Sha256 => std::option::Option::Some(2),
Self::RsaPss4096Sha256 => std::option::Option::Some(3),
Self::RsaPss4096Sha512 => std::option::Option::Some(4),
Self::RsaSignPkcs12048Sha256 => std::option::Option::Some(5),
Self::RsaSignPkcs13072Sha256 => std::option::Option::Some(6),
Self::RsaSignPkcs14096Sha256 => std::option::Option::Some(7),
Self::RsaSignPkcs14096Sha512 => std::option::Option::Some(8),
Self::EcdsaP256Sha256 => std::option::Option::Some(9),
Self::EcSignP256Sha256 => std::option::Option::Some(9),
Self::EcdsaP384Sha384 => std::option::Option::Some(10),
Self::EcSignP384Sha384 => std::option::Option::Some(10),
Self::EcdsaP521Sha512 => std::option::Option::Some(11),
Self::EcSignP521Sha512 => std::option::Option::Some(11),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SIGNATURE_ALGORITHM_UNSPECIFIED"),
Self::RsaPss2048Sha256 => std::option::Option::Some("RSA_PSS_2048_SHA256"),
Self::RsaPss3072Sha256 => std::option::Option::Some("RSA_PSS_3072_SHA256"),
Self::RsaPss4096Sha256 => std::option::Option::Some("RSA_PSS_4096_SHA256"),
Self::RsaPss4096Sha512 => std::option::Option::Some("RSA_PSS_4096_SHA512"),
Self::RsaSignPkcs12048Sha256 => {
std::option::Option::Some("RSA_SIGN_PKCS1_2048_SHA256")
}
Self::RsaSignPkcs13072Sha256 => {
std::option::Option::Some("RSA_SIGN_PKCS1_3072_SHA256")
}
Self::RsaSignPkcs14096Sha256 => {
std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA256")
}
Self::RsaSignPkcs14096Sha512 => {
std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA512")
}
Self::EcdsaP256Sha256 => std::option::Option::Some("ECDSA_P256_SHA256"),
Self::EcSignP256Sha256 => std::option::Option::Some("EC_SIGN_P256_SHA256"),
Self::EcdsaP384Sha384 => std::option::Option::Some("ECDSA_P384_SHA384"),
Self::EcSignP384Sha384 => std::option::Option::Some("EC_SIGN_P384_SHA384"),
Self::EcdsaP521Sha512 => std::option::Option::Some("ECDSA_P521_SHA512"),
Self::EcSignP521Sha512 => std::option::Option::Some("EC_SIGN_P521_SHA512"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for SignatureAlgorithm {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for SignatureAlgorithm {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for SignatureAlgorithm {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::RsaPss2048Sha256,
2 => Self::RsaPss3072Sha256,
3 => Self::RsaPss4096Sha256,
4 => Self::RsaPss4096Sha512,
5 => Self::RsaSignPkcs12048Sha256,
6 => Self::RsaSignPkcs13072Sha256,
7 => Self::RsaSignPkcs14096Sha256,
8 => Self::RsaSignPkcs14096Sha512,
9 => Self::EcdsaP256Sha256,
10 => Self::EcdsaP384Sha384,
11 => Self::EcdsaP521Sha512,
_ => Self::UnknownValue(signature_algorithm::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for SignatureAlgorithm {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SIGNATURE_ALGORITHM_UNSPECIFIED" => Self::Unspecified,
"RSA_PSS_2048_SHA256" => Self::RsaPss2048Sha256,
"RSA_PSS_3072_SHA256" => Self::RsaPss3072Sha256,
"RSA_PSS_4096_SHA256" => Self::RsaPss4096Sha256,
"RSA_PSS_4096_SHA512" => Self::RsaPss4096Sha512,
"RSA_SIGN_PKCS1_2048_SHA256" => Self::RsaSignPkcs12048Sha256,
"RSA_SIGN_PKCS1_3072_SHA256" => Self::RsaSignPkcs13072Sha256,
"RSA_SIGN_PKCS1_4096_SHA256" => Self::RsaSignPkcs14096Sha256,
"RSA_SIGN_PKCS1_4096_SHA512" => Self::RsaSignPkcs14096Sha512,
"ECDSA_P256_SHA256" => Self::EcdsaP256Sha256,
"EC_SIGN_P256_SHA256" => Self::EcSignP256Sha256,
"ECDSA_P384_SHA384" => Self::EcdsaP384Sha384,
"EC_SIGN_P384_SHA384" => Self::EcSignP384Sha384,
"ECDSA_P521_SHA512" => Self::EcdsaP521Sha512,
"EC_SIGN_P521_SHA512" => Self::EcSignP521Sha512,
_ => Self::UnknownValue(signature_algorithm::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for SignatureAlgorithm {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::RsaPss2048Sha256 => serializer.serialize_i32(1),
Self::RsaPss3072Sha256 => serializer.serialize_i32(2),
Self::RsaPss4096Sha256 => serializer.serialize_i32(3),
Self::RsaPss4096Sha512 => serializer.serialize_i32(4),
Self::RsaSignPkcs12048Sha256 => serializer.serialize_i32(5),
Self::RsaSignPkcs13072Sha256 => serializer.serialize_i32(6),
Self::RsaSignPkcs14096Sha256 => serializer.serialize_i32(7),
Self::RsaSignPkcs14096Sha512 => serializer.serialize_i32(8),
Self::EcdsaP256Sha256 => serializer.serialize_i32(9),
Self::EcSignP256Sha256 => serializer.serialize_i32(9),
Self::EcdsaP384Sha384 => serializer.serialize_i32(10),
Self::EcSignP384Sha384 => serializer.serialize_i32(10),
Self::EcdsaP521Sha512 => serializer.serialize_i32(11),
Self::EcSignP521Sha512 => serializer.serialize_i32(11),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for SignatureAlgorithm {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<SignatureAlgorithm>::new(
".google.cloud.binaryauthorization.v1.PkixPublicKey.SignatureAlgorithm",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AttestorPublicKey {
pub comment: std::string::String,
pub id: std::string::String,
pub public_key: std::option::Option<crate::model::attestor_public_key::PublicKey>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AttestorPublicKey {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_comment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.comment = v.into();
self
}
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
pub fn set_public_key<
T: std::convert::Into<std::option::Option<crate::model::attestor_public_key::PublicKey>>,
>(
mut self,
v: T,
) -> Self {
self.public_key = v.into();
self
}
pub fn ascii_armored_pgp_public_key(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.public_key.as_ref().and_then(|v| match v {
crate::model::attestor_public_key::PublicKey::AsciiArmoredPgpPublicKey(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_ascii_armored_pgp_public_key<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.public_key = std::option::Option::Some(
crate::model::attestor_public_key::PublicKey::AsciiArmoredPgpPublicKey(v.into()),
);
self
}
pub fn pkix_public_key(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::PkixPublicKey>> {
#[allow(unreachable_patterns)]
self.public_key.as_ref().and_then(|v| match v {
crate::model::attestor_public_key::PublicKey::PkixPublicKey(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_pkix_public_key<
T: std::convert::Into<std::boxed::Box<crate::model::PkixPublicKey>>,
>(
mut self,
v: T,
) -> Self {
self.public_key = std::option::Option::Some(
crate::model::attestor_public_key::PublicKey::PkixPublicKey(v.into()),
);
self
}
}
impl wkt::message::Message for AttestorPublicKey {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.binaryauthorization.v1.AttestorPublicKey"
}
}
pub mod attestor_public_key {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum PublicKey {
AsciiArmoredPgpPublicKey(std::string::String),
PkixPublicKey(std::boxed::Box<crate::model::PkixPublicKey>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetPolicyRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetPolicyRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetPolicyRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.binaryauthorization.v1.GetPolicyRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdatePolicyRequest {
pub policy: std::option::Option<crate::model::Policy>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdatePolicyRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Policy>,
{
self.policy = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Policy>,
{
self.policy = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdatePolicyRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.binaryauthorization.v1.UpdatePolicyRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateAttestorRequest {
pub parent: std::string::String,
pub attestor_id: std::string::String,
pub attestor: std::option::Option<crate::model::Attestor>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateAttestorRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_attestor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.attestor_id = v.into();
self
}
pub fn set_attestor<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Attestor>,
{
self.attestor = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_attestor<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Attestor>,
{
self.attestor = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for CreateAttestorRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.binaryauthorization.v1.CreateAttestorRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetAttestorRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetAttestorRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetAttestorRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.binaryauthorization.v1.GetAttestorRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateAttestorRequest {
pub attestor: std::option::Option<crate::model::Attestor>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateAttestorRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_attestor<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Attestor>,
{
self.attestor = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_attestor<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Attestor>,
{
self.attestor = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateAttestorRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.binaryauthorization.v1.UpdateAttestorRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListAttestorsRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListAttestorsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
impl wkt::message::Message for ListAttestorsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.binaryauthorization.v1.ListAttestorsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListAttestorsResponse {
pub attestors: std::vec::Vec<crate::model::Attestor>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListAttestorsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_attestors<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Attestor>,
{
use std::iter::Iterator;
self.attestors = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
}
impl wkt::message::Message for ListAttestorsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.binaryauthorization.v1.ListAttestorsResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListAttestorsResponse {
type PageItem = crate::model::Attestor;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.attestors
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteAttestorRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteAttestorRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for DeleteAttestorRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.binaryauthorization.v1.DeleteAttestorRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetSystemPolicyRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetSystemPolicyRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetSystemPolicyRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.binaryauthorization.v1.GetSystemPolicyRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ValidateAttestationOccurrenceRequest {
pub attestor: std::string::String,
pub attestation: std::option::Option<google_cloud_grafeas_v1::model::AttestationOccurrence>,
pub occurrence_note: std::string::String,
pub occurrence_resource_uri: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ValidateAttestationOccurrenceRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_attestor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.attestor = v.into();
self
}
pub fn set_attestation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_grafeas_v1::model::AttestationOccurrence>,
{
self.attestation = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_grafeas_v1::model::AttestationOccurrence>,
{
self.attestation = v.map(|x| x.into());
self
}
pub fn set_occurrence_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.occurrence_note = v.into();
self
}
pub fn set_occurrence_resource_uri<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.occurrence_resource_uri = v.into();
self
}
}
impl wkt::message::Message for ValidateAttestationOccurrenceRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.binaryauthorization.v1.ValidateAttestationOccurrenceRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ValidateAttestationOccurrenceResponse {
pub result: crate::model::validate_attestation_occurrence_response::Result,
pub denial_reason: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ValidateAttestationOccurrenceResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_result<
T: std::convert::Into<crate::model::validate_attestation_occurrence_response::Result>,
>(
mut self,
v: T,
) -> Self {
self.result = v.into();
self
}
pub fn set_denial_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.denial_reason = v.into();
self
}
}
impl wkt::message::Message for ValidateAttestationOccurrenceResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.binaryauthorization.v1.ValidateAttestationOccurrenceResponse"
}
}
pub mod validate_attestation_occurrence_response {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Result {
Unspecified,
Verified,
AttestationNotVerifiable,
UnknownValue(result::UnknownValue),
}
#[doc(hidden)]
pub mod result {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Result {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Verified => std::option::Option::Some(1),
Self::AttestationNotVerifiable => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("RESULT_UNSPECIFIED"),
Self::Verified => std::option::Option::Some("VERIFIED"),
Self::AttestationNotVerifiable => {
std::option::Option::Some("ATTESTATION_NOT_VERIFIABLE")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Result {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Result {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Result {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Verified,
2 => Self::AttestationNotVerifiable,
_ => Self::UnknownValue(result::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Result {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"RESULT_UNSPECIFIED" => Self::Unspecified,
"VERIFIED" => Self::Verified,
"ATTESTATION_NOT_VERIFIABLE" => Self::AttestationNotVerifiable,
_ => Self::UnknownValue(result::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Result {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Verified => serializer.serialize_i32(1),
Self::AttestationNotVerifiable => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Result {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Result>::new(
".google.cloud.binaryauthorization.v1.ValidateAttestationOccurrenceResponse.Result",
))
}
}
}