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() -> Self
pub fn set(&mut self, provider: OAuthProviderId, selector: AccountSelector)
pub fn with(self, provider: OAuthProviderId, selector: AccountSelector) -> Self
pub fn selector(&self, provider: OAuthProviderId) -> AccountSelector
pub fn is_empty(&self) -> bool
Sourcepub fn from_config_map(map: &BTreeMap<String, String>) -> (Self, Vec<String>)
pub fn from_config_map(map: &BTreeMap<String, String>) -> (Self, 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) -> Self
pub fn with_env_overlay(self) -> Self
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() -> Self
pub fn from_environment() -> Self
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§impl Debug for AccountPolicy
impl Debug for AccountPolicy
Source§impl Default for AccountPolicy
impl Default for 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<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.