utils

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AwsConfigFile

func AwsConfigFile(accountName string, region string) string

marshalls data into a string

func AwsConfigFileRead

func AwsConfigFileRead() string

reads the aws config file

func AwsCredentialsFile

func AwsCredentialsFile(accountName string, accessKeyID string, secretAccessKey string, sessionToken string) string

marshalls data into a string

func AwsCredsFileRead

func AwsCredsFileRead() string

reads the aws credentials file

func AwsReplaceBlock

func AwsReplaceBlock(file string, accountName string) string

removes from a file all text in between two strings

func AwsSingleReplaceBlock added in v0.1.5

func AwsSingleReplaceBlock(file string, accountName string) string

returns only the text entry which statisfies the accountName

func CacheFileExists

func CacheFileExists() bool

checks if a cache file exists

func CacheFileRead

func CacheFileRead() string

reads the cache file

func CheckAccountLocally added in v0.1.5

func CheckAccountLocally(account string) string

check if an account is present on the local aws credentials/config files

func CheckAndReturnError

func CheckAndReturnError(err error)

checks the error, if the error contains a message, stop the execution and show the error to the user

func CheckConfigFile

func CheckConfigFile(path string) bool

verify config-file integrity

func CommandExists

func CommandExists(command string)

check if a command exists on the host machine

func ConfigFileResultString

func ConfigFileResultString(field string) string

parses letme-config file and returns one field at a time

func GetHomeDirectory

func GetHomeDirectory() string

gets user's $HOME directory

func GetLatestRequestedTime added in v0.1.5

func GetLatestRequestedTime(content string) string

return the latest requested time from a block of text

func TemplateCacheFile

func TemplateCacheFile(accountName string, accountID int, accountRole []string, accountRegion []string) string

marshalls data into a toml file (.letme-cache)

func TemplateConfigFile

func TemplateConfigFile() string

marshalls data into a toml file (config-file)

Types

type CacheFields

type CacheFields struct {
	Id     int      `toml:"id"`
	Name   string   `toml:"name"`
	Role   []string `toml:"role"`
	Region []string `toml:"region"`
}

struct which represents the cache file toml keys

func ParseCacheFile

func ParseCacheFile(account string) CacheFields

maps data from the cache file into a struct

type GeneralParams

type GeneralParams struct {
	Aws_source_profile        string
	Aws_source_profile_region string `toml:"aws_source_profile_region,omitempty"`
	Dynamodb_table            string
	Mfa_arn                   string `toml:"mfa_arn,omitempty"`
	Session_name              string
}

struct which represents the config-file toml keys

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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