cartogram

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AccountRegex = regexp.MustCompile(accountRegexString)

AccountRegex matches an account number with an optional role name

Functions

This section is empty.

Types

type Account

type Account struct {
	Account string  `json:"account"`
	Region  string  `json:"region"`
	Roles   RoleSet `json:"roles"`
	Tags    Tags    `json:"tags"`
}

Account defines the spec for a role assumption target

type AccountSet added in v0.7.0

type AccountSet []Account

AccountSet is a set of accounts

func (AccountSet) Lookup added in v0.7.0

func (as AccountSet) Lookup(accountID string) (bool, Account)

Lookup finds an account in a Cartogram based on its ID

func (AccountSet) Search added in v0.7.0

func (as AccountSet) Search(tfs TagFilterSet) AccountSet

Search finds accounts based on their tags

type Cartogram

type Cartogram struct {
	Version    int        `json:"version"`
	Created    time.Time  `json:"created"`
	AccountSet AccountSet `json:"accounts"`
}

Cartogram defines a set of accounts and their metadata

func NewCartogram added in v0.7.0

func NewCartogram(as AccountSet) Cartogram

NewCartogram creates a new cartogram from an account set

func (Cartogram) Lookup

func (c Cartogram) Lookup(accountID string) (bool, Account)

Lookup finds an account in a Cartogram based on its ID

func (Cartogram) Search

func (c Cartogram) Search(tfs TagFilterSet) AccountSet

Search finds accounts based on their tags

type Pack

type Pack map[string]Cartogram

Pack defines a group of Cartograms

func (Pack) Find added in v0.7.0

func (cp Pack) Find(args []string) (Account, error)

Find checks both Lookup and Search for an account

func (Pack) FindWithPrompt added in v0.7.0

func (cp Pack) FindWithPrompt(args []string, pf prompt.Func) (Account, error)

FindWithPrompt checks both Lookup and Search for an account with a custom prompt

func (Pack) Load

func (cp Pack) Load() error

Load populates the Cartograms from disk

func (Pack) Lookup

func (cp Pack) Lookup(accountID string) (bool, Account)

Lookup finds an account in a Pack based on its ID

func (Pack) Search

func (cp Pack) Search(tfs TagFilterSet) AccountSet

Search finds accounts based on their tags

func (Pack) Write

func (cp Pack) Write() error

Write dumps the Cartograms to disk

type Role

type Role struct {
	Name    string   `json:"name"`
	Mfa     bool     `json:"mfa"`
	Sources []Source `json:"sources"`
}

Role holds information about authenticating to a role

type RoleSet added in v0.9.0

type RoleSet []Role

RoleSet is a list of Roles

func (RoleSet) Lookup added in v0.9.0

func (rs RoleSet) Lookup(name string) (bool, Role)

Lookup searches for a role by name

type Source added in v0.9.0

type Source struct {
	Path string `json:"path"`
}

Source defines the previous hop for accessing a role

type SpecVersionError added in v0.10.3

type SpecVersionError struct {
	ActualVersion, ExpectedVersion int
}

SpecVersionError indicates the cartogram version doesn't match voyager version

func (SpecVersionError) Error added in v0.10.3

func (s SpecVersionError) Error() string

type TagFilter

type TagFilter struct {
	Name  string
	Value *regexp.Regexp
}

TagFilter describes a filter to apply based on an account's tags

func (TagFilter) Match

func (tf TagFilter) Match(a Account) bool

Match checks if an account matches the tag filter

type TagFilterSet

type TagFilterSet []TagFilter

TagFilterSet describes a set of tag filters

func (*TagFilterSet) LoadFromArgs

func (tfs *TagFilterSet) LoadFromArgs(args []string) error

LoadFromArgs parses key:value args into a TagFilterSet

func (TagFilterSet) Match

func (tfs TagFilterSet) Match(a Account) bool

Match checks if an account matches the tag filter set

type Tags

type Tags map[string]string

Tags are a set of metadata about an account

func (Tags) String

func (t Tags) String() string

String converts tags to a human-readable string

Jump to

Keyboard shortcuts

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