You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.0 KiB
48 lines
1.0 KiB
10 years ago
|
package donut
|
||
|
|
||
|
// BucketACL - bucket level access control
|
||
|
type BucketACL string
|
||
|
|
||
|
// different types of ACL's currently supported for buckets
|
||
|
const (
|
||
|
BucketPrivate = BucketACL("private")
|
||
|
BucketPublicRead = BucketACL("public-read")
|
||
|
BucketPublicReadWrite = BucketACL("public-read-write")
|
||
|
)
|
||
|
|
||
|
func (b BucketACL) String() string {
|
||
|
return string(b)
|
||
|
}
|
||
|
|
||
|
// IsPrivate - is acl Private
|
||
|
func (b BucketACL) IsPrivate() bool {
|
||
|
return b == BucketACL("private")
|
||
|
}
|
||
|
|
||
|
// IsPublicRead - is acl PublicRead
|
||
|
func (b BucketACL) IsPublicRead() bool {
|
||
|
return b == BucketACL("public-read")
|
||
|
}
|
||
|
|
||
|
// IsPublicReadWrite - is acl PublicReadWrite
|
||
|
func (b BucketACL) IsPublicReadWrite() bool {
|
||
|
return b == BucketACL("public-read-write")
|
||
|
}
|
||
|
|
||
|
// IsValidBucketACL - is provided acl string supported
|
||
|
func IsValidBucketACL(acl string) bool {
|
||
|
switch acl {
|
||
|
case "private":
|
||
|
fallthrough
|
||
|
case "public-read":
|
||
|
fallthrough
|
||
|
case "public-read-write":
|
||
|
return true
|
||
|
case "":
|
||
|
// by default its "private"
|
||
|
return true
|
||
|
default:
|
||
|
return false
|
||
|
}
|
||
|
}
|