Documentation ¶
Index ¶
- Constants
- Variables
- type ReadOptions
- type Storage
- func (s *Storage) Attributes(ctx context.Context, key string) (*blob.Attributes, error)
- func (s *Storage) BucketName() string
- func (s *Storage) Close() error
- func (s *Storage) Download(ctx context.Context, key string, readOptions *ReadOptions) (io.Reader, error)
- func (s *Storage) DownloadByte(ctx context.Context, key string, readOptions *ReadOptions) ([]byte, error)
- func (s *Storage) DownloadFile(ctx context.Context, key, destination string, readOptions *ReadOptions) error
- func (s *Storage) Name() string
- func (s *Storage) SignedURL(ctx context.Context, key string, expiry time.Duration) (string, error)
- func (s *Storage) Stream(ctx context.Context, key string, writeOptions *WriteOptions) (*Stream, error)
- func (s *Storage) Upload(ctx context.Context, reader io.Reader, key string, writeOptions *WriteOptions) (string, error)
- func (s *Storage) UploadByte(ctx context.Context, content []byte, key string, writeOptions *WriteOptions) (string, error)
- func (s *Storage) UploadFile(ctx context.Context, filepath, key string, writeOptions *WriteOptions) (string, error)
- type StorageProvider
- type Stream
- type WriteOptions
Constants ¶
const ( // local storage for testing StorageLocal = "local" // google cloud storage StorageGCS = "gcs" // amazon s3 storage StorageS3 = "s3" // digital ocean space storage StorageDO = "do" // minio storage StorageMinio = "minio" )
storage type of artifact
Variables ¶
var ( ErrByteEmpty = errors.New("byte content is empty") ErrCredentialsEmpty = errors.New("credentials is empty") )
list of error
Functions ¶
This section is empty.
Types ¶
type ReadOptions ¶
type ReadOptions struct { // FileMode is an options when downloading file // using DownloadFile function FileMode os.FileMode }
ReadOptions struct we might need this later on
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage struct
func (*Storage) Attributes ¶
Attributes return information/attributes of object
func (*Storage) Download ¶
func (s *Storage) Download(ctx context.Context, key string, readOptions *ReadOptions) (io.Reader, error)
Download file from bucket
func (*Storage) DownloadByte ¶
func (s *Storage) DownloadByte(ctx context.Context, key string, readOptions *ReadOptions) ([]byte, error)
DownloadByte is a helper function for downloading content with return of byte
func (*Storage) DownloadFile ¶
func (s *Storage) DownloadFile(ctx context.Context, key, destination string, readOptions *ReadOptions) error
DownloadFile will download and create file from object storage
func (*Storage) Name ¶
Name of provider this might be useful if application has admin-port of something like that to retrieve the current name of the provider
func (*Storage) Stream ¶
func (s *Storage) Stream(ctx context.Context, key string, writeOptions *WriteOptions) (*Stream, error)
Stream create a new stream object
func (*Storage) Upload ¶
func (s *Storage) Upload(ctx context.Context, reader io.Reader, key string, writeOptions *WriteOptions) (string, error)
Upload file from bytes
func (*Storage) UploadByte ¶
func (s *Storage) UploadByte(ctx context.Context, content []byte, key string, writeOptions *WriteOptions) (string, error)
UploadByte is a halper function for upload receiving byte param
func (*Storage) UploadFile ¶
func (s *Storage) UploadFile(ctx context.Context, filepath, key string, writeOptions *WriteOptions) (string, error)
UploadFile file from source and destination
type StorageProvider ¶
type StorageProvider interface { Bucket() *blob.Bucket Name() string BucketName() string BucketURL() string Close() error }
StorageProvider interface
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream struct
type WriteOptions ¶
type WriteOptions struct { // BufferSize for writing many small writes concurrently BufferSize int // ContentType specifies the MIME type of the blob ContentType string // ContentDisposition specifies whether the content is displayed inline or as attachment ContentDisposition string // ContentEncoding to store specific encoding for the content ContentEncoding string // ContentLanguage for language of the content ContentLanguage string // ContentMD5 for integrity check ContentMD5 []byte // Key-value associated with the blob Metadata map[string]string }
WriteOptions struct