func AddCloseResponseBodyMiddleware(stack *middleware.Stack) error
AddCloseResponseBodyMiddleware adds the middleware to automatically close the response body of an operation request, after the response had been deserialized.
func AddComputeContentLengthMiddleware(stack *middleware.Stack) error
AddComputeContentLengthMiddleware adds ComputeContentLength to the middleware stack's Build step.
func AddContentChecksumMiddleware(stack *middleware.Stack) error
AddContentChecksumMiddleware adds checksum middleware to middleware's build step.
func AddErrorCloseResponseBodyMiddleware(stack *middleware.Stack) error
AddErrorCloseResponseBodyMiddleware adds the middleware to automatically close the response body of an operation request if the request response failed.
func AddHeaderValue(header string, value string) func(stack *middleware.Stack) error
AddHeaderValue returns a stack mutator that adds the header value pair to header. Appends to any existing values if present.
func AddNoPayloadDefaultContentTypeRemover(stack *middleware.Stack) (err error)
AddNoPayloadDefaultContentTypeRemover Adds the DefaultContentTypeRemover middleware to the stack after the operation serializer. This middleware will remove the content-type header from the request if it was set as a default value, and no request payload is present.
Returns error if unable to add the middleware.
func AddRequireMinimumProtocol(stack *middleware.Stack, major, minor int) error
AddRequireMinimumProtocol adds the RequireMinimumProtocol middleware to the stack using the provided minimum protocol major and minor version.
func DisableEndpointHostPrefix(ctx context.Context, value bool) context.Context
DisableEndpointHostPrefix sets or modifies whether the request's endpoint host prefixing should be disabled. If value is true, endpoint host prefixing will be disabled.
Scoped to stack values. Use middleware#ClearStackValues to clear all stack values.
func GetDisableDoubleEncoding(p *smithy.Properties) (bool, bool)
GetDisableDoubleEncoding gets whether the payload is unsigned from Properties.
func GetHostnameImmutable(ctx context.Context) (v bool)
GetHostnameImmutable retrieves whether the endpoint hostname should be considered immutable or not.
Scoped to stack values. Use middleware#ClearStackValues to clear all stack values.
func GetIsContentTypeDefaultValue(ctx context.Context) bool
GetIsContentTypeDefaultValue returns if the content-type HTTP header on the request is a default value that was auto assigned by an operation serializer. Allows middleware post serialization to know if the content-type was auto set to a default value or not.
Also returns false if the Context value was never updated to include if content-type was set to a default value.
func GetIsUnsignedPayload(p *smithy.Properties) (bool, bool)
GetIsUnsignedPayload gets whether the payload is unsigned from Properties.
func GetSigV4ASigningName(p *smithy.Properties) (string, bool)
GetSigV4ASigningName gets the v4a signing name from Properties.
func GetSigV4ASigningRegions(p *smithy.Properties) ([]string, bool)
GetSigV4ASigningRegion gets the v4a signing region set from Properties.
func GetSigV4SigningName(p *smithy.Properties) (string, bool)
GetSigV4SigningName gets the signing name from Properties.
func GetSigV4SigningRegion(p *smithy.Properties) (string, bool)
GetSigV4SigningRegion gets the signing region from Properties.
func IsEndpointHostPrefixDisabled(ctx context.Context) (v bool)
IsEndpointHostPrefixDisabled retrieves whether the hostname prefixing is disabled.
Scoped to stack values. Use middleware#ClearStackValues to clear all stack values.
func JoinPath(a, b string) string
JoinPath returns an absolute URL path composed of the two paths provided. Enforces that the returned path begins with '/'. If added path is empty the returned path suffix will match the first parameter suffix.
func JoinRawQuery(a, b string) string
JoinRawQuery returns an absolute raw query expression. Any duplicate '&' will be collapsed to single separator between values.
func NewStackRequest() interface{}
NewStackRequest returns an initialized request ready to be populated with the HTTP request details. Returns empty interface so the function can be used as a parameter to the Smithy middleware Stack constructor.
func ParseTime(text string) (t time.Time, err error)
ParseTime parses a time string like the HTTP Date header. This uses a more relaxed rule set for date parsing compared to the standard library.
func RemoveNoPayloadDefaultContentTypeRemover(stack *middleware.Stack) (err error)
RemoveNoPayloadDefaultContentTypeRemover removes the DefaultContentTypeRemover middleware from the stack. Returns an error if unable to remove the middleware.
func RequestCloner(v interface{}) interface{}
RequestCloner is a function that can take an input request type and clone the request for use in a subsequent retry attempt.
func SetDisableDoubleEncoding(p *smithy.Properties, disableDoubleEncoding bool)
SetDisableDoubleEncoding sets whether the payload is unsigned on Properties.
func SetHeaderValue(header string, value string) func(stack *middleware.Stack) error
SetHeaderValue returns a stack mutator that adds the header value pair to header. Replaces any existing values if present.
func SetHostnameImmutable(ctx context.Context, value bool) context.Context
SetHostnameImmutable sets or modifies whether the request's endpoint hostname should be considered immutable or not.
Scoped to stack values. Use middleware#ClearStackValues to clear all stack values.
func SetIsContentTypeDefaultValue(ctx context.Context, isDefault bool) context.Context
SetIsContentTypeDefaultValue returns a Context specifying if the request's content-type header was set to a default value.
func SetIsUnsignedPayload(p *smithy.Properties, isUnsignedPayload bool)
SetIsUnsignedPayload sets whether the payload is unsigned on Properties.
func SetSigV4ASigningName(p *smithy.Properties, name string)
SetSigV4ASigningName sets the signing name on Properties.
func SetSigV4ASigningRegions(p *smithy.Properties, regions []string)
SetSigV4ASigningRegions sets the v4a signing region set on Properties.
func SetSigV4SigningName(p *smithy.Properties, name string)
SetSigV4SigningName sets the signing name on Properties.
func SetSigV4SigningRegion(p *smithy.Properties, region string)
SetSigV4SigningRegion sets the signing region on Properties.
func SplitHTTPDateTimestampHeaderListValues(vs []string) ([]string, error)
SplitHTTPDateTimestampHeaderListValues attempts to split the HTTP-Date timestamp values in the slice by commas, and return a list of all values separated. The split is aware of the HTTP-Date timestamp format, and will skip comma within the timestamp value. Returns an error if unable to split the timestamp values.
func SplitHeaderListValues(vs []string) ([]string, error)
SplitHeaderListValues attempts to split the elements of the slice by commas, and return a list of all values separated. Returns error if unable to separate the values.
func ValidHostLabel(label string) bool
ValidHostLabel returns whether the label is a valid RFC 3986 host abel.
func ValidPortNumber(port string) bool
ValidPortNumber returns whether the port is valid RFC 3986 port.
func ValidateContentLengthHeader(stack *middleware.Stack) error
ValidateContentLengthHeader adds middleware that validates request content-length is set to value greater than zero.
func ValidateEndpointHost(host string) error
ValidateEndpointHost validates that the host string passed in is a valid RFC 3986 host. Returns error if the host is not valid.
func WithHeaderComment(header, content string) func(*middleware.Stack) error
WithHeaderComment instruments a middleware stack to append an HTTP field comment to the given header as specified in RFC 9110 (https://www.rfc-editor.org/rfc/rfc9110#name-comments).
The header is case-insensitive. If the provided header exists when the middleware runs, the content will be inserted as-is enclosed in parentheses.
Note that per the HTTP specification, comments are only allowed in fields containing "comment" as part of their field value definition, but this API will NOT verify whether the provided header is one of them.
WithHeaderComment MAY be applied more than once to a middleware stack and/or more than once per header.
AuthScheme defines an HTTP authentication scheme.
type AuthScheme interface { SchemeID() string IdentityResolver(auth.IdentityResolverOptions) auth.IdentityResolver Signer() Signer }
func NewAnonymousScheme() AuthScheme
NewAnonymousScheme returns the anonymous HTTP auth scheme.
ClientDo provides the interface for custom HTTP client implementations.
type ClientDo interface { Do(*http.Request) (*http.Response, error) }
ClientDoFunc provides a helper to wrap a function as an HTTP client for round tripping requests.
type ClientDoFunc func(*http.Request) (*http.Response, error)
func (fn ClientDoFunc) Do(r *http.Request) (*http.Response, error)
Do will invoke the underlying func, returning the result.
ClientHandler wraps a client that implements the HTTP Do method. Standard implementation is http.Client.
type ClientHandler struct {
// contains filtered or unexported fields
}
func NewClientHandler(client ClientDo) ClientHandler
NewClientHandler returns an initialized middleware handler for the client.
func (c ClientHandler) Handle(ctx context.Context, input interface{}) ( out interface{}, metadata middleware.Metadata, err error, )
Handle implements the middleware Handler interface, that will invoke the underlying HTTP client. Requires the input to be a Smithy *Request. Returns a smithy *Response, or error if the request failed.
ComputeContentLength provides a middleware to set the content-length header for the length of a serialize request body.
type ComputeContentLength struct { }
func (m *ComputeContentLength) HandleBuild( ctx context.Context, in middleware.BuildInput, next middleware.BuildHandler, ) ( out middleware.BuildOutput, metadata middleware.Metadata, err error, )
HandleBuild adds the length of the serialized request to the HTTP header if the length can be determined.
func (m *ComputeContentLength) ID() string
ID returns the identifier for the ComputeContentLength.
MinimumProtocolError is an error type indicating that the established connection did not meet the expected minimum HTTP protocol version.
type MinimumProtocolError struct {
// contains filtered or unexported fields
}
func (m *MinimumProtocolError) Error() string
Error returns the error message.
NopClient provides a client that ignores the request, and returns an empty successful HTTP response value.
type NopClient struct{}
func (NopClient) Do(r *http.Request) (*http.Response, error)
Do ignores the request and returns a 200 status empty response.
Request provides the HTTP specific request structure for HTTP specific middleware steps to use to serialize input, and send an operation's request.
type Request struct { *http.Request // contains filtered or unexported fields }
▹ Example (SerializeMiddleware)
func (r *Request) Build(ctx context.Context) *http.Request
Build returns a build standard HTTP request value from the Smithy request. The request's stream is wrapped in a safe container that allows it to be reused for subsequent attempts.
func (r *Request) Clone() *Request
Clone returns a deep copy of the Request for the new context. A reference to the Stream is copied, but the underlying stream is not copied.
func (r *Request) GetStream() io.Reader
GetStream returns the request stream io.Reader if a stream is set. If no stream is present nil will be returned.
func (r *Request) IsHTTPS() bool
IsHTTPS returns if the request is HTTPS. Returns false if no endpoint URL is set.
func (r *Request) IsStreamSeekable() bool
IsStreamSeekable returns whether the stream is seekable.
func (r *Request) RewindStream() error
RewindStream will rewind the io.Reader to the relative start position if it is an io.Seeker.
func (r *Request) SetStream(reader io.Reader) (rc *Request, err error)
SetStream returns a clone of the request with the stream set to the provided reader. May return an error if the provided reader is seekable but returns an error.
func (r *Request) StreamLength() (size int64, ok bool, err error)
StreamLength returns the number of bytes of the serialized stream attached to the request and ok set. If the length cannot be determined, an error will be returned.
RequestResponseLogger is a deserialize middleware that will log the request and response HTTP messages and optionally their respective bodies. Will not perform any logging if none of the options are set.
type RequestResponseLogger struct { LogRequest bool LogRequestWithBody bool LogResponse bool LogResponseWithBody bool }
func (r *RequestResponseLogger) HandleDeserialize( ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler, ) ( out middleware.DeserializeOutput, metadata middleware.Metadata, err error, )
HandleDeserialize will log the request and response HTTP messages if configured accordingly.
func (r *RequestResponseLogger) ID() string
ID is the middleware identifier.
RequestSendError provides a generic request transport error. This error should wrap errors making HTTP client requests.
The ClientHandler will wrap the HTTP client's error if the client request fails, and did not fail because of context canceled.
type RequestSendError struct { Err error }
func (e *RequestSendError) ConnectionError() bool
ConnectionError returns that the error is related to not being able to send the request, or receive a response from the service.
func (e *RequestSendError) Error() string
func (e *RequestSendError) Unwrap() error
Unwrap returns the underlying error, if there was one.
RequireMinimumProtocol is a deserialization middleware that asserts that the established HTTP connection meets the minimum major ad minor version.
type RequireMinimumProtocol struct { ProtoMajor int ProtoMinor int }
func (r *RequireMinimumProtocol) HandleDeserialize( ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler, ) ( out middleware.DeserializeOutput, metadata middleware.Metadata, err error, )
HandleDeserialize asserts that the established connection is a HTTP connection with the minimum major and minor protocol version.
func (r *RequireMinimumProtocol) ID() string
ID returns the middleware identifier string.
Response provides the HTTP specific response structure for HTTP specific middleware steps to use to deserialize the response from an operation call.
type Response struct { *http.Response }
▹ Example (DeserializeMiddleware)
ResponseError provides the HTTP centric error type wrapping the underlying error with the HTTP response value.
type ResponseError struct { Response *Response Err error }
▹ Example
func (e *ResponseError) Error() string
func (e *ResponseError) HTTPResponse() *Response
HTTPResponse returns the HTTP response received from the service.
func (e *ResponseError) HTTPStatusCode() int
HTTPStatusCode returns the HTTP response status code received from the service.
func (e *ResponseError) Unwrap() error
Unwrap returns the nested error if any, or nil.
Signer defines the interface through which HTTP requests are supplemented with an Identity.
type Signer interface { SignRequest(context.Context, *Request, auth.Identity, smithy.Properties) error }
UserAgentBuilder is a builder for a HTTP User-Agent string.
type UserAgentBuilder struct {
// contains filtered or unexported fields
}
func NewUserAgentBuilder() *UserAgentBuilder
NewUserAgentBuilder returns a new UserAgentBuilder.
func (u *UserAgentBuilder) AddKey(key string)
AddKey adds the named component/product to the agent string
func (u *UserAgentBuilder) AddKeyValue(key, value string)
AddKeyValue adds the named key to the agent string with the given value.
func (u *UserAgentBuilder) Build() string
Build returns the constructed User-Agent string. May be called multiple times.
Name | Synopsis |
---|---|
.. |