diff options
author | Alex Pilon <apilon@hashicorp.com> | 2019-02-22 18:24:37 -0500 |
---|---|---|
committer | Alex Pilon <apilon@hashicorp.com> | 2019-02-22 18:24:37 -0500 |
commit | 15c0b25d011f37e7c20aeca9eaf461f78285b8d9 (patch) | |
tree | 255c250a5c9d4801c74092d33b7337d8c14438ff /vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go | |
parent | 07971ca38143c5faf951d152fba370ddcbe26ad5 (diff) | |
download | terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.tar.gz terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.tar.zst terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.zip |
deps: github.com/hashicorp/terraform@sdk-v0.11-with-go-modules
Updated via: go get github.com/hashicorp/terraform@sdk-v0.11-with-go-modules and go mod tidy
Diffstat (limited to 'vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go')
-rw-r--r-- | vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go index 8758462..ff1ef68 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go | |||
@@ -9,6 +9,8 @@ import ( | |||
9 | "strconv" | 9 | "strconv" |
10 | "strings" | 10 | "strings" |
11 | "time" | 11 | "time" |
12 | |||
13 | "github.com/aws/aws-sdk-go/private/protocol" | ||
12 | ) | 14 | ) |
13 | 15 | ||
14 | // UnmarshalXML deserializes an xml.Decoder into the container v. V | 16 | // UnmarshalXML deserializes an xml.Decoder into the container v. V |
@@ -52,9 +54,15 @@ func parse(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { | |||
52 | if t == "" { | 54 | if t == "" { |
53 | switch rtype.Kind() { | 55 | switch rtype.Kind() { |
54 | case reflect.Struct: | 56 | case reflect.Struct: |
55 | t = "structure" | 57 | // also it can't be a time object |
58 | if _, ok := r.Interface().(*time.Time); !ok { | ||
59 | t = "structure" | ||
60 | } | ||
56 | case reflect.Slice: | 61 | case reflect.Slice: |
57 | t = "list" | 62 | // also it can't be a byte slice |
63 | if _, ok := r.Interface().([]byte); !ok { | ||
64 | t = "list" | ||
65 | } | ||
58 | case reflect.Map: | 66 | case reflect.Map: |
59 | t = "map" | 67 | t = "map" |
60 | } | 68 | } |
@@ -247,8 +255,12 @@ func parseScalar(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { | |||
247 | } | 255 | } |
248 | r.Set(reflect.ValueOf(&v)) | 256 | r.Set(reflect.ValueOf(&v)) |
249 | case *time.Time: | 257 | case *time.Time: |
250 | const ISO8601UTC = "2006-01-02T15:04:05Z" | 258 | format := tag.Get("timestampFormat") |
251 | t, err := time.Parse(ISO8601UTC, node.Text) | 259 | if len(format) == 0 { |
260 | format = protocol.ISO8601TimeFormatName | ||
261 | } | ||
262 | |||
263 | t, err := protocol.ParseTime(format, node.Text) | ||
252 | if err != nil { | 264 | if err != nil { |
253 | return err | 265 | return err |
254 | } | 266 | } |