acl

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package acl provides ACL types and XML helpers.

Package acl provides access control list types for bucket and object ACLs.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidCannedACL indicates an unknown canned ACL.
	ErrInvalidCannedACL = errors.New("acl: invalid canned ACL")

	// ErrMixedACL indicates both canned and grant-based ACLs were provided.
	ErrMixedACL = errors.New("acl: cannot mix canned ACL with grant-based ACL")
)

Functions

This section is empty.

Types

type ACL

type ACL struct {
	XMLNS   string   `xml:"xmlns,attr,omitempty"`
	XMLName xml.Name `xml:"AccessControlPolicy"`
	Owner   Owner    `xml:"Owner,omitempty"`
	Grants  []Grant  `xml:"AccessControlList>Grant,omitempty"`
	Canned  CannedACL
}

ACL represents an access control policy.

func ParseACL

func ParseACL(reader io.Reader) (ACL, error)

ParseACL parses ACL policy XML from a reader.

func (*ACL) Normalize

func (a *ACL) Normalize() error

Normalize validates and normalizes the ACL.

func (ACL) ToXML

func (a ACL) ToXML() ([]byte, error)

ToXML marshals the ACL policy to XML.

type CannedACL

type CannedACL string

CannedACL is a predefined ACL.

const (
	ACLPrivate                CannedACL = "private"
	ACLPublicRead             CannedACL = "public-read"
	ACLPublicReadWrite        CannedACL = "public-read-write"
	ACLAuthenticatedRead      CannedACL = "authenticated-read"
	ACLBucketOwnerRead        CannedACL = "bucket-owner-read"
	ACLBucketOwnerFullControl CannedACL = "bucket-owner-full-control"
)

func (CannedACL) IsValid

func (c CannedACL) IsValid() bool

IsValid reports whether the canned ACL is supported.

type Grant

type Grant struct {
	Grantee    Grantee    `xml:"Grantee"`
	Permission Permission `xml:"Permission"`
}

Grant defines a permission granted to a grantee.

type Grantee

type Grantee struct {
	XMLName      xml.Name `xml:"Grantee"`
	Type         string   `xml:"http://www.w3.org/2001/XMLSchema-instance type,attr,omitempty"`
	ID           string   `xml:"ID,omitempty"`
	DisplayName  string   `xml:"DisplayName,omitempty"`
	EmailAddress string   `xml:"EmailAddress,omitempty"`
	URI          string   `xml:"URI,omitempty"`
}

Grantee identifies the entity being granted access.

type Owner

type Owner struct {
	ID          string `xml:"ID,omitempty"`
	DisplayName string `xml:"DisplayName,omitempty"`
}

Owner identifies the owner of the resource.

type Permission

type Permission string

Permission represents the access level.

const (
	PermissionFullControl Permission = "FULL_CONTROL"
	PermissionWrite       Permission = "WRITE"
	PermissionWriteACP    Permission = "WRITE_ACP"
	PermissionRead        Permission = "READ"
	PermissionReadACP     Permission = "READ_ACP"
)

Jump to

Keyboard shortcuts

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