awsprofile

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MPL-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WarnOnProfileMismatch added in v0.9.1

func WarnOnProfileMismatch(w io.Writer, r Resolver, expected string)

WarnOnProfileMismatch writes a warning to w when expected is missing but a different profile is defined. This tells the user that the profile probably has the wrong name. It writes nothing when expected is defined, or when no profile is defined.

Types

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver holds the paths of the AWS config file and credentials file that a lookup reads. Use ForContext or Ambient to make one.

func Ambient

func Ambient() Resolver

Ambient returns a Resolver for the files that the AWS SDK reads when windsor does not set them. It uses AWS_CONFIG_FILE and AWS_SHARED_CREDENTIALS_FILE when they are set, and the files in ~/.aws when they are not. A path stays empty when it has no variable and there is no home directory. An empty path matches no profile.

func ForContext

func ForContext(configRoot string) Resolver

ForContext returns a Resolver that reads <configRoot>/.aws/config and <configRoot>/.aws/credentials. Project mode uses it, because windsor owns the .aws directory of the context.

func (Resolver) HasProfile

func (r Resolver) HasProfile(name string) bool

HasProfile reports whether the named profile is in the config file or the credentials file. The AWS SDK accepts a profile from either file, so one match is sufficient. The config file uses "[profile <name>]", or "[default]" for the default profile. The credentials file uses "[<name>]".

func (Resolver) ListProfileNames added in v0.9.1

func (r Resolver) ListProfileNames() []string

ListProfileNames returns each profile name in the config file and the credentials file, without duplicates. It reads the config file first and keeps the order in which it finds the names. When a profile is missing, the caller uses this list to tell the user which profiles exist. For example, `aws configure sso` without --profile names the profile after the SSO role, not the context.

Jump to

Keyboard shortcuts

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