utils

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: MIT Imports: 8 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

this function marshalls data into a file

func AwsConfigFileRead

func AwsConfigFileRead() string

this function reads the aws config file

func AwsCredentialsFile

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

this function marshalls data into a toml file

func AwsCredsFileRead

func AwsCredsFileRead() string

this function reads the aws credentials file

func AwsReplaceBlock

func AwsReplaceBlock(file string, accountName string) string

this function replaces within a file the block of text which matches the accountName input variable

func CacheFileExists

func CacheFileExists() bool

this function checks if a cache file exists

func CacheFileRead

func CacheFileRead() string

this function reads the cache file

func CheckAndReturnError

func CheckAndReturnError(err error)

this function 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

this function verifies the config file integrity

func CommandExists

func CommandExists(command string)

this function checks if a command exists

func ConfigFileResultString

func ConfigFileResultString(field string) string

this function parsers the struct and returns one field (string only) at a time

func GetHomeDirectory

func GetHomeDirectory() string

this function returns the caller $HOME directory

func TemplateCacheFile

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

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

func TemplateConfigFile

func TemplateConfigFile() string

this function marshalls data into a toml file (letme-config)

Types

type CacheFields

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

struct to parse cache data

func ParseCacheFile

func ParseCacheFile(account string) CacheFields

this function maps data on 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 to unmarshal toml (will be modified as new options are demanded)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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