s3client

package
v0.0.0-...-8f1e39b Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DeleteObjectOperation = "delete-object"

DeleteObjectOperation Delete object operation.

View Source
const FileType = "FILE"

FileType File type.

View Source
const FolderType = "FOLDER"

FolderType Folder type.

View Source
const GetObjectOperation = "get-object"

GetObjectOperation Get object operation.

View Source
const HeadObjectOperation = "head-object"

HeadObjectOperation Head object operation.

View Source
const ListObjectsOperation = "list-objects"

ListObjectsOperation List objects operation.

View Source
const PutObjectOperation = "put-object"

PutObjectOperation Put object operation.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound Error not found.

View Source
var ErrNotModified = errors.New("not modified")

ErrNotModified Error not modified.

View Source
var ErrPreconditionFailed = errors.New("precondition failed")

ErrPreconditionFailed Error precondition failed.

Functions

This section is empty.

Types

type Client

type Client interface {
	// ListFilesAndDirectories will list files and directories in S3.
	ListFilesAndDirectories(ctx context.Context, key string) ([]*ListElementOutput, *ResultInfo, error)
	// HeadObject will head a key.
	HeadObject(ctx context.Context, key string) (*HeadOutput, error)
	// GetObject will get an object.
	GetObject(ctx context.Context, input *GetInput) (*GetOutput, *ResultInfo, error)
	// PutObject will put an object.
	PutObject(ctx context.Context, input *PutInput) (*ResultInfo, error)
	// DeleteObject will delete an object.
	DeleteObject(ctx context.Context, key string) (*ResultInfo, error)
	// GetObjectSignedURL will return a signed url for a get object.
	GetObjectSignedURL(ctx context.Context, input *GetInput, expiration time.Duration) (string, error)
}

Client S3 Context interface.

type GetInput

type GetInput struct {
	Key               string
	IfModifiedSince   *time.Time
	IfMatch           string
	IfNoneMatch       string
	IfUnmodifiedSince *time.Time
	Range             string
}

GetInput Input object for get requests.

type GetOutput

type GetOutput struct {
	LastModified       time.Time
	Body               io.ReadCloser
	Metadata           map[string]string
	CacheControl       string
	Expires            string
	ContentDisposition string
	ContentEncoding    string
	ContentLanguage    string
	ContentRange       string
	ContentType        string
	ETag               string
	ContentLength      int64
}

GetOutput Object output for S3 get object.

type HeadOutput

type HeadOutput struct {
	Type string
	Key  string
}

HeadOutput represents output of Head.

type ListElementOutput

type ListElementOutput struct {
	LastModified time.Time
	Type         string
	ETag         string
	Name         string
	Key          string
	Size         int64
}

ListElementOutput Bucket ListElementOutput.

type Manager

type Manager interface {
	// GetClientForTarget will return a S3 client for a target.
	GetClientForTarget(name string) Client
	// Load will load all S3 clients.
	Load() error
}

Manager S3 client manager.

func NewManager

func NewManager(cfgManager config.Manager, metricsCl metrics.Client) Manager

NewManager will return a new S3 client manager.

type PutInput

type PutInput struct {
	Body               io.ReadSeeker
	Metadata           map[string]string
	Expires            *time.Time
	Key                string
	ContentType        string
	StorageClass       string
	CacheControl       string
	ContentDisposition string
	ContentEncoding    string
	ContentLanguage    string
	ContentSize        int64
}

PutInput Put input object for PUT request.

type ResultInfo

type ResultInfo struct {
	Bucket     string
	Key        string
	Region     string
	S3Endpoint string
}

ResultInfo ResultInfo structure.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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