s3upload

package
v1.233.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package s3upload uploads local files without deleting remote objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseDestination

func ParseDestination(destination string) (string, string, error)

ParseDestination validates an S3 URI without interpreting keys as filesystem paths.

func UploadReader

func UploadReader(ctx context.Context, client Client, reader io.ReadSeeker, size int64, opts Options) (bool, error)

UploadReader compares an object before uploading a repeatable stream.

Types

type Client

type Client interface {
	HeadObject(context.Context, *s3.HeadObjectInput, ...func(*s3.Options)) (*s3.HeadObjectOutput, error)
	PutObject(context.Context, *s3.PutObjectInput, ...func(*s3.Options)) (*s3.PutObjectOutput, error)
}

Client is the S3 API needed to compare and upload objects.

func NewClient

func NewClient(ctx context.Context, region string, authContext *schema.AWSAuthContext, env map[string]string) (Client, error)

NewClient resolves isolated AWS credentials and endpoints without changing the process environment.

type Options

type Options struct {
	Source       string
	Destination  string
	ContentType  string
	CacheControl string
}

Options selects local content and a bucket/key or bucket/prefix destination.

type Result

type Result struct {
	URIs      []string
	Uploaded  int
	Unchanged int
}

Result includes every destination, including objects already up to date.

func Upload

func Upload(ctx context.Context, client Client, opts Options) (Result, error)

Upload compares SHA-256, size, and delivery headers before streaming changed files. It never creates buckets, deletes objects, or rewrites template references.

Jump to

Keyboard shortcuts

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