policy

package
v7.0.69 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: Apache-2.0 Imports: 5 Imported by: 46

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPolicies

func GetPolicies(statements []Statement, bucketName, prefix string) map[string]BucketPolicy

GetPolicies - returns a map of policies of given bucket name, prefix in given statements.

Types

type BucketAccessPolicy

type BucketAccessPolicy struct {
	Version    string      // date in YYYY-MM-DD format
	Statements []Statement `json:"Statement"`
}

BucketAccessPolicy - minio policy collection

type BucketPolicy

type BucketPolicy string

BucketPolicy - Bucket level policy.

const (
	BucketPolicyNone      BucketPolicy = "none"
	BucketPolicyReadOnly  BucketPolicy = "readonly"
	BucketPolicyReadWrite BucketPolicy = "readwrite"
	BucketPolicyWriteOnly BucketPolicy = "writeonly"
)

Different types of Policies currently supported for buckets.

func GetPolicy

func GetPolicy(statements []Statement, bucketName, prefix string) BucketPolicy

GetPolicy - Returns policy of given bucket name, prefix in given statements.

func (BucketPolicy) IsValidBucketPolicy

func (p BucketPolicy) IsValidBucketPolicy() bool

IsValidBucketPolicy - returns true if policy is valid and supported, false otherwise.

type ConditionKeyMap

type ConditionKeyMap map[string]set.StringSet

ConditionKeyMap - map of policy condition key and value.

func CopyConditionKeyMap

func CopyConditionKeyMap(condKeyMap ConditionKeyMap) ConditionKeyMap

CopyConditionKeyMap - returns new copy of given ConditionKeyMap.

func (ConditionKeyMap) Add

func (ckm ConditionKeyMap) Add(key string, value set.StringSet)

Add - adds key and value. The value is appended If key already exists.

func (ConditionKeyMap) Remove

func (ckm ConditionKeyMap) Remove(key string, value set.StringSet)

Remove - removes value of given key. If key has empty after removal, the key is also removed.

func (ConditionKeyMap) RemoveKey

func (ckm ConditionKeyMap) RemoveKey(key string)

RemoveKey - removes key and its value.

type ConditionMap

type ConditionMap map[string]ConditionKeyMap

ConditionMap - map of condition and conditional values.

func (ConditionMap) Add

func (cond ConditionMap) Add(condKey string, condKeyMap ConditionKeyMap)

Add - adds condition key and condition value. The value is appended if key already exists.

func (ConditionMap) Remove

func (cond ConditionMap) Remove(condKey string)

Remove - removes condition key and its value.

type Statement

type Statement struct {
	Actions    set.StringSet `json:"Action"`
	Conditions ConditionMap  `json:"Condition,omitempty"`
	Effect     string
	Principal  User          `json:"Principal"`
	Resources  set.StringSet `json:"Resource"`
	Sid        string
}

Statement - minio policy statement

func SetPolicy

func SetPolicy(statements []Statement, policy BucketPolicy, bucketName, prefix string) []Statement

SetPolicy - Returns new statements containing policy of given bucket name and prefix are appended.

type User

type User struct {
	AWS           set.StringSet `json:"AWS,omitempty"`
	CanonicalUser set.StringSet `json:"CanonicalUser,omitempty"`
}

User - canonical users list.

func (*User) UnmarshalJSON

func (u *User) UnmarshalJSON(data []byte) error

UnmarshalJSON is a custom json unmarshaler for Principal field, the reason is that Principal can take a json struct represented by User string but it can also take a string.

Jump to

Keyboard shortcuts

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