s3

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package s3 keeps backups in a bucket of Amazon S3 or of a service that speaks its API (Cloudflare R2, MinIO, Alibaba Cloud OSS, Tencent Cloud COS and others), signing each request with AWS Signature Version 4.

Index

Constants

This section is empty.

Variables

View Source
var ErrEndpoint = errors.New("s3: endpoint must be an http or https URL with a host, with a valid region and bucket")

ErrEndpoint reports an endpoint that is not an http or https URL with a host (and no user info, query or fragment), a bad region or bucket name.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	// Endpoint is "" for AWS (https://s3.<region>.amazonaws.com), else the
	// URL of an S3-compatible service.
	Endpoint string
	// Region is the bucket's region; "" is us-east-1.
	Region string
	Bucket string
	// Prefix is the folder inside the bucket, as "sshyard/"; "" is none.
	Prefix string
	// PathStyle puts the bucket in the path (as MinIO wants) instead of the
	// host name.
	PathStyle bool
	AccessKey string
	SecretKey string
	// HTTP is the client requests go through; nil is backup.Client(nil).
	HTTP *http.Client
	// contains filtered or unexported fields
}

Bucket is a folder of an S3 bucket that keeps backups.

func (*Bucket) Check

func (b *Bucket) Check(ctx context.Context) error

Check lists the prefix, which needs the bucket and the credentials.

func (*Bucket) Delete

func (b *Bucket) Delete(ctx context.Context, name string) error

Delete removes the backup name.

func (*Bucket) Get

func (b *Bucket) Get(ctx context.Context, name string) ([]byte, error)

Get reads the backup name, up to backup.MaxSize.

func (*Bucket) List

func (b *Bucket) List(ctx context.Context) ([]backup.Object, error)

List is the backups right under the prefix, newest first.

func (*Bucket) Put

func (b *Bucket) Put(ctx context.Context, name string, data []byte) error

Put stores data as the backup name.

Jump to

Keyboard shortcuts

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