Documentation ¶
Index ¶
- Constants
- func Arn(r AwsResource, a *Account) string
- func GetAwsAccountId(sess *session.Session, debug *log.Logger) (string, error)
- type Account
- type AccountData
- func (a *AccountData) FindBucketPolicyByBucketName(name string) (bool, *BucketPolicy)
- func (a *AccountData) FindGroupByName(name, path string) (bool, *Group)
- func (a *AccountData) FindInstanceProfileByName(name, path string) (bool, *InstanceProfile)
- func (a *AccountData) FindPolicyByName(name, path string) (bool, *Policy)
- func (a *AccountData) FindRoleByName(name, path string) (bool, *Role)
- func (a *AccountData) FindUserByName(name, path string) (bool, *User)
- type AwsFetcher
- type AwsResource
- type BucketPolicy
- type Cmd
- type CmdList
- type Group
- type InlinePolicy
- type InstanceProfile
- type Policy
- type PolicyDocument
- type Role
- type User
- type YamlLoadDumper
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
Types ¶
type Account ¶
func NewAccountFromString ¶
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 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 ¶
func (Cmd) IsDestructive ¶
IsDestructive indicates if the aws command is destructive
type CmdList ¶
type CmdList []Cmd
func AwsCliCmdsForSync ¶
func AwsCliCmdsForSync(from, to *AccountData) CmdList
func (CmdList) CountDestructive ¶
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 ¶
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
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 ¶
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 ¶
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 ¶
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
Click to show internal directories.
Click to hide internal directories.