Documentation ¶
Index ¶
- Variables
- func AddCommand(input AddCommandInput, keyring keyring.Keyring, ...) error
- func ClearCommand(input ClearCommandInput, awsConfigFile *vault.ConfigFile, ...) error
- func ConfigureAddCommand(app *kingpin.Application, a *AwsVault)
- func ConfigureClearCommand(app *kingpin.Application, a *AwsVault)
- func ConfigureExecCommand(app *kingpin.Application, a *AwsVault)
- func ConfigureExportCommand(app *kingpin.Application, a *AwsVault)
- func ConfigureListCommand(app *kingpin.Application, a *AwsVault)
- func ConfigureLoginCommand(app *kingpin.Application, a *AwsVault)
- func ConfigureProxyCommand(app *kingpin.Application)
- func ConfigureRemoveCommand(app *kingpin.Application, a *AwsVault)
- func ConfigureRotateCommand(app *kingpin.Application, a *AwsVault)
- func ExecCommand(input ExecCommandInput, f *vault.ConfigFile, keyring keyring.Keyring) (exitcode int, err error)
- func ExportCommand(input ExportCommandInput, f *vault.ConfigFile, keyring keyring.Keyring) error
- func ListCommand(input ListCommandInput, awsConfigFile *vault.ConfigFile, ...) (err error)
- func LoginCommand(ctx context.Context, input LoginCommandInput, f *vault.ConfigFile, ...) error
- func RemoveCommand(input RemoveCommandInput, keyring keyring.Keyring) error
- func RotateCommand(input RotateCommandInput, f *vault.ConfigFile, keyring keyring.Keyring) error
- type AddCommandInput
- type AwsVault
- type ClearCommandInput
- type ExecCommandInput
- type ExportCommandInput
- type ListCommandInput
- type LoginCommandInput
- type RemoveCommandInput
- type RotateCommandInput
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( FormatTypeEnv = "env" FormatTypeExportEnv = "export-env" FormatTypeExportJSON = "json" FormatTypeExportINI = "ini" )
Functions ¶
func AddCommand ¶
func AddCommand(input AddCommandInput, keyring keyring.Keyring, awsConfigFile *vault.ConfigFile) error
Example ¶
f, err := os.CreateTemp("", "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 ClearCommand ¶
func ClearCommand(input ClearCommandInput, awsConfigFile *vault.ConfigFile, keyring keyring.Keyring) error
func ConfigureAddCommand ¶
func ConfigureAddCommand(app *kingpin.Application, a *AwsVault)
func ConfigureClearCommand ¶
func ConfigureClearCommand(app *kingpin.Application, a *AwsVault)
func ConfigureExecCommand ¶
func ConfigureExecCommand(app *kingpin.Application, a *AwsVault)
func ConfigureExportCommand ¶
func ConfigureExportCommand(app *kingpin.Application, a *AwsVault)
func ConfigureListCommand ¶
func ConfigureListCommand(app *kingpin.Application, a *AwsVault)
func ConfigureLoginCommand ¶
func ConfigureLoginCommand(app *kingpin.Application, a *AwsVault)
func ConfigureProxyCommand ¶
func ConfigureProxyCommand(app *kingpin.Application)
func ConfigureRemoveCommand ¶
func ConfigureRemoveCommand(app *kingpin.Application, a *AwsVault)
func ConfigureRotateCommand ¶
func ConfigureRotateCommand(app *kingpin.Application, a *AwsVault)
func ExecCommand ¶
func ExecCommand(input ExecCommandInput, f *vault.ConfigFile, keyring keyring.Keyring) (exitcode int, 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"}`)}, }) ConfigureExecCommand(app, awsVault) kingpin.MustParse(app.Parse([]string{ "--debug", "exec", "--no-session", "llamas", "--", "sh", "-c", "echo $AWS_ACCESS_KEY_ID", }))
Output: ABC
func ExportCommand ¶
func ExportCommand(input ExportCommandInput, f *vault.ConfigFile, 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"}`)}, }) ConfigureExportCommand(app, awsVault) kingpin.MustParse(app.Parse([]string{ "export", "--format=ini", "--no-session", "llamas", }))
Output: [llamas] aws_access_key_id=ABC aws_secret_access_key=XYZ region=us-east-1
func ListCommand ¶
func ListCommand(input ListCommandInput, 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 LoginCommand ¶
func LoginCommand(ctx context.Context, input LoginCommandInput, f *vault.ConfigFile, keyring keyring.Keyring) error
LoginCommand creates a login URL for the AWS Management Console using the method described at https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html
func RemoveCommand ¶
func RemoveCommand(input RemoveCommandInput, keyring keyring.Keyring) error
func RotateCommand ¶
func RotateCommand(input RotateCommandInput, f *vault.ConfigFile, keyring keyring.Keyring) error
Types ¶
type AddCommandInput ¶
type AwsVault ¶
type AwsVault struct { Debug bool KeyringConfig keyring.Config KeyringBackend 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) MustGetProfileNames ¶
func (*AwsVault) PromptDriver ¶
type ClearCommandInput ¶
type ClearCommandInput struct {
ProfileName string
}
type ExecCommandInput ¶
type ExportCommandInput ¶
type ListCommandInput ¶
type LoginCommandInput ¶
type RemoveCommandInput ¶
type RotateCommandInput ¶
type RotateCommandInput struct { NoSession bool ProfileName string Config vault.ProfileConfig }
Click to show internal directories.
Click to hide internal directories.