awscreds

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONFIG_FILE      = "~/.aws/config"
	CREDENTIALS_FILE = "~/.aws/credentials" // #nosec
)

Variables

This section is empty.

Functions

func HasStaticCreds

func HasStaticCreds(s *ini.Section) bool

func SetLogger

func SetLogger(l *logrus.Logger)

Types

type AwsConfig

type AwsConfig struct {
	ConfigFile      string
	Config          *ini.File
	CredentialsFile string
	Credentials     *ini.File
	Profiles        map[string]map[string]interface{} // profile.go
}

func NewAwsConfig

func NewAwsConfig(config, credentials string) (*AwsConfig, error)

NewAwsConfig creates a new *AwsConfig struct

func (*AwsConfig) StaticProfiles

func (a *AwsConfig) StaticProfiles() ([]Profile, error)

StaticProfiles returns a list of all the profiles with static API creds stored in ~/.aws/config and ~/.aws/credentials

func (*AwsConfig) UpdateSecureStore

func (a *AwsConfig) UpdateSecureStore(store storage.SecureStorage) error

UpdateSecureStore writes any new role ARN credentials to the provided SecureStorage

func (*AwsConfig) Write

func (a *AwsConfig) Write() error

Write updates the AWS ~/.aws/config file to use aws-sso via a credential_process and removes the associated ~/.aws/credentials entries

type Profile

type Profile struct {
	// Required for import of static creds
	FromConfig      bool
	Name            string
	AccessKeyId     string `ini:"aws_access_key_id"`
	SecretAccessKey string `ini:"aws_secret_access_key"`
	MfaSerial       string `ini:"mfa_serial"`
}

func (*Profile) GetAccountAlias

func (p *Profile) GetAccountAlias() string

GetAccountAlias calls iam:ListAccountAliases to retrieve the AWS Account Alias. Returns an empty string if no alias has been set.

func (*Profile) GetArn

func (p *Profile) GetArn() (string, error)

GetArn uses the credentials to call sts:GetCallerIdentity to retrieve the ARN

Jump to

Keyboard shortcuts

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