pub enum ApiKeyKind {
Zone,
Personal,
}Expand description
Which kind of API key a key is, read from its prefix. Core decides by the same prefix, so this is known without a request.
Variants§
Zone
dz_…: full access to exactly one zone, no user behind it. Issued by
Zones::create_api_key.
Personal
du_…: the access of the user it belongs to. Issued by
Users::create_api_key.
Implementations§
Source§impl ApiKeyKind
impl ApiKeyKind
Sourcepub fn of(key: &str) -> Option<Self>
pub fn of(key: &str) -> Option<Self>
The kind of key, or None if it has neither prefix. Core treats such a token as a
JWT, so a key without a prefix (e.g. one from before Core issued keys) gets
ErrorCode::InvalidToken.
§Examples
use dinio_sdk::ApiKeyKind;
assert_eq!(ApiKeyKind::of("dz_abc"), Some(ApiKeyKind::Zone));
assert_eq!(ApiKeyKind::of("du_abc"), Some(ApiKeyKind::Personal));
assert_eq!(ApiKeyKind::of("dinio_abc"), None);Trait Implementations§
Source§impl Clone for ApiKeyKind
impl Clone for ApiKeyKind
Source§fn clone(&self) -> ApiKeyKind
fn clone(&self) -> ApiKeyKind
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ApiKeyKind
Source§impl Debug for ApiKeyKind
impl Debug for ApiKeyKind
Source§impl Display for ApiKeyKind
impl Display for ApiKeyKind
impl Eq for ApiKeyKind
Source§impl Hash for ApiKeyKind
impl Hash for ApiKeyKind
Source§impl PartialEq for ApiKeyKind
impl PartialEq for ApiKeyKind
impl StructuralPartialEq for ApiKeyKind
Auto Trait Implementations§
impl Freeze for ApiKeyKind
impl RefUnwindSafe for ApiKeyKind
impl Send for ApiKeyKind
impl Sync for ApiKeyKind
impl Unpin for ApiKeyKind
impl UnsafeUnpin for ApiKeyKind
impl UnwindSafe for ApiKeyKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.