helper

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CARSelector added in v0.0.2

func CARSelector(cCtx *cli.Context, car *kion.CAR) error

CARSelector is a wizard that walks a user through the selection of a Project, then associated Accounts, then available Cloud Access Roles, to set the user selected Cloud Access Role. Optional account number and or car name can be passed via an existing car struct, the flow will dynamically ask what is needed to be able to find the full car.

func CreateSubShell

func CreateSubShell(accountNumber string, accountAlias string, carName string, stak kion.STAK, region string) error

CreateSubShell creates a sub-shell containing set variables for AWS short term access keys. It attempts to use the users configured shell and rc file while overriding the prompt to indicate the authed AWS account.

func FindCARByName

func FindCARByName(cars []kion.CAR, carName string) (*kion.CAR, error)

FindCARByName returns a CAR identified by its name.

func LoadConfig

func LoadConfig(filename string, config *structs.Configuration) error

LoadConfig reads in the configuration yaml file located at `configFile`.

func MapAccounts

func MapAccounts(accounts []kion.Account) ([]string, map[string]kion.Account)

MapAccounts transforms a slice of Accounts into a slice of their names and a map indexed by their names.

func MapAccountsFromCARS added in v0.1.0

func MapAccountsFromCARS(cars []kion.CAR, pid uint) ([]string, map[string]string)

MapAccountsFromCARS transforms a slice of CARs into a slice of account names and a map of account numbers indexed by their names. If a project ID is passed it will only return accounts in the given project. Note that some versions of Kion will not populate account metadata in CAR objects so use carefully (see useUpdatedCloudAccessRoleAPI bool).

func MapCAR

func MapCAR(cars []kion.CAR) ([]string, map[string]kion.CAR)

MapCAR transforms a slice of CARs into a slice of their names and a map indexed by their names.

func MapFavs

func MapFavs(favs []structs.Favorite) ([]string, map[string]structs.Favorite)

MapFavs transforms a slice of Favorites into a slice of their names and a map indexed by their names.

func MapIDMSs

func MapIDMSs(idmss []kion.IDMS) ([]string, map[string]kion.IDMS)

MapIDMSs transforms a slice of IDMSs into a slice of their names and a map indexed by their names.

func MapProjects

func MapProjects(projects []kion.Project) ([]string, map[string]kion.Project)

MapProjects transforms a slice of Projects into a slice of their names and a map indexed by their names.

func OpenBrowser

func OpenBrowser(url string, typeID uint) error

OpenBrowser opens up a URL in the users system default browser.

func PrintSTAK

func PrintSTAK(w io.Writer, stak kion.STAK, region string) error

PrintSTAK prints out the short term access keys for AWS auth.

func PromptInput

func PromptInput(message string) (string, error)

PromptInput prompts the user to provide dynamic input.

func PromptPassword

func PromptPassword(message string) (string, error)

PromptPassword prompts the user to provide sensitive dynamic input.

func PromptSelect

func PromptSelect(message string, options []string) (string, error)

PromptSelect prompts the user to select from a slice of options. It requires that the selection made be one of the options provided.

func RunCommand

func RunCommand(accountNumber string, accountAlias string, carName string, stak kion.STAK, region string, cmd string, args ...string) error

RunCommand executes a one time command with AWS credentials set within the environment. Command output is sent directly to stdout / stderr.

func SaveAWSCreds added in v0.1.0

func SaveAWSCreds(stak kion.STAK, car kion.CAR) error

SaveAWSCreds saves the short term access keys for AWS auth to the users AWS configuration file.

func SaveConfig

func SaveConfig(filename string, config structs.Configuration) error

SaveConfig saves the entirety of the current config to the users config file.

func SaveSession

func SaveSession(filename string, config structs.Configuration) error

SaveSession updates the session section only of the users config file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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