pub struct SecretsCore { /* private fields */ }Expand description
Embedded secrets client that can be used directly from Rust runtimes.
Implementations§
Source§impl SecretsCore
impl SecretsCore
Sourcepub fn builder() -> CoreBuilder
pub fn builder() -> CoreBuilder
Start building a new embedded core instance.
Sourcepub fn config(&self) -> &CoreConfig
pub fn config(&self) -> &CoreConfig
Access the runtime configuration. Return an immutable reference to the runtime configuration.
Sourcepub async fn get_bytes(&self, uri: &str) -> Result<Vec<u8>, SecretsError>
pub async fn get_bytes(&self, uri: &str) -> Result<Vec<u8>, SecretsError>
Retrieve secret bytes for the provided URI.
Sourcepub async fn get_text(&self, uri: &str) -> Result<String, SecretsError>
pub async fn get_text(&self, uri: &str) -> Result<String, SecretsError>
Retrieve a secret as UTF-8 text.
Sourcepub async fn get_json<T: DeserializeOwned>(
&self,
uri: &str,
) -> Result<T, SecretsError>
pub async fn get_json<T: DeserializeOwned>( &self, uri: &str, ) -> Result<T, SecretsError>
Retrieve a secret and deserialize it as JSON.
Sourcepub async fn put_json<T: Serialize>(
&self,
uri: &str,
value: &T,
) -> Result<SecretMeta, SecretsError>
pub async fn put_json<T: Serialize>( &self, uri: &str, value: &T, ) -> Result<SecretMeta, SecretsError>
Store JSON content at the provided URI.
Sourcepub async fn list(&self, prefix: &str) -> Result<Vec<SecretMeta>, SecretsError>
pub async fn list(&self, prefix: &str) -> Result<Vec<SecretMeta>, SecretsError>
List secret metadata matching the provided prefix.
Sourcepub fn purge_cache(&self, uris: &[String])
pub fn purge_cache(&self, uris: &[String])
Remove cached entries whose keys match the provided exact URIs or prefixes
(indicated by a trailing *).
Source§impl SecretsCore
impl SecretsCore
Sourcepub async fn validate_specs_at_prefix(
&self,
base_prefix: &str,
specs: &[SecretSpec],
) -> Result<SecretValidationResult, SecretsError>
pub async fn validate_specs_at_prefix( &self, base_prefix: &str, specs: &[SecretSpec], ) -> Result<SecretValidationResult, SecretsError>
Validate that every secret in specs exists under the provided prefix.
Example: base prefix secrets://dev/example/_/ would test URIs such as
secrets://dev/example/_/configs/TELEGRAM_TOKEN.
Auto Trait Implementations§
impl Freeze for SecretsCore
impl RefUnwindSafe for SecretsCore
impl Send for SecretsCore
impl Sync for SecretsCore
impl Unpin for SecretsCore
impl UnwindSafe for SecretsCore
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
Mutably borrows from an owned value. Read more