Skip to main content

CodexAuthManager

Struct CodexAuthManager 

Source
pub struct CodexAuthManager { /* private fields */ }
Expand description

A manager rooted at one Codex home directory.

Implementations§

Source§

impl CodexAuthManager

Source

pub fn from_env() -> Result<Self, Error>

Create a manager from $CODEX_HOME, or $HOME/.codex when $CODEX_HOME is unset.

The stored path is absolute. The directory is not created by this method.

§Errors

Returns an error when neither environment variable can be read or the current directory cannot be determined while absolutizing a relative path.

Source

pub fn new(codex_home: impl AsRef<Path>) -> Result<Self, Error>

Create a manager for codex_home.

The stored path is absolute. The directory is not created by this method.

§Errors

Returns an error when the current directory cannot be determined while absolutizing a relative path.

Source

pub fn codex_home(&self) -> &Path

The Codex home directory this manager uses.

Source

pub fn status(&self) -> Result<AuthStatus, Error>

Return the current auth status.

§Errors

Returns an error when CAM cannot inspect auth.json or read its symlink target.

Source

pub fn list(&self) -> Result<Vec<Identity>, Error>

List identities from the manager directory.

Broken identity entries are included. Missing manager directories produce an empty list.

§Errors

Returns an error when the manager directory or one of its entries cannot be inspected.

Source

pub fn capture( &self, identity: &IdentityName, options: CaptureOptions, ) -> Result<(), Error>

Capture the native auth file into an identity and make it active.

§Errors

Returns an error when there is no native auth file, the destination identity already exists without force, the destination is broken, or a filesystem operation fails.

Source

pub fn use_identity( &self, identity: &IdentityName, options: UseOptions, ) -> Result<(), Error>

Make an existing identity active.

§Errors

Returns an error when the identity is missing or broken, a native auth file would be discarded without force, the auth state is unknown, or a filesystem operation fails.

Source

pub fn detach(&self, options: DetachOptions) -> Result<(), Error>

Detach Codex from the active managed identity.

§Errors

Returns an error when detaching would discard a native auth file or broken managed link without force, the auth state is unknown, or a filesystem operation fails.

Trait Implementations§

Source§

impl Clone for CodexAuthManager

Source§

fn clone(&self) -> CodexAuthManager

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CodexAuthManager

Source§

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

Formats the value using the given formatter. Read more

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
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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.