diff options
author | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-08-09 15:59:15 +0200 |
---|---|---|
committer | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-08-09 16:39:21 +0200 |
commit | 863486a6b71ed0e562a3965bed56465d007b1418 (patch) | |
tree | e93f6a687695af86d54237ec9f575d4ef104222d /vendor/github.com/aws/aws-sdk-go/private/protocol/rest | |
parent | 49c1c7b4dc69ffb9ab52330e6dc52ccdd6351087 (diff) | |
download | terraform-provider-statuscake-add_contact_groups.tar.gz terraform-provider-statuscake-add_contact_groups.tar.zst terraform-provider-statuscake-add_contact_groups.zip |
update vendor and go.modadd_contact_groups
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.go | 20 | ||||
-rw-r--r-- | vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go | 12 |
2 files changed, 21 insertions, 11 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 b80f84f..1301b14 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 | |||
@@ -25,6 +25,8 @@ var noEscape [256]bool | |||
25 | 25 | ||
26 | var errValueNotSet = fmt.Errorf("value not set") | 26 | var errValueNotSet = fmt.Errorf("value not set") |
27 | 27 | ||
28 | var byteSliceType = reflect.TypeOf([]byte{}) | ||
29 | |||
28 | func init() { | 30 | func init() { |
29 | for i := 0; i < len(noEscape); i++ { | 31 | for i := 0; i < len(noEscape); i++ { |
30 | // AWS expects every character except these to be escaped | 32 | // AWS expects every character except these to be escaped |
@@ -94,6 +96,14 @@ func buildLocationElements(r *request.Request, v reflect.Value, buildGETQuery bo | |||
94 | continue | 96 | continue |
95 | } | 97 | } |
96 | 98 | ||
99 | // Support the ability to customize values to be marshaled as a | ||
100 | // blob even though they were modeled as a string. Required for S3 | ||
101 | // API operations like SSECustomerKey is modeled as stirng but | ||
102 | // required to be base64 encoded in request. | ||
103 | if field.Tag.Get("marshal-as") == "blob" { | ||
104 | m = m.Convert(byteSliceType) | ||
105 | } | ||
106 | |||
97 | var err error | 107 | var err error |
98 | switch field.Tag.Get("location") { | 108 | switch field.Tag.Get("location") { |
99 | case "headers": // header maps | 109 | case "headers": // header maps |
@@ -137,7 +147,7 @@ func buildBody(r *request.Request, v reflect.Value) { | |||
137 | case string: | 147 | case string: |
138 | r.SetStringBody(reader) | 148 | r.SetStringBody(reader) |
139 | default: | 149 | default: |
140 | r.Error = awserr.New("SerializationError", | 150 | r.Error = awserr.New(request.ErrCodeSerialization, |
141 | "failed to encode REST request", | 151 | "failed to encode REST request", |
142 | fmt.Errorf("unknown payload type %s", payload.Type())) | 152 | fmt.Errorf("unknown payload type %s", payload.Type())) |
143 | } | 153 | } |
@@ -152,7 +162,7 @@ func buildHeader(header *http.Header, v reflect.Value, name string, tag reflect. | |||
152 | if err == errValueNotSet { | 162 | if err == errValueNotSet { |
153 | return nil | 163 | return nil |
154 | } else if err != nil { | 164 | } else if err != nil { |
155 | return awserr.New("SerializationError", "failed to encode REST request", err) | 165 | return awserr.New(request.ErrCodeSerialization, "failed to encode REST request", err) |
156 | } | 166 | } |
157 | 167 | ||
158 | name = strings.TrimSpace(name) | 168 | name = strings.TrimSpace(name) |
@@ -170,7 +180,7 @@ func buildHeaderMap(header *http.Header, v reflect.Value, tag reflect.StructTag) | |||
170 | if err == errValueNotSet { | 180 | if err == errValueNotSet { |
171 | continue | 181 | continue |
172 | } else if err != nil { | 182 | } else if err != nil { |
173 | return awserr.New("SerializationError", "failed to encode REST request", err) | 183 | return awserr.New(request.ErrCodeSerialization, "failed to encode REST request", err) |
174 | 184 | ||
175 | } | 185 | } |
176 | keyStr := strings.TrimSpace(key.String()) | 186 | keyStr := strings.TrimSpace(key.String()) |
@@ -186,7 +196,7 @@ func buildURI(u *url.URL, v reflect.Value, name string, tag reflect.StructTag) e | |||
186 | if err == errValueNotSet { | 196 | if err == errValueNotSet { |
187 | return nil | 197 | return nil |
188 | } else if err != nil { | 198 | } else if err != nil { |
189 | return awserr.New("SerializationError", "failed to encode REST request", err) | 199 | return awserr.New(request.ErrCodeSerialization, "failed to encode REST request", err) |
190 | } | 200 | } |
191 | 201 | ||
192 | u.Path = strings.Replace(u.Path, "{"+name+"}", value, -1) | 202 | u.Path = strings.Replace(u.Path, "{"+name+"}", value, -1) |
@@ -219,7 +229,7 @@ func buildQueryString(query url.Values, v reflect.Value, name string, tag reflec | |||
219 | if err == errValueNotSet { | 229 | if err == errValueNotSet { |
220 | return nil | 230 | return nil |
221 | } else if err != nil { | 231 | } else if err != nil { |
222 | return awserr.New("SerializationError", "failed to encode REST request", err) | 232 | return awserr.New(request.ErrCodeSerialization, "failed to encode REST request", err) |
223 | } | 233 | } |
224 | query.Set(name, str) | 234 | query.Set(name, str) |
225 | } | 235 | } |
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 33fd53b..de02136 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 | |||
@@ -57,7 +57,7 @@ func unmarshalBody(r *request.Request, v reflect.Value) { | |||
57 | defer r.HTTPResponse.Body.Close() | 57 | defer r.HTTPResponse.Body.Close() |
58 | b, err := ioutil.ReadAll(r.HTTPResponse.Body) | 58 | b, err := ioutil.ReadAll(r.HTTPResponse.Body) |
59 | if err != nil { | 59 | if err != nil { |
60 | r.Error = awserr.New("SerializationError", "failed to decode REST response", err) | 60 | r.Error = awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err) |
61 | } else { | 61 | } else { |
62 | payload.Set(reflect.ValueOf(b)) | 62 | payload.Set(reflect.ValueOf(b)) |
63 | } | 63 | } |
@@ -65,7 +65,7 @@ func unmarshalBody(r *request.Request, v reflect.Value) { | |||
65 | defer r.HTTPResponse.Body.Close() | 65 | defer r.HTTPResponse.Body.Close() |
66 | b, err := ioutil.ReadAll(r.HTTPResponse.Body) | 66 | b, err := ioutil.ReadAll(r.HTTPResponse.Body) |
67 | if err != nil { | 67 | if err != nil { |
68 | r.Error = awserr.New("SerializationError", "failed to decode REST response", err) | 68 | r.Error = awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err) |
69 | } else { | 69 | } else { |
70 | str := string(b) | 70 | str := string(b) |
71 | payload.Set(reflect.ValueOf(&str)) | 71 | payload.Set(reflect.ValueOf(&str)) |
@@ -77,7 +77,7 @@ func unmarshalBody(r *request.Request, v reflect.Value) { | |||
77 | case "io.ReadSeeker": | 77 | case "io.ReadSeeker": |
78 | b, err := ioutil.ReadAll(r.HTTPResponse.Body) | 78 | b, err := ioutil.ReadAll(r.HTTPResponse.Body) |
79 | if err != nil { | 79 | if err != nil { |
80 | r.Error = awserr.New("SerializationError", | 80 | r.Error = awserr.New(request.ErrCodeSerialization, |
81 | "failed to read response body", err) | 81 | "failed to read response body", err) |
82 | return | 82 | return |
83 | } | 83 | } |
@@ -85,7 +85,7 @@ func unmarshalBody(r *request.Request, v reflect.Value) { | |||
85 | default: | 85 | default: |
86 | io.Copy(ioutil.Discard, r.HTTPResponse.Body) | 86 | io.Copy(ioutil.Discard, r.HTTPResponse.Body) |
87 | defer r.HTTPResponse.Body.Close() | 87 | defer r.HTTPResponse.Body.Close() |
88 | r.Error = awserr.New("SerializationError", | 88 | r.Error = awserr.New(request.ErrCodeSerialization, |
89 | "failed to decode REST response", | 89 | "failed to decode REST response", |
90 | fmt.Errorf("unknown payload type %s", payload.Type())) | 90 | fmt.Errorf("unknown payload type %s", payload.Type())) |
91 | } | 91 | } |
@@ -115,14 +115,14 @@ func unmarshalLocationElements(r *request.Request, v reflect.Value) { | |||
115 | case "header": | 115 | case "header": |
116 | err := unmarshalHeader(m, r.HTTPResponse.Header.Get(name), field.Tag) | 116 | err := unmarshalHeader(m, r.HTTPResponse.Header.Get(name), field.Tag) |
117 | if err != nil { | 117 | if err != nil { |
118 | r.Error = awserr.New("SerializationError", "failed to decode REST response", err) | 118 | r.Error = awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err) |
119 | break | 119 | break |
120 | } | 120 | } |
121 | case "headers": | 121 | case "headers": |
122 | prefix := field.Tag.Get("locationName") | 122 | prefix := field.Tag.Get("locationName") |
123 | err := unmarshalHeaderMap(m, r.HTTPResponse.Header, prefix) | 123 | err := unmarshalHeaderMap(m, r.HTTPResponse.Header, prefix) |
124 | if err != nil { | 124 | if err != nil { |
125 | r.Error = awserr.New("SerializationError", "failed to decode REST response", err) | 125 | r.Error = awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err) |
126 | break | 126 | break |
127 | } | 127 | } |
128 | } | 128 | } |