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<DefaultResolver, SecretsError>
pub async fn new() -> Result<DefaultResolver, SecretsError>
Build a resolver using environment configuration.
Sourcepub async fn from_config(
config: ResolverConfig,
) -> Result<DefaultResolver, SecretsError>
pub async fn from_config( config: ResolverConfig, ) -> Result<DefaultResolver, 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>(&self, uri: &str) -> Result<T, SecretsError>where
T: DeserializeOwned,
pub async fn get_json<T>(&self, uri: &str) -> Result<T, SecretsError>where
T: DeserializeOwned,
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>(
&self,
uri: &str,
value: &T,
) -> Result<SecretMeta, SecretsError>where
T: Serialize,
pub async fn put_json<T>(
&self,
uri: &str,
value: &T,
) -> Result<SecretMeta, SecretsError>where
T: Serialize,
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§
Source§impl Deref for DefaultResolver
impl Deref for DefaultResolver
Source§type Target = SecretsCore
type Target = SecretsCore
Source§impl SecretsResolver for DefaultResolver
impl SecretsResolver for DefaultResolver
fn get_json<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
path: &'life1 SecretPath,
_ctx: &'life2 TenantCtx,
) -> Pin<Box<dyn Future<Output = NodeResult<Option<T>>> + Send + 'async_trait>>where
T: DeserializeOwned + Send + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn put_json<'life0, 'life1, 'life2, 'life3, 'async_trait, T>( &'life0 self, path: &'life1 SecretPath, _ctx: &'life2 TenantCtx, value: &'life3 T, ) -> Pin<Box<dyn Future<Output = NodeResult<()>> + Send + 'async_trait>>
Auto Trait Implementations§
impl Freeze for DefaultResolver
impl RefUnwindSafe for DefaultResolver
impl Send for DefaultResolver
impl Sync for DefaultResolver
impl Unpin for DefaultResolver
impl UnwindSafe for DefaultResolver
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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 moreSource§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