Documentation ¶
Index ¶
- func AddCommand(input AddCommandInput, keyring keyring.Keyring, ...) error
- func ConfigureAddCommand(app *kingpin.Application, a *AwsVault)
- func ConfigureExecCommand(app *kingpin.Application, a *AwsVault)
- func ConfigureListCommand(app *kingpin.Application, a *AwsVault)
- func ConfigureLoginCommand(app *kingpin.Application, a *AwsVault)
- func ConfigureRemoveCommand(app *kingpin.Application, a *AwsVault)
- func ConfigureRotateCommand(app *kingpin.Application, a *AwsVault)
- func ConfigureServerCommand(app *kingpin.Application, a *AwsVault)
- func ExecCommand(input ExecCommandInput, configLoader *vault.ConfigLoader, ...) error
- func LoginCommand(input LoginCommandInput, configLoader *vault.ConfigLoader, ...) error
- func LsCommand(input LsCommandInput, awsConfigFile *vault.ConfigFile, keyring keyring.Keyring) (err error)
- func RemoveCommand(input RemoveCommandInput, keyring keyring.Keyring) error
- func RotateCommand(input RotateCommandInput, configLoader *vault.ConfigLoader, ...) error
- type AddCommandInput
- type AwsCredentialHelperData
- type AwsVault
- type ExecCommandInput
- type LoginCommandInput
- type LsCommandInput
- type RemoveCommandInput
- type RotateCommandInput
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCommand ¶
func AddCommand(input AddCommandInput, keyring keyring.Keyring, awsConfigFile *vault.ConfigFile) error
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`, ``) ConfigureAddCommand(app, ConfigureGlobals(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, a *AwsVault)
func ConfigureExecCommand ¶
func ConfigureExecCommand(app *kingpin.Application, a *AwsVault)
func ConfigureListCommand ¶
func ConfigureListCommand(app *kingpin.Application, a *AwsVault)
func ConfigureLoginCommand ¶
func ConfigureLoginCommand(app *kingpin.Application, a *AwsVault)
func ConfigureRemoveCommand ¶
func ConfigureRemoveCommand(app *kingpin.Application, a *AwsVault)
func ConfigureRotateCommand ¶
func ConfigureRotateCommand(app *kingpin.Application, a *AwsVault)
func ConfigureServerCommand ¶
func ConfigureServerCommand(app *kingpin.Application, a *AwsVault)
func ExecCommand ¶
func ExecCommand(input ExecCommandInput, configLoader *vault.ConfigLoader, keyring keyring.Keyring) error
Example ¶
app := kingpin.New("aws-vault", "") awsVault := ConfigureGlobals(app) awsVault.keyringImpl = keyring.NewArrayKeyring([]keyring.Item{ {Key: "llamas", Data: []byte(`{"AccessKeyID":"ABC","SecretAccessKey":"XYZ"}`)}, }) ConfigureExecCommand(app, awsVault) kingpin.MustParse(app.Parse([]string{ "--debug", "exec", "--no-session", "llamas", "--", "sh", "-c", "echo $AWS_ACCESS_KEY_ID", }))
Output: ABC
func LoginCommand ¶
func LoginCommand(input LoginCommandInput, configLoader *vault.ConfigLoader, keyring keyring.Keyring) error
func LsCommand ¶
func LsCommand(input LsCommandInput, awsConfigFile *vault.ConfigFile, keyring keyring.Keyring) (err error)
Example ¶
app := kingpin.New("aws-vault", "") awsVault := ConfigureGlobals(app) awsVault.keyringImpl = keyring.NewArrayKeyring([]keyring.Item{ {Key: "llamas", Data: []byte(`{"AccessKeyID":"ABC","SecretAccessKey":"XYZ"}`)}, }) ConfigureListCommand(app, awsVault) kingpin.MustParse(app.Parse([]string{ "list", "--credentials", }))
Output: llamas
func RemoveCommand ¶
func RemoveCommand(input RemoveCommandInput, keyring keyring.Keyring) error
func RotateCommand ¶
func RotateCommand(input RotateCommandInput, configLoader *vault.ConfigLoader, keyring keyring.Keyring) error
Types ¶
type AddCommandInput ¶
type AwsCredentialHelperData ¶
type AwsCredentialHelperData struct { Version int `json:"Version"` AccessKeyID string `json:"AccessKeyId"` SecretAccessKey string `json:"SecretAccessKey"` SessionToken string `json:"SessionToken,omitempty"` Expiration string `json:"Expiration,omitempty"` }
AwsCredentialHelperData is metadata for AWS CLI credential process See https://docs.aws.amazon.com/cli/latest/topic/config-vars.html#sourcing-credentials-from-external-processes
type AwsVault ¶
type AwsVault struct { Debug bool KeyringConfig keyring.Config KeyringBackend string PromptDriver string // contains filtered or unexported fields }
func ConfigureGlobals ¶
func ConfigureGlobals(app *kingpin.Application) *AwsVault
func (*AwsVault) AwsConfigFile ¶
func (a *AwsVault) AwsConfigFile() (*vault.ConfigFile, error)
func (*AwsVault) ConfigLoader ¶
func (a *AwsVault) ConfigLoader() (*vault.ConfigLoader, error)
func (*AwsVault) MustGetProfileNames ¶
type ExecCommandInput ¶
type LoginCommandInput ¶
type LsCommandInput ¶
type RemoveCommandInput ¶
Click to show internal directories.
Click to hide internal directories.