iam

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: AGPL-3.0 Imports: 13 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrCode

func ErrCode(msg string, err error) error

func PolicyDeepEqual

func PolicyDeepEqual(p1, p2 PolicyDocument) bool

Types

type Condition

type Condition map[string]ConditionStatement

func (Condition) Equal

func (c Condition) Equal(c1 Condition) bool

type ConditionStatement

type ConditionStatement map[string]Value

func (ConditionStatement) Equal

type IAM

type IAM struct {
	Service iamiface.IAMAPI
	// contains filtered or unexported fields
}

func New

func New(opts ...IAMOption) IAM

func (*IAM) AddUserToGroup

func (i *IAM) AddUserToGroup(ctx context.Context, userName, groupName string) error

AddUserToGroup adds an existing user to an existing group

func (*IAM) AttachGroupPolicy

func (i *IAM) AttachGroupPolicy(ctx context.Context, groupName, policyArn string) error

func (*IAM) CreateAccessKey

func (i *IAM) CreateAccessKey(ctx context.Context, name string) (*iam.AccessKey, error)

func (*IAM) CreateGroup

func (i *IAM) CreateGroup(ctx context.Context, name, path string) (*iam.Group, error)

CreateGroup handles creating an IAM group

func (*IAM) CreatePolicy

func (i *IAM) CreatePolicy(ctx context.Context, name, path, policyDoc string) (*iam.Policy, error)

func (*IAM) CreateRole added in v0.2.0

func (i *IAM) CreateRole(ctx context.Context, input *iam.CreateRoleInput) (*iam.Role, error)

CreateRole handles creating an IAM role

func (*IAM) CreateUser

func (i *IAM) CreateUser(ctx context.Context, name, path string, tags []*iam.Tag) (*iam.User, error)

func (*IAM) DeleteAccessKey

func (i *IAM) DeleteAccessKey(ctx context.Context, name, keyId string) error

func (*IAM) DeleteRole added in v0.2.0

func (i *IAM) DeleteRole(ctx context.Context, input *iam.DeleteRoleInput) error

DeleteRole handles deleting an IAM role

func (*IAM) DeleteRolePolicy added in v0.2.0

func (i *IAM) DeleteRolePolicy(ctx context.Context, role, policy string) error

DeleteRolePolicy deletes an inline policy for a role

func (*IAM) DeleteUser

func (i *IAM) DeleteUser(ctx context.Context, name string) error

func (*IAM) GetDefaultPolicyVersion

func (i *IAM) GetDefaultPolicyVersion(ctx context.Context, arn, version string) (*iam.PolicyVersion, error)

func (*IAM) GetGroupWithPath

func (i *IAM) GetGroupWithPath(ctx context.Context, name, path string) (*iam.Group, error)

GetGroup gets the details of an IAM group

func (*IAM) GetPolicyByName

func (i *IAM) GetPolicyByName(ctx context.Context, name, path string) (*iam.Policy, error)

func (*IAM) GetRole added in v0.2.0

func (i *IAM) GetRole(ctx context.Context, roleName string) (*iam.Role, error)

GetRole handles getting information about an IAM role

func (*IAM) GetRolePolicy added in v0.2.0

func (i *IAM) GetRolePolicy(ctx context.Context, role, policy string) (string, error)

GetRolePolicy gets the inline policy attached to an IAM role

func (*IAM) GetUserWithPath

func (i *IAM) GetUserWithPath(ctx context.Context, path, name string) (*iam.User, error)

GetUserWithPath gets details about a user and returns an error if the path doesn't match

func (*IAM) ListAccessKeys

func (i *IAM) ListAccessKeys(ctx context.Context, name string) ([]*iam.AccessKeyMetadata, error)

func (*IAM) ListAttachedGroupPolicies

func (i *IAM) ListAttachedGroupPolicies(ctx context.Context, groupName, path string) ([]string, error)

func (*IAM) ListGroupsForUser

func (i *IAM) ListGroupsForUser(ctx context.Context, name string) ([]string, error)

func (*IAM) ListRolePolicies added in v0.2.0

func (i *IAM) ListRolePolicies(ctx context.Context, role string) ([]string, error)

ListRolePolicies lists the inline policies for a role

func (*IAM) ListUsers

func (i *IAM) ListUsers(ctx context.Context, path string) ([]string, error)

ListUsers lists all of the users in a path prefix, "/" by default

func (*IAM) PutRolePolicy added in v0.2.0

func (i *IAM) PutRolePolicy(ctx context.Context, input *iam.PutRolePolicyInput) error

PutRolePolicy handles attaching an inline policy to IAM role

func (*IAM) RemoveUserFromGroup

func (i *IAM) RemoveUserFromGroup(ctx context.Context, userName, groupName string) error

RemoveUserFromGroup removes a user from a group

func (*IAM) TagRole added in v0.2.0

func (i *IAM) TagRole(ctx context.Context, role string, tags []*iam.Tag) error

TagRole adds tags to an IAM role

func (*IAM) TagUser

func (i *IAM) TagUser(ctx context.Context, name string, tags []*iam.Tag) error

func (*IAM) UpdatePolicy

func (i *IAM) UpdatePolicy(ctx context.Context, arn, policyDoc string) error

func (*IAM) WaitForPolicy

func (i *IAM) WaitForPolicy(ctx context.Context, policyArn string) error

func (*IAM) WaitForUser

func (i *IAM) WaitForUser(ctx context.Context, name string) error

type IAMOption

type IAMOption func(*IAM)

func WithCredentials

func WithCredentials(key, secret, token, region string) IAMOption

func WithSession

func WithSession(sess *session.Session) IAMOption

type PolicyDocument

type PolicyDocument struct {
	// 2012-10-17 or 2008-10-17 old policies, do NOT use this for new policies
	Version   string           `json:"Version"`
	Id        string           `json:"Id,omitempty"`
	Statement []StatementEntry `json:"Statement"`
}

type Principal

type Principal map[string]Value

func (Principal) Equal

func (p Principal) Equal(p1 Principal) bool

type StatementEntry

type StatementEntry struct {
	Sid          string    `json:"Sid,omitempty"`          // statement ID, service specific
	Effect       string    `json:"Effect"`                 // Allow or Deny
	Principal    Principal `json:"Principal,omitempty"`    // principal that is allowed or denied
	NotPrincipal Principal `json:"NotPrincipal,omitempty"` // exception to a list of principals
	Action       Value     `json:"Action"`                 // allowed or denied action
	NotAction    Value     `json:"NotAction,omitempty"`    // matches everything except
	Resource     Value     `json:"Resource,omitempty"`     // object or objects that the statement covers
	NotResource  Value     `json:"NotResource,omitempty"`  // matches everything except
	Condition    Condition `json:"Condition,omitempty"`    // conditions for when a policy is in effect
}

type Value

type Value []string

func (Value) Equal

func (v Value) Equal(v1 Value) bool

func (*Value) UnmarshalJSON

func (value *Value) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshalls IAM values, converting everything to []string to avoid casting

Jump to

Keyboard shortcuts

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