assume

package
v0.23.1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 39 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssumeCommand

func AssumeCommand(c *cli.Context) error

func Completion added in v0.2.1

func Completion(ctx *cli.Context)

If there are more than 2 args and the last argument is a "-" then provide completion for the flags.

Else, provide completion for the aws profiles.

You can use `assume -c ` + tab to get profile names or `assume -` + tab to get flags

func EnvKeys added in v0.1.13

func EnvKeys(creds aws.Credentials, region string) []string

EnvKeys is used to set the env for the "exec" flag

func GetCliApp

func GetCliApp() *cli.App

func GlobalFlags added in v0.1.4

func GlobalFlags() []cli.Flag

Prevent issues where these flags are initialised in some part of the program then used by another part For our use case, we need fresh copies of these flags in the app and in the assume command we use this to allow flags to be set on either side of the profile arg e.g `assume -c profile-name -r ap-southeast-2`

func PrepareStringsForShellScript added in v0.1.6

func PrepareStringsForShellScript(in []string) []interface{}

PrepareCredentialsForShellScript will set empty values to "None", this is required by the shell script to identify which variables to unset it is also required to ensure that the return values are correctly split, e.g if sessionToken is "" then profile name will be used to set the session token environment variable

func RunExecCommandWithCreds added in v0.1.13

func RunExecCommandWithCreds(creds aws.Credentials, region string, cmd string, args ...string) error

RunExecCommandWithCreds takes in a command, which may be a program and arguments separated by spaces it splits these then runs the command with the credentials as the environment. The output of this is returned via the assume script to stdout so it may be processed further by piping

func SSOProfileFromEnv added in v0.2.9

func SSOProfileFromEnv() (*cfaws.Profile, error)

SSOProfileFromEnv will prepare a profile to be assumed from environment variables

func SSOProfileFromFlags added in v0.2.6

func SSOProfileFromFlags(c *cli.Context) (*cfaws.Profile, error)

SSOProfileFromFlags will prepare a profile to be assumed from cli flags

func UnsetAction added in v0.1.8

func UnsetAction(c *cli.Context) error

func ValidateSSOFlags added in v0.2.6

func ValidateSSOFlags(c *cli.Context) error

Types

type Launcher added in v0.3.0

type Launcher interface {
	LaunchCommand(url string, profile string) []string
	// UseForkProcess returns true if the launcher implementation should call
	// the forkprocess library.
	//
	// For launchers that use 'open' commands, this should be false,
	// as the forkprocess library causes the following error to appear:
	// 	fork/exec open: no such file or directory
	UseForkProcess() bool
}

Launchers give a command that we need to run in order to launch a browser, such as 'open <URL>' or 'firefox --new-tab <URL'. The returned command is a string slice, with each element being an argument. (e.g. []string{"firefox", "--new-tab", "<URL>"})

Jump to

Keyboard shortcuts

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