s3

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package s3 provides simplified aws s3 functionality in order to reduce the amount of duplicated s3 code we have across all of our Go projects

Package s3 provides simplified aws s3 functionality in order to reduce the amount of duplicated s3 code we have across all of our Go projects

Index

Constants

View Source
const (
	AwsRequestTimeout     = "RequestTimeout"
	AwsServiceUnavailable = "ServiceUnavailable"
	AwsSlowDown           = "SlowDown"
)

Variables

This section is empty.

Functions

func DefaultConfig

func DefaultConfig() (*aws.Config, error)

func IsTemporary

func IsTemporary(err error) bool

IsTemporary returns true if err is temporary.

func New

func New(options ...func(*client) error) (*client, error)

New produces a new s3 client. The basic usage is as follows:

	s, err := s3.New()

	s, err := s3.New(s3.WithService(s3crypto.NewDecryptionClient())

	cfg, err := external.LoadDefaultAWSConfig(
  	external.WithSharedConfigProfile("exampleProfile"),
	)
	s, err := s3.New(s3.WithConfig(cfg))

func WithConfig

func WithConfig(cfg *aws.Config) func(*client) error

WithConfig allows passing in an already established configuration object

func WithService

func WithService(svc *s3.S3) func(*client) error

WithService allows passing in an already established service object

Types

type Error

type Error interface {
	error
	String() string
	Cause() error
}

Error is the basic s3 error object interface.

type ParameterError

type ParameterError interface {
	Error
	Key() string
	Value() interface{}
}

ParameterError allows type switching to more easily know if Key() and Value() can be called on the error object

type RequestError

type RequestError interface {
	Error
	Temporary() bool
	Url() string
}

RequestError allows type switching to more easily know if Temporary() and Url() can be called on the error object. For now, Temporary() will be set to true if AWS comes back with a "RequestTimeout", "ServiceUnavailable", or "SlowDown" coded error.

Jump to

Keyboard shortcuts

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