Documentation
¶
Overview ¶
Package s3 implements bsw.BlockStorageWrapper for Amazon S3 and S3-compatible storages.
Index ¶
- Constants
- Variables
- type AwsCompletedPartdeprecated
- type Config
- type Service
- func (s *Service) CompleteMultipartUpload(o *bsw.Object, uploadID string, parts []bsw.CompletedPart) error
- func (s *Service) Init(ctx context.Context) error
- func (s *Service) Name() string
- func (s *Service) PreSignGetObjectURL(o *bsw.Object, timeout time.Duration) (string, error)
- func (s *Service) PreSignMultipartObjectURL(o *bsw.Object, timeout time.Duration) ([]string, string, error)
- func (s *Service) PreSignPutObjectURL(o *bsw.Object, timeout time.Duration) (string, error)
Constants ¶
const DefaultRetryCount = 5
DefaultRetryCount is used when Config.RetryCount is 0.
const MaxPresignTimeout = 7 * 24 * time.Hour
MaxPresignTimeout is the longest validity of a presigned URL allowed by S3.
Variables ¶
var ( ErrSessionInit = errors.Template("aws session init failed"). Code("BSW-0201").StatusCode(500).Severity(errors.Critical) ErrCreateMultipartUpload = errors.Template("create multipart upload request failed"). Code("BSW-0202").StatusCode(500).Severity(errors.Critical) ErrPresignPartURL = errors.Template("presigned part URL generation failed"). Code("BSW-0203").StatusCode(500).Severity(errors.Critical) ErrCompleteMultipartUpload = errors.Template("multipart complete failed"). Code("BSW-0204").StatusCode(500).Severity(errors.Critical) ErrPresignURL = errors.Template("presigned URL generation failed"). Code("BSW-0205").StatusCode(500).Severity(errors.Critical) )
Functions ¶
This section is empty.
Types ¶
type AwsCompletedPart
deprecated
type Config ¶
type Config struct {
Region *string `json:"region"`
Credentials struct {
AwsAccessKeyID string `json:"awsAccessKeyId"`
AwsSecretAccessKey string `json:"awsSecretAccessKey"`
} `json:"credentials"`
RetryCount int `json:"retryCount"`
// Endpoint overrides the S3 endpoint, e.g. for MinIO. Optional.
Endpoint string `json:"endpoint"`
// ForcePathStyle uses path-style URLs (https://host/bucket/key)
// instead of virtual-hosted ones. Usually needed with Endpoint.
ForcePathStyle bool `json:"forcePathStyle"`
}
Config holds S3 settings.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements bsw.BlockStorageWrapper for S3.
func (*Service) CompleteMultipartUpload ¶
func (s *Service) CompleteMultipartUpload(o *bsw.Object, uploadID string, parts []bsw.CompletedPart) error
CompleteMultipartUpload merges uploaded parts into a single object. Parts may be passed in any order, they are sent sorted by part number.
func (*Service) PreSignGetObjectURL ¶
PreSignGetObjectURL returns presigned URL for GET object request.
func (*Service) PreSignMultipartObjectURL ¶
func (s *Service) PreSignMultipartObjectURL(o *bsw.Object, timeout time.Duration) ([]string, string, error)
PreSignMultipartObjectURL starts a multipart upload and returns presigned PUT URLs for every part and the upload ID. If a part URL can not be generated, the upload is aborted.