aws

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidChecksumCalculationMode = errors.New("invalid checksum calculation mode")

Functions

This section is empty.

Types

type ChecksumMode added in v1.1.0

type ChecksumMode string
const (
	ChecksumSupported ChecksumMode = "supported"
	ChecksumRequired  ChecksumMode = "required"
)

func (*ChecksumMode) Set added in v1.1.0

func (cm *ChecksumMode) Set(value string) error

func (*ChecksumMode) String added in v1.1.0

func (cm *ChecksumMode) String() string

type Client

type Client struct {
	S3         *S3
	Cloudfront *Cloudfront
}

func NewClient

func NewClient(
	ctx context.Context,
	url, region, accessKey, secretKey string,
	pathStyle bool,
	cm string,
) (*Client, error)

NewClient creates a new S3 client with the provided configuration.

type Cloudfront

type Cloudfront struct {
	Distribution string
	// contains filtered or unexported fields
}

func (*Cloudfront) Invalidate

Invalidate invalidates the specified path in the CloudFront distribution.

type CloudfrontAPIClient

type CloudfrontAPIClient interface {
	CreateInvalidation(ctx context.Context, params *cloudfront.CreateInvalidationInput, optFns ...func(*cloudfront.Options)) (*cloudfront.CreateInvalidationOutput, error)
}

type CloudfrontInvalidateOptions

type CloudfrontInvalidateOptions struct {
	Path string
}

type S3

type S3 struct {
	Bucket string
	DryRun bool
	// contains filtered or unexported fields
}

func (*S3) Delete

func (u *S3) Delete(ctx context.Context, opt S3DeleteOptions) error

Delete removes the specified object from the S3 bucket.

func (*S3) List

func (u *S3) List(ctx context.Context, opt S3ListOptions) ([]string, error)

List retrieves a list of object keys in the S3 bucket under the specified path.

func (*S3) Redirect

func (u *S3) Redirect(ctx context.Context, opt S3RedirectOptions) error

Redirect adds a redirect from the specified path to the specified location in the S3 bucket.

func (*S3) Upload

func (u *S3) Upload(ctx context.Context, opt S3UploadOptions) error

Upload uploads a file to an S3 bucket. It first checks if the file already exists in the bucket and compares the local file's content and metadata with the remote file. If the file has changed, it updates the remote file's metadata. If the file does not exist or has changed, it uploads the local file to the remote bucket.

type S3APIClient

type S3APIClient interface {
	HeadObject(ctx context.Context, params *s3.HeadObjectInput, optFns ...func(*s3.Options)) (*s3.HeadObjectOutput, error)
	PutObject(ctx context.Context, params *s3.PutObjectInput, optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error)
	GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error)
	CopyObject(ctx context.Context, params *s3.CopyObjectInput, optFns ...func(*s3.Options)) (*s3.CopyObjectOutput, error)
	GetObjectAcl(ctx context.Context, params *s3.GetObjectAclInput, optFns ...func(*s3.Options)) (*s3.GetObjectAclOutput, error)
	DeleteObject(ctx context.Context, params *s3.DeleteObjectInput, optFns ...func(*s3.Options)) (*s3.DeleteObjectOutput, error)
	ListObjects(ctx context.Context, params *s3.ListObjectsInput, optFns ...func(*s3.Options)) (*s3.ListObjectsOutput, error)
}

type S3DeleteOptions

type S3DeleteOptions struct {
	RemoteObjectKey string
}

type S3ListOptions

type S3ListOptions struct {
	Path string
}

type S3RedirectOptions

type S3RedirectOptions struct {
	Path     string
	Location string
}

type S3UploadOptions

type S3UploadOptions struct {
	LocalFilePath   string
	RemoteObjectKey string
	ACL             map[string]string
	ContentType     map[string]string
	ContentEncoding map[string]string
	CacheControl    map[string]string
	Metadata        map[string]map[string]string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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