Skip to main content

Admin

Struct Admin 

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

Administrator RPCs. Constructed via super::Client::admin.

Implementations§

Source§

impl Admin

Source

pub async fn request(&self, request: AdminRequest) -> Result<AdminResponse>

One-shot administrator RPC. CLI output rendering can call this directly.

Source

pub async fn request_with_timeout( &self, request: AdminRequest, io_timeout: Duration, ) -> Result<AdminResponse>

Self::request with an explicit I/O bound, covering the connect as well as the exchange.

Source

pub async fn issue_key( &self, ttl: Duration, label: Option<String>, ) -> Result<IssuedKey>

Mint a temporary credential valid for ttl.

Source

pub async fn show_key(&self, key_id: u64) -> Result<IssuedKey>

Metadata for one credential, without its secret.

Source

pub async fn reveal_key(&self, key_id: u64) -> Result<IssuedKey>

Metadata for one credential, with its secret.

Source

pub async fn renew_key(&self, key_id: u64, ttl: Duration) -> Result<IssuedKey>

Extend a credential’s lifetime to ttl from now.

Source

pub async fn revoke_key(&self, key_id: u64) -> Result<KeyMetadata>

Revoke a credential, taking effect on the relay immediately.

Source

pub async fn auth_status(&self) -> Result<AuthStatusInfo>

The relay’s credential-subsystem snapshot.

Source

pub async fn gc_keys(&self) -> Result<u64>

Drop expired and revoked credentials, returning how many were removed.

Source

pub async fn reset_auth_state(&self) -> Result<()>

Erase the relay’s credential state. Every temporary credential stops authenticating; the administrator key is unaffected.

Source

pub async fn set_legacy_protocol(&self, policy: LegacyProtocol) -> Result<()>

Allow or deny pre-v2 framing on new connections.

Source

pub async fn list_keys(&self, page: u32, page_size: u16) -> Result<KeyListPage>

One page of temporary credentials.

Source

pub async fn list_services( &self, key_id: Option<u64>, page: u32, page_size: u16, ) -> Result<ServicePage>

One page of registered services, optionally scoped to one credential.

Source

pub async fn list_connections( &self, key_id: Option<u64>, page: u32, page_size: u16, ) -> Result<ConnectionPage>

One page of live connections, optionally scoped to one credential.

Source

pub async fn retire_connections( &self, key_id: Option<u64>, service_name: String, conn_id: Option<u32>, ) -> Result<u32>

Drop registered control connections the relay is still holding for a service, returning how many it dropped.

conn_id of None retires every connection the service has, which is what frees a connection quota filled by connections that should have gone away. A registration whose client is still healthy simply reconnects, so this is a nudge rather than a shutdown.

Source

pub async fn list_keys_all(&self) -> Result<Vec<KeyMetadata>>

Every temporary credential, paging until the relay stops handing back a cursor.

Source

pub async fn list_services_all( &self, key_id: Option<u64>, ) -> Result<Vec<ServiceInfo>>

Every registered service, optionally scoped to one credential.

Source

pub async fn list_connections_all( &self, key_id: Option<u64>, ) -> Result<Vec<ConnectionInfo>>

Every live connection, optionally scoped to one credential.

Source

pub async fn rotate_root_key(&self, new_key: Option<String>) -> Result<String>

Rotate the relay’s administrator key, returning the key now in force.

Generates a key when new_key is None. Rotation is not idempotent, so a caller who never learns the outcome cannot retry safely: if the relay committed the change and the response was lost, only the new key still authenticates. When the SDK generated that key, losing it locks the operator out — so any inconclusive result is reported as Error::RootRotationUncertain, which carries the candidate. A caller who supplied new_key already holds it and gets the underlying error unchanged.

Prefer Admin::rotate_root_key_to_file, which persists the candidate before the request is ever sent.

Source

pub async fn rotate_root_key_to_file( &self, path: &Path, new_key: Option<String>, ) -> Result<String>

Rotate the root key and persist it to path.

The candidate is staged at a sibling file before the request is sent, and path is only replaced once the relay has accepted the rotation and the new key has passed a post-rotation status check. A rotation that fails after the relay may have committed it therefore leaves both keys on disk rather than a path holding a key the relay never installed.

An unresolved candidate from an earlier attempt is never overwritten — see stage_admin_key_candidate — so this fails until the operator establishes which of the two keys the relay accepts. Retrying with the same new_key is allowed.

Trait Implementations§

Source§

impl Clone for Admin

Source§

fn clone(&self) -> Self

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

Auto Trait Implementations§

§

impl !RefUnwindSafe for Admin

§

impl !UnwindSafe for Admin

§

impl Freeze for Admin

§

impl Send for Admin

§

impl Sync for Admin

§

impl Unpin for Admin

§

impl UnsafeUnpin for Admin

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> Instrument for T

Source§

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

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

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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = !

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

impl<T> WithSubscriber for T

Source§

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

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

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