utils

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var API = api{}

API exposes the STS API and related info

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",
	},
	"console": {
		"sessionId":    "AccessKey",
		"sessionKey":   "SecretKey",
		"sessionToken": "SessionToken",
	},
}

Translations defines common mappings for credential variables

View Source
var Version = "unset"

Version is overriden by link flags during build

Functions

This section is empty.

Types

type Assumption

type Assumption struct {
	RoleName    string
	AccountID   string
	SessionName string
	Policy      string
	Lifetime
	Mfa
}

Assumption describes the parameters that result in a Role

func (*Assumption) Execute added in v0.0.3

func (a *Assumption) Execute() (Creds, error)

Execute actions a role assumption object with creds from the environment

func (*Assumption) ExecuteWithCreds added in v0.0.5

func (a *Assumption) ExecuteWithCreds(c Creds) (Creds, error)

ExecuteWithCreds actions a role assumption with provided creds

func (*Assumption) ParseFlags added in v0.0.3

func (a *Assumption) ParseFlags(cmd *cobra.Command) error

ParseFlags for assumption object

type Creds added in v0.0.3

type Creds struct {
	AccessKey, SecretKey, SessionToken string
}

Creds defines a set of AWS credentials

func (*Creds) New added in v0.0.3

func (c *Creds) New(argCreds map[string]string) error

New initializes credentials from a map

func (*Creds) NewFromEnv added in v0.0.3

func (c *Creds) NewFromEnv() error

NewFromEnv initializes credentials from the environment variables

func (*Creds) NewFromStsSdk added in v0.0.5

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

NewFromStsSdk initializes a credential object from an AWS SDK Credentials object

func (Creds) ToConsoleURL added in v0.0.3

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

ToConsoleURL returns a console URL for the role

func (Creds) ToEnvVars added in v0.0.3

func (c Creds) ToEnvVars() []string

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

func (*Creds) ToSdk added in v0.0.5

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

ToSdk returns an AWS SDK Credentials object

func (Creds) Translate added in v0.0.3

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

Translate converts credentials based on a map of field names

type CredsExecutor added in v0.0.3

type CredsExecutor interface {
	ParseFlags(*cobra.Command) error
	Execute() (Creds, error)
	ExecuteWithCreds(Creds) (Creds, error)
}

CredsExecutor defines the interface for requesting a new set of AWS creds

type Lifetime added in v0.0.3

type Lifetime struct {
	LifetimeInt int64
}

Lifetime object encapsulates the setup of session duration

type Mfa added in v0.0.3

type Mfa struct {
	UseMfa  bool
	MfaCode string
}

Mfa object encapsulates the setup of MFA for API calls

type Signin added in v0.0.3

type Signin struct {
	Lifetime
	Mfa
}

Signin describes the parameters to perform GetSigninToken

func (*Signin) Execute added in v0.0.3

func (s *Signin) Execute() (Creds, error)

Execute actions the signin object with creds from the environment

func (*Signin) ExecuteWithCreds added in v0.0.5

func (s *Signin) ExecuteWithCreds(c Creds) (Creds, error)

ExecuteWithCreds actions the signin object with the provided creds

func (*Signin) ParseFlags added in v0.0.3

func (s *Signin) ParseFlags(cmd *cobra.Command) error

ParseFlags for signin object

Jump to

Keyboard shortcuts

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