Skip to main content

ApiKeyAccounts

Struct ApiKeyAccounts 

Source
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

Source

pub fn new(settings: ApiKeySettings) -> Self

A provider configured as settings say.

Trait Implementations§

Source§

impl AccountProvider for ApiKeyAccounts

Source§

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>

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>

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 more
Source§

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 more
Source§

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>

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 more
Source§

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 more
Source§

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 more
Source§

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 more
Source§

impl Debug for ApiKeyAccounts

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<ApiKeySettings> for ApiKeyAccounts

Source§

fn from(settings: ApiKeySettings) -> Self

Converts to this type from the input type.
Source§

impl ProviderDecl for ApiKeyAccounts

Source§

const KINDS: &'static [&'static str]

The name of every kind this provider serves, so a library can declare them at compile time.
Source§

fn provider(host: Host, alloc: Alloc) -> Result<ProviderParts, ValueError>

Builds this provider’s descriptor, its tables and its configuration schema, once. host is what the library was loaded by; alloc is what the schema is built through.

Auto Trait Implementations§

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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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
§

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

§

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.

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

impl<T> Instrument for T

§

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

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

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.

§

impl<T> IntoMaybeUndefined<T> for T

§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
§

impl<T> IntoOption<T> for T

§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

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, 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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

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

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