aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/aws/aws-sdk-go/private/protocol/rest
diff options
context:
space:
mode:
authorappilon <apilon@hashicorp.com>2019-02-27 16:43:31 -0500
committerGitHub <noreply@github.com>2019-02-27 16:43:31 -0500
commit844b5a68d8af4791755b8f0ad293cc99f5959183 (patch)
tree255c250a5c9d4801c74092d33b7337d8c14438ff /vendor/github.com/aws/aws-sdk-go/private/protocol/rest
parent303b299eeb6b06e939e35905e4b34cb410dd9dc3 (diff)
parent15c0b25d011f37e7c20aeca9eaf461f78285b8d9 (diff)
downloadterraform-provider-statuscake-844b5a68d8af4791755b8f0ad293cc99f5959183.tar.gz
terraform-provider-statuscake-844b5a68d8af4791755b8f0ad293cc99f5959183.tar.zst
terraform-provider-statuscake-844b5a68d8af4791755b8f0ad293cc99f5959183.zip
Merge pull request #27 from terraform-providers/go-modules-2019-02-22
[MODULES] Switch to Go Modules
Diffstat (limited to 'vendor/github.com/aws/aws-sdk-go/private/protocol/rest')
-rw-r--r--vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go33
-rw-r--r--vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go20
2 files changed, 28 insertions, 25 deletions
diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go
index 7161835..b34f525 100644
--- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go
+++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go
@@ -4,7 +4,6 @@ package rest
4import ( 4import (
5 "bytes" 5 "bytes"
6 "encoding/base64" 6 "encoding/base64"
7 "encoding/json"
8 "fmt" 7 "fmt"
9 "io" 8 "io"
10 "net/http" 9 "net/http"
@@ -18,11 +17,9 @@ import (
18 "github.com/aws/aws-sdk-go/aws" 17 "github.com/aws/aws-sdk-go/aws"
19 "github.com/aws/aws-sdk-go/aws/awserr" 18 "github.com/aws/aws-sdk-go/aws/awserr"
20 "github.com/aws/aws-sdk-go/aws/request" 19 "github.com/aws/aws-sdk-go/aws/request"
20 "github.com/aws/aws-sdk-go/private/protocol"
21) 21)
22 22
23// RFC822 returns an RFC822 formatted timestamp for AWS protocols
24const RFC822 = "Mon, 2 Jan 2006 15:04:05 GMT"
25
26// Whether the byte value can be sent without escaping in AWS URLs 23// Whether the byte value can be sent without escaping in AWS URLs
27var noEscape [256]bool 24var noEscape [256]bool
28 25
@@ -252,13 +249,12 @@ func EscapePath(path string, encodeSep bool) string {
252 return buf.String() 249 return buf.String()
253} 250}
254 251
255func convertType(v reflect.Value, tag reflect.StructTag) (string, error) { 252func convertType(v reflect.Value, tag reflect.StructTag) (str string, err error) {
256 v = reflect.Indirect(v) 253 v = reflect.Indirect(v)
257 if !v.IsValid() { 254 if !v.IsValid() {
258 return "", errValueNotSet 255 return "", errValueNotSet
259 } 256 }
260 257
261 var str string
262 switch value := v.Interface().(type) { 258 switch value := v.Interface().(type) {
263 case string: 259 case string:
264 str = value 260 str = value
@@ -271,19 +267,28 @@ func convertType(v reflect.Value, tag reflect.StructTag) (string, error) {
271 case float64: 267 case float64:
272 str = strconv.FormatFloat(value, 'f', -1, 64) 268 str = strconv.FormatFloat(value, 'f', -1, 64)
273 case time.Time: 269 case time.Time:
274 str = value.UTC().Format(RFC822) 270 format := tag.Get("timestampFormat")
271 if len(format) == 0 {
272 format = protocol.RFC822TimeFormatName
273 if tag.Get("location") == "querystring" {
274 format = protocol.ISO8601TimeFormatName
275 }
276 }
277 str = protocol.FormatTime(format, value)
275 case aws.JSONValue: 278 case aws.JSONValue:
276 b, err := json.Marshal(value) 279 if len(value) == 0 {
277 if err != nil { 280 return "", errValueNotSet
278 return "", err
279 } 281 }
282 escaping := protocol.NoEscape
280 if tag.Get("location") == "header" { 283 if tag.Get("location") == "header" {
281 str = base64.StdEncoding.EncodeToString(b) 284 escaping = protocol.Base64Escape
282 } else { 285 }
283 str = string(b) 286 str, err = protocol.EncodeJSONValue(value, escaping)
287 if err != nil {
288 return "", fmt.Errorf("unable to encode JSONValue, %v", err)
284 } 289 }
285 default: 290 default:
286 err := fmt.Errorf("Unsupported value for param %v (%s)", v.Interface(), v.Type()) 291 err := fmt.Errorf("unsupported value for param %v (%s)", v.Interface(), v.Type())
287 return "", err 292 return "", err
288 } 293 }
289 return str, nil 294 return str, nil
diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go
index 7a779ee..33fd53b 100644
--- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go
+++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go
@@ -3,7 +3,6 @@ package rest
3import ( 3import (
4 "bytes" 4 "bytes"
5 "encoding/base64" 5 "encoding/base64"
6 "encoding/json"
7 "fmt" 6 "fmt"
8 "io" 7 "io"
9 "io/ioutil" 8 "io/ioutil"
@@ -16,6 +15,7 @@ import (
16 "github.com/aws/aws-sdk-go/aws" 15 "github.com/aws/aws-sdk-go/aws"
17 "github.com/aws/aws-sdk-go/aws/awserr" 16 "github.com/aws/aws-sdk-go/aws/awserr"
18 "github.com/aws/aws-sdk-go/aws/request" 17 "github.com/aws/aws-sdk-go/aws/request"
18 "github.com/aws/aws-sdk-go/private/protocol"
19) 19)
20 20
21// UnmarshalHandler is a named request handler for unmarshaling rest protocol requests 21// UnmarshalHandler is a named request handler for unmarshaling rest protocol requests
@@ -198,23 +198,21 @@ func unmarshalHeader(v reflect.Value, header string, tag reflect.StructTag) erro
198 } 198 }
199 v.Set(reflect.ValueOf(&f)) 199 v.Set(reflect.ValueOf(&f))
200 case *time.Time: 200 case *time.Time:
201 t, err := time.Parse(RFC822, header) 201 format := tag.Get("timestampFormat")
202 if len(format) == 0 {
203 format = protocol.RFC822TimeFormatName
204 }
205 t, err := protocol.ParseTime(format, header)
202 if err != nil { 206 if err != nil {
203 return err 207 return err
204 } 208 }
205 v.Set(reflect.ValueOf(&t)) 209 v.Set(reflect.ValueOf(&t))
206 case aws.JSONValue: 210 case aws.JSONValue:
207 b := []byte(header) 211 escaping := protocol.NoEscape
208 var err error
209 if tag.Get("location") == "header" { 212 if tag.Get("location") == "header" {
210 b, err = base64.StdEncoding.DecodeString(header) 213 escaping = protocol.Base64Escape
211 if err != nil {
212 return err
213 }
214 } 214 }
215 215 m, err := protocol.DecodeJSONValue(header, escaping)
216 m := aws.JSONValue{}
217 err = json.Unmarshal(b, &m)
218 if err != nil { 216 if err != nil {
219 return err 217 return err
220 } 218 }