s3

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package s3 provides a client to make API requests to Amazon Simple Storage Service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseURL added in v1.5.0

func ParseURL(url string) (bucket string, key string, err error)

ParseURL parses S3 object URL and returns the bucket name and the key. For example: https://stackset-myapp-infrastru-pipelinebuiltartifactbuc-1nk5t9zkymh8r.s3-us-west-2.amazonaws.com/scripts/dns-cert-validator/dd2278811c3 returns "stackset-myapp-infrastru-pipelinebuiltartifactbuc-1nk5t9zkymh8r" and "scripts/dns-cert-validator/dd2278811c3"

Types

type CompressAndUploadFunc added in v1.4.0

type CompressAndUploadFunc func(key string, objects ...NamedBinary) (url string, err error)

CompressAndUploadFunc is invoked to zip multiple template contents and upload them to an S3 bucket under the specified key.

type NamedBinary added in v1.4.0

type NamedBinary interface {
	Name() string
	Content() []byte
}

NamedBinary is a named binary to be uploaded.

type S3

type S3 struct {
	// contains filtered or unexported fields
}

S3 wraps an Amazon Simple Storage Service client.

func New

func New(s *session.Session) *S3

New returns an S3 client configured against the input session.

func (*S3) EmptyBucket

func (s *S3) EmptyBucket(bucket string) error

EmptyBucket deletes all objects within the bucket.

func (*S3) PutArtifact

func (s *S3) PutArtifact(bucket, fileName string, data io.Reader) (string, error)

PutArtifact uploads data to a S3 bucket under a random path that ends with the file name and returns its url.

func (*S3) Upload added in v1.9.0

func (s *S3) Upload(bucket, key string, file NamedBinary) (string, error)

Upload uploads a file to an S3 bucket under the specified key.

func (*S3) ZipAndUpload added in v1.4.0

func (s *S3) ZipAndUpload(bucket, key string, files ...NamedBinary) (string, error)

ZipAndUpload zips all files and uploads the zipped file to an S3 bucket under the specified key.

type UploadFunc added in v1.9.0

type UploadFunc func(key string, file NamedBinary) (string, error)

UploadFunc is invoked to upload an item to an S3 bucket under the specified key.

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