s3

package
v0.5.12 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	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"
	Range              = "Range"
)

Standard S3 HTTP response constants

View Source
const (
	XCache       = "X-Cache"
	XCacheLookup = "X-Cache-Lookup"
)

Non standard S3 HTTP response constants

View Source
const (
	IfModifiedSince   = "If-Modified-Since"
	IfUnmodifiedSince = "If-Unmodified-Since"
	IfMatch           = "If-Match"
	IfNoneMatch       = "If-None-Match"

	// S3 storage class
	AmzStorageClass = "x-amz-storage-class"

	// S3 object version ID
	AmzVersionID    = "x-amz-version-id"
	AmzDeleteMarker = "x-amz-delete-marker"

	// S3 object tagging
	AmzObjectTagging = "X-Amz-Tagging"
	AmzTagCount      = "x-amz-tagging-count"
	AmzTagDirective  = "X-Amz-Tagging-Directive"

	// S3 transition restore
	AmzRestore            = "x-amz-restore"
	AmzRestoreExpiryDays  = "X-Amz-Restore-Expiry-Days"
	AmzRestoreRequestDate = "X-Amz-Restore-Request-Date"
	AmzRestoreOutputPath  = "x-amz-restore-output-path"

	// S3 extensions
	AmzCopySource                  = "x-amz-copy-source"
	AmzCopySourceIfModifiedSince   = "x-amz-copy-source-if-modified-since"
	AmzCopySourceIfUnmodifiedSince = "x-amz-copy-source-if-unmodified-since"

	AmzCopySourceIfNoneMatch = "x-amz-copy-source-if-none-match"
	AmzCopySourceIfMatch     = "x-amz-copy-source-if-match"

	AmzCopySourceVersionID        = "X-Amz-Copy-Source-Version-Id"
	AmzCopySourceRange            = "X-Amz-Copy-Source-Range"
	AmzMetadataDirective          = "X-Amz-Metadata-Directive"
	AmzObjectLockMode             = "X-Amz-Object-Lock-Mode"
	AmzObjectLockRetainUntilDate  = "X-Amz-Object-Lock-Retain-Until-Date"
	AmzObjectLockLegalHold        = "X-Amz-Object-Lock-Legal-Hold"
	AmzObjectLockBypassGovernance = "X-Amz-Bypass-Governance-Retention"
	AmzBucketReplicationStatus    = "X-Amz-Replication-Status"

	// AmzSnowballExtract will trigger unpacking of an archive content
	AmzSnowballExtract = "X-Amz-Meta-Snowball-Auto-Extract"
	// MinIOSnowballIgnoreDirs will skip creating empty directory objects.
	MinIOSnowballIgnoreDirs = "X-Amz-Meta-Minio-Snowball-Ignore-Dirs"
	// MinIOSnowballIgnoreErrors will ignore recoverable errors, typically single files failing to upload.
	// An error will be printed to console instead.
	MinIOSnowballIgnoreErrors = "X-Amz-Meta-Minio-Snowball-Ignore-Errors"
	// MinIOSnowballPrefix will apply this prefix (plus / at end) to all extracted objects
	MinIOSnowballPrefix = "X-Amz-Meta-Minio-Snowball-Prefix"

	// Object lock enabled
	AmzObjectLockEnabled = "x-amz-bucket-object-lock-enabled"

	// Multipart parts count
	AmzMpPartsCount = "x-amz-mp-parts-count"

	// Object date/time of expiration
	AmzExpiration = "x-amz-expiration"

	// Dummy putBucketACL
	AmzACL = "x-amz-acl"

	// Signature V4 related contants.
	AmzContentSha256        = "X-Amz-Content-Sha256"
	AmzDate                 = "X-Amz-Date"
	AmzAlgorithm            = "X-Amz-Algorithm"
	AmzExpires              = "X-Amz-Expires"
	AmzSignedHeaders        = "X-Amz-SignedHeaders"
	AmzSignature            = "X-Amz-Signature"
	AmzCredential           = "X-Amz-Credential"
	AmzSecurityToken        = "X-Amz-Security-Token"
	AmzDecodedContentLength = "X-Amz-Decoded-Content-Length"
	AmzTrailer              = "X-Amz-Trailer"

	AmzMetaUnencryptedContentLength = "X-Amz-Meta-X-Amz-Unencrypted-Content-Length"
	AmzMetaUnencryptedContentMD5    = "X-Amz-Meta-X-Amz-Unencrypted-Content-Md5"

	// AWS server-side encryption headers for SSE-S3, SSE-KMS and SSE-C.
	AmzServerSideEncryption                      = "X-Amz-Server-Side-Encryption"
	AmzServerSideEncryptionKmsID                 = AmzServerSideEncryption + "-Aws-Kms-Key-Id"
	AmzServerSideEncryptionKmsContext            = AmzServerSideEncryption + "-Context"
	AmzServerSideEncryptionCustomerAlgorithm     = AmzServerSideEncryption + "-Customer-Algorithm"
	AmzServerSideEncryptionCustomerKey           = AmzServerSideEncryption + "-Customer-Key"
	AmzServerSideEncryptionCustomerKeyMD5        = AmzServerSideEncryption + "-Customer-Key-Md5"
	AmzServerSideEncryptionCopyCustomerAlgorithm = "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Algorithm"
	AmzServerSideEncryptionCopyCustomerKey       = "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key"
	AmzServerSideEncryptionCopyCustomerKeyMD5    = "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key-Md5"

	AmzEncryptionAES = "AES256"
	AmzEncryptionKMS = "aws:kms"

	// Signature v2 related constants
	AmzSignatureV2 = "Signature"
	AmzAccessKeyID = "AWSAccessKeyId"

	// Response request id.
	AmzRequestID     = "x-amz-request-id"
	AmzRequestHostID = "x-amz-id-2"

	// Content Checksums
	AmzChecksumAlgo   = "x-amz-checksum-algorithm"
	AmzChecksumCRC32  = "x-amz-checksum-crc32"
	AmzChecksumCRC32C = "x-amz-checksum-crc32c"
	AmzChecksumSHA1   = "x-amz-checksum-sha1"
	AmzChecksumSHA256 = "x-amz-checksum-sha256"
	AmzChecksumMode   = "x-amz-checksum-mode"
)

Standard S3 HTTP request constants

Variables

This section is empty.

Functions

func ExtractSignedHeaders

func ExtractSignedHeaders(signedHeaders []string, r *http.Request) (http.Header, error)

ExtractSignedHeaders extract signed headers from Authorization header

func ValidateBucketName

func ValidateBucketName(bucketName string) error

Types

type CredentialHeader

type CredentialHeader struct {
	AccessKey string
	Scope     struct {
		Date    time.Time
		Region  string
		Service string
		Request string
	}
}

func (CredentialHeader) GetScope

func (c CredentialHeader) GetScope() string

type CredentialsV4

type CredentialsV4 struct {
	AccessKeyID     string `yaml:"accessKeyID"`
	SecretAccessKey string `yaml:"secretAccessKey"`
}

type Method

type Method uint8
const (
	UndefinedMethod Method = iota
	CreateBucket
	DeleteBucket
	HeadBucket
	ListBuckets
	GetBucketLocation

	GetBucketTagging
	PutBucketTagging
	DeleteBucketTagging

	GetBucketLifecycle
	DeleteBucketLifecycle
	PutBucketLifecycle

	GetBucketPolicy
	PutBucketPolicy
	DeleteBucketPolicy
	GetBucketPolicyStatus

	GetBucketAcl
	PutBucketAcl

	GetBucketVersioning
	PutBucketVersioning

	GetBucketWebsite
	PutBucketWebsite
	DeleteBucketWebsite

	GetBucketReplication
	PutBucketReplication
	DeleteBucketReplication

	GetBucketNotification
	// DeleteBucketNotification is Ceph extension
	DeleteBucketNotification
	PutBucketNotification

	GetBucketEncryption
	PutBucketEncryption
	DeleteBucketEncryption

	GetBucketRequestPayment
	PutBucketRequestPayment

	GetBucketMetricsConfiguration
	ListBucketMetricsConfiguration
	PutBucketMetricsConfiguration
	DeleteBucketMetricsConfiguration

	GetBucketAnalyticsConfiguration
	ListBucketAnalyticsConfiguration
	PutBucketAnalyticsConfiguration
	DeleteBucketAnalyticsConfiguration

	GetBucketIntelligentTieringConfiguration
	ListBucketIntelligentTieringConfiguration
	PutBucketIntelligentTieringConfiguration
	DeleteBucketIntelligentTieringConfiguration

	GetBucketInventoryConfiguration
	ListBucketInventoryConfiguration
	PutBucketInventoryConfiguration
	DeleteBucketInventoryConfiguration

	GetBucketAccelerateConfiguration
	PutBucketAccelerateConfiguration

	GetBucketLogging
	PutBucketLogging

	GetBucketOwnershipControls
	PutBucketOwnershipControls
	DeleteBucketOwnershipControls

	GetBucketCors
	PutBucketCors
	DeleteBucketCors

	GetObject
	HeadObject
	PutObject
	DeleteObject
	DeleteObjects
	ListObjects
	ListObjectsV2

	GetObjectAttributes
	CopyObject
	ListObjectVersions
	RestoreObject
	SelectObjectContent
	WriteGetObjectResponse

	CreateMultipartUpload
	UploadPart
	CompleteMultipartUpload
	AbortMultipartUpload
	ListMultipartUploads
	ListParts
	UploadPartCopy

	GetObjectTagging
	PutObjectTagging
	DeleteObjectTagging

	GetObjectAcl
	PutObjectAcl

	GetPublicAccessBlock
	PutPublicAccessBlock
	DeletePublicAccessBlock

	GetObjectRetention
	PutObjectRetention

	GetObjectLegalHold
	PutObjectLegalHold

	GetObjectLockConfiguration
	PutObjectLockConfiguration

	GetObjectTorrent
)

func ParseReq

func ParseReq(r *http.Request) (bucket string, object string, method Method)

func (Method) String

func (i Method) String() string

type RateLimit

type RateLimit struct {
	Enabled bool `yaml:"enabled"`
	RPM     int  `yaml:"rpm"`
}

type SignValues

type SignValues struct {
	Credential    CredentialHeader
	SignedHeaders []string
	Signature     string
}

func ParseSignV4

func ParseSignV4(v4Auth string) (sv SignValues, err error)

type Storage

type Storage struct {
	Address             string                   `yaml:"address"`
	Credentials         map[string]CredentialsV4 `yaml:"credentials"`
	Provider            string                   `yaml:"provider"`
	IsMain              bool                     `yaml:"isMain"`
	HealthCheckInterval time.Duration            `yaml:"healthCheckInterval"`
	HttpTimeout         time.Duration            `yaml:"httpTimeout"`
	IsSecure            bool                     `yaml:"isSecure"`
	DefaultRegion       string                   `yaml:"defaultRegion"`

	RateLimit RateLimit `yaml:"rateLimit"`
	// contains filtered or unexported fields
}

func (*Storage) CredentialList

func (s *Storage) CredentialList() []string

type StorageConfig

type StorageConfig struct {
	DefaultRegion     string             `yaml:"defaultRegion"`
	Storages          map[string]Storage `yaml:"storages"`
	CreateRouting     bool               `yaml:"createRouting"`
	CreateReplication bool               `yaml:"createReplication"`
	// contains filtered or unexported fields
}

func (*StorageConfig) Followers

func (s *StorageConfig) Followers() []string

func (*StorageConfig) Init

func (s *StorageConfig) Init() error

func (*StorageConfig) Main

func (s *StorageConfig) Main() string

func (*StorageConfig) RateLimitConf

func (s *StorageConfig) RateLimitConf() map[string]RateLimit

func (*StorageConfig) StorageList

func (s *StorageConfig) StorageList() []string

Jump to

Keyboard shortcuts

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