operations

package
v0.84.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func CopyFromEntry added in v0.54.0

func CopyFromEntry(w http.ResponseWriter, req *http.Request, o *PathOperation, copySource string) *catalog.DBEntry

CopyFromEntry create copy of the file

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(action, repository, ref, userID string)

type AuthenticatedOperationHandler

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

type AuthorizedOperation

type AuthorizedOperation struct {
	*Operation
	Principal string
}

type BranchOperationHandler

type BranchOperationHandler interface {
	RequiredPermissions(req *http.Request, repository, branch string) (permissions.Node, 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.Node, 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.Node, 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.Node, 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.Node, 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.Node, 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.Node, 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.Node, error)

type Operation

type Operation struct {
	OperationID      OperationID
	Region           string
	FQDN             string
	Catalog          catalog.Interface
	MultipartTracker multipart.Tracker
	BlockStore       block.Adapter
	Auth             auth.GatewayService
	Incr             ActionIncr
	MatchedHost      bool
	PathProvider     upload.PathProvider
}

func (*Operation) DeleteHeader

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 http.Header)

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.Node, error)
	Handle(w http.ResponseWriter, req *http.Request, op *Operation)
}

type OperationID

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"
	OperationIDPutBucket     OperationID = "put_bucket"

	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.Node, 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.Node, error)

type PutBucket added in v0.51.0

type PutBucket struct{}

PutBucket handles S3 Create Bucket operations. It does *not* actually create new repos (there is not enough information in the S3 request to create a new repo), but *does* detect whether the repo already exists.

func (*PutBucket) Handle added in v0.51.0

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

func (*PutBucket) RequiredPermissions added in v0.51.0

func (controller *PutBucket) RequiredPermissions(_ *http.Request, repoID string) (permissions.Node, error)

type PutObject

type PutObject struct{}

func (*PutObject) Handle

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

func (*PutObject) RequiredPermissions

func (controller *PutObject) RequiredPermissions(req *http.Request, repoID, _, destPath string) (permissions.Node, error)

type RefOperation

type RefOperation struct {
	*RepoOperation
	Reference string
}

type RepoOperation

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

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.Node, 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