restjson

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package restjson provides RESTful JSON serialization of AWS requests and responses.

Index

Constants

This section is empty.

Variables

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

BuildHandler is a named request handler for building restjson protocol requests

View Source
var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.restjson.UnmarshalError", Fn: UnmarshalError}

UnmarshalErrorHandler is a named request handler for unmarshaling restjson protocol request errors

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

UnmarshalHandler is a named request handler for unmarshaling restjson protocol requests

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

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

Functions

func Build

func Build(r *request.Request)

Build builds a request for the REST JSON protocol.

func Unmarshal

func Unmarshal(r *request.Request)

Unmarshal unmarshals a response body for the REST JSON protocol.

func UnmarshalError

func UnmarshalError(r *request.Request)

UnmarshalError unmarshals a response error for the REST JSON protocol.

func UnmarshalMeta

func UnmarshalMeta(r *request.Request)

UnmarshalMeta unmarshals response headers for the REST JSON protocol.

Types

type Encoder

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

An Encoder provides encoding of the AWS RESTJSON protocol. This encoder combindes the JSON and REST encoders deligating to them for their associated targets.

It is invalid to set a JSON and stream payload on the same encoder.

func NewEncoder

func NewEncoder(req *http.Request) *Encoder

NewEncoder creates a new encoder for encoding the AWS RESTJSON protocol. The request passed in will be the base the path, query, and headers encoded will be set on top of.

func (*Encoder) Encode

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

Encode returns the encoded request, and body payload. If no payload body was set nil will be returned. If an error occurred while encoding the API an error will be returned.

func (*Encoder) List

List will return the proper list encoder based on the given protocol.Target.

func (*Encoder) Map

Map will return the proper map encoder based on the given protocol Target.

func (*Encoder) SetFields

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

SetFields will set the nested type's fields to the body.

func (*Encoder) SetStream

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

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

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