Documentation
¶
Overview ¶
Package awsprofile checks whether a named AWS profile is defined in either a context-scoped .aws/ directory or the operator's ambient AWS config. Callers use the result to decide whether emitting AWS_PROFILE is safe — pinning a profile that doesn't exist in the file the SDK will read causes a hard "profile not found" error that masks ambient env-var or IMDS credentials.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver carries the AWS config and credentials file paths a single profile lookup should read against. Construct via ForContext or Ambient.
func Ambient ¶
func Ambient() Resolver
Ambient resolves to the file paths the AWS SDK reads when windsor does not redirect them — AWS_CONFIG_FILE / AWS_SHARED_CREDENTIALS_FILE if the operator set them, else ~/.aws/config and ~/.aws/credentials. Any path that cannot be resolved (no env override and no home dir) stays empty — HasProfile treats empty paths as "no match".
func ForContext ¶
ForContext scopes lookups to <configRoot>/.aws/config and .aws/credentials. Used in project mode where windsor owns the context's .aws/ directory.
func (Resolver) HasProfile ¶
HasProfile reports whether the named profile is defined in either of the resolver's files. The AWS SDK treats a profile found in either file as satisfying the lookup, so a single match is enough. Section headers are expected as "[profile <name>]" in the config file (or "[default]" for the default profile) and "[<name>]" in the credentials file.