Documentation
¶
Overview ¶
Package helper provides utility functions for various common tasks.
Index ¶
- func CARSelector(cCtx *cli.Context, car *kion.CAR) error
- func CombineFavorites(localFavs []structs.Favorite, upstreamFavs []structs.Favorite) ([]structs.Favorite, *structs.FavoritesComparison, error)
- func CreateSubShell(accountNumber string, accountAlias string, carName string, stak kion.STAK, ...) error
- func FindCARByName(cars []kion.CAR, carName string) (*kion.CAR, error)
- func LoadConfig(filename string, config *structs.Configuration) error
- func MapAccounts(accounts []kion.Account) ([]string, map[string]kion.Account)
- func MapAccountsFromCARS(cars []kion.CAR, pid uint) ([]string, map[string]string)
- func MapCAR(cars []kion.CAR) ([]string, map[string]kion.CAR)
- func MapFavs(favs []structs.Favorite) ([]string, map[string]structs.Favorite)
- func MapIDMSs(idmss []kion.IDMS) ([]string, map[string]kion.IDMS)
- func MapProjects(projects []kion.Project) ([]string, map[string]kion.Project)
- func OpenBrowser(url string, typeID uint) errordeprecated
- func OpenBrowserRedirect(target string, session structs.SessionInfo, config structs.Browser, ...) error
- func PrintCredentialProcess(w io.Writer, stak kion.STAK) error
- func PrintFavoriteConfig(w io.Writer, car kion.CAR, region string, access_type string) error
- func PrintSTAK(w io.Writer, stak kion.STAK, region string) error
- func PromptInput(message string) (string, error)
- func PromptPassword(message string) (string, error)
- func PromptSelect(message string, description string, options []string) (string, error)
- func RunCommand(stak kion.STAK, region string, cmd string, args ...string) error
- func SaveAWSCreds(stak kion.STAK, car kion.CAR) error
- func SaveConfig(filename string, config structs.Configuration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CARSelector ¶ added in v0.0.2
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 CombineFavorites ¶ added in v0.15.0
func CombineFavorites(localFavs []structs.Favorite, upstreamFavs []structs.Favorite) ([]structs.Favorite, *structs.FavoritesComparison, error)
CombineFavorites combines local favorites with API favorites, identifying exact matches, unaliased matches, conflicts, and local-only favorites. It returns a combined slice of all favorites and a detailed comparison struct.
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 ¶
FindCARByName returns a CAR identified by its name.
func LoadConfig ¶
func LoadConfig(filename string, config *structs.Configuration) error
LoadConfig reads in the embedded configuration file as well as the users configuration yaml file located at `configFile`. Precedence is given to the users configuration file, so any values set there will override the embedded defaults.
func MapAccounts ¶
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
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 ¶
MapCAR transforms a slice of CARs into a slice of their names and a map indexed by their names.
func MapFavs ¶
MapFavs transforms a slice of Favorites into a slice of their names and a map indexed by their names.
func MapIDMSs ¶
MapIDMSs transforms a slice of IDMSs into a slice of their names and a map indexed by their names.
func MapProjects ¶
MapProjects transforms a slice of Projects into a slice of their names and a map indexed by their names.
func OpenBrowser
deprecated
func OpenBrowserRedirect ¶ added in v0.2.1
func OpenBrowserRedirect(target string, session structs.SessionInfo, config structs.Browser, redirect string, firefoxContainerName string) error
OpenBrowserDirect opens up a URL in the users system default browser. It uses the redirect_uri query parameter to handle the logout and redirect to the federated login page.
func PrintCredentialProcess ¶ added in v0.2.0
PrintCredentialProcess prints out the short term access keys for use with AWS profiles as a credential process subsystem.
func PrintFavoriteConfig ¶ added in v0.12.0
PrintFavoriteConfig prints out how to save the current selection as a favorite within the users configuration file.
func PromptInput ¶
PromptInput prompts the user to provide dynamic input.
func PromptPassword ¶
PromptPassword prompts the user to provide sensitive dynamic input.
func PromptSelect ¶
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 ¶
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
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.
Types ¶
This section is empty.