Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadMasterPassword ¶
LoadMasterPassword loads the master password to encrypt/decrypt the RC file. This function has 3 patterns:
- no password
- password given through CLI option (`-P`)
- password given through terminal (i.e. interactive mode)
func RetrieveSessionToken ¶
func RetrieveSessionToken(otpCode string, accessKeyID string, secretAccessKey string, durationSec int64, mfaSerial string) (*sts.GetSessionTokenOutput, error)
RetrieveSessionToken retrieves session token according to access token and OTP code.
Types ¶
type Config ¶
type Config struct { AccessKeyID string `json:"accessKeyID"` SecretAccessKey string `json:"secretAccessKey"` MFASerial string `json:"mfaSerial"` ProfileName string `json:"profileName"` }
Config represents the AWS configuration for MFA.
func ReadRCFile ¶
ReadRCFile reads the contents of RC file and maps that to the config model.
type Options ¶
type Options struct { RCFilePath string `short:"r" long:"rc" description:"configuration file path of sesstok (default: $HOME/.sesstok.rc)"` CredentialsFilePath string `short:"c" long:"credentials" description:"file path of AWS credentials (default: $HOME/.aws/credentials)"` PasswordRequired bool `` /* 149-byte string literal not displayed */ Password string `short:"P" description:"(NOT RECOMMENDED) pass the master password"` Duration int64 `short:"d" long:"duration" default:"86400" description:"duration of STS session token (unit: second)"` TokenOnly bool `short:"t" long:"token-only" description:"only retrieve STS session token (i.e. don't update credentials file)"` Silent bool `short:"s" long:"silent" description:"silent mode"` Version bool `short:"v" long:"version" description:"show the version"` DumpRCFile bool `long:"dumprc" description:"dump rc file contents"` Init bool `` /* 131-byte string literal not displayed */ Args struct{ TokenCode string } `positional-args:"yes"` }
Options represents CLI options.
func (*Options) GetCredentialsFileFullPath ¶
GetCredentialsFileFullPath returns the full path for the AWS credentials file according to the Options model.
func (*Options) GetRCFileFullPath ¶
GetRCFileFullPath returns the full path for RC file according to the Options model.
type OptionsParser ¶
type OptionsParser struct {
// contains filtered or unexported fields
}
OptionsParser represents a parser for CLI options.
func NewOptionsParser ¶
func NewOptionsParser() *OptionsParser
NewOptionsParser returns a new OptionsParser instance.
func (*OptionsParser) ParseArgs ¶
func (p *OptionsParser) ParseArgs(args []string) (*Options, error)
ParseArgs parses the CLI arguments and converts that to the Options.
func (*OptionsParser) Usage ¶
func (p *OptionsParser) Usage()
Usage shows the usage of this application.