api

package
v0.30.6 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetadataPrefix              = "X-Amz-Meta-"
	FrostFSSystemMetadataPrefix = "S3-"
	AmzMetadataDirective        = "X-Amz-Metadata-Directive"
	AmzTaggingDirective         = "X-Amz-Tagging-Directive"
	AmzVersionID                = "X-Amz-Version-Id"
	AmzTaggingCount             = "X-Amz-Tagging-Count"
	AmzTagging                  = "X-Amz-Tagging"
	AmzDeleteMarker             = "X-Amz-Delete-Marker"
	AmzCopySource               = "X-Amz-Copy-Source"
	AmzCopySourceRange          = "X-Amz-Copy-Source-Range"
	AmzDate                     = "X-Amz-Date"

	LastModified       = "Last-Modified"
	Date               = "Date"
	ETag               = "ETag"
	ContentType        = "Content-Type"
	ContentMD5         = "Content-Md5"
	ContentEncoding    = "Content-Encoding"
	Expires            = "Expires"
	ContentLength      = "Content-Length"
	ContentLanguage    = "Content-Language"
	ContentRange       = "Content-Range"
	Connection         = "Connection"
	AcceptRanges       = "Accept-Ranges"
	AmzBucketRegion    = "X-Amz-Bucket-Region"
	ServerInfo         = "Server"
	RetryAfter         = "Retry-After"
	Location           = "Location"
	CacheControl       = "Cache-Control"
	ContentDisposition = "Content-Disposition"
	Authorization      = "Authorization"
	Action             = "Action"
	IfModifiedSince    = "If-Modified-Since"
	IfUnmodifiedSince  = "If-Unmodified-Since"
	IfMatch            = "If-Match"
	IfNoneMatch        = "If-None-Match"

	AmzContentSha256             = "X-Amz-Content-Sha256"
	AmzCopyIfModifiedSince       = "X-Amz-Copy-Source-If-Modified-Since"
	AmzCopyIfUnmodifiedSince     = "X-Amz-Copy-Source-If-Unmodified-Since"
	AmzCopyIfMatch               = "X-Amz-Copy-Source-If-Match"
	AmzCopyIfNoneMatch           = "X-Amz-Copy-Source-If-None-Match"
	AmzACL                       = "X-Amz-Acl"
	AmzDecodedContentLength      = "X-Amz-Decoded-Content-Length"
	AmzGrantFullControl          = "X-Amz-Grant-Full-Control"
	AmzGrantRead                 = "X-Amz-Grant-Read"
	AmzGrantWrite                = "X-Amz-Grant-Write"
	AmzExpectedBucketOwner       = "X-Amz-Expected-Bucket-Owner"
	AmzSourceExpectedBucketOwner = "X-Amz-Source-Expected-Bucket-Owner"
	AmzBucketObjectLockEnabled   = "X-Amz-Bucket-Object-Lock-Enabled"
	AmzObjectLockLegalHold       = "X-Amz-Object-Lock-Legal-Hold"
	AmzObjectLockMode            = "X-Amz-Object-Lock-Mode"
	AmzObjectLockRetainUntilDate = "X-Amz-Object-Lock-Retain-Until-Date"
	AmzBypassGovernanceRetention = "X-Amz-Bypass-Governance-Retention"
	AmzObjectAttributes          = "X-Amz-Object-Attributes"
	AmzMaxParts                  = "X-Amz-Max-Parts"
	AmzPartNumberMarker          = "X-Amz-Part-Number-Marker"
	AmzStorageClass              = "X-Amz-Storage-Class"

	AmzServerSideEncryptionCustomerAlgorithm = "x-amz-server-side-encryption-customer-algorithm"
	AmzServerSideEncryptionCustomerKey       = "x-amz-server-side-encryption-customer-key"
	AmzServerSideEncryptionCustomerKeyMD5    = "x-amz-server-side-encryption-customer-key-MD5"

	AmzCopySourceServerSideEncryptionCustomerAlgorithm = "x-amz-copy-source-server-side-encryption-customer-algorithm"
	AmzCopySourceServerSideEncryptionCustomerKey       = "x-amz-copy-source-server-side-encryption-customer-key"
	AmzCopySourceServerSideEncryptionCustomerKeyMD5    = "x-amz-copy-source-server-side-encryption-customer-key-MD5"

	OwnerID       = "X-Owner-Id"
	ContainerID   = "X-Container-Id"
	ContainerName = "X-Container-Name"
	ContainerZone = "X-Container-Zone"

	AccessControlAllowOrigin      = "Access-Control-Allow-Origin"
	AccessControlAllowMethods     = "Access-Control-Allow-Methods"
	AccessControlExposeHeaders    = "Access-Control-Expose-Headers"
	AccessControlAllowHeaders     = "Access-Control-Allow-Headers"
	AccessControlMaxAge           = "Access-Control-Max-Age"
	AccessControlAllowCredentials = "Access-Control-Allow-Credentials"

	Origin                      = "Origin"
	AccessControlRequestMethod  = "Access-Control-Request-Method"
	AccessControlRequestHeaders = "Access-Control-Request-Headers"

	AwsChunked = "aws-chunked"

	Vary = "Vary"

	DefaultLocationConstraint = "default"

	StreamingContentSHA256 = "STREAMING-AWS4-HMAC-SHA256-PAYLOAD"

	DefaultStorageClass = "STANDARD"
)

Standard S3 HTTP request/response constants.

View Source
const (
	QueryVersionID = "versionId"
)

S3 request query params.

Variables

View Source
var ResponseModifiers = map[string]string{
	"response-content-type":        ContentType,
	"response-content-language":    ContentLanguage,
	"response-expires":             Expires,
	"response-cache-control":       CacheControl,
	"response-content-disposition": ContentDisposition,
	"response-content-encoding":    ContentEncoding,
}

ResponseModifiers maps response modifies headers to regular headers.

View Source
var SystemMetadata = map[string]struct{}{
	Date:               {},
	CacheControl:       {},
	ContentDisposition: {},
	ContentLength:      {},
	ContentType:        {},
	LastModified:       {},
	ETag:               {},
	ContentLanguage:    {},
}

Functions

func IsSignedStreamingV4 added in v0.28.0

func IsSignedStreamingV4(r *http.Request) bool

func NewRouter added in v0.29.0

func NewRouter(cfg Config) *chi.Mux

Types

type Config added in v0.29.0

type Config struct {
	Throttle middleware.ThrottleOpts
	Handler  Handler
	Center   s3middleware.Center
	Log      *zap.Logger
	Metrics  *metrics.AppMetrics

	MiddlewareSettings Settings

	// Domains optional. If empty no virtual hosted domains will be attached.
	Domains []string

	FrostfsID FrostFSID

	FrostFSIDValidation bool

	PolicyChecker engine.ChainRouter

	XMLDecoder s3middleware.XMLDecoder
	Tagging    s3middleware.ResourceTagging
}

type Filter added in v0.28.0

type Filter struct {
	// contains filtered or unexported fields
}

func NewFilter added in v0.28.0

func NewFilter() *Filter

func (*Filter) Handler added in v0.28.0

func (f *Filter) Handler(handler http.HandlerFunc) *Filter

func (*Filter) Headers added in v0.28.0

func (f *Filter) Headers(headers ...string) *Filter

Headers is similar to HeadersMatch but accept only header keys, set value to empty string internally.

func (*Filter) HeadersMatch added in v0.28.0

func (f *Filter) HeadersMatch(pairs ...string) *Filter

HeadersMatch adds a matcher for header values. It accepts a sequence of key/value pairs. Values may define variables. Panics if number of parameters is not even. Supports only exact matching. If the value is an empty string, it will match any value if the key is set.

func (*Filter) Queries added in v0.28.0

func (f *Filter) Queries(queries ...string) *Filter

Queries is similar to QueriesMatch but accept only query keys, set value to empty string internally.

func (*Filter) QueriesMatch added in v0.28.0

func (f *Filter) QueriesMatch(pairs ...string) *Filter

QueriesMatch adds a matcher for URL query values. It accepts a sequence of key/value pairs. Values may define variables. Panics if number of parameters is not even. Supports only exact matching. If the value is an empty string, it will match any value if the key is set.

type FrostFSID added in v0.29.0

type Handler

type Handler interface {
	HeadObjectHandler(http.ResponseWriter, *http.Request)
	GetObjectACLHandler(http.ResponseWriter, *http.Request)
	PutObjectACLHandler(http.ResponseWriter, *http.Request)
	GetObjectTaggingHandler(http.ResponseWriter, *http.Request)
	PutObjectTaggingHandler(http.ResponseWriter, *http.Request)
	DeleteObjectTaggingHandler(http.ResponseWriter, *http.Request)
	SelectObjectContentHandler(http.ResponseWriter, *http.Request)
	GetObjectRetentionHandler(http.ResponseWriter, *http.Request)
	GetObjectLegalHoldHandler(http.ResponseWriter, *http.Request)
	GetObjectHandler(http.ResponseWriter, *http.Request)
	GetObjectAttributesHandler(http.ResponseWriter, *http.Request)
	CopyObjectHandler(http.ResponseWriter, *http.Request)
	PutObjectRetentionHandler(http.ResponseWriter, *http.Request)
	PutObjectLegalHoldHandler(http.ResponseWriter, *http.Request)
	PutObjectHandler(http.ResponseWriter, *http.Request)
	DeleteObjectHandler(http.ResponseWriter, *http.Request)
	GetBucketLocationHandler(http.ResponseWriter, *http.Request)
	GetBucketPolicyStatusHandler(http.ResponseWriter, *http.Request)
	GetBucketPolicyHandler(http.ResponseWriter, *http.Request)
	GetBucketLifecycleHandler(http.ResponseWriter, *http.Request)
	GetBucketEncryptionHandler(http.ResponseWriter, *http.Request)
	GetBucketACLHandler(http.ResponseWriter, *http.Request)
	PutBucketACLHandler(http.ResponseWriter, *http.Request)
	GetBucketCorsHandler(http.ResponseWriter, *http.Request)
	PutBucketCorsHandler(http.ResponseWriter, *http.Request)
	DeleteBucketCorsHandler(http.ResponseWriter, *http.Request)
	GetBucketWebsiteHandler(http.ResponseWriter, *http.Request)
	GetBucketAccelerateHandler(http.ResponseWriter, *http.Request)
	GetBucketRequestPaymentHandler(http.ResponseWriter, *http.Request)
	GetBucketLoggingHandler(http.ResponseWriter, *http.Request)
	GetBucketReplicationHandler(http.ResponseWriter, *http.Request)
	GetBucketTaggingHandler(http.ResponseWriter, *http.Request)
	DeleteBucketWebsiteHandler(http.ResponseWriter, *http.Request)
	DeleteBucketTaggingHandler(http.ResponseWriter, *http.Request)
	GetBucketObjectLockConfigHandler(http.ResponseWriter, *http.Request)
	GetBucketVersioningHandler(http.ResponseWriter, *http.Request)
	GetBucketNotificationHandler(http.ResponseWriter, *http.Request)
	ListenBucketNotificationHandler(http.ResponseWriter, *http.Request)
	ListObjectsV2MHandler(http.ResponseWriter, *http.Request)
	ListObjectsV2Handler(http.ResponseWriter, *http.Request)
	ListBucketObjectVersionsHandler(http.ResponseWriter, *http.Request)
	ListObjectsV1Handler(http.ResponseWriter, *http.Request)
	PutBucketLifecycleHandler(http.ResponseWriter, *http.Request)
	PutBucketEncryptionHandler(http.ResponseWriter, *http.Request)
	PutBucketPolicyHandler(http.ResponseWriter, *http.Request)
	PutBucketObjectLockConfigHandler(http.ResponseWriter, *http.Request)
	PutBucketTaggingHandler(http.ResponseWriter, *http.Request)
	PutBucketVersioningHandler(http.ResponseWriter, *http.Request)
	PutBucketNotificationHandler(http.ResponseWriter, *http.Request)
	CreateBucketHandler(http.ResponseWriter, *http.Request)
	HeadBucketHandler(http.ResponseWriter, *http.Request)
	PostObject(http.ResponseWriter, *http.Request)
	DeleteMultipleObjectsHandler(http.ResponseWriter, *http.Request)
	DeleteBucketPolicyHandler(http.ResponseWriter, *http.Request)
	DeleteBucketLifecycleHandler(http.ResponseWriter, *http.Request)
	DeleteBucketEncryptionHandler(http.ResponseWriter, *http.Request)
	DeleteBucketHandler(http.ResponseWriter, *http.Request)
	ListBucketsHandler(http.ResponseWriter, *http.Request)
	Preflight(w http.ResponseWriter, r *http.Request)
	AppendCORSHeaders(w http.ResponseWriter, r *http.Request)
	CreateMultipartUploadHandler(http.ResponseWriter, *http.Request)
	UploadPartHandler(http.ResponseWriter, *http.Request)
	UploadPartCopy(w http.ResponseWriter, r *http.Request)
	CompleteMultipartUploadHandler(http.ResponseWriter, *http.Request)
	AbortMultipartUploadHandler(http.ResponseWriter, *http.Request)
	ListPartsHandler(w http.ResponseWriter, r *http.Request)
	ListMultipartUploadsHandler(http.ResponseWriter, *http.Request)

	ResolveBucket(ctx context.Context, bucket string) (*data.BucketInfo, error)
	ResolveCID(ctx context.Context, bucket string) (cid.ID, error)
}

Handler is an S3 API handler interface.

type HandlerFilters added in v0.28.0

type HandlerFilters struct {
	// contains filtered or unexported fields
}

func NewHandlerFilter added in v0.28.0

func NewHandlerFilter() *HandlerFilters

func (*HandlerFilters) Add added in v0.28.0

func (hf *HandlerFilters) Add(filter *Filter) *HandlerFilters

func (*HandlerFilters) DefaultHandler added in v0.28.0

func (hf *HandlerFilters) DefaultHandler(handler http.HandlerFunc) *HandlerFilters

func (*HandlerFilters) ServeHTTP added in v0.28.0

func (hf *HandlerFilters) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HostBucketRouter added in v0.28.0

type HostBucketRouter struct {
	// contains filtered or unexported fields
}

func NewHostBucketRouter added in v0.28.0

func NewHostBucketRouter(bktParam string) HostBucketRouter

func (*HostBucketRouter) Default added in v0.28.0

func (hr *HostBucketRouter) Default(router chi.Router)

func (HostBucketRouter) Map added in v0.28.0

func (hr HostBucketRouter) Map(host string, h chi.Router)

func (HostBucketRouter) ServeHTTP added in v0.28.0

func (hr HostBucketRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Pair added in v0.28.0

type Pair struct {
	Key   string
	Value string
}

Directories

Path Synopsis
signer/v4
Package v4 implements signing for AWS V4 signer
Package v4 implements signing for AWS V4 signer

Jump to

Keyboard shortcuts

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