cerbos 0.5.0

Rust SDK for working with Cerbos: an open core, language-agnostic, scalable authorization solution
Documentation
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AccessLogEntry {
    #[prost(string, tag = "1")]
    pub call_id: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "2")]
    pub timestamp: ::core::option::Option<
        super::super::super::google::protobuf::Timestamp,
    >,
    #[prost(message, optional, tag = "3")]
    pub peer: ::core::option::Option<Peer>,
    #[prost(map = "string, message", tag = "4")]
    pub metadata: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        MetaValues,
    >,
    #[prost(string, tag = "5")]
    pub method: ::prost::alloc::string::String,
    #[prost(uint32, tag = "6")]
    pub status_code: u32,
    #[prost(bool, tag = "7")]
    pub oversized: bool,
    #[prost(message, optional, tag = "8")]
    pub policy_source: ::core::option::Option<PolicySource>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DecisionLogEntry {
    #[prost(string, tag = "1")]
    pub call_id: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "2")]
    pub timestamp: ::core::option::Option<
        super::super::super::google::protobuf::Timestamp,
    >,
    #[prost(message, optional, tag = "3")]
    pub peer: ::core::option::Option<Peer>,
    /// Deprecated. Use method.check_resources.inputs instead.
    #[deprecated]
    #[prost(message, repeated, tag = "4")]
    pub inputs: ::prost::alloc::vec::Vec<super::super::engine::v1::CheckInput>,
    /// Deprecated. Use method.check_resources.outputs instead.
    #[deprecated]
    #[prost(message, repeated, tag = "5")]
    pub outputs: ::prost::alloc::vec::Vec<super::super::engine::v1::CheckOutput>,
    /// Deprecated. Use method.check_resources.error instead.
    #[deprecated]
    #[prost(string, tag = "6")]
    pub error: ::prost::alloc::string::String,
    #[prost(map = "string, message", tag = "15")]
    pub metadata: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        MetaValues,
    >,
    #[prost(message, optional, tag = "16")]
    pub audit_trail: ::core::option::Option<AuditTrail>,
    #[prost(bool, tag = "17")]
    pub oversized: bool,
    #[prost(message, optional, tag = "18")]
    pub policy_source: ::core::option::Option<PolicySource>,
    #[prost(oneof = "decision_log_entry::Method", tags = "7, 8")]
    pub method: ::core::option::Option<decision_log_entry::Method>,
}
/// Nested message and enum types in `DecisionLogEntry`.
pub mod decision_log_entry {
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct CheckResources {
        #[prost(message, repeated, tag = "1")]
        pub inputs: ::prost::alloc::vec::Vec<
            super::super::super::engine::v1::CheckInput,
        >,
        #[prost(message, repeated, tag = "2")]
        pub outputs: ::prost::alloc::vec::Vec<
            super::super::super::engine::v1::CheckOutput,
        >,
        #[prost(string, tag = "3")]
        pub error: ::prost::alloc::string::String,
    }
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct PlanResources {
        #[prost(message, optional, tag = "1")]
        pub input: ::core::option::Option<
            super::super::super::engine::v1::PlanResourcesInput,
        >,
        #[prost(message, optional, tag = "2")]
        pub output: ::core::option::Option<
            super::super::super::engine::v1::PlanResourcesOutput,
        >,
        #[prost(string, tag = "3")]
        pub error: ::prost::alloc::string::String,
    }
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Method {
        #[prost(message, tag = "7")]
        CheckResources(CheckResources),
        #[prost(message, tag = "8")]
        PlanResources(PlanResources),
    }
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MetaValues {
    #[prost(string, repeated, tag = "1")]
    pub values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Peer {
    #[prost(string, tag = "1")]
    pub address: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub auth_info: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub user_agent: ::prost::alloc::string::String,
    #[prost(string, tag = "4")]
    pub forwarded_for: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AuditTrail {
    #[prost(map = "string, message", tag = "1")]
    pub effective_policies: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        super::super::policy::v1::SourceAttributes,
    >,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PolicySource {
    #[prost(oneof = "policy_source::Source", tags = "1, 2, 3, 4, 5, 6")]
    pub source: ::core::option::Option<policy_source::Source>,
}
/// Nested message and enum types in `PolicySource`.
pub mod policy_source {
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct Blob {
        #[prost(string, tag = "1")]
        pub bucket_url: ::prost::alloc::string::String,
        #[prost(string, tag = "2")]
        pub prefix: ::prost::alloc::string::String,
    }
    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct Database {
        #[prost(enumeration = "database::Driver", tag = "1")]
        pub driver: i32,
    }
    /// Nested message and enum types in `Database`.
    pub mod database {
        #[derive(
            Clone,
            Copy,
            Debug,
            PartialEq,
            Eq,
            Hash,
            PartialOrd,
            Ord,
            ::prost::Enumeration
        )]
        #[repr(i32)]
        pub enum Driver {
            Unspecified = 0,
            Mysql = 1,
            Postgres = 2,
            Sqlite3 = 3,
        }
        impl Driver {
            /// String value of the enum field names used in the ProtoBuf definition.
            ///
            /// The values are not transformed in any way and thus are considered stable
            /// (if the ProtoBuf definition does not change) and safe for programmatic use.
            pub fn as_str_name(&self) -> &'static str {
                match self {
                    Self::Unspecified => "DRIVER_UNSPECIFIED",
                    Self::Mysql => "DRIVER_MYSQL",
                    Self::Postgres => "DRIVER_POSTGRES",
                    Self::Sqlite3 => "DRIVER_SQLITE3",
                }
            }
            /// Creates an enum from field names used in the ProtoBuf definition.
            pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
                match value {
                    "DRIVER_UNSPECIFIED" => Some(Self::Unspecified),
                    "DRIVER_MYSQL" => Some(Self::Mysql),
                    "DRIVER_POSTGRES" => Some(Self::Postgres),
                    "DRIVER_SQLITE3" => Some(Self::Sqlite3),
                    _ => None,
                }
            }
        }
    }
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct Disk {
        #[prost(string, tag = "1")]
        pub directory: ::prost::alloc::string::String,
    }
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct EmbeddedPdp {
        #[prost(string, tag = "1")]
        pub url: ::prost::alloc::string::String,
        #[prost(string, tag = "2")]
        pub commit_hash: ::prost::alloc::string::String,
        #[prost(message, optional, tag = "3")]
        pub built_at: ::core::option::Option<
            super::super::super::super::google::protobuf::Timestamp,
        >,
    }
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct Git {
        #[prost(string, tag = "1")]
        pub repository_url: ::prost::alloc::string::String,
        #[prost(string, tag = "2")]
        pub branch: ::prost::alloc::string::String,
        #[prost(string, tag = "3")]
        pub subdirectory: ::prost::alloc::string::String,
    }
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct Hub {
        #[prost(oneof = "hub::Source", tags = "1, 2, 3, 4")]
        pub source: ::core::option::Option<hub::Source>,
    }
    /// Nested message and enum types in `Hub`.
    pub mod hub {
        #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
        pub struct LocalBundle {
            #[prost(string, tag = "1")]
            pub path: ::prost::alloc::string::String,
        }
        #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
        pub enum Source {
            #[prost(string, tag = "1")]
            Label(::prost::alloc::string::String),
            #[prost(string, tag = "2")]
            DeploymentId(::prost::alloc::string::String),
            #[prost(string, tag = "3")]
            PlaygroundId(::prost::alloc::string::String),
            #[prost(message, tag = "4")]
            LocalBundle(LocalBundle),
        }
    }
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum Source {
        #[prost(message, tag = "1")]
        Blob(Blob),
        #[prost(message, tag = "2")]
        Database(Database),
        #[prost(message, tag = "3")]
        Disk(Disk),
        #[prost(message, tag = "4")]
        Git(Git),
        #[prost(message, tag = "5")]
        Hub(Hub),
        #[prost(message, tag = "6")]
        EmbeddedPdp(EmbeddedPdp),
    }
}