Overview ▹

Overview ▾

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.

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.

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 files

Internal call graph ▹

Internal call graph ▾

In the call graph viewer below, each node
is a function belonging to this package
and its children are the functions it
calls—perhaps dynamically.

The root nodes are the entry points of the
package: functions that may be called from
outside the package.
There may be non-exported or anonymous
functions among them if they are called
dynamically from another package.

Click a node to visit that function's source code.
From there you can visit its callers by
clicking its declaring func
token.

Functions may be omitted if they were
determined to be unreachable in the
particular programs or tests that were
analyzed.

Constants

SDKName is the name of this AWS SDK

const SDKName = "aws-sdk-go"

SDKVersion is the version of this SDK

const SDKVersion = "1.8.44"

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.

const UseServiceDefaultRetries = -1

Variables

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)
)

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.

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 request.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
}

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.

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{}
}

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()

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

type LogLevelType uint

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
)

Debug Logging Sub Levels

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
)

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 nill, will default to LogOff comparison.

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.

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.