Documentation ¶
Index ¶
- Variables
- func AddResponseErrorMiddleware(stack *middleware.Stack) error
- func AddResponseReadTimeoutMiddleware(stack *middleware.Stack, duration time.Duration) error
- func RemoveContentTypeHeader(stack *middleware.Stack) error
- type BuildableClient
- func (b *BuildableClient) Do(req *http.Request) (*http.Response, error)
- func (b *BuildableClient) Freeze() aws.HTTPClient
- func (b *BuildableClient) GetDialer() *net.Dialer
- func (b *BuildableClient) GetTimeout() time.Duration
- func (b *BuildableClient) GetTransport() *http.Transport
- func (b *BuildableClient) WithDialerOptions(opts ...func(*net.Dialer)) *BuildableClient
- func (b *BuildableClient) WithTimeout(timeout time.Duration) *BuildableClient
- func (b *BuildableClient) WithTransportOptions(opts ...func(*http.Transport)) *BuildableClient
- type ResponseError
- type ResponseErrorWrapper
- type ResponseTimeoutError
Constants ¶
This section is empty.
Variables ¶
var ( // Default connection pool options DefaultHTTPTransportMaxIdleConns = 100 DefaultHTTPTransportMaxIdleConnsPerHost = 10 // Default connection timeouts DefaultHTTPTransportIdleConnTimeout = 90 * time.Second DefaultHTTPTransportTLSHandleshakeTimeout = 10 * time.Second DefaultHTTPTransportExpectContinueTimeout = 1 * time.Second // Default to TLS 1.2 for all HTTPS requests. DefaultHTTPTransportTLSMinVersion uint16 = tls.VersionTLS12 )
Defaults for the HTTPTransportBuilder.
var ( DefaultDialConnectTimeout = 30 * time.Second DefaultDialKeepAliveTimeout = 30 * time.Second )
Timeouts for net.Dialer's network connection.
Functions ¶
func AddResponseErrorMiddleware ¶
func AddResponseErrorMiddleware(stack *middleware.Stack) error
AddResponseErrorMiddleware adds response error wrapper middleware
func AddResponseReadTimeoutMiddleware ¶
func AddResponseReadTimeoutMiddleware(stack *middleware.Stack, duration time.Duration) error
AddResponseReadTimeoutMiddleware adds a middleware to the stack that wraps the response body so that a read that takes too long will return an error.
func RemoveContentTypeHeader ¶
func RemoveContentTypeHeader(stack *middleware.Stack) error
RemoveContentTypeHeader removes content-type header if content length is unset or equal to zero.
Types ¶
type BuildableClient ¶
type BuildableClient struct {
// contains filtered or unexported fields
}
BuildableClient 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 BuildableClient. Only exported member values of the Transport and optional Dialer will be copied between copies of BuildableClient.
func NewBuildableClient ¶
func NewBuildableClient() *BuildableClient
NewBuildableClient returns an initialized client for invoking HTTP requests.
func (*BuildableClient) Do ¶
Do implements the HTTPClient interface's Do method to invoke a HTTP request, and receive the response. Uses the BuildableClient'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 BuildableClient will have their own connection pools.
Redirect (3xx) responses will not be followed, the HTTP response received will returned instead.
func (*BuildableClient) Freeze ¶
func (b *BuildableClient) Freeze() aws.HTTPClient
Freeze returns a frozen aws.HTTPClient implementation that is no longer a BuildableClient. Use this to prevent the SDK from applying DefaultMode configuration values to a buildable client.
func (*BuildableClient) GetDialer ¶
func (b *BuildableClient) GetDialer() *net.Dialer
GetDialer returns a copy of the client's network dialer.
func (*BuildableClient) GetTimeout ¶
func (b *BuildableClient) GetTimeout() time.Duration
GetTimeout returns a copy of the client's timeout to cancel requests with.
func (*BuildableClient) GetTransport ¶
func (b *BuildableClient) GetTransport() *http.Transport
GetTransport returns a copy of the client's HTTP Transport.
func (*BuildableClient) WithDialerOptions ¶
func (b *BuildableClient) WithDialerOptions(opts ...func(*net.Dialer)) *BuildableClient
WithDialerOptions copies the BuildableClient and returns it with the net.Dialer options applied. Will set the client's http.Transport DialContext member.
func (*BuildableClient) WithTimeout ¶
func (b *BuildableClient) WithTimeout(timeout time.Duration) *BuildableClient
WithTimeout Sets the timeout used by the client for all requests.
func (*BuildableClient) WithTransportOptions ¶
func (b *BuildableClient) WithTransportOptions(opts ...func(*http.Transport)) *BuildableClient
WithTransportOptions copies the BuildableClient 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 ResponseError ¶
type ResponseError struct { *smithyhttp.ResponseError // RequestID associated with response error RequestID string }
ResponseError provides the HTTP centric error type wrapping the underlying error with the HTTP response value and the deserialized RequestID.
func (*ResponseError) As ¶
func (e *ResponseError) As(target interface{}) bool
As populates target and returns true if the type of target is a error type that the ResponseError embeds, (e.g.AWS HTTP ResponseError)
func (*ResponseError) Error ¶
func (e *ResponseError) Error() string
Error returns the formatted error
func (*ResponseError) ServiceRequestID ¶
func (e *ResponseError) ServiceRequestID() string
ServiceRequestID returns the request id associated with Response Error
type ResponseErrorWrapper ¶
type ResponseErrorWrapper struct { }
ResponseErrorWrapper wraps operation errors with ResponseError.
func (*ResponseErrorWrapper) HandleDeserialize ¶
func (m *ResponseErrorWrapper) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( out middleware.DeserializeOutput, metadata middleware.Metadata, err error, )
HandleDeserialize wraps the stack error with smithyhttp.ResponseError.
func (*ResponseErrorWrapper) ID ¶
func (m *ResponseErrorWrapper) ID() string
ID returns the middleware identifier
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.