Struct ZeroKMSConfig
pub struct ZeroKMSConfig<ClientKeyState = ()> { /* private fields */ }
Expand description
Configuration for the ZeroKMS client library.
The ClientKeyState
generic is used to specify whether the config has a client key or not. If
the client doesn’t have a ClientKey
it can’t be used to encrypt or decrypt data.
let config = ZeroKMSConfig::builder()
.with_env()
.build()
.expect("failed to build config");
let client = config.create_client();
Implementations§
§impl ZeroKMSConfig
impl ZeroKMSConfig
pub fn builder() -> ZeroKMSConfigBuilder
pub fn builder() -> ZeroKMSConfigBuilder
Create a new ZeroKMSConfigBuilder
to build a ZeroKMS
used to configure
access to ZeroKMS.
let config = ZeroKMSConfig::builder()
.with_env()
.build()
.expect("failed to build config");
let client = config.create_client();
In situations where a ClientKey
has been configured in the environment. You can use
ZeroKMSConfigBuilder::build_with_client_key
.
let config = ZeroKMSConfig::builder()
.with_env()
.build_with_client_key()
.expect("failed to build config");
let client = config.create_client();
pub fn clone_with_client_key(
&self,
client_key: ClientKey,
) -> ZeroKMSConfigWithClientKey
pub fn clone_with_client_key( &self, client_key: ClientKey, ) -> ZeroKMSConfigWithClientKey
pub fn create_client(&self) -> ZeroKMS<ServiceCredentials>
pub fn create_client(&self) -> ZeroKMS<ServiceCredentials>
Create a new ZeroKMS client instance without a client key.
In order to encrypt and decrypt data use ZeroKMS<ClientKey>
.
§impl ZeroKMSConfig<ClientKey>
impl ZeroKMSConfig<ClientKey>
pub fn client_key(&self) -> ClientKey
pub fn client_key(&self) -> ClientKey
Return a copy of the ClientKey
used for generating and retrieving data keys.
pub fn create_client(&self) -> ZeroKMSWithClientKey<ServiceCredentials>
pub fn create_client(&self) -> ZeroKMSWithClientKey<ServiceCredentials>
Create a new ZeroKMS client instance that can be used for encryption and decryption.
§impl<T> ZeroKMSConfig<T>
impl<T> ZeroKMSConfig<T>
pub fn workspace_dir(&self) -> PathBuf
pub fn workspace_dir(&self) -> PathBuf
The configuration directory for the current workspace.
pub fn workspace_id(&self) -> &str
pub fn workspace_id(&self) -> &str
The ID of the current workspace.
pub fn token_path(&self) -> PathBuf
pub fn token_path(&self) -> PathBuf
The path where the cached ZeroKMS access token is stored.
pub fn decryption_log_path(&self) -> Option<PathBuf>
pub fn decryption_log_path(&self) -> Option<PathBuf>
The path to the decryption log file - if enabled.
pub fn credentials(&self) -> ServiceCredentials
pub fn credentials(&self) -> ServiceCredentials
Return a crate::credentials::Credentials
provider that can retrieve an access token to
the ZeroKMS API.
Trait Implementations§
§impl<ClientKeyState: Clone> Clone for ZeroKMSConfig<ClientKeyState>
impl<ClientKeyState: Clone> Clone for ZeroKMSConfig<ClientKeyState>
§fn clone(&self) -> ZeroKMSConfig<ClientKeyState>
fn clone(&self) -> ZeroKMSConfig<ClientKeyState>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<ClientKeyState> Freeze for ZeroKMSConfig<ClientKeyState>where
ClientKeyState: Freeze,
impl<ClientKeyState> RefUnwindSafe for ZeroKMSConfig<ClientKeyState>where
ClientKeyState: RefUnwindSafe,
impl<ClientKeyState> Send for ZeroKMSConfig<ClientKeyState>where
ClientKeyState: Send,
impl<ClientKeyState> Sync for ZeroKMSConfig<ClientKeyState>where
ClientKeyState: Sync,
impl<ClientKeyState> Unpin for ZeroKMSConfig<ClientKeyState>where
ClientKeyState: Unpin,
impl<ClientKeyState> UnwindSafe for ZeroKMSConfig<ClientKeyState>where
ClientKeyState: UnwindSafe,
Blanket Implementations§
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more