pub struct AccountPolicy { /* private fields */ }Expand description
Per-provider account selection. Built once from config (+ env overlay); never mutates the process environment or the active profile.
Implementations§
Source§impl AccountPolicy
impl AccountPolicy
pub fn new() -> AccountPolicy
pub fn set(&mut self, provider: OAuthProviderId, selector: AccountSelector)
pub fn with( self, provider: OAuthProviderId, selector: AccountSelector, ) -> AccountPolicy
pub fn selector(&self, provider: OAuthProviderId) -> AccountSelector
pub fn is_empty(&self) -> bool
Sourcepub fn from_config_map(
map: &BTreeMap<String, String>,
) -> (AccountPolicy, Vec<String>)
pub fn from_config_map( map: &BTreeMap<String, String>, ) -> (AccountPolicy, Vec<String>)
Build from the auth.account.<provider> = <label|auto> map.
Fail closed: a malformed label for a known provider becomes
AccountSelector::Invalid, so every later resolution for that
provider errors instead of quietly using the default (or any other)
account. Unknown providers cannot affect resolution and are reported
as warnings only. Empty values mean “unset”.
Sourcepub fn with_env_overlay(self) -> AccountPolicy
pub fn with_env_overlay(self) -> AccountPolicy
Apply SYNAPS_ACCOUNT_<PROVIDER> overrides on top of self. A
malformed value fails closed for that provider (a typo must never
redirect traffic to a different account). Empty values are ignored.
Sourcepub fn from_environment() -> AccountPolicy
pub fn from_environment() -> AccountPolicy
Precedence: env SYNAPS_ACCOUNT_<PROVIDER> > config
auth.account.<provider> > default. Reads the active profile’s config
file; never writes anything.
Sourcepub fn resolve(
&self,
provider: OAuthProviderId,
) -> Result<CredentialRef, BrokerError>
pub fn resolve( &self, provider: OAuthProviderId, ) -> Result<CredentialRef, BrokerError>
Resolve the credential to use for provider when the caller did not
pin one. Auto is not resolvable here (the broker consults its
capacity selector); Invalid always errors.
Trait Implementations§
Source§impl Clone for AccountPolicy
impl Clone for AccountPolicy
Source§fn clone(&self) -> AccountPolicy
fn clone(&self) -> AccountPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AccountPolicy
impl Debug for AccountPolicy
Source§impl Default for AccountPolicy
impl Default for AccountPolicy
Source§fn default() -> AccountPolicy
fn default() -> AccountPolicy
impl Eq for AccountPolicy
Source§impl PartialEq for AccountPolicy
impl PartialEq for AccountPolicy
impl StructuralPartialEq for AccountPolicy
Auto Trait Implementations§
impl Freeze for AccountPolicy
impl RefUnwindSafe for AccountPolicy
impl Send for AccountPolicy
impl Sync for AccountPolicy
impl Unpin for AccountPolicy
impl UnsafeUnpin for AccountPolicy
impl UnwindSafe for AccountPolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.