Documentation
¶
Index ¶
- Variables
- func AssumeRole(letmeContext *LetmeContext, cfg aws.Config, inlineTokenMfa string, ...) (ProfileCredential, ProfileConfig)
- func AssumeRoleChained(letmeContext *LetmeContext, cfg aws.Config, inlineTokenMfa string, ...) (ProfileCredential, ProfileConfig)
- func AwsConfigFileCredentialsProcessV1(accountName string, region string)
- func AwsConfigFileReadV2() *ini.File
- func AwsCredsFileReadV2() *ini.File
- func CacheFileExists() bool
- func CheckAccountAvailability(accountName string) bool
- func CheckAccountLocally(account string) map[string]bool
- func CheckAndReturnError(err error)
- func CheckConfigFile(path string) bool
- func CommandExists(command string)
- func CredentialsProcessOutput(accessKeyID string, secretAccessKey string, sessionToken string, ...) string
- func DatabaseFile(accountName string, sessionDuration int32, v1Credentials string, ...)
- func GetAvalaibleContexts() []string
- func GetCurrentContext() string
- func GetHomeDirectory() string
- func LetmeConfigCreate()
- func LetmeConfigRead() *ini.File
- func ListJsonOutput(accountList []DynamoDbAccountConfig)
- func ListTextOutput(accountList []DynamoDbAccountConfig)
- func LoadAwsConfig(profileName string, profileConfig ProfileConfig)
- func LoadAwsCredentials(profileName string, profileCredential ProfileCredential)
- func NewContext(context string)
- func RemoveAccountFromDatabaseFile(accountName string)
- func ReturnAccountCredentials(accountName string) map[string]string
- func TemplateConfigFile(stdout bool)
- func UpdateContext(context string)
- type Account
- type AccountItem
- type AccountItems
- type Context
- type CredentialsProcess
- type Dataset
- type DynamoDbAccountConfig
- type LetmeContext
- type ProfileConfig
- type ProfileCredential
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, "tags": 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 AssumeRole ¶ added in v0.2.0
func AssumeRole(letmeContext *LetmeContext, cfg aws.Config, inlineTokenMfa string, account *DynamoDbAccountConfig, renew bool, localCredentialProcessFlagV1 bool, authMethod string) (ProfileCredential, ProfileConfig)
func AssumeRoleChained ¶ added in v0.2.0
func AssumeRoleChained(letmeContext *LetmeContext, cfg aws.Config, inlineTokenMfa string, account *DynamoDbAccountConfig, renew bool, localCredentialProcessFlagV1 bool, authMethod string) (ProfileCredential, ProfileConfig)
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 AwsConfigFileReadV2 ¶ added in v0.2.0
func AwsConfigFileReadV2() *ini.File
func AwsCredsFileReadV2 ¶ added in v0.2.0
func AwsCredsFileReadV2() *ini.File
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 LetmeContext
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 int32, 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 GetAvalaibleContexts ¶ added in v0.2.0
func GetAvalaibleContexts() []string
func GetCurrentContext ¶ added in v0.2.0
func GetCurrentContext() string
func LetmeConfigCreate ¶ added in v0.2.0
func LetmeConfigCreate()
func LetmeConfigRead ¶ added in v0.2.0
func LetmeConfigRead() *ini.File
func ListJsonOutput ¶ added in v0.2.1
func ListJsonOutput(accountList []DynamoDbAccountConfig)
func ListTextOutput ¶ added in v0.2.1
func ListTextOutput(accountList []DynamoDbAccountConfig)
func LoadAwsConfig ¶ added in v0.2.0
func LoadAwsConfig(profileName string, profileConfig ProfileConfig)
func LoadAwsCredentials ¶ added in v0.2.0
func LoadAwsCredentials(profileName string, profileCredential ProfileCredential)
func NewContext ¶ added in v0.2.0
func NewContext(context string)
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(stdout bool)
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 AccountItem ¶ added in v0.2.1
type AccountItems ¶ added in v0.2.1
type AccountItems struct {
Items []AccountItem `json:"items"`
}
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 DynamoDbAccountConfig ¶ added in v0.2.0
type DynamoDbAccountConfig struct { Name string `dynamodbav:"name"` Region []string `dynamodbav:"region"` Role []string `dynamodbav:"role"` Tags []string `dynamodbav:"tags"` }
func GetAccount ¶ added in v0.2.0
func GetAccount(awsDynamoDbTable string, cfg aws.Config, profileName string) *DynamoDbAccountConfig
func GetTableData ¶ added in v0.2.1
func GetTableData(awsDynamoDbTable string, tags []string, cfg aws.Config) (resp []DynamoDbAccountConfig)
type LetmeContext ¶ added in v0.2.0
type LetmeContext struct { AwsSourceProfile string `ini:"aws_source_profile"` AwsSourceProfileRegion string `ini:"aws_source_profile_region"` AwsDynamoDbTable string `ini:"dynamodb_table"` AwsMfaArn string `ini:"mfa_arn"` AwsSessionName string `ini:"session_name"` AwsSessionDuration int32 `ini:"session_duration"` Tags []string `ini:"tags"` }
func GetContextData ¶ added in v0.2.0
func GetContextData(context string) *LetmeContext