mfa

package
v0.0.0-...-e0dbba8 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindDefaultCfgFileLocation

func FindDefaultCfgFileLocation() string

FindDefaultCfgFileLocation determines default config location

Types

type Account

type Account struct {
	Name         string `yaml:"name"`
	Region       string `yaml:"region"`
	AccessKey    string `yaml:"accessKey"`
	SecretKey    string `yaml:"secretKey"`
	Expiration   time.Time
	SessionToken string
	MFASerial    string
}

Account is aws account abstract object definition

func (*Account) CreateSession

func (a *Account) CreateSession() *session.Session

CreateSession creates new AWS session

func (*Account) GetCurrentUserName

func (a *Account) GetCurrentUserName(s *session.Session) *string

GetCurrentUserName determines current aws UserName

func (*Account) GetMFADeviceSerial

func (a *Account) GetMFADeviceSerial(s *session.Session)

GetMFADeviceSerial tries to get serial number of mfa device if configured

func (*Account) GetTempCredentials

func (a *Account) GetTempCredentials(s *session.Session, mfaSerial *string, durationSeconds int64, passCode string)

GetTempCredentials gets temporary credentials for aws account and modifies its fields accordingly

func (*Account) Print

func (a *Account) Print(format string)

Print outputs Account information in pretty formats It automatically detects wether Account is already MFAd or not Use this until more specific printing is required

func (*Account) PrintAccount

func (a *Account) PrintAccount(format string)

PrintAccount outputs Account information in non-MFAd formats

func (*Account) PrintAws

func (a *Account) PrintAws()

PrintAws prints Account in non-MFAd aws format for aws config file

func (*Account) PrintAwsRegion

func (a *Account) PrintAwsRegion()

PrintAwsRegion prints Account in non-MFAd aws format for aws config file

func (*Account) PrintDebug

func (a *Account) PrintDebug()

PrintDebug print Account in debug mode (struct)

func (*Account) PrintEnv

func (a *Account) PrintEnv()

PrintEnv prints Account in non-MFAd env format

func (*Account) PrintMFAdAccount

func (a *Account) PrintMFAdAccount(format string)

PrintMFAdAccount outputs Account information in MFAd formats

func (*Account) PrintMFAdAws

func (a *Account) PrintMFAdAws()

PrintMFAdAws prints Account in MFAd aws format for aws credentials file

func (*Account) PrintMFAdAwsRegion

func (a *Account) PrintMFAdAwsRegion()

PrintMFAdAwsRegion prints Account in MFAd aws format for aws config file

func (*Account) PrintMFAdEnv

func (a *Account) PrintMFAdEnv()

PrintMFAdEnv prints Account in MFAd env format

func (*Account) SprintAws

func (a *Account) SprintAws() string

SprintAws string prints Account in non-MFAd aws format for aws config file

func (*Account) SprintAwsRegion

func (a *Account) SprintAwsRegion() string

SprintAwsRegion string prints Account in non-MFAd aws format for aws config file

func (*Account) SprintEnv

func (a *Account) SprintEnv() string

SprintEnv string prints Account in non-MFAd env format

func (*Account) SprintMFAdAws

func (a *Account) SprintMFAdAws() string

SprintMFAdAws string prints Account in MFAd aws format for aws credentials file

func (*Account) SprintMFAdAwsRegion

func (a *Account) SprintMFAdAwsRegion() string

SprintMFAdAwsRegion string prints Account in MFAd aws format for aws config file

func (*Account) SprintMFAdEnv

func (a *Account) SprintMFAdEnv() string

SprintMFAdEnv string prints Account in MFAd env format

type Config

type Config struct {
	Accounts []Account
}

Config describes tool configuration

func ReadCfgFile

func ReadCfgFile(cfgFile string) *Config

ReadCfgFile reads config file and yaml unmarshals its content

func (*Config) CheckIfAccountExists

func (c *Config) CheckIfAccountExists() error

CheckIfAccountExists checks if any account exists in config file and returns error value

Jump to

Keyboard shortcuts

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