package aws
import "github.com/aws/aws-sdk-go-v2/aws"
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.
Code generated by aws/generate.go DO NOT EDIT.
Code generated by aws/generate.go DO NOT EDIT.
Package aws provides core functionality for making requests to AWS services.
Index ¶
- Constants
- Variables
- func Bool(v bool) *bool
- func BoolMap(vs map[string]bool) map[string]*bool
- func BoolSlice(vs []bool) []*bool
- func Byte(v byte) *byte
- func ByteMap(vs map[string]byte) map[string]*byte
- func ByteSlice(vs []byte) []*byte
- func Float32(v float32) *float32
- func Float32Map(vs map[string]float32) map[string]*float32
- func Float32Slice(vs []float32) []*float32
- func Float64(v float64) *float64
- func Float64Map(vs map[string]float64) map[string]*float64
- func Float64Slice(vs []float64) []*float64
- func Int(v int) *int
- func Int16(v int16) *int16
- func Int16Map(vs map[string]int16) map[string]*int16
- func Int16Slice(vs []int16) []*int16
- func Int32(v int32) *int32
- func Int32Map(vs map[string]int32) map[string]*int32
- func Int32Slice(vs []int32) []*int32
- func Int64(v int64) *int64
- func Int64Map(vs map[string]int64) map[string]*int64
- func Int64Slice(vs []int64) []*int64
- func Int8(v int8) *int8
- func Int8Map(vs map[string]int8) map[string]*int8
- func Int8Slice(vs []int8) []*int8
- func IntMap(vs map[string]int) map[string]*int
- func IntSlice(vs []int) []*int
- func IsReaderSeekable(r io.Reader) bool
- func SeekerLen(s io.Seeker) (int64, error)
- func String(v string) *string
- func StringMap(vs map[string]string) map[string]*string
- func StringSlice(vs []string) []*string
- func Time(v time.Time) *time.Time
- func TimeMap(vs map[string]time.Time) map[string]*time.Time
- func TimeSlice(vs []time.Time) []*time.Time
- func ToBool(p *bool) (v bool)
- func ToBoolMap(vs map[string]*bool) map[string]bool
- func ToBoolSlice(vs []*bool) []bool
- func ToByte(p *byte) (v byte)
- func ToByteMap(vs map[string]*byte) map[string]byte
- func ToByteSlice(vs []*byte) []byte
- func ToFloat32(p *float32) (v float32)
- func ToFloat32Map(vs map[string]*float32) map[string]float32
- func ToFloat32Slice(vs []*float32) []float32
- func ToFloat64(p *float64) (v float64)
- func ToFloat64Map(vs map[string]*float64) map[string]float64
- func ToFloat64Slice(vs []*float64) []float64
- func ToInt(p *int) (v int)
- func ToInt16(p *int16) (v int16)
- func ToInt16Map(vs map[string]*int16) map[string]int16
- func ToInt16Slice(vs []*int16) []int16
- func ToInt32(p *int32) (v int32)
- func ToInt32Map(vs map[string]*int32) map[string]int32
- func ToInt32Slice(vs []*int32) []int32
- func ToInt64(p *int64) (v int64)
- func ToInt64Map(vs map[string]*int64) map[string]int64
- func ToInt64Slice(vs []*int64) []int64
- func ToInt8(p *int8) (v int8)
- func ToInt8Map(vs map[string]*int8) map[string]int8
- func ToInt8Slice(vs []*int8) []int8
- func ToIntMap(vs map[string]*int) map[string]int
- func ToIntSlice(vs []*int) []int
- func ToString(p *string) (v string)
- func ToStringMap(vs map[string]*string) map[string]string
- func ToStringSlice(vs []*string) []string
- func ToTime(p *time.Time) (v time.Time)
- func ToTimeMap(vs map[string]*time.Time) map[string]time.Time
- func ToTimeSlice(vs []*time.Time) []time.Time
- func ToUint(p *uint) (v uint)
- func ToUint16(p *uint16) (v uint16)
- func ToUint16Map(vs map[string]*uint16) map[string]uint16
- func ToUint16Slice(vs []*uint16) []uint16
- func ToUint32(p *uint32) (v uint32)
- func ToUint32Map(vs map[string]*uint32) map[string]uint32
- func ToUint32Slice(vs []*uint32) []uint32
- func ToUint64(p *uint64) (v uint64)
- func ToUint64Map(vs map[string]*uint64) map[string]uint64
- func ToUint64Slice(vs []*uint64) []uint64
- func ToUint8(p *uint8) (v uint8)
- func ToUint8Map(vs map[string]*uint8) map[string]uint8
- func ToUint8Slice(vs []*uint8) []uint8
- func ToUintMap(vs map[string]*uint) map[string]uint
- func ToUintSlice(vs []*uint) []uint
- func Uint(v uint) *uint
- func Uint16(v uint16) *uint16
- func Uint16Map(vs map[string]uint16) map[string]*uint16
- func Uint16Slice(vs []uint16) []*uint16
- func Uint32(v uint32) *uint32
- func Uint32Map(vs map[string]uint32) map[string]*uint32
- func Uint32Slice(vs []uint32) []*uint32
- func Uint64(v uint64) *uint64
- func Uint64Map(vs map[string]uint64) map[string]*uint64
- func Uint64Slice(vs []uint64) []*uint64
- func Uint8(v uint8) *uint8
- func Uint8Map(vs map[string]uint8) map[string]*uint8
- func Uint8Slice(vs []uint8) []*uint8
- func UintMap(vs map[string]uint) map[string]*uint
- func UintSlice(vs []uint) []*uint
- type AnonymousCredentials
- type BuildableHTTPClient
- func NewBuildableHTTPClient() *BuildableHTTPClient
- func (b *BuildableHTTPClient) Do(req *http.Request) (*http.Response, error)
- func (b *BuildableHTTPClient) GetDialer() *net.Dialer
- func (b *BuildableHTTPClient) GetTimeout() time.Duration
- func (b *BuildableHTTPClient) GetTransport() *http.Transport
- func (b *BuildableHTTPClient) WithDialerOptions(opts ...func(*net.Dialer)) HTTPClient
- func (b *BuildableHTTPClient) WithTimeout(timeout time.Duration) HTTPClient
- func (b *BuildableHTTPClient) WithTransportOptions(opts ...func(*http.Transport)) HTTPClient
- type Config
- type Credentials
- type CredentialsCache
- func (p *CredentialsCache) Invalidate()
- func (p *CredentialsCache) Retrieve(ctx context.Context) (Credentials, error)
- type CredentialsProvider
- type CredentialsProviderFunc
- type Endpoint
- type EndpointNotFoundError
- type EndpointResolver
- type EndpointResolverFunc
- type HTTPClient
- type MissingEndpointError
- type MissingRegionError
- type NoOpRetryer
- func (NoOpRetryer) GetInitialToken() func(error) error
- func (NoOpRetryer) GetRetryToken(context.Context, error) (func(error) error, error)
- func (NoOpRetryer) IsErrorRetryable(error) bool
- func (NoOpRetryer) MaxAttempts() int
- func (NoOpRetryer) RetryDelay(int, error) (time.Duration, error)
- type ReaderSeekerCloser
- func ReadSeekCloser(r io.Reader) ReaderSeekerCloser
- func (r ReaderSeekerCloser) Close() error
- func (r ReaderSeekerCloser) GetLen() (int64, error)
- func (r ReaderSeekerCloser) HasLen() (int, bool)
- func (r ReaderSeekerCloser) IsSeeker() bool
- func (r ReaderSeekerCloser) Read(p []byte) (int, error)
- func (r ReaderSeekerCloser) Seek(offset int64, whence int) (int64, error)
- type RequestCanceledError
- func (*RequestCanceledError) CanceledError() bool
- func (e *RequestCanceledError) Error() string
- func (e *RequestCanceledError) Unwrap() error
- type ResponseTimeoutError
- type Retryer
- type Ternary
- type WriteAtBuffer
Constants ¶
const SDKName = "aws-sdk-go"
SDKName is the name of this AWS SDK
const SDKVersion = "0.25.0"
SDKVersion is the version of this SDK
Variables ¶
var ( DefaultHTTPTransportMaxIdleConns = 100 DefaultHTTPTransportMaxIdleConnsPerHost = 10 DefaultHTTPTransportIdleConnTimeout = 90 * time.Second DefaultHTTPTransportTLSHandleshakeTimeout = 10 * time.Second DefaultHTTPTransportExpectContinueTimeout = 1 * time.Second )
Defaults for the HTTPTransportBuilder.
Timeouts for net.Dialer's network connection.
Functions ¶
func Bool ¶
Bool returns a pointer value for the bool value passed in.
func BoolMap ¶
BoolMap returns a map of bool pointers from the values passed in.
func BoolSlice ¶
BoolSlice returns a slice of bool pointers from the values passed in.
func Byte ¶
Byte returns a pointer value for the byte value passed in.
func ByteMap ¶
ByteMap returns a map of byte pointers from the values passed in.
func ByteSlice ¶
ByteSlice returns a slice of byte pointers from the values passed in.
func Float32 ¶
Float32 returns a pointer value for the float32 value passed in.
func Float32Map ¶
Float32Map returns a map of float32 pointers from the values passed in.
func Float32Slice ¶
Float32Slice returns a slice of float32 pointers from the values passed in.
func Float64 ¶
Float64 returns a pointer value for the float64 value passed in.
func Float64Map ¶
Float64Map returns a map of float64 pointers from the values passed in.
func Float64Slice ¶
Float64Slice returns a slice of float64 pointers from the values passed in.
func Int ¶
Int returns a pointer value for the int value passed in.
func Int16 ¶
Int16 returns a pointer value for the int16 value passed in.
func Int16Map ¶
Int16Map returns a map of int16 pointers from the values passed in.
func Int16Slice ¶
Int16Slice returns a slice of int16 pointers from the values passed in.
func Int32 ¶
Int32 returns a pointer value for the int32 value passed in.
func Int32Map ¶
Int32Map returns a map of int32 pointers from the values passed in.
func Int32Slice ¶
Int32Slice returns a slice of int32 pointers from the values passed in.
func Int64 ¶
Int64 returns a pointer value for the int64 value passed in.
func Int64Map ¶
Int64Map returns a map of int64 pointers from the values passed in.
func Int64Slice ¶
Int64Slice returns a slice of int64 pointers from the values passed in.
func Int8 ¶
Int8 returns a pointer value for the int8 value passed in.
func Int8Map ¶
Int8Map returns a map of int8 pointers from the values passed in.
func Int8Slice ¶
Int8Slice returns a slice of int8 pointers from the values passed in.
func IntMap ¶
IntMap returns a map of int pointers from the values passed in.
func IntSlice ¶
IntSlice returns a slice of int pointers from the values passed in.
func IsReaderSeekable ¶
IsReaderSeekable returns if the underlying reader type can be seeked. A io.Reader might not actually be seekable if it is the ReaderSeekerCloser type.
func SeekerLen ¶
SeekerLen attempts to get the number of bytes remaining at the seeker's current position. Returns the number of bytes remaining or error.
func String ¶
String returns a pointer value for the string value passed in.
func StringMap ¶
StringMap returns a map of string pointers from the values passed in.
func StringSlice ¶
StringSlice returns a slice of string pointers from the values passed in.
func Time ¶
Time returns a pointer value for the time.Time value passed in.
func TimeMap ¶
TimeMap returns a map of time.Time pointers from the values passed in.
func TimeSlice ¶
TimeSlice returns a slice of time.Time pointers from the values passed in.
func ToBool ¶
ToBool returns bool value dereferenced if the passed in pointer was not nil. Returns a bool zero value if the pointer was nil.
func ToBoolMap ¶
ToBoolMap returns a map of bool values, that are dereferenced if the passed in pointer was not nil. The bool zero value is used if the pointer was nil.
func ToBoolSlice ¶
ToBoolSlice returns a slice of bool values, that are dereferenced if the passed in pointer was not nil. Returns a bool zero value if the pointer was nil.
func ToByte ¶
ToByte returns byte value dereferenced if the passed in pointer was not nil. Returns a byte zero value if the pointer was nil.
func ToByteMap ¶
ToByteMap returns a map of byte values, that are dereferenced if the passed in pointer was not nil. The byte zero value is used if the pointer was nil.
func ToByteSlice ¶
ToByteSlice returns a slice of byte values, that are dereferenced if the passed in pointer was not nil. Returns a byte zero value if the pointer was nil.
func ToFloat32 ¶
ToFloat32 returns float32 value dereferenced if the passed in pointer was not nil. Returns a float32 zero value if the pointer was nil.
func ToFloat32Map ¶
ToFloat32Map returns a map of float32 values, that are dereferenced if the passed in pointer was not nil. The float32 zero value is used if the pointer was nil.
func ToFloat32Slice ¶
ToFloat32Slice returns a slice of float32 values, that are dereferenced if the passed in pointer was not nil. Returns a float32 zero value if the pointer was nil.
func ToFloat64 ¶
ToFloat64 returns float64 value dereferenced if the passed in pointer was not nil. Returns a float64 zero value if the pointer was nil.
func ToFloat64Map ¶
ToFloat64Map returns a map of float64 values, that are dereferenced if the passed in pointer was not nil. The float64 zero value is used if the pointer was nil.
func ToFloat64Slice ¶
ToFloat64Slice returns a slice of float64 values, that are dereferenced if the passed in pointer was not nil. Returns a float64 zero value if the pointer was nil.
func ToInt ¶
ToInt returns int value dereferenced if the passed in pointer was not nil. Returns a int zero value if the pointer was nil.
func ToInt16 ¶
ToInt16 returns int16 value dereferenced if the passed in pointer was not nil. Returns a int16 zero value if the pointer was nil.
func ToInt16Map ¶
ToInt16Map returns a map of int16 values, that are dereferenced if the passed in pointer was not nil. The int16 zero value is used if the pointer was nil.
func ToInt16Slice ¶
ToInt16Slice returns a slice of int16 values, that are dereferenced if the passed in pointer was not nil. Returns a int16 zero value if the pointer was nil.
func ToInt32 ¶
ToInt32 returns int32 value dereferenced if the passed in pointer was not nil. Returns a int32 zero value if the pointer was nil.
func ToInt32Map ¶
ToInt32Map returns a map of int32 values, that are dereferenced if the passed in pointer was not nil. The int32 zero value is used if the pointer was nil.
func ToInt32Slice ¶
ToInt32Slice returns a slice of int32 values, that are dereferenced if the passed in pointer was not nil. Returns a int32 zero value if the pointer was nil.
func ToInt64 ¶
ToInt64 returns int64 value dereferenced if the passed in pointer was not nil. Returns a int64 zero value if the pointer was nil.
func ToInt64Map ¶
ToInt64Map returns a map of int64 values, that are dereferenced if the passed in pointer was not nil. The int64 zero value is used if the pointer was nil.
func ToInt64Slice ¶
ToInt64Slice returns a slice of int64 values, that are dereferenced if the passed in pointer was not nil. Returns a int64 zero value if the pointer was nil.
func ToInt8 ¶
ToInt8 returns int8 value dereferenced if the passed in pointer was not nil. Returns a int8 zero value if the pointer was nil.
func ToInt8Map ¶
ToInt8Map returns a map of int8 values, that are dereferenced if the passed in pointer was not nil. The int8 zero value is used if the pointer was nil.
func ToInt8Slice ¶
ToInt8Slice returns a slice of int8 values, that are dereferenced if the passed in pointer was not nil. Returns a int8 zero value if the pointer was nil.
func ToIntMap ¶
ToIntMap returns a map of int values, that are dereferenced if the passed in pointer was not nil. The int zero value is used if the pointer was nil.
func ToIntSlice ¶
ToIntSlice returns a slice of int values, that are dereferenced if the passed in pointer was not nil. Returns a int zero value if the pointer was nil.
func ToString ¶
ToString returns string value dereferenced if the passed in pointer was not nil. Returns a string zero value if the pointer was nil.
func ToStringMap ¶
ToStringMap returns a map of string values, that are dereferenced if the passed in pointer was not nil. The string zero value is used if the pointer was nil.
func ToStringSlice ¶
ToStringSlice returns a slice of string values, that are dereferenced if the passed in pointer was not nil. Returns a string zero value if the pointer was nil.
func ToTime ¶
ToTime returns time.Time value dereferenced if the passed in pointer was not nil. Returns a time.Time zero value if the pointer was nil.
func ToTimeMap ¶
ToTimeMap returns a map of time.Time values, that are dereferenced if the passed in pointer was not nil. The time.Time zero value is used if the pointer was nil.
func ToTimeSlice ¶
ToTimeSlice returns a slice of time.Time values, that are dereferenced if the passed in pointer was not nil. Returns a time.Time zero value if the pointer was nil.
func ToUint ¶
ToUint returns uint value dereferenced if the passed in pointer was not nil. Returns a uint zero value if the pointer was nil.
func ToUint16 ¶
ToUint16 returns uint16 value dereferenced if the passed in pointer was not nil. Returns a uint16 zero value if the pointer was nil.
func ToUint16Map ¶
ToUint16Map returns a map of uint16 values, that are dereferenced if the passed in pointer was not nil. The uint16 zero value is used if the pointer was nil.
func ToUint16Slice ¶
ToUint16Slice returns a slice of uint16 values, that are dereferenced if the passed in pointer was not nil. Returns a uint16 zero value if the pointer was nil.
func ToUint32 ¶
ToUint32 returns uint32 value dereferenced if the passed in pointer was not nil. Returns a uint32 zero value if the pointer was nil.
func ToUint32Map ¶
ToUint32Map returns a map of uint32 values, that are dereferenced if the passed in pointer was not nil. The uint32 zero value is used if the pointer was nil.
func ToUint32Slice ¶
ToUint32Slice returns a slice of uint32 values, that are dereferenced if the passed in pointer was not nil. Returns a uint32 zero value if the pointer was nil.
func ToUint64 ¶
ToUint64 returns uint64 value dereferenced if the passed in pointer was not nil. Returns a uint64 zero value if the pointer was nil.
func ToUint64Map ¶
ToUint64Map returns a map of uint64 values, that are dereferenced if the passed in pointer was not nil. The uint64 zero value is used if the pointer was nil.
func ToUint64Slice ¶
ToUint64Slice returns a slice of uint64 values, that are dereferenced if the passed in pointer was not nil. Returns a uint64 zero value if the pointer was nil.
func ToUint8 ¶
ToUint8 returns uint8 value dereferenced if the passed in pointer was not nil. Returns a uint8 zero value if the pointer was nil.
func ToUint8Map ¶
ToUint8Map returns a map of uint8 values, that are dereferenced if the passed in pointer was not nil. The uint8 zero value is used if the pointer was nil.
func ToUint8Slice ¶
ToUint8Slice returns a slice of uint8 values, that are dereferenced if the passed in pointer was not nil. Returns a uint8 zero value if the pointer was nil.
func ToUintMap ¶
ToUintMap returns a map of uint values, that are dereferenced if the passed in pointer was not nil. The uint zero value is used if the pointer was nil.
func ToUintSlice ¶
ToUintSlice returns a slice of uint values, that are dereferenced if the passed in pointer was not nil. Returns a uint zero value if the pointer was nil.
func Uint ¶
Uint returns a pointer value for the uint value passed in.
func Uint16 ¶
Uint16 returns a pointer value for the uint16 value passed in.
func Uint16Map ¶
Uint16Map returns a map of uint16 pointers from the values passed in.
func Uint16Slice ¶
Uint16Slice returns a slice of uint16 pointers from the values passed in.
func Uint32 ¶
Uint32 returns a pointer value for the uint32 value passed in.
func Uint32Map ¶
Uint32Map returns a map of uint32 pointers from the values passed in.
func Uint32Slice ¶
Uint32Slice returns a slice of uint32 pointers from the values passed in.
func Uint64 ¶
Uint64 returns a pointer value for the uint64 value passed in.
func Uint64Map ¶
Uint64Map returns a map of uint64 pointers from the values passed in.
func Uint64Slice ¶
Uint64Slice returns a slice of uint64 pointers from the values passed in.
func Uint8 ¶
Uint8 returns a pointer value for the uint8 value passed in.
func Uint8Map ¶
Uint8Map returns a map of uint8 pointers from the values passed in.
func Uint8Slice ¶
Uint8Slice returns a slice of uint8 pointers from the values passed in.
func UintMap ¶
UintMap returns a map of uint pointers from the values passed in.
func UintSlice ¶
UintSlice returns a slice of uint pointers from the values passed in.
Types ¶
type AnonymousCredentials ¶
type AnonymousCredentials struct{}
AnonymousCredentials provides a sentinel CredentialsProvider that should be used to instruct the SDK's signing middleware to not sign the request.
Using `nil` credentials when configuring an API client will achieve the same result. The AnonymousCredentials type allows you to configure the SDK's external config loading to not attempt to source credentials from the shared config or environment.
For example you can use this CredentialsProvider with an API client's Options to instruct the client not to sign a request for accessing public S3 bucket objects.
The following example demonstrates using the AnonymousCredentials to prevent SDK's external config loading attempt to resolve credentials.
cfg, err := config.LoadDefaultConfig( config.WithCredentialsProvider(aws.AnonymousCredentials{})) if err != nil { log.Fatalf("failed to load config, %v", err) } client := s3.NewFromConfig(cfg)
Alternatively you can leave the API client Option's `Credential` member to nil. If using the `NewFromConfig` constructor you'll need to explicitly set the `Credentials` member to nil, if the external config resolved a credential provider.
client := s3.New(s3.Options{ // Credentials defaults to a nil value. })
This can also be configured for specific operations calls too.
cfg, err := config.LoadDefaultConfig() if err != nil { log.Fatalf("failed to load config, %v", err) } client := s3.NewFromConfig(config) result, err := client.GetObject(context.TODO(), s3.GetObject{ Bucket: aws.String("example-bucket"), Key: aws.String("example-key"), }, func(o *s3.Options) { o.Credentials = nil // Or o.Credentials = aws.AnonymousCredentials{} })
func (AnonymousCredentials) Retrieve ¶
func (AnonymousCredentials) Retrieve(context.Context) (Credentials, error)
Retrieve implements the CredentialsProvider interface, but will always return error, and cannot be used to sign a request. The AnonymousCredentials type is used as a sentinel type instructing the AWS request signing middleware to not sign a request.
type BuildableHTTPClient ¶
type BuildableHTTPClient struct {
// contains filtered or unexported fields
}
BuildableHTTPClient provides a HTTPClient implementation with options to create copies of the HTTPClient when additional configuration is provided.
The client's methods will not share the http.Transport value between copies of the BuildableHTTPClient. Only exported member values of the Transport and optional Dialer will be copied between copies of BuildableHTTPClient.
func NewBuildableHTTPClient ¶
func NewBuildableHTTPClient() *BuildableHTTPClient
NewBuildableHTTPClient returns an initialized client for invoking HTTP requests.
func (*BuildableHTTPClient) Do ¶
Do implements the HTTPClient interface's Do method to invoke a HTTP request, and receive the response. Uses the BuildableHTTPClient's current configuration to invoke the http.Request.
If connection pooling is enabled (aka HTTP KeepAlive) the client will only share pooled connections with its own instance. Copies of the BuildableHTTPClient will have their own connection pools.
Redirect (3xx) responses will not be followed, the HTTP response received will returned instead.
func (*BuildableHTTPClient) GetDialer ¶
func (b *BuildableHTTPClient) GetDialer() *net.Dialer
GetDialer returns a copy of the client's network dialer.
func (*BuildableHTTPClient) GetTimeout ¶
func (b *BuildableHTTPClient) GetTimeout() time.Duration
GetTimeout returns a copy of the client's timeout to cancel requests with.
func (*BuildableHTTPClient) GetTransport ¶
func (b *BuildableHTTPClient) GetTransport() *http.Transport
GetTransport returns a copy of the client's HTTP Transport.
func (*BuildableHTTPClient) WithDialerOptions ¶
func (b *BuildableHTTPClient) WithDialerOptions(opts ...func(*net.Dialer)) HTTPClient
WithDialerOptions copies the BuildableHTTPClient and returns it with the net.Dialer options applied. Will set the client's http.Transport DialContext member.
func (*BuildableHTTPClient) WithTimeout ¶
func (b *BuildableHTTPClient) WithTimeout(timeout time.Duration) HTTPClient
WithTimeout Sets the timeout used by the client for all requests.
func (*BuildableHTTPClient) WithTransportOptions ¶
func (b *BuildableHTTPClient) WithTransportOptions(opts ...func(*http.Transport)) HTTPClient
WithTransportOptions copies the BuildableHTTPClient and returns it with the http.Transport options applied.
If a non (*http.Transport) was set as the round tripper, the round tripper will be replaced with a default Transport value before invoking the option functions.
type Config ¶
type Config struct { // 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 for // information on AWS regions. Region string // 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 CredentialsProvider // The HTTP Client the SDK's API clients will use to invoke HTTP requests. // The SDK defaults to a BuildableHTTPClient allowing API clients to create // copies of the HTTP Client for service specific customizations. // // Use a (*http.Client) for custom behavior. Using a custom http.Client // will prevent the SDK from modifying the HTTP client. HTTPClient HTTPClient // An endpoint resolver that can be used to provide or override an endpoint for the given // service and region Please see the `aws.EndpointResolver` documentation on usage. EndpointResolver EndpointResolver // Retryer guides how HTTP requests should be retried in case of // recoverable failures. When nil the API client will use a default // retryer. Retryer Retryer // ConfigSources are the sources that were used to construct the Config. // Allows for additional configuration to be loaded by clients. ConfigSources []interface{} // APIOptions provides the set of middleware mutations modify how the API // client requests will be handled. This is useful for adding additional // tracing data to a request, or changing behavior of the SDK's client. APIOptions []func(*middleware.Stack) error }
A Config provides service configuration for service clients.
func NewConfig ¶
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.
func (Config) Copy ¶
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.
type Credentials ¶
type Credentials struct { // AWS Access key ID AccessKeyID string // AWS Secret Access Key SecretAccessKey string // AWS Session Token SessionToken string // Source of the credentials Source string // Time the credentials will expire. CanExpire bool Expires time.Time }
A Credentials is the AWS credentials value for individual credential fields.
func (Credentials) Expired ¶
func (v Credentials) Expired() bool
Expired returns if the credentials have expired.
func (Credentials) HasKeys ¶
func (v Credentials) HasKeys() bool
HasKeys returns if the credentials keys are set.
type CredentialsCache ¶
type CredentialsCache struct { Provider CredentialsProvider // contains filtered or unexported fields }
CredentialsCache provides caching and concurrency safe credentials retrieval via the provider's retrieve method.
func (*CredentialsCache) Invalidate ¶
func (p *CredentialsCache) Invalidate()
Invalidate will invalidate the cached credentials. The next call to Retrieve will cause the provider's Retrieve method to be called.
func (*CredentialsCache) Retrieve ¶
func (p *CredentialsCache) Retrieve(ctx context.Context) (Credentials, error)
Retrieve returns the credentials. If the credentials have already been retrieved, and not expired the cached credentials will be returned. If the credentials have not been retrieved yet, or expired the provider's Retrieve method will be called.
Returns and error if the provider's retrieve method returns an error.
type CredentialsProvider ¶
type CredentialsProvider interface { // Retrieve returns nil if it successfully retrieved the value. // Error is returned if the value were not obtainable, or empty. Retrieve(ctx context.Context) (Credentials, error) }
A CredentialsProvider is the interface for any component which will provide credentials Credentials. A CredentialsProvider is required to manage its own Expired state, and what to be expired means.
A credentials provider implementation can be wrapped with a CredentialCache to cache the credential value retrieved. Without the cache the SDK will attempt to retrieve the credentials for ever request.
type CredentialsProviderFunc ¶
type CredentialsProviderFunc func(context.Context) (Credentials, error)
CredentialsProviderFunc provides a helper wrapping a function value to satisfy the CredentialsProvider interface.
func (CredentialsProviderFunc) Retrieve ¶
func (fn CredentialsProviderFunc) Retrieve(ctx context.Context) (Credentials, error)
Retrieve delegates to the function value the CredentialsProviderFunc wraps.
type Endpoint ¶
type Endpoint struct { // The URL of the endpoint. URL string // The endpoint partition PartitionID string // The service name that should be used for signing the requests to the // endpoint. SigningName string // The region that should be used for signing the request to the endpoint. SigningRegion string // The signing method that should be used for signing the requests to the // endpoint. SigningMethod string }
Endpoint represents the endpoint a service client should make requests to.
type EndpointNotFoundError ¶
type EndpointNotFoundError struct { Err error }
EndpointNotFoundError is a sentinel error to indicate that the EndpointResolver implementation was unable to resolve an endpoint for the given service and region. Resolvers should use this to indicate that a client should fallback and attempt to use it's default resolver to resolve the endpoint.
func (*EndpointNotFoundError) Error ¶
func (e *EndpointNotFoundError) Error() string
Error is the error message.
func (*EndpointNotFoundError) Unwrap ¶
func (e *EndpointNotFoundError) Unwrap() error
Unwrap returns the underlying error.
type EndpointResolver ¶
EndpointResolver is an endpoint resolver that can be used to provide or override an endpoint for the given service and region. Clients will attempt to use the EndpointResolver first to resolve an endpoint if available. If the EndpointResolver returns an EndpointNotFoundError error, clients will fallback to attempting to resolve the endpoint using their default endpoint resolver.
type EndpointResolverFunc ¶
EndpointResolverFunc wraps a function to satisfy the EndpointResolver interface.
func (EndpointResolverFunc) ResolveEndpoint ¶
func (e EndpointResolverFunc) ResolveEndpoint(service, region string) (Endpoint, error)
ResolveEndpoint calls the wrapped function and returns the results
type HTTPClient ¶
HTTPClient provides the interface to provide custom HTTPClients. Generally *http.Client is sufficient for most use cases. The HTTPClient should not follow redirects.
type MissingEndpointError ¶
type MissingEndpointError struct{}
MissingEndpointError is an error that is returned if an endpoint cannot be resolved for a service.
func (*MissingEndpointError) Error ¶
func (*MissingEndpointError) Error() string
type MissingRegionError ¶
type MissingRegionError struct{}
MissingRegionError is an error that is returned if region configuration is not found.
func (*MissingRegionError) Error ¶
func (*MissingRegionError) Error() string
type NoOpRetryer ¶
type NoOpRetryer struct{}
NoOpRetryer provides a RequestRetryDecider implementation that will flag all attempt errors as not retryable, with a max attempts of 1.
func (NoOpRetryer) GetInitialToken ¶
func (NoOpRetryer) GetInitialToken() func(error) error
GetInitialToken returns a stub function that does nothing.
func (NoOpRetryer) GetRetryToken ¶
GetRetryToken returns a stub function that does nothing.
func (NoOpRetryer) IsErrorRetryable ¶
func (NoOpRetryer) IsErrorRetryable(error) bool
IsErrorRetryable returns false for all error values.
func (NoOpRetryer) MaxAttempts ¶
func (NoOpRetryer) MaxAttempts() int
MaxAttempts always returns 1 for the original request attempt.
func (NoOpRetryer) RetryDelay ¶
RetryDelay is not valid for the NoOpRetryer. Will always return error.
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 ¶
func ReadSeekCloser(r io.Reader) ReaderSeekerCloser
ReadSeekCloser wraps a io.Reader returning a ReaderSeekerCloser. Allows the SDK to accept an io.Reader that is not also an io.Seeker for unsigned streaming payload API operations.
A readSeekCloser wrapping an nonseekable io.Reader used in an API operation's input will prevent that operation being retried in the case of network errors, and cause operation requests to fail if yhe operation requires payload signing.
Note: If using with S3 PutObject to stream an object upload. The SDK's S3 Upload Manager(s3manager.Uploader) provides support for streaming with the ability to retry network errors.
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) GetLen ¶
func (r ReaderSeekerCloser) GetLen() (int64, error)
GetLen returns the length of the bytes remaining in the underlying reader. Checks first for Len(), then io.Seeker to determine the size of the underlying reader.
Will return -1 if the length cannot be determined.
func (ReaderSeekerCloser) HasLen ¶
func (r ReaderSeekerCloser) HasLen() (int, bool)
HasLen returns the length of the underlying reader if the value implements the Len() int method.
func (ReaderSeekerCloser) IsSeeker ¶
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 RequestCanceledError ¶
type RequestCanceledError struct { Err error }
RequestCanceledError is the error that will be returned by an API request that was canceled. Requests given a Context may return this error when canceled.
func (*RequestCanceledError) CanceledError ¶
func (*RequestCanceledError) CanceledError() bool
CanceledError returns true to satisfy interfaces checking for canceled errors.
func (*RequestCanceledError) Error ¶
func (e *RequestCanceledError) Error() string
func (*RequestCanceledError) Unwrap ¶
func (e *RequestCanceledError) Unwrap() error
Unwrap returns the underlying error, if there was one.
type ResponseTimeoutError ¶
ResponseTimeoutError is an error when the reads from the response are delayed longer than the timeout the read was configured for.
func (*ResponseTimeoutError) Error ¶
func (e *ResponseTimeoutError) Error() string
func (*ResponseTimeoutError) Timeout ¶
func (*ResponseTimeoutError) Timeout() bool
Timeout returns that the error is was caused by a timeout, and can be retried.
type Retryer ¶
type Retryer interface { // IsErrorRetryable returns if the failed request is retryable. This check // should determine if the error can be retried, or if the error is // terminal. IsErrorRetryable(error) bool // MaxAttempts returns the maximum number of attempts that can be made for // a request before failing. A value of 0 implies that the request should // be retried until it succeeds if the errors are retryable. MaxAttempts() int // RetryDelay returns the delay that should be used before retrying the // request. Will return error if the if the delay could not be determined. RetryDelay(attempt int, opErr error) (time.Duration, error) // GetRetryToken attempts to deduct the retry cost from the retry token pool. // Returning the token release function, or error. GetRetryToken(ctx context.Context, opErr error) (releaseToken func(error) error, err error) // GetInitalToken returns the initial request token that can increment the // retry token pool if the request is successful. GetInitialToken() (releaseToken func(error) error) }
Retryer is an interface to determine if a given error from a request should be retried, and if so what backoff delay to apply. The default implementation used by most services is the retry package's Standard type. Which contains basic retry logic using exponential backoff.
type Ternary ¶
type Ternary int
Ternary is an enum allowing an unknown or none state in addition to a bool's true and false.
Enumerations for the values of the Ternary type.
func BoolTernary ¶
BoolTernary returns a true or false Ternary value for the bool provided.
func (Ternary) Bool ¶
Bool returns true if the value is TrueTernary, false otherwise.
func (Ternary) String ¶
type WriteAtBuffer ¶
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 ¶
func NewWriteAtBuffer(buf []byte) *WriteAtBuffer
NewWriteAtBuffer creates a WriteAtBuffer with an internal buffer provided by buf.
func (*WriteAtBuffer) Bytes ¶
func (b *WriteAtBuffer) Bytes() []byte
Bytes returns a slice of bytes written to the buffer.
func (*WriteAtBuffer) WriteAt ¶
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.
Source Files ¶
client.go config.go credential_cache.go credentials.go doc.go endpoints.go errors.go from_ptr.go http_client.go request.go retryer.go timeout_read_closer.go to_ptr.go types.go version.go
Directories ¶
Path | Synopsis |
---|---|
aws/arn | Package arn provides a parser for interacting with Amazon Resource Names. |
aws/middleware | |
aws/protocol | |
aws/protocol/ec2query | |
aws/protocol/query | |
aws/protocol/restjson | |
aws/protocol/xml | |
aws/ratelimit | |
aws/retry | |
aws/signer | |
aws/signer/internal | |
aws/signer/v4 | Package v4 implements signing for AWS V4 signer |
aws/transport | |
aws/transport/http |
- Version
- v0.26.0
- Published
- Oct 1, 2020
- Platform
- js/wasm
- Imports
- 13 packages
- Last checked
- 1 hour ago –
Tools for package owners.