travel

package
v2.10.4 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCache

func CheckCache(c Cache, h Hop) (creds.Creds, bool)

CheckCache returns credentials if they exist in the cache and are still valid If the credentials exist but are invalid/expired, it removes them from the cache

Types

type Cache

type Cache interface {
	Get(Hop) (creds.Creds, bool)
	Put(Hop, creds.Creds) error
	Delete(Hop) error
}

Cache defines a credential caching object

type Grapher

type Grapher struct {
	Prompt list.Prompt
	Pack   cartogram.Pack
}

Grapher defines a graph resolution object for finding paths to accounts

func (*Grapher) Resolve

func (g *Grapher) Resolve(args, roleNames, profileNames []string) (Path, error)

Resolve selects a valid path to the target account and role

func (*Grapher) ResolveAll added in v2.1.0

func (g *Grapher) ResolveAll(args, roleNames, profileNames []string) ([]Path, error)

ResolveAll selects all matching paths based on provided args

func (*Grapher) ResolveWithOptions added in v2.10.0

func (g *Grapher) ResolveWithOptions(opts ResolveOptions) (Path, error)

ResolveWithOptions resolves a valid path using the provided options and the graph

type Hop

type Hop struct {
	Profile string
	Account string
	Role    string
	Mfa     bool
	Region  string
}

Hop defines an individual node on the path from initial credentials to the target role

func (Hop) Traverse

func (h Hop) Traverse(c creds.Creds, opts TraverseOptions) (creds.Creds, error)

Traverse executes a Hop, returning the new credentials

type MapCache

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

MapCache stores credentials in a map object based on the hop information

func (*MapCache) Delete

func (mc *MapCache) Delete(h Hop) error

Delete removes credentials from the cache

func (*MapCache) Get

func (mc *MapCache) Get(h Hop) (creds.Creds, bool)

Get returns credentials from the map, if they exist

func (*MapCache) Put

func (mc *MapCache) Put(h Hop, c creds.Creds) error

Put stores the credentials in the map

type NullCache

type NullCache struct{}

NullCache implements an empty cache which stores nothing

func (*NullCache) Delete

func (nc *NullCache) Delete(_ Hop) error

Delete is a no-op for NullCache

func (*NullCache) Get

func (nc *NullCache) Get(_ Hop) (creds.Creds, bool)

Get for NullCache always returns empty Creds / false

func (*NullCache) Put

func (nc *NullCache) Put(_ Hop, _ creds.Creds) error

Put is a no-op for NullCache

type Path

type Path []Hop

Path defines a set of hops to reach the target account

func (Path) Traverse

func (p Path) Traverse() (creds.Creds, error)

Traverse executes a path and returns the final resulting credentials using the default set of TraverseOptions

func (Path) TraverseWithOptions

func (p Path) TraverseWithOptions(opts TraverseOptions) (creds.Creds, error)

TraverseWithOptions executes a path and returns the final resulting credentials

type ResolveOptions added in v2.10.0

type ResolveOptions struct {
	Args         []string
	RoleNames    []string
	ProfileNames []string
	Region       string
}

ResolveOptions allow passing structured parameters for graph resolution

type TraverseOptions

type TraverseOptions struct {
	MfaCode        string
	MfaPrompt      creds.MfaPrompt
	Store          profiles.Store
	Cache          Cache
	SessionName    string
	Lifetime       int64
	UserAgentItems []creds.UserAgentItem
}

TraverseOptions defines the parameters for traversing a path

func DefaultTraverseOptions

func DefaultTraverseOptions() TraverseOptions

DefaultTraverseOptions returns a standard set of TraverseOptions

Jump to

Keyboard shortcuts

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