aws/region
Region resolution.
Precedence (matches go-v2 / Rust SDK):
AWS_REGIONenvironment variableAWS_DEFAULT_REGIONenvironment variableregionsetting in~/.aws/configunder the active profile
Resolution from EC2 IMDS is not implemented — most workloads set
AWS_REGION explicitly, and the few that rely on IMDS region
auto-detection can call from_imds themselves and feed the result in.
Types
pub type ResolveError {
NoRegion(sources_tried: List(String))
}
Constructors
-
NoRegion(sources_tried: List(String))No region found in any of the sources tried. The accompanying list records every source that was checked, in order, so an end-user log message can read like “tried AWS_REGION, AWS_DEFAULT_REGION, ~/.aws/config[profile=default]”.
Values
pub fn resolve(
profile profile: String,
) -> Result(String, ResolveError)
Resolve a region using the real OS env and ~/.aws/config. Standard
production wiring.
pub fn resolve_with(
profile profile: String,
env_lookup env_lookup: fn(String) -> Result(String, Nil),
config_reader config_reader: fn() -> Result(String, Nil),
) -> Result(String, ResolveError)
Resolve a region with injectable env and config-file access — used by tests, and available to callers that want to feed in their own sources.