grow_aws_secrets_manager/lib.rs
1// Service-owned (created from the sdk-kit 0.1.0 skeleton).
2//! # grow-aws-secrets-manager
3//!
4//! Rust SDK for [AWS Secrets Manager](https://grow-codes-packages.github.io/aws-secrets-manager/)
5//! by Grow Codes, built on the official AWS SDK for Rust (`aws-sdk-secretsmanager`).
6//!
7//! ```no_run
8//! # async fn demo() -> grow_aws_secrets_manager::Result<()> {
9//! use grow_aws_secrets_manager::secrets::SecretsProvider;
10//! use grow_aws_secrets_manager::{AwsSecretsManagerClient, AwsSecretsManagerConfig};
11//! use grow_aws_secrets_manager::models::GetSecretValueOptions;
12//!
13//! let client = AwsSecretsManagerClient::new(AwsSecretsManagerConfig::from_env()?)?;
14//! let secret = client.get_secret_value("prod/db", GetSecretValueOptions::default()).await?;
15//! println!("version {:?}", secret.version_id); // the value itself prints as [REDACTED]
16//! let password = client.get_json_field("prod/db", "password", Default::default()).await?;
17//! let provider = client.secrets();
18//! let api_key = provider.get_string("prod/api-key", None).await?;
19//! # let _ = (password, api_key);
20//! client.close().await;
21//! # Ok(())
22//! # }
23//! ```
24//!
25//! Features: `blocking` (a blocking client), `testing` (in-memory fakes and the conformance
26//! runner).
27//!
28//! Not affiliated with or endorsed by Amazon Web Services. AWS and AWS Secrets Manager are
29//! trademarks of Amazon.com, Inc. or its affiliates.
30#![cfg_attr(docsrs, feature(doc_cfg))]
31
32pub mod core;
33
34mod api;
35mod aws_error;
36mod cache;
37mod client;
38mod config;
39pub mod models;
40mod paginator;
41mod provider;
42mod sdk;
43
44#[cfg(feature = "blocking")]
45#[cfg_attr(docsrs, doc(cfg(feature = "blocking")))]
46pub mod blocking;
47
48#[cfg(feature = "testing")]
49#[cfg_attr(docsrs, doc(cfg(feature = "testing")))]
50pub mod testing;
51
52pub mod secrets;
53
54pub use crate::core::{Error, ErrorCode, HealthStatus, Result, RetryPolicy, Secret};
55
56pub use crate::config::{
57 DEFAULT_RECOVERY_WINDOW_DAYS, DEFAULT_ROLE_SESSION_NAME, DEFAULT_URL, VENDOR_PROFILE_VARS,
58 VENDOR_REGION_VARS, VENDOR_URL_VARS,
59};
60
61pub use crate::client::AwsSecretsManagerClient;
62
63pub use crate::config::AwsSecretsManagerConfig;
64
65pub use crate::config::AwsSecretsManagerConfigBuilder;
66
67pub use crate::aws_error::{
68 aws_error_code, error_code_for_aws, error_code_from_body, AwsErrorDetail, AWS_ERROR_CODES,
69};
70pub use crate::cache::{
71 AwsSecretCache, AwsSecretCacheOptions, AwsSecretCacheStats, OnRefreshError, SecretCacheSource,
72 AWS_SECRET_CACHE_MAX_ENTRIES, AWS_SECRET_CACHE_TTL,
73};
74pub use crate::models::{API_VERSION, AWSCURRENT, AWSPENDING, AWSPREVIOUS, BATCH_GET_MAX_IDS};
75pub use crate::paginator::Paginator;
76pub use crate::provider::{
77 full_name, is_missing, to_metadata, AwsSecretsManagerSecretsOptions,
78 AwsSecretsManagerSecretsProvider,
79};
80
81/// The AWS SDK for Rust crate this package is built on (for `with_sdk_client` and the escape
82/// hatch [`AwsSecretsManagerClient::sdk`]).
83pub use aws_sdk_secretsmanager;
84
85/// Service-prefixed alias of [`Error`].
86pub type AwsSecretsManagerError = Error;