Documentation ¶
Index ¶
Constants ¶
View Source
const (
// AzureProvider indicates we'd like to use the azure adapter for blob.
AzureProvider = "azure"
)
View Source
const (
// FilesystemProvider indicates we'd like to use the filesystem adapter for blob.
FilesystemProvider = "filesystem"
)
View Source
const (
// GCSProvider indicates we'd like to use the gcs adapter for blob.
GCSProvider = "gcs"
)
View Source
const (
// MemoryProvider indicates we'd like to use the memory adapter for blob.
MemoryProvider = "memory"
)
View Source
const (
// S3Provider indicates we'd like to use the s3 adapter for blob.
S3Provider = "s3"
)
Variables ¶
View Source
var ( // ErrNilConfig denotes that the provided configuration is nil. ErrNilConfig = errors.New("nil config provided") // ErrInvalidConfiguration denotes that the provided configuration is invalid. ErrInvalidConfiguration = errors.New("configuration invalid") ErrBucketIsUnavailable = errors.New("bucket is unavailable") )
View Source
var ( // Providers is what we provide to the dependency injection framework. Providers = wire.NewSet( NewUploadManager, ) )
Functions ¶
This section is empty.
Types ¶
type AzureConfig ¶
type AzureConfig struct { AuthMethod string `json:"auth_method" mapstructure:"auth_method" toml:"auth_method,omitempty"` AccountName string `json:"account_name" mapstructure:"account_name" toml:"account_name,omitempty"` BucketName string `json:"bucket_name" mapstructure:"bucket_name" toml:"bucket_name,omitempty"` Retrying *AzureRetryConfig `json:"retrying" mapstructure:"retrying" toml:"retrying,omitempty"` TokenCredentialsInitialToken string `json:"token_creds_initial_token" mapstructure:"token_creds_initial_token" toml:"token_creds_initial_token,omitempty"` // contains filtered or unexported fields }
AzureConfig configures an azure instance of an UploadManager.
func (*AzureConfig) ValidateWithContext ¶
func (c *AzureConfig) ValidateWithContext(ctx context.Context) error
ValidateWithContext validates the AzureConfig.
type AzureRetryConfig ¶
type AzureRetryConfig struct { RetryReadsFromSecondaryHost string `` /* 134-byte string literal not displayed */ TryTimeout time.Duration `json:"try_timeout" mapstructure:"try_timeout" toml:"try_timeout,omitempty"` RetryDelay time.Duration `json:"retry_delay" mapstructure:"retry_delay" toml:"retry_delay,omitempty"` MaxRetryDelay time.Duration `json:"max_retry_delay" mapstructure:"max_retry_delay" toml:"max_retry_delay,omitempty"` MaxTries int32 `json:"max_tries" mapstructure:"max_tries" toml:"max_tries,omitempty"` // contains filtered or unexported fields }
AzureRetryConfig configures storage retries.
type Config ¶
type Config struct { FilesystemConfig *FilesystemConfig `json:"filesystem" mapstructure:"filesystem" toml:"filesystem,omitempty"` AzureConfig *AzureConfig `json:"azure" mapstructure:"azure" toml:"azure,omitempty"` GCSConfig *GCSConfig `json:"gcs" mapstructure:"gcs" toml:"gcs,omitempty"` S3Config *S3Config `json:"s3" mapstructure:"s3" toml:"s3,omitempty"` BucketName string `json:"bucket_name" mapstructure:"bucket_name" toml:"bucket_name,omitempty"` UploadFilenameKey string `json:"upload_filename_key" mapstructure:"upload_filename_key" toml:"upload_filename_key,omitempty"` Provider string `json:"provider" mapstructure:"provider" toml:"provider,omitempty"` // contains filtered or unexported fields }
Config configures our UploadManager.
type FilesystemConfig ¶
type FilesystemConfig struct { RootDirectory string `json:"root_directory" mapstructure:"root_directory" toml:"root_directory,omitempty"` // contains filtered or unexported fields }
FilesystemConfig configures a filesystem-based storage provider.
func (*FilesystemConfig) ValidateWithContext ¶
func (c *FilesystemConfig) ValidateWithContext(ctx context.Context) error
ValidateWithContext validates the FilesystemConfig.
type GCSBlobConfig ¶
type GCSBlobConfig struct { GoogleAccessID string `json:"google_access_id" mapstructure:"google_access_id" toml:"google_access_id,omitempty"` // contains filtered or unexported fields }
GCSBlobConfig configures a gcs blob passwords method.
type GCSConfig ¶
type GCSConfig struct { BlobSettings GCSBlobConfig `json:"blob_settings" mapstructure:"blob_settings" toml:"blob_settings,omitempty"` ServiceAccountKeyFilepath string `json:"service_account_key_filepath" mapstructure:"service_account_key_filepath" toml:"service_account_key_filepath,omitempty"` BucketName string `json:"bucket_name" mapstructure:"bucket_name" toml:"bucket_name,omitempty"` Scopes []string `json:"scopes" mapstructure:"scopes" toml:"scopes,omitempty"` // contains filtered or unexported fields }
GCSConfig configures a gcs based storage provider.
type S3Config ¶
type S3Config struct { BucketName string `json:"bucket_name" mapstructure:"bucket_name" toml:"bucket_name,omitempty"` // contains filtered or unexported fields }
S3Config configures an S3-based storage provider.
type Uploader ¶
type Uploader struct {
// contains filtered or unexported fields
}
Uploader implements our UploadManager struct.
func NewUploadManager ¶
func NewUploadManager(ctx context.Context, logger logging.Logger, cfg *Config, routeParamManager routing.RouteParamManager) (*Uploader, error)
NewUploadManager provides a new uploads.UploadManager.
func (*Uploader) ServeFiles ¶
func (u *Uploader) ServeFiles(res http.ResponseWriter, req *http.Request)
ServeFiles saves a file to the blob.
Click to show internal directories.
Click to hide internal directories.