Documentation
¶
Index ¶
- type Client
- type ClientImpl
- func (i *ClientImpl) DeleteFileFromPrivateBucket(ctx context.Context, filename string) error
- func (i *ClientImpl) DeleteFileFromPublicBucket(ctx context.Context, filename string) error
- func (i *ClientImpl) DownloadFromPrivateBucket(ctx context.Context, path string) ([]byte, error)
- func (i *ClientImpl) DownloadFromPublicBucket(ctx context.Context, path string) ([]byte, error)
- func (i *ClientImpl) FileExistsInPrivateBucket(ctx context.Context, filename string) (bool, error)
- func (i *ClientImpl) FileExistsInPublicBucket(ctx context.Context, filename string) (bool, error)
- func (i *ClientImpl) GetFileURLWithExpiry(ctx context.Context, filename string, duration time.Duration) (string, error)
- func (i *ClientImpl) ListFilesInPrivateBucket(ctx context.Context, path string) ([]string, error)
- func (i *ClientImpl) UploadToPrivateBucket(ctx context.Context, body io.Reader, filename string) (*string, error)
- func (i *ClientImpl) UploadToPublicBucket(ctx context.Context, body io.Reader, filename string) (*string, error)
- type Configuration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
UploadToPublicBucket(ctx context.Context, body io.Reader, filename string) (*string, error)
UploadToPrivateBucket(ctx context.Context, body io.Reader, filename string) (*string, error)
DownloadFromPublicBucket(ctx context.Context, filename string) ([]byte, error)
DownloadFromPrivateBucket(ctx context.Context, filename string) ([]byte, error)
DeleteFileFromPublicBucket(ctx context.Context, filename string) error
DeleteFileFromPrivateBucket(ctx context.Context, filename string) error
FileExistsInPublicBucket(ctx context.Context, filename string) (bool, error)
FileExistsInPrivateBucket(ctx context.Context, filename string) (bool, error)
GetFileURLWithExpiry(ctx context.Context, filename string, duration time.Duration) (string, error)
ListFilesInPrivateBucket(ctx context.Context, path string) ([]string, error)
}
func NewClient ¶
func NewClient(config Configuration, obs observability.Observability) Client
type ClientImpl ¶
type ClientImpl struct {
// contains filtered or unexported fields
}
func (*ClientImpl) DeleteFileFromPrivateBucket ¶
func (i *ClientImpl) DeleteFileFromPrivateBucket(ctx context.Context, filename string) error
func (*ClientImpl) DeleteFileFromPublicBucket ¶
func (i *ClientImpl) DeleteFileFromPublicBucket(ctx context.Context, filename string) error
func (*ClientImpl) DownloadFromPrivateBucket ¶
func (*ClientImpl) DownloadFromPublicBucket ¶
func (*ClientImpl) FileExistsInPrivateBucket ¶
func (*ClientImpl) FileExistsInPublicBucket ¶
func (*ClientImpl) GetFileURLWithExpiry ¶
func (*ClientImpl) ListFilesInPrivateBucket ¶
func (*ClientImpl) UploadToPrivateBucket ¶
func (i *ClientImpl) UploadToPrivateBucket(ctx context.Context, body io.Reader, filename string) (*string, error)
todo add metadata to the upload, such as the user who uploaded it
func (*ClientImpl) UploadToPublicBucket ¶
func (i *ClientImpl) UploadToPublicBucket(ctx context.Context, body io.Reader, filename string) (*string, error)
todo add metadata to the upload, such as the user who uploaded it
type Configuration ¶
type Configuration struct {
// Provider is the type of Configuration provider to use (AWS, Minio, etc).
Provider string `yaml:"provider" json:"provider" mapstructure:"provider"`
// Endpoint is the endpoint of the Configuration.
Endpoint string `yaml:"endpoint" json:"endpoint" mapstructure:"endpoint"`
// PublicURL is the public access url of the Configuration.
PublicURL string `yaml:"publicUrl" json:"publicUrl" mapstructure:"publicUrl"`
// AccessKey is access key for the Configuration connection.
AccessKey string `yaml:"accessKey" json:"accessKey" mapstructure:"accessKey"`
// Bucket is the name of the bucket to use.
PrivateBucket string `yaml:"privateBucket" json:"privateBucket" mapstructure:"privateBucket"`
// Bucket is the name of the bucket to use.
PublicBucket string `yaml:"publicBucket" json:"publicBucket" mapstructure:"publicBucket"`
// SecretKey is secret key for the Configuration connection.
SecretKey string `yaml:"secretKey" json:"secretKey" mapstructure:"secretKey"`
// Region is the region of the Configuration.
Region string `yaml:"region" json:"region" mapstructure:"region"`
AccessTokenId string `yaml:"accessTokenId" json:"accessTokenId" mapstructure:"accessTokenId"`
// AccessTokenSecret is the access token secret for the Configuration connection.
AccessTokenSecret string `yaml:"accessTokenSecret" json:"accessTokenSecret" mapstructure:"accessTokenSecret"`
ForcePathStyle bool `yaml:"forcePathStyle" json:"forcePathStyle" mapstructure:"forcePathStyle"`
// TLS is the TLS configuration for the Configuration connection.
TLS configuration.TLS `mapstructure:"tls" yaml:"tls" json:"tls"`
}
Configuration storage configuration with TLS
func (Configuration) ToAWSConfig ¶
func (c Configuration) ToAWSConfig() *aws.Config
Click to show internal directories.
Click to hide internal directories.