Package: request
Constants
-
const WaiterResourceNotReadyErrorCode = readonly
WaiterResourceNotReadyErrorCode is the error code returned by a waiter when the waiter's max attempts have been exhausted.
-
Value:
"ResourceNotReady" -
const SuccessWaiterState WaiterState = readonly
-
Value:
iota // waiter successful -
const PathAllWaiterMatch WaiterMatchMode = readonly
-
Value:
iota // match on all paths -
const ErrCodeSerialization = readonly
ErrCodeSerialization is the serialization error code that is received during protocol unmarshaling.
-
Value:
"SerializationError" -
const ErrCodeRead = readonly
ErrCodeRead is an error that is returned during HTTP reads.
-
Value:
"ReadError" -
const ErrCodeResponseTimeout = readonly
ErrCodeResponseTimeout is the connection timeout error that is received during body reads.
-
Value:
"ResponseTimeout" -
const ErrCodeInvalidPresignExpire = readonly
ErrCodeInvalidPresignExpire is returned when the expire time provided to presign is invalid
-
Value:
"InvalidPresignExpireError" -
const CanceledErrorCode = readonly
CanceledErrorCode is the error code that will be returned by an API request that was canceled. Requests given a aws.Context may return this error when canceled.
-
Value:
"RequestCanceled" -
const ErrCodeRequestError = readonly
ErrCodeRequestError is an error preventing the SDK from continuing to process the request.
-
Value:
"RequestError" -
const InvalidParameterErrCode = readonly
InvalidParameterErrCode is the error code for invalid parameters errors
-
Value:
"InvalidParameter" -
const ParamRequiredErrCode = readonly
ParamRequiredErrCode is the error code for required parameter errors
-
Value:
"ParamRequiredError" -
const ParamMinValueErrCode = readonly
ParamMinValueErrCode is the error code for fields with too low of a number value.
-
Value:
"ParamMinValueError" -
const ParamMinLenErrCode = readonly
ParamMinLenErrCode is the error code for fields without enough elements.
-
Value:
"ParamMinLenError" -
const ParamMaxLenErrCode = readonly
ParamMaxLenErrCode is the error code for value being too long.
-
Value:
"ParamMaxLenError" -
const ParamFormatErrCode = readonly
ParamFormatErrCode is the error code for a field with invalid format or characters.
-
Value:
"ParamFormatInvalidError" -
const HandlerResponseTimeout = readonly
HandlerResponseTimeout is what we use to signify the name of the response timeout handler.
-
Value:
"ResponseTimeoutHandler"
Variables
-
var NoBody = writable
NoBody is a http.NoBody reader instructing Go HTTP client to not include and body in the HTTP request.
-
Value:
http.NoBody
Type Summary collapse
-
ErrInvalidParams
struct
An ErrInvalidParams provides wrapping of invalid parameter errors found when validating API operation input parameters.
-
ErrParamFormat
struct
An ErrParamFormat represents a invalid format parameter error.
-
ErrParamMaxLen
struct
An ErrParamMaxLen represents a maximum length parameter error.
-
ErrParamMinLen
struct
An ErrParamMinLen represents a minimum length parameter error.
-
ErrParamMinValue
struct
An ErrParamMinValue represents a minimum value parameter error.
-
ErrParamRequired
struct
An ErrParamRequired represents an required parameter error.
-
HandlerList
struct
A HandlerList manages zero or more handlers in a list.
-
HandlerListRunItem
struct
A HandlerListRunItem represents an entry in the HandlerList which is being run.
-
Handlers
struct
A Handlers provides a collection of request handlers for various stages of handling requests.
-
NamedHandler
struct
A NamedHandler is a struct that contains a name and function callback.
-
Operation
struct
An Operation is the service API operation to be made.
-
Pagination
struct
A Pagination provides paginating of SDK API operations which are paginatable.
-
Paginator
struct
A Paginator is the configuration data that defines how an API operation should be paginated.
-
Request
struct
nextPageTokens returns the tokens to use when asking for the next page of data.
-
Waiter
struct
A Waiter provides the functionality to perform a blocking call which will wait for a resource state to be satisfied by a service.
-
WaiterAcceptor
struct
A WaiterAcceptor provides the information needed to wait for an API operation to complete.
-
WaiterMatchMode
struct
String returns the string representation of the waiter match mode.
-
WaiterState
struct
String returns the string representation of the waiter state.
Interface Summary collapse
-
ErrInvalidParam
interface
An ErrInvalidParam represents an invalid parameter error type.
-
Retryer
interface
Retryer provides the interface drive the SDK's request retry behavior.
-
Validator
interface
Validator provides a way for types to perform validation logic on their input values that external code can use to determine if a type's values are valid.
Function Summary collapse
-
func AddToUserAgent(r *Request, s string)
AddToUserAgent adds the string to the end of the request's current user agent.
-
func ConstantWaiterDelay(delay time.Duration) WaiterDelay
ConstantWaiterDelay returns a WaiterDelay that will always return a constant delay the waiter should use between attempts.
-
func HandlerListLogItem(item HandlerListRunItem) bool
HandlerListLogItem logs the request handler and the state of the request's Error value.
-
func HandlerListStopOnError(item HandlerListRunItem) bool
HandlerListStopOnError returns false to stop the HandlerList iterating over request handlers if Request.Error is not nil.
-
func IsErrorExpiredCreds(err error) bool
IsErrorExpiredCreds returns whether the error code is a credential expiry error.
-
func IsErrorRetryable(err error) bool
IsErrorRetryable returns whether the error is retryable, based on its Code.
-
func IsErrorThrottle(err error) bool
IsErrorThrottle returns whether the error is to be throttled based on its code.
-
func MakeAddToUserAgentFreeFormHandler(s string) func(*Request)
MakeAddToUserAgentFreeFormHandler adds the input to the User-Agent request header.
-
func MakeAddToUserAgentHandler(name, version string, extra ...string) func(*Request)
MakeAddToUserAgentHandler will add the name/version pair to the User-Agent request header.
-
func SanitizeHostForHeader(r *http.Request)
SanitizeHostForHeader removes default port from host and updates request.Host.
-
func WithAppendUserAgent(s string) Option
WithAppendUserAgent will add a string to the user agent prefixed with a single white space.
-
func WithGetResponseHeader(key string, val *string) Option
WithGetResponseHeader builds a request Option which will retrieve a single header value from the HTTP Response.
-
func WithGetResponseHeaders(headers *http.Header) Option
WithGetResponseHeaders builds a request Option which will retrieve the headers from the HTTP response and assign them to the passed in headers variable.
-
func WithLogLevel(l aws.LogLevelType) Option
WithLogLevel is a request option that will set the request to use a specific log level when the request is made.
-
func WithResponseReadTimeout(duration time.Duration) Option
WithResponseReadTimeout is a request option that will wrap the body in a timeout read closer.
-
func WithRetryer(cfg *aws.Config, retryer Retryer) *aws.Config
WithRetryer sets a Retryer value to the given Config returning the Config value for chaining.
-
func WithSetRequestHeaders(h map[string]string) Option
WithSetRequestHeaders updates the operation request's HTTP header to contain the header key value pairs provided.
-
func WithWaiterDelay(delayer WaiterDelay) WaiterOption
WithWaiterDelay will set the Waiter to use the WaiterDelay passed in.
-
func WithWaiterLogger(logger aws.Logger) WaiterOption
WithWaiterLogger returns a waiter option to set the logger a waiter should use to log warnings and errors to.
-
func WithWaiterMaxAttempts(max int) WaiterOption
WithWaiterMaxAttempts returns the maximum number of times the waiter should attempt to check the resource for the target state.
-
func WithWaiterRequestOptions(opts ...Option) WaiterOption
WithWaiterRequestOptions returns a waiter option setting the request options for each request the waiter makes.
Type Details
HandlerListRunItem struct
A HandlerListRunItem represents an entry in the HandlerList which is being run.
NamedHandler struct
A NamedHandler is a struct that contains a name and function callback.
Operation struct
An Operation is the service API operation to be made.
Paginator struct
A Paginator is the configuration data that defines how an API operation should be paginated. This type is used by the API service models to define the generated pagination config for service APIs.
The Pagination type is what provides iterating between pages of an API. It is only used to store the token metadata the SDK should use for performing pagination.
WaiterMatchMode struct
String returns the string representation of the waiter match mode.
WaiterState struct
String returns the string representation of the waiter state.
Function Details
func AddToUserAgent(r *Request, s string)
AddToUserAgent adds the string to the end of the request's current user agent.
642 643 644 645 646 647 648 |
// File 'aws/request/request.go', line 642
|
func ConstantWaiterDelay(delay time.Duration) WaiterDelay
ConstantWaiterDelay returns a WaiterDelay that will always return a constant delay the waiter should use between attempts. It ignores the number of attempts made.
38 39 40 41 42 |
// File 'aws/request/waiter.go', line 38
|
func HandlerListLogItem(item HandlerListRunItem) bool
HandlerListLogItem logs the request handler and the state of the request's Error value. Always returns true to continue iterating request handlers in a HandlerList.
279 280 281 282 283 284 285 286 287 |
// File 'aws/request/handlers.go', line 279
|
func HandlerListStopOnError(item HandlerListRunItem) bool
HandlerListStopOnError returns false to stop the HandlerList iterating over request handlers if Request.Error is not nil. True otherwise to continue iterating.
292 293 294 |
// File 'aws/request/handlers.go', line 292
|
func IsErrorExpiredCreds(err error) bool
IsErrorExpiredCreds returns whether the error code is a credential expiry error. Returns false if error is nil.
238 239 240 241 242 243 |
// File 'aws/request/retryer.go', line 238
|
func IsErrorRetryable(err error) bool
IsErrorRetryable returns whether the error is retryable, based on its Code. Returns false if error is nil.
156 157 158 159 160 161 |
// File 'aws/request/retryer.go', line 156
|
func IsErrorThrottle(err error) bool
IsErrorThrottle returns whether the error is to be throttled based on its code. Returns false if error is nil.
229 230 231 232 233 234 |
// File 'aws/request/retryer.go', line 229
|
func MakeAddToUserAgentFreeFormHandler(s string) func(*Request)
MakeAddToUserAgentFreeFormHandler adds the input to the User-Agent request header. The input string will be concatenated with the current request's user agent string.
323 324 325 326 327 |
// File 'aws/request/handlers.go', line 323
|
func MakeAddToUserAgentHandler(name, version string, extra ...string) func(*Request)
MakeAddToUserAgentHandler will add the name/version pair to the User-Agent request header. If the extra parameters are provided they will be added as metadata to the name/version pair resulting in the following format. “name/version (extra0; extra1; …)” The user agent part will be concatenated with this current request's user agent string.
311 312 313 314 315 316 317 318 319 |
// File 'aws/request/handlers.go', line 311
|
func SanitizeHostForHeader(r *http.Request)
SanitizeHostForHeader removes default port from host and updates request.Host
651 652 653 654 655 656 657 |
// File 'aws/request/request.go', line 651
|
func WithAppendUserAgent(s string) Option
WithAppendUserAgent will add a string to the user agent prefixed with a single white space.
298 299 300 301 302 303 304 |
// File 'aws/request/handlers.go', line 298
|
func WithGetResponseHeader(key string, val *string) Option
WithGetResponseHeader builds a request Option which will retrieve a single header value from the HTTP Response. If there are multiple values for the header key use WithGetResponseHeaders instead to access the http.Header map directly. The passed in val pointer must be non-nil.
This Option can be used multiple times with a single API operation.
var id2, versionID string
svc.PutObjectWithContext(ctx, params,
request.WithGetResponseHeader("x-amz-id-2", &id2),
request.WithGetResponseHeader("x-amz-version-id", &versionID),
)
189 190 191 192 193 194 195 |
// File 'aws/request/request.go', line 189
|
func WithGetResponseHeaders(headers *http.Header) Option
WithGetResponseHeaders builds a request Option which will retrieve the headers from the HTTP response and assign them to the passed in headers variable. The passed in headers pointer must be non-nil.
var headers http.Header
svc.PutObjectWithContext(ctx, params, request.WithGetResponseHeaders(&headers))
203 204 205 206 207 208 209 |
// File 'aws/request/request.go', line 203
|
func WithLogLevel(l aws.LogLevelType) Option
WithLogLevel is a request option that will set the request to use a specific log level when the request is made.
svc.PutObjectWithContext(ctx, params, request.WithLogLevel(aws.LogDebugWithHTTPBody)
215 216 217 218 219 |
// File 'aws/request/request.go', line 215
|
func WithResponseReadTimeout(duration time.Duration) Option
WithResponseReadTimeout is a request option that will wrap the body in a timeout read closer. This will allow for per read timeouts. If a timeout occurred, we will return the ErrCodeResponseTimeout.
svc.PutObjectWithContext(ctx, params, request.WithTimeoutReadCloser(30 * time.Second)
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
// File 'aws/request/timeout_read_closer.go', line 74
|
func WithRetryer(cfg *aws.Config, retryer Retryer) *aws.Config
WithRetryer sets a Retryer value to the given Config returning the Config value for chaining. The value must not be nil.
38 39 40 41 42 43 44 45 46 47 48 |
// File 'aws/request/retryer.go', line 38
|
func WithSetRequestHeaders(h map[string]string) Option
WithSetRequestHeaders updates the operation request's HTTP header to contain the header key value pairs provided. If the header key already exists in the request's HTTP header set, the existing value(s) will be replaced.
Header keys added will be added as canonical format with title casing applied via http.Header.Set method.
335 336 337 |
// File 'aws/request/handlers.go', line 335
|
func WithWaiterDelay(delayer WaiterDelay) WaiterOption
WithWaiterDelay will set the Waiter to use the WaiterDelay passed in.
45 46 47 48 49 |
// File 'aws/request/waiter.go', line 45
|
func WithWaiterLogger(logger aws.Logger) WaiterOption
WithWaiterLogger returns a waiter option to set the logger a waiter should use to log warnings and errors to.
53 54 55 56 57 |
// File 'aws/request/waiter.go', line 53
|
func WithWaiterMaxAttempts(max int) WaiterOption
WithWaiterMaxAttempts returns the maximum number of times the waiter should attempt to check the resource for the target state.
21 22 23 24 25 |
// File 'aws/request/waiter.go', line 21
|
func WithWaiterRequestOptions(opts ...Option) WaiterOption
WithWaiterRequestOptions returns a waiter option setting the request options for each request the waiter makes. Appends to waiter's request options already set.
62 63 64 65 66 |
// File 'aws/request/waiter.go', line 62
|