Skip to main content

DatabaseSecrets

Struct DatabaseSecrets 

Source
pub struct DatabaseSecrets<'a> { /* private fields */ }
Expand description

The database secrets engine at one mount.

Implementations§

Source§

impl<'a> DatabaseSecrets<'a>

Source

pub fn mount(self, mount: impl Into<String>) -> DatabaseSecrets<'a>

The same engine mounted elsewhere.

Source

pub async fn credentials(&self, role: &str) -> Result<DatabaseCredentials>

A new account for a role, created on the spot.

Each call makes a different account. Calling it per query rather than per process will fill the database with roles and exhaust whatever connection limit it has, so hold the result for the life of the lease.

Source

pub async fn rotate_root(&self, name: &str) -> Result<()>

Change the password Vault itself uses to reach the database.

Worth doing right after the engine is configured: until it runs, the root password is whatever an operator typed into a terminal, and afterwards it is a value only Vault has ever seen. It is one-way — there is no call that reads the new password back — so an operator who needs superuser access again has to reset it out of band.

Source

pub async fn static_credentials( &self, role: &str, ) -> Result<DatabaseCredentials>

The credentials for a static role: an account that already exists and whose password Vault rotates on a schedule.

Unlike DatabaseSecrets::credentials this returns the same username every time, and the lease is only how long until the next rotation.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for DatabaseSecrets<'a>

§

impl<'a> !UnwindSafe for DatabaseSecrets<'a>

§

impl<'a> Freeze for DatabaseSecrets<'a>

§

impl<'a> Send for DatabaseSecrets<'a>

§

impl<'a> Sync for DatabaseSecrets<'a>

§

impl<'a> Unpin for DatabaseSecrets<'a>

§

impl<'a> UnsafeUnpin for DatabaseSecrets<'a>

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