zitadel-with-serde 0.1.1-alpha.6

An implementation of ZITADEL API access and authentication in Rust. Now with support for serde for easy JSON serialization and deserialization.
Documentation
// @generated
// This file is @generated by prost-build.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Authorization {
    /// ID is the unique identifier of the authorization.
    #[prost(string, tag="1")]
    pub id: ::prost::alloc::string::String,
    /// ID is the unique identifier of the project the user was granted the authorization for.
    #[prost(string, tag="2")]
    pub project_id: ::prost::alloc::string::String,
    /// Name is the name of the project the user was granted the authorization for.
    #[prost(string, tag="3")]
    pub project_name: ::prost::alloc::string::String,
    /// OrganizationID is the ID of the organization the project belongs to.
    #[prost(string, tag="4")]
    pub project_organization_id: ::prost::alloc::string::String,
    /// ID of the granted project, only provided if it is a granted project.
    #[prost(string, optional, tag="5")]
    pub project_grant_id: ::core::option::Option<::prost::alloc::string::String>,
    /// ID of the organization the project is granted to, only provided if it is a granted project.
    #[prost(string, optional, tag="6")]
    pub granted_organization_id: ::core::option::Option<::prost::alloc::string::String>,
    /// The unique identifier of the organization the authorization belongs to.
    #[prost(string, tag="7")]
    pub organization_id: ::prost::alloc::string::String,
    /// CreationDate is the timestamp when the authorization was created.
    #[prost(message, optional, tag="8")]
    pub creation_date: ::core::option::Option<::pbjson_types::Timestamp>,
    /// ChangeDate is the timestamp when the authorization was last updated.
    /// In case the authorization was not updated, this field is equal to the creation date.
    #[prost(message, optional, tag="9")]
    pub change_date: ::core::option::Option<::pbjson_types::Timestamp>,
    /// State is the current state of the authorization.
    #[prost(enumeration="State", tag="10")]
    pub state: i32,
    #[prost(message, optional, tag="11")]
    pub user: ::core::option::Option<User>,
    /// Roles contains the roles the user was granted for the project.
    #[prost(string, repeated, tag="12")]
    pub roles: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct User {
    /// ID represents the ID of the user who was granted the authorization.
    #[prost(string, tag="1")]
    pub id: ::prost::alloc::string::String,
    /// PreferredLoginName represents the preferred login name of the granted user.
    #[prost(string, tag="2")]
    pub preferred_login_name: ::prost::alloc::string::String,
    /// DisplayName represents the public display name of the granted user.
    #[prost(string, tag="3")]
    pub display_name: ::prost::alloc::string::String,
    /// AvatarURL is the URL to the user's public avatar image.
    #[prost(string, tag="4")]
    pub avatar_url: ::prost::alloc::string::String,
    /// The organization the user belong to.
    /// This does not have to correspond with the authorizations organization.
    #[prost(string, tag="5")]
    pub organization_id: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AuthorizationsSearchFilter {
    #[prost(oneof="authorizations_search_filter::Filter", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11")]
    pub filter: ::core::option::Option<authorizations_search_filter::Filter>,
}
/// Nested message and enum types in `AuthorizationsSearchFilter`.
pub mod authorizations_search_filter {
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(crate = "serde", rename_all = "snake_case")]
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Filter {
        /// Search for authorizations by their IDs.
        #[prost(message, tag="1")]
        AuthorizationIds(super::super::super::filter::v2beta::InIDsFilter),
        /// Search for an organizations authorizations by its ID.
        #[prost(message, tag="2")]
        OrganizationId(super::super::super::filter::v2beta::IdFilter),
        /// Search for authorizations by their state.
        #[prost(message, tag="3")]
        State(super::StateQuery),
        /// Search for authorizations by the ID of the user who was granted the authorization.
        #[prost(message, tag="4")]
        UserId(super::super::super::filter::v2beta::IdFilter),
        /// Search for authorizations by the ID of the organisation the user is part of.
        #[prost(message, tag="5")]
        UserOrganizationId(super::super::super::filter::v2beta::IdFilter),
        /// Search for authorizations by the preferred login name of the granted user.
        #[prost(message, tag="6")]
        UserPreferredLoginName(super::UserPreferredLoginNameQuery),
        /// Search for authorizations by the public display name of the granted user.
        #[prost(message, tag="7")]
        UserDisplayName(super::UserDisplayNameQuery),
        /// Search for authorizations by the ID of the project the user was granted the authorization for.
        /// This will also include authorizations granted for project grants of the same project.
        #[prost(message, tag="8")]
        ProjectId(super::super::super::filter::v2beta::IdFilter),
        /// Search for authorizations by the name of the project the user was granted the authorization for.
        /// This will also include authorizations granted for project grants of the same project.
        #[prost(message, tag="9")]
        ProjectName(super::ProjectNameQuery),
        /// Search for authorizations by the key of the role the user was granted.
        #[prost(message, tag="10")]
        RoleKey(super::RoleKeyQuery),
        /// Search for authorizations by the ID of the project grant the user was granted the authorization for.
        /// This will also include authorizations granted for project grants of the same project.
        #[prost(message, tag="11")]
        ProjectGrantId(super::super::super::filter::v2beta::IdFilter),
    }
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct StateQuery {
    /// Specify the state of the authorization to search for.
    #[prost(enumeration="State", tag="1")]
    pub state: i32,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UserPreferredLoginNameQuery {
    /// Specify the preferred login name of the granted user to search for.
    #[prost(string, tag="1")]
    pub login_name: ::prost::alloc::string::String,
    /// Specify the method to search for the preferred login name. Default is EQUAL.
    /// For example, to search for all authorizations granted to a user with
    /// a preferred login name containing a specific string, use CONTAINS or CONTAINS_IGNORE_CASE.
    #[prost(enumeration="super::super::filter::v2beta::TextFilterMethod", tag="2")]
    pub method: i32,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UserDisplayNameQuery {
    /// Specify the public display name of the granted user to search for.
    #[prost(string, tag="1")]
    pub display_name: ::prost::alloc::string::String,
    /// Specify the method to search for the display name. Default is EQUAL.
    /// For example, to search for all authorizations granted to a user with
    /// a display name containing a specific string, use CONTAINS or CONTAINS_IGNORE_CASE.
    #[prost(enumeration="super::super::filter::v2beta::TextFilterMethod", tag="2")]
    pub method: i32,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProjectNameQuery {
    /// Specify the name of the project the user was granted the authorization for to search for.
    /// Note that this will also include authorizations granted for project grants of the same project.
    #[prost(string, tag="1")]
    pub name: ::prost::alloc::string::String,
    /// Specify the method to search for the project name. Default is EQUAL.
    /// For example, to search for all authorizations granted on a project with
    /// a name containing a specific string, use CONTAINS or CONTAINS_IGNORE_CASE.
    #[prost(enumeration="super::super::filter::v2beta::TextFilterMethod", tag="2")]
    pub method: i32,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OrganizationNameQuery {
    /// Specify the name of the organization the authorization was granted for to search for.
    /// This can either be the organization the project or the project grant is part of.
    #[prost(string, tag="1")]
    pub name: ::prost::alloc::string::String,
    /// Specify the method to search for the organization name. Default is EQUAL.
    /// For example, to search for all authorizations with an organization name containing a specific string,
    /// use CONTAINS or CONTAINS_IGNORE_CASE.
    #[prost(enumeration="super::super::filter::v2beta::TextFilterMethod", tag="2")]
    pub method: i32,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RoleKeyQuery {
    /// Specify the key of the role the user was granted to search for.
    #[prost(string, tag="1")]
    pub key: ::prost::alloc::string::String,
    /// Specify the method to search for the role key. Default is EQUAL.
    /// For example, to search for all authorizations starting with a specific role key,
    /// use STARTS_WITH or STARTS_WITH_IGNORE_CASE.
    #[prost(enumeration="super::super::filter::v2beta::TextFilterMethod", tag="2")]
    pub method: i32,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum State {
    Unspecified = 0,
    /// An active authorization grants the user access with the roles specified on the project.
    Active = 1,
    /// An inactive authorization temporarily deactivates the granted access and roles.
    /// ZITADEL will not include the specific authorization in any authorization information like an access token.
    /// But the information can still be accessed using the API.
    Inactive = 2,
}
impl State {
    /// 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 => "STATE_UNSPECIFIED",
            Self::Active => "STATE_ACTIVE",
            Self::Inactive => "STATE_INACTIVE",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "STATE_UNSPECIFIED" => Some(Self::Unspecified),
            "STATE_ACTIVE" => Some(Self::Active),
            "STATE_INACTIVE" => Some(Self::Inactive),
            _ => None,
        }
    }
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum AuthorizationFieldName {
    Unspecified = 0,
    CreatedDate = 1,
    ChangedDate = 2,
    Id = 3,
    UserId = 4,
    ProjectId = 5,
    OrganizationId = 6,
    UserOrganizationId = 7,
}
impl AuthorizationFieldName {
    /// 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 => "AUTHORIZATION_FIELD_NAME_UNSPECIFIED",
            Self::CreatedDate => "AUTHORIZATION_FIELD_NAME_CREATED_DATE",
            Self::ChangedDate => "AUTHORIZATION_FIELD_NAME_CHANGED_DATE",
            Self::Id => "AUTHORIZATION_FIELD_NAME_ID",
            Self::UserId => "AUTHORIZATION_FIELD_NAME_USER_ID",
            Self::ProjectId => "AUTHORIZATION_FIELD_NAME_PROJECT_ID",
            Self::OrganizationId => "AUTHORIZATION_FIELD_NAME_ORGANIZATION_ID",
            Self::UserOrganizationId => "AUTHORIZATION_FIELD_NAME_USER_ORGANIZATION_ID",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "AUTHORIZATION_FIELD_NAME_UNSPECIFIED" => Some(Self::Unspecified),
            "AUTHORIZATION_FIELD_NAME_CREATED_DATE" => Some(Self::CreatedDate),
            "AUTHORIZATION_FIELD_NAME_CHANGED_DATE" => Some(Self::ChangedDate),
            "AUTHORIZATION_FIELD_NAME_ID" => Some(Self::Id),
            "AUTHORIZATION_FIELD_NAME_USER_ID" => Some(Self::UserId),
            "AUTHORIZATION_FIELD_NAME_PROJECT_ID" => Some(Self::ProjectId),
            "AUTHORIZATION_FIELD_NAME_ORGANIZATION_ID" => Some(Self::OrganizationId),
            "AUTHORIZATION_FIELD_NAME_USER_ORGANIZATION_ID" => Some(Self::UserOrganizationId),
            _ => None,
        }
    }
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListAuthorizationsRequest {
    /// Paginate through the results using a limit, offset and sorting.
    #[prost(message, optional, tag="1")]
    pub pagination: ::core::option::Option<super::super::filter::v2beta::PaginationRequest>,
    /// The field the result is sorted by. The default is the creation date. Beware that if you change this, your result pagination might be inconsistent.
    #[prost(enumeration="AuthorizationFieldName", optional, tag="2")]
    pub sorting_column: ::core::option::Option<i32>,
    /// Define the criteria to query for.
    #[prost(message, repeated, tag="3")]
    pub filters: ::prost::alloc::vec::Vec<AuthorizationsSearchFilter>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListAuthorizationsResponse {
    /// Details contains the pagination information.
    #[prost(message, optional, tag="1")]
    pub pagination: ::core::option::Option<super::super::filter::v2beta::PaginationResponse>,
    #[prost(message, repeated, tag="2")]
    pub authorizations: ::prost::alloc::vec::Vec<Authorization>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateAuthorizationRequest {
    /// UserID is the ID of the user who should be granted the authorization.
    #[prost(string, tag="1")]
    pub user_id: ::prost::alloc::string::String,
    /// Project ID is the ID of the project the user should be authorized for.
    #[prost(string, tag="2")]
    pub project_id: ::prost::alloc::string::String,
    /// OrganizationID is the ID of the organization on which the authorization should be created.
    /// The organization must either own the project or have a grant for the project.
    /// If omitted, the authorization is created on the projects organization.
    #[prost(string, optional, tag="3")]
    pub organization_id: ::core::option::Option<::prost::alloc::string::String>,
    /// RoleKeys are the keys of the roles the user should be granted.
    #[prost(string, repeated, tag="4")]
    pub role_keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateAuthorizationResponse {
    /// ID is the unique identifier of the newly created authorization.
    #[prost(string, tag="1")]
    pub id: ::prost::alloc::string::String,
    /// CreationDate is the timestamp when the authorization was created.
    #[prost(message, optional, tag="2")]
    pub creation_date: ::core::option::Option<::pbjson_types::Timestamp>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateAuthorizationRequest {
    /// ID is the unique identifier of the authorization.
    #[prost(string, tag="1")]
    pub id: ::prost::alloc::string::String,
    /// RoleKeys are the keys of the roles the user should be granted.
    /// Note that any role keys previously granted to the user and not present in the list will be revoked.
    #[prost(string, repeated, tag="2")]
    pub role_keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct UpdateAuthorizationResponse {
    /// ChangeDate is the timestamp when the authorization was last updated.
    #[prost(message, optional, tag="1")]
    pub change_date: ::core::option::Option<::pbjson_types::Timestamp>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteAuthorizationRequest {
    /// ID is the unique identifier of the authorization that should be deleted.
    #[prost(string, tag="1")]
    pub id: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DeleteAuthorizationResponse {
    /// DeletionDate is the timestamp when the authorization was deleted.
    #[prost(message, optional, tag="1")]
    pub deletion_date: ::core::option::Option<::pbjson_types::Timestamp>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ActivateAuthorizationRequest {
    /// ID is the unique identifier of the authorization that should be activated.
    #[prost(string, tag="1")]
    pub id: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ActivateAuthorizationResponse {
    /// ChangeDate is the last timestamp when the authorization was changed / activated.
    #[prost(message, optional, tag="1")]
    pub change_date: ::core::option::Option<::pbjson_types::Timestamp>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeactivateAuthorizationRequest {
    /// ID is the unique identifier of the authorization that should be deactivated.
    #[prost(string, tag="1")]
    pub id: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DeactivateAuthorizationResponse {
    /// ChangeDate is the last timestamp when the authorization was changed / deactivated.
    #[prost(message, optional, tag="1")]
    pub change_date: ::core::option::Option<::pbjson_types::Timestamp>,
}
include!("zitadel.authorization.v2beta.tonic.rs");
// @@protoc_insertion_point(module)