]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blame - vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go
Merge pull request #27 from terraform-providers/go-modules-2019-02-22
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / aws / aws-sdk-go / private / protocol / query / unmarshal.go
CommitLineData
bae9f6d2
JC
1package query
2
3//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/query.json unmarshal_test.go
4
5import (
6 "encoding/xml"
7
8 "github.com/aws/aws-sdk-go/aws/awserr"
9 "github.com/aws/aws-sdk-go/aws/request"
10 "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil"
11)
12
13// UnmarshalHandler is a named request handler for unmarshaling query protocol requests
14var UnmarshalHandler = request.NamedHandler{Name: "awssdk.query.Unmarshal", Fn: Unmarshal}
15
16// UnmarshalMetaHandler is a named request handler for unmarshaling query protocol request metadata
17var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalMeta", Fn: UnmarshalMeta}
18
19// Unmarshal unmarshals a response for an AWS Query service.
20func Unmarshal(r *request.Request) {
21 defer r.HTTPResponse.Body.Close()
22 if r.DataFilled() {
23 decoder := xml.NewDecoder(r.HTTPResponse.Body)
24 err := xmlutil.UnmarshalXML(r.Data, decoder, r.Operation.Name+"Result")
25 if err != nil {
26 r.Error = awserr.New("SerializationError", "failed decoding Query response", err)
27 return
28 }
29 }
30}
31
32// UnmarshalMeta unmarshals header response values for an AWS Query service.
33func UnmarshalMeta(r *request.Request) {
34 r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid")
35}