aws

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAWSLoginURL added in v0.0.5

func CreateAWSLoginURL(sessionId string, sessionKey string, sessionToken string, issuer string) (string, error)

CreateAWSLoginURL returns a federation AWS URL used for wev console login This uses AWS Security Token Service (AWS STS) AssumeRole More info at: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html Thanks to Lachlan Donald for the following code: https://github.com/99designs/aws-vault

func CreateRegionalURL added in v0.0.5

func CreateRegionalURL(region string, path string) (string, string)

CreateRegionalURL creates signin and console URLs based on the region/path provided

Types

type Aws

type Aws struct {
	// contains filtered or unexported fields
}

Aws is the main object

func New

func New(config *Config) (*Aws, error)

New builds a client from the provided config

func (*Aws) CreateSession added in v0.0.5

func (a *Aws) CreateSession(accessKey string, secretKey string) error

func (*Aws) GetCredentialPath added in v0.0.5

func (a *Aws) GetCredentialPath() (string, error)

GetCredentialPath gets the filepath to the credential path in the user's home directory

func (*Aws) GetFederationToken added in v0.0.4

func (a *Aws) GetFederationToken(name string, duration time.Duration) *sts.Credentials

GetFederationToken takes in a name and returns a set of STS Credentials based on the current session

func (*Aws) MapProfile added in v0.0.5

func (a *Aws) MapProfile(name string, profiles ...interface{}) error

MapProfile gets an AWS profile from the user's credentials file and maps it, if found, to the given interface(s)

func (*Aws) SaveProfile added in v0.0.5

func (a *Aws) SaveProfile(name string, profile *Profile, setAsDefault bool, additionalProfiles ...interface{}) error

SaveProfile saves the given profile(s)/section(s) to file, optionally also saving it as the default profile. The Profile type is requried and additional profile fields can be added with the additionalProfiles parameter

func (*Aws) WaitForActiveCreds added in v0.0.4

func (a *Aws) WaitForActiveCreds()

WaitForActiveCreds waits for the current session to become valid This is useful when IAM credentials were just provisioned and we need to wait until they're active to take the next step.

type Config

type Config struct {
	AccessKey string
	SecretKey string
	Log       Logger
}

type Logger added in v0.0.4

type Logger interface {
	Debug(args ...interface{})
	Info(args ...interface{})
	Fatal(args ...interface{})
}

type Profile added in v0.0.5

type Profile struct {
	AccessKeyID     string `ini:"aws_access_key_id"`
	SecretAccessKey string `ini:"aws_secret_access_key"`
}

Profile is the base struct for creating new profiles

Jump to

Keyboard shortcuts

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