mirror of
https://github.com/thegeeklab/drone-s3-sync.git
synced 2024-11-06 09:10:40 +00:00
30 lines
896 B
Go
30 lines
896 B
Go
|
package query
|
||
|
|
||
|
//go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/query.json unmarshal_test.go
|
||
|
|
||
|
import (
|
||
|
"encoding/xml"
|
||
|
|
||
|
"github.com/aws/aws-sdk-go/aws/awserr"
|
||
|
"github.com/aws/aws-sdk-go/aws/request"
|
||
|
"github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil"
|
||
|
)
|
||
|
|
||
|
// Unmarshal unmarshals a response for an AWS Query service.
|
||
|
func Unmarshal(r *request.Request) {
|
||
|
defer r.HTTPResponse.Body.Close()
|
||
|
if r.DataFilled() {
|
||
|
decoder := xml.NewDecoder(r.HTTPResponse.Body)
|
||
|
err := xmlutil.UnmarshalXML(r.Data, decoder, r.Operation.Name+"Result")
|
||
|
if err != nil {
|
||
|
r.Error = awserr.New("SerializationError", "failed decoding Query response", err)
|
||
|
return
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// UnmarshalMeta unmarshals header response values for an AWS Query service.
|
||
|
func UnmarshalMeta(r *request.Request) {
|
||
|
r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid")
|
||
|
}
|