hank-types 0.1.8

Generated type definitions for Hank
Documentation
// @generated
// This file is @generated by prost-build.
/// The operation for the access check, i.e. AND/OR
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum AccessCheckOperator {
    And = 0,
    Or = 1,
}
impl AccessCheckOperator {
    /// 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 {
            AccessCheckOperator::And => "AND",
            AccessCheckOperator::Or => "OR",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "AND" => Some(Self::And),
            "OR" => Some(Self::Or),
            _ => None,
        }
    }
}
/// An individual access check
///
/// Individual access checks test a user for specific access, or can be a
/// nested chain.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AccessCheck {
    #[prost(oneof="access_check::Kind", tags="1, 2, 3")]
    #[serde(flatten)]
    pub kind: ::core::option::Option<access_check::Kind>,
}
/// Nested message and enum types in `AccessCheck`.
pub mod access_check {
    #[derive(serde::Serialize, serde::Deserialize)]
    #[serde(rename_all = "snake_case")]
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Kind {
        /// A nested AccessCheckChain
        ///
        /// Access check chains can be nested to allow representations of more
        /// compelx logic.
        #[prost(message, tag="1")]
        Chain(super::AccessCheckChain),
        /// A user access check
        ///
        /// Checks if the user requesting access matches this user.
        ///
        /// Can be a user id or a user name.
        #[prost(string, tag="2")]
        User(::prost::alloc::string::String),
        /// A role access check
        ///
        /// Checks if the user requesting access has this role.
        ///
        /// Can be a role id or a role name.
        #[prost(string, tag="3")]
        Role(::prost::alloc::string::String),
    }
}
/// A chain of acess checks
///
/// Access Checks are used to determine if a user has access to a piece of
/// functionality. A chain of checks and nested chains can be used to represent
/// access logic.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AccessCheckChain {
    /// The operator to use for this chain, i.e. AND/OR
    ///
    /// All access checks in this chain will be combined using this operator.
    #[prost(enumeration="AccessCheckOperator", tag="1")]
    pub operator: i32,
    /// A list of access checks to execute in this chain
    #[prost(message, repeated, tag="2")]
    pub checks: ::prost::alloc::vec::Vec<AccessCheck>,
}
// @@protoc_insertion_point(module)