// Build builds a request for the REST JSON protocol. func Build(r *aws.Request) { rest.Build(r) if t := rest.PayloadType(r.Params); t == "structure" || t == "" { jsonrpc.Build(r) } }
// Unmarshal unmarshals a payload response for the REST XML protocol. func Unmarshal(r *aws.Request) { if t := rest.PayloadType(r.Data); t == "structure" || t == "" { defer r.HTTPResponse.Body.Close() decoder := xml.NewDecoder(r.HTTPResponse.Body) err := xmlutil.UnmarshalXML(r.Data, decoder, "") if err != nil { r.Error = apierr.New("Unmarshal", "failed to decode REST XML response", err) return } } }
// Build builds a request payload for the REST XML protocol. func Build(r *aws.Request) { rest.Build(r) if t := rest.PayloadType(r.Params); t == "structure" || t == "" { var buf bytes.Buffer err := xmlutil.BuildXML(r.Params, xml.NewEncoder(&buf)) if err != nil { r.Error = apierr.New("Marshal", "failed to enode rest XML request", err) return } r.SetBufferBody(buf.Bytes()) } }
// Unmarshal unmarshals a response body for the REST JSON protocol. func Unmarshal(r *aws.Request) { if t := rest.PayloadType(r.Data); t == "structure" || t == "" { jsonrpc.Unmarshal(r) } }