s3manager

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package s3manager implements the various functions needed to store and retrieve files from an S3 API compatible endpoint (AWS S3, Minio, etc)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionDetails

type ConnectionDetails struct {
	Endpoint        string
	UseSSL          bool
	AccessKeyID     string
	SecretAccessKey string
	Bucket          string
	Location        string
	CA              []byte
}

func GetConnectionDetails

func GetConnectionDetails(ctx context.Context, cluster *kubernetes.Cluster, secretNamespace, secretName string) (ConnectionDetails, error)

GetConnectionDetails retrieves s3 details from an ini file stored in a secret. Note: The CLI tool in the staging job will use the ini file directly.

func (*ConnectionDetails) Validate

func (details *ConnectionDetails) Validate() error

Validate makes sure the provided S3 settings are valid The user should provide all the mandatory settings or no settings at all.

type Manager

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

func New

func New(connectionDetails ConnectionDetails) (*Manager, error)

New returns an instance of an s3 manager

func (*Manager) DeleteObject

func (m *Manager) DeleteObject(ctx context.Context, objectID string) error

DeleteObject deletes the specified object from the storage

func (*Manager) EnsureBucket

func (m *Manager) EnsureBucket(ctx context.Context) error

EnsureBucket creates our bucket if it's missing

func (*Manager) Meta added in v0.3.0

func (m *Manager) Meta(ctx context.Context, blobUID string) (map[string]string, error)

Meta retrieves the meta data for the blob specified by it blobUID.

func (*Manager) Upload

func (m *Manager) Upload(ctx context.Context, filepath string, metadata map[string]string) (string, error)

Upload uploads the given file to the S3 endpoint and returns a blobUID which can later be used to fetch the same file.

func (*Manager) UploadStream added in v0.3.6

func (m *Manager) UploadStream(ctx context.Context, file io.Reader, size int64, metadata map[string]string) (string, error)

UploadStream uploads the given Reader to the S3 endpoint and returns a blobUID which can later be used to fetch the same file.

Jump to

Keyboard shortcuts

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