config

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debug bool

Debug - Package variable for extra logging

View Source
var Verbose bool

Verbose - Package variable for extra logging

Functions

func CredentialsNeedRefresh

func CredentialsNeedRefresh(creds *credentials.Credentials, refreshWindowMinutes int) bool

CredentialsNeedRefresh - Calculates whether tokens need to be refreshed, based on existence, or if time.Now() is within refreshWindowMinutes of expiry.

func LoadCredentialsFromFile

func LoadCredentialsFromFile(filePath string) (*credentials.Credentials, error)

LoadCredentialsFromFile - Attempts to load existing credentials from file.

func ReadGobFromFile

func ReadGobFromFile(filePath string, object interface{}) error

ReadGobFromFile - Reads a gob-encoded interface from file.

func WriteGobToFile

func WriteGobToFile(filePath string, object interface{}) error

WriteGobToFile - Writes a gob-encoded interface to file.

Types

type Config

type Config struct {
	DefaultProfile string       `yaml:"default_profile"`
	MFASerial      string       `yaml:"mfa_serial"`
	Roles          []RoleConfig `yaml:"roles"`
}

Config represents the config file.

func New

func New(filePath string) *Config

New - Returns a hydrated instance of Config from configFile.

func (*Config) GetDefaultRole added in v0.0.6

func (c *Config) GetDefaultRole() *RoleConfig

GetDefaultRole returns the first role flagged as default.

func (*Config) GetRole

func (c *Config) GetRole(searchString string) *RoleConfig

GetRole Returns a RoleConfig.

func (*Config) ListRoles added in v0.0.5

func (c *Config) ListRoles()

ListRoles outputs a list of configured roles.

type RoleConfig

type RoleConfig struct {
	Name             string   `yaml:"name"`
	ARN              string   `yaml:"arn"`
	IsDefault        bool     `yaml:"default"`
	Aliases          []string `yaml:"aliases"`
	TargetAWSProfile string   `yaml:"target_aws_profile"`
}

RoleConfig represents a single mapping of an account role to assume.

Jump to

Keyboard shortcuts

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