file

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	Uploader       Uploader
	CryptoUploader Uploader
	PublicURL      string
	PublicBucket   string

	VaultPath   string
	VaultClient VaultClient
	// contains filtered or unexported fields
}

Store provides file storage via S3.

func NewStore

func NewStore(
	region,
	publicURL,
	publicBucket,
	privateBucket,
	vaultPath string,
	vaultClient VaultClient,
) (*Store, error)

NewStore returns a new store instance for the given AWS region and S3 bucket name.

func (*Store) PutFile

func (store *Store) PutFile(ctx context.Context, reader io.Reader, filename string, isPublished bool) (uploadedFileURL string, err error)

PutFile stores the contents of the given reader to a csv file of given the supplied name.

type Uploader

type Uploader interface {
	Upload(input *s3manager.UploadInput, options ...func(*s3manager.Uploader)) (*s3manager.UploadOutput, error)
	UploadWithPSK(input *s3manager.UploadInput, psk []byte) (*s3manager.UploadOutput, error)
	Session() *session.Session
	BucketName() string
	Checker(ctx context.Context, state *healthcheck.CheckState) error
}

Uploader represents the methods required to upload to s3 with and without encryption

type VaultClient

type VaultClient interface {
	WriteKey(path, key, value string) error
}

VaultClient is an interface to represent methods called to action upon vault

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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