aws

package
v0.0.0-...-312487f Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCredentialNotFound = errors.New("No rotatable credential found. You may need to run aws configure")

ErrCredentialNotFound means no credential existed that can be rotated by cloudkey.

View Source
var ErrUnknownSource = errors.New("Unknown source in profile")

ErrUnknownSource is for a source not configured in our AWS cloud provider

View Source
var ErrUnsupportedIdentityType = errors.New("Unsupported Identity Type--only supports user type")

ErrUnsupportedIdentityType is for any IAM resource that's not a user

Functions

This section is empty.

Types

type Credential

type Credential struct {
	AccessKeyID     string `mapstructure:"aws_access_key_id"`
	SecretAccessKey string `mapstructure:"aws_secret_access_key"`
	SessionToken    string `mapstructure:"aws_session_token"`
}

Credential is an AWS credential from the credentials file

func FromAccessKey

func FromAccessKey(key iam.AccessKey) (Credential, error)

FromAccessKey converts an iam.AccessKey to a Credential

type Profile

type Profile struct {
	Name  string
	Cloud string
	Cred  Credential
	// config    Config
	Source    string
	IsCurrent bool
	sts.GetCallerIdentityOutput
	Session *session.Session
	STS     stsiface.STSAPI
	IAM     iamiface.IAMAPI
}

Profile is a local profile containing the credential and configuration.

func Current

func Current() (Profile, error)

Current gets the current profile

func FromEnviron

func FromEnviron() (Profile, error)

FromEnviron gets a profile from the credential environment variables

func GetByName

func GetByName(profileName string) (Profile, error)

GetByName gets the profile by name

func (*Profile) Lookup

func (p *Profile) Lookup() error

Lookup adds metadata from the cloud about the current proile

func (*Profile) NewIAM

func (p *Profile) NewIAM()

NewIAM creates a new IAM client from the current session

func (*Profile) NewSTS

func (p *Profile) NewSTS()

NewSTS creates a new STS client from the current session

func (*Profile) NewSession

func (p *Profile) NewSession() error

NewSession creates an AWS session

func (*Profile) String

func (p *Profile) String() string

String formats the profile's attributes to a string

func (*Profile) UpdateCredential

func (p *Profile) UpdateCredential(cred Credential) error

UpdateCredential locally updates the credential based on the profile type

type Profiles

type Profiles struct {
	Profiles []Profile
}

Profiles is a collection of Profile

func FromConfigFile

func FromConfigFile(findDefault bool) (Profiles, error)

FromConfigFile gets a list of profiles from the configuration file (default path/file is ~/.aws/credentials)

func (*Profiles) WriteConfig

func (p *Profiles) WriteConfig() error

WriteConfig writes the profiles to the default config file

func (*Profiles) WriteConfigAs

func (p *Profiles) WriteConfigAs(filename string) error

WriteConfigAs writes the profiles to the config filename specified

Jump to

Keyboard shortcuts

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