Documentation ¶
Index ¶
- Constants
- func CheckStatementsAreRemovable(statements []Statement, bucketName string, prefix string) bool
- func GetPolicies(statements []Statement, bucketName, prefix string) map[string]BucketPolicy
- type BucketAccessPolicy
- type BucketPolicy
- type ConditionKeyMap
- type ConditionMap
- type Statement
- type User
Constants ¶
const ( BucketPolicyNone BucketPolicy = "none" BucketPolicyReadOnly = "readonly" BucketPolicyReadWrite = "readwrite" BucketPolicyWriteOnly = "writeonly" )
Different types of Policies currently supported for buckets.
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.
func GetPolicy ¶
func GetPolicy(statements []Statement, bucketName string, 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 ¶
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
type User ¶
type User struct { AWS set.StringSet `json:"AWS,omitempty"` CanonicalUser set.StringSet `json:"CanonicalUser,omitempty"` }
User - canonical users list.
func (*User) UnmarshalJSON ¶
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.