Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WarnOnProfileMismatch ¶ added in v0.9.1
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 ¶
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 ¶
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
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.