Documentation ¶
Index ¶
- Constants
- Variables
- func AddCommand(app *kingpin.Application, input AddCommandInput)
- func ConfigureAddCommand(app *kingpin.Application)
- func ConfigureExecCommand(app *kingpin.Application)
- func ConfigureGlobals(app *kingpin.Application)
- func ConfigureListCommand(app *kingpin.Application)
- func ConfigureLoginCommand(app *kingpin.Application)
- func ConfigureRemoveCommand(app *kingpin.Application)
- func ConfigureRotateCommand(app *kingpin.Application)
- func ConfigureServerCommand(app *kingpin.Application)
- func ExecCommand(app *kingpin.Application, input ExecCommandInput)
- func LoginCommand(app *kingpin.Application, input LoginCommandInput)
- func LsCommand(app *kingpin.Application, input LsCommandInput)
- func ProfileNames() []string
- func RemoveCommand(app *kingpin.Application, input RemoveCommandInput)
- func RotateCommand(app *kingpin.Application, input RotateCommandInput)
- func ServerCommand(app *kingpin.Application, input ServerCommandInput)
- type AddCommandInput
- type AwsCredentialHelperData
- type ExecCommandInput
- type LoginCommandInput
- type LsCommandInput
- type RemoveCommandInput
- type RotateCommandInput
- type ServerCommandInput
Examples ¶
Constants ¶
View Source
const (
DefaultKeyringName = "aws-vault"
)
Variables ¶
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)
Example ¶
keyringImpl = keyring.NewArrayKeyring([]keyring.Item{ {Key: "llamas", Data: []byte(`{"AccessKeyID":"ABC","SecretAccessKey":"XYZ"}`)}, }) app := kingpin.New(`aws-vault`, ``) ConfigureGlobals(app) ConfigureListCommand(app) kingpin.MustParse(app.Parse([]string{ "list", "--credentials", }))
Output: llamas
func ProfileNames ¶
func ProfileNames() []string
ProfileNames returns a slice of profile names from the AWS config
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 AwsCredentialHelperData ¶
type AwsCredentialHelperData struct { Version int `json:"Version"` AccessKeyID string `json:"AccessKeyId"` SecretAccessKey string `json:"SecretAccessKey"` SessionToken string `json:"SessionToken"` Expiration string `json:"Expiration,omitempty"` }
json metadata for AWS credential process. Ref: https://docs.aws.amazon.com/cli/latest/topic/config-vars.html#sourcing-credentials-from-external-processes
type ExecCommandInput ¶
type LoginCommandInput ¶
type LsCommandInput ¶
type RemoveCommandInput ¶
type RotateCommandInput ¶
type ServerCommandInput ¶
type ServerCommandInput struct { }
Click to show internal directories.
Click to hide internal directories.