pub struct ApiKeyAccounts { /* private fields */ }Expand description
API-key accounts as a provider of account_provider, under the id api_key_accounts.
A key is handed over in the grant’s sealed credentials for each call and goes nowhere but to the account’s own
endpoint (a rate-limits read) or to the harness’s environment or login standard input (a models listing).
Implementations§
Source§impl ApiKeyAccounts
impl ApiKeyAccounts
Sourcepub fn new(settings: ApiKeySettings) -> Self
pub fn new(settings: ApiKeySettings) -> Self
A provider configured as settings say.
Trait Implementations§
Source§impl AccountProvider for ApiKeyAccounts
impl AccountProvider for ApiKeyAccounts
Source§fn describe(&self) -> Result<AccountProviderInfo, ProviderError>
fn describe(&self) -> Result<AccountProviderInfo, ProviderError>
Who the provider is, for a host listing its providers. Cheap, and the same on every call.
Source§fn offers(&self) -> Result<AccountOffer, ProviderError>
fn offers(&self) -> Result<AccountOffer, ProviderError>
The kinds of account it makes, the ways to sign in, and which kinds report usage. Cheap,
the same on every call, and answered as configured.
Source§fn provides(&self, account: AccountRef) -> Result<Vec<String>, ProviderError>
fn provides(&self, account: AccountRef) -> Result<Vec<String>, ProviderError>
The standards the account
account provides: every one it can be used as, the ids a harness
matches against what it accepts. An account names only its kind and settings; this is where
they are read. A kind that lists provides answers that list, and a kind whose settings pick
the standards (PROVIDES_BY_VALUE is the usual way)
answers what the account’s settings pick. The answer is the account’s, not the credentials’:
it reads account.settings and no secret, and account.provides is no input. Each id is a
standard id, none twice. May be empty for an account that cannot be
used yet. Read moreSource§fn login(
&self,
request: LoginRequest,
spawner: Object<dyn ProcessSpawner>,
prompter: Object<dyn LoginPrompter>,
) -> Result<LoginOutcome, ProviderError>
fn login( &self, request: LoginRequest, spawner: Object<dyn ProcessSpawner>, prompter: Object<dyn LoginPrompter>, ) -> Result<LoginOutcome, ProviderError>
Signs in to make an account of the kind the method
request.method produces. The provider
runs the sign-in in request.state_dir (a program on a terminal where it needs one)
through spawner, reads what it prints and relays each step through prompter, and at the
end reads the files it wrote into the outcome’s credentials. spawner and prompter are
handed over: the provider destroys both before it answers, a timeout excepted (see below). Read moreSource§fn renew(
&self,
request: RenewRequest,
spawner: Object<dyn ProcessSpawner>,
) -> Result<RenewReport, ProviderError>
fn renew( &self, request: RenewRequest, spawner: Object<dyn ProcessSpawner>, ) -> Result<RenewReport, ProviderError>
Renews the credentials of
request.account with no model turn. Answers the new
credentials, or why nothing changed. GUATIAO_ERR_UNSUPPORTED, with the reason, for a
kind whose entry says renews false; GUATIAO_ERR_BAD_VALUE for a kind it does not list,
an id that is not 1 to 128 bytes without a control character, or a credential that is
missing. spawner is handed over as login’s is. A refused renewal that lost the login is
GUATIAO_ERR_GONE with the reason, and the blank copy is never answered.Source§fn watch(
&self,
request: WatchRequest,
spawner: Object<dyn ProcessSpawner>,
keeper: Object<dyn AccountKeeper>,
) -> Result<Object<dyn AccountWatch>, ProviderError>
fn watch( &self, request: WatchRequest, spawner: Object<dyn ProcessSpawner>, keeper: Object<dyn AccountKeeper>, ) -> Result<Object<dyn AccountWatch>, ProviderError>
Starts watching the account
request.account names for a credential its program renewed or
lost behind the host’s back: the files in its state_dir, read through spawner. The
watch tells keeper of each change, from threads of its own, and ends when the returned
object is stopped or destroyed. Read moreSource§fn signed_in(
&self,
query: SignedInQuery,
) -> Result<SignedInCheck, ProviderError>
fn signed_in( &self, query: SignedInQuery, ) -> Result<SignedInCheck, ProviderError>
Whether the program’s own login (the automatic
local account) exists, asked cheaply enough
for a host to list the account only when it does, with no list of file names of its own. Read moreSource§fn usage(
&self,
query: AccountUsageQuery,
spawner: Object<dyn ProcessSpawner>,
keeper: Object<dyn AccountKeeper>,
) -> Result<AccountUsage, ProviderError>
fn usage( &self, query: AccountUsageQuery, spawner: Object<dyn ProcessSpawner>, keeper: Object<dyn AccountKeeper>, ) -> Result<AccountUsage, ProviderError>
What the plan behind
query.account has used and has left, with no session and no model
turn: the account’s windows, how much of each is used, when each resets and which models it
covers. Cheap, so a host may poll it as often as it likes. A kind the provider lists in
offers().usage answers supported; any other kind it lists answers “not offered”,
[AccountUsage::unsupported], which is a true answer. The automatic local account (kind
HARNESS_LOGIN, when offers().local) is asked of the program on
the configuration as it stands. A kind it neither lists nor offers as local is
GUATIAO_ERR_BAD_VALUE, as is an id that is not 1 to 128 bytes without a control
character. Read moreSource§fn models(
&self,
query: AccountModelsQuery,
spawner: Object<dyn ProcessSpawner>,
keeper: Object<dyn AccountKeeper>,
) -> Result<ModelListing, ProviderError>
fn models( &self, query: AccountModelsQuery, spawner: Object<dyn ProcessSpawner>, keeper: Object<dyn AccountKeeper>, ) -> Result<ModelListing, ProviderError>
The models the account behind
query.account may use, with no model turn and no session:
what a host shows a person choosing one before a session starts. The listing is the
account’s, so an account of another kind (another login, another key) may list others. A
provider that cannot list for a kind (the program lists its models only in a session, or
has no way to) answers [ModelListing::unknown] with the reason, which is a true answer,
and one that tried and could not answers [ModelListing::unavailable]; it never guesses. Read moreSource§impl Debug for ApiKeyAccounts
impl Debug for ApiKeyAccounts
Source§impl From<ApiKeySettings> for ApiKeyAccounts
impl From<ApiKeySettings> for ApiKeyAccounts
Source§fn from(settings: ApiKeySettings) -> Self
fn from(settings: ApiKeySettings) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !Freeze for ApiKeyAccounts
impl RefUnwindSafe for ApiKeyAccounts
impl Send for ApiKeyAccounts
impl Sync for ApiKeyAccounts
impl Unpin for ApiKeyAccounts
impl UnsafeUnpin for ApiKeyAccounts
impl UnwindSafe for ApiKeyAccounts
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Converts this value into a three-state builder argument.
§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Converts this value into an optional builder argument.