Documentation ¶
Index ¶
- func AddToUserAgent(r *Request, s string)
- func MakeAddToUserAgentFreeFormHandler(s string) func(*Request)
- func MakeAddToUserAgentHandler(name, version string, extra ...string) func(*Request)
- func WithRetryer(cfg *aws.Config, retryer Retryer) *aws.Config
- type HandlerList
- func (l *HandlerList) Clear()
- func (l *HandlerList) Len() int
- func (l *HandlerList) PushBack(f func(*Request))
- func (l *HandlerList) PushBackNamed(n NamedHandler)
- func (l *HandlerList) PushFront(f func(*Request))
- func (l *HandlerList) PushFrontNamed(n NamedHandler)
- func (l *HandlerList) Remove(n NamedHandler)
- func (l *HandlerList) Run(r *Request)
- type Handlers
- type NamedHandler
- type Operation
- type Paginator
- type Request
- func (r *Request) Build() error
- func (r *Request) DataFilled() bool
- func (r *Request) EachPage(fn func(data interface{}, isLastPage bool) (shouldContinue bool)) error
- func (r *Request) HasNextPage() bool
- func (r *Request) IsErrorExpired() bool
- func (r *Request) IsErrorRetryable() bool
- func (r *Request) NextPage() *Request
- func (r *Request) ParamsFilled() bool
- func (r *Request) Presign(expireTime time.Duration) (string, error)
- func (r *Request) Send() error
- func (r *Request) SetBufferBody(buf []byte)
- func (r *Request) SetReaderBody(reader io.ReadSeeker)
- func (r *Request) SetStringBody(s string)
- func (r *Request) Sign() error
- func (r *Request) WillRetry() bool
- type Retryer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddToUserAgent ¶
AddToUserAgent adds the string to the end of the request's current user agent.
func MakeAddToUserAgentFreeFormHandler ¶
MakeAddToUserAgentFreeFormHandler adds the input to the User-Agent request header. The input string will be concatenated with the current request's user agent string.
func MakeAddToUserAgentHandler ¶
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.
Types ¶
type HandlerList ¶
type HandlerList struct {
// contains filtered or unexported fields
}
A HandlerList manages zero or more handlers in a list.
func (*HandlerList) Len ¶
func (l *HandlerList) Len() int
Len returns the number of handlers in the list.
func (*HandlerList) PushBack ¶
func (l *HandlerList) PushBack(f func(*Request))
PushBack pushes handler f to the back of the handler list.
func (*HandlerList) PushBackNamed ¶
func (l *HandlerList) PushBackNamed(n NamedHandler)
PushBackNamed pushes named handler f to the back of the handler list.
func (*HandlerList) PushFront ¶
func (l *HandlerList) PushFront(f func(*Request))
PushFront pushes handler f to the front of the handler list.
func (*HandlerList) PushFrontNamed ¶
func (l *HandlerList) PushFrontNamed(n NamedHandler)
PushFrontNamed pushes named handler f to the front of the handler list.
func (*HandlerList) Remove ¶
func (l *HandlerList) Remove(n NamedHandler)
Remove removes a NamedHandler n
func (*HandlerList) Run ¶
func (l *HandlerList) Run(r *Request)
Run executes all handlers in the list with a given request object.
type Handlers ¶
type Handlers struct { Validate HandlerList Build HandlerList Sign HandlerList Send HandlerList ValidateResponse HandlerList Unmarshal HandlerList UnmarshalMeta HandlerList UnmarshalError HandlerList Retry HandlerList AfterRetry HandlerList }
A Handlers provides a collection of request handlers for various stages of handling requests.
type NamedHandler ¶
A NamedHandler is a struct that contains a name and function callback.
type Paginator ¶
type Paginator struct { InputTokens []string OutputTokens []string LimitToken string TruncationToken string }
Paginator keeps track of pagination configuration for an API operation.
type Request ¶
type Request struct { Config aws.Config ClientInfo metadata.ClientInfo Handlers Handlers Retryer Time time.Time ExpireTime time.Duration Operation *Operation HTTPRequest *http.Request HTTPResponse *http.Response Body io.ReadSeeker BodyStart int64 // offset from beginning of Body that the request body starts Params interface{} Error error Data interface{} RequestID string RetryCount int Retryable *bool RetryDelay time.Duration // contains filtered or unexported fields }
A Request is the service request to be made.
func New ¶
func New(cfg aws.Config, clientInfo metadata.ClientInfo, handlers Handlers, retryer Retryer, operation *Operation, params interface{}, data interface{}) *Request
New returns a new Request pointer for the service API operation and parameters.
Params is any value of input parameters to be the request payload. Data is pointer value to an object which the request's response payload will be deserialized to.
func (*Request) Build ¶
Build will build the request's object so it can be signed and sent to the service. Build will also validate all the request's parameters. Anny additional build Handlers set on this request will be run in the order they were set.
The request will only be built once. Multiple calls to build will have no effect.
If any Validate or Build errors occur the build will stop and the error which occurred will be returned.
func (*Request) DataFilled ¶
DataFilled returns true if the request's data for response deserialization target has been set and is a valid. False is returned if data is not set, or is invalid.
func (*Request) EachPage ¶
EachPage iterates over each page of a paginated request object. The fn parameter should be a function with the following sample signature:
func(page *T, lastPage bool) bool { return true // return false to stop iterating }
Where "T" is the structure type matching the output structure of the given operation. For example, a request object generated by DynamoDB.ListTablesRequest() would expect to see dynamodb.ListTablesOutput as the structure "T". The lastPage value represents whether the page is the last page of data or not. The return value of this function should return true to keep iterating or false to stop.
func (*Request) HasNextPage ¶
HasNextPage returns true if this request has more pages of data available.
func (*Request) IsErrorExpired ¶
IsErrorExpired returns whether the error code is a credential expiry error. Returns false if the request has no Error set.
func (*Request) IsErrorRetryable ¶
IsErrorRetryable returns whether the error is retryable, based on its Code. Returns false if the request has no Error set.
func (*Request) NextPage ¶
NextPage returns a new Request that can be executed to return the next page of result data. Call .Send() on this request to execute it.
func (*Request) ParamsFilled ¶
ParamsFilled returns if the request's parameters have been populated and the parameters are valid. False is returned if no parameters are provided or invalid.
func (*Request) Presign ¶
Presign returns the request's signed URL. Error will be returned if the signing fails.
func (*Request) Send ¶
Send will send the request returning error if errors are encountered.
Send will sign the request prior to sending. All Send Handlers will be executed in the order they were set.
func (*Request) SetBufferBody ¶
SetBufferBody will set the request's body bytes that will be sent to the service API.
func (*Request) SetReaderBody ¶
func (r *Request) SetReaderBody(reader io.ReadSeeker)
SetReaderBody will set the request's body reader.
func (*Request) SetStringBody ¶
SetStringBody sets the body of the request to be backed by a string.
type Retryer ¶
type Retryer interface { RetryRules(*Request) time.Duration ShouldRetry(*Request) bool MaxRetries() int }
Retryer is an interface to control retry logic for a given service. The default implementation used by most services is the service.DefaultRetryer structure, which contains basic retry logic using exponential backoff.