imguploader

package
v6.1.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2019 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Account string
	Key     string
}

func (*Auth) SignRequest

func (a *Auth) SignRequest(req *http.Request)

type AzureBlobUploader

type AzureBlobUploader struct {
	// contains filtered or unexported fields
}

func NewAzureBlobUploader

func NewAzureBlobUploader(account_name string, account_key string, container_name string) *AzureBlobUploader

func (*AzureBlobUploader) Upload

func (az *AzureBlobUploader) Upload(ctx context.Context, imageDiskPath string) (string, error)

Receive path of image on disk and return azure blob url

type Blob

type Blob struct {
	Name     string   `xml:"Name"`
	Property Property `xml:"Properties"`
}

type Blobs

type Blobs struct {
	XMLName xml.Name `xml:"EnumerationResults"`
	Items   []Blob   `xml:"Blobs>Blob"`
}

--- AZURE LIBRARY

type Error

type Error struct {
	Code   int
	Status string
	Body   []byte
	Header http.Header

	AzureCode string
}

func (*Error) Error

func (e *Error) Error() string

type GCSUploader

type GCSUploader struct {
	// contains filtered or unexported fields
}

func NewGCSUploader

func NewGCSUploader(keyFile, bucket, path string) *GCSUploader

func (*GCSUploader) Upload

func (u *GCSUploader) Upload(ctx context.Context, imageDiskPath string) (string, error)

type ImageUploader

type ImageUploader interface {
	Upload(ctx context.Context, path string) (string, error)
}

func NewImageUploader

func NewImageUploader() (ImageUploader, error)

type LocalUploader

type LocalUploader struct {
}

func NewLocalImageUploader

func NewLocalImageUploader() (*LocalUploader, error)

func (*LocalUploader) Upload

func (u *LocalUploader) Upload(ctx context.Context, imageOnDiskPath string) (string, error)

type NopImageUploader

type NopImageUploader struct {
}

func (NopImageUploader) Upload

func (NopImageUploader) Upload(ctx context.Context, path string) (string, error)

type Property

type Property struct {
	LastModified  string `xml:"Last-Modified"`
	Etag          string `xml:"Etag"`
	ContentLength int    `xml:"Content-Length"`
	ContentType   string `xml:"Content-Type"`
	BlobType      string `xml:"BlobType"`
	LeaseStatus   string `xml:"LeaseStatus"`
}

type S3Uploader

type S3Uploader struct {
	// contains filtered or unexported fields
}

func NewS3Uploader

func NewS3Uploader(region, bucket, path, acl, accessKey, secretKey string) *S3Uploader

func (*S3Uploader) Upload

func (u *S3Uploader) Upload(ctx context.Context, imageDiskPath string) (string, error)

type StorageClient

type StorageClient struct {
	Auth      *Auth
	Transport http.RoundTripper
}

func NewStorageClient

func NewStorageClient(account, accessKey string) *StorageClient

func (*StorageClient) FileUpload

func (c *StorageClient) FileUpload(container, blobName string, body io.Reader) (*http.Response, error)

type WebdavUploader

type WebdavUploader struct {
	// contains filtered or unexported fields
}

func NewWebdavImageUploader

func NewWebdavImageUploader(url, username, password, public_url string) (*WebdavUploader, error)

func (*WebdavUploader) PublicURL

func (u *WebdavUploader) PublicURL(filename string) string

func (*WebdavUploader) Upload

func (u *WebdavUploader) Upload(ctx context.Context, pa string) (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL