creds

package
v0.10.5 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2019 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Translations = map[string]map[string]string{
	"envvar": {
		"AWS_ACCESS_KEY_ID":     "AccessKey",
		"AWS_SECRET_ACCESS_KEY": "SecretKey",
		"AWS_SESSION_TOKEN":     "SessionToken",
		"AWS_SECURITY_TOKEN":    "SessionToken",
		"AWS_DEFAULT_REGION":    "Region",
	},
	"console": {
		"sessionId":    "AccessKey",
		"sessionKey":   "SecretKey",
		"sessionToken": "SessionToken",
	},
}

Translations defines common mappings for credential variables

Functions

This section is empty.

Types

type Creds

type Creds struct {
	AccessKey, SecretKey, SessionToken, Region string
}

Creds defines a set of AWS credentials

func New

func New(argCreds map[string]string) (Creds, error)

New initializes credentials from a map

func NewFromEnv

func NewFromEnv() (Creds, error)

NewFromEnv initializes credentials from the environment variables

func NewFromStsSdk

func NewFromStsSdk(stsCreds *sts.Credentials) (Creds, error)

NewFromStsSdk initializes a credential object from an AWS SDK Credentials object

func (Creds) AccountID

func (c Creds) AccountID() (string, error)

AccountID returns the user's account ID

func (Creds) Client

func (c Creds) Client() *sts.STS

Client returns an AWS STS client for these creds

func (Creds) MfaArn

func (c Creds) MfaArn() (string, error)

MfaArn returns the user's virtual MFA token ARN

func (Creds) NextRoleArn

func (c Creds) NextRoleArn(role, inputAccountID string) (string, error)

NextRoleArn returns the new role's ARN

func (Creds) SessionName

func (c Creds) SessionName() (string, error)

SessionName returns the default session name

func (Creds) ToConsoleURL

func (c Creds) ToConsoleURL() (string, error)

ToConsoleURL returns a console URL for the role

func (Creds) ToCustomConsoleURL added in v0.10.4

func (c Creds) ToCustomConsoleURL(dest string) (string, error)

ToCustomConsoleURL returns a console URL with a custom path

func (Creds) ToEnvVars

func (c Creds) ToEnvVars() []string

ToEnvVars returns environment variables suitable for eval-ing into the shell

func (*Creds) ToSdk

func (c *Creds) ToSdk() *credentials.Credentials

ToSdk returns an AWS SDK Credentials object

func (Creds) ToSignoutURL

func (c Creds) ToSignoutURL() (string, error)

ToSignoutURL returns a signout URL for the console

func (Creds) Translate

func (c Creds) Translate(dictionary map[string]string) map[string]string

Translate converts credentials based on a map of field names

Jump to

Keyboard shortcuts

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