Documentation ¶
Index ¶
- Variables
- type Config
- type ConfigBase
- type GetOptions
- type GocloudConfig
- type GocloudProvider
- func (n *GocloudProvider) AuthPlugin() string
- func (n *GocloudProvider) DeleteObject(ctx context.Context, key string) error
- func (n *GocloudProvider) GetObject(ctx context.Context, key string, opts GetOptions) (io.ReadCloser, ObjectInfo, error)
- func (n *GocloudProvider) GetTags(ctx context.Context, key string) (map[string]string, error)
- func (n *GocloudProvider) Id() string
- func (n *GocloudProvider) ListObjects(ctx context.Context, prefix string) (ListObjectsResponse, error)
- func (n *GocloudProvider) PutObject(ctx context.Context, key string, data io.Reader, opts PutOptions) error
- type ListObjectsResponse
- type LogConfig
- type LogProvider
- func (n *LogProvider) AuthPlugin() string
- func (n *LogProvider) DeleteObject(ctx context.Context, key string) error
- func (n *LogProvider) GetObject(ctx context.Context, key string, opts GetOptions) (io.ReadCloser, ObjectInfo, error)
- func (n *LogProvider) GetTags(ctx context.Context, key string) (map[string]string, error)
- func (n *LogProvider) Id() string
- func (n *LogProvider) ListObjects(ctx context.Context, prefix string) (ListObjectsResponse, error)
- func (n *LogProvider) PutObject(ctx context.Context, key string, data io.Reader, opts PutOptions) error
- type ObjectInfo
- type PresignOperation
- type Presigner
- type Provider
- type ProviderType
- type PutOptions
- type S3Config
- type S3Provider
- func (s *S3Provider) AuthPlugin() string
- func (s *S3Provider) DeleteObject(ctx context.Context, key string) error
- func (s *S3Provider) GetObject(ctx context.Context, key string, opts GetOptions) (io.ReadCloser, ObjectInfo, error)
- func (s *S3Provider) GetTags(ctx context.Context, key string) (map[string]string, error)
- func (s *S3Provider) Id() string
- func (s *S3Provider) ListObjects(ctx context.Context, prefix string) (ListObjectsResponse, error)
- func (s *S3Provider) PresignURL(ctx context.Context, key string, op PresignOperation) (string, error)
- func (s *S3Provider) PutObject(ctx context.Context, key string, data io.Reader, opts PutOptions) error
- type VoidConfig
- type VoidProvider
- func (n *VoidProvider) AuthPlugin() string
- func (n *VoidProvider) DeleteObject(ctx context.Context, key string) error
- func (n *VoidProvider) GetObject(ctx context.Context, key string, opts GetOptions) (io.ReadCloser, ObjectInfo, error)
- func (n *VoidProvider) GetTags(ctx context.Context, key string) (map[string]string, error)
- func (n *VoidProvider) Id() string
- func (n *VoidProvider) ListObjects(ctx context.Context, prefix string) (ListObjectsResponse, error)
- func (n *VoidProvider) PutObject(ctx context.Context, key string, data io.Reader, opts PutOptions) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("resource not found") ErrDenied = errors.New("access denied") ErrNoPresign = errors.New("presigning is not allowed for this provider") // This is a special error that the provider can return to indicate that the object has not been modified since the specified time // It will be translated into a 304 Not Modified response by the server ErrNotModified = errors.New("resource not modified") )
Functions ¶
This section is empty.
Types ¶
type ConfigBase ¶
func (*ConfigBase) Id ¶
func (c *ConfigBase) Id() string
type GetOptions ¶
type GocloudConfig ¶
type GocloudConfig struct { ConfigBase DriverURL string `json:"driver-url"` }
type GocloudProvider ¶
type GocloudProvider struct {
// contains filtered or unexported fields
}
func NewGocloudProvider ¶
func NewGocloudProvider(cfg *GocloudConfig) (*GocloudProvider, error)
func (*GocloudProvider) AuthPlugin ¶
func (n *GocloudProvider) AuthPlugin() string
func (*GocloudProvider) DeleteObject ¶ added in v0.3.0
func (n *GocloudProvider) DeleteObject(ctx context.Context, key string) error
func (*GocloudProvider) GetObject ¶
func (n *GocloudProvider) GetObject(ctx context.Context, key string, opts GetOptions) (io.ReadCloser, ObjectInfo, error)
func (*GocloudProvider) Id ¶
func (n *GocloudProvider) Id() string
func (*GocloudProvider) ListObjects ¶ added in v0.3.0
func (n *GocloudProvider) ListObjects(ctx context.Context, prefix string) (ListObjectsResponse, error)
func (*GocloudProvider) PutObject ¶
func (n *GocloudProvider) PutObject(ctx context.Context, key string, data io.Reader, opts PutOptions) error
type ListObjectsResponse ¶ added in v0.3.0
type ListObjectsResponse struct { // The keys of the objects found Keys []string }
type LogConfig ¶
type LogConfig struct {
ConfigBase
}
type LogProvider ¶
type LogProvider struct {
// contains filtered or unexported fields
}
func NewLogProvider ¶
func NewLogProvider(cfg *LogConfig) *LogProvider
func (*LogProvider) AuthPlugin ¶
func (n *LogProvider) AuthPlugin() string
func (*LogProvider) DeleteObject ¶ added in v0.3.0
func (n *LogProvider) DeleteObject(ctx context.Context, key string) error
func (*LogProvider) GetObject ¶
func (n *LogProvider) GetObject(ctx context.Context, key string, opts GetOptions) (io.ReadCloser, ObjectInfo, error)
func (*LogProvider) Id ¶
func (n *LogProvider) Id() string
func (*LogProvider) ListObjects ¶ added in v0.3.0
func (n *LogProvider) ListObjects(ctx context.Context, prefix string) (ListObjectsResponse, error)
func (*LogProvider) PutObject ¶
func (n *LogProvider) PutObject(ctx context.Context, key string, data io.Reader, opts PutOptions) error
type ObjectInfo ¶
type ObjectInfo struct { // When the object was last modified LastModified *time.Time // The length of the object in bytes ContentLength *int64 // The content type of the object ContentType *string }
ObjectInfo contains metadata about an object The server will only act on the fields that are not nil
type PresignOperation ¶
type PresignOperation string
const ( PresignOperationDownload PresignOperation = "download" PresignOperationUpload PresignOperation = "upload" )
type Provider ¶
type Provider interface { // Id returns the provider ID which must be unique among all providers Id() string // AuthPlugin optionally returns the name of the auth plugin that should be used for this provider // If the provider does not specify an auth plugin the default one will be used AuthPlugin() string GetObject(ctx context.Context, key string, opts GetOptions) (io.ReadCloser, ObjectInfo, error) PutObject(ctx context.Context, key string, data io.Reader, opts PutOptions) error GetTags(ctx context.Context, key string) (map[string]string, error) ListObjects(ctx context.Context, prefix string) (ListObjectsResponse, error) DeleteObject(ctx context.Context, key string) error }
type ProviderType ¶
type ProviderType string
const ( // ProviderTypeVoid is a provider that does nothing ProviderTypeVoid ProviderType = "void" // ProviderTypeLog is a provider that logs all operations ProviderTypeLog ProviderType = "log" // ProviderTypeS3 is a provider that uses AWS S3 ProviderTypeS3 ProviderType = "s3" // ProviderTypeGocloud is a provider that uses the gocloud.dev CDK // This will support all the providers that gocloud supports including S3, Azure, Google Cloud, file and in-memory ProviderTypeGocloud ProviderType = "gocloud" )
type PutOptions ¶ added in v0.2.0
type S3Config ¶
type S3Config struct { ConfigBase Bucket string Region string Profile string PresignEnabled bool `json:"presign-enabled"` }
type S3Provider ¶
type S3Provider struct {
// contains filtered or unexported fields
}
func NewS3Provider ¶
func NewS3Provider(cfg *S3Config) (*S3Provider, error)
func (*S3Provider) AuthPlugin ¶
func (s *S3Provider) AuthPlugin() string
func (*S3Provider) DeleteObject ¶ added in v0.3.0
func (s *S3Provider) DeleteObject(ctx context.Context, key string) error
func (*S3Provider) GetObject ¶
func (s *S3Provider) GetObject(ctx context.Context, key string, opts GetOptions) (io.ReadCloser, ObjectInfo, error)
func (*S3Provider) Id ¶
func (s *S3Provider) Id() string
func (*S3Provider) ListObjects ¶ added in v0.3.0
func (s *S3Provider) ListObjects(ctx context.Context, prefix string) (ListObjectsResponse, error)
Does currently not support pagination but the default max is 1000 so it is fine for now. Note for future developers: output.IsTruncated is a boolean that indicates if there are more objects to retrieve and output.NextContinuationToken is the token to use for the next request.
func (*S3Provider) PresignURL ¶
func (s *S3Provider) PresignURL(ctx context.Context, key string, op PresignOperation) (string, error)
func (*S3Provider) PutObject ¶
func (s *S3Provider) PutObject(ctx context.Context, key string, data io.Reader, opts PutOptions) error
type VoidConfig ¶
type VoidConfig struct {
ConfigBase
}
type VoidProvider ¶
type VoidProvider struct {
// contains filtered or unexported fields
}
func NewVoidProvider ¶
func NewVoidProvider(cfg *VoidConfig) *VoidProvider
func (*VoidProvider) AuthPlugin ¶
func (n *VoidProvider) AuthPlugin() string
func (*VoidProvider) DeleteObject ¶ added in v0.3.0
func (n *VoidProvider) DeleteObject(ctx context.Context, key string) error
func (*VoidProvider) GetObject ¶
func (n *VoidProvider) GetObject(ctx context.Context, key string, opts GetOptions) (io.ReadCloser, ObjectInfo, error)
func (*VoidProvider) Id ¶
func (n *VoidProvider) Id() string
func (*VoidProvider) ListObjects ¶ added in v0.3.0
func (n *VoidProvider) ListObjects(ctx context.Context, prefix string) (ListObjectsResponse, error)
func (*VoidProvider) PutObject ¶
func (n *VoidProvider) PutObject(ctx context.Context, key string, data io.Reader, opts PutOptions) error
Click to show internal directories.
Click to hide internal directories.