rest

package
v0.24.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package rest provides RESTful serialization of AWS requests and responses.

Index

Constants

View Source
const RFC822 = "Mon, 2 Jan 2006 15:04:05 GMT"

RFC822 returns an RFC822 formatted timestamp for AWS protocols

Variables

View Source
var BuildHandler = request.NamedHandler{Name: "awssdk.rest.Build", Fn: Build}

BuildHandler is a named request handler for building rest protocol requests

View Source
var UnmarshalHandler = request.NamedHandler{Name: "awssdk.rest.Unmarshal", Fn: Unmarshal}

UnmarshalHandler is a named request handler for unmarshaling rest protocol requests

View Source
var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.rest.UnmarshalMeta", Fn: UnmarshalMeta}

UnmarshalMetaHandler is a named request handler for unmarshaling rest protocol request metadata

Functions

func Build

func Build(r *request.Request)

Build builds the REST component of a service request.

func BuildAsGET

func BuildAsGET(r *request.Request)

BuildAsGET builds the REST component of a service request with the ability to hoist data from the body.

func EscapePath

func EscapePath(path string, encodeSep bool) string

EscapePath escapes part of a URL path in Amazon style

func PayloadMember

func PayloadMember(i interface{}) interface{}

PayloadMember returns the payload field member of i if there is one, or nil.

func PayloadType

func PayloadType(i interface{}) string

PayloadType returns the type of a payload field member of i if there is one, or "".

func Unmarshal

func Unmarshal(r *request.Request)

Unmarshal unmarshals the REST component of a response in a REST service.

func UnmarshalMeta

func UnmarshalMeta(r *request.Request)

UnmarshalMeta unmarshals the REST metadata of a response in a REST service

Types

type Encoder added in v0.3.0

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

An Encoder provides encoding of REST URI path, query, and header components of an HTTP request. Can also encode a stream as the payload.

Does not support SetFields.

func NewEncoder added in v0.3.0

func NewEncoder(req *http.Request) *Encoder

NewEncoder creates a new encoder from the passed in request. All query and header values will be added on top of the request's existing values. Overwriting duplicate values.

func (*Encoder) Encode added in v0.3.0

func (e *Encoder) Encode() (*http.Request, io.ReadSeeker, error)

Encode will return the request and body if one was set. If the body payload was not set the io.ReadSeeker will be nil.

returns any error if one occured while encoding the API's parameters.

func (*Encoder) List added in v0.3.0

List will set the nested list values to the header or query.

func (*Encoder) Map added in v0.3.0

Map will set the nested map values to the header or query.

func (*Encoder) SetFields added in v0.3.0

func (e *Encoder) SetFields(t protocol.Target, k string, m protocol.FieldMarshaler, meta protocol.Metadata)

SetFields is not supported for REST encoder.

func (*Encoder) SetStream added in v0.3.0

func (e *Encoder) SetStream(t protocol.Target, k string, v protocol.StreamMarshaler, meta protocol.Metadata)

SetStream will set the stream to the payload of the request.

func (*Encoder) SetValue added in v0.3.0

SetValue will set a value to the header, path, query.

If the request's method is GET all BodyTarget values will be written to the query string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL