cartogram

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: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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

func (Account) AllProfiles added in v2.6.0

func (a Account) AllProfiles() []string

AllProfiles returns all unique profiles found

type AccountSet

type AccountSet []Account

AccountSet is a set of accounts

func (AccountSet) AllProfiles added in v2.6.0

func (as AccountSet) AllProfiles() []string

AllProfiles returns all unique profiles found

func (AccountSet) Lookup

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

Lookup finds an account in a Cartogram based on its ID

func (AccountSet) Search

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

func NewCartogram(as AccountSet) Cartogram

NewCartogram creates a new cartogram from an account set

func (Cartogram) AllProfiles added in v2.6.0

func (c Cartogram) AllProfiles() []string

AllProfiles returns all unique profiles found

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) AllProfiles added in v2.6.0

func (cp Pack) AllProfiles() []string

AllProfiles returns all unique profiles found

func (Pack) Find

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

Find checks both Lookup and Search for an account

func (Pack) FindWithPrompt

func (cp Pack) FindWithPrompt(args []string, prompt list.Prompt) (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 SourceSet `json:"sources"`
}

Role holds information about authenticating to a role

func (Role) AllProfiles added in v2.6.0

func (r Role) AllProfiles() []string

AllProfiles returns all unique profiles found

type RoleSet

type RoleSet []Role

RoleSet is a list of Roles

func (RoleSet) AllProfiles added in v2.6.0

func (rs RoleSet) AllProfiles() []string

AllProfiles returns all unique profiles found

func (RoleSet) Lookup

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

Lookup searches for a role by name

type Source

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

Source defines the previous hop for accessing a role

func (Source) AllProfiles added in v2.6.0

func (s Source) AllProfiles() []string

AllProfiles returns all unique profiles found

func (Source) IsProfile added in v2.6.0

func (s Source) IsProfile() bool

IsProfile returns true if the source hop is

func (Source) Parse added in v2.6.0

func (s Source) Parse() (string, string)

Parse returns the account and role for a non-profile Path, or two empty strings

type SourceSet added in v2.6.0

type SourceSet []Source

SourceSet is a list of Sources

func (SourceSet) AllProfiles added in v2.6.0

func (ss SourceSet) AllProfiles() []string

AllProfiles returns all unique profiles found

type SpecVersionError

type SpecVersionError struct {
	ActualVersion, ExpectedVersion int
}

SpecVersionError indicates the cartogram version doesn't match voyager version

func (SpecVersionError) Error

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