cloudstorage

package
v0.0.0-...-f83813f Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const PresignPutExpires time.Duration = 15 * duration.PerMinute

PresignPutExpires is how long the presign PUT request remains valid.

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureStorage

type AzureStorage struct {
	ServiceURL     string
	StorageAccount string
	Container      string
	AccessKey      string
	Clock          clock.Clock
}

func NewAzureStorage

func NewAzureStorage(serviceURL string, storageAccount string, accessKey string, container string, c clock.Clock) *AzureStorage

func (*AzureStorage) MakeDirector

func (s *AzureStorage) MakeDirector(extractKey func(r *http.Request) string, expire time.Duration) func(r *http.Request)

func (*AzureStorage) PresignGetObject

func (s *AzureStorage) PresignGetObject(ctx context.Context, name string, expire time.Duration) (*url.URL, error)

func (*AzureStorage) PresignHeadObject

func (s *AzureStorage) PresignHeadObject(ctx context.Context, name string, expire time.Duration) (*url.URL, error)

func (*AzureStorage) PresignPutObject

func (s *AzureStorage) PresignPutObject(ctx context.Context, name string, header http.Header) (*http.Request, error)

func (*AzureStorage) SignedURL

func (s *AzureStorage) SignedURL(name string, now time.Time, duration time.Duration, perm azblob.BlobSASPermissions) (*url.URL, error)

type GCSStorage

type GCSStorage struct {
	ServiceAccount  string
	Bucket          string
	CredentialsJSON []byte
	Clock           clock.Clock
}

func NewGCSStorage

func NewGCSStorage(
	credentialsJSON []byte,
	serviceAccount string,
	bucket string,
	c clock.Clock,
) (*GCSStorage, error)

func (*GCSStorage) MakeDirector

func (s *GCSStorage) MakeDirector(extractKey func(r *http.Request) string, expire time.Duration) func(r *http.Request)

func (*GCSStorage) PresignGetObject

func (s *GCSStorage) PresignGetObject(ctx context.Context, name string, expire time.Duration) (*url.URL, error)

func (*GCSStorage) PresignGetOrHeadObject

func (s *GCSStorage) PresignGetOrHeadObject(ctx context.Context, name string, method string, expire time.Duration) (*url.URL, error)

func (*GCSStorage) PresignHeadObject

func (s *GCSStorage) PresignHeadObject(ctx context.Context, name string, expire time.Duration) (*url.URL, error)

func (*GCSStorage) PresignPutObject

func (s *GCSStorage) PresignPutObject(ctx context.Context, name string, header http.Header) (*http.Request, error)

type MinIOStorage

type MinIOStorage struct {
	Endpoint        string
	AccessKeyID     string
	SecretAccessKey string
	Bucket          string
	// contains filtered or unexported fields
}

func NewMinIOStorage

func NewMinIOStorage(endpoint string, bucketName string, accessKeyID string, secretAccessKey string) (*MinIOStorage, error)

MinIOStorage takes endpoint, accessKeyID, and secretAccessKey to construct a minio.Client under the hood. Contradictory to minio.Client, endpoint MUST BE a http URL or https URL.

func (*MinIOStorage) MakeDirector

func (s *MinIOStorage) MakeDirector(extractKey func(r *http.Request) string, expire time.Duration) func(r *http.Request)

func (*MinIOStorage) PresignGetObject

func (s *MinIOStorage) PresignGetObject(ctx context.Context, name string, expire time.Duration) (*url.URL, error)

func (*MinIOStorage) PresignHeadObject

func (s *MinIOStorage) PresignHeadObject(ctx context.Context, name string, expire time.Duration) (*url.URL, error)

func (*MinIOStorage) PresignPutObject

func (s *MinIOStorage) PresignPutObject(ctx context.Context, name string, header http.Header) (*http.Request, error)

type S3Storage

type S3Storage struct {
	Bucket          string
	Region          string
	AccessKeyID     string
	SecretAccessKey string
	// contains filtered or unexported fields
}

func NewS3Storage

func NewS3Storage(accessKeyID, secretAccessKey, region, bucket string) (*S3Storage, error)

func (*S3Storage) MakeDirector

func (s *S3Storage) MakeDirector(extractKey func(r *http.Request) string, expire time.Duration) func(r *http.Request)

func (*S3Storage) PresignGetObject

func (s *S3Storage) PresignGetObject(ctx context.Context, name string, expire time.Duration) (*url.URL, error)

func (*S3Storage) PresignHeadObject

func (s *S3Storage) PresignHeadObject(ctx context.Context, name string, expire time.Duration) (*url.URL, error)

func (*S3Storage) PresignPutObject

func (s *S3Storage) PresignPutObject(ctx context.Context, name string, header http.Header) (*http.Request, error)

Jump to

Keyboard shortcuts

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