aws

package
v1.12.3 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package aws provides the core SDK's utilities and shared types. Use this package's utilities to simplify setting and reading API operations parameters.

Value and Pointer Conversion Utilities

This package includes a helper conversion utility for each scalar type the SDK's API use. These utilities make getting a pointer of the scalar, and dereferencing a pointer easier.

Each conversion utility comes in two forms. Value to Pointer and Pointer to Value. The Pointer to value will safely dereference the pointer and return its value. If the pointer was nil, the scalar's zero value will be returned.

The value to pointer functions will be named after the scalar type. So get a *string from a string value use the "String" function. This makes it easy to to get pointer of a literal string value, because getting the address of a literal requires assigning the value to a variable first.

var strPtr *string

// Without the SDK's conversion functions
str := "my string"
strPtr = &str

// With the SDK's conversion functions
strPtr = aws.String("my string")

// Convert *string to string value
str = aws.StringValue(strPtr)

In addition to scalars the aws package also includes conversion utilities for map and slice for commonly types used in API parameters. The map and slice conversion functions use similar naming pattern as the scalar conversion functions.

var strPtrs []*string
var strs []string = []string{"Go", "Gophers", "Go"}

// Convert []string to []*string
strPtrs = aws.StringSlice(strs)

// Convert []*string to []string
strs = aws.StringValueSlice(strPtrs)

SDK Default HTTP Client

The SDK will use the http.DefaultClient if a HTTP client is not provided to the SDK's Session, or service client constructor. This means that if the http.DefaultClient is modified by other components of your application the modifications will be picked up by the SDK as well.

In some cases this might be intended, but it is a better practice to create a custom HTTP Client to share explicitly through your application. You can configure the SDK to use the custom HTTP Client by setting the HTTPClient value of the SDK's Config type when creating a Session or service client.

Package aws provides core functionality for making requests to AWS services.

Index

Constants

View Source
const SDKName = "aws-sdk-go"

SDKName is the name of this AWS SDK

View Source
const SDKVersion = "1.12.3"

SDKVersion is the version of this SDK

View Source
const UseServiceDefaultRetries = -1

UseServiceDefaultRetries instructs the config to use the service's own default number of retries. This will be the default action if Config.MaxRetries is nil also.

Variables

View Source
var (
	// ErrMissingRegion is an error that is returned if region configuration is
	// not found.
	//
	// @readonly
	ErrMissingRegion = awserr.New("MissingRegion", "could not find region configuration", nil)

	// ErrMissingEndpoint is an error that is returned if an endpoint cannot be
	// resolved for a service.
	//
	// @readonly
	ErrMissingEndpoint = awserr.New("MissingEndpoint", "'Endpoint' configuration is required for this service", nil)
)

Functions

func Bool added in v0.7.0

func Bool(v bool) *bool

Bool returns a pointer to the bool value passed in.

func BoolMap added in v0.7.0

func BoolMap(src map[string]bool) map[string]*bool

BoolMap converts a string map of bool values into a string map of bool pointers

func BoolSlice added in v0.7.0

func BoolSlice(src []bool) []*bool

BoolSlice converts a slice of bool values into a slice of bool pointers

func BoolValue added in v0.7.0

func BoolValue(v *bool) bool

BoolValue returns the value of the bool pointer passed in or false if the pointer is nil.

func BoolValueMap added in v0.7.0

func BoolValueMap(src map[string]*bool) map[string]bool

BoolValueMap converts a string map of bool pointers into a string map of bool values

func BoolValueSlice added in v0.7.0

func BoolValueSlice(src []*bool) []bool

BoolValueSlice converts a slice of bool pointers into a slice of bool values

func Float64 added in v0.7.0

func Float64(v float64) *float64

Float64 returns a pointer to the float64 value passed in.

func Float64Map added in v0.7.0

func Float64Map(src map[string]float64) map[string]*float64

Float64Map converts a string map of float64 values into a string map of float64 pointers

func Float64Slice added in v0.7.0

func Float64Slice(src []float64) []*float64

Float64Slice converts a slice of float64 values into a slice of float64 pointers

func Float64Value added in v0.7.0

func Float64Value(v *float64) float64

Float64Value returns the value of the float64 pointer passed in or 0 if the pointer is nil.

func Float64ValueMap added in v0.7.0

func Float64ValueMap(src map[string]*float64) map[string]float64

Float64ValueMap converts a string map of float64 pointers into a string map of float64 values

func Float64ValueSlice added in v0.7.0

func Float64ValueSlice(src []*float64) []float64

Float64ValueSlice converts a slice of float64 pointers into a slice of float64 values

func Int added in v0.7.0

func Int(v int) *int

Int returns a pointer to the int value passed in.

func Int64 added in v0.7.0

func Int64(v int64) *int64

Int64 returns a pointer to the int64 value passed in.

func Int64Map added in v0.7.0

func Int64Map(src map[string]int64) map[string]*int64

Int64Map converts a string map of int64 values into a string map of int64 pointers

func Int64Slice added in v0.7.0

func Int64Slice(src []int64) []*int64

Int64Slice converts a slice of int64 values into a slice of int64 pointers

func Int64Value added in v0.7.0

func Int64Value(v *int64) int64

Int64Value returns the value of the int64 pointer passed in or 0 if the pointer is nil.

func Int64ValueMap added in v0.7.0

func Int64ValueMap(src map[string]*int64) map[string]int64

Int64ValueMap converts a string map of int64 pointers into a string map of int64 values

func Int64ValueSlice added in v0.7.0

func Int64ValueSlice(src []*int64) []int64

Int64ValueSlice converts a slice of int64 pointers into a slice of int64 values

func IntMap added in v0.7.0

func IntMap(src map[string]int) map[string]*int

IntMap converts a string map of int values into a string map of int pointers

func IntSlice added in v0.7.0

func IntSlice(src []int) []*int

IntSlice converts a slice of int values into a slice of int pointers

func IntValue added in v0.7.0

func IntValue(v *int) int

IntValue returns the value of the int pointer passed in or 0 if the pointer is nil.

func IntValueMap added in v0.7.0

func IntValueMap(src map[string]*int) map[string]int

IntValueMap converts a string map of int pointers into a string map of int values

func IntValueSlice added in v0.7.0

func IntValueSlice(src []*int) []int

IntValueSlice converts a slice of int pointers into a slice of int values

func MillisecondsTimeValue added in v1.10.21

func MillisecondsTimeValue(v *int64) time.Time

MillisecondsTimeValue converts an int64 pointer to a time.Time value representing milliseconds sinch Epoch or time.Time{} if the pointer is nil.

func SecondsTimeValue added in v1.10.21

func SecondsTimeValue(v *int64) time.Time

SecondsTimeValue converts an int64 pointer to a time.Time value representing seconds since Epoch or time.Time{} if the pointer is nil.

func SleepWithContext added in v1.8.0

func SleepWithContext(ctx Context, dur time.Duration) error

SleepWithContext will wait for the timer duration to expire, or the context is canceled. Which ever happens first. If the context is canceled the Context's error will be returned.

Expects Context to always return a non-nil error if the Done channel is closed.

func String

func String(v string) *string

String returns a pointer to the string value passed in.

func StringMap added in v0.7.0

func StringMap(src map[string]string) map[string]*string

StringMap converts a string map of string values into a string map of string pointers

func StringSlice added in v0.7.0

func StringSlice(src []string) []*string

StringSlice converts a slice of string values into a slice of string pointers

func StringValue added in v0.7.0

func StringValue(v *string) string

StringValue returns the value of the string pointer passed in or "" if the pointer is nil.

func StringValueMap added in v0.7.0

func StringValueMap(src map[string]*string) map[string]string

StringValueMap converts a string map of string pointers into a string map of string values

func StringValueSlice added in v0.7.0

func StringValueSlice(src []*string) []string

StringValueSlice converts a slice of string pointers into a slice of string values

func Time

func Time(v time.Time) *time.Time

Time returns a pointer to the time.Time value passed in.

func TimeMap added in v0.7.0

func TimeMap(src map[string]time.Time) map[string]*time.Time

TimeMap converts a string map of time.Time values into a string map of time.Time pointers

func TimeSlice added in v0.7.0

func TimeSlice(src []time.Time) []*time.Time

TimeSlice converts a slice of time.Time values into a slice of time.Time pointers

func TimeUnixMilli added in v1.1.27

func TimeUnixMilli(t time.Time) int64

TimeUnixMilli returns a Unix timestamp in milliseconds from "January 1, 1970 UTC". The result is undefined if the Unix time cannot be represented by an int64. Which includes calling TimeUnixMilli on a zero Time is undefined.

This utility is useful for service API's such as CloudWatch Logs which require their unix time values to be in milliseconds.

See Go stdlib https://golang.org/pkg/time/#Time.UnixNano for more information.

func TimeValue added in v0.7.0

func TimeValue(v *time.Time) time.Time

TimeValue returns the value of the time.Time pointer passed in or time.Time{} if the pointer is nil.

func TimeValueMap added in v0.7.0

func TimeValueMap(src map[string]*time.Time) map[string]time.Time

TimeValueMap converts a string map of time.Time pointers into a string map of time.Time values

func TimeValueSlice added in v0.7.0

func TimeValueSlice(src []*time.Time) []time.Time

TimeValueSlice converts a slice of time.Time pointers into a slice of time.Time values

func URLHostname added in v1.8.13

func URLHostname(url *url.URL) string

URLHostname will extract the Hostname without port from the URL value.

Wrapper of net/url#URL.Hostname for backwards Go version compatibility.

Types

type Config

type Config struct {
	// Enables verbose error printing of all credential chain errors.
	// Should be used when wanting to see all errors while attempting to
	// retrieve credentials.
	CredentialsChainVerboseErrors *bool

	// The credentials object to use when signing requests. Defaults to a
	// chain of credential providers to search for credentials in environment
	// variables, shared credential file, and EC2 Instance Roles.
	Credentials *credentials.Credentials

	// An optional endpoint URL (hostname only or fully qualified URI)
	// that overrides the default generated endpoint for a client. Set this
	// to `""` to use the default generated endpoint.
	//
	// @note You must still provide a `Region` value when specifying an
	//   endpoint for a client.
	Endpoint *string

	// The resolver to use for looking up endpoints for AWS service clients
	// to use based on region.
	EndpointResolver endpoints.Resolver

	// EnforceShouldRetryCheck is used in the AfterRetryHandler to always call
	// ShouldRetry regardless of whether or not if request.Retryable is set.
	// This will utilize ShouldRetry method of custom retryers. If EnforceShouldRetryCheck
	// is not set, then ShouldRetry will only be called if request.Retryable is nil.
	// Proper handling of the request.Retryable field is important when setting this field.
	EnforceShouldRetryCheck *bool

	// The region to send requests to. This parameter is required and must
	// be configured globally or on a per-client basis unless otherwise
	// noted. A full list of regions is found in the "Regions and Endpoints"
	// document.
	//
	// @see http://docs.aws.amazon.com/general/latest/gr/rande.html
	//   AWS Regions and Endpoints
	Region *string

	// Set this to `true` to disable SSL when sending requests. Defaults
	// to `false`.
	DisableSSL *bool

	// The HTTP client to use when sending requests. Defaults to
	// `http.DefaultClient`.
	HTTPClient *http.Client

	// An integer value representing the logging level. The default log level
	// is zero (LogOff), which represents no logging. To enable logging set
	// to a LogLevel Value.
	LogLevel *LogLevelType

	// The logger writer interface to write logging messages to. Defaults to
	// standard out.
	Logger Logger

	// The maximum number of times that a request will be retried for failures.
	// Defaults to -1, which defers the max retry setting to the service
	// specific configuration.
	MaxRetries *int

	// Retryer guides how HTTP requests should be retried in case of
	// recoverable failures.
	//
	// When nil or the value does not implement the request.Retryer interface,
	// the client.DefaultRetryer will be used.
	//
	// When both Retryer and MaxRetries are non-nil, the former is used and
	// the latter ignored.
	//
	// To set the Retryer field in a type-safe manner and with chaining, use
	// the request.WithRetryer helper function:
	//
	//   cfg := request.WithRetryer(aws.NewConfig(), myRetryer)
	//
	Retryer RequestRetryer

	// Disables semantic parameter validation, which validates input for
	// missing required fields and/or other semantic request input errors.
	DisableParamValidation *bool

	// Disables the computation of request and response checksums, e.g.,
	// CRC32 checksums in Amazon DynamoDB.
	DisableComputeChecksums *bool

	// Set this to `true` to force the request to use path-style addressing,
	// i.e., `http://s3.amazonaws.com/BUCKET/KEY`. By default, the S3 client
	// will use virtual hosted bucket addressing when possible
	// (`http://BUCKET.s3.amazonaws.com/KEY`).
	//
	// @note This configuration option is specific to the Amazon S3 service.
	// @see http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html
	//   Amazon S3: Virtual Hosting of Buckets
	S3ForcePathStyle *bool

	// Set this to `true` to disable the SDK adding the `Expect: 100-Continue`
	// header to PUT requests over 2MB of content. 100-Continue instructs the
	// HTTP client not to send the body until the service responds with a
	// `continue` status. This is useful to prevent sending the request body
	// until after the request is authenticated, and validated.
	//
	// http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html
	//
	// 100-Continue is only enabled for Go 1.6 and above. See `http.Transport`'s
	// `ExpectContinueTimeout` for information on adjusting the continue wait
	// timeout. https://golang.org/pkg/net/http/#Transport
	//
	// You should use this flag to disble 100-Continue if you experience issues
	// with proxies or third party S3 compatible services.
	S3Disable100Continue *bool

	// Set this to `true` to enable S3 Accelerate feature. For all operations
	// compatible with S3 Accelerate will use the accelerate endpoint for
	// requests. Requests not compatible will fall back to normal S3 requests.
	//
	// The bucket must be enable for accelerate to be used with S3 client with
	// accelerate enabled. If the bucket is not enabled for accelerate an error
	// will be returned. The bucket name must be DNS compatible to also work
	// with accelerate.
	S3UseAccelerate *bool

	// Set this to `true` to disable the EC2Metadata client from overriding the
	// default http.Client's Timeout. This is helpful if you do not want the
	// EC2Metadata client to create a new http.Client. This options is only
	// meaningful if you're not already using a custom HTTP client with the
	// SDK. Enabled by default.
	//
	// Must be set and provided to the session.NewSession() in order to disable
	// the EC2Metadata overriding the timeout for default credentials chain.
	//
	// Example:
	//    sess := session.Must(session.NewSession(aws.NewConfig()
	//       .WithEC2MetadataDiableTimeoutOverride(true)))
	//
	//    svc := s3.New(sess)
	//
	EC2MetadataDisableTimeoutOverride *bool

	// Instructs the endpiont to be generated for a service client to
	// be the dual stack endpoint. The dual stack endpoint will support
	// both IPv4 and IPv6 addressing.
	//
	// Setting this for a service which does not support dual stack will fail
	// to make requets. It is not recommended to set this value on the session
	// as it will apply to all service clients created with the session. Even
	// services which don't support dual stack endpoints.
	//
	// If the Endpoint config value is also provided the UseDualStack flag
	// will be ignored.
	//
	// Only supported with.
	//
	//     sess := session.Must(session.NewSession())
	//
	//     svc := s3.New(sess, &aws.Config{
	//         UseDualStack: aws.Bool(true),
	//     })
	UseDualStack *bool

	// SleepDelay is an override for the func the SDK will call when sleeping
	// during the lifecycle of a request. Specifically this will be used for
	// request delays. This value should only be used for testing. To adjust
	// the delay of a request see the aws/client.DefaultRetryer and
	// aws/request.Retryer.
	//
	// SleepDelay will prevent any Context from being used for canceling retry
	// delay of an API operation. It is recommended to not use SleepDelay at all
	// and specify a Retryer instead.
	SleepDelay func(time.Duration)

	// DisableRestProtocolURICleaning will not clean the URL path when making rest protocol requests.
	// Will default to false. This would only be used for empty directory names in s3 requests.
	//
	// Example:
	//    sess := session.Must(session.NewSession(&aws.Config{
	//         DisableRestProtocolURICleaning: aws.Bool(true),
	//    }))
	//
	//    svc := s3.New(sess)
	//    out, err := svc.GetObject(&s3.GetObjectInput {
	//    	Bucket: aws.String("bucketname"),
	//    	Key: aws.String("//foo//bar//moo"),
	//    })
	DisableRestProtocolURICleaning *bool
}

A Config provides service configuration for service clients. By default, all clients will use the defaults.DefaultConfig tructure.

// Create Session with MaxRetry configuration to be shared by multiple
// service clients.
sess := session.Must(session.NewSession(&aws.Config{
    MaxRetries: aws.Int(3),
}))

// Create S3 service client with a specific Region.
svc := s3.New(sess, &aws.Config{
    Region: aws.String("us-west-2"),
})

func NewConfig added in v0.7.0

func NewConfig() *Config

NewConfig returns a new Config pointer that can be chained with builder methods to set multiple configuration values inline without using pointers.

// Create Session with MaxRetry configuration to be shared by multiple
// service clients.
sess := session.Must(session.NewSession(aws.NewConfig().
    WithMaxRetries(3),
))

// Create S3 service client with a specific Region.
svc := s3.New(sess, aws.NewConfig().
    WithRegion("us-west-2"),
)

func (*Config) Copy

func (c *Config) Copy(cfgs ...*Config) *Config

Copy will return a shallow copy of the Config object. If any additional configurations are provided they will be merged into the new config returned.

func (*Config) MergeIn added in v0.10.0

func (c *Config) MergeIn(cfgs ...*Config)

MergeIn merges the passed in configs into the existing config object.

func (*Config) WithCredentials added in v0.7.0

func (c *Config) WithCredentials(creds *credentials.Credentials) *Config

WithCredentials sets a config Credentials value returning a Config pointer for chaining.

func (*Config) WithCredentialsChainVerboseErrors added in v1.0.10

func (c *Config) WithCredentialsChainVerboseErrors(verboseErrs bool) *Config

WithCredentialsChainVerboseErrors sets a config verbose errors boolean and returning a Config pointer.

func (*Config) WithDisableComputeChecksums added in v0.7.0

func (c *Config) WithDisableComputeChecksums(disable bool) *Config

WithDisableComputeChecksums sets a config DisableComputeChecksums value returning a Config pointer for chaining.

func (*Config) WithDisableParamValidation added in v0.7.0

func (c *Config) WithDisableParamValidation(disable bool) *Config

WithDisableParamValidation sets a config DisableParamValidation value returning a Config pointer for chaining.

func (*Config) WithDisableSSL added in v0.7.0

func (c *Config) WithDisableSSL(disable bool) *Config

WithDisableSSL sets a config DisableSSL value returning a Config pointer for chaining.

func (*Config) WithEC2MetadataDisableTimeoutOverride added in v1.0.10

func (c *Config) WithEC2MetadataDisableTimeoutOverride(enable bool) *Config

WithEC2MetadataDisableTimeoutOverride sets a config EC2MetadataDisableTimeoutOverride value returning a Config pointer for chaining.

func (*Config) WithEndpoint added in v0.7.0

func (c *Config) WithEndpoint(endpoint string) *Config

WithEndpoint sets a config Endpoint value returning a Config pointer for chaining.

func (*Config) WithEndpointResolver added in v1.6.0

func (c *Config) WithEndpointResolver(resolver endpoints.Resolver) *Config

WithEndpointResolver sets a config EndpointResolver value returning a Config pointer for chaining.

func (*Config) WithHTTPClient added in v0.7.0

func (c *Config) WithHTTPClient(client *http.Client) *Config

WithHTTPClient sets a config HTTPClient value returning a Config pointer for chaining.

func (*Config) WithLogLevel added in v0.7.0

func (c *Config) WithLogLevel(level LogLevelType) *Config

WithLogLevel sets a config LogLevel value returning a Config pointer for chaining.

func (*Config) WithLogger added in v0.7.0

func (c *Config) WithLogger(logger Logger) *Config

WithLogger sets a config Logger value returning a Config pointer for chaining.

func (*Config) WithMaxRetries added in v0.7.0

func (c *Config) WithMaxRetries(max int) *Config

WithMaxRetries sets a config MaxRetries value returning a Config pointer for chaining.

func (*Config) WithRegion added in v0.7.0

func (c *Config) WithRegion(region string) *Config

WithRegion sets a config Region value returning a Config pointer for chaining.

func (*Config) WithS3Disable100Continue added in v1.1.16

func (c *Config) WithS3Disable100Continue(disable bool) *Config

WithS3Disable100Continue sets a config S3Disable100Continue value returning a Config pointer for chaining.

func (*Config) WithS3ForcePathStyle added in v0.7.0

func (c *Config) WithS3ForcePathStyle(force bool) *Config

WithS3ForcePathStyle sets a config S3ForcePathStyle value returning a Config pointer for chaining.

func (*Config) WithS3UseAccelerate added in v1.1.21

func (c *Config) WithS3UseAccelerate(enable bool) *Config

WithS3UseAccelerate sets a config S3UseAccelerate value returning a Config pointer for chaining.

func (*Config) WithSleepDelay added in v0.9.5

func (c *Config) WithSleepDelay(fn func(time.Duration)) *Config

WithSleepDelay overrides the function used to sleep while waiting for the next retry. Defaults to time.Sleep.

func (*Config) WithUseDualStack added in v1.4.1

func (c *Config) WithUseDualStack(enable bool) *Config

WithUseDualStack sets a config UseDualStack value returning a Config pointer for chaining.

type Context added in v1.8.0

type Context interface {
	// Deadline returns the time when work done on behalf of this context
	// should be canceled. Deadline returns ok==false when no deadline is
	// set. Successive calls to Deadline return the same results.
	Deadline() (deadline time.Time, ok bool)

	// Done returns a channel that's closed when work done on behalf of this
	// context should be canceled. Done may return nil if this context can
	// never be canceled. Successive calls to Done return the same value.
	Done() <-chan struct{}

	// Err returns a non-nil error value after Done is closed. Err returns
	// Canceled if the context was canceled or DeadlineExceeded if the
	// context's deadline passed. No other values for Err are defined.
	// After Done is closed, successive calls to Err return the same value.
	Err() error

	// Value returns the value associated with this context for key, or nil
	// if no value is associated with key. Successive calls to Value with
	// the same key returns the same result.
	//
	// Use context values only for request-scoped data that transits
	// processes and API boundaries, not for passing optional parameters to
	// functions.
	Value(key interface{}) interface{}
}

Context is an copy of the Go v1.7 stdlib's context.Context interface. It is represented as a SDK interface to enable you to use the "WithContext" API methods with Go v1.6 and a Context type such as golang.org/x/net/context.

See https://golang.org/pkg/context on how to use contexts.

func BackgroundContext added in v1.8.0

func BackgroundContext() Context

BackgroundContext returns a context that will never be canceled, has no values, and no deadline. This context is used by the SDK to provide backwards compatibility with non-context API operations and functionality.

Go 1.6 and before: This context function is equivalent to context.Background in the Go stdlib.

Go 1.7 and later: The context returned will be the value returned by context.Background()

See https://golang.org/pkg/context for more information on Contexts.

type JSONValue added in v1.8.0

type JSONValue map[string]interface{}

JSONValue is a representation of a grab bag type that will be marshaled into a json string. This type can be used just like any other map.

Example:

values := aws.JSONValue{
	"Foo": "Bar",
}
values["Baz"] = "Qux"

type LogLevelType added in v0.7.0

type LogLevelType uint

A LogLevelType defines the level logging should be performed at. Used to instruct the SDK which statements should be logged.

const (
	// LogOff states that no logging should be performed by the SDK. This is the
	// default state of the SDK, and should be use to disable all logging.
	LogOff LogLevelType = iota * 0x1000

	// LogDebug state that debug output should be logged by the SDK. This should
	// be used to inspect request made and responses received.
	LogDebug
)
const (
	// LogDebugWithSigning states that the SDK should log request signing and
	// presigning events. This should be used to log the signing details of
	// requests for debugging. Will also enable LogDebug.
	LogDebugWithSigning LogLevelType = LogDebug | (1 << iota)

	// LogDebugWithHTTPBody states the SDK should log HTTP request and response
	// HTTP bodys in addition to the headers and path. This should be used to
	// see the body content of requests and responses made while using the SDK
	// Will also enable LogDebug.
	LogDebugWithHTTPBody

	// LogDebugWithRequestRetries states the SDK should log when service requests will
	// be retried. This should be used to log when you want to log when service
	// requests are being retried. Will also enable LogDebug.
	LogDebugWithRequestRetries

	// LogDebugWithRequestErrors states the SDK should log when service requests fail
	// to build, send, validate, or unmarshal.
	LogDebugWithRequestErrors
)

Debug Logging Sub Levels

func LogLevel added in v0.7.0

func LogLevel(l LogLevelType) *LogLevelType

LogLevel returns the pointer to a LogLevel. Should be used to workaround not being able to take the address of a non-composite literal.

func (*LogLevelType) AtLeast added in v0.7.0

func (l *LogLevelType) AtLeast(v LogLevelType) bool

AtLeast returns true if this LogLevel is at least high enough to satisfies v. Is safe to use on nil value LogLevelTypes. If LogLevel is nil, will default to LogOff comparison.

func (*LogLevelType) Matches added in v0.7.0

func (l *LogLevelType) Matches(v LogLevelType) bool

Matches returns true if the v LogLevel is enabled by this LogLevel. Should be used with logging sub levels. Is safe to use on nil value LogLevelTypes. If LogLevel is nil, will default to LogOff comparison.

func (*LogLevelType) Value added in v0.7.0

func (l *LogLevelType) Value() LogLevelType

Value returns the LogLevel value or the default value LogOff if the LogLevel is nil. Safe to use on nil value LogLevelTypes.

type Logger added in v0.7.0

type Logger interface {
	Log(...interface{})
}

A Logger is a minimalistic interface for the SDK to log messages to. Should be used to provide custom logging writers for the SDK to use.

func NewDefaultLogger added in v0.7.0

func NewDefaultLogger() Logger

NewDefaultLogger returns a Logger which will write log messages to stdout, and use same formatting runes as the stdlib log.Logger

type LoggerFunc added in v1.1.3

type LoggerFunc func(...interface{})

A LoggerFunc is a convenience type to convert a function taking a variadic list of arguments and wrap it so the Logger interface can be used.

Example:

s3.New(sess, &aws.Config{Logger: aws.LoggerFunc(func(args ...interface{}) {
    fmt.Fprintln(os.Stdout, args...)
})})

func (LoggerFunc) Log added in v1.1.3

func (f LoggerFunc) Log(args ...interface{})

Log calls the wrapped function with the arguments provided

type ReaderSeekerCloser

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

ReaderSeekerCloser represents a reader that can also delegate io.Seeker and io.Closer interfaces to the underlying object if they are available.

func ReadSeekCloser deprecated

func ReadSeekCloser(r io.Reader) ReaderSeekerCloser

ReadSeekCloser wraps a io.Reader returning a ReaderSeekerCloser. Should only be used with an io.Reader that is also an io.Seeker. Doing so may cause request signature errors, or request body's not sent for GET, HEAD and DELETE HTTP methods.

Deprecated: Should only be used with io.ReadSeeker. If using for S3 PutObject to stream content use s3manager.Uploader instead.

func (ReaderSeekerCloser) Close

func (r ReaderSeekerCloser) Close() error

Close closes the ReaderSeekerCloser.

If the ReaderSeekerCloser is not an io.Closer nothing will be done.

func (ReaderSeekerCloser) IsSeeker added in v1.6.3

func (r ReaderSeekerCloser) IsSeeker() bool

IsSeeker returns if the underlying reader is also a seeker.

func (ReaderSeekerCloser) Read

func (r ReaderSeekerCloser) Read(p []byte) (int, error)

Read reads from the reader up to size of p. The number of bytes read, and error if it occurred will be returned.

If the reader is not an io.Reader zero bytes read, and nil error will be returned.

Performs the same functionality as io.Reader Read

func (ReaderSeekerCloser) Seek

func (r ReaderSeekerCloser) Seek(offset int64, whence int) (int64, error)

Seek sets the offset for the next Read to offset, interpreted according to whence: 0 means relative to the origin of the file, 1 means relative to the current offset, and 2 means relative to the end. Seek returns the new offset and an error, if any.

If the ReaderSeekerCloser is not an io.Seeker nothing will be done.

type RequestRetryer added in v1.0.0

type RequestRetryer interface{}

RequestRetryer is an alias for a type that implements the request.Retryer interface.

type WriteAtBuffer added in v0.7.4

type WriteAtBuffer struct {

	// GrowthCoeff defines the growth rate of the internal buffer. By
	// default, the growth rate is 1, where expanding the internal
	// buffer will allocate only enough capacity to fit the new expected
	// length.
	GrowthCoeff float64
	// contains filtered or unexported fields
}

A WriteAtBuffer provides a in memory buffer supporting the io.WriterAt interface Can be used with the s3manager.Downloader to download content to a buffer in memory. Safe to use concurrently.

func NewWriteAtBuffer added in v1.1.15

func NewWriteAtBuffer(buf []byte) *WriteAtBuffer

NewWriteAtBuffer creates a WriteAtBuffer with an internal buffer provided by buf.

func (*WriteAtBuffer) Bytes added in v0.7.4

func (b *WriteAtBuffer) Bytes() []byte

Bytes returns a slice of bytes written to the buffer.

func (*WriteAtBuffer) WriteAt added in v0.7.4

func (b *WriteAtBuffer) WriteAt(p []byte, pos int64) (n int, err error)

WriteAt writes a slice of bytes to a buffer starting at the position provided The number of bytes written will be returned, or error. Can overwrite previous written slices if the write ats overlap.

Directories

Path Synopsis
Package arn provides a parser for interacting with Amazon Resource Names.
Package arn provides a parser for interacting with Amazon Resource Names.
Package awserr represents API error interface accessors for the SDK.
Package awserr represents API error interface accessors for the SDK.
Package credentials provides credential retrieval and management The Credentials is the primary method of getting access to and managing credentials Values.
Package credentials provides credential retrieval and management The Credentials is the primary method of getting access to and managing credentials Values.
endpointcreds
Package endpointcreds provides support for retrieving credentials from an arbitrary HTTP endpoint.
Package endpointcreds provides support for retrieving credentials from an arbitrary HTTP endpoint.
plugincreds
Package plugincreds implements a credentials provider sourced from a Go plugin.
Package plugincreds implements a credentials provider sourced from a Go plugin.
stscreds
Package stscreds are credential Providers to retrieve STS AWS credentials.
Package stscreds are credential Providers to retrieve STS AWS credentials.
Package defaults is a collection of helpers to retrieve the SDK's default configuration and handlers.
Package defaults is a collection of helpers to retrieve the SDK's default configuration and handlers.
Package ec2metadata provides the client for making API calls to the EC2 Metadata service.
Package ec2metadata provides the client for making API calls to the EC2 Metadata service.
Package endpoints provides the types and functionality for defining regions and endpoints, as well as querying those definitions.
Package endpoints provides the types and functionality for defining regions and endpoints, as well as querying those definitions.
Package session provides configuration for the SDK's service clients.
Package session provides configuration for the SDK's service clients.
signer
v4
Package v4 implements signing for AWS V4 signer Provides request signing for request that need to be signed with AWS V4 Signatures.
Package v4 implements signing for AWS V4 signer Provides request signing for request that need to be signed with AWS V4 Signatures.

Jump to

Keyboard shortcuts

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