3 //go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/query.json unmarshal_test.go
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"
13 // UnmarshalHandler is a named request handler for unmarshaling query protocol requests
14 var UnmarshalHandler = request.NamedHandler{Name: "awssdk.query.Unmarshal", Fn: Unmarshal}
16 // UnmarshalMetaHandler is a named request handler for unmarshaling query protocol request metadata
17 var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalMeta", Fn: UnmarshalMeta}
19 // Unmarshal unmarshals a response for an AWS Query service.
20 func Unmarshal(r *request.Request) {
21 defer r.HTTPResponse.Body.Close()
23 decoder := xml.NewDecoder(r.HTTPResponse.Body)
24 err := xmlutil.UnmarshalXML(r.Data, decoder, r.Operation.Name+"Result")
26 r.Error = awserr.NewRequestFailure(
27 awserr.New(request.ErrCodeSerialization, "failed decoding Query response", err),
28 r.HTTPResponse.StatusCode,
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")