iamy

package
v2.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2019 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const MaxAllowedPolicyVersions = 5

MaxAllowedPolicyVersions are the number of Versions of a managed policy that can be stored See http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html

View Source
const NoSuchBucketPolicyErrCode = "NoSuchBucketPolicy"

Variables

This section is empty.

Functions

func Arn

func Arn(r AwsResource, a *Account) string

func GetAwsAccountId

func GetAwsAccountId(sess *session.Session, debug *log.Logger) (string, error)

GetAwsAccountId determines the AWS account id associated with the given session

Types

type Account

type Account struct {
	Id    string
	Alias string
}

func NewAccountFromString

func NewAccountFromString(s string) *Account

func (Account) String

func (a Account) String() string

type AccountData

type AccountData struct {
	Account          *Account
	Users            []*User
	Groups           []*Group
	Roles            []*Role
	Policies         []*Policy
	BucketPolicies   []*BucketPolicy
	InstanceProfiles []*InstanceProfile
}

func NewAccountData

func NewAccountData(account string) *AccountData

func (*AccountData) FindBucketPolicyByBucketName

func (a *AccountData) FindBucketPolicyByBucketName(name string) (bool, *BucketPolicy)

func (*AccountData) FindGroupByName

func (a *AccountData) FindGroupByName(name, path string) (bool, *Group)

func (*AccountData) FindInstanceProfileByName

func (a *AccountData) FindInstanceProfileByName(name, path string) (bool, *InstanceProfile)

func (*AccountData) FindPolicyByName

func (a *AccountData) FindPolicyByName(name, path string) (bool, *Policy)

func (*AccountData) FindRoleByName

func (a *AccountData) FindRoleByName(name, path string) (bool, *Role)

func (*AccountData) FindUserByName

func (a *AccountData) FindUserByName(name, path string) (bool, *User)

type AwsFetcher

type AwsFetcher struct {
	// As Policy and Role descriptions are immutable, we can skip fetching them
	// when pushing to AWS
	SkipFetchingPolicyAndRoleDescriptions bool

	Debug *log.Logger
	// contains filtered or unexported fields
}

AwsFetcher fetches account data from AWS

func (*AwsFetcher) Fetch

func (a *AwsFetcher) Fetch() (*AccountData, error)

Fetch queries AWS for account data

type AwsResource

type AwsResource interface {
	Service() string
	ResourceType() string
	ResourceName() string
	ResourcePath() string
}

type BucketPolicy

type BucketPolicy struct {
	BucketName string          `json:"-"`
	Policy     *PolicyDocument `json:"Policy"`
}

func (BucketPolicy) ResourceName

func (bp BucketPolicy) ResourceName() string

func (BucketPolicy) ResourcePath

func (bp BucketPolicy) ResourcePath() string

func (BucketPolicy) ResourceType

func (bp BucketPolicy) ResourceType() string

func (BucketPolicy) Service

func (bp BucketPolicy) Service() string

type Cmd

type Cmd struct {
	Name string
	Args []string
}

func (Cmd) IsDestructive

func (c Cmd) IsDestructive() bool

IsDestructive indicates if the aws command is destructive

func (Cmd) String

func (c Cmd) String() string

type CmdList

type CmdList []Cmd

func AwsCliCmdsForSync

func AwsCliCmdsForSync(from, to *AccountData) CmdList

func (*CmdList) Add

func (cc *CmdList) Add(name string, args ...string)

func (CmdList) Count

func (cc CmdList) Count() int

func (CmdList) CountDestructive

func (cc CmdList) CountDestructive() int

func (CmdList) String

func (cc CmdList) String() string

type Group

type Group struct {
	InlinePolicies []InlinePolicy `json:"InlinePolicies,omitempty"`
	Policies       []string       `json:"Policies,omitempty"`
	// contains filtered or unexported fields
}

func (Group) ResourceName

func (s Group) ResourceName() string

func (Group) ResourcePath

func (s Group) ResourcePath() string

func (Group) ResourceType

func (g Group) ResourceType() string

func (Group) Service

func (s Group) Service() string

type InlinePolicy

type InlinePolicy struct {
	Name   string          `json:"Name"`
	Policy *PolicyDocument `json:"Policy"`
}

type InstanceProfile

type InstanceProfile struct {
	Roles []string `json:"Roles,omitempty"`
	// contains filtered or unexported fields
}

func (InstanceProfile) ResourceName

func (s InstanceProfile) ResourceName() string

func (InstanceProfile) ResourcePath

func (s InstanceProfile) ResourcePath() string

func (InstanceProfile) ResourceType

func (ip InstanceProfile) ResourceType() string

func (InstanceProfile) Service

func (s InstanceProfile) Service() string

type Policy

type Policy struct {
	Description string          `json:"Description,omitempty"`
	Policy      *PolicyDocument `json:"Policy"`
	// contains filtered or unexported fields
}

func (Policy) ResourceName

func (s Policy) ResourceName() string

func (Policy) ResourcePath

func (s Policy) ResourcePath() string

func (Policy) ResourceType

func (p Policy) ResourceType() string

func (Policy) Service

func (s Policy) Service() string

type PolicyDocument

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

PolicyDocument represents an AWS policy document. It normalises the data when Marshaling and Unmarshaling JSON the same way AWS does to avoid conflicts when diffing

func NewPolicyDocumentFromEncodedJson

func NewPolicyDocumentFromEncodedJson(encoded string) (*PolicyDocument, error)

func (*PolicyDocument) JsonString

func (p *PolicyDocument) JsonString() string

func (PolicyDocument) MarshalJSON

func (p PolicyDocument) MarshalJSON() ([]byte, error)

func (*PolicyDocument) UnmarshalJSON

func (p *PolicyDocument) UnmarshalJSON(jsonData []byte) error

type Role

type Role struct {
	Description              string          `json:"Description,omitempty"`
	AssumeRolePolicyDocument *PolicyDocument `json:"AssumeRolePolicyDocument"`
	InlinePolicies           []InlinePolicy  `json:"InlinePolicies,omitempty"`
	Policies                 []string        `json:"Policies,omitempty"`
	// contains filtered or unexported fields
}

func (Role) ResourceName

func (s Role) ResourceName() string

func (Role) ResourcePath

func (s Role) ResourcePath() string

func (Role) ResourceType

func (r Role) ResourceType() string

func (Role) Service

func (s Role) Service() string

type User

type User struct {
	Groups         []string          `json:"Groups,omitempty"`
	InlinePolicies []InlinePolicy    `json:"InlinePolicies,omitempty"`
	Policies       []string          `json:"Policies,omitempty"`
	Tags           map[string]string `json:"Tags,omitempty"`
	// contains filtered or unexported fields
}

func (User) ResourceName

func (s User) ResourceName() string

func (User) ResourcePath

func (s User) ResourcePath() string

func (User) ResourceType

func (u User) ResourceType() string

func (User) Service

func (s User) Service() string

type YamlLoadDumper

type YamlLoadDumper struct {
	Dir string
}

A YamlLoadDumper loads and dumps account data in yaml files

func (*YamlLoadDumper) Dump

func (f *YamlLoadDumper) Dump(accountData *AccountData, canDelete bool) error

Dump writes AccountData into yaml files in the a.Dir directory

func (*YamlLoadDumper) Load

func (a *YamlLoadDumper) Load() ([]AccountData, error)

Load reads yaml files in a.Dir and returns the AccountData

Jump to

Keyboard shortcuts

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