actions

package
v0.0.0-...-672744a Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketBasics

type BucketBasics struct {
	S3Client *s3.Client
}

BucketBasics encapsulates the Amazon Simple Storage Service (Amazon S3) actions used in the examples. It contains S3Client, an Amazon S3 service client that is used to perform bucket and object actions.

func (BucketBasics) BucketExists

func (basics BucketBasics) BucketExists(bucketName string) (bool, error)

BucketExists checks whether a bucket exists in the current account.

func (BucketBasics) CopyToBucket

func (basics BucketBasics) CopyToBucket(sourceBucket string, destinationBucket string, objectKey string) error

CopyToBucket copies an object in a bucket to another bucket.

func (BucketBasics) CopyToFolder

func (basics BucketBasics) CopyToFolder(bucketName string, objectKey string, folderName string) error

CopyToFolder copies an object in a bucket to a subfolder in the same bucket.

func (BucketBasics) CreateBucket

func (basics BucketBasics) CreateBucket(name string, region string) error

CreateBucket creates a bucket with the specified name in the specified Region.

func (BucketBasics) DeleteBucket

func (basics BucketBasics) DeleteBucket(bucketName string) error

DeleteBucket deletes a bucket. The bucket must be empty or an error is returned.

func (BucketBasics) DeleteObjects

func (basics BucketBasics) DeleteObjects(bucketName string, objectKeys []string) error

DeleteObjects deletes a list of objects from a bucket.

func (BucketBasics) DownloadFile

func (basics BucketBasics) DownloadFile(bucketName string, objectKey string, fileName string) error

DownloadFile gets an object from a bucket and stores it in a local file.

func (BucketBasics) DownloadLargeObject

func (basics BucketBasics) DownloadLargeObject(bucketName string, objectKey string) ([]byte, error)

DownloadLargeObject uses a download manager to download an object from a bucket. The download manager gets the data in parts and writes them to a buffer until all of the data has been downloaded.

func (BucketBasics) ListBuckets

func (basics BucketBasics) ListBuckets() ([]types.Bucket, error)

ListBuckets lists the buckets in the current account.

func (BucketBasics) ListObjects

func (basics BucketBasics) ListObjects(bucketName string) ([]types.Object, error)

ListObjects lists the objects in a bucket.

func (BucketBasics) UploadFile

func (basics BucketBasics) UploadFile(bucketName string, objectKey string, fileName string) error

UploadFile reads from a file and puts the data into an object in a bucket.

func (BucketBasics) UploadLargeObject

func (basics BucketBasics) UploadLargeObject(bucketName string, objectKey string, largeObject []byte) error

UploadLargeObject uses an upload manager to upload data to an object in a bucket. The upload manager breaks large data into parts and uploads the parts concurrently.

type Presigner

type Presigner struct {
	PresignClient *s3.PresignClient
}

Presigner encapsulates the Amazon Simple Storage Service (Amazon S3) presign actions used in the examples. It contains PresignClient, a client that is used to presign requests to Amazon S3. Presigned requests contain temporary credentials and can be made from any HTTP client.

func (Presigner) DeleteObject

func (presigner Presigner) DeleteObject(bucketName string, objectKey string) (*v4.PresignedHTTPRequest, error)

DeleteObject makes a presigned request that can be used to delete an object from a bucket.

func (Presigner) GetObject

func (presigner Presigner) GetObject(
	bucketName string, objectKey string, lifetimeSecs int64) (*v4.PresignedHTTPRequest, error)

GetObject makes a presigned request that can be used to get an object from a bucket. The presigned request is valid for the specified number of seconds.

func (Presigner) PutObject

func (presigner Presigner) PutObject(
	bucketName string, objectKey string, lifetimeSecs int64) (*v4.PresignedHTTPRequest, error)

PutObject makes a presigned request that can be used to put an object in a bucket. The presigned request is valid for the specified number of seconds.

Jump to

Keyboard shortcuts

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