iam

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EntityType

type EntityType string

EntityType represents entity's type.

func NewEntityTypeGroup

func NewEntityTypeGroup() EntityType

NewEntityTypeGroup returns group's EntityType.

func NewEntityTypeRole

func NewEntityTypeRole() EntityType

NewEntityTypeRole returns role's EntityType.

func NewEntityTypeUser

func NewEntityTypeUser() EntityType

NewEntityTypeUser returns user's EntityType.

type Group

type Group struct {
	ARN        string
	GroupID    string
	GroupName  string
	Path       string
	CreateDate time.Time
}

Group contains IAM Group data.

func NewGroup

func NewGroup(g *SDK.Group) Group

NewGroup returns initialized Group from *SDK.Group.

func NewGroups

func NewGroups(list []*SDK.Group) []Group

NewGroups converts from []*SDK.Group to []Group.

type IAM

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

IAM has IAM client.

func New

func New(conf config.Config) (*IAM, error)

New returns initialized *IAM.

func (*IAM) Errorf

func (svc *IAM) Errorf(format string, v ...interface{})

Errorf logging error information.

func (*IAM) GetGroup

func (svc *IAM) GetGroup(groupName string) (*SDK.GetGroupOutput, error)

GetGroup executes GetGroup operation.

func (*IAM) GetGroupPolicyDocument

func (svc *IAM) GetGroupPolicyDocument(groupName, policyName string) (*PolicyDocument, error)

GetGroupPolicyDocument fetched Statement from user's inline policy.

func (*IAM) GetPolicyVersion

func (svc *IAM) GetPolicyVersion(arn, versionID string) (*SDK.PolicyVersion, error)

GetPolicyVersion executes GetPolicyVersion operation.

func (*IAM) GetRolePolicyDocument

func (svc *IAM) GetRolePolicyDocument(roleName, policyName string) (*PolicyDocument, error)

GetRolePolicyDocument fetched Statement from user's inline policy.

func (*IAM) GetUserPolicyDocument

func (svc *IAM) GetUserPolicyDocument(userName, policyName string) (*PolicyDocument, error)

GetUserPolicyDocument fetched Statement from user's inline policy.

func (*IAM) Infof

func (svc *IAM) Infof(format string, v ...interface{})

Infof logging information.

func (*IAM) ListAllPolicies

func (svc *IAM) ListAllPolicies() ([]Policy, error)

ListAllPolicies fetches all of the policies list.

func (*IAM) ListAttachedPolicies

func (svc *IAM) ListAttachedPolicies() ([]Policy, error)

ListAttachedPolicies fetches attached policy list.

func (*IAM) ListEntitiesForPolicy

func (svc *IAM) ListEntitiesForPolicy(arn string) ([]PolicyEntity, error)

ListEntitiesForPolicy executes ListEntitiesForPolicy operation.

func (*IAM) ListGroupPolicies

func (svc *IAM) ListGroupPolicies(groupName string) ([]string, error)

ListGroupPolicies fetches inline policies of the user.

func (*IAM) ListGroups

func (svc *IAM) ListGroups() ([]Group, error)

ListGroups fetches all of the group list.

func (*IAM) ListRolePolicies

func (svc *IAM) ListRolePolicies(roleName string) ([]string, error)

ListRolePolicies fetches inline policies of the user.

func (*IAM) ListRoles

func (svc *IAM) ListRoles() ([]Role, error)

ListRoles fetches all of the role list.

func (*IAM) ListUserPolicies

func (svc *IAM) ListUserPolicies(userName string) ([]string, error)

ListUserPolicies fetches inline policies of the user.

func (*IAM) ListUsers

func (svc *IAM) ListUsers() ([]User, error)

ListUsers fetches all of the user list.

func (*IAM) SetLogger

func (svc *IAM) SetLogger(logger log.Logger)

SetLogger sets logger.

type Policy

type Policy struct {
	ARN             string
	PolicyID        string
	PolicyName      string
	VersionID       string
	Description     string
	AttachmentCount int64
	CreateDate      time.Time
	UpdateDate      time.Time
}

Policy contains IAM policy data.

func NewPoilicy

func NewPoilicy(p *SDK.Policy) Policy

NewPoilicy returns initialized Policy from *SDK.Policy.

func NewPolicies

func NewPolicies(list []*SDK.Policy) []Policy

NewPolicies converts from []*SDK.Policy to []Policy.

type PolicyDocument

type PolicyDocument struct {
	Version   string      `json:"Version"`
	Statement []Statement `json:"Statement"`
}

PolicyDocument contains permission data of a policy.

func NewPolicyDocumentFromDocument

func NewPolicyDocumentFromDocument(document string) (PolicyDocument, error)

NewPolicyDocumentFromDocument returns initialized PolicyDocument from response data.

func NewPolicyDocumentFromJSONString

func NewPolicyDocumentFromJSONString(data string) (PolicyDocument, error)

NewPolicyDocumentFromJSONString returns initialized PolicyDocument from JSON data.

func (*PolicyDocument) UnmarshalJSON

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

UnmarshalJSON converts from json to *PolicyDocument.

type PolicyEntity

type PolicyEntity struct {
	Type EntityType
	ID   string
	Name string
}

PolicyEntity contains Entity's id and name. Entity is User, Group or Role.

func NewPolicyEntityList

func NewPolicyEntityList(o *SDK.ListEntitiesForPolicyOutput) []PolicyEntity

NewPolicyEntityList creates []PolicyEntity from *SDK.ListEntitiesForPolicyOutput.

func (PolicyEntity) IsGroup

func (e PolicyEntity) IsGroup() bool

IsGroup checks this entity is group or not.

func (PolicyEntity) IsRole

func (e PolicyEntity) IsRole() bool

IsRole checks this entity is role or not.

func (PolicyEntity) IsUser

func (e PolicyEntity) IsUser() bool

IsUser checks this entity is user or not.

type Role

type Role struct {
	ARN                      string
	RoleID                   string
	RoleName                 string
	Path                     string
	Description              string
	AssumeRolePolicyDocument string
	CreateDate               time.Time
}

Role contains IAM Role data.

func NewRole

func NewRole(r *SDK.Role) Role

NewRole returns initialized Role from *SDK.Role.

func NewRoles

func NewRoles(list []*SDK.Role) []Role

NewRoles converts from []*SDK.Role to []Role.

type Statement

type Statement struct {
	Sid      string   `json:"Sid"`
	Effect   string   `json:"Effect"`
	Action   []string `json:"Action"`
	Resource []string `json:"Resource"`
}

Statement represents statement of iam policy.

func (*Statement) IsAllow

func (s *Statement) IsAllow() bool

IsAllow checks that effect is allow.

func (*Statement) IsDeny

func (s *Statement) IsDeny() bool

IsDeny checks that effect is deny.

func (*Statement) UnmarshalJSON

func (s *Statement) UnmarshalJSON(data []byte) error

UnmarshalJSON converts from json to *Statement.

type User

type User struct {
	ARN              string
	UserID           string
	UserName         string
	Path             string
	CreateDate       time.Time
	PasswordLastUsed time.Time
}

User contains IAM User data.

func NewUser

func NewUser(u *SDK.User) User

NewUser returns initialized User from *SDK.User.

func NewUsers

func NewUsers(list []*SDK.User) []User

NewUsers converts from []*SDK.User to []User.

Jump to

Keyboard shortcuts

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