policy

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReadOnlyPermissionsName  = "read-only"
	ReadWritePermissionsName = "read-write"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Actions

type Actions []string

We alias Actions as []string here and implement the UnmarshalJSON interface because AWS IAM policies with a single action are returned with a string, instead of an array with a single element, and Go's type system is no expressive enough to support that.

func (*Actions) UnmarshalJSON

func (a *Actions) UnmarshalJSON(b []byte) error

type NoPermissions

type NoPermissions struct{}

func (NoPermissions) Actions

func (NoPermissions) Actions() []string

type Permissions

type Permissions interface {
	Actions() []string
}

func ValidatePermissions

func ValidatePermissions(permissionName string) (Permissions, error)

type PolicyDocument

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

func BuildPolicy

func BuildPolicy(maybeExistingPolicy string, statement Statement) (PolicyDocument, error)

func RemoveUserFromPolicy

func RemoveUserFromPolicy(existingPolicy string, userArnSuffix string) (PolicyDocument, error)

type Principal

type Principal struct {
	AWS string `json:"AWS"`
}

type PublicBucketPermissions

type PublicBucketPermissions struct{}

func (PublicBucketPermissions) Actions

func (PublicBucketPermissions) Actions() []string

type ReadOnlyPermissions

type ReadOnlyPermissions struct{}

func (ReadOnlyPermissions) Actions

func (ReadOnlyPermissions) Actions() []string

type ReadWritePermissions

type ReadWritePermissions struct{}

func (ReadWritePermissions) Actions

func (ReadWritePermissions) Actions() []string

type Statement

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

func BuildStatement

func BuildStatement(bucketName string, iamUser iam.User, permissions Permissions) Statement

Jump to

Keyboard shortcuts

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