]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blob - vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / aws / aws-sdk-go / private / protocol / query / unmarshal.go
1 package query
2
3 //go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/query.json unmarshal_test.go
4
5 import (
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
14 var UnmarshalHandler = request.NamedHandler{Name: "awssdk.query.Unmarshal", Fn: Unmarshal}
15
16 // UnmarshalMetaHandler is a named request handler for unmarshaling query protocol request metadata
17 var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalMeta", Fn: UnmarshalMeta}
18
19 // Unmarshal unmarshals a response for an AWS Query service.
20 func 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.NewRequestFailure(
27 awserr.New("SerializationError", "failed decoding Query response", err),
28 r.HTTPResponse.StatusCode,
29 r.RequestID,
30 )
31 return
32 }
33 }
34 }
35
36 // UnmarshalMeta unmarshals header response values for an AWS Query service.
37 func UnmarshalMeta(r *request.Request) {
38 r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid")
39 }