config

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Example (Debug)
l := simple_logger.NewLogger(os.Stdout, "", 0)
l.SetLevel(simple_logger.DEBUG)
r := new(configResolver).WithLogger(l)
r.debug("test")
Output:

DEBUG test
Example (DebugNilLogger)
r := new(configResolver)
r.debug("test")
Output:

Index

Examples

Constants

View Source
const (
	// RegionEnvVar is the environment variable to define the AWS region to work in
	RegionEnvVar = "AWS_REGION"
	// DefaultRegionEnvVar is the environment variable to define the default AWS region (if AWS_REGION is not specified)
	DefaultRegionEnvVar = "AWS_DEFAULT_REGION"
	// SessionDurationEnvVar is the environment variable to define the Session Token credential lifetime
	SessionDurationEnvVar = "SESSION_TOKEN_DURATION"
	// RoleDurationEnvVar is the environment variable to define the Assume Role credential lifetime
	RoleDurationEnvVar = "CREDENTIALS_DURATION"
	// MfaSerialEnvVar is the environment variable to define the optional multi-factor authentication serial number or ARN to use to retrieve credentials
	MfaSerialEnvVar = "MFA_SERIAL"
	// ExternalIdEnvVar is the environment variable to define the optional External ID value when getting Assumed Role credentials
	ExternalIdEnvVar = "EXTERNAL_ID"
	// ProfileEnvVar is the environment variable to define the name of the configuration profile (or role ARN) to use to retrieve credentials
	ProfileEnvVar = "AWS_PROFILE"
	// DefaultProfileEnvVar is the environment variable to define the name of the default AWS profile, if different from the SDK default 'default'
	DefaultProfileEnvVar = "AWS_DEFAULT_PROFILE"
)

Variables

This section is empty.

Functions

func NewConfigResolver

func NewConfigResolver(c *AwsConfig) (*configResolver, error)

NewConfigResolver provides a default ConfigResolver which will consult the SDK config file ($HOME/.aws/config or value of AWS_CONFIG_FILE env var) as a source for configuration resolution, in addition to the provided user config data.

Types

type AwsConfig

type AwsConfig struct {
	Region          string        `ini:"region"`
	SessionDuration time.Duration `ini:"session_token_duration"`
	RoleDuration    time.Duration `ini:"credentials_duration"`
	MfaSerial       string        `ini:"mfa_serial"`
	RoleArn         string        `ini:"role_arn"`
	ExternalID      string        `ini:"external_id"`
	SourceProfile   string        `ini:"source_profile"`
}

AwsConfig is the type used to hold the configuration details retrieved from a given source.

func MergeConfig

func MergeConfig(conf ...*AwsConfig) *AwsConfig

MergeConfig will merge the provided list of AwsConfig types to a single value. Precedence is based on the order of the item in the list, with later items overriding values specified in earlier items. Only non-nil AwsConfig types will be considered, and the field inside the AwsConfig item must be a non-zero value to override a prior setting

type ConfigResolver

type ConfigResolver interface {
	ResolveConfig(string) (*AwsConfig, error)
	ListProfiles(bool) []string
}

ConfigResolver is the interface for retrieving AWS SDK configuration from a source

Jump to

Keyboard shortcuts

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