Documentation
¶
Index ¶
- Variables
- func AwsConfigFile(accountName string, region string) string
- func AwsConfigFileCredentialsProcessV1(accountName string, region string) string
- func AwsConfigFileRead() string
- func AwsCredentialsFile(accountName string, accessKeyID string, secretAccessKey string, ...) string
- func AwsCredsFileRead() string
- func AwsReplaceBlock(file string, accountName string) string
- func AwsSingleReplaceBlock(file string, accountName string) string
- func CacheFileExists() bool
- func CheckAccountAvailability(accountName string) bool
- func CheckAccountLocally(account string) string
- func CheckAndReturnError(err error)
- func CheckConfigFile(path string) bool
- func CommandExists(command string)
- func ConfigFileResultString(profile string, field string) interface{}
- func CredentialsProcessOutput(accessKeyID string, secretAccessKey string, sessionToken string, ...) string
- func DatabaseFile(accountName string, sessionDuration int64, v1Credentials string, ...)
- func GetCurrentContext() string
- func GetHomeDirectory() string
- func GetLatestRequestedTime(content string) string
- func RemoveAccountFromDatabaseFile(accountName string)
- func ReturnAccountCredentials(accountName string) map[string]string
- func TemplateConfigFile() string
- func UpdateContext(context string)
- type Account
- type CredentialsProcess
- type Dataset
- type GeneralParams
- type UserSettings
Constants ¶
This section is empty.
Variables ¶
var ExpectedKeys = map[string]bool{ "aws_source_profile": true, "aws_source_profile_region": true, "dynamodb_table": true, "mfa_arn": true, "session_name": true, "session_duration": true, }
Expected keys in letme-config file
var MandatoryKeys = []string{
"aws_source_profile",
"aws_source_profile_region",
"dynamodb_table",
}
Mandatory keys in letme-config file
Functions ¶
func AwsConfigFile ¶
Marshalls data into a string used for the aws credentials file
func AwsConfigFileCredentialsProcessV1 ¶ added in v0.2.0
Marshalls data into a string used for the aws config file but with the v1 output protocol
func AwsCredentialsFile ¶
func AwsCredentialsFile(accountName string, accessKeyID string, secretAccessKey string, sessionToken string) string
Marshalls data into a string used for the aws credentials file
func AwsReplaceBlock ¶
Removes from a file all text in between two indentificators (accountName)
func AwsSingleReplaceBlock ¶ added in v0.1.5
Returns only the text entry which statisfies the accountName
func CacheFileExists ¶
func CacheFileExists() bool
Checks if the .letme-cache file exists, this file is not supported starting from versions 0.2.0 and above
func CheckAccountAvailability ¶ added in v0.2.0
Compare the current local time with the expiry field in the .letme-db file. If current time has not yet surpassed expiry time, return true. Else, return false indicating new credentials need to be requested.
func CheckAccountLocally ¶ added in v0.1.5
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 ¶
Verify if the config-file respects the struct GeneralParams
func ConfigFileResultString ¶
Parses letme-config file and returns one field at a time
func CredentialsProcessOutput ¶ added in v0.2.0
func CredentialsProcessOutput(accessKeyID string, secretAccessKey string, sessionToken string, expirationTime time.Time) string
Return aws credentials following the credentials_process standard https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sourcing-external.html
func DatabaseFile ¶ added in v0.2.0
func DatabaseFile(accountName string, sessionDuration int64, v1Credentials string, authMethod string)
Create a file which stores the last time when credentials where requested. Then query if the account exists, if not, it will create its first entry.
func GetCurrentContext ¶ added in v0.2.0
func GetCurrentContext() string
func GetLatestRequestedTime ¶ added in v0.1.5
Return the latest requested time from a block of text
func RemoveAccountFromDatabaseFile ¶ added in v0.2.0
func RemoveAccountFromDatabaseFile(accountName string)
Remove an account from the database file
func ReturnAccountCredentials ¶ added in v0.2.0
Check if the account to retrieve stored credentials exist, if true, return the credentials to stdout
func TemplateConfigFile ¶
func TemplateConfigFile() string
Marshalls data into a toml file (config-file)
func UpdateContext ¶ added in v0.2.0
func UpdateContext(context string)
Create the .letme-usersettings file which holds the current context and more
Types ¶
type CredentialsProcess ¶ added in v0.2.0
type CredentialsProcess struct { Version int AccessKeyId string SecretAccessKey string SessionToken string Expiration time.Time }
Struct which states the credential process output for the v1 protocol
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 Session_duration int64 `toml:"session_duration,omitempty"` }
Struct which represents the config-file keys
type UserSettings ¶
type UserSettings struct {
ActiveContext string `json:"activeContext"`
}
UserSettings represents the structure of the .letme-usersettings file.