operations

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreateMultipartUploadQueryParam   = "uploads"
	CompleteMultipartUploadQueryParam = "uploadId"
)
View Source
const (
	CopySourceHeader     = "x-amz-copy-source"
	QueryParamUploadID   = "uploadId"
	QueryParamPartNumber = "partNumber"
)
View Source
const (
	ListObjectMaxKeys = 1000
)
View Source
const StorageClassHeader = "x-amz-storage-class"

Variables

This section is empty.

Functions

func DecodeXMLBody

func DecodeXMLBody(reader io.Reader, entity interface{}) error

func EncodeResponse

func EncodeResponse(w http.ResponseWriter, entity interface{}, statusCode int) error

func EncodeXMLBytes

func EncodeXMLBytes(w http.ResponseWriter, t []byte, statusCode int) error

func StorageClassFromHeader

func StorageClassFromHeader(header http.Header) *string

Types

type ActionIncr

type ActionIncr func(string)

type AuthenticatedOperationHandler

type AuthenticatedOperationHandler interface {
	RequiredPermissions(req *http.Request) ([]permissions.Permission, error)
	Handle(w http.ResponseWriter, req *http.Request, op *AuthorizedOperation)
}

type AuthorizedOperation added in v0.22.1

type AuthorizedOperation struct {
	*Operation
	Principal string
}

type BranchOperationHandler

type BranchOperationHandler interface {
	RequiredPermissions(req *http.Request, repository, branch string) ([]permissions.Permission, error)
	Handle(w http.ResponseWriter, req *http.Request, op *RefOperation)
}

type DeleteObject

type DeleteObject struct{}

func (*DeleteObject) Handle

func (controller *DeleteObject) Handle(w http.ResponseWriter, req *http.Request, o *PathOperation)

func (*DeleteObject) HandleAbortMultipartUpload

func (controller *DeleteObject) HandleAbortMultipartUpload(w http.ResponseWriter, req *http.Request, o *PathOperation)

func (*DeleteObject) RequiredPermissions

func (controller *DeleteObject) RequiredPermissions(_ *http.Request, repoID, _, path string) ([]permissions.Permission, error)

type DeleteObjects

type DeleteObjects struct{}

func (*DeleteObjects) Handle

func (controller *DeleteObjects) Handle(w http.ResponseWriter, req *http.Request, o *RepoOperation)

func (*DeleteObjects) RequiredPermissions

func (controller *DeleteObjects) RequiredPermissions(_ *http.Request, _ string) ([]permissions.Permission, error)

type GetObject

type GetObject struct{}

func (*GetObject) Handle

func (controller *GetObject) Handle(w http.ResponseWriter, req *http.Request, o *PathOperation)

func (*GetObject) RequiredPermissions

func (controller *GetObject) RequiredPermissions(_ *http.Request, repoID, _, path string) ([]permissions.Permission, error)

type HeadBucket

type HeadBucket struct{}

func (*HeadBucket) Handle

func (controller *HeadBucket) Handle(w http.ResponseWriter, _ *http.Request, o *RepoOperation)

func (*HeadBucket) RequiredPermissions

func (controller *HeadBucket) RequiredPermissions(_ *http.Request, repoID string) ([]permissions.Permission, error)

type HeadObject

type HeadObject struct{}

func (*HeadObject) Handle

func (controller *HeadObject) Handle(w http.ResponseWriter, req *http.Request, o *PathOperation)

func (*HeadObject) RequiredPermissions

func (controller *HeadObject) RequiredPermissions(_ *http.Request, repoID, _, path string) ([]permissions.Permission, error)

type ListBuckets

type ListBuckets struct{}

func (*ListBuckets) Handle

func (controller *ListBuckets) Handle(w http.ResponseWriter, req *http.Request, o *AuthorizedOperation)

func (*ListBuckets) RequiredPermissions

func (controller *ListBuckets) RequiredPermissions(_ *http.Request) ([]permissions.Permission, error)

type ListObjects

type ListObjects struct{}

func (*ListObjects) Handle

func (controller *ListObjects) Handle(w http.ResponseWriter, req *http.Request, o *RepoOperation)

func (*ListObjects) ListV1

func (controller *ListObjects) ListV1(w http.ResponseWriter, req *http.Request, o *RepoOperation)

func (*ListObjects) ListV2

func (controller *ListObjects) ListV2(w http.ResponseWriter, req *http.Request, o *RepoOperation)

func (*ListObjects) RequiredPermissions

func (controller *ListObjects) RequiredPermissions(req *http.Request, repoID string) ([]permissions.Permission, error)

type Operation

type Operation struct {
	OperationID       OperationID
	Region            string
	FQDN              string
	Cataloger         catalog.Cataloger
	MultipartsTracker multiparts.Tracker
	BlockStore        block.Adapter
	Auth              simulator.GatewayAuthService
	Incr              ActionIncr
}

func (*Operation) DeleteHeader added in v0.20.1

func (o *Operation) DeleteHeader(w http.ResponseWriter, key string)

DeleteHeader deletes a header from the response

func (*Operation) EncodeError

func (o *Operation) EncodeError(w http.ResponseWriter, req *http.Request, e errors.APIError) *http.Request

func (*Operation) EncodeResponse

func (o *Operation) EncodeResponse(w http.ResponseWriter, req *http.Request, entity interface{}, statusCode int)

func (*Operation) EncodeXMLBytes

func (o *Operation) EncodeXMLBytes(w http.ResponseWriter, req *http.Request, t []byte, statusCode int)

func (*Operation) Log

func (o *Operation) Log(req *http.Request) logging.Logger

func (*Operation) SetHeader

func (o *Operation) SetHeader(w http.ResponseWriter, key, value string)

SetHeader sets a header on the response while preserving its case

func (*Operation) SetHeaders

func (o *Operation) SetHeaders(w http.ResponseWriter, headers map[string]string)

SetHeaders sets a map of headers on the response while preserving the header's case

type OperationHandler

type OperationHandler interface {
	RequiredPermissions(req *http.Request) ([]permissions.Permission, error)
	Handle(w http.ResponseWriter, req *http.Request, op *Operation)
}

type OperationID added in v0.22.1

type OperationID string
const (
	OperationIDDeleteObject  OperationID = "delete_object"
	OperationIDDeleteObjects OperationID = "delete_objects"
	OperationIDGetObject     OperationID = "get_object"
	OperationIDHeadBucket    OperationID = "head_bucket"
	OperationIDHeadObject    OperationID = "head_object"
	OperationIDListBuckets   OperationID = "list_buckets"
	OperationIDListObjects   OperationID = "list_objects"
	OperationIDPostObject    OperationID = "post_object"
	OperationIDPutObject     OperationID = "put_object"

	OperationIDUnsupportedOperation OperationID = "unsupported"
	OperationIDOperationNotFound    OperationID = "not_found"
)

type PathOperation

type PathOperation struct {
	*RefOperation
	Path string
}

func (*PathOperation) EncodeError

func (o *PathOperation) EncodeError(w http.ResponseWriter, req *http.Request, err errors.APIError) *http.Request

type PathOperationHandler

type PathOperationHandler interface {
	RequiredPermissions(req *http.Request, repository, branch, path string) ([]permissions.Permission, error)
	Handle(w http.ResponseWriter, req *http.Request, op *PathOperation)
}

type PostObject

type PostObject struct{}

func (*PostObject) Handle

func (controller *PostObject) Handle(w http.ResponseWriter, req *http.Request, o *PathOperation)

func (*PostObject) HandleCompleteMultipartUpload

func (controller *PostObject) HandleCompleteMultipartUpload(w http.ResponseWriter, req *http.Request, o *PathOperation)

func (*PostObject) HandleCreateMultipartUpload

func (controller *PostObject) HandleCreateMultipartUpload(w http.ResponseWriter, req *http.Request, o *PathOperation)

func (*PostObject) RequiredPermissions

func (controller *PostObject) RequiredPermissions(_ *http.Request, repoID, _, path string) ([]permissions.Permission, error)

type PutObject

type PutObject struct{}

func (*PutObject) Handle

func (controller *PutObject) Handle(w http.ResponseWriter, req *http.Request, o *PathOperation)

func (*PutObject) HandleCopy

func (controller *PutObject) HandleCopy(w http.ResponseWriter, req *http.Request, o *PathOperation, copySource string)

func (*PutObject) HandleUploadPart

func (controller *PutObject) HandleUploadPart(w http.ResponseWriter, req *http.Request, o *PathOperation)

func (*PutObject) RequiredPermissions

func (controller *PutObject) RequiredPermissions(_ *http.Request, repoID, _, path string) ([]permissions.Permission, error)

type RefOperation

type RefOperation struct {
	*RepoOperation
	Reference string
}

type RepoOperation

type RepoOperation struct {
	*AuthorizedOperation
	Repository *catalog.Repository
}

func (*RepoOperation) EncodeError

func (o *RepoOperation) EncodeError(w http.ResponseWriter, req *http.Request, err errors.APIError) *http.Request

type RepoOperationHandler

type RepoOperationHandler interface {
	RequiredPermissions(req *http.Request, repository string) ([]permissions.Permission, error)
	Handle(w http.ResponseWriter, req *http.Request, op *RepoOperation)
}

Jump to

Keyboard shortcuts

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