Documentation ¶
Index ¶
- Constants
- Variables
- func New(ctx context.Context, opts ...*Options) (storage.ObjectStorage, error)
- func NewEmpty(ctx context.Context, opts ...*Options) (storage.ObjectStorage, error)
- func NewSigner(unsignedHeaders []string, optFns ...func(signer *v4.SignerOptions)) v4.HTTPSigner
- type Options
- func (opts *Options) SetBucketName(bucketName string) *Options
- func (opts *Options) SetBufferSize(bufferSize int) *Options
- func (opts *Options) SetContentType(contentType string) *Options
- func (opts *Options) SetDefaultExpire(defaultExpire time.Duration) *Options
- func (opts *Options) SetExternalURI(externalURI string) *Options
- func (opts *Options) SetFilenameSuffix(suffix string) *Options
- func (opts *Options) SetForcePathStyle(forcePathStyle bool) *Options
- func (opts *Options) SetProxyURI(proxyURI *url.URL) *Options
- func (opts *Options) SetRegion(region string) *Options
- func (opts *Options) SetStaticCredentials(key, secret, sessionToken string) *Options
- func (opts *Options) SetTransport(transport http.RoundTripper) *Options
- func (opts *Options) SetURI(URI string) *Options
- func (opts *Options) SetUnsignedHeaders(unsignedHeaders []string) *Options
- func (opts *Options) SetUseAccelerate(useAccelerate bool) *Options
- func (opts Options) Validate() error
- type Signer
- type SimpleStorageService
- func (s *SimpleStorageService) DeleteObject(ctx context.Context, path string) error
- func (s *SimpleStorageService) DeleteRequest(ctx context.Context, path string, expireAfter time.Duration) (*model.Link, error)
- func (s *SimpleStorageService) GetObject(ctx context.Context, path string) (io.ReadCloser, error)
- func (s *SimpleStorageService) GetRequest(ctx context.Context, objectPath string, filename string, ...) (*model.Link, error)
- func (s *SimpleStorageService) HealthCheck(ctx context.Context) error
- func (s *SimpleStorageService) PutObject(ctx context.Context, path string, src io.Reader) error
- func (s *SimpleStorageService) PutRequest(ctx context.Context, path string, expireAfter time.Duration) (*model.Link, error)
- func (s *SimpleStorageService) StatObject(ctx context.Context, path string) (*storage.ObjectInfo, error)
- type StaticCredentials
Constants ¶
const ( DefaultBufferSize = 10 * mib DefaultExpire = 15 * time.Minute )
const ( ExpireMaxLimit = 7 * 24 * time.Hour ExpireMinLimit = 1 * time.Minute MultipartMaxParts = 10000 MultipartMinSize = 5 * mib )
Variables ¶
var ErrClientEmpty = stderr.New("s3: storage client credentials not configured")
Functions ¶
func NewEmpty ¶
NewEmpty initializes a new s3 client that does not implicitly load credentials from the environment. Credentials must be set using the StorageSettings provided with the Context.
func NewSigner ¶
func NewSigner( unsignedHeaders []string, optFns ...func(signer *v4.SignerOptions), ) v4.HTTPSigner
Types ¶
type Options ¶
type Options struct { // ContentType of the uploaded objects ContentType *string // FilenameSuffix adds the suffix to the content-disposition for object downloads FilenameSuffix *string // DefaultExpire is the fallback presign expire duration // (defaults to 15min). DefaultExpire *time.Duration // BufferSize sets the buffer size allocated for uploads. // This implicitly sets the upper limit for upload size: // BufferSize * 10000 (defaults to: 5MiB). BufferSize *int // UnsignedHeaders forces the driver to skip the named headers from the // being signed. UnsignedHeaders []string // Transport sets an alternative RoundTripper used by the Go HTTP // client. Transport http.RoundTripper // contains filtered or unexported fields }
func NewOptions ¶
func (*Options) SetBucketName ¶
func (*Options) SetBufferSize ¶
func (*Options) SetContentType ¶
func (*Options) SetDefaultExpire ¶
func (*Options) SetExternalURI ¶
func (*Options) SetFilenameSuffix ¶
func (*Options) SetForcePathStyle ¶
func (*Options) SetStaticCredentials ¶
func (*Options) SetTransport ¶
func (opts *Options) SetTransport(transport http.RoundTripper) *Options
func (*Options) SetUnsignedHeaders ¶
func (*Options) SetUseAccelerate ¶
type Signer ¶
type SimpleStorageService ¶
type SimpleStorageService struct {
// contains filtered or unexported fields
}
SimpleStorageService - AWS S3 client. Data layer for file storage. Implements model.FileStorage interface
func (*SimpleStorageService) DeleteObject ¶
func (s *SimpleStorageService) DeleteObject(ctx context.Context, path string) error
Delete removes deleted file from storage. Noop if ID does not exist.
func (*SimpleStorageService) DeleteRequest ¶
func (s *SimpleStorageService) DeleteRequest( ctx context.Context, path string, expireAfter time.Duration, ) (*model.Link, error)
DeleteRequest returns a presigned deletion request
func (*SimpleStorageService) GetObject ¶
func (s *SimpleStorageService) GetObject( ctx context.Context, path string, ) (io.ReadCloser, error)
func (*SimpleStorageService) GetRequest ¶
func (s *SimpleStorageService) GetRequest( ctx context.Context, objectPath string, filename string, expireAfter time.Duration, ) (*model.Link, error)
GetRequest duration is limited to 7 days (AWS limitation)
func (*SimpleStorageService) HealthCheck ¶
func (s *SimpleStorageService) HealthCheck(ctx context.Context) error
func (*SimpleStorageService) PutObject ¶
UploadArtifact uploads given artifact into the file server (AWS S3 or minio) using objectID as a key. If the artifact is larger than 5 MiB, the file is uploaded using the s3 multipart API, otherwise the object is created in a single request.
func (*SimpleStorageService) PutRequest ¶
func (*SimpleStorageService) StatObject ¶
func (s *SimpleStorageService) StatObject( ctx context.Context, path string, ) (*storage.ObjectInfo, error)
Exists check if selected object exists in the storage
type StaticCredentials ¶
type StaticCredentials struct { Key string `json:"key"` Secret string `json:"secret"` Token string `json:"token"` }
func (StaticCredentials) Retrieve ¶
func (creds StaticCredentials) Retrieve(context.Context) (aws.Credentials, error)
func (StaticCredentials) Validate ¶
func (creds StaticCredentials) Validate() error