cli

package
v4.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2018 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const (
	DefaultKeyringName = "aws-vault"
)

Variables

View Source
var GlobalFlags struct {
	Debug        bool
	Backend      string
	PromptDriver string
	KeychainName string
}

Functions

func AddCommand

func AddCommand(app *kingpin.Application, input AddCommandInput)
Example
f, err := ioutil.TempFile("", "aws-config")
if err != nil {
	log.Fatal(err)
}
defer os.Remove(f.Name())

os.Setenv("AWS_CONFIG_FILE", f.Name())
os.Setenv("AWS_ACCESS_KEY_ID", "llamas")
os.Setenv("AWS_SECRET_ACCESS_KEY", "rock")
os.Setenv("AWS_VAULT_BACKEND", "file")
os.Setenv("AWS_VAULT_FILE_PASSPHRASE", "password")

defer os.Unsetenv("AWS_ACCESS_KEY_ID")
defer os.Unsetenv("AWS_SECRET_ACCESS_KEY")
defer os.Unsetenv("AWS_VAULT_BACKEND")
defer os.Unsetenv("AWS_VAULT_FILE_PASSPHRASE")

app := kingpin.New(`aws-vault`, ``)
ConfigureGlobals(app)
ConfigureAddCommand(app)
kingpin.MustParse(app.Parse([]string{"add", "--debug", "--env", "foo"}))
Output:

Added credentials to profile "foo" in vault

func ConfigureAddCommand

func ConfigureAddCommand(app *kingpin.Application)

func ConfigureExecCommand

func ConfigureExecCommand(app *kingpin.Application)

func ConfigureGlobals

func ConfigureGlobals(app *kingpin.Application)

func ConfigureListCommand

func ConfigureListCommand(app *kingpin.Application)

func ConfigureLoginCommand

func ConfigureLoginCommand(app *kingpin.Application)

func ConfigureRemoveCommand

func ConfigureRemoveCommand(app *kingpin.Application)

func ConfigureRotateCommand

func ConfigureRotateCommand(app *kingpin.Application)

func ConfigureServerCommand

func ConfigureServerCommand(app *kingpin.Application)

func ExecCommand

func ExecCommand(app *kingpin.Application, input ExecCommandInput)
Example
awsConfig = &vault.Config{}
keyringImpl = keyring.NewArrayKeyring([]keyring.Item{
	{Key: "llamas", Data: []byte(`{"AccessKeyID":"ABC","SecretAccessKey":"XYZ"}`)},
})

app := kingpin.New("aws-vault", "")
ConfigureGlobals(app)
ConfigureExecCommand(app)
kingpin.MustParse(app.Parse([]string{
	"--debug", "exec", "--no-session", "llamas", "--", "sh", "-c", "echo $AWS_ACCESS_KEY_ID",
}))
Output:

ABC

func LoginCommand

func LoginCommand(app *kingpin.Application, input LoginCommandInput)

func LsCommand

func LsCommand(app *kingpin.Application, input LsCommandInput)

func RemoveCommand

func RemoveCommand(app *kingpin.Application, input RemoveCommandInput)

func RotateCommand

func RotateCommand(app *kingpin.Application, input RotateCommandInput)

func ServerCommand

func ServerCommand(app *kingpin.Application, input ServerCommandInput)

Types

type AddCommandInput

type AddCommandInput struct {
	Profile   string
	Keyring   keyring.Keyring
	FromEnv   bool
	AddConfig bool
}

type ExecCommandInput

type ExecCommandInput struct {
	Profile      string
	Command      string
	Args         []string
	Keyring      keyring.Keyring
	Duration     time.Duration
	RoleDuration time.Duration
	MfaToken     string
	MfaPrompt    prompt.PromptFunc
	StartServer  bool
	Signals      chan os.Signal
	NoSession    bool
}

type LoginCommandInput

type LoginCommandInput struct {
	Profile                 string
	Keyring                 keyring.Keyring
	MfaToken                string
	MfaPrompt               prompt.PromptFunc
	UseStdout               bool
	FederationTokenDuration time.Duration
	AssumeRoleDuration      time.Duration
}

type LsCommandInput

type LsCommandInput struct {
	Keyring         keyring.Keyring
	OnlyProfiles    bool
	OnlySessions    bool
	OnlyCredentials bool
}

type RemoveCommandInput

type RemoveCommandInput struct {
	Profile      string
	Keyring      keyring.Keyring
	SessionsOnly bool
}

type RotateCommandInput

type RotateCommandInput struct {
	Profile   string
	Keyring   keyring.Keyring
	MfaToken  string
	MfaPrompt prompt.PromptFunc
}

type ServerCommandInput

type ServerCommandInput struct {
}

Jump to

Keyboard shortcuts

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