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 get_secret_with_meta(
&self,
uri: &str,
) -> Result<BrokerSecret, SecretsError>
pub async fn get_secret_with_meta( &self, uri: &str, ) -> Result<BrokerSecret, SecretsError>
Retrieve a secret along with its metadata (decrypted).
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 UnsafeUnpin 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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request