iam

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseURL = "https://docs.aws.amazon.com/service-authorization/latest/reference"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessLevel added in v0.0.11

type AccessLevel string
const (
	AccessLevelWrite                 AccessLevel = "Write"
	AccessLevelRead                  AccessLevel = "Read"
	AccessLevelTagging               AccessLevel = "Tagging"
	AccessLevelPermissionsManagement AccessLevel = "Permissions management"
	AccessLevelList                  AccessLevel = "List"
)

type Action

type Action string

func (Action) HasWildcard

func (a Action) HasWildcard() bool

func (Action) Name

func (a Action) Name() string

func (Action) ServicePrefix

func (a Action) ServicePrefix() string

type ActionData added in v0.0.11

type ActionData struct {
	Name              string
	Description       string
	AccessLevel       string
	ResourceARNFormat string
	APIDocLink        string
	ConditionKeys     []string
	DependentActions  []string
}

type ActionDefinition

type ActionDefinition struct {
	Name          string
	Description   string
	AccessLevel   string
	ResourceTypes map[string]*ActionResourceType
	APIDocLink    string
}

type ActionResourceType

type ActionResourceType struct {
	Name             string
	Required         bool
	ConditionKeys    []string
	DependentActions []string
}

type ConditionKey

type ConditionKey struct {
	Name        string
	Description string
	Type        string
}

type Definitions

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

func NewDefinitionFromReference

func NewDefinitionFromReference() (*Definitions, error)

func NewDefinitions

func NewDefinitions() (*Definitions, error)

func NewDefinitionsFromFS

func NewDefinitionsFromFS(filename string, fs fs.FS, gzipFile bool) (*Definitions, error)

func (*Definitions) GetActionData added in v0.0.11

func (d *Definitions) GetActionData(action Action) []*ActionData

GetActionData gets details about an IAM Action

func (*Definitions) GetActions

func (d *Definitions) GetActions(input *GetActionsInput) []Action

func (*Definitions) GetServiceDefinition added in v0.0.11

func (d *Definitions) GetServiceDefinition(prefix string) *ServiceDefinition

func (*Definitions) Save

func (d *Definitions) Save(filename string, gzipFile bool) error

func (*Definitions) ServicePrefixes

func (d *Definitions) ServicePrefixes() []string

type Effect

type Effect string
const (
	EffectAllow Effect = "Allow"
	EffectDeny  Effect = "Deny"
)

type ExternalIDCondition added in v0.0.20

type ExternalIDCondition struct {
	StringEquals struct {
		StsExternalID string `json:"sts:ExternalId"`
	} `json:"StringEquals"`
}

func ConvertToExternalIDCondition added in v0.0.20

func ConvertToExternalIDCondition(rawCondition []byte) (*ExternalIDCondition, error)

type GetActionsInput

type GetActionsInput struct {
	ServicePrefix    string
	AccessLevel      AccessLevel
	ResourceTypeName string // * => wildcard arns only
	NamePattern      string // supports wildcards: '*', '?'
}

type PolicyDocument

type PolicyDocument struct {
	ID         string      `json:"Id,omitempty"`
	Version    string      `json:"Version"`
	Statements []Statement `json:"Statement"`
}

func ConvertToPolicyDocument

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

type PricipalValue

type PricipalValue[T ~string] map[string][]T

func (*PricipalValue[T]) UnmarshalJSON

func (value *PricipalValue[T]) UnmarshalJSON(b []byte) error

type Principal

type Principal string

type Resource

type Resource string

type ResourceType

type ResourceType struct {
	Name       string
	ARN        string
	Conditions []string
}

type ServiceDefinition

type ServiceDefinition struct {
	Name             string
	Prefix           string
	AuthorizationURL string
	Actions          map[string]*ActionDefinition
	ResourceTypes    map[string]*ResourceType
	ConditionKeys    map[string]*ConditionKey
}

type Statement

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

type StatementValue

type StatementValue[T ~string] []T

AWS allows string or []string as value, we convert everything to []T to avoid casting

func (*StatementValue[T]) UnmarshalJSON

func (value *StatementValue[T]) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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