aws-sdk-go: github.com/aws/aws-sdk-go/private/protocol Index | Files | Directories

package protocol

import "github.com/aws/aws-sdk-go/private/protocol"

Index

Package Files

host.go host_prefix.go idempotency.go jsonvalue.go payload.go protocol.go timestamp.go unmarshal.go unmarshal_error.go

Constants

const (
    RFC822TimeFormatName  = "rfc822"
    ISO8601TimeFormatName = "iso8601"
    UnixTimeFormatName    = "unixTimestamp"
)

Names of time formats supported by the SDK

const (
    // RFC 7231#section-7.1.1.1 timetamp format. e.g Tue, 29 Apr 2014 18:30:38 GMT
    RFC822TimeFormat = "Mon, 2 Jan 2006 15:04:05 GMT"

    // This format is used for output time without seconds precision
    RFC822OutputTimeFormat = "Mon, 02 Jan 2006 15:04:05 GMT"

    // RFC3339 a subset of the ISO8601 timestamp format. e.g 2014-04-29T18:30:38Z
    ISO8601TimeFormat = "2006-01-02T15:04:05.999999999Z"

    // This format is used for output time with fractional second precision up to milliseconds
    ISO8601OutputTimeFormat = "2006-01-02T15:04:05.999999999Z"
)

Time formats supported by the SDK Output time is intended to not contain decimals

const ErrCodeMinimumHTTPProtocolError = "MinimumHTTPProtocolError"

ErrCodeMinimumHTTPProtocolError error code is returned when the target endpoint did not match the required HTTP major and minor protocol version.

const HostPrefixHandlerName = "awssdk.endpoint.HostPrefixHandler"

HostPrefixHandlerName is the handler name for the host prefix request handler.

const UnmarshalErrorHandlerName = "awssdk.protocol.UnmarshalError"

UnmarshalErrorHandlerName is the name of the named handler.

Variables

var RandReader = rand.Reader

RandReader is the random reader the protocol package will use to read random bytes from. This is exported for testing, and should not be used.

var UnmarshalDiscardBodyHandler = request.NamedHandler{Name: "awssdk.shared.UnmarshalDiscardBody", Fn: UnmarshalDiscardBody}

UnmarshalDiscardBodyHandler is a named request handler to empty and close a response's body

var ValidateEndpointHostHandler = request.NamedHandler{
    Name: "awssdk.protocol.ValidateEndpointHostHandler",
    Fn: func(r *request.Request) {
        err := ValidateEndpointHost(r.Operation.Name, r.HTTPRequest.URL.Host)
        if err != nil {
            r.Error = err
        }
    },
}

ValidateEndpointHostHandler is a request handler that will validate the request endpoint's hosts is a valid RFC 3986 host.

func CanSetIdempotencyToken Uses

func CanSetIdempotencyToken(v reflect.Value, f reflect.StructField) bool

CanSetIdempotencyToken returns true if the struct field should be automatically populated with a Idempotency token.

Only *string and string type fields that are tagged with idempotencyToken which are not already set can be auto filled.

func DecodeJSONValue Uses

func DecodeJSONValue(v string, escape EscapeMode) (aws.JSONValue, error)

DecodeJSONValue will attempt to decode the string input as a JSONValue. Optionally decoding base64 the value first before JSON unmarshaling.

Will panic if the escape mode is unknown.

func EncodeJSONValue Uses

func EncodeJSONValue(v aws.JSONValue, escape EscapeMode) (string, error)

EncodeJSONValue marshals the value into a JSON string, and optionally base64 encodes the string before returning it.

Will panic if the escape mode is unknown.

func FormatTime Uses

func FormatTime(name string, t time.Time) string

FormatTime returns a string value of the time.

func GetIdempotencyToken Uses

func GetIdempotencyToken() string

GetIdempotencyToken returns a randomly generated idempotency token.

func IsKnownTimestampFormat Uses

func IsKnownTimestampFormat(name string) bool

IsKnownTimestampFormat returns if the timestamp format name is know to the SDK's protocols.

func NewHostPrefixHandler Uses

func NewHostPrefixHandler(prefix string, labelsFn func() map[string]string) request.NamedHandler

NewHostPrefixHandler constructs a build handler

func ParseTime Uses

func ParseTime(formatName, value string) (time.Time, error)

ParseTime attempts to parse the time given the format. Returns the time if it was able to be parsed, and fails otherwise.

func SetIdempotencyToken Uses

func SetIdempotencyToken(v reflect.Value)

SetIdempotencyToken will set the value provided with a Idempotency Token. Given that the value can be set. Will panic if value is not setable.

func UUIDVersion4 Uses

func UUIDVersion4(u []byte) string

UUIDVersion4 returns a Version 4 random UUID from the byte slice provided

func UnmarshalDiscardBody Uses

func UnmarshalDiscardBody(r *request.Request)

UnmarshalDiscardBody is a request handler to empty a response's body and closing it.

func ValidHostLabel Uses

func ValidHostLabel(label string) bool

ValidHostLabel returns if the label is a valid RFC 3986 host label.

func ValidateEndpointHost Uses

func ValidateEndpointHost(opName, 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.

type ErrorUnmarshaler Uses

type ErrorUnmarshaler interface {
    UnmarshalError(*http.Response, ResponseMetadata) (error, error)
}

ErrorUnmarshaler is an abstract interface for concrete implementations to unmarshal protocol specific response errors.

type EscapeMode Uses

type EscapeMode uint

EscapeMode is the mode that should be use for escaping a value

const (
    NoEscape EscapeMode = iota
    Base64Escape
    QuotedEscape
)

The modes for escaping a value before it is marshaled, and unmarshaled.

type HandlerPayloadMarshal Uses

type HandlerPayloadMarshal struct {
    Marshalers request.HandlerList
}

HandlerPayloadMarshal implements the PayloadMarshaler from a HandlerList. This provides support for marshaling a SDK shape into an io.Writer without needing a SDK request first.

func (HandlerPayloadMarshal) MarshalPayload Uses

func (h HandlerPayloadMarshal) MarshalPayload(w io.Writer, v interface{}) error

MarshalPayload marshals the SDK shape into the io.Writer using the Marshalers HandlerList provided. Returns an error if unable if marshal fails.

type HandlerPayloadUnmarshal Uses

type HandlerPayloadUnmarshal struct {
    Unmarshalers request.HandlerList
}

HandlerPayloadUnmarshal implements the PayloadUnmarshaler from a HandlerList. This provides the support for unmarshaling a payload reader to a shape without needing a SDK request first.

func (HandlerPayloadUnmarshal) UnmarshalPayload Uses

func (h HandlerPayloadUnmarshal) UnmarshalPayload(r io.Reader, v interface{}) error

UnmarshalPayload unmarshals the io.Reader payload into the SDK shape using the Unmarshalers HandlerList provided. Returns an error if unable unmarshaling fails.

type HostPrefixBuilder Uses

type HostPrefixBuilder struct {
    Prefix   string
    LabelsFn func() map[string]string
}

HostPrefixBuilder provides the request handler to expand and prepend the host prefix into the operation's request endpoint host.

func (HostPrefixBuilder) Build Uses

func (h HostPrefixBuilder) Build(r *request.Request)

Build updates the passed in Request with the HostPrefix template expanded.

type PayloadMarshaler Uses

type PayloadMarshaler interface {
    MarshalPayload(io.Writer, interface{}) error
}

PayloadMarshaler provides the interface for marshaling a SDK shape into and io.Writer.

type PayloadUnmarshaler Uses

type PayloadUnmarshaler interface {
    UnmarshalPayload(io.Reader, interface{}) error
}

PayloadUnmarshaler provides the interface for unmarshaling a payload's reader into a SDK shape.

type RequireHTTPMinProtocol Uses

type RequireHTTPMinProtocol struct {
    Major, Minor int
}

RequireHTTPMinProtocol request handler is used to enforce that the target endpoint supports the given major and minor HTTP protocol version.

func (RequireHTTPMinProtocol) Handler Uses

func (p RequireHTTPMinProtocol) Handler(r *request.Request)

Handler will mark the request.Request with an error if the target endpoint did not connect with the required HTTP protocol major and minor version.

type ResponseMetadata Uses

type ResponseMetadata struct {
    StatusCode int
    RequestID  string
}

ResponseMetadata provides the SDK response metadata attributes.

type UnmarshalErrorHandler Uses

type UnmarshalErrorHandler struct {
    // contains filtered or unexported fields
}

UnmarshalErrorHandler provides unmarshaling errors API response errors for both typed and untyped errors.

func NewUnmarshalErrorHandler Uses

func NewUnmarshalErrorHandler(unmarshaler ErrorUnmarshaler) *UnmarshalErrorHandler

NewUnmarshalErrorHandler returns an UnmarshalErrorHandler initialized for the set of exception names to the error unmarshalers

func (*UnmarshalErrorHandler) NamedHandler Uses

func (u *UnmarshalErrorHandler) NamedHandler() request.NamedHandler

NamedHandler returns a NamedHandler for the unmarshaler using the set of errors the unmarshaler was initialized for.

func (*UnmarshalErrorHandler) UnmarshalError Uses

func (u *UnmarshalErrorHandler) UnmarshalError(r *request.Request)

UnmarshalError will attempt to unmarshal the API response's error message into either a generic SDK error type, or a typed error corresponding to the errors exception name.

Directories

PathSynopsis
ec2queryPackage ec2query provides serialization of AWS EC2 requests and responses.
eventstream
eventstream/eventstreamapi
eventstream/eventstreamtest
json/jsonutilPackage jsonutil provides JSON serialization of AWS requests and responses.
jsonrpcPackage jsonrpc provides JSON RPC utilities for serialization of AWS requests and responses.
queryPackage query provides serialization of AWS query requests, and responses.
query/queryutil
restPackage rest provides RESTful serialization of AWS requests and responses.
restjsonPackage restjson provides RESTful JSON serialization of AWS requests and responses.
restxmlPackage restxml provides RESTful XML serialization of AWS requests and responses.
xml/xmlutilPackage xmlutil provides XML serialization of AWS requests and responses.

Package protocol imports 17 packages (graph) and is imported by 7186 packages. Updated 2020-08-28. Refresh now. Tools for package owners.