diff options
Diffstat (limited to 'vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go')
-rw-r--r-- | vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go index 7091b45..07764c8 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go | |||
@@ -13,9 +13,13 @@ import ( | |||
13 | "github.com/aws/aws-sdk-go/private/protocol" | 13 | "github.com/aws/aws-sdk-go/private/protocol" |
14 | ) | 14 | ) |
15 | 15 | ||
16 | // BuildXML will serialize params into an xml.Encoder. | 16 | // BuildXML will serialize params into an xml.Encoder. Error will be returned |
17 | // Error will be returned if the serialization of any of the params or nested values fails. | 17 | // if the serialization of any of the params or nested values fails. |
18 | func BuildXML(params interface{}, e *xml.Encoder) error { | 18 | func BuildXML(params interface{}, e *xml.Encoder) error { |
19 | return buildXML(params, e, false) | ||
20 | } | ||
21 | |||
22 | func buildXML(params interface{}, e *xml.Encoder, sorted bool) error { | ||
19 | b := xmlBuilder{encoder: e, namespaces: map[string]string{}} | 23 | b := xmlBuilder{encoder: e, namespaces: map[string]string{}} |
20 | root := NewXMLElement(xml.Name{}) | 24 | root := NewXMLElement(xml.Name{}) |
21 | if err := b.buildValue(reflect.ValueOf(params), root, ""); err != nil { | 25 | if err := b.buildValue(reflect.ValueOf(params), root, ""); err != nil { |
@@ -23,7 +27,7 @@ func BuildXML(params interface{}, e *xml.Encoder) error { | |||
23 | } | 27 | } |
24 | for _, c := range root.Children { | 28 | for _, c := range root.Children { |
25 | for _, v := range c { | 29 | for _, v := range c { |
26 | return StructToXML(e, v, false) | 30 | return StructToXML(e, v, sorted) |
27 | } | 31 | } |
28 | } | 32 | } |
29 | return nil | 33 | return nil |
@@ -278,8 +282,12 @@ func (b *xmlBuilder) buildScalar(value reflect.Value, current *XMLNode, tag refl | |||
278 | case float32: | 282 | case float32: |
279 | str = strconv.FormatFloat(float64(converted), 'f', -1, 32) | 283 | str = strconv.FormatFloat(float64(converted), 'f', -1, 32) |
280 | case time.Time: | 284 | case time.Time: |
281 | const ISO8601UTC = "2006-01-02T15:04:05Z" | 285 | format := tag.Get("timestampFormat") |
282 | str = converted.UTC().Format(ISO8601UTC) | 286 | if len(format) == 0 { |
287 | format = protocol.ISO8601TimeFormatName | ||
288 | } | ||
289 | |||
290 | str = protocol.FormatTime(format, converted) | ||
283 | default: | 291 | default: |
284 | return fmt.Errorf("unsupported value for param %s: %v (%s)", | 292 | return fmt.Errorf("unsupported value for param %s: %v (%s)", |
285 | tag.Get("locationName"), value.Interface(), value.Type().Name()) | 293 | tag.Get("locationName"), value.Interface(), value.Type().Name()) |