Bump AWS libraries to latest
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
3
vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go
generated
vendored
3
vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go
generated
vendored
@@ -4,6 +4,7 @@ package ec2query
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"strings"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
@@ -70,7 +71,7 @@ func UnmarshalError(r *request.Request) {
|
||||
}
|
||||
|
||||
r.Error = awserr.NewRequestFailure(
|
||||
awserr.New(respErr.Code, respErr.Message, nil),
|
||||
awserr.New(strings.TrimSpace(respErr.Code), strings.TrimSpace(respErr.Message), nil),
|
||||
r.HTTPResponse.StatusCode,
|
||||
respErr.RequestID,
|
||||
)
|
||||
|
10
vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go
generated
vendored
10
vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go
generated
vendored
@@ -82,13 +82,17 @@ func buildStruct(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag)
|
||||
field, _ := value.Type().FieldByName(payload)
|
||||
tag = field.Tag
|
||||
value = elemOf(value.FieldByName(payload))
|
||||
|
||||
if !value.IsValid() {
|
||||
if !value.IsValid() && tag.Get("type") != "structure" {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
buf.WriteByte('{')
|
||||
defer buf.WriteString("}")
|
||||
|
||||
if !value.IsValid() {
|
||||
return nil
|
||||
}
|
||||
|
||||
t := value.Type()
|
||||
first := true
|
||||
@@ -144,8 +148,6 @@ func buildStruct(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag)
|
||||
|
||||
}
|
||||
|
||||
buf.WriteString("}")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
5
vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go
generated
vendored
5
vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go
generated
vendored
@@ -49,9 +49,8 @@ func Build(req *request.Request) {
|
||||
buf = emptyJSON
|
||||
}
|
||||
|
||||
if req.ClientInfo.TargetPrefix != "" || string(buf) != "{}" {
|
||||
req.SetBufferBody(buf)
|
||||
}
|
||||
// Always serialize the body, don't suppress it.
|
||||
req.SetBufferBody(buf)
|
||||
|
||||
if req.ClientInfo.TargetPrefix != "" {
|
||||
target := req.ClientInfo.TargetPrefix + "." + req.Operation.Name
|
||||
|
3
vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go
generated
vendored
3
vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go
generated
vendored
@@ -3,6 +3,7 @@ package query
|
||||
import (
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
@@ -62,7 +63,7 @@ func UnmarshalError(r *request.Request) {
|
||||
}
|
||||
|
||||
r.Error = awserr.NewRequestFailure(
|
||||
awserr.New(respErr.Code, respErr.Message, nil),
|
||||
awserr.New(strings.TrimSpace(respErr.Code), strings.TrimSpace(respErr.Message), nil),
|
||||
r.HTTPResponse.StatusCode,
|
||||
reqID,
|
||||
)
|
||||
|
25
vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go
generated
vendored
25
vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go
generated
vendored
@@ -98,7 +98,7 @@ func buildLocationElements(r *request.Request, v reflect.Value, buildGETQuery bo
|
||||
|
||||
// Support the ability to customize values to be marshaled as a
|
||||
// blob even though they were modeled as a string. Required for S3
|
||||
// API operations like SSECustomerKey is modeled as stirng but
|
||||
// API operations like SSECustomerKey is modeled as string but
|
||||
// required to be base64 encoded in request.
|
||||
if field.Tag.Get("marshal-as") == "blob" {
|
||||
m = m.Convert(byteSliceType)
|
||||
@@ -272,7 +272,29 @@ func convertType(v reflect.Value, tag reflect.StructTag) (str string, err error)
|
||||
|
||||
switch value := v.Interface().(type) {
|
||||
case string:
|
||||
if tag.Get("suppressedJSONValue") == "true" && tag.Get("location") == "header" {
|
||||
value = base64.StdEncoding.EncodeToString([]byte(value))
|
||||
}
|
||||
str = value
|
||||
case []*string:
|
||||
if tag.Get("location") != "header" || tag.Get("enum") == "" {
|
||||
return "", fmt.Errorf("%T is only supported with location header and enum shapes", value)
|
||||
}
|
||||
buff := &bytes.Buffer{}
|
||||
for i, sv := range value {
|
||||
if sv == nil || len(*sv) == 0 {
|
||||
continue
|
||||
}
|
||||
if i != 0 {
|
||||
buff.WriteRune(',')
|
||||
}
|
||||
item := *sv
|
||||
if strings.Index(item, `,`) != -1 || strings.Index(item, `"`) != -1 {
|
||||
item = strconv.Quote(item)
|
||||
}
|
||||
buff.WriteString(item)
|
||||
}
|
||||
str = string(buff.Bytes())
|
||||
case []byte:
|
||||
str = base64.StdEncoding.EncodeToString(value)
|
||||
case bool:
|
||||
@@ -306,5 +328,6 @@ func convertType(v reflect.Value, tag reflect.StructTag) (str string, err error)
|
||||
err := fmt.Errorf("unsupported value for param %v (%s)", v.Interface(), v.Type())
|
||||
return "", err
|
||||
}
|
||||
|
||||
return str, nil
|
||||
}
|
||||
|
11
vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go
generated
vendored
11
vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go
generated
vendored
@@ -28,18 +28,27 @@ func PayloadMember(i interface{}) interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// PayloadType returns the type of a payload field member of i if there is one, or "".
|
||||
const nopayloadPayloadType = "nopayload"
|
||||
|
||||
// PayloadType returns the type of a payload field member of i if there is one,
|
||||
// or "".
|
||||
func PayloadType(i interface{}) string {
|
||||
v := reflect.Indirect(reflect.ValueOf(i))
|
||||
if !v.IsValid() {
|
||||
return ""
|
||||
}
|
||||
|
||||
if field, ok := v.Type().FieldByName("_"); ok {
|
||||
if noPayload := field.Tag.Get(nopayloadPayloadType); noPayload != "" {
|
||||
return nopayloadPayloadType
|
||||
}
|
||||
|
||||
if payloadName := field.Tag.Get("payload"); payloadName != "" {
|
||||
if member, ok := v.Type().FieldByName(payloadName); ok {
|
||||
return member.Tag.Get("type")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
9
vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go
generated
vendored
9
vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go
generated
vendored
@@ -140,7 +140,7 @@ func unmarshalLocationElements(resp *http.Response, v reflect.Value, lowerCaseHe
|
||||
prefix := field.Tag.Get("locationName")
|
||||
err := unmarshalHeaderMap(m, resp.Header, prefix, lowerCaseHeaderMaps)
|
||||
if err != nil {
|
||||
awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err)
|
||||
return awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,6 +204,13 @@ func unmarshalHeader(v reflect.Value, header string, tag reflect.StructTag) erro
|
||||
|
||||
switch v.Interface().(type) {
|
||||
case *string:
|
||||
if tag.Get("suppressedJSONValue") == "true" && tag.Get("location") == "header" {
|
||||
b, err := base64.StdEncoding.DecodeString(header)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to decode JSONValue, %v", err)
|
||||
}
|
||||
header = string(b)
|
||||
}
|
||||
v.Set(reflect.ValueOf(&header))
|
||||
case []byte:
|
||||
b, err := base64.StdEncoding.DecodeString(header)
|
||||
|
61
vendor/github.com/aws/aws-sdk-go/private/protocol/timestamp.go
generated
vendored
61
vendor/github.com/aws/aws-sdk-go/private/protocol/timestamp.go
generated
vendored
@@ -1,6 +1,8 @@
|
||||
package protocol
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"math"
|
||||
"strconv"
|
||||
"time"
|
||||
@@ -19,13 +21,16 @@ const (
|
||||
// Output time is intended to not contain decimals
|
||||
const (
|
||||
// RFC 7231#section-7.1.1.1 timetamp format. e.g Tue, 29 Apr 2014 18:30:38 GMT
|
||||
RFC822TimeFormat = "Mon, 2 Jan 2006 15:04:05 GMT"
|
||||
RFC822TimeFormat = "Mon, 2 Jan 2006 15:04:05 GMT"
|
||||
rfc822TimeFormatSingleDigitDay = "Mon, _2 Jan 2006 15:04:05 GMT"
|
||||
rfc822TimeFormatSingleDigitDayTwoDigitYear = "Mon, _2 Jan 06 15:04:05 GMT"
|
||||
|
||||
// This format is used for output time without seconds precision
|
||||
RFC822OutputTimeFormat = "Mon, 02 Jan 2006 15:04:05 GMT"
|
||||
|
||||
// RFC3339 a subset of the ISO8601 timestamp format. e.g 2014-04-29T18:30:38Z
|
||||
ISO8601TimeFormat = "2006-01-02T15:04:05.999999999Z"
|
||||
ISO8601TimeFormat = "2006-01-02T15:04:05.999999999Z"
|
||||
iso8601TimeFormatNoZ = "2006-01-02T15:04:05.999999999"
|
||||
|
||||
// This format is used for output time with fractional second precision up to milliseconds
|
||||
ISO8601OutputTimeFormat = "2006-01-02T15:04:05.999999999Z"
|
||||
@@ -67,10 +72,21 @@ func FormatTime(name string, t time.Time) string {
|
||||
// the time if it was able to be parsed, and fails otherwise.
|
||||
func ParseTime(formatName, value string) (time.Time, error) {
|
||||
switch formatName {
|
||||
case RFC822TimeFormatName:
|
||||
return time.Parse(RFC822TimeFormat, value)
|
||||
case ISO8601TimeFormatName:
|
||||
return time.Parse(ISO8601TimeFormat, value)
|
||||
case RFC822TimeFormatName: // Smithy HTTPDate format
|
||||
return tryParse(value,
|
||||
RFC822TimeFormat,
|
||||
rfc822TimeFormatSingleDigitDay,
|
||||
rfc822TimeFormatSingleDigitDayTwoDigitYear,
|
||||
time.RFC850,
|
||||
time.ANSIC,
|
||||
)
|
||||
case ISO8601TimeFormatName: // Smithy DateTime format
|
||||
return tryParse(value,
|
||||
ISO8601TimeFormat,
|
||||
iso8601TimeFormatNoZ,
|
||||
time.RFC3339Nano,
|
||||
time.RFC3339,
|
||||
)
|
||||
case UnixTimeFormatName:
|
||||
v, err := strconv.ParseFloat(value, 64)
|
||||
_, dec := math.Modf(v)
|
||||
@@ -83,3 +99,36 @@ func ParseTime(formatName, value string) (time.Time, error) {
|
||||
panic("unknown timestamp format name, " + formatName)
|
||||
}
|
||||
}
|
||||
|
||||
func tryParse(v string, formats ...string) (time.Time, error) {
|
||||
var errs parseErrors
|
||||
for _, f := range formats {
|
||||
t, err := time.Parse(f, v)
|
||||
if err != nil {
|
||||
errs = append(errs, parseError{
|
||||
Format: f,
|
||||
Err: err,
|
||||
})
|
||||
continue
|
||||
}
|
||||
return t, nil
|
||||
}
|
||||
|
||||
return time.Time{}, fmt.Errorf("unable to parse time string, %v", errs)
|
||||
}
|
||||
|
||||
type parseErrors []parseError
|
||||
|
||||
func (es parseErrors) Error() string {
|
||||
var s bytes.Buffer
|
||||
for _, e := range es {
|
||||
fmt.Fprintf(&s, "\n * %q: %v", e.Format, e.Err)
|
||||
}
|
||||
|
||||
return "parse errors:" + s.String()
|
||||
}
|
||||
|
||||
type parseError struct {
|
||||
Format string
|
||||
Err error
|
||||
}
|
||||
|
Reference in New Issue
Block a user