pub struct DefaultResolver { /* private fields */ }Expand description
Resolver that selects an appropriate backend and exposes JSON/text helpers.
Implementations§
Source§impl DefaultResolver
impl DefaultResolver
Sourcepub async fn new() -> Result<Self, SecretsError>
pub async fn new() -> Result<Self, SecretsError>
Build a resolver using environment configuration.
Sourcepub async fn from_config(config: ResolverConfig) -> Result<Self, SecretsError>
pub async fn from_config(config: ResolverConfig) -> Result<Self, SecretsError>
Build a resolver from the provided configuration.
Sourcepub fn core(&self) -> &SecretsCore
pub fn core(&self) -> &SecretsCore
Returns an immutable reference to the underlying SecretsCore.
Methods from Deref<Target = SecretsCore>§
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 *).
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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DefaultResolver
impl RefUnwindSafe for DefaultResolver
impl Send for DefaultResolver
impl Sync for DefaultResolver
impl Unpin for DefaultResolver
impl UnsafeUnpin for DefaultResolver
impl UnwindSafe for DefaultResolver
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