awsprofile

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2026 License: MPL-2.0 Imports: 4 Imported by: 0

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

func ForContext(configRoot string) Resolver

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

func (r Resolver) HasProfile(name string) bool

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL