Enum rusoto_credential::Variable [−][src]
pub enum Variable<T, E = CredentialsError> { Static(T), Dynamic(Arc<dyn Fn() -> Result<T, E> + Send + Sync>), Fallback(Box<Variable<T, E>>, Box<Variable<T, E>>), }
Expand description
Variable is an abstraction over parameters to credential providers, allowing to abstract on how (source) and when (time) parameter values are resolved. A lot of credentials providers use external information sources such as environment variables or files to obtain parameter values needed to produce AWS credentials.
Information Sources
- In memory values (static)
- Environment variables (dynamic)
- Files (dynamic)
- …
Resolving Behaviour
- Static variables always resolve to the same value.
- Dynamic variables can resolve to different values over time.
Most prominent examples for dynamic variables are parameters which read their value from environment variables or files.
Variants
Static variable always resolving to the same given value.
Dynamic variable can resolve to different values over time.
Fallback try variables in given order returning the value of the first variable that does resolve.
Implementations
Variable which statically resolves to a provided (in-memory) value.
Combine this Variable with a fallback Variable. Resolving the variable’s value will be done lazily, stopping on the first Variable that successfuly resolves.
Example Usage
let primary: Variable<String> = Variable::from_env_var("AWS_SECRET_ACCESS_KEY"); let fallback = Variable::from_env_var("AWS_SECRET_KEY"); let aws_secret_access_key = primary.or(fallback);
Variable which dynamically resolves to the value of a given environment variable.
Variable which dynamically resolves to the value of a given environment variable.
Variable which dynamically resolves to the value of an UTF-8 encoded text file (removing all leading and trailing whitespaces.
Variable which dynamically resolves to the value of a binary file.
Trait Implementations
Custom Clone implementation as type parameter E doesn’t have to be cloneable.
Auto Trait Implementations
impl<T, E = CredentialsError> !RefUnwindSafe for Variable<T, E>
impl<T, E = CredentialsError> !UnwindSafe for Variable<T, E>
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more