Skip to main content

Crate grow_aws_secrets_manager

Crate grow_aws_secrets_manager 

Source
Expand description

§grow-aws-secrets-manager

Rust SDK for AWS Secrets Manager by Grow Codes, built on the official AWS SDK for Rust (aws-sdk-secretsmanager).

use grow_aws_secrets_manager::secrets::SecretsProvider;
use grow_aws_secrets_manager::{AwsSecretsManagerClient, AwsSecretsManagerConfig};
use grow_aws_secrets_manager::models::GetSecretValueOptions;

let client = AwsSecretsManagerClient::new(AwsSecretsManagerConfig::from_env()?)?;
let secret = client.get_secret_value("prod/db", GetSecretValueOptions::default()).await?;
println!("version {:?}", secret.version_id); // the value itself prints as [REDACTED]
let password = client.get_json_field("prod/db", "password", Default::default()).await?;
let provider = client.secrets();
let api_key = provider.get_string("prod/api-key", None).await?;
client.close().await;

Features: blocking (a blocking client), testing (in-memory fakes and the conformance runner).

Not affiliated with or endorsed by Amazon Web Services. AWS and AWS Secrets Manager are trademarks of Amazon.com, Inc. or its affiliates.

Re-exports§

pub use crate::core::Error;
pub use crate::core::ErrorCode;
pub use crate::core::HealthStatus;
pub use crate::core::Result;
pub use crate::core::RetryPolicy;
pub use crate::core::Secret;
pub use crate::models::API_VERSION;
pub use crate::models::AWSCURRENT;
pub use crate::models::AWSPENDING;
pub use crate::models::AWSPREVIOUS;
pub use crate::models::BATCH_GET_MAX_IDS;
pub use aws_sdk_secretsmanager;

Modules§

blockingblocking
Blocking wrapper (feature blocking). Each client owns a tokio runtime with one worker thread, so background work (watchers, retries’ timers) keeps running between blocking calls.
core
Shared core: errors, configuration, secrets in config, redaction, retries and transport.
models
Models of the AWS Secrets Manager API, request options and converters from the AWS SDK shapes. Secret values are always wrapped in the redacting SecretValue.
secrets
Secrets category: values, provider traits, cache, watch and load_env (SPEC §3).
testingtesting
Test support (feature testing): in-memory fakes and the conformance runner (SPEC §6).

Structs§

AwsErrorDetail
Redacted details of an AWS error, kept as the Error source. It never holds the raw response (which could echo request data).
AwsSecretCache
Version-stage aware cache in front of an AwsSecretsManagerClient (client.secret_cache(opts)). Reads are coalesced per (secret_id, stage). A refresh that fails keeps serving the cached value and retries with exponential backoff (AWS caching-client behaviour); a first read that fails returns the error.
AwsSecretCacheOptions
Options of AwsSecretCache.
AwsSecretCacheStats
Counters reported by AwsSecretCache::stats.
AwsSecretsManagerClient
Async client for AWS Secrets Manager. Cheap to clone (clones share one SDK client).
AwsSecretsManagerConfig
Immutable client configuration; build it with AwsSecretsManagerConfig::builder or AwsSecretsManagerConfig::from_env. Debug output redacts every credential.
AwsSecretsManagerConfigBuilder
Builder for AwsSecretsManagerConfig. Values set here win over the environment.
AwsSecretsManagerSecretsOptions
Options of AwsSecretsManagerClient::secrets_with_options.
AwsSecretsManagerSecretsProvider
SecretsProvider over AWS Secrets Manager (client.secrets()). Capabilities: write, versions, delete.
Paginator
Lazy iterator over every page of a list call. Nothing is sent until the first next, next_page or try_collect.

Constants§

AWS_ERROR_CODES
AWS error code → Grow ErrorCode (API.md §1.1).
AWS_SECRET_CACHE_MAX_ENTRIES
Capacity of the AWS caching clients (1 024 entries).
AWS_SECRET_CACHE_TTL
TTL of the AWS caching clients (1 h).
DEFAULT_RECOVERY_WINDOW_DAYS
Default recovery window of delete_secret / SecretsProvider::delete in days (AWS default).
DEFAULT_ROLE_SESSION_NAME
Default STS role session name of the assume-role helper.
DEFAULT_URL
Informational endpoint used when no endpoint override is set and no region is known. The AWS SDK resolves the real endpoint (https://secretsmanager.<region>.amazonaws.com) itself.
VENDOR_PROFILE_VARS
Vendor variables checked after GROW_AWS_SECRETS_MANAGER_PROFILE.
VENDOR_REGION_VARS
Vendor variables checked (in order) after GROW_AWS_SECRETS_MANAGER_REGION.
VENDOR_URL_VARS
Vendor variables checked (in order) after GROW_AWS_SECRETS_MANAGER_URL.

Traits§

SecretCacheSource
The client operations the cache needs (AwsSecretsManagerClient implements it; tests can pass a fake).

Functions§

aws_error_code
The AWS error code behind an SDK error (e.g. ResourceNotFoundException), when the error came from an AWS response with a recognisable code.
error_code_for_aws
The Grow code for an AWS error code (None when unknown).
error_code_from_body
Extracts an AWS error code from an XML (<Code>) or JSON (__type, code) error body.
full_name
path/name when a path is given, otherwise name.
is_missing
Whether err means “missing”: NOT_FOUND, or InvalidRequestException (the secret is scheduled for deletion).
to_metadata
Converts a description into SPEC metadata.

Type Aliases§

AwsSecretsManagerError
Service-prefixed alias of Error.
OnRefreshError
Callback for refresh failures.