Skip to main content

IamCache

Struct IamCache 

Source
pub struct IamCache<T> {
    pub cache: Cache,
    pub api: T,
    pub state: Arc<AtomicU8>,
    pub loading: Arc<AtomicBool>,
    pub roles: HashMap<ARN, Vec<String>>,
    pub send_chan: Sender<i64>,
    pub last_timestamp: AtomicI64,
    pub sync_failures: AtomicU64,
    pub sync_successes: AtomicU64,
    pub last_sync_duration_millis: AtomicU64,
}

Fields§

§cache: Cache§api: T§state: Arc<AtomicU8>§loading: Arc<AtomicBool>§roles: HashMap<ARN, Vec<String>>§send_chan: Sender<i64>§last_timestamp: AtomicI64§sync_failures: AtomicU64§sync_successes: AtomicU64§last_sync_duration_millis: AtomicU64

Implementations§

Source§

impl<T> IamCache<T>
where T: Store,

Source

pub fn is_ready(&self) -> bool

Check if IAM system is ready

Source

pub fn sync_metrics_snapshot(&self) -> IamSyncMetricsSnapshot

Source

pub async fn load_user(&self, access_key: &str) -> Result<()>

Source

pub async fn get_user(&self, access_key: &str) -> Option<UserIdentity>

Source

pub async fn get_mapped_policy( &self, name: &str, is_group: bool, ) -> Option<MappedPolicy>

Source

pub async fn get_mapped_policy_record( &self, name: &str, user_type: UserType, is_group: bool, ) -> Option<MappedPolicy>

The cached mapping record for one user or group, looked up in the same cache partition policy_db_set writes it to (group / STS / regular+service user). None when no mapping is stored.

Source

pub async fn get_group_info(&self, name: &str) -> Option<GroupInfo>

The cached group record (members, status, own timestamp) without the mapped-policy overlay get_group_description applies. None when the group does not exist.

Source

pub async fn get_policy(&self, name: &str) -> Result<Policy>

Source

pub async fn get_policy_doc(&self, name: &str) -> Result<PolicyDoc>

Source

pub async fn delete_policy( &self, name: &str, is_from_notify: bool, ) -> Result<()>

Source

pub async fn set_policy( &self, name: &str, policy: Policy, ) -> Result<OffsetDateTime>

Source

pub async fn set_policy_at( &self, name: &str, policy: Policy, updated_at: OffsetDateTime, ) -> Result<OffsetDateTime>

Self::set_policy stamping the document with updated_at instead of the local clock.

A site-replication receiver passes the edit’s source time: the next incoming revision is judged against the stored UpdateDate, so a local stamp would reject a newer source edit that was merely delivered later (backlog#2291). The returned stamp is the one persisted.

Source

pub async fn list_policies( &self, bucket_name: &str, ) -> Result<HashMap<String, Policy>>

Source

pub async fn list_polices( &self, bucket_name: &str, ) -> Result<HashMap<String, Policy>>

👎Deprecated since 1.0.0:

use list_policies instead; this alias will be removed in the next breaking release

Backward-compatible misspelling retained until the next breaking release.

Source

pub async fn merge_policies(&self, name: &str) -> (String, Policy)

Source

pub async fn list_policy_docs( &self, bucket_name: &str, ) -> Result<HashMap<String, PolicyDoc>>

Source

pub async fn list_policy_docs_internal( &self, bucket_name: &str, ) -> Result<HashMap<String, PolicyDoc>>

Source

pub async fn list_temp_accounts( &self, access_key: &str, ) -> Result<Vec<UserIdentity>>

Source

pub async fn list_sts_accounts( &self, access_key: &str, ) -> Result<Vec<Credentials>>

Source

pub async fn list_service_accounts( &self, access_key: &str, ) -> Result<Vec<Credentials>>

Source

pub async fn add_service_account( &self, cred: Credentials, ) -> Result<OffsetDateTime>

create a service account and update cache

Source

pub async fn add_service_account_at( &self, cred: Credentials, updated_at: OffsetDateTime, ) -> Result<OffsetDateTime>

Self::add_service_account stamping the identity with updated_at instead of the local clock; see Self::set_policy_at (backlog#2291).

Source

pub async fn update_service_account( &self, name: &str, opts: UpdateServiceAccountOpts, ) -> Result<OffsetDateTime>

Source

pub async fn update_service_account_at( &self, name: &str, opts: UpdateServiceAccountOpts, updated_at: OffsetDateTime, ) -> Result<OffsetDateTime>

Self::update_service_account stamping the identity with updated_at instead of the local clock; see Self::set_policy_at (backlog#2291).

Source

pub async fn policy_db_get( &self, name: &str, groups: &Option<Vec<String>>, ) -> Result<Vec<String>>

Source

pub async fn sts_policy_db_get( &self, name: &str, groups: &Option<Vec<String>>, ) -> Result<Vec<String>>

Source

pub async fn policy_db_set( &self, name: &str, user_type: UserType, is_group: bool, policy: &str, ) -> Result<OffsetDateTime>

Source

pub async fn policy_db_set_at( &self, name: &str, user_type: UserType, is_group: bool, policy: &str, updated_at: OffsetDateTime, ) -> Result<OffsetDateTime>

Self::policy_db_set stamping the mapping with updated_at instead of the local clock; see Self::set_policy_at (backlog#2291).

Source

pub async fn set_temp_user( &self, access_key: &str, cred: &Credentials, policy_name: Option<&str>, ) -> Result<OffsetDateTime>

Source

pub async fn get_user_info(&self, name: &str) -> Result<UserInfo>

Source

pub async fn get_users(&self) -> Result<HashMap<String, UserInfo>>

Source

pub async fn get_bucket_users( &self, bucket_name: &str, ) -> Result<HashMap<String, UserInfo>>

Source

pub async fn get_users_with_mapped_policies(&self) -> HashMap<String, String>

Source

pub async fn add_user( &self, access_key: &str, args: &AddOrUpdateUserReq, ) -> Result<OffsetDateTime>

Source

pub async fn add_user_at( &self, access_key: &str, args: &AddOrUpdateUserReq, updated_at: OffsetDateTime, ) -> Result<OffsetDateTime>

Self::add_user stamping the identity with updated_at instead of the local clock; see Self::set_policy_at (backlog#2291).

Source

pub async fn delete_user(&self, access_key: &str, utype: UserType) -> Result<()>

Source

pub async fn delete_service_account_with_revision( &self, access_key: &str, ) -> Result<OffsetDateTime>

Source

pub async fn update_user_secret_key( &self, access_key: &str, secret_key: &str, ) -> Result<(OffsetDateTime, AccountStatus)>

Source

pub async fn add_user_ssh_public_key( &self, access_key: &str, public_key: &str, ) -> Result<()>

Add SSH public key for a user (for SFTP authentication)

Source

pub async fn set_user_status( &self, access_key: &str, status: AccountStatus, ) -> Result<OffsetDateTime>

Source

pub async fn set_user_status_at( &self, access_key: &str, status: AccountStatus, updated_at: OffsetDateTime, ) -> Result<OffsetDateTime>

Self::set_user_status stamping the identity with updated_at instead of the local clock; see Self::set_policy_at (backlog#2291).

Source

pub async fn is_temp_user(&self, access_key: &str) -> Result<(bool, String)>

Source

pub async fn add_users_to_group( &self, group: &str, members: Vec<String>, ) -> Result<OffsetDateTime>

Source

pub async fn add_users_to_group_at( &self, group: &str, members: Vec<String>, updated_at: OffsetDateTime, ) -> Result<OffsetDateTime>

Self::add_users_to_group stamping the group with updated_at instead of the local clock; see Self::set_policy_at (backlog#2291).

Source

pub async fn set_group_status( &self, name: &str, enable: bool, ) -> Result<OffsetDateTime>

Source

pub async fn set_group_status_at( &self, name: &str, enable: bool, updated_at: OffsetDateTime, ) -> Result<OffsetDateTime>

Self::set_group_status stamping the group with updated_at instead of the local clock; see Self::set_policy_at (backlog#2291).

Source

pub async fn get_group_description(&self, name: &str) -> Result<GroupDesc>

Source

pub async fn list_groups(&self) -> Result<Vec<String>>

Source

pub async fn update_groups(&self) -> Result<Vec<String>>

Source

pub async fn remove_members_from_group( &self, name: &str, members: Vec<String>, update_cache_only: bool, ) -> Result<OffsetDateTime>

Source

pub async fn remove_members_from_group_at( &self, name: &str, members: Vec<String>, update_cache_only: bool, updated_at: OffsetDateTime, ) -> Result<OffsetDateTime>

Self::remove_members_from_group stamping the group with updated_at instead of the local clock; see Self::set_policy_at (backlog#2291).

Source

pub async fn remove_users_from_group( &self, group: &str, members: Vec<String>, ) -> Result<OffsetDateTime>

Source

pub async fn remove_users_from_group_at( &self, group: &str, members: Vec<String>, updated_at: OffsetDateTime, ) -> Result<OffsetDateTime>

Self::remove_users_from_group stamping the group with updated_at instead of the local clock; a group delete (no members) leaves no record and returns the stamp unchanged (backlog#2291).

Source

pub async fn group_notification_handler(&self, group: &str) -> Result<()>

Source

pub async fn policy_notification_handler(&self, policy: &str) -> Result<()>

Source

pub async fn policy_mapping_notification_handler( &self, name: &str, user_type: UserType, is_group: bool, ) -> Result<()>

Source

pub async fn user_notification_handler( &self, name: &str, user_type: UserType, ) -> Result<()>

Auto Trait Implementations§

§

impl<T> !Freeze for IamCache<T>

§

impl<T> !RefUnwindSafe for IamCache<T>

§

impl<T> Forget for IamCache<T>

§

impl<T> Move for IamCache<T>

§

impl<T> Send for IamCache<T>
where T: Send, Atomic<*mut CacheState>: Send, Arc<CacheState>: Send, Mutex<()>: Send, Mutex<()>: Send, Arc<StsMutationLockRegistry>: Send, Arc<Atomic<u8>>: Send, Arc<Atomic<bool>>: Send, RawTable<(ARN, Vec<String>)>: Send, Arc<Chan<i64, Semaphore>>: Send, Atomic<i64>: Send, Atomic<u64>: Send,

§

impl<T> Sync for IamCache<T>
where T: Sync, Atomic<*mut CacheState>: Sync, Arc<CacheState>: Sync, Mutex<()>: Sync, Mutex<()>: Sync, Arc<StsMutationLockRegistry>: Sync, Arc<Atomic<u8>>: Sync, Arc<Atomic<bool>>: Sync, RawTable<(ARN, Vec<String>)>: Sync, Arc<Chan<i64, Semaphore>>: Sync, Atomic<i64>: Sync, Atomic<u64>: Sync,

§

impl<T> Unpin for IamCache<T>
where T: Unpin, Align8<*mut CacheState>: Unpin, Arc<CacheState>: Unpin, Align4<u32>: Unpin, Align1<u8>: Unpin, *const Waiter is !null: Unpin, Align8<usize>: Unpin, Arc<StsMutationLockRegistry>: Unpin, Arc<Atomic<u8>>: Unpin, Arc<Atomic<bool>>: Unpin, *const u8 is !null: Unpin, Arc<Chan<i64, Semaphore>>: Unpin, Align8<i64>: Unpin, Align8<u64>: Unpin,

§

impl<T> UnsafeUnpin for IamCache<T>
where Align8<*mut CacheState>: UnsafeUnpin, PhantomData<Arc<CacheState>>: UnsafeUnpin, Align4<u32>: UnsafeUnpin, Align1<u8>: UnsafeUnpin, *const Waiter is !null: UnsafeUnpin, Align8<usize>: UnsafeUnpin, *const ArcInner<StsMutationLockRegistry> is !null: UnsafeUnpin, PhantomData<ArcInner<StsMutationLockRegistry>>: UnsafeUnpin, T: UnsafeUnpin, *const ArcInner<Atomic<u8>> is !null: UnsafeUnpin, PhantomData<ArcInner<Atomic<u8>>>: UnsafeUnpin, *const ArcInner<Atomic<bool>> is !null: UnsafeUnpin, PhantomData<ArcInner<Atomic<bool>>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<(ARN, Vec<String>)>: UnsafeUnpin, *const ArcInner<Chan<i64, Semaphore>> is !null: UnsafeUnpin, PhantomData<ArcInner<Chan<i64, Semaphore>>>: UnsafeUnpin, Align8<i64>: UnsafeUnpin, Align8<u64>: UnsafeUnpin,

§

impl<T> UnwindSafe for IamCache<T>
where Align8<*mut CacheState>: UnwindSafe, Arc<CacheState>: UnwindSafe, Mutex<()>: UnwindSafe, Mutex<Waitlist>: UnwindSafe, AtomicUsize: UnwindSafe, Arc<StsMutationLockRegistry>: UnwindSafe, T: UnwindSafe, Arc<Atomic<u8>>: UnwindSafe, Arc<Atomic<bool>>: UnwindSafe, HashMap<ARN, Vec<String>>: UnwindSafe, Arc<Chan<i64, Semaphore>>: UnwindSafe, Align8<i64>: UnwindSafe, Align8<u64>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromExt for T

Source§

fn from_<T>(t: T) -> Self
where Self: From<T>,

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoExt for T

Source§

fn into_<T>(self) -> T
where Self: Into<T>,

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T> TryFromExt for T

Source§

fn try_from_<T>(t: T) -> Result<Self, Self::Error>
where Self: TryFrom<T>,

Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> TryIntoExt for T

Source§

fn try_into_<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more