awsspec

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IAMSpec

type IAMSpec struct {
	Session *session.Session
}

IAMSpec contains the AWS session

func New

func New(s *session.Session) IAMSpec

New returns a new IAMSpec

func (IAMSpec) PolicyAllows

func (i IAMSpec) PolicyAllows(arn string, actions, resources []string) (res bool, err error)

PolicyAllows returns true if the defined actions are allowed on the provided resources. Please note that the check will be performed on the default policy version.

func (IAMSpec) RoleHasPolicy added in v0.6.0

func (i IAMSpec) RoleHasPolicy(role, policyARN string) (res bool, err error)

RoleHasPolicy checks that the provided policy ARN is attached to the specified IAM role

func (IAMSpec) UserHasPolicy added in v0.4.0

func (i IAMSpec) UserHasPolicy(user, policyARN string) (res bool, err error)

UserHasPolicy checks that the provided policy ARN is attached to the specified IAM user

type OptSlice

type OptSlice []string

OptSlice is an entity that could be either a JSON string or a slice As per https://stackoverflow.com/a/38757780/543423

func (OptSlice) Contains

func (o OptSlice) Contains(items []string) (res bool)

Contains checks whether OptSlice contains the provided items slice

func (*OptSlice) MarshalJSON

func (o *OptSlice) MarshalJSON() ([]byte, error)

MarshalJSON returns o as the JSON encoding of o

func (*OptSlice) UnmarshalJSON

func (o *OptSlice) UnmarshalJSON(data []byte) error

UnmarshalJSON sets *o to a copy of data

type PolicyDocument

type PolicyDocument struct {
	Version   string
	ID        string
	Statement []Statement
}

PolicyDocument represents an IAM policy document

type Statement

type Statement struct {
	// TODO:
	// - Handle Principal, NotPrincipal, and Condition
	SID          string
	Principal    interface{}
	NotPrincipal interface{}
	Effect       string
	Action       *OptSlice
	NotAction    *OptSlice
	Resource     *OptSlice
	NotResource  *OptSlice
	Condition    interface{}
}

Statement represents an IAM statement

Jump to

Keyboard shortcuts

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